From e7b8cfdb15198da1fd1212a055a43849f364164a Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期二, 06 六月 2023 11:06:31 +0800
Subject: [PATCH] 新增换托调拨单模块调用方法

---
 CLOUDWEB/WebService1.asmx.cs |  562 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 543 insertions(+), 19 deletions(-)

diff --git a/CLOUDWEB/WebService1.asmx.cs b/CLOUDWEB/WebService1.asmx.cs
index a4a6855..f568021 100644
--- a/CLOUDWEB/WebService1.asmx.cs
+++ b/CLOUDWEB/WebService1.asmx.cs
@@ -16442,7 +16442,7 @@
             SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
             //鑾峰彇绯荤粺鍙傛暟
             Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
-            if (oSystemParameter.ShowBill(ref sErrMsg) == false)
+            if (oSystemParameter.ShowBillByOrgID(oMain.HSTOCKORGID, ref sErrMsg) == false)
             {
                 sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
                 return false;
@@ -16466,8 +16466,12 @@
             try
             {
                 oCn.BeginTran();
-                //鍐欏叆鏉$爜鍑哄叆搴撹〃
-                oCn.RunProc("EXEC h_p_Kf_ICStockBillSub_WMS_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + oMain.HBillNo + "'");
+
+                if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl != "Y")
+                {
+                    //鍐欏叆鏉$爜鍑哄叆搴撹〃
+                    oCn.RunProc("EXEC h_p_Kf_ICStockBillSub_WMS_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + oMain.HBillNo + "'");
+                }
 
                 //浠庨厤缃枃浠惰幏鍙� CLOUD缃戝潃銆佽处濂椾俊鎭�佺櫥褰曠敤鎴枫�佺櫥褰曞瘑鐮�
                 if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo))
@@ -50205,6 +50209,477 @@
         #endregion
 
 
+        #region 鎹㈡墭璋冩嫧鍗曟ā鍧楄皟鐢ㄦ柟娉�     20230531鏂板
+
+        #region 鎹㈡墭璋冩嫧鍗曟ā鍧� 鎵弿璋冨叆鎵樻潯鐮�
+
+        [WebMethod]
+        public Model.ClsKf_ICStockBill_WMS get_BarCodePack_In_MoveStockBill_HuanTuo(Int64 HInterID, string HBillNo, string HBarCode_Pack, Int64 HStockOrgID, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
+
+            //鍒ゆ柇鎵�鎵皟鍏ユ墭鏉$爜鏄惁鏈夋晥锛屾湁鏁堣繑鍥炲搴旀墭鏉$爜銆佷粨搴撱�佷粨浣嶄俊鎭�
+            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddPackBarCode_MoveStockBill_HuanTuo " + HInterID.ToString() + ",'" + HBillNo + "','" + HBarCode_Pack + "'," + HStockOrgID.ToString(), "h_p_WMS_AddPackBarCode_MoveStockBill_HuanTuo");
+            if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
+            {
+                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涘垽鏂墍鎵皟鍏ユ墭鏉$爜鏄惁鏈夋晥澶辫触锛�";
+                return null;
+            }
+            else
+            {
+                if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
+                {
+                    oBar.HInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceInterID"]);
+                    oBar.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBarCode_Pack"]);
+                    oBar.HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]);
+                    oBar.HWhName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HWhName"]);
+                    oBar.HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]);
+                    oBar.HSPName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSPName"]);
+                    return oBar;
+                }
+                else
+                {
+                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛�" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
+                    return null;
+                }
+            }
+        }
+
+        #endregion
+
+        #region 鎹㈡墭璋冩嫧鍗曟ā鍧� 鎵弿璋冨嚭鏉$爜
+
+        [WebMethod]
+        public bool get_BarCode_MoveStockBill_HuanTuo(Int64 HInterID, string HBillNo, string HBillType, string HBarCode, string HBarCode_Pack, Int64 HPackUnionInterID_In, Int64 HWhID, Int64 HSPID, string HMaker, Int64 HStockOrgID, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            DataSet ds = oCN.RunProcReturn("exec h_p_WMS_AddBarCode_MoveStockBill_HuanTuo " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode + "','" + HBarCode_Pack + "'," + HPackUnionInterID_In.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HMaker + "'," + HStockOrgID.ToString(), "h_p_WMS_AddBarCode_MoveStockBill_HuanTuo");
+            if (ds == null || ds.Tables[0].Rows.Count == 0)
+            {
+                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涙壂鎻忚皟鍑烘潯鐮佸垽鏂け璐ワ紒";
+                return false;
+            }
+            else
+            {
+                if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 0)
+                {
+                    return true;
+                }
+                else
+                {
+                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                    return false;
+                }
+            }
+        }
+
+        #endregion
+
+        #region 鎹㈡墭璋冩嫧鍗曟ā鍧� 杩斿洖鍒楄〃淇℃伅
+
+        [WebMethod]
+        public DataSet GetBillEntry_Temp_MoveStockBill_HuanTuo(Int64 HInterID, string HBillNo, string HBillType, Int64 HStockOrgID, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            DataSet DS = oCn.RunProcReturn("exec h_p_WMS_BillEntryTmp_MoveStockBill_HuanTuo " + HInterID.ToString() + ",'" + HBillType + "'", "h_p_WMS_BillEntryTmp_MoveStockBill_HuanTuo");
+            return DS;
+        }
+
+        #endregion
+
+        #region 鎹㈡墭璋冩嫧鍗曟ā鍧� 鎵弿鍒犻櫎鏄庣粏琛ㄤ綋琛岃褰�
+
+        [WebMethod]
+        public bool set_DelPackUnionBill_Temp_MoveStockBill_HuanTuo(Int64 HInterID, string HBarCode, string HBillType, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            try
+            {
+                oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HInterID=" + HInterID.ToString() + " and HBillType='" + HBillType + "' and ( HBarCode='" + HBarCode + "' or HBarCode_Pack='" + HBarCode + "')", ref DBUtility.ClsPub.sExeReturnInfo);
+                return true;
+            }
+            catch (Exception e)
+            {
+                sErrMsg = "鍒犻櫎鎹㈡墭璋冩嫧璁板綍澶辫触锛�" + e.Message;
+                return false;
+            }
+        }
+
+        #endregion
+
+        #region 涓婁紶鐢熸垚鎹㈡墭璋冩嫧鍗�
+
+        [WebMethod]
+        public bool set_SaveMoveStockBill_HuanTuo(Int64 HInterID, string HBillType, string HBillNo, string HBarCode_Pack, string HMaker, Int64 HStockOrgID, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            int sStatus = 2;    //1=鍚屼粨搴撲粨浣嶆崲鎵橈紱2=闈炲悓浠撳簱浠撲綅鎹㈡墭
+            //鑾峰彇绯荤粺鍙傛暟
+            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+            if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == false)
+            {
+                sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                return false;
+            }
+
+            //涓婁紶鍓嶅垽鏂�
+            DataSet Dsload = oCn.RunProcReturn("exec h_p_WMS_BeforeUpload_MoveStockBill_HuanTuo " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "'", "h_p_WMS_BeforeUpload_MoveStockBill_HuanTuo");
+            if (Dsload == null || Dsload.Tables[0].Rows.Count == 0)
+            {
+                sErrMsg = "鎹㈡墭璋冩嫧涓婁紶鍓嶅垽鏂紝鍙戠敓閿欒锛�";
+                return false;
+            }
+            else
+            {
+                if (DBUtility.ClsPub.isLong(Dsload.Tables[0].Rows[0][0]) == 1)
+                {
+                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛�" + DBUtility.ClsPub.isStrNull(Dsload.Tables[0].Rows[0]["HRemark"]);
+                    return false;
+                }
+                else
+                {
+                    sStatus = DBUtility.ClsPub.isInt(Dsload.Tables[0].Rows[0]["HStatus"]);
+                }
+            }
+
+            //鍚屼粨搴撲粨浣嶆崲鎵�
+            if (sStatus==1)
+            {
+                try
+                {
+                    oCn.BeginTran();
+                    //鐢熸垚鏉$爜鍑哄叆搴撳崟鎹�佽皟鎷ㄥ崟鎹�佺粍鎵樺崟绛�
+                    DataSet dsInsert = oCn.RunProcReturn("exec h_p_Kf_MoveStockBill_Insert_HuanTuo " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_Kf_MoveStockBill_Insert_HuanTuo");
+                    if (dsInsert == null || dsInsert.Tables[0].Rows.Count == 0)
+                    {
+                        sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涗笂浼犲け璐ワ紒";
+                        oCn.RollBack();
+                        return false;
+                    }
+                    else
+                    {
+                        if (DBUtility.ClsPub.isLong(dsInsert.Tables[0].Rows[0][0]) == 1)
+                        {
+                            sErrMsg = "涓婁紶澶辫触锛屽崟鎹彿锛�" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛�" + DBUtility.ClsPub.isStrNull(dsInsert.Tables[0].Rows[0]["HRemark"]);
+                            oCn.RollBack();
+                            return false;
+                        }
+                        else
+                        {
+                            sErrMsg = "鐢熸垚鍚屼粨搴撲粨浣嶆崲鎵樿皟鎷ㄥ崟鎴愬姛锛佸崟鎹彿涓猴細" + HBillNo;
+                            oCn.Commit();
+                            return true;
+                        }
+                    }
+                }
+                catch (Exception e)
+                {
+                    sErrMsg = "鐢熸垚鍚屼粨搴撲粨浣嶆崲鎵樿皟鎷ㄥ崟澶辫触锛�" + e.Message;
+                    oCn.RollBack();
+                    return false;
+                }
+            }
+            else
+            //闈炲悓浠撳簱浠撲綅鎹㈡墭
+            {
+                string sRemark = "";
+                //浠庨厤缃枃浠惰幏鍙� 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(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);
+
+                sRemark = sRemark + " 锛涜幏鍙栭獙璇丆LOUD璐﹀彿瀵嗙爜" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
+
+                try
+                {
+                    oCn.BeginTran();
+                    //鐢熸垚鏉$爜鍑哄叆搴撳崟鎹�佽皟鎷ㄥ崟鎹�佺粍鎵樺崟绛�
+                    DataSet dsInsert2 = oCn.RunProcReturn("exec h_p_Kf_MoveStockBill_Insert_HuanTuo " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_Kf_MoveStockBill_Insert_HuanTuo");
+                    if (dsInsert2 == null || dsInsert2.Tables[0].Rows.Count == 0)
+                    {
+                        sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涗笂浼犲け璐ワ紒";
+                        oCn.RollBack();
+                        return false;
+                    }
+                    else
+                    {
+                        if (DBUtility.ClsPub.isLong(dsInsert2.Tables[0].Rows[0][0]) == 1)
+                        {
+                            sErrMsg = "涓婁紶澶辫触锛屽崟鎹彿锛�" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛�" + DBUtility.ClsPub.isStrNull(dsInsert2.Tables[0].Rows[0]["HRemark"]);
+                            oCn.RollBack();
+                            return false;
+                        }
+                    }
+
+                    sRemark = sRemark + " 锛涚敓鎴愭崲鎵樿皟鎷ㄥ崟鎹�" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
+
+                    //鏍规嵁TMP琛� 杩斿洖 淇℃伅
+                    DataSet Ds;
+                    if (oSystemParameter.omodel.WMS_CloudMode == "N") //绯荤粺鍙傛暟  鏄惁涓虹鏈変簯妯″紡(N涓哄叕鏈変簯妯″紡锛孻涓虹鏈変簯妯″紡)
+                    {
+                        Ds = oCn.RunProcReturn("exec h_p_Kf_GetMoveOutBill_PUBCLD " + HInterID + ",'" + HBillNo + "'", "h_p_Kf_GetMoveOutBill_PUBCLD");
+                        sRemark = sRemark + " 锛涘叕鏈変簯妯″紡";
+                    }
+                    else
+                    {
+                        Ds = oCn.RunProcReturn("exec h_p_Kf_GetMoveOutBill_CLD " + HInterID + ",'" + HBillNo + "'", "h_p_Kf_GetMoveOutBill_CLD");
+                        sRemark = sRemark + " 锛涚鏈変簯妯″紡";
+                    }
+                    if (Ds == null || Ds.Tables[0].Rows.Count == 0 || Ds.Tables[1].Rows.Count == 0)
+                    {
+                        sErrMsg = "涓婁紶澶辫触锛屽崟鎹彿锛�" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涜幏鍙朩ebAPI閫掑叆淇℃伅澶辫触锛�";
+                        oCn.RollBack();
+                        return false;
+                    }
+                    else
+                    {
+                        string sJson_MainCustom = "";    //涓昏〃鑷畾涔夊瓧娈�
+                        sJson_MainCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["MainCustom"]);
+
+                        string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[]," +
+                            "\"Model\":{ " +
+                            "\"FBillNo\":\"" + 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"]) + "\" }," +
+                            "\"FDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDate"]) + "\"," +
+                            "\"FBaseCurrId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBaseCurrId"]) + "\" }," +
+                            sJson_MainCustom +
+                            "\"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 = "";
+                            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]["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_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},";
+
+                            sJson_Entry = sJson_Entry + " {\"FSEQ\":\"" + Convert.ToString(i + 1) + "\"," +
+                            "\"FMaterialId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMaterialId"]) + "\" }," +
+                            sJson_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 +
+                            //"\"FSrcStockLocId\":{\"FSRCSTOCKLOCID__FF100002\":{\"FNUMBER\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockLocId"]) + "\"}}," +
+                            "\"FDestStockId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockId"]) + "\" }," +
+                            sJson_DestStockPlace +
+                            //"\"FDestStockLocId\":{\"FDESTSTOCKLOCID__FF100002\":{\"FNUMBER\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockLocId"]) + "\"}}," +
+                            "\"FSrcStockStatusId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockStatusId"]) + "\" }," +
+                            "\"FDestStockStatusId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockStatusId"]) + "\" }," +
+                            // "\"FBusinessDate\":\"" + oMain.HDate.ToShortDateString() + "\"," +
+                            sJson_FProduceDate +
+                            sJson_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"]) + "\" }," +
+                            "\"FBaseUnitId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseUnitId"]) + "\" }," +
+                            "\"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"]) + "\"," +
+                            "\"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"]) + "\" }," +
+                            "\"FDestMaterialId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestMaterialId"]) + "\" }," +
+                            "\"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]["FPriceQty"]) + "\"," +
+                            "\"FTransReserveLink\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FTransReserveLink"]) + "," +
+                            sJson_SubCustom +
+                            "\"FCheckDelivery\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCheckDelivery"]) + "} ";
+                        }
+                        string sJson_End = "  ]  }}";
+                        string sJson = sJson_Main + sJson_Entry + sJson_End;
+
+                        sRemark = sRemark + " 锛涜幏鍙朇LOUD鍗曟嵁API閫掑叆鍊�" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
+
+                        //鐢熸垚閲戣澏浜戝崟鎹�
+                        if (bLogin)
+                        {
+                            var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save",
+                            new object[] { "STK_TransferDirect", sJson });
+
+                            sRemark = sRemark + " 锛涚敓鎴怌LOUD鍗曟嵁" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
+
+                            HReturn = result.ToString();
+
+                            if (HReturn.Contains("\"IsSuccess\":false") == true)
+                            {
+                                sErrMsg = "鐢熸垚鎹㈡墭璋冩嫧鍗曞け璐ワ紒" + HReturn;
+                                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("鐢熸垚鍥炴粴" + sRemark);
+                    sErrMsg = "鐢熸垚鎹㈡墭璋冩嫧鍗曞け璐ワ紒" + e.Message;
+                    oCn.RollBack();
+                    return false;
+                }
+
+                if (oSystemParameter.omodel.Kf_MoveStockBill_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                {
+                    try
+                    {
+                        oCn.BeginTran();
+                        //瀹℃牳WMS鍗曟嵁
+                        oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + HMaker + "',HCheckDate=convert(varchar(10),getdate(),120),HBillStatus=2 where HInterID= " + HInterID.ToString());
+
+                        //鎻愪氦銆佸鏍搁噾铦朵簯鍗曟嵁
+                        HReturn = "";
+                        string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + HBillNo + "\"]}";
+                        var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit",
+                        new object[] { "STK_TransferDirect", sJson2 });
+
+                        string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + HBillNo + "\"]}";
+                        var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit",
+                        new object[] { "STK_TransferDirect", sJson3 });
+
+                        HReturn = result2.ToString() + "," + result3.ToString();
+
+                        if (HReturn.Contains("\"IsSuccess\":false") == true)
+                        {
+                            LogService.Write("瀹℃牳鍗曟嵁澶辫触" + sRemark);
+                            sErrMsg = "鐢熸垚鎹㈡墭璋冩嫧鍗曟垚鍔燂紝瀹℃牳鍗曟嵁澶辫触锛�" + HReturn;
+                            oCn.RollBack();
+                            return true;
+                        }
+                        else
+                        {
+                            LogService.Write("鐢熸垚骞跺鏍告崲鎵樿皟鎷ㄥ崟锛堟簮鍗曪細鏃犳簮鍗曪級鎴愬姛锛�" + sRemark);
+                            sErrMsg = "鐢熸垚骞跺鏍告崲鎵樿皟鎷ㄥ崟鎴愬姛锛佸崟鎹彿涓猴細" + HBillNo;
+                            oCn.Commit();
+                            return true;
+                        }
+                    }
+                    catch (Exception e)
+                    {
+                        LogService.Write("瀹℃牳鍥炴粴" + sRemark);
+                        sErrMsg = "瀹℃牳鎹㈡墭璋冩嫧鍗曞け璐ワ紒" + e.Message;
+                        oCn.RollBack();
+                        return false;
+                    }
+                }
+                else
+                {
+                    LogService.Write("鐢熸垚鎹㈡墭璋冩嫧鍗曪紙婧愬崟锛氭棤婧愬崟锛夋垚鍔燂紒" + sRemark);
+                    sErrMsg = "鐢熸垚鎹㈡墭璋冩嫧鍗曟垚鍔燂紒鍗曟嵁鍙蜂负锛�" + HBillNo;
+                    return true;
+                }
+            }
+        }
+
+        #endregion
+
+
+        #endregion
+
+
         #region 鐢熶骇瑁呯杩芥函鍗曟ā鍧楄皟鐢ㄦ柟娉�
 
         #region 鎵弿绠辨潯鐮�
