|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using BP.DA;
|
|
|
|
|
using BP.Sys;
|
|
|
|
|
using BP.Port;
|
|
|
|
|
|
|
|
|
|
namespace CCFlow.App
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// YuTong 的摘要说明
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class YuTong : IHttpHandler
|
|
|
|
|
{
|
|
|
|
|
#region 基本属性.
|
|
|
|
|
public HttpContext context = null;
|
|
|
|
|
public string DoType
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return context.Request.QueryString["DoType"];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public string Key
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return context.Request.QueryString["Key"];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public string FK_Flow
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return context.Request.QueryString["FK_Flow"];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public string FK_Node
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return context.Request.QueryString["FK_Node"];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public Int64 WorkID
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Int64.Parse(context.Request.QueryString["OID"]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion 基本属性.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void ProcessRequest(HttpContext contextPara)
|
|
|
|
|
{
|
|
|
|
|
contextPara.Response.ContentType = "text/plain";
|
|
|
|
|
context = contextPara;
|
|
|
|
|
|
|
|
|
|
string str = null;
|
|
|
|
|
switch (this.DoType)
|
|
|
|
|
{
|
|
|
|
|
case "FlowOver029": //订单评审流程结束的时候写入数据.
|
|
|
|
|
str = FlowOver029();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (str != null)
|
|
|
|
|
{
|
|
|
|
|
contextPara.Response.Write(str);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 数据填充029
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string FlowOver029()
|
|
|
|
|
{
|
|
|
|
|
//获得主表的数据,并求出billNo.
|
|
|
|
|
GEEntity en = new GEEntity("Frm_KeHuDingShan", this.WorkID);
|
|
|
|
|
string billNo = en.GetValStringByKey("BillNo");
|
|
|
|
|
if (billNo == null)
|
|
|
|
|
return "err@订单编号没有找到.";
|
|
|
|
|
|
|
|
|
|
//创建数据源.
|
|
|
|
|
SFDBSrc dbsrc = new SFDBSrc("Oracle21");
|
|
|
|
|
|
|
|
|
|
#region 删除对方的数据.
|
|
|
|
|
string sql = "";
|
|
|
|
|
//首先查询订单单号是否存在, 在对方的系统里.
|
|
|
|
|
//如果已经存在,就删除. sz028.oea_file 主表 sz028.OEB_FILE 从表
|
|
|
|
|
sql = "DELETE FROM sz028.oea_file WHERE OEA01='" + billNo + "'";
|
|
|
|
|
dbsrc.RunSQL(sql);
|
|
|
|
|
sql = "DELETE FROM sz028.OEB_FILE WHERE OEB01='" + billNo + "'";
|
|
|
|
|
dbsrc.RunSQL(sql);
|
|
|
|
|
#endregion 删除对方的数据.
|
|
|
|
|
sql = "select concat( concat('2201-',to_char(sysdate,'yyMM')),LPAD(NVL(MAX(SUBSTR(oea01,10)),0)+1,5,'0')) as NewOrderId from sz028.oea_file WHERE oea01 like concat(concat('2201-',to_char(sysdate, 'yyMM')),'%')";
|
|
|
|
|
string newid = dbsrc.RunSQLReturnString(sql);
|
|
|
|
|
|
|
|
|
|
sql = "update Frm_KeHuDingShan set ERPDingShanHao='" + newid+"' WHERE OID="+this.WorkID;
|
|
|
|
|
DBAccess.RunSQL(sql);
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//执行主表的插入.
|
|
|
|
|
sql = "INSERT INTO sz028.oea_file ";
|
|
|
|
|
sql += "(OEA00,OEA01,OEA02,oea09,oea03,oea032,oea04,oea12,OEA61,OEA62,OEA63,oea10)";
|
|
|
|
|
sql += "VALUES ( ";
|
|
|
|
|
sql += " '1' ,";//OEA00
|
|
|
|
|
// sql += " '" + en.GetValStringByKey("BillNo") + "',"; // OEA01=单据编号.
|
|
|
|
|
sql += " '" + newid + "',"; // OEA01=单据编号.
|
|
|
|
|
sql += " " + GenerToData(en.GetValStringByKey("DingShanRiQi")) + ",";//OEA02
|
|
|
|
|
sql += " '0' ,";//oea09
|
|
|
|
|
sql += " '" + en.GetValStringByKey("KeHuBianHao") + "',"; //oea03
|
|
|
|
|
sql += " '" + en.GetValStringByKey("KHMC") + "',";//oea032
|
|
|
|
|
sql += " '" + en.GetValStringByKey("KeHuBianHao") + "',";//oea04
|
|
|
|
|
sql += " '" + newid + "',"; // OEA12=单据编号.
|
|
|
|
|
sql += " '0' ,"; //OEA61
|
|
|
|
|
sql += " '0' ,";
|
|
|
|
|
sql += " '0' ,";
|
|
|
|
|
sql += " '" + en.GetValStringByKey("KeHuDingShanHao") + "'";
|
|
|
|
|
|
|
|
|
|
sql += " ) ";
|
|
|
|
|
dbsrc.RunSQL(sql);
|
|
|
|
|
|
|
|
|
|
//获得从表的数据.
|
|
|
|
|
GEDtls dtls = new GEDtls("Frm_KeHuDingShanDtl1");
|
|
|
|
|
dtls.Retrieve("RefPK", this.WorkID);
|
|
|
|
|
//执行从表的插入.
|
|
|
|
|
int i = 1;
|
|
|
|
|
foreach (GEDtl dtl in dtls)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//执行从表的插入.
|
|
|
|
|
sql = "INSERT INTO sz028.OEB_FILE ";
|
|
|
|
|
sql += "(oeb01,oeb04,OEB03,OEB05_FAC,OEB12,OEB13,OEB14,OEB14T,OEB23,OEB24,OEB25,OEB26)";
|
|
|
|
|
sql += "VALUES ( ";
|
|
|
|
|
sql += " '" + newid + "',";
|
|
|
|
|
sql += " '" + dtl.GetValByKey("liaoHao") + "',";
|
|
|
|
|
sql += " '" + i + "',";
|
|
|
|
|
sql += " '0' ,";
|
|
|
|
|
sql += " '0' ,";
|
|
|
|
|
sql += " '0' ,";
|
|
|
|
|
sql += " '0' ,";
|
|
|
|
|
sql += " '0' ,";
|
|
|
|
|
sql += " '0' ,";
|
|
|
|
|
sql += " '0' ,";
|
|
|
|
|
sql += " '0' ,";
|
|
|
|
|
sql += " '0' ";
|
|
|
|
|
//sql += " '" + en.GetValStringByKey("Rec") + "',";
|
|
|
|
|
//sql += " '" + en.GetValStringByKey("Re11c") + "'";
|
|
|
|
|
sql += " ) ";
|
|
|
|
|
i++;
|
|
|
|
|
dbsrc.RunSQL(sql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//BP.WF.GenerWorkFlow gwf = new BP.WF.GenerWorkFlow(this.WorkID);
|
|
|
|
|
//让发起人登录.
|
|
|
|
|
//BP.WF.Dev2Interface.Port_Login(gwf.Starter, null, gwf.OrgNo);
|
|
|
|
|
//BP.WF.Dev2Interface.Flow_DoFlowOver(this.WorkID, "写入成功");
|
|
|
|
|
|
|
|
|
|
return "info@数据写入成功.";
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//删除已经插入的数据..
|
|
|
|
|
sql = "DELETE FROM sz028.oea_file WHERE OEA01='" + billNo + "'";
|
|
|
|
|
dbsrc.RunSQL(sql);
|
|
|
|
|
|
|
|
|
|
//删除已经插入的数据,
|
|
|
|
|
sql = "DELETE FROM sz028.OEB_FILE WHERE oeb01='" + billNo + "'";
|
|
|
|
|
dbsrc.RunSQL(sql);
|
|
|
|
|
return "err@执行错误." + ex.Message;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public string GenerToData(string val)
|
|
|
|
|
{
|
|
|
|
|
string str = " to_date('" + val + "', 'yyyy-mm-dd ')";
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsReusable
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|