From 79026026625f03b542bc2a3f4091d59366ae0dba Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期四, 13 五月 2021 15:59:21 +0800
Subject: [PATCH] 生产汇报、生产入库模块,上传生成单据前增加判断条码临时表中是否存在相同条码

---
 CLOUDWEB/WebService1.asmx.cs |  337 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 337 insertions(+), 0 deletions(-)

diff --git a/CLOUDWEB/WebService1.asmx.cs b/CLOUDWEB/WebService1.asmx.cs
index cb18cb8..73da70b 100644
--- a/CLOUDWEB/WebService1.asmx.cs
+++ b/CLOUDWEB/WebService1.asmx.cs
@@ -4260,6 +4260,21 @@
         [WebMethod]
         public bool set_SaveICMOReportBill_CLD_New(Model.ClsSc_ICMOReportBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
         {
+            //涓婁紶鍓嶅垽鏂槸鍚﹀瓨鍦ㄧ浉鍚屾潯鐮�
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            DataSet ds = oCn.RunProcReturn("exec h_p_WMS_UpLoadControl " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'", "h_p_WMS_UpLoadControl");
+            if (ds == null || ds.Tables[0].Rows.Count == 0)
+            {
+            }
+            else
+            {
+                if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 1)
+                {
+                    sErrMsg = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                    return false;
+                }
+            }
+
             //if (sHSourceType == "3710")   //婧愬崟锛氱敓浜ц鍗�
             //{
             if (SaveICMOReportBill_ICMO_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg))
@@ -4956,6 +4971,21 @@
                     //"淇濆瓨澶辫触锛�";
                     sErrMsg = "鍗曟嵁鍙凤細" + oMain.HBillNo + "锛屽崟鎹甀D锛�" + oMain.HInterID + "锛�" + sErrMsg;
                     //sErrMsg = sErrMsg;
+                    return false;
+                }
+            }
+            else if (sHSourceType == "1243") //璋冩嫧鐢宠鍗�
+            {
+                if (SaveMoveStockBill_MoveStockRequest_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg))
+                {
+                    //"淇濆瓨鎴愬姛锛�";
+                    sErrMsg = "淇濆瓨鎴愬姛锛�" + oMain.HBillNo;
+                    return true;
+                }
+                else
+                {
+                    //"淇濆瓨澶辫触锛�";
+                    sErrMsg = "鍗曟嵁鍙凤細" + oMain.HBillNo + "锛屽崟鎹甀D锛�" + oMain.HInterID + "锛�" + sErrMsg;
                     return false;
                 }
             }
