From da2b3cb087fb3dad59ac2570a6365194031ea1e5 Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期三, 11 三月 2026 14:24:33 +0800
Subject: [PATCH] 新增检验单上传生成金蝶云单据调用方法

---
 Model/质检管理/ClsQC_POStockInCheckBillSub.cs |    5 
 WebAPI/Controllers/条码管理/WEBSController.cs |  547 +++++++++++++++++++++++++++++++++++++++++++++++++
 WebAPI/Models/KingdeeResponse.cs          |   53 ++++
 WebAPI/WebAPI.csproj                      |    1 
 4 files changed, 606 insertions(+), 0 deletions(-)

diff --git "a/Model/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_POStockInCheckBillSub.cs" "b/Model/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_POStockInCheckBillSub.cs"
index e2f61f4..7297492 100644
--- "a/Model/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_POStockInCheckBillSub.cs"
+++ "b/Model/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_POStockInCheckBillSub.cs"
@@ -48,6 +48,11 @@
         public Int64 HInspectMethodID;  // 检验方法
         public Int64 HInspectBasisID;   // 检验依据
         public decimal HInspectValQ; // 检验值(定量分析)
+        public Int64 HMaterID;      //物料ID
+        public double HInStockQty;  //入库数量
+        public double HCheckQty;    //抽检数量
+        public double HRightQty;    //合格数量
+        public double HBadQty;      //不合格数量
 
     }
 }
diff --git "a/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs" "b/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs"
index 120b735..7d1b8a0 100644
--- "a/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs"
+++ "b/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs"
@@ -5250,6 +5250,553 @@
 
         #endregion
 
