| | |
| | | |
| | | //生成生产汇报单 |
| | | [WebMethod] |
| | | public bool set_SaveICMOProductReportBill_Layui(Model.ClsSc_ICMOReportBillMain oMain, string sHSourceType, ref string sErrMsg) |
| | | public bool set_SaveICMOProductReportBill_Layui(Model.ClsSc_ICMOReportBillMain oMain, string workcode, int HSourceID, string sHSourceType, ref string sErrMsg) |
| | | { |
| | | //获取系统参数 |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | |
| | | } |
| | | if (oSystemParameter.omodel.Sc_ICMOReportBill_ERPMode.ToUpper() == "CLOUD") //判断同步模式是金蝶CLOUD |
| | | { |
| | | if (set_SaveICMOProductReportBill_CLD_Layui(oMain, sHSourceType, oSystemParameter.omodel, ref sErrMsg) == true) |
| | | if (set_SaveICMOProductReportBill_CLD_Layui(oMain, workcode,HSourceID, sHSourceType, oSystemParameter.omodel, ref sErrMsg) == true) |
| | | { |
| | | //"保存成功!"; |
| | | return true; |
| | |
| | | |
| | | //生成生产汇报单 |
| | | [WebMethod] |
| | | public bool set_SaveICMOProductReportBill_CLD_Layui(Model.ClsSc_ICMOReportBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | public bool set_SaveICMOProductReportBill_CLD_Layui(Model.ClsSc_ICMOReportBillMain oMain,string workcode,int HSourceID, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | //if (sHSourceType == "3710") //源单:生产订单 |
| | | //{ |
| | | if (SaveICMOProductReportBill_ICMO_CLD_Layui(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | if (SaveICMOProductReportBill_ICMO_CLD_Layui(oMain, workcode, HSourceID, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | sErrMsg = "保存成功!" + oMain.HBillNo + ";" + sErrMsg; |
| | |
| | | /// <param name="oMain"></param> |
| | | /// <param name="sErrMsg"></param> |
| | | /// <returns></returns> |
| | | public bool SaveICMOProductReportBill_ICMO_CLD_Layui(Model.ClsSc_ICMOReportBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | public bool SaveICMOProductReportBill_ICMO_CLD_Layui(Model.ClsSc_ICMOReportBillMain oMain,string workcode,int HSourceID, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //建立一个 事务; |
| | | try |
| | |
| | | //写入WMS生产汇报单 |
| | | oCn.BeginTran(); |
| | | |
| | | //根据单号、资源ID、订单主ID、订单子ID、制单人过滤产量汇报报检申请提交数据 |
| | | string sql = string.Format(@"update Sc_ICMOBillWorkQtyStatus_Tmp set |
| | | HICMOReportInterID ='" + oMain.HInterID + "', HICMOReportBillNo='" + oMain.HBillNo + "' from Sc_ICMOBillWorkQtyStatus_Tmp a where a.HICMOBillNo='" + workcode + "' and a.HSourceID='" + HSourceID + "' and HICMOInterID='" + oMain.HMainSourceInterID + "' and a.HICMOEntryID='" + oMain.HMainSourceEntryID + "' and a.HMaker='" + oMain.HMaker + "' and HRelationInterID='0'"); |
| | | oCn.RunProc(sql); |
| | | |
| | | //根据生产订单号查询生产订单表,拿到组织、车间 |
| | | DataSet ds0 = oCn.RunProcReturn("select HPRDORGID,HDeptID from Sc_ICMOBillMain with(nolock) where HBillNo='" + workcode + "'", "Sc_ICMOBillMain"); |
| | | |
| | | //查询产量汇报临时表 |
| | | DataSet ds = oCn.RunProcReturn("select top 1 * from Sc_ICMOBillWorkQtyStatus_Tmp with(nolock) where HICMOReportInterID='" + oMain.HInterID + "' and HICMOReportBillNo='" + oMain.HBillNo + "'", "Sc_ICMOBillWorkQtyStatus_Tmp"); |
| | | if (ds.Tables[0].Rows.Count <= 0) |
| | | { |
| | | sErrMsg = "当前单据无产量汇报记录!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | oMain.HGroupID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HGroupID"]); |
| | | oMain.HDeptID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HDeptID"]); |
| | | oMain.HPRDORGID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HPRDORGID"]); |
| | | //插入子表 |
| | | oCn.RunProc("exec h_p_Sc_ICMOReportBillSub_Insert_WorkQty " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + sHSourceType + "'"); |
| | | //插入主表 |
| | |
| | | if (bLogin) |
| | | { |
| | | var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", |
| | | new object[] { "PRD_MORPT", sJson },null,30000); //调用保存方式 |
| | | new object[] { "PRD_MORPT", sJson }); //调用保存方式 |
| | | |
| | | if (oSystemParameterMain.Sc_ICMOReportBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "PRD_MORPT", sJson2 }, null, 30000); //提交单据 |
| | | new object[] { "PRD_MORPT", sJson2 }); //提交单据 |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "PRD_MORPT", sJson3 }, null, 30000); //审核单据 |
| | | new object[] { "PRD_MORPT", sJson3 }); //审核单据 |
| | | |
| | | HReturn = result.ToString() + "," + result2.ToString() + "," + result3.ToString(); |
| | | |