@@ -6002,6 +6032,298 @@
             catch (Exception e)
             {
                 sErrMsg = "鐢熸垚鍙戣揣璋冩嫧鍗曞け璐ワ紒" + e.Message;
+                oCn.RollBack();
+                return false;
+            }
+        }
+
+
+        /// <summary>
+        /// 鐩存帴璋冩嫧鍗�   婧愬崟锛氳皟鎷ㄧ敵璇峰崟
+        /// </summary>
+        /// <param name="oMain"></param>
+        /// <param name="sErrMsg"></param>
+        /// <returns></returns>
+        private bool SaveMoveStockBill_MoveStockRequest_CLD(Model.ClsKf_MoveStockBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            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();
+                //鍐欏叆WMS璋冩嫧鍗�
+                //鎻掑叆瀛愯〃
+                oCn.RunProc("EXEC h_p_Kf_MoveStockBillSub_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + sHSourceType + "'");
+                //鎻掑叆涓昏〃
+                oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
+                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
+                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
+                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
+                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
+                ",HStockStyle,HTransferDirect,HShipType" +
+                ") " +
+                " values('1207','1207'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "',convert(varchar(10),getdate(),120),'" + oMain.HMainSourceBillType + "'" +
+                ", " + oMain.HYear.ToString() + "," + oMain.HPeriod.ToString() + ",'" + oMain.HRemark + "','" + oMain.HMaker + "',convert(varchar(10),getdate(),120)" +
+                ", " + oMain.HSupID.ToString() + "," + oMain.HWHID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HEmpID.ToString() + "," + oMain.HManagerID.ToString() + "," + oMain.HSecManagerID.ToString() +
+                ", " + oMain.HKeeperID.ToString() + "," + oMain.HDeptID.ToString() + ",'" + oMain.HExplanation + "','" + oMain.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(oMain.HRedBlueFlag) +
+                ",'" + oMain.HStockStyle + "','" + oMain.HTransferDirect + "','" + oMain.HShipType + "'" +
+                ") ");
+                //鏇存柊鍏宠仈鏁伴噺
+                oCn.RunProc("exec h_p_Kf_UpDateRelation_MoveStockRequestToMoveStock_Add " + oMain.HInterID.ToString());
+
+                if (oSystemParameterMain.Kf_MoveStockBill_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                {
+                    //瀹℃牳鍗曟嵁
+                    oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString());
+                }
+
+                //鏍规嵁TMP琛� 杩斿洖 瀛愯〃淇℃伅
+                DataSet Ds;
+                Ds = oCn.RunProcReturn("exec h_p_Kf_GetMoveStockBill_MoveStockRequest_CLD_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetMoveStockBill_MoveStockRequest_CLD_New");
+                if (Ds == null || Ds.Tables[0].Rows.Count == 0 || Ds.Tables[1].Rows.Count == 0)
+                {
+                    sErrMsg = "鑾峰彇瀛愯〃淇℃伅澶辫触锛�";
+                    oCn.RollBack();
+                    return false;
+                }
+                else
+                {
+                    string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\"," +
+                        "\"IsEntryBatchFill\":\"True\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," +
+                        "\"Model\":{ " +
+                        //\"FID\":\"0\",
+                        "\"FBillNo\":\"" + oMain.HBillNo + "\"," +
+                        "\"FBillTypeID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillTypeID"]) + "\"}," +
+                        "\"FBizType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBizType"]) + "\"," +
+                        "\"FTransferDirect\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FTransferDirect"]) + "\"," +
+                        "\"FTransferBizType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FTransferBizType"]) + "\"," +
+                        "\"FSettleOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSettleOrgId"]) + "\"}," +
+                        "\"FSaleOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSaleOrgId"]) + "\"}," +
+                        "\"FStockOutOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockOutOrgId"]) + "\"}," +
+                        "\"FOwnerTypeOutIdHead\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeOutIdHead"]) + "\"," +
+                        "\"FOwnerOutIdHead\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerOutIdHead"]) + "\"}," +
+                        "\"FStockOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockOrgId"]) + "\"}," +
+                        "\"FIsIncludedTax\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FIsIncludedTax"]) + "\"," +
+                        "\"FIsPriceExcludeTax\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FIsPriceExcludeTax"]) + "\"," +
+                        "\"FOwnerTypeIdHead\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeIdHead"]) + "\"," +
+                        "\"FSETTLECURRID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSETTLECURRID"]) + "\"}," +
+                        "\"FOwnerIdHead\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerIdHead"]) + "\"}," +
+                        //\"FStockerId\":{\"FNumber\":\"\"},
+                        //\"FStockerGroupId\":{\"FNumber\":\"\"},
+                        "\"FDATE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDATE"]) + "\"," +
+                        //\"FNote\":\"\",
+                        "\"FBaseCurrId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBaseCurrId"]) + "\"}," +
+                        "\"FSUPPLIERID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSUPPLIERID"]) + "\"}," +
+                        //\"FCustID\":{\"FNUMBER\":\"\"},
+                        //\"FScanBox\":\"\",
+                        //\"FThirdSystem\":\"\",
+                        //\"FThirdSrcBillNo\":\"\",
+                        //\"FThirdSrcId\":\"\",
+                        "\"FBillEntry\": [  ";
+                    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_SrcStockPlace = "";
+                        string sJson_DestStockPlace = "";
+                        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]["FSrcStockLocId"]) == "")
+                        {
+                            sJson_SrcStockPlace = "";
+                        }
+                        else
+                        {
+                            sJson_SrcStockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockLocId"]) + "\"}},";
+                        }
+                        //璋冨嚭浠撲綅
+                        if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockLocId"]) == "")
+                        {
+                            sJson_DestStockPlace = "";
+                        }
+                        else
+                        {
+                            sJson_DestStockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockLocId"]) + "\"}},";
+                        }
+                        //
+                        sJson_Entry = sJson_Entry + " {" +
+                        //\"FEntryID\":\"0\",
+                        " \"FMaterialId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMaterialId"]) + "\"}," +
+                        " \"FAuxPropId\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAuxPropId"]) + "\"}}," +
+                        " \"FUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUnitID"]) + "\"}," +
+                        " \"FQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FQty"]) + "\"," +
+                        sJson_BatchNo +
+                        " \"FSrcStockId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockId"]) + "\"}," +
+                        sJson_SrcStockPlace +
+                        //\"FPrice\":\"0\",
+                        " \"FDestStockId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockId"]) + "\"}," +
+                        sJson_DestStockPlace +
+                        " \"FBomId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBomId"]) + "\"}," +
+                        " \"FSrcStockStatusId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockStatusId"]) + "\"}," +
+                        //\"FDeliChkQualifyType\":\"\",
+                        //\"FAmount\":\"0\",
+                        " \"FProduceDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProduceDate"]) + "\"," +
+                        " \"FDestStockStatusId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockStatusId"]) + "\"}," +
+                        " \"FMtoNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMtoNo"]) + "\"," +
+                        " \"FBusinessDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBusinessDate"]) + "\"," +
+                        " \"FExpiryDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExpiryDate"]) + "\"," +
+                        " \"FOwnerTypeOutId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerTypeOutId"]) + "\"," +
+                        " \"FOwnerOutId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerOutId"]) + "\"}," +
+                        " \"FOwnerTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerTypeId"]) + "\"," +
+                        " \"FOwnerId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerId"]) + "\"}," +
+                        //\"FNoteEntry\":\"\",
+                        //" \"FProjectNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProjectNo"]) + "\"," +
+                        //\"FOutJoinQty\":\"0\",
+                        " \"FSecUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSecUnitId"]) + "\"}," +
+                        //\"FSecQty\":\"0\",
+                        //\"FBASEOUTJOINQTY\":\"0\",
+                        " \"FBaseUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseUnitId"]) + "\"}," +
+                        " \"FExtAuxUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExtAuxUnitId"]) + "\"}," +
+                        //\"FExtAuxUnitQty\":\"0\",
+                        " \"FBaseQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseQty"]) + "\"," +
+                        " \"FISFREE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISFREE"]) + "\"," +
+                        " \"FKeeperTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeId"]) + "\"," +
+                        //\"FActQty\":\"0\",
+                        " \"FKeeperId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperId"]) + "\"}," +
+                        " \"FKeeperTypeOutId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeOutId"]) + "\"," +
+                        " \"FKeeperOutId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperOutId"]) + "\"}," +
+                        //\"FDiscountRate\":\"0\",
+                        //\"FRepairQty\":\"0\",
+                        //\"FRETURNNOTE\":\"\",
+                        //" \"FDestLot\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestLot"]) + "\"}," +
+                        " \"FDestMaterialId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestMaterialId"]) + "\"}," +
+                        //" \"FDestBomId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestBomId"]) + "\"}," +
+                        //\"FServiceContext\":\"\",
+                        " \"FPriceUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPriceUnitID"]) + "\"}," +
+                        " \"FPriceQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPriceQty"]) + "\"," +
+                        " \"FPriceBaseQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPriceBaseQty"]) + "\"," +
+                        //\"FSOEntryId\":\"0\",
+                        " \"FTransReserveLink\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FTransReserveLink"]) + "\"," +
+                        //\"FQmEntryId\":\"0\",
+                        //\"FConvertEntryId\":\"0\",
+                        //\"FThirdSrcEntryId\":\"\",
+                        //
+                        " \"FSNUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSNUnitID"]) + "\"}," +
+                        " \"FSrcBillNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBillNo"]) + "\"," +
+                        " \"FSrcBillTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBillTypeId"]) + "\"," +
+                        " \"FSaleUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSaleUnitId"]) + "\"}," +
+                        " \"FSRCBIZUNITID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBIZUNITID"]) + "\"}," +
+                        " \"FSrcAuxUnitId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcAuxUnitId"]) + "\"}," +
+                        " \"FSrcBizBaseQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBizBaseQty"]) + "\"," +
+                        " \"FSrcAuxBaseQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcAuxBaseQty"]) + "\"," +
+
+                        //\"FSerialSubEntity\":[{\"FDetailID\":\"0\",
+                        //\"FSerialNo\":\"\",
+                        //\"FSerialNote\":\"\"}]
+
+                        " \"FBillEntry_Link\": [{" +
+                            " \"FBillEntry_Link_FFlowId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowId"]) + "\"," +
+                            " \"FBillEntry_Link_FFlowLineId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowLineId"]) + "\"," +
+                            " \"FBillEntry_Link_FRuleId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FRuleId"]) + "\"," +
+                            " \"FBillEntry_Link_FSTableName\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSTableName"]) + "\"," +
+                            " \"FBillEntry_Link_FSBillId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSBillId"]) + "\"," +
+                            " \"FBillEntry_Link_FBASEQTYOLD\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FBASEQTYOLD"]) + "\"," +
+                            " \"FBillEntry_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))
+                    {
+                        sErrMsg = Pub_Class.ClsPub.sExeReturnInfo;
+                        return false;
+                    }
+
+                    //鑾峰彇CLOUD璐﹀彿瀵嗙爜
+                    string sCLOUDUseName = Pub_Class.ClsPub.sCLOUDUseName;
+                    string sCLOUDPsd = Pub_Class.ClsPub.sCLOUDPsd;
+                    DataSet ds11 = get_SaveCLOUDUseNameandPsd(oMain.HInterID);
+                    if (ds11 == null || ds11.Tables[0].Rows.Count == 0)
+                    {
+                    }
+                    else
+                    {
+                        sCLOUDUseName = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserName"]);
+                        sCLOUDPsd = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserPsd"]);
+                    }
+
+                    //鐢熸垚 鐩存帴璋冩嫧
+                    string HReturn;
+                    ApiClient client = new ApiClient(Pub_Class.ClsPub.sCLOUDUrl);
+                    string dbId = Pub_Class.ClsPub.sCLOUDAcc; //AotuTest117
+                    bool bLogin = client.Login(dbId, sCLOUDUseName, sCLOUDPsd, 2052);
+                    if (bLogin)
+                    {
+                        var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save",
+                        new object[] { "STK_TransferDirect", sJson });
+
+                        ////鐢熸垚鍗曟嵁鍚庢洿鏂拌嚜瀹氫箟瀛楁
+                        oCn.RunProc("exec h_p_Sc_UpDateSelfFildMove_MoveStockRequest '" + oMain.HBillNo + "'");
+
+                        if (oSystemParameterMain.Kf_MoveStockBill_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                        {
+                            string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
+                            var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit",
+                            new object[] { "STK_TransferDirect", sJson2 });
+
+                            string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
+                            var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit",
+                            new object[] { "STK_TransferDirect", sJson3 });
+
+                            HReturn = result.ToString() + "," + result2.ToString() + "," + result3.ToString();
+                        }
+                        else
+                        {
+                            HReturn = result.ToString();
+                        }
+                        if (HReturn.Contains("\"IsSuccess\":false") == true)
+                        {
+                            sErrMsg = "鐢熸垚鐩存帴璋冩嫧鍗曞け璐ワ紒" + HReturn + sJson;
+                            oCn.RollBack();
+                            return false;
+                        }
+                        else
+                        {
+                            oCn.Commit();
+                            return true;
+                        }
+                    }
+                    else
+                    {
+                        sErrMsg = "鐢熸垚鐩存帴璋冩嫧鍗曞け璐ワ紒鐧诲綍澶辫触锛�";
+                        oCn.RollBack();
+                        return false;
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                sErrMsg = "鐢熸垚鐩存帴璋冩嫧鍗曞け璐ワ紒" + e.Message;
                 oCn.RollBack();
                 return false;
             }
@@ -18727,6 +19049,21 @@
         [WebMethod]
         public bool set_SaveProductInBill_CLD(Model.ClsKf_ProductInBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
         {
+            //涓婁紶鍓嶅垽鏂槸鍚﹀瓨鍦ㄧ浉鍚屾潯鐮�
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            DataSet ds = oCn.RunProcReturn("exec h_p_WMS_UpLoadControl " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'", "h_p_WMS_UpLoadControl");
+            if (ds == null || ds.Tables[0].Rows.Count == 0)
+            {
+            }
+            else
+            {
+                if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 1)
+                {
+                    sErrMsg = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                    return false;
+                }
+            }
+
             if (sHSourceType == "3710")   //鐢熶骇璁㈠崟
             {
                 if (SaveProductInBill_CLD(oMain, oSystemParameterMain, ref sErrMsg))

--
Gitblit v1.9.1