You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

196 lines
6.4 KiB
Plaintext

11 months ago
using System;
using System.Threading;
using System.Collections;
using System.Data;
using BP.DA;
using BP.DTS;
using BP.En;
using BP.Web;
using BP.Sys;
using BP.WF;
namespace BP.MES
{
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>002
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵽 BP.*.dll <20><><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
public class F002 : BP.WF.FlowEventBase
{
#region <20><><EFBFBD><EFBFBD>.
/// <summary>
/// <20><>д<EFBFBD><D0B4><EFBFBD>̱<EFBFBD><CCB1><EFBFBD>
/// </summary>
public override string FlowMark
{
get { return ",002,"; }
}
#endregion <20><><EFBFBD><EFBFBD>.
#region <20><><EFBFBD><EFBFBD>.
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
/// </summary>
public F002()
{
}
#endregion <20><><EFBFBD><EFBFBD>.
#region <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>.
/// <summary>
/// <20><>д<EFBFBD><D0B4><EFBFBD><EFBFBD>ǰ<EFBFBD>¼<EFBFBD>
/// </summary>
/// <returns></returns>
public override string SendWhen()
{
if (this.HisNode.NodeID == 201)
{
DBAccess.RunSQL("UPDATE ND201Dtl1 SET XTSta=1 WHERE RefPK=(select PWorkID from ND1Rpt WHERE OID=" + this.WorkID + ")");
}
if (this.HisNode.NodeID == 202)
{
DBAccess.RunSQL("UPDATE ND201Dtl1 SET XTSta=2 WHERE RefPK=(select PWorkID from ND1Rpt WHERE OID=" + this.WorkID + ")");
}
if (this.HisNode.NodeID == 203)
{
DBAccess.RunSQL("UPDATE ND201Dtl1 SET XTSta=3 WHERE RefPK=" + this.WorkID );
}
if (this.HisNode.NodeID == 204)
{
// DBAccess.RunSQL("UPDATE ND201Dtl1 SET XTSta=4 WHERE XTSta=3 AND RefPK=" + this.WorkID);
}
return null;
}
#endregion <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>.
/// <summary>
/// <20><><EFBFBD>ͳɹ<CDB3><C9B9>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳɹ<CDB3>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵Ĵ<CCB5><C4B4><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>.
/// </summary>
/// <returns><3E><><EFBFBD><EFBFBD>ִ<EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>null<6C>Ͳ<EFBFBD><CDB2><EFBFBD>ʾ<EFBFBD><CABE></returns>
public override string SendSuccess()
{
try
{
// <20><>֯<EFBFBD><D6AF>Ҫ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>.
Int64 workid = this.WorkID; // <20><><EFBFBD><EFBFBD>id.w
string flowNo = this.HisNode.FK_Flow; // <20><><EFBFBD>̱<EFBFBD><CCB1><EFBFBD>.
int currNodeID = this.SendReturnObjs.VarCurrNodeID; //<2F><>ǰ<EFBFBD>ڵ<EFBFBD>id
int toNodeID = this.SendReturnObjs.VarToNodeID; //<2F><><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>id.
string toNodeName = this.SendReturnObjs.VarToNodeName; // <20><><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>ơ<EFBFBD>
string acceptersID = this.SendReturnObjs.VarAcceptersID; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Աid, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD> <20><><EFBFBD>ŷֿ<C5B7> ,<2C><><EFBFBD><EFBFBD> zhangsan,lisi<73><69>
string acceptersName = this.SendReturnObjs.VarAcceptersName; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ö<EFBFBD><C3B6>ŷֿ<C5B7><D6BF><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>.
//ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳд<CDB3><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
/*
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>д<EFBFBD><D0B4><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>߼<EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֯<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>.
*/
if (this.HisNode.NodeID == 201)
{
StartSubFlows();
DBAccess.RunSQL("UPDATE WF_GenerWorkerlist SET IsEnable=0 WHERE FK_Node !=201 and WorkID= " + workid);
}
if (this.HisNode.NodeID == 203)
DBAccess.RunSQL("UPDATE WF_GenerWorkerlist SET IsEnable = 0 WHERE FK_Node = 204 and WorkID= " + workid);
//<2F><><EFBFBD><EFBFBD>.
return base.SendSuccess();
}
catch (Exception ex)
{
return base.SendSuccess();
// throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳд<CDB3><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2>"+ex.Message);
}
}
public void StartSubFlows()
{
//<2F><><EFBFBD><EFBFBD>֮ǰ<D6AE><C7B0>ɾ<EFBFBD><C9BE><EFBFBD>п<EFBFBD><D0BF>ܴ<EFBFBD><DCB4>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
GenerWorkFlows gwfs = new GenerWorkFlows();
gwfs.Retrieve(GenerWorkFlowAttr.PWorkID, this.WorkID);
foreach (GenerWorkFlow item in gwfs)
{
BP.WF.Dev2Interface.Flow_DoDeleteFlowByReal(item.WorkID);
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6>ٸ<EFBFBD><D9B8><EFBFBD><EFBFBD><EFBFBD>.
ND201Dtl1s dtls = new ND201Dtl1s();
dtls.Retrieve(ND201Dtl1Attr.RefPK, this.WorkID);
//<2F><>ǰʵ<C7B0><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
ND2Rpt rpt002 = new ND2Rpt(this.WorkID);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>壬.
foreach (ND201Dtl1 item in dtls)
{
int i=item.Row.Count;
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>հ׵<D5B0>workid.
Int64 workid = BP.WF.Dev2Interface.Node_CreateBlankWork("001", BP.Web.WebUser.No);
//ִ<>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
ND1Rpt rpt001 = new ND1Rpt(workid);
//<2F>Ѷ<EFBFBD><D1B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶΣ<D6B6><CEA3><EFBFBD><EFBFBD><EFBFBD><EBB5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ.
rpt001.SetValByKey("DingDanHao", rpt002.GetValByKey("DingDanHao")); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
rpt001.SetValByKey("PrjName", rpt002.GetValByKey("PrjName")); //<2F><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>
rpt001.SetValByKey("KeHuMingCheng", rpt002.GetValByKey("KeHuMingCheng")); //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
rpt001.SetValByKey("QiXianXianDing", rpt002.GetValByKey("QiXianXianDing")); //<2F><><EFBFBD><EFBFBD><EFBFBD>޶<EFBFBD>
rpt001.SetValByKey("JJCD", rpt002.GetValByKey("JJCD")); //<2F><><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>д<EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ.
rpt001.SetValByKey("XiangTiMingCheng", item.GetValByKey("XiangTiMingCheng")); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
rpt001.SetValByKey("TuZhiBianHao", item.GetValByKey("TuZhiBianHao")); //ͼֽ<CDBC><D6BD><EFBFBD><EFBFBD>.
rpt001.SetValByKey("TuZhiZhiTuRen", item.GetValByKey("TuZhiZhiTuRen")); //ͼֽ<CDBC><D6BD>ͼ<EFBFBD><CDBC>.
//rpt001.SetValByKey("QiXianXianDing", item.GetValByKey("QiXianXianDing")); //<2F><><EFBFBD><EFBFBD><EFBFBD>޶<EFBFBD>.
//rpt001.SetValByKey("JJCD", item.GetValByKey("JJCD")); //<2F><><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD>.
rpt001.Update();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD>ϵ<EFBFBD>.
ND201Dtl1Dtl1s dtl1s = new ND201Dtl1Dtl1s();
dtl1s.Retrieve(ND201Dtl1Dtl1Attr.RefPK, item.OID);
//<2F><>װ<EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>copy<70><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ.
ND101Dtl1 dtl101 = new ND101Dtl1();
foreach (ND201Dtl1Dtl1 dtl1 in dtl1s)
{
dtl101.Row = dtl1.Row;
dtl101.RefPK = workid;
dtl101.InsertAsOID(dtl1.OID);
}
//ִ<>з<EFBFBD><D0B7><EFBFBD>.
BP.WF.Dev2Interface.Node_SendWork("001", workid);
//<2F><><EFBFBD>ø<EFBFBD><C3B8>ӹ<EFBFBD>ϵ.
BP.WF.Dev2Interface.SetParentInfo("001", workid, this.WorkID, BP.Web.WebUser.No, 202, false);
//BP.WF.Dev2Interface.Node_SetDraft2Todolist("001", workid);
}
}
}
}