using SuperMap.RealEstate.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SuperMap.RealEstate.WorkFlow.Instance;
using Running = SuperMap.RealEstate.HighWay.Running;
using Storage = SuperMap.RealEstate.HighWay.Running;
namespace SuperMap.RealEstate.HighWay.Plugins.Cloud
{
///
public class HighWayProInst : IWorkFlowProInstDataAction, IWorkFlowActInstDataAction
{
//商品审批
ProInst_100100 _ProInst_100100 = null;
ProInst_100200 _ProInst_100200 = null;
///
public string ErrorString
{
get;
set;
}
///
/// 办结
///
///
///
public bool EndProcess(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst WorkFlowProInst)
{
bool Flag = true;
string _ErrorString = "";
Running.Business.HIGHWAYPROINST _HIGHWAYPROINST = GetPropertyProinst(WorkFlowProInst);
DeleteCommonInfo(_HIGHWAYPROINST);
switch (WorkFlowProInst.Operation_Type_BaseValue)
{
case 100100:
#region 商品价格审批
Flag = false;
_ProInst_100100 = new ProInst_100100(_HIGHWAYPROINST);
Flag = _ProInst_100100.EndProcess(WorkFlowProInst, out _ErrorString);
ErrorString += _ErrorString;
break;
#endregion
case 100200:
#region 商品调价审批
Flag = false;
_ProInst_100200 = new ProInst_100200(_HIGHWAYPROINST);
Flag = _ProInst_100200.EndProcess(WorkFlowProInst, out _ErrorString);
ErrorString += _ErrorString;
break;
#endregion
default:
throw new Exception("Plugins尚未配置");
}
return Flag;
}
///
/// 驳回
///
///
///
public bool FallBackRunning(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst WorkFlowProInst)
{
throw new NotImplementedException();
}
///
/// 入库
///
///
///
public bool PutInStorage(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst WorkFlowProInst)
{
bool Flag = true;
string _ErrorString = "";
Running.Business.HIGHWAYPROINST _HIGHWAYPROINST = GetPropertyProinst(WorkFlowProInst);
PutInStorageCommonInfo(_HIGHWAYPROINST);
switch (WorkFlowProInst.Operation_Type_BaseValue)
{
case 100100:
#region 商品价格审批
Flag = false;
_ProInst_100100 = new ProInst_100100(_HIGHWAYPROINST);
Flag = _ProInst_100100.PutInStorage(WorkFlowProInst, out _ErrorString);
ErrorString += _ErrorString;
break;
#endregion
case 100200:
#region 商品调价审批
Flag = false;
_ProInst_100200 = new ProInst_100200(_HIGHWAYPROINST);
Flag = _ProInst_100200.PutInStorage(WorkFlowProInst, out _ErrorString);
ErrorString += _ErrorString;
break;
#endregion
default:
throw new Exception("Plugins尚未配置");
}
return Flag;
}
///
/// 流程删除
///
///
///
public bool DeleteProcess(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst WorkFlowProInst)
{
bool Flag = false;
string _ErrorString = "";
Running.Business.HIGHWAYPROINST _HIGHWAYPROINST = GetPropertyProinst(WorkFlowProInst);
DeleteCommonInfo(_HIGHWAYPROINST);
switch (WorkFlowProInst.Operation_Type_BaseValue)
{
case 100100:
#region 商品价格审批
Flag = false;
_ProInst_100100 = new ProInst_100100(_HIGHWAYPROINST);
Flag = _ProInst_100100.DeleteProcess(WorkFlowProInst, out _ErrorString);
ErrorString += _ErrorString;
break;
#endregion
case 100200:
#region 商品调价审批
Flag = false;
_ProInst_100200 = new ProInst_100200(_HIGHWAYPROINST);
Flag = _ProInst_100200.DeleteProcess(WorkFlowProInst, out _ErrorString);
ErrorString += _ErrorString;
break;
#endregion
default:
throw new Exception("Plugins尚未配置");
}
return Flag;
}
///
public void DeleteCommonInfo(Running.Business.HIGHWAYPROINST _HIGHWAYPROINST)
{
//删除审批信息
foreach (Running.Business.APPROVED _APPROVED in _HIGHWAYPROINST.ApprovedCollection)
{
_APPROVED.Delete();
}
////删除申请人信息
//foreach (Running.Business.Proposer _Proposer in _PropertyProinst.ProposerCollection)
// _Proposer.Delete();
}
///
public void PutInStorageCommonInfo(Running.Business.HIGHWAYPROINST _HIGHWAYPROINST)
{
Storage.Business.APPROVED StorageApproved = null;
foreach (Running.Business.APPROVED _Approved in _HIGHWAYPROINST.ApprovedCollection)
{
StorageApproved = new Storage.Business.APPROVED(_HIGHWAYPROINST.Transaction);
StorageApproved.APPROVED_ID = _Approved.APPROVED_ID;
if (StorageApproved.Select())
{
StorageApproved.Delete();
StorageApproved.ResetProperty();
}
StorageApproved.CopyFrom(_Approved);
StorageApproved.Insert();
}
//foreach (Running.Business.Proposer _Proposer in _PropertyProinst.ProposerCollection)
//{
// StorageProposer = new Storage.Business.Proposer(_PropertyProinst.Transaction);
// StorageProposer.CopyFrom(_Proposer);
// StorageProposer.Insert();
//}
}
///
/// 获取当前流程信息
///
///
///
public Running.Business.HIGHWAYPROINST GetPropertyProinst(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst WorkFlowProInst)
{
Running.Business.HIGHWAYPROINST _PropertyProinst = new Running.Business.HIGHWAYPROINST(WorkFlowProInst.Transaction);
_PropertyProinst.AddSearchParameter("proinst_id", WorkFlowProInst.ProInst_ID);
if (_PropertyProinst.Search())
return _PropertyProinst;
else
{
throw new Exception("无法获取ProInst实例对象!");
}
}
#region 流转
///
public bool OverRuled(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst ProInst)
{
return true;
}
///
public bool OverRuling(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst ProInst)
{
return true;
}
///
public bool Transfered(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst ProInst)
{
return true;
}
///
public bool Transferring(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst ProInst)
{
return true;
}
///
public bool TurnOvered(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst ProInst)
{
return true;
}
///
public bool TurnOvering(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst ProInst)
{
return true;
}
#endregion
}
}