+        #region 妫�楠屽崟    涓婁紶鐢熷崟
+
+        #region 妫�楠屽崟    鍚堟牸鍝�
+
+        /// <summary>
+        /// 妫�楠屽崟鏂板涓婁紶
+        /// </summary>
+        /// <returns></returns>
+        [Route("WEBSController/set_SaveQCPOStockInCheckBill_Json")]
+        [HttpPost]
+        public object set_SaveQCPOStockInCheckBill_Json(Int64 HInterID, string HBillNo, string HSourceBillType, string HSourceBillNo, Int64 HSourceInterID, string sHSourceEntryID, Int64 HFirstCheckEmp, string HMaker)
+        {
+            try
+            {
+               ClsQC_POStockInCheckBillMain oMain = new ClsQC_POStockInCheckBillMain();
+                oMain.HInterID = HInterID;
+                oMain.HBillNo = HBillNo;
+                oMain.HBillType = "7503";
+                oMain.HDate = DateTime.Today;
+                oMain.HMainSourceBillType = HSourceBillType;
+                oMain.HMainSourceBillNo = HSourceBillNo;
+                oMain.HMainSourceInterID = HSourceInterID;
+                oMain.HFirstCheckEmp = HFirstCheckEmp;
+                oMain.HMaker = HMaker;
+
+                if (set_SaveQCPOStockInCheckBill(oMain, HSourceBillType, sHSourceEntryID, ref DBUtility.ClsPub.sErrInfo))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //鎴愬姛锛�
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //澶辫触锛�
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "妫�楠屽崟涓婁紶澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        //鐢熸垚妫�楠屽崟
+        public bool set_SaveQCPOStockInCheckBill(Model.ClsQC_POStockInCheckBillMain oMain, string HSourceBillType, string sHSourceEntryID, ref string sErrMsg)
+        {
+            string sRemark = "";
+            string HReturn;
+
+            //涓婁紶鍓嶅垽鏂�
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            DataSet BfDs = oCn.RunProcReturn("exec h_p_QC_BeforeUpload_POStockInCheckBill " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + HSourceBillType + "','" + sHSourceEntryID + "'," + oMain.HFirstCheckEmp.ToString(), "h_p_QC_BeforeUpload_POStockInCheckBill");
+            if (BfDs == null || BfDs.Tables[0].Rows.Count == 0)
+            {
+                sErrMsg = "涓婁紶鍓嶅垽鏂暟鎹畬鏁存�уけ璐ワ紒";
+                return false;
+            }
+            else
+            {
+                if (DBUtility.ClsPub.isLong(BfDs.Tables[0].Rows[0][0]) == 1)
+                {
+                    sErrMsg = "鍗曟嵁鍙凤細" + oMain.HBillNo + "锛屽崟鎹甀D锛�" + oMain.HInterID + "锛�" + DBUtility.ClsPub.isStrNull(BfDs.Tables[0].Rows[0]["HRemark"]);
+                    return false;
+                }
+            }
+            sRemark = sRemark + " 锛涗笂浼犲墠鍒ゆ柇" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
+
+            //杩斿洖鎵�闇�鏁版嵁
+            DataSet Ds;
+            Ds = oCn.RunProcReturn("exec h_p_QC_POStockInCheckBill_CLD " + oMain.HMainSourceInterID.ToString() + ",'" + sHSourceEntryID + "'," + oMain.HFirstCheckEmp.ToString(), "h_p_QC_POStockInCheckBill_CLD");
+            if (Ds == null || Ds.Tables[0].Rows.Count == 0 || Ds.Tables[1].Rows.Count == 0)
+            {
+                sErrMsg = "鏍规嵁鏀舵枡閫氱煡鍗曪細" + oMain.HMainSourceBillNo + " 鑾峰彇鏁版嵁澶辫触锛�";
+                return false;
+            }
+            sRemark = sRemark + " 锛涜幏鍙朇LOUD鍗曟嵁API閫掑叆鍊�" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
+
+            //鑾峰彇鍗曟嵁涓昏〃鎵�闇�鏁版嵁
+            oMain.HSupID = Pub_Class.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]);
+            oMain.HSTOCKORGID = Pub_Class.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSTOCKORGID"]);
+
+            //鑾峰彇绯荤粺鍙傛暟
+            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+            if (oSystemParameter.ShowBillByOrgID(oMain.HSTOCKORGID, ref sErrMsg) == false)
+            {
+                sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                return false;
+            }
+
+            try
+            {
+                //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                string s = "";
+                int sYear = 0;
+                int sPeriod = 0;
+                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oMain.HDate, ref sYear, ref sPeriod, ref s) == false)
+                {
+                    sErrMsg = s;
+                    return false;
+                }
+                oMain.HYear = sYear;
+                oMain.HPeriod = sPeriod;
+
+                oCn.BeginTran();
+                //鐢熸垚妫�楠屽崟
+                //鍐欏叆涓昏〃
+                oCn.RunProc("Insert Into QC_POStockInCheckBillMain " +
+                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate" +
+                ",HYear,HPeriod,HRemark,HSTOCKORGID,HSupID,HMaterID" +
+                ",HInstockQty,HCheckQty,HRightQty,HBadQty,HFirstCheckEmp" +
+                ",HCheckerResult,HSteelStoveNo,HSteelCompReport,HAspect,HSize" +
+                ") " +
+                " values('" + oMain.HBillType + "','" + oMain.HBillType + "'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HDate.ToShortDateString() + "','" + oMain.HMaker + "',getdate()" +
+                ", " + oMain.HYear.ToString() + "," + oMain.HPeriod.ToString() + ",'" + oMain.HRemark + "'," + oMain.HSTOCKORGID.ToString() + "," + oMain.HSupID.ToString() + "," + oMain.HMaterID.ToString() +
+                ", " + oMain.HCheckQty.ToString() + "," + oMain.HCheckQty.ToString() + "," + oMain.HRightQty.ToString() + "," + oMain.HBadQty.ToString() + "," + oMain.HFirstCheckEmp.ToString() +
+                ",'" + oMain.HCheckerResult + "','" + oMain.HSteelStoveNo + "','" + oMain.HSteelCompReport + "','" + oMain.HAspect + "','" + oMain.HSize + "'" +
+                ") ");
+
+                //鍐欏叆瀛愯〃
+                for (int i = 0; i < Ds.Tables[1].Rows.Count; i++)
+                {
+                    Model.ClsQC_POStockInCheckBillSub oSub = new Model.ClsQC_POStockInCheckBillSub();
+                    oSub.HEntryID = i + 1;
+                    oSub.HSourceInterID = Pub_Class.ClsPub.isLong(Ds.Tables[1].Rows[i]["HSourceInterID"]);
+                    oSub.HSourceEntryID = Pub_Class.ClsPub.isLong(Ds.Tables[1].Rows[i]["HSourceEntryID"]);
+                    oSub.HSourceBillNo = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HSourceBillNo"]);
+                    oSub.HSourceBillType = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HSourceBillType"]);
+                    oSub.HResult = "鍚堟牸";
+                    oSub.HProcCheckEmp = oMain.HFirstCheckEmp;
+                    oSub.HMaterID = Pub_Class.ClsPub.isLong(Ds.Tables[1].Rows[i]["HMaterID"]);
+                    oSub.HInStockQty = Pub_Class.ClsPub.isDoule(Ds.Tables[1].Rows[i]["HInStockQty"]);
+                    oSub.HCheckQty = Pub_Class.ClsPub.isDoule(Ds.Tables[1].Rows[i]["HCheckQty"]);
+                    oSub.HRightQty = Pub_Class.ClsPub.isDoule(Ds.Tables[1].Rows[i]["HRightQty"]);
+                    oSub.HBadQty = Pub_Class.ClsPub.isDoule(Ds.Tables[1].Rows[i]["HBadQty"]);
+
+                    oCn.RunProc("Insert Into QC_POStockInCheckBillSub " +
+                    "(HInterID,HEntryID,,HBillNo_bak,HRemark" +
+                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+                    ",HQCCheckClassID,HQCCheckItemID,HQCStd,HQCRelValue" +
+                    "HResult,HProcCheckEmp,HProcCheckTime" +
+                    "HMaterID,HInStockQty,HCheckQty,HRightQty,HBadQty" +
+                    ") " +
+                    " values(" + oMain.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oMain.HBillNo + "','" + oSub.HRemark + "'" +
+                    ", " + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" +
+                    ", " + oSub.HQCCheckClassID.ToString() + "," + oSub.HQCCheckItemID.ToString() + ",'" + oSub.HQCStd + "','" + oSub.HQCRelValue + "'" +
+                    ",'" + oSub.HResult + "'," + oSub.HProcCheckEmp.ToString() + "',getdate()" +
+                    ", " + oSub.HMaterID.ToString() + "," + oSub.HInStockQty.ToString() + "," + oSub.HCheckQty.ToString() + "," + oSub.HRightQty.ToString() + "," + oSub.HBadQty.ToString() +
+                    ") ");
+                }
+                sRemark = sRemark + " 锛涚敓鎴愭楠屽崟鍗曟嵁" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
+
+                //鑾峰彇閲戣澏浜慉PI鎵�闇�閫掑叆鏁版嵁
+                string sJson_MainCustom = "";   //涓昏〃鑷畾涔夊瓧娈�
+                sJson_MainCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["MainCustom"]);
+
+                string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\",\"IsEntryBatchFill\":\"True\",\"Model\":{\"FBillNo\":\"" + oMain.HBillNo + "\"," +
+                    //\"FID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FID"]) + "\"," +
+                    "\"FBillTypeID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillTypeID"]) + "\" }," +
+                    "\"FBusinessType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBusinessType"]) + "\"," +
+                    "\"FDATE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDATE"]) + "\"," +
+                    "\"FSourceOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSourceOrgId"]) + "\"}," +
+                    "\"FInspectOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FInspectOrgId"]) + "\"}," +
+                    "\"FInspectDepId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FInspectDepId"]) + "\"}," +
+                    //"\"FInspectGroupId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FInspectGroupId"]) + "\"}," +
+                    "\"FInspectorId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FInspectorId"]) + "\"}," +
+                    //"\"FDescription\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDescription"]) + "\"," +
+                    //"\"FUpScanBox\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FUpScanBox"]) + "\"," +
+                    //"\"FDefScanBox\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDefScanBox"]) + "\"," +
+                    //"\"FCheckQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FCheckQty"]) + "\"," +
+                    //"\"FInspectValScanBox\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FInspectValScanBox"]) + "\"," +
+                    "\"FIsSynced\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FIsSynced"]) + "\"," +
+                    sJson_MainCustom +
+                    "\"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_FProduceDate = "";     //鐢熶骇鏃ユ湡
+                    string sJson_FExpiryDate = "";      //鏈夋晥鏈熻嚦
+                    string sJson_FAUXPROPID = "";
+                    string sJson_SubCustom = "";        //瀛愯〃鑷畾涔夊瓧娈�
+
+                    //瀛愯〃鑷畾涔夊瓧娈�
+                    sJson_SubCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["SubCustom"]);
+
+                    //鏄惁鍚敤鎵规绠$悊
+                    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]["FISKFPERIOD"]) == "1")
+                    {
+                        sJson_FProduceDate = " \"FProduceDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProduceDate"]) + "\",";
+                        sJson_FExpiryDate = " \"FExpiryDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExpiryDate"]) + "\",";
+                    }
+                    else
+                    {
+                        sJson_FProduceDate = "";
+                        sJson_FExpiryDate = "";
+                    }
+
+                    //鏄惁鍚敤浠撲綅
+                    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"]) + "\"}},";
+                    }
+
+                    //杈呭姪灞炴��
+                    sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},";
+
+                    sJson_Entry = sJson_Entry + "{" +
+                    //"FEntryID": 0,
+                    "\"FMaterialId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMaterialId"]) + "\"}," +
+                    //"FQCSchemeId": {"FNUMBER": ""},
+                    "\"FUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUnitID"]) + "\"}," +
+                    "\"FInspectQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FInspectQty"]) + "\"," +            //妫�楠屾暟閲� 
+                    "\"FQualifiedQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FQualifiedQty"]) + "\"," +        //鍚堟牸鏁伴噺 
+                    "\"FUnqualifiedQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUnqualifiedQty"]) + "\"," +    //涓嶅悎鏍兼暟閲�
+                    //"FSampleDamageQty": 0,
+                    //"FSUnqualifiedQty": 0,
+                    "\"FInspectResult\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FInspectResult"]) + "\"," +      //妫�楠岀粨鏋�
+                    "\"FQCStatus\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FQCStatus"]) + "\"," +                //璐ㄦ鐘舵��
+                    //"FBaseSUnqualifiedQty": 0,
+                    //"FSampleQty": 0,
+                    //"FMemo": "",
+                    "\"FIsRelated\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FIsRelated"]) + "\"," +
+                    "\"FSrcBillType0\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBillType0"]) + "\"," +
+                    "\"FSrcBillNo0\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBillNo0"]) + "\"," +
+                    "\"FSrcInterId0\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcInterId0"]) + "\"," +
+                    "\"FSrcEntryId0\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcEntryId0"]) + "\"," +
+                    "\"FSrcEntrySeq0\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcEntrySeq0"]) + "\"," +
+                    "\"FBaseUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseUnitId"]) + "\"}," +
+                    //"FQCBusinessType": "",
+                    //"FBFLowId": {"FNAME": ""},
+                    //"FSampleSchemeId": {"FNUMBER": ""},
+                    //"FAcceptQty": 0,
+                    //"FRejectQty": 0,
+                    //"FInspectEndDate": "1900-01-01", 
+                    "\"FBaseInspectQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseInspectQty"]) + "\"," +        //鍩烘湰鍗曚綅妫�楠屾暟閲�
+                    "\"FSupplierId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSupplierId"]) + "\"}," +
+                    //"FCustomerId": {"FNUMBER": ""},
+                    //"FProductLineId": {"FNUMBER": ""},
+                    //"FPrdLineLocation": {"FLOCATIONCODE": ""},
+                    //"FWorkshopId": {"FNUMBER": ""},
+                    "\"FStockId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockId"]) + "\"}," +
+                    sJson_BatchNo +
+                    "\"FInspectTimes\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FInspectTimes"]) + "\"," +            //妫�楠屾鏁�
+                    sJson_StockPlace +
+                    //"FConsumeTime": 0,
+                    //"FInspectStartDate": "1900-01-01",
+                    "\"FTimeUnit\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FTimeUnit"]) + "\"," +
+                    //"FBaseSampleDamageQty": 0,
+                    //"FBaseUnqualifiedQty": 0,
+                    //"FOperNumber": 0,
+                    "\"FSampleDamageBearer\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSampleDamageBearer"]) + "\"," +
+                    "\"FIsFirstInspect\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FIsFirstInspect"]) + "\"," +
+                    "\"FBaseQualifiedQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseQualifiedQty"]) + "\"," +    //鍩烘湰鍗曚綅鍚堟牸鏁�
+                    "\"FBaseAcceptQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseAcceptQty"]) + "\"," +          //鍩烘湰鍗曚綅鎺ユ敹鏁�
+                    sJson_FAUXPROPID +
+                    //"FPrdUnitId": {"FNumber": ""},
+                    //"FBaseReAcceptQty": 0,
+                    //"FOperDescription": "",
+                    //"FUnitTransHeadQty": 0,
+                    //"FUnitTransOperQty": 0,
+                    //"FSNUnitID": {"FNumber": ""},
+                    //"FBaseWBInspectQty": 0,
+                    //"FBaseUnQuaSalQty": 0,
+                    //"FSupplierLot": "",
+                    sJson_FProduceDate +
+                    sJson_FExpiryDate +
+                    //"FNewExpiryDate": "1900-01-01",
+                    "\"FCurrency\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCurrency"]) + "\"}," +
+                    //"FDiscountQty": 0,
+                    "\"FIsSplitRow\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FIsSplitRow"]) + "\"," +
+                    sJson_SubCustom +
+
+                    //浣跨敤鍐崇瓥琛ㄤ綋
+                    "\"FPolicyDetail\": [ {  " +
+                    //"FDetailID": 0,
+                    "\"FPolicyMaterialId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPolicyMaterialId"]) + "\"}," +
+                    "\"FPolicyStatus\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPolicyStatus"]) + "\"," +
+                    "\"FPolicyQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPolicyQty"]) + "\"," +
+                    "\"FBasePolicyQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBasePolicyQty"]) + "\"," +
+                    "\"FUsePolicy\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUsePolicy"]) + "\"," +
+                    //"FSerialId": { "FNUMBER": ""},
+                    "\"FIsCheck\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FIsCheck"]) + "\"," +
+                    "\"FIsDefectProcess\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FIsDefectProcess"]) + "\"," +
+                    "\"FCanSale\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCanSale"]) + "\"," +
+                    "\"FIsMRBReview\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FIsMRBReview"]) + "\"," +
+                    "\"FIsReturn\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FIsReturn"]) + "\"," +
+                    "\"FIsRelatedDefect\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FIsRelatedDefect"]) + "\"" +
+                    //"FMRBReviewStatus": "",
+                    //"FBoxNumber": "",
+                    //"FMemo1": "",
+                    //"FPolicyAuxPropId": {"FPOLICYAUXPROPID__FF100005": { "FNumber": ""},"FPOLICYAUXPROPID__FF100002": { "FNumber": ""}}
+                    " } ]," +
+
+                    //缂洪櫡璁板綍琛ㄤ綋
+                    //"\"FDefectDetail\": [ {  " +
+                    ////"FDetailID": 0,
+                    ////"FDSerialId": {"FNUMBER": ""},
+                    ////"FDefectTypeId": {"FNUMBER": ""},
+                    ////"FDefectQty": 0,
+                    ////"FBaseDefectQty1": 0,
+                    ////"FDefectReasonId": {"FNUMBER": ""},
+                    ////"FDefectLevel": "",
+                    ////"FDefectResultId": {"FNUMBER": ""},
+                    ////"FDefectMemo": ""
+                    //" } ]," +
+
+                    //妫�楠岄」鐩〃浣�
+                    //"\"FItemDetail\": [ {  " +
+                    ////"FDetailID": 0,
+                    ////"FInspectItemId": { "FNUMBER": ""},
+                    ////"FInspectResult1": "",
+                    ////"FAnalysisMethod": "",
+                    ////"FQualityStdId": { "FNUMBER": ""},
+                    ////"FUnitId2": { "FNUMBER": ""},
+                    ////"FInspectValQ": 0,
+                    ////"FInspectValB": { "FNUMBER": ""},
+                    ////"FInspectValT": "",
+                    ////"FInspectMethodId": { "FNUMBER": ""},
+                    ////"FInspectInstrumentId": { "FNUMBER": ""},
+                    ////"FDefectlevel1": "",
+                    ////"FDestructInspect": "false",
+                    ////"FKeyInspect": "false",
+                    ////"FInspectBasisId": { "FNUMBER": ""},
+                    ////"FSampleSchemeId1": { "FNUMBER": ""},
+                    ////"FItemStatus": "",
+                    ////"FCompareSymbol": "",
+                    ////"FSampleQty1": 0,
+                    ////"FAcceptQty1": 0,
+                    ////"FRejectQty1": 0,
+                    ////"FSampleDamageQty1": 0,
+                    ////"FBaseSampleDamageQty1": 0,
+                    ////"FItemMemo": "",
+                    ////"FSUnqualifiedQty1": 0,
+                    ////"FBaseSUnqualifiedQty1": 0,
+                    ////"FTargetVal": "",
+                    ////"FInspectVal": "",
+                    ////"FUpLimit": "",
+                    ////"FDownLimit": "",
+                    ////"FUpOffset": "",
+                    ////"FDownOffset": "",
+                    ////"FInspectValKey": "",
+                    ////"FTargetValKey": "",
+                    ////"FUpLimitKey": "",
+                    ////"FDownLimitKey": "",
+                    ////"FUpOffsetKey": "",
+                    ////"FDownOffsetKey": "",
+                    ////"FTargetValQ": 0,
+                    ////"FUpLimitQ": 0,
+                    ////"FDownLimitQ": 0,
+                    ////"FUpOffsetQ": 0,
+                    ////"FDownOffsetQ": 0,
+                    ////"FTargetValB": { "FNUMBER": ""},
+                    ////"FUpLimitB": { "FNUMBER": ""},
+                    ////"FDownLimitB": { "FNUMBER": ""},
+                    ////"FUpOffsetB": { "FNUMBER": ""},
+                    ////"FDownOffsetB": { "FNUMBER": ""},
+                    ////"FTargetValT": "",
+                    ////"FUpLimitT": "",
+                    ////"FDownLimitT": "",
+                    ////"FUpOffsetT": "",
+                    ////"FDownOffsetT": "",
+                    ////"FValueGrid": [
+                    ////    {
+                    ////    "FGridId": 0,
+                    ////    "FInspectResult2": "",
+                    ////    "FInspectValueB": { "FNUMBER": ""},
+                    ////    "FInspectValueT": "",
+                    ////    "FInspectValue": 0,
+                    ////    "FVSerialId": { "FNUMBER": ""}
+                    ////    }
+                    ////]
+                    //" } ]," +
+
+                    //鍙傝�冭〃浣�
+                    "\"FReferDetail\": [ {  " +
+                    //"FDetailID": 0,
+                    "\"FSrcBillType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBillType"]) + "\"," +
+                    "\"FSrcBillNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBillNo"]) + "\"," +
+                    "\"FSrcInterId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcInterId"]) + "\"," +
+                    "\"FSrcEntryId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcEntryId"]) + "\"," +
+                    "\"FSrcEntrySeq\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcEntrySeq"]) + "\"," +
+                    "\"FOrderType\":{\"FID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOrderType"]) + "\"}," +
+                    "\"FOrderBillNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOrderBillNo"]) + "\"," +
+                    "\"FOrderId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOrderId"]) + "\"," +
+                    "\"FOrderEntryId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOrderEntryId"]) + "\"," +
+                    "\"FOrderEntrySeq\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOrderEntrySeq"]) + "\"" +
+                    " } ]," +
+
+                    //鍏宠仈鍏崇郴琛�
+                    "\"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"]) + "\"," +
+                    "\"FEntity_Link_FBaseAcceptQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FBaseAcceptQty"]) + "\"," +
+                    "\"FEntity_Link_FBaseAcceptQtyOld\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FBaseAcceptQtyOld"]) + "\"," +
+                    "\"FEntity_Link_FBaseInspectQtyOld\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FBaseInspectQtyOld"]) + "\"," +
+                    "\"FEntity_Link_FInspectQtyOld\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FInspectQtyOld"]) + "\"" +
+                    " } ]   }  ";
+                }
+                string sJson_End = "  ]  }}";
+                string sJson = sJson_Main + sJson_Entry + sJson_End;
+
+                //CLOUD閲戣澏浜戣处鍙峰瘑鐮佺櫥鍏�
+                var loginRet = InvokeHelper.LoginUser(oMain.HMaker);
+                var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
+                sRemark = sRemark + " 锛涜幏鍙栭獙璇丆LOUD璐﹀彿瀵嗙爜" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
+
+                //鐢熸垚閲戣澏浜戝崟鎹�
+                if (isSuccess == 1)
+                {
+                    string result = InvokeHelper.Save("QM_InspectBill", sJson); //淇濆瓨
+
+                    sRemark = sRemark + " 锛涚敓鎴怌LOUD鍗曟嵁" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
+
+                    HReturn = result.ToString();
+
+                    if (HReturn.Contains("\"IsSuccess\":false") == true)
+                    {
+                        //鍙嶅簭鍒楀寲json鏁版嵁
+                        var retModel = JsonConvert.DeserializeObject<KingdeeResponse>(HReturn);
+                        //鎺ユ敹閲戣澏鎶ラ敊淇℃伅
+                        var strErrorMsg = string.Empty;
+                        //閬嶅巻鑾峰彇鎶ラ敊淇℃伅
+                        foreach (var item in retModel.Result.ResponseStatus.Errors)
+                        {
+                            strErrorMsg += item.Message + "\r\n";
+                        };
+                        sErrMsg = "鐢熸垚妫�楠屽崟澶辫触锛侀噾铦朵簯鎻愮ず锛�" + strErrorMsg;
+                        LogService.Write("鐢熸垚妫�楠屽崟澶辫触锛�" + HReturn + sJson);   //鍐欏叆txt鏂囨湰
+                        oCn.RollBack();
+                        return false;
+                    }
+                    else
+                    {
+                        sRemark = sRemark + sJson;
+                        oCn.Commit();
+                    }
+                }
+                else
+                {
+                    sErrMsg = "鐢熸垚妫�楠屽崟澶辫触锛侀噾铦朵簯鐧诲綍澶辫触锛�";
+                    oCn.RollBack();
+                    return false;
+                }
+            }
+            catch (Exception e)
+            {
+                LogService.Write("鐢熸垚鍥炴粴" + e.Message + sRemark);
+                sErrMsg = "鐢熸垚妫�楠屽崟澶辫触锛�" + e.Message;
+                oCn.RollBack();
+                return false;
+            }
+
+            if (oSystemParameter.omodel.QC_POStockInCheckBill_AutoCheck.ToUpper() == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+            {
+                try
+                {
+                    oCn.BeginTran();
+                    //瀹℃牳WMS鍗曟嵁
+                    oCn.RunProc("Update QC_POStockInCheckBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=getdate(),HBillStatus=2 where HInterID= " + oMain.HInterID.ToString());
+
+                    //鎻愪氦銆佸鏍搁噾铦朵簯鍗曟嵁
+                    HReturn = "";
+                    string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
+                    var result2 = InvokeHelper.Submit("QM_InspectBill", sJson2);    //鎻愪氦
+                    sRemark = sRemark + " 锛涙彁浜LOUD鍗曟嵁" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
+
+                    var result3 = InvokeHelper.Audit("QM_InspectBill", sJson2);     //瀹℃牳
+                    sRemark = sRemark + " 锛涘鏍窩LOUD鍗曟嵁" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
+
+                    HReturn = result2.ToString() + "," + result3.ToString();
+
+                    if (HReturn.Contains("\"IsSuccess\":false") == true)
+                    {
+                        //鍙嶅簭鍒楀寲json鏁版嵁
+                        var retModel = JsonConvert.DeserializeObject<KingdeeResponse>(result3);
+                        //鎺ユ敹閲戣澏鎶ラ敊淇℃伅
+                        var strErrorMsg = string.Empty;
+                        //閬嶅巻鑾峰彇鎶ラ敊淇℃伅
+                        foreach (var item in retModel.Result.ResponseStatus.Errors)
+                        {
+                            strErrorMsg += item.Message + "\r\n";
+                        };
+                        sErrMsg = "鐢熸垚妫�楠屽崟鎴愬姛锛屽鏍稿崟鎹け璐ワ紒閲戣澏浜戞彁绀猴細" + strErrorMsg;
+                        LogService.Write("瀹℃牳鍗曟嵁澶辫触" + sRemark + HReturn);
+                        oCn.RollBack();
+                        return true;
+                    }
+                    else
+                    {
+                        LogService.Write("鐢熸垚骞跺鏍告楠屽崟鎴愬姛锛�" + sRemark);
+                        sErrMsg = "鐢熸垚骞跺鏍告楠屽崟鎴愬姛锛佸崟鎹彿涓猴細" + oMain.HBillNo;
+                        oCn.Commit();
+                        return true;
+                    }
+                }
+                catch (Exception e)
+                {
+                    LogService.Write("瀹℃牳鍥炴粴" + sRemark + HReturn);
+                    sErrMsg = "瀹℃牳妫�楠屽崟澶辫触锛�" + e.Message;
+                    oCn.RollBack();
+                    return false;
+                }
+            }
+            else
+            {
+                LogService.Write("鐢熸垚妫�楠屽崟鎴愬姛锛�" + sRemark);
+                sErrMsg = "鐢熸垚妫�楠屽崟鎴愬姛锛佸崟鎹彿涓猴細" + oMain.HBillNo;
+                return true;
+            }
+        }
+
+        #endregion
+
+        #endregion
+
         #region 鐢熶骇缁勬墭鍗�    涓婁紶鐢熷崟
 
         /// <summary>
