From 5ce30510e4067a3cba5d76c16d27a10f2322cbe4 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期四, 14 十二月 2023 17:14:38 +0800
Subject: [PATCH] 新增生产汇报单同步字段-不良数量、报废数量、批号,新增产量汇报单反写关联字段

---
 WebAPI/Controllers/Sc_ProcessMangementController.cs      |    1 
 WebAPI/DLL/ClsSc_ICMOReportBill.cs                       |  279 ++++++++++++++++++++--------------------------
 WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs |   22 +-
 3 files changed, 134 insertions(+), 168 deletions(-)

diff --git a/WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs
index 8f391a6..0f9d62f 100644
--- a/WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs
@@ -892,17 +892,17 @@
 
         public static DataSet Sc_GetMESProductReportBillList(string sWhere)
         {
-            string sql = string.Format(@"select a.HInterID, a.HBillNo,a.HDate,a.HBillType,a.HBillStatus,a.HMaterID,m.HNumber HMaterCode,m.HName HMaterName,m.HModel HMaterSpec 
-                                   ,a.HSourceID,s.HNumber HSourceCode,s.HName HSourceName,a.HGroupID,g.HNumber HGroupCode,g.HName HGroupName
-                                   ,a.HWorkManID,e.HName HWorkManName,a.HMaker,a.HMakeDate, a.HReportType  
-                                   ,a.HQty,a.HICMOBillNo,a.HICMOInterID,a.HICMOEntryID 
-                                   ,a.HSourceInterID,a.HSourceEntryID,a.HSourceBillNo, a.HSourceBillType
-                                   from Sc_ICMOBillWorkQtyStatus_Tmp a 
-                                   left join Gy_Material m on a.HMaterID=m.hitemid
-                                   left join Gy_Source s on a.HSourceID=s.HItemID
-                                   left join Gy_Group g on a.HGroupID=g.HItemID
-                                   left join Gy_Employee e on a.HWorkManID=e.HItemID " + sWhere + " and HRelationInterID='0'");
-            return new SQLHelper.ClsCN().RunProcReturn(sql, "Sc_ICMOBillWorkQtyStatus_Tmp");
+            string sql = "";
+            if (sWhere != null && sWhere != "")
+            {
+                sql = "select * from h_v_Sc_ICMOBillWorkQtyTmpList_ReportingPlatform " + sWhere;
+            }
+            else
+            {
+                sql = "select * from h_v_Sc_ICMOBillWorkQtyTmpList_ReportingPlatform " ;
+            }
+            
+            return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_ICMOBillWorkQtyTmpList_ReportingPlatform");
         }
         #endregion
 
diff --git a/WebAPI/Controllers/Sc_ProcessMangementController.cs b/WebAPI/Controllers/Sc_ProcessMangementController.cs
index e835f1e..749364a 100644
--- a/WebAPI/Controllers/Sc_ProcessMangementController.cs
+++ b/WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -590,6 +590,7 @@
                     FentityModel.Add("FFinishQty", item["鎺ユ敹鏁伴噺"].ToString());//瀹屾垚鏁伴噺1
                     FentityModel.Add("FQuaQty", item["鍚堟牸鏁伴噺"].ToString());//鍚堟牸鏁伴噺1FFailQty
                     FentityModel.Add("FFailQty", item["涓嶈壇鏁伴噺"].ToString());//涓嶅悎鏍兼暟閲�
+                    FentityModel.Add("FScrapQty", item["鎶ュ簾鏁伴噺"].ToString());//鎶ュ簾鏁伴噺                    
                     FentityModel.Add("FStockInOrgId ", new JObject() { ["Fnumber"] = OrganizationNUM });// 鍏ュ簱缁勭粐 
                     FentityModel.Add("FStockId", new JObject() { ["Fnumber"] = dr1["FStockNUM"].ToString() }); // 浠撳簱 
                     FentityModel.Add("FMOID", dr1["FMOID"].ToString());//  
diff --git a/WebAPI/DLL/ClsSc_ICMOReportBill.cs b/WebAPI/DLL/ClsSc_ICMOReportBill.cs
index 2db1745..04de2d0 100644
--- a/WebAPI/DLL/ClsSc_ICMOReportBill.cs
+++ b/WebAPI/DLL/ClsSc_ICMOReportBill.cs
@@ -193,13 +193,22 @@
                       "," + 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() +
+                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                       "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
                       "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "','" + oSub.HBarCode + "','" + oSub.HOWNERTYPEID + "'," +
                       oSub.HISENTRUST + "," + oSub.HSTOCKINORGID + "," + oSub.HOWNERID + "," + oSub.HCHECKPRODUCT + ",'" + oSub.HQAIP + "'," +
                       oSub.HCOSTRATE + "," + oSub.HISBACKFLUSH + ",'" + oSub.HREQSRC + "','" + oSub.HREQBILLNO + "'," + oSub.HREQBILLID + "," + 
-                      oSub.HREQENTRYSEQ + "," + oSub.HREQENTRYID + "," + oSub.HMOMAINENTRYID + "," + oSub.HSTOCKINQUASELQTY + "," + oSub.HPRODUCTTYPE + ",'" + oSub.HPROJECTNO + "'," + oSub.HICMOENTRYSEQ + "," + oSub.HSEQ + ",'" + oSub.HPRODUCEDATE + "','" + oSub.HEXPIRYDATE + "'," + oSub.HBASEUNITID + "," + oSub.HDEPTID + "," + oSub.HGroupID + ",'" + oSub.HDESCRIPTION + "','" + oSub.HSourceNumber + "'," + oSub.HQPQty + ","  + oSub.HSourceEntryID + ","  + oSub.HICMOEntryID + ","  +  oSub.HWhID + "," + oSub.HSPID + ",'" + oSub.HBatChNo + "'," + oSub.HAuxPropID + ",'" + oSub.HMTONo + "'," + oSub.HPlanMode + "," + oSub.HERPInterID + "," + oSub.HERPEntryID +
+                      oSub.HREQENTRYSEQ + "," + oSub.HREQENTRYID + "," + oSub.HMOMAINENTRYID + "," + oSub.HSTOCKINQUASELQTY + "," + oSub.HPRODUCTTYPE + ",'" + oSub.HPROJECTNO + "'," + oSub.HICMOENTRYSEQ + "," + oSub.HSEQ + ",'" + oSub.HPRODUCEDATE + "','" + oSub.HEXPIRYDATE + "'," + oSub.HBASEUNITID + "," + oSub.HDEPTID + "," + oSub.HGroupID + ",'" + oSub.HDESCRIPTION + "','" + oSub.HSourceNumber + "'," + oSub.HQPQty + ","  + oSub.HICMOEntryID + ","  +  oSub.HWhID + "," + oSub.HSPID + ",'" + oSub.HBatChNo + "'," + oSub.HAuxPropID + ",'" + oSub.HMTONo + "'," + oSub.HPlanMode + "," + oSub.HERPInterID + "," + oSub.HERPEntryID +
                       ") ");
