From 0a6224c1f057e83ed90b75d0c71286c30d8e01ab Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期三, 13 十二月 2023 00:11:32 +0800
Subject: [PATCH] 1
---
WebAPI/DLL/ClsSc_ICMOReportBill.cs | 220 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 218 insertions(+), 2 deletions(-)
diff --git a/WebAPI/DLL/ClsSc_ICMOReportBill.cs b/WebAPI/DLL/ClsSc_ICMOReportBill.cs
index 476118b..2db1745 100644
--- a/WebAPI/DLL/ClsSc_ICMOReportBill.cs
+++ b/WebAPI/DLL/ClsSc_ICMOReportBill.cs
@@ -3,6 +3,9 @@
using System.Text;
using System.Data;
using DBUtility;
+using Newtonsoft.Json.Linq;
+using Newtonsoft.Json;
+using WebAPI.Models;
namespace WebAPI.DLL
{
@@ -11,6 +14,8 @@
public Models.ClsSc_ICMOReportBillMain omodel = new Models.ClsSc_ICMOReportBillMain();
public Models.ClsSc_ICMOReportBillSub oSub = new Models.ClsSc_ICMOReportBillSub();
public List<Models.ClsSc_ICMOReportBillSub> DetailColl = new List<Models.ClsSc_ICMOReportBillSub>();
+ Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+ private json objJsonResult = new json();
public ClsSc_ICMOReportBill()
{
@@ -171,7 +176,7 @@
{
oCn.RunProc("Insert into Sc_ICMOReportBillSub " +
" (HInterID,HEntryID,HMaterID,HMaterNumber" +
- ",HQty,HUnitID,HUnitNumber,HTimes,HSourceID" +
+ ",HQty,HBadQty,HUnitID,HUnitNumber,HTimes,HSourceID" +
",HQtyMust,HWorkerID,HWorkerNumber,HBadCount,HWasterQty," +
"HCloseMan,HCloseType,HRemark," +
"HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
@@ -185,7 +190,7 @@
",HWhID,HSPID,HBatChNo,HAuxPropID,HMTONo,HPlanMode,HERPInterID,HERPEntryID" +
") values("
+ omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + ",'" + oSub.HMaterNumber + "'" +
- "," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HUnitNumber + "'," + oSub.HTimes.ToString() + "," + oSub.HSourceID.ToString() +
+ "," + oSub.HQty.ToString() + "," + oSub.HBadQty.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HUnitNumber + "'," + oSub.HTimes.ToString() + "," + oSub.HSourceID.ToString() +
"," + oSub.HQtyMust.ToString() + "," + oSub.HWorkerID.ToString() + ",'" + oSub.HWorkerNumber + "'," + oSub.HBadCount.ToString() + "," + oSub.HWasterQty.ToString() +
",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
"," + oSub.HSourceInterID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
@@ -331,6 +336,217 @@
oCn.BeginTran();
oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='2',HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString());
+ DataSet ds,Ds;
+ ds = oCn.RunProcReturn("select * from Sc_ICMOReportBillMain where HInterID = " + lngBillKey, "Sc_ICMOReportBillMain");
+ string HBillNo = "";
+
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+ }
+
+ Ds = oCn.RunProcReturn("exec h_p_Kf_GetICMOReportBill_ICMO_CLD_WorkQty " + lngBillKey.ToString() + ",'" + HBillNo + "'", "h_p_Kf_GetICMOReportBill_ICMO_CLD_WorkQty");
+
+ if (Ds == null || Ds.Tables[0].Rows.Count == 0 || Ds.Tables[1].Rows.Count == 0)
+ {
+ LogService.Write("鐢熶骇姹囨姤鍗曞鏍革紝鑾峰彇json瀛愯〃淇℃伅澶辫触");
+ oCn.RollBack();
+ return false;
+ }
+ else
+ {
+ LogService.Write("鑾峰彇json瀛愯〃淇℃伅鎴愬姛");
+ string sJson_ZYMESFLAG = ""; //鐢熶骇姹囨姤鍗曞悓姝ES鏍囪
+ sJson_ZYMESFLAG = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FHZYMESFLAG"]);
+
+ string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\"," +
+ "\"IsEntryBatchFill\":\"false\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," +
+ "\"Model\": { \"FBILLNO\":\"" + HBillNo + "\"," +
+ //"\"FID\":\"" + oMain.HInterID.ToString() + "\"," +
+ "\"FBillType\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillType"]) + "\"}," +
+ //\"FDocumentStatus\":\"\",
+ "\"FDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDate"]) + "\"," +
+ "\"FPRDORGID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FPRDORGID"]) + "\"}," +
+ //\"FWorkshipIdH\":{\"FNumber\":\"\"},
+ //\"FDescription\":\"\",
+ sJson_ZYMESFLAG +
+ "\"FEntity\": [ ";
+ string sJson_Entry = "";
+ for (int i = 0; i < Ds.Tables[1].Rows.Count; i++)
+ {
+ if (sJson_Entry != "")
+ {
+ sJson_Entry = sJson_Entry + " , ";
+ }
+ string sJson_BatchNo = "";
+ string sJson_StockPlace = "";
+ string sJson_EntryCustom = "";
+ if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HISBATCHMANAGE"]) == "1") //鏄惁鍚敤鎵规绠$悊
+ {
+ sJson_BatchNo = " \"FLOT\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\"}, \"FLOT_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\" , ";
+ }
+ else
+ {
+ sJson_BatchNo = "";
+ }
+ //浠撲綅
+ if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKLOCID"]) == "")
+ {
+ sJson_StockPlace = "";
+ }
+ else
+ {
+ sJson_StockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKLOCID"]) + "\"}},";
+ }
+
+ //鑷畾涔夊瓧娈靛鐞�
+ if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤
+ {
+ sJson_EntryCustom = "\"FBILLSTATUS\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBILLSTATUS"]) + "\"," + //鍗曟嵁鐘舵��
+ "\"F_abcd_Datetime\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["F_abcd_Datetime"]) + "\","; //璁″垝寮�宸ユ棩鏈�
+ }
+ //
+ sJson_Entry = sJson_Entry + " {" +
+ //" \"FEntryID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HEntryID"]) + "," +
+ " \"FSRCENTRYID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCENTRYID"]) + "," +
+ " \"FIsNew\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FIsNew"]) + "," +
+ " \"FMATERIALID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMATERIALID"]) + "\"}," +
+ " \"FPRODUCTTYPE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPRODUCTTYPE"]) + "\"," +
+ " \"FREPORTTYPE\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREPORTTYPE"]) + "\"}," +
+ " \"FUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUNITID"]) + "\"}," +
+ " \"FWORKSHIPID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FWORKSHOPID"]) + "\"}," +
+ //\"FShiftGroupId\":{\"FNumber\":\"\"},
+ sJson_BatchNo +
+ //\"FDeptId\":{\"FNumber\":\"\"},
+ sJson_StockPlace +
+ " \"FMTONO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMTONO"]) + "\"," +
+ " \"FCHECKPRODUCT\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCHECKPRODUCT"]) + "," +
+ " \"FISENTRUST\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISENTRUST"]) + "," +
+ " \"FSRCBILLTYPE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLTYPE"]) + "\"," +
+ " \"FMOBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMOBILLNO"]) + "\"," +
+ " \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}}," +
+ //\"FHumanQty\":\"0\",
+ " \"FSRCBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLNO"]) + "\"," +
+ //\"FMachineQty\":\"0\",
+ //\"FMaterialUnitID\":{\"FNumber\":\"\"},
+ //\"FStartTime\":\"1900-01-01\",
+ //\"FEndTime\":\"1900-01-01\",
+ //\"FTimeUnitId\":\"\",
+ " \"FMOENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMOENTRYSEQ"]) + "," +
+ //" \"FSTANDHOURUNITID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTANDHOURUNITID"]) + "\"," +
+ " \"FPROJECTNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPROJECTNO"]) + "\"," +
+ " \"FSTDMANHOUR\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTDMANHOUR"]) + "," +
+ " \"FHRPREPARETIME\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FHRPREPARETIME"]) + "," +
+ //\"FHrWorkTime\":\"0\",
+ " \"FMACPREPARETIME\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMACPREPARETIME"]) + "," +
+ //\"FMacWorkTime\":\"0\",
+ //\"FDescriptionE\":\"\",
+ " \"FSRCINTERID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCINTERID"]) + "," +
+ " \"FSRCENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCENTRYSEQ"]) + "," +
+ " \"FMOID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMOID"]) + "," +
+ " \"FMOENTRYID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMOENTRYID"]) + "," +
+ " \"FBASEUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBASEUNITID"]) + "\"}," +
+ " \"FSTOCKINORGID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKINORGID"]) + "\"}," +
+ " \"FBOMID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBOMID"]) + "\"}," +
+ " \"FOWNERTYPEID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOWNERTYPEID"]) + "\"," +
+ " \"FOWNERID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOWNERID"]) + "\"}," +
+ " \"FSTOCKID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKID"]) + "\"}," +
+ " \"FCOSTRATE\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCOSTRATE"]) + "," +
+ " \"FSNUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSNUNITID"]) + "\"}," +
+ //\"FSNQty\":\"0\",
+ //\"FProduceDate\":\"1900-01-01\",
+ //\"FExpiryDate\":\"1900-01-01\",
+ " \"FISBACKFLUSH\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISBACKFLUSH"]) + "," +
+ " \"FMOMAINENTRYID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMOMAINENTRYID"]) + "," +
+ " \"FQAIP\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FQAIP"]) + "\"," +
+ " \"FREQSRC\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREQSRC"]) + "\"," +
+ " \"FREQBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREQBILLNO"]) + "\"," +
+ " \"FREQBILLID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREQBILLID"]) + "," +
+ " \"FREQENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREQENTRYSEQ"]) + "," +
+ " \"FREQENTRYID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREQENTRYID"]) + "," +
+ " \"FBASEQUAQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBASEQUAQTY"]) + "," +
+ " \"FQUAQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FQUAQTY"]) + "," +
+ " \"FBASEFINISHQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBASEFINISHQTY"]) + "," +
+ " \"FFINISHQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FFINISHQTY"]) + "," +
+ sJson_EntryCustom +
+
+ //\"FSerialSubEntity\":[{\"FDetailID\":\"0\",
+ //\"FQCMaterialId\":{\"FNUMBER\":\"\"},
+ //\"FInspectResult\":\"\",
+ //\"FQcAuxPropId\":{\"FQCAUXPROPID__FF100002\":{\"FNumber\":\"\"}},
+ //\"FQCQty\":\"0\",
+ //\"FSerialNo\":\"\",
+ //\"FSerialId\":{\"FNUMBER\":\"\"},
+ //\"FQCStockInSelQty\":\"0\",
+ //\"FSerialNote\":\"\",
+ //\"FBaseQCQty\":\"0\",
+ //\"FBaseQCStockInSelQty\":\"0\"}]
+
+ " \"FEntity_Link\": [{" +
+ " \"FEntity_Link_FFlowId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowId"]) + "\"," +
+ " \"FEntity_Link_FFlowLineId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowLineId"]) + "\"," +
+ " \"FEntity_Link_FRuleId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FRuleId"]) + "\"," +
+ " \"FEntity_Link_FSTableName\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSTableName"]) + "\"," +
+ " \"FEntity_Link_FSBillId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSBillId"]) + "\"," +
+ " \"FEntity_Link_FSId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSId"]) + "\"" +
+ " } ]," +
+ " \"FBFLOWID\":{\"FID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBFLOWID"]) + "\"}}";
+ }
+ string sJson_End = " ] }}";
+ string sJson = sJson_Main + sJson_Entry + sJson_End;
+
+ //浠庨厤缃枃浠惰幏鍙� CLOUD缃戝潃銆佽处濂椾俊鎭�佺櫥褰曠敤鎴枫�佺櫥褰曞瘑鐮�
+ if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo))
+ {
+ LogService.Write("鐢熶骇姹囨姤鍗曞鏍革紝鍚屾鑾峰彇鐧诲綍璐﹀彿瀵嗙爜澶辫触");
+
+ return false;
+ }
+
+ var loginRet = InvokeHelper.Login();
+ var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
+ if (isSuccess == 0)
+ {
+ oCn.RollBack();
+ return false;
+ }
+ else
+ {
+ LogService.Write("寮�濮嬭皟鐢ㄤ繚瀛樻柟娉�");
+ string result = InvokeHelper.Save("PRD_MORPT", JsonConvert.SerializeObject(sJson));//淇濆瓨
+
+ if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
+ {
+ LogService.Write("鐢熶骇姹囨姤閿欒jsonRoot:" + sJson);
+ oCn.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = $"鐢熶骇姹囨姤鍗曞悓姝ラ噾铦朵簯澶辫触锛佸崟鍙�:{HBillNo.ToString()}" + result + sJson;
+ objJsonResult.data = null;
+ return false;
+ }
+
+ //鎻愪氦瀹℃牳
+ string result1 = string.Empty;
+ string result2 = string.Empty;
+ if (oSystemParameter.omodel.Sc_ICMOReportBill_AutoCheck == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳
+ {
+ result1 = InvokeHelper.Submit("PRD_MORPT", JsonConvert.SerializeObject(sJson));//鎻愪氦
+ result2 = InvokeHelper.Audit("PRD_MORPT", JsonConvert.SerializeObject(sJson));//瀹℃牳
+
+ if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
+ {
+ oCn.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = $"鐢熶骇姹囨姤鍗曞崟鍙凤細{HBillNo}锛屾彁浜ゅけ璐�" + result;
+ objJsonResult.data = null;
+ return false;
+ }
+ }
+ }
+ }
+
sReturn = "瀹℃牳鍗曟嵁鎴愬姛锛�";
oCn.Commit();
--
Gitblit v1.9.1