diff --git a/WebAPI/Models/KingdeeResponse.cs b/WebAPI/Models/KingdeeResponse.cs
new file mode 100644
index 0000000..2c5f5b5
--- /dev/null
+++ b/WebAPI/Models/KingdeeResponse.cs
@@ -0,0 +1,53 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WebAPI.Models
+{
+    public class KingdeeResponse
+    {
+        public _Result Result { get; set; }
+    }
+
+    public class _Result
+    {
+        public _ResponseStatus ResponseStatus { get; set; }
+    }
+
+    public class _ResponseStatus
+    {
+        public int ErrorCode { get; set; }
+        public bool IsSuccess { get; set; }
+
+        private List<_Error> _errors;
+        public List<_Error> Errors
+        {
+            get; set;
+        } = new List<_Error>();
+
+        private List<_SuccessEntity> _successEntitys;
+        public List<_SuccessEntity> SuccessEntitys
+        {
+            get; set;
+        }
+        public int MsgCode { get; set; }
+    }
+
+    public class _Error
+    {
+        public string FieldName { get; set; }
+        public string Message { get; set; }
+        public int DIndex { get; set; }
+        //閿欒鐨勫崟鎹紪鍙�
+        public string FNumber { get; set; }
+    }
+
+    public class _SuccessEntity
+    {
+        public int Id { get; set; }
+        public string Number { get; set; }
+        public int DIndex { get; set; }
+    }
+}
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index 18e97f5..f253dc2 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -986,6 +986,7 @@
     <Compile Include="Models\Gy_RoutingBillSub_WorkQty.cs" />
     <Compile Include="Models\ClsQC_CheckNote_PNL_Temp.cs" />
     <Compile Include="Models\Gy_TechnologyParameterSub.cs" />
+    <Compile Include="Models\KingdeeResponse.cs" />
     <Compile Include="Models\QC_OutCompCheckBillSub_ValueGrid.cs" />
     <Compile Include="Models\Sc_StationOutBillSub_Sup.cs" />
     <Compile Include="Models\Gy_MateNumRelation_Sec.cs" />

--
Gitblit v1.9.1