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.

175 lines
6.5 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>001
/// <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 F001 : BP.WF.FlowEventBase
{
#region <20><><EFBFBD><EFBFBD>.
/// <summary>
/// <20><>д<EFBFBD><D0B4><EFBFBD>̱<EFBFBD><CCB1><EFBFBD>
/// </summary>
public override string FlowMark
{
get { return ",001,"; }
}
#endregion <20><><EFBFBD><EFBFBD>.
#region <20><><EFBFBD><EFBFBD>.
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
/// </summary>
public F001()
{
}
#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()
{
//<2F><><EFBFBD>صı<D8B5><C4B1><EFBFBD>,
// <20><>ǰ<EFBFBD>Ľڵ<C4BD>, <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> this.HisNode .
int nodeID = this.HisNode.NodeID; // int<6E><74><EFBFBD>͵<EFBFBD>ID.
string nodeName = this.HisNode.Name; // <20><>ǰ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>.
switch (nodeID)
{
case 102: //<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD>Ϲ<EFBFBD>,<2C><><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>׳<EFBFBD><D7B3>쳣..
string sql = "SELECT COUNT(*) FROM ND101Dtl1 WHERE RefPK=" + this.WorkID + " AND WorkSta!= 1 AND WorkSta!=4 ";
DBAccess.RunSQL("UPDATE ND201Dtl1 SET XTSta=1 WHERE REFPK=(SELECT PWORKID FROM ND1Rpt WHERE OID=" + this.WorkID +") AND XiangTiMingCheng = (SELECT XiangTiMingCheng FROM ND1Rpt WHERE OID = "+ this.WorkID + ")");
var num = DBAccess.RunSQLReturnValInt(sql);
if (num != 0)
throw new Exception("err@<40><><EFBFBD><EFBFBD>Ŀ<EFBFBD>С<EFBFBD>" + num + "<22><>û<EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD>ϸ񣬻<CFB8><F1A3ACBB><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD><DCB7>͡<EFBFBD>");
break;
case 103:
// 0=δ<><CEB4><EFBFBD><EFBFBD>. 1=<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. 2=<3D><><EFBFBD><EFBFBD>. 3=<3D><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>. 4=<3D><><EFBFBD>ɴ<EFBFBD><C9B4><EFBFBD><EFBFBD><EFBFBD>. 5=<3D><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>
/* 1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WorkSta=4<><34> <20>޸<EFBFBD>δ5 === <20><><EFBFBD><EFBFBD><EFBFBD>ɴ<EFBFBD><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>. */
DBAccess.RunSQL("UPDATE ND101Dtl1 SET WorkSta=3 WHERE WorkSta=4 AND RefPK=" + this.WorkID);
/* 2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WorkSta=2 <20><> <20>޸<EFBFBD>δ5 === <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>޸<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> */
DBAccess.RunSQL("UPDATE ND101Dtl1 SET WorkSta=3 WHERE WorkSta=2 AND RefPK=" + this.WorkID);
/* 3. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WorkSta=1 <20><> <20>޸<EFBFBD>δ3 ==== <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵģ<C9B5><C4A3><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>. */
DBAccess.RunSQL("UPDATE ND101Dtl1 SET WorkSta=3 WHERE WorkSta=1 AND RefPK=" + this.WorkID);
//<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD>Ϲ<EFBFBD>,<2C><><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>׳<EFBFBD><D7B3>쳣..
string sql3 = "SELECT COUNT(*) FROM ND101Dtl1 WHERE RefPK=" + this.WorkID + " AND WorkSta!= 3 ";
var num3 = DBAccess.RunSQLReturnValInt(sql3);
if (num3 != 0)
throw new Exception("err@<40><><EFBFBD><EFBFBD>Ŀ<EFBFBD>С<EFBFBD>" + num3 + "<22><>û<EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD>ϸ񣬻<CFB8><F1A3ACBB><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD><DCB7>͡<EFBFBD>");
break;
default:
break;
}
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>.
*/
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ㣬<DAB5><E3A3AC><EFBFBD>·<EFBFBD><C2B7><EFBFBD>.
if (this.HisNode.NodeID == 103)
{
// 0=δ<><CEB4><EFBFBD><EFBFBD>. 1=<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. 2=<3D><><EFBFBD><EFBFBD>. 3=<3D><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>. 4=<3D><><EFBFBD>ɴ<EFBFBD><C9B4><EFBFBD><EFBFBD><EFBFBD>. 5=<3D><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>
/* 1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WorkSta=4<><34> <20>޸<EFBFBD>δ5 === <20><><EFBFBD><EFBFBD><EFBFBD>ɴ<EFBFBD><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>. */
DBAccess.RunSQL("UPDATE ND101Dtl1 SET WorkSta=3 WHERE WorkSta=4 AND RefPK="+this.WorkID);
/* 2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WorkSta=2 <20><> <20>޸<EFBFBD>δ5 === <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>޸<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> */
DBAccess.RunSQL("UPDATE ND101Dtl1 SET WorkSta=3 WHERE WorkSta=2 AND RefPK=" + this.WorkID);
/* 3. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WorkSta=1 <20><> <20>޸<EFBFBD>δ3 ==== <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵģ<C9B5><C4A3><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>. */
DBAccess.RunSQL("UPDATE ND101Dtl1 SET WorkSta=3 WHERE WorkSta=1 AND RefPK=" + this.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);
}
}
/// <summary>
/// <20><><EFBFBD>̽<EFBFBD><CCBD><EFBFBD>֮<EFBFBD><D6AE>
/// </summary>
/// <returns></returns>
public override string FlowOverAfter()
{
GenerWorkFlow gwf = new GenerWorkFlow(this.WorkID);
//<2F><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><CCA3>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><CCA3>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD>ڵ㡣
string sql = "SELECT COUNT(*) from WF_GenerWorkFlow WHERE PWorkID=" + gwf.PWorkID + " AND WFState!=3 ";
int num = DBAccess.RunSQLReturnValInt(sql);
if (num > 0)
return ""; //˵<><CBB5><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>δ<EFBFBD><CEB4><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD>.
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD>ļල<C4BC><E0B6BD>Ա.
sql = "SELECT FK_Emp from WF_GenerWorkerList WHERE WorkID=" + gwf.PWorkID + " AND FK_Node=202 AND IsPass=0 ";
string worker = DBAccess.RunSQLReturnStringIsNull(sql, null);
if (worker == null)
throw new Exception("err@<40><>Ӧ<EFBFBD>ò<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>");
string currEmpNo = BP.Web.WebUser.No;
BP.WF.Dev2Interface.Port_Login(worker);
//<2F>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><CCA3>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD>ڵ<EFBFBD>.
BP.WF.Dev2Interface.Node_SendWork("002", gwf.PWorkID);
//<2F>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD>
BP.WF.Dev2Interface.Port_Login(currEmpNo);
return base.FlowOverAfter();
}
}
}