+
+                    //鍙嶅啓浜ч噺姹囨姤鍗曚复鏃惰〃鍏宠仈瀛楁淇℃伅
+                    string sql = string.Format(@"update Sc_ICMOBillWorkQtyStatus_Tmp  set 
+                                                                    HICMOReportInterID ='" + omodel.HInterID +
+                                                                   "', HICMOReportBillNo='" + omodel.HBillNo +
+                                                                   "', HRelationInterID='" + omodel.HInterID +
+                                                                   "', HRelationEntryID='" + oSub.HEntryID +
+                                                                   "' from Sc_ICMOBillWorkQtyStatus_Tmp a where a.HICMOBillNo='" + DetailColl[0].HICMOBillNo + "' and a.HSourceID='" + DetailColl[0].HSourceID + "' and  HICMOInterID='" + DetailColl[0].HICMOInterID + "' and a.HICMOEntryID='" + DetailColl[0].HICMOEntryID + "' and a.HMaker='" + omodel.HMaker + "'  and HRelationInterID='0'");
+                    oCn.RunProc(sql);
                 }
                 //
                 //foreach (Model.ClsSc_ICMOReportBillSub oSub in DetailColl)
@@ -213,7 +222,8 @@
                 //        return false;
                 //    }
                 //}
-                //
+                //               
+
                 sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
                 return true;