@@ -50433,30 +50908,79 @@
         {
             SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
             Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
-            //灏嗗崟鎹俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBillBarCode_BillCheck '" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddBillBarCode_BillCheck");
-            if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
+
+            //鑾峰彇绯荤粺鍙傛暟
+            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+            if (oSystemParameter.ShowBillByOrgID(HOWNERID, ref sErrMsg) == false)
             {
-                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛涘皢鍗曟嵁淇℃伅瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃澶辫触锛�";
+                sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
                 return null;
             }
-            else
+
+            string sSourceBarCodeCtl = "N";   //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
+            if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
             {
-                if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
+                //閿�鍞嚭搴撳崟
+                sSourceBarCodeCtl = "Y";
+            }
+
+            //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
+            if (sSourceBarCodeCtl == "Y")
+            {
+                //灏嗗崟鎹俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛� KF_PonderationBillMain_Temp锛屽崟鎹搴旀潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱璁板綍涓存椂琛� Kf_ICStockBillSub_WMS_Temp
+                DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBillBarCode_BillCheckVerify '" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddBillBarCode_BillCheckVerify");
+                if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
                 {
-                    oBar.HInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HInterID"]);
-                    oBar.HBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBillNo"]);
-                    oBar.HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]);
-                    oBar.HWhName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HWhName"]);
-                    oBar.HSPFlag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HSPFlag"]);
-                    oBar.HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]);
-                    oBar.HSPName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSPName"]);
-                    return oBar;
+                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛涘皢鍗曟嵁淇℃伅瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃澶辫触锛�";
+                    return null;
                 }
                 else
                 {
-                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛�" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
+                    if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
+                    {
+                        oBar.HInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HInterID"]);
+                        oBar.HBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBillNo"]);
+                        oBar.HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]);
+                        oBar.HWhName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HWhName"]);
+                        oBar.HSPFlag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HSPFlag"]);
+                        oBar.HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]);
+                        oBar.HSPName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSPName"]);
+                        return oBar;
+                    }
+                    else
+                    {
+                        sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛�" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
+                        return null;
+                    }
+                }
+            }
+            else
+            {
+                //灏嗗崟鎹俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBillBarCode_BillCheck '" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddBillBarCode_BillCheck");
+                if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
+                {
+                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛涘皢鍗曟嵁淇℃伅瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃澶辫触锛�";
                     return null;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
+                    {
+                        oBar.HInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HInterID"]);
+                        oBar.HBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBillNo"]);
+                        oBar.HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]);
+                        oBar.HWhName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HWhName"]);
+                        oBar.HSPFlag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HSPFlag"]);
+                        oBar.HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]);
+                        oBar.HSPName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSPName"]);
+                        return oBar;
+                    }
+                    else
+                    {
+                        sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛�" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
+                        return null;
+                    }
                 }
             }
         }
@@ -51508,7 +52032,7 @@
             {
                 //鑾峰彇绯荤粺鍙傛暟
                 Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
-                if (oSystemParameter.ShowBill(ref sErrMsg) == false)
+                if (oSystemParameter.ShowBillByOrgID(HOWNERID, ref sErrMsg) == false)
                 {
                     sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
                     return null;

--
Gitblit v1.9.1