@@ -349,157 +359,118 @@
 
                 if (Ds == null || Ds.Tables[0].Rows.Count == 0 || Ds.Tables[1].Rows.Count == 0)
                 {
-                    LogService.Write("鐢熶骇姹囨姤鍗曞鏍革紝鑾峰彇json瀛愯〃淇℃伅澶辫触");
+                    sReturn = "webapi鐢熶骇姹囨姤鍗曞鏍革紝鑾峰彇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"]);
+                    JObject model = new JObject();
+                    model.Add("FBillType", new JObject() { ["FNumber"] = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillType"]) }); //鍗曟嵁绫诲瀷
+                    model.Add("FDate", Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDate"])); //鍗曟嵁鏃ユ湡                   
+                    model.Add("FPrdOrgId", new JObject() { ["FNumber"] = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FPRDORGID"] )}); //鐢熶骇缁勭粐浠g爜
+                    model.Add("FBillNo", HBillNo);
 
-                    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"]) + "\"}},";
-                        }
+                    JArray Fentity = new JArray();
+                    foreach (DataRow item in Ds.Tables[1].Rows)
+                    {                       
+                        JObject FentityModel = new JObject();
+                        FentityModel.Add("FSrcEntryId", item["FSRCENTRYID"].ToString());//  婧愬崟鍒嗗綍鍐呯爜銆�
+                        FentityModel.Add("FIsNew", item["FIsNew"].ToString());//  婧愬崟绫诲瀷 
+                        FentityModel.Add("FMaterialId", new JObject() { ["FNumber"] = item["FMaterialId"].ToString() }); // 鐗╂枡缂栫爜 
+                        FentityModel.Add("FREPORTTYPE", new JObject() { ["FNumber"] = item["FREPORTTYPE"].ToString() });  // 鐢熶骇姹囨姤绫诲瀷
+                        FentityModel.Add("FProductType", item["FPRODUCTTYPE"].ToString());// 	 浜у搧绫诲瀷
+                        FentityModel.Add("FUNITID", new JObject() { ["FNumber"] = item["FUNITID"].ToString() });//鍗曚綅
+                        FentityModel.Add("FWORKSHIPID", new JObject() { ["FNumber"] = item["FWORKSHOPID"].ToString() });//鐢熶骇杞﹂棿
+                        FentityModel.Add("FMTONO", item["FMTONO"].ToString());//   璁″垝璺熻釜鍙�
+                        FentityModel.Add("FCheckProduct", item["FCheckProduct"].ToString());//   浜у搧妫�楠�
+                        FentityModel.Add("FISENTRUST", item["FISENTRUST"].ToString());//  	 缁勭粐濮旀墭鍔犲伐
+                        FentityModel.Add("FSrcBillType", "FSRCBILLTYPE");//   婧愬崟绫诲瀷
+                        FentityModel.Add("FMOBILLNO", item["FMOBILLNO"].ToString());//  鐢熶骇璁㈠崟
+                        FentityModel.Add("FSrcBillNo", item["FSrcBillNo"].ToString());//   婧愬崟缂栧彿
+                        FentityModel.Add("FMoEntrySeq", item["FMoEntrySeq"].ToString());//鐢熶骇璁㈠崟琛屽彿
+                        FentityModel.Add("FPROJECTNO", item["FPROJECTNO"].ToString());//  椤圭洰缂栧彿
+                        FentityModel.Add("FSTDMANHOUR", item["FSTDMANHOUR"].ToString());//  鍗曚綅鏍囧噯宸ユ椂
+                        FentityModel.Add("FHRPREPARETIME", item["FHRPREPARETIME"].ToString());//  浜哄憳鍑嗗宸ユ椂
+                        FentityModel.Add("FMACPREPARETIME", item["FMACPREPARETIME"].ToString());//  鏈哄櫒鍑嗗宸ユ椂
+                        FentityModel.Add("FSrcInterId", item["FSrcInterId"].ToString());//  婧愬崟鍐呯爜
+                        FentityModel.Add("FSrcEntrySeq", item["FSrcEntrySeq"].ToString());//  婧愬崟琛屽彿
+                        FentityModel.Add("FMoId", item["FMoId"].ToString());//鐢熶骇璁㈠崟鍐呯爜
+                        FentityModel.Add("FMoEntryId", item["FMoEntryId"].ToString());//鐢熶骇璁㈠崟鍒嗗綍鍙�
+                        FentityModel.Add("FBaseUnitID", new JObject() { ["FNumber"] = item["FBaseUnitID"].ToString() });//鍗曚綅
+                        FentityModel.Add("FSTOCKINORGID", new JObject() { ["FNumber"] = item["FSTOCKINORGID"].ToString() });//鍏ュ簱缁勭粐
+                        FentityModel.Add("FBOMID", new JObject() { ["FNumber"] = item["FBOMID"].ToString() });// BOM鐗堟湰
+                        FentityModel.Add("FOwnerTypeId", item["FOwnerTypeId"].ToString());// 璐т富绫诲瀷
+                        FentityModel.Add("FOwnerId", new JObject() { ["FNumber"] = item["FOwnerId"].ToString() });// 璐т富
+                        FentityModel.Add("FSTOCKID", new JObject() { ["FNumber"] = item["FSTOCKID"].ToString() });//浠撳簱
+                        FentityModel.Add("FCostRate", item["FCOSTRATE"].ToString());//	 鎴愭湰鏉冮噸
+                        FentityModel.Add("FSNUNITID", new JObject() { ["FNumber"] = item["FSNUNITID"].ToString() });//搴忓垪鍙峰崟浣�
+                        FentityModel.Add("FISBACKFLUSH", item["FISBACKFLUSH"].ToString());//  鍊掑啿棰嗘枡
+                        FentityModel.Add("FMOMAINENTRYID", item["FMOMAINENTRYID"].ToString());// 鐢熶骇璁㈠崟涓讳骇鍝佸垎褰�
+                        FentityModel.Add("FQAIP", item["FQAIP"].ToString());//绱ф�ユ斁琛�
+                        FentityModel.Add("FREQSRC", item["FREQSRC"].ToString());//闇�姹傛潵婧�
+                        FentityModel.Add("FREQBILLNO", item["FREQBILLNO"].ToString());//闇�姹傚崟鎹�
+                        FentityModel.Add("FREQBILLID", item["FREQBILLID"].ToString());// 闇�姹傚崟鎹唴鐮�
+                        FentityModel.Add("FREQENTRYSEQ", item["FREQENTRYSEQ"].ToString());//闇�姹傚崟鎹鍙�
+                        FentityModel.Add("FREQENTRYID", item["FREQENTRYID"].ToString());// 闇�姹傚崟鎹垎褰曞唴鐮�
+                        FentityModel.Add("FBASEQUAQTY", item["FBASEQUAQTY"].ToString());// 鍩烘湰鍗曚綅鍚堟牸鏁伴噺
+                        FentityModel.Add("FQUAQTY", item["FQUAQTY"].ToString());//鍚堟牸鏁伴噺
+                        FentityModel.Add("FFailQty", item["FFailQty"].ToString());//涓嶅悎鏍兼暟閲�
+                        FentityModel.Add("FScrapQty", item["FScrapQty"].ToString());//鎶ュ簾鏁伴噺
+                        FentityModel.Add("FBASEFINISHQTY", item["FBASEFINISHQTY"].ToString());//鍩烘湰鍗曚綅瀹屾垚鏁伴噺
+                        FentityModel.Add("FFINISHQTY", item["FFINISHQTY"].ToString());//瀹屾垚鏁伴噺
+                        FentityModel.Add("FLot", new JObject() { ["FNumber"] = item["FLot"].ToString() });//鎵瑰彿
+                        
+                        //sJson_BatchNo +
+                        //sJson_StockPlace +
+                        //" \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}}," +
 
-                        //鑷畾涔夊瓧娈靛鐞�
-                        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"]) + "\"}}";
+                        JArray Fentity2 = new JArray();
+                        JObject FentityModel2 = new JObject();
+                        FentityModel2.Add("FEntity_Link_FFlowId", item["FEntity_Link_FFlowId"].ToString());
+                        FentityModel2.Add("FEntity_Link_FFlowLineId", item["FEntity_Link_FFlowLineId"].ToString());
+                        FentityModel2.Add("FEntity_Link_FRuleId", item["FEntity_Link_FRuleId"].ToString());
+                        FentityModel2.Add("FEntity_Link_FSTableName", item["FEntity_Link_FSTableName"].ToString());
+                        FentityModel2.Add("FEntity_Link_FSBillId", item["FEntity_Link_FSBillId"].ToString());
+                        FentityModel2.Add("FEntity_Link_FSId", item["FEntity_Link_FSId"].ToString());
+                        Fentity2.Add(FentityModel2);
+                        FentityModel.Add("FEntity_Link", Fentity2);
+                        FentityModel.Add("FBFLowId", new JObject() { ["FID"] = item["FBFLOWID"].ToString() }); //
+                        Fentity.Add(FentityModel);
                     }
-                    string sJson_End = "  ]  }}";
-                    string sJson = sJson_Main + sJson_Entry + sJson_End;
+                    model.Add("FEntity", Fentity); //鏄庣粏淇℃伅                       
+                    JObject jsonRoot = new JObject()
+                    {
+                        ["Creator"] = "",
+                        ["NeedUpDateFields"] = new JArray(),
+                        ["NeedReturnFields"] = new JArray(),
+                        //["IsDeleteEntry"] = "true",
+                        //["SubSystemId"] = "",
+                        //["IsVerifyBaseDataField"] = "false",
+                        ["IsDeleteEntry"] = "true",
+                        ["SubSystemId"] = "",
+                        ["IsVerifyBaseDataField"] = "true",
+                        ["IsEntryBatchFill"] = "false",
+                        ["ValidateFlag"] = "true",
+                        ["NumberSearch"] = "true",
+                        ["IsAutoAdjustField"] = "false",
+                        ["InterationFlags"] = "",
+                        ["IgnoreInterationFlag"] = "",
+                        //["IsAutoSubmitAndAudit"] = true,//鑷姩璋冪敤鎻愪氦鍜屽鏍稿姛鑳�
+                        ["Model"] = model
+                    };
+
+
+                    //string sJson_ZYMESFLAG = "";    //鐢熶骇姹囨姤鍗曞悓姝ES鏍囪
+                    //sJson_ZYMESFLAG = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FHZYMESFLAG"]);
+
+                 
 
                     //浠庨厤缃枃浠惰幏鍙� CLOUD缃戝潃銆佽处濂椾俊鎭�佺櫥褰曠敤鎴枫�佺櫥褰曞瘑鐮�
                     if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo))
                     {
-                        LogService.Write("鐢熶骇姹囨姤鍗曞鏍革紝鍚屾鑾峰彇鐧诲綍璐﹀彿瀵嗙爜澶辫触");
-
+                        sReturn = "鐢熶骇姹囨姤鍗曞鏍革紝鍚屾鑾峰彇鐧诲綍璐﹀彿瀵嗙爜澶辫触";
+                        oCn.RollBack();
                         return false;
                     }
 
@@ -507,22 +478,19 @@
                     var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
                     if (isSuccess == 0)
                     {
+                        sReturn = "鐧诲綍閲戣澏澶辫触!";
                         oCn.RollBack();
                         return false;
                     }
                     else
                     {
-                        LogService.Write("寮�濮嬭皟鐢ㄤ繚瀛樻柟娉�");
-                        string result = InvokeHelper.Save("PRD_MORPT", JsonConvert.SerializeObject(sJson));//淇濆瓨
+                        LogService.Write(JsonConvert.SerializeObject(jsonRoot));
+                        string result = InvokeHelper.Save("PRD_MORPT", JsonConvert.SerializeObject(jsonRoot));//淇濆瓨
 
                         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;
+                            sReturn = "鐢熶骇姹囨姤鍗曞悓姝ラ噾铦朵簯澶辫触锛佸崟鍙�:" + HBillNo + result + jsonRoot;
+                            oCn.RollBack();                         
                             return false;
                         }
 
@@ -531,17 +499,14 @@
                         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));//瀹℃牳
+                            result1 = InvokeHelper.Submit("PRD_MORPT", JsonConvert.SerializeObject(jsonRoot));//鎻愪氦
+                            result2 = InvokeHelper.Audit("PRD_MORPT", JsonConvert.SerializeObject(jsonRoot));//瀹℃牳
 
                             if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
                             {
+                                sReturn = "鐢熶骇姹囨姤鍗曞崟鍙�:" + HBillNo + ",鎻愪氦澶辫触" + result;
                                 oCn.RollBack();
-                                objJsonResult.code = "0";
-                                objJsonResult.count = 0;
-                                objJsonResult.Message = $"鐢熶骇姹囨姤鍗曞崟鍙凤細{HBillNo}锛屾彁浜ゅけ璐�" + result;
-                                objJsonResult.data = null;
-                                return false;
+                                return false;                              
                             }
                         }                       
                     }                   

--
Gitblit v1.9.1