From 4a25eeca358b3c50383adfea3875be6c2ba077f9 Mon Sep 17 00:00:00 2001
From: YL <YL@LAPTOP-SE03PLUR>
Date: 星期一, 13 十二月 2021 16:56:04 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MESWMS-WEBS

---
 DLL/Model.dll                |    0 
 DLL/DAL.dll                  |    0 
 CLOUDWEB/CLOUDWEB.csproj     |    1 
 CLOUDWEB/WebService1.asmx.cs |  652 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 4 files changed, 622 insertions(+), 31 deletions(-)

diff --git a/CLOUDWEB/CLOUDWEB.csproj b/CLOUDWEB/CLOUDWEB.csproj
index 8449caf..6f15c70 100644
--- a/CLOUDWEB/CLOUDWEB.csproj
+++ b/CLOUDWEB/CLOUDWEB.csproj
@@ -235,6 +235,7 @@
     <Content Include="packages.config" />
     <Content Include="WebService1.asmx" />
     <None Include="Properties\PublishProfiles\CLOUDWEBAPI.pubxml" />
+    <None Include="Properties\PublishProfiles\WEBS.pubxml" />
     <None Include="Scripts\jquery-1.8.2.intellisense.js" />
     <Content Include="Scripts\jquery-1.8.2.js" />
     <Content Include="Scripts\jquery-1.8.2.min.js" />
diff --git a/CLOUDWEB/WebService1.asmx.cs b/CLOUDWEB/WebService1.asmx.cs
index 7451b6f..20ad5c4 100644
--- a/CLOUDWEB/WebService1.asmx.cs
+++ b/CLOUDWEB/WebService1.asmx.cs
@@ -4948,6 +4948,9 @@
                             {
                                 sErrMsg = "";
                             }
+
+                            //杞﹂棿鍦ㄧ嚎鎶ュ伐妯″潡 姹囨姤鍚庯紝鏍规嵁姹囨姤鏁伴噺 鍙嶅啓 鏉$爜鏍囩鏁伴噺
+                            oCn.RunProc("exec h_p_WMS_UpdateHQtyByBarCodeBill " + oMain.HInterID.ToString() + ",'3711'");
                             oCn.Commit();
                             return true;
                         }
@@ -5306,7 +5309,7 @@
                     string msgReport = dbId + ';' + sCLOUDUseName + ';' + sCLOUDPsd + ';' + 2052;
 
                     
-                    LogService.Write($"{Pub_Class.ClsPub.sCLOUDUrl}銆亄dbId}銆亄sCLOUDUseName}銆亄sCLOUDPsd}");
+                    //LogService.Write($"{Pub_Class.ClsPub.sCLOUDUrl}銆亄dbId}銆亄sCLOUDUseName}銆亄sCLOUDPsd}");
 
                     LogService.Write(sJson);
                   
@@ -5485,7 +5488,7 @@
                 if (oSystemParameterMain.WMS_MouldManagerCtl == "Y") //绯荤粺鍙傛暟  鍚敤鍣ㄥ叿绠$悊
                 {
                     string HMouldBillType = "3814";
-                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString());
+                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString() + ",3");
                 }
 
                 //鏍规嵁TMP琛� 杩斿洖 瀛愯〃淇℃伅
@@ -5762,7 +5765,7 @@
                 if (oSystemParameterMain.WMS_MouldManagerCtl == "Y") //绯荤粺鍙傛暟  鍚敤鍣ㄥ叿绠$悊
                 {
                     string HMouldBillType = "3814";
-                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString());
+                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString() + ",3");
                 }
 
                 //鏍规嵁TMP琛� 杩斿洖 瀛愯〃淇℃伅
@@ -6019,7 +6022,7 @@
                 if (oSystemParameterMain.WMS_MouldManagerCtl == "Y") //绯荤粺鍙傛暟  鍚敤鍣ㄥ叿绠$悊
                 {
                     string HMouldBillType = "3814";
-                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString());
+                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString() + ",3");
                 }
 
                 //鏍规嵁TMP琛� 杩斿洖 瀛愯〃淇℃伅
@@ -7499,7 +7502,7 @@
                 if (oSystemParameterMain.WMS_MouldManagerCtl == "Y") //绯荤粺鍙傛暟  鍚敤鍣ㄥ叿绠$悊
                 {
                     string HMouldBillType = "3814";
-                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString());
+                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString() + ",3");
                 }
 
                 //鏍规嵁TMP琛� 杩斿洖 瀛愯〃淇℃伅
@@ -7903,7 +7906,7 @@
                 if (oSystemParameterMain.WMS_MouldManagerCtl == "Y") //绯荤粺鍙傛暟  鍚敤鍣ㄥ叿绠$悊
                 {
                     string HMouldBillType = "3840";
-                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString());
+                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString() + ",3");
                 }
 
                 //鏍规嵁TMP琛� 杩斿洖 瀛愯〃淇℃伅
@@ -8208,7 +8211,7 @@
                 if (oSystemParameterMain.WMS_MouldManagerCtl == "Y") //绯荤粺鍙傛暟  鍚敤鍣ㄥ叿绠$悊
                 {
                     string HMouldBillType = "3840";
-                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString());
+                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString() + ",3");
                 }
 
                 //鏍规嵁TMP琛� 杩斿洖 瀛愯〃淇℃伅
@@ -8556,7 +8559,7 @@
                 if (oSystemParameterMain.WMS_MouldManagerCtl == "Y") //绯荤粺鍙傛暟  鍚敤鍣ㄥ叿绠$悊
                 {
                     string HMouldBillType = "3841";
-                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString());
+                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString() + ",3");
                 }
 
                 //鏍规嵁TMP琛� 杩斿洖 瀛愯〃淇℃伅
@@ -12560,7 +12563,7 @@
                 if (oSystemParameterMain.WMS_MouldManagerCtl == "Y") //绯荤粺鍙傛暟  鍚敤鍣ㄥ叿绠$悊
                 {
                     string HMouldBillType = "3802";
-                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString());
+                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString() + ",2");
                 }
 
                 //鏍规嵁TMP琛� 杩斿洖 瀛愯〃淇℃伅
@@ -14009,6 +14012,23 @@
                 sErrMsg = "鍙戞枡娌℃湁閫夋嫨锛�";
                 return false;
             }
+            //鐢熸垚棰嗘枡鍑哄簱鍗曞墠鍒ゆ柇
+            DataSet DsCheck;
+            DsCheck = oCn.RunProcReturn("exec h_p_K3_LoadMateOutCheck " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + sHSourceType + "'", "h_p_K3_LoadMateOutCheck");
+            if (DsCheck == null || DsCheck.Tables[0].Rows.Count == 0)
+            {
+                sErrMsg = "鐢熸垚鍗曟嵁鍓嶅垽鏂け璐ワ紒";
+                return false;
+            }
+            else
+            {
+                if (DBUtility.ClsPub.isLong(DsCheck.Tables[0].Rows[0][0]) == 1)
+                {
+                    sErrMsg = DBUtility.ClsPub.isStrNull(DsCheck.Tables[0].Rows[0]["HRemark"]);
+                    return false;
+                }
+            }
+
             //K3璐熷簱瀛樺垽鏂�
             if (oSystemParameterMain.WMS_ERPStockCtl == "Y") //绯荤粺鍙傛暟  鎻愪氦鍚嶦RP璐熷簱瀛樻帶鍒� 
             {
@@ -21048,7 +21068,7 @@
                 if (oSystemParameterMain.WMS_MouldManagerCtl == "Y") //绯荤粺鍙傛暟  鍚敤鍣ㄥ叿绠$悊
                 {
                     string HMouldBillType = "3803";
-                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString());
+                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString() + ",1");
                 }
 
                 //鏍规嵁TMP琛� 杩斿洖 瀛愯〃淇℃伅
@@ -21322,7 +21342,7 @@
                 if (oSystemParameterMain.WMS_MouldManagerCtl == "Y") //绯荤粺鍙傛暟  鍚敤鍣ㄥ叿绠$悊
                 {
                     string HMouldBillType = "3803";
-                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString());
+                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString() + ",1");
                 }
 
                 //鏍规嵁TMP琛� 杩斿洖 瀛愯〃淇℃伅
@@ -22573,6 +22593,22 @@
             {
                 sErrMsg = "淇濈娌℃湁閫夋嫨锛�";
                 return false;
+            }
+            //鐢熸垚浜у搧鍏ュ簱鍗曞墠鍒ゆ柇
+            DataSet DsCheck;
+            DsCheck = oCn.RunProcReturn("exec h_p_K3_LoadProductInCheck " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + sHSourceType + "'", "h_p_K3_LoadProductInCheck");
+            if (DsCheck == null || DsCheck.Tables[0].Rows.Count == 0)
+            {
+                sErrMsg = "鐢熸垚鍗曟嵁鍓嶅垽鏂け璐ワ紒";
+                return false;
+            }
+            else
+            {
+                if (DBUtility.ClsPub.isLong(DsCheck.Tables[0].Rows[0][0]) == 1)
+                {
+                    sErrMsg = DBUtility.ClsPub.isStrNull(DsCheck.Tables[0].Rows[0]["HRemark"]);
+                    return false;
+                }
             }
 
             try
@@ -31466,6 +31502,19 @@
                     }
                     else
                     {
+                        if (HSourceBillNo != "" && SourceFlag == true)
+                        {
+                            if (HBillType == "1202") //鐢熶骇鍏ュ簱鏃� 鏉$爜涓诲唴鐮併�佸瓙鍐呯爜鍜屾簮鍗曚富鍐呯爜銆佸瓙鍐呯爜蹇呴』涓�鑷�
+                            {
+                                if (dal.omodel_View.HSourceInterID != DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HSourceInterID"])
+                                    && dal.omodel_View.HSourceEntryID != DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HSourceEntryID"])
+                                    )
+                                {
+                                    sErrMsg = "璇ユ潯鐮佺殑婧愬崟涓庢壂鎻忕殑婧愬崟涓嶄竴鑷达紝璇风‘璁ゆ棤璇悗閲嶆柊鎵弿锛�";
+                                    return false;
+                                }
+                            }
+                        }
                         dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HSourceBillNo"]);
                         dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HSourceEntryID"]);
                         dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HSourceInterID"]);
@@ -32935,7 +32984,7 @@
         #region 鎵弿婧愬崟鏉$爜
 
         [WebMethod]
-        public Model.ClsKf_ICStockBill_WMS get_SourceBarCode_New(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, bool HRedBlueflag, string HHMaker, Double HPTQty, Int64 HPlanMode, Int64 HFIFOWhID, Int64 HOWNERID, ref string sErrMsg)
+        public Model.ClsKf_ICStockBill_WMS get_SourceBarCode_New(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, bool HRedBlueflag, bool SourceFlag, string HMaker, Double HPTQty, Int64 HPlanMode, Int64 HFIFOWhID, Int64 HOWNERID, ref string sErrMsg)
         {
             SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
             Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
@@ -32948,7 +32997,7 @@
                 sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涙壂鎻忔簮鍗曟椂鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
                 return null;
             }
-            oBar = getSourceBill_New(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HRedBlueflag, HHMaker, HPTQty, HPlanMode, HFIFOWhID, HOWNERID, HAccessFlag, oSystemParameter.omodel, ref sErrMsg);
+            oBar = getSourceBill_New(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HRedBlueflag, HMaker, HPTQty, HPlanMode, HFIFOWhID, HOWNERID, HAccessFlag, SourceFlag, oSystemParameter.omodel, ref sErrMsg);
             if (oBar == null)
             {
                 sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涙壂鎻忔簮鍗曞け璐ワ紒" + sErrMsg;
@@ -32965,7 +33014,7 @@
         #region 灏嗘簮鍗曚俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
 
         [WebMethod]
-        public Model.ClsKf_ICStockBill_WMS getSourceBill_New(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, bool HRedBlueflag, string HHMaker, Double HPTQty, Int64 HPlanMode, Int64 HFIFOWhID, Int64 HOWNERID, Int64 HAccessFlag, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
+        public Model.ClsKf_ICStockBill_WMS getSourceBill_New(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, bool HRedBlueflag, string HMaker, Double HPTQty, Int64 HPlanMode, Int64 HFIFOWhID, Int64 HOWNERID, Int64 HAccessFlag, bool SourceFlag, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
         {
             SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
             Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
@@ -33067,7 +33116,7 @@
             }
 
             //灏嗘簮鍗曚俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_New " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "','" + sRedBlue + "'," + sMulSourceFlag.ToString() + ",'" + HHMaker + "'," + HPTQty.ToString() + "," + HPlanMode.ToString() + "," + HFIFOWhID.ToString() + "," + HOWNERID.ToString() + "," + HAccessFlag.ToString(), "h_p_WMS_AddSourceBarCode_New");
+            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_New " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "','" + sRedBlue + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HPTQty.ToString() + "," + HPlanMode.ToString() + "," + HFIFOWhID.ToString() + "," + HOWNERID.ToString() + "," + HAccessFlag.ToString(), "h_p_WMS_AddSourceBarCode_New");
             if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
             {
                 sErrMsg = "灏嗘簮鍗曚俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛ㄥけ璐ワ紒";
@@ -33161,6 +33210,563 @@
         #endregion
 
 
+//        #region 鎵弿鐗╂枡鏉$爜璋冪敤鏂规硶
+
+//        #region 鎵弿鐗╂枡鏉$爜
+
+//        [WebMethod]
+//        public Model.ClsKf_ICStockBill_WMS get_MaterBarCode_New(string HBarCode, Int64 HInterID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Int64 HSCWhID, Int64 HSCSPID, Double HQty, bool HRedBlueFlag, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HStockOrgID, Int64 HStockOutOrgID, string HExpressNumber, ref string sHSourceBillNo, ref string sHSourceBillType, ref long sHSupID, ref string sHSupName, ref long sHDeptID, ref string sHDeptName, ref string sErrMsg)
+//        {
+//            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+//            Model.ClsKf_ICStockBill_WMS model = new Model.ClsKf_ICStockBill_WMS();
+//            //鑾峰彇绯荤粺鍙傛暟
+//            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+//            if (oSystemParameter.ShowBill(ref sErrMsg) == false)
+//            {
+//                sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+//                return null;
+//            }
+//            //鍒ゆ柇鏉$爜鏄惁涓虹┖
+//            if (HBarCode.Trim() == "")
+//            {
+//                sErrMsg = "鏉$爜涓嶈兘涓虹┖锛岃閲嶆柊鎵弿鐗╂枡鏉$爜锛�";
+//                return null;
+//            }
+//            //鍒ゆ柇鏉$爜鏄惁鍚壒娈婄鍙� # 锛屽鏋滃惈鏈夊垯鎷嗗垎锛屾埅鍙� # 鍓嶅瓧绗︿覆
+//            string[] NewBarCode;
+//            if (HBarCode.CompareTo("#") > 0)
+//            {
+//                NewBarCode = HBarCode.Split(Convert.ToChar("#"));
+//                HBarCode = NewBarCode[0];
+//            }
+//            //鑾峰彇鏉$爜妗f淇℃伅
+//            Model.ClsGy_BarCodeBill_WMS_Model_View oBar = new Model.ClsGy_BarCodeBill_WMS_Model_View();
+//            DataSet ds1 = oCn.RunProcReturn("Select * from h_v_Gy_BarCodeBill_New Where HBarCode='" + HBarCode + "'", "h_v_Gy_BarCodeBill_New");
+//            if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
+//            {
+//                sErrMsg = "鎵�鎵弿鐗╂枡鏉$爜锛�" + HBarCode + " 鏃犳晥锛屼笉瀛樺湪鏉$爜妗f涓紒";
+//                return null;
+//            }
+//            else
+//            {
+//                oBar.HItemID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HItemID"]);
+//                oBar.HBarCode = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBarCode"]);
+//                oBar.HBarCodeType = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBarCodeType"]);
+//                oBar.HStopflag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HStopflag"]);
+//                oBar.HRemark = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
+//                oBar.HMaterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HMaterID"]);
+//                oBar.HUnitID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HUnitID"]);
+//                oBar.HAuxPropID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HAuxPropID"]);
+//                oBar.HBatchNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBatchNo"]);
+//                oBar.HQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[0]["HQty"]);
+//                oBar.HSourceInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceInterID"]);
+//                oBar.HSourceEntryID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceEntryID"]);
+//                oBar.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]);
+//                oBar.HSourceBillType = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillType"]);
+//                oBar.HMTONo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HMTONo"]);
+//                oBar.HSTOCKORGID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSTOCKORGID"]);
+//                oBar.HOWNERID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HOWNERID"]);
+//            }
+//            //鍒ゆ柇鏉$爜鏄惁鍙敤
+//            if (oBar.HStopflag)
+//            {
+//                sErrMsg = "鎵�鎵弿鐗╂枡鏉$爜锛�" + HBarCode + " 宸蹭綔搴燂紝涓嶅厑璁歌繘琛屾壂鐮佹搷浣滐紒";
+//                return null;
+//            }
+//            //鍏ュ簱銆佹眹鎶ユā鍧楋紝鏈夋簮鍗曟潯鐮� 涓� 鏉$爜绫诲瀷涓哄敮涓�鏉$爜锛屾壂鎻忕墿鏂欐潯鐮佹椂鑷姩甯﹀嚭婧愬崟淇℃伅
+//            //閲囪喘鍏ュ簱锛�1201锛夈�佷骇鍝佸叆搴擄紙1202锛夈�佸澶栧叆搴擄紙1210锛夈�佺敓浜ф眹鎶ワ紙3711锛�
+//            if (oBar.HBarCodeType == "鍞竴鏉$爜" && oBar.HSourceBillNo == "" && HSourceBillType != "-1"
+//                && (HBillType == "1201" || HBillType == "1202" || HBillType == "1210" || HBillType == "3711"))
+//            {
+//                Int64 HAccessFlag = 1;   //鏄惁鐗╂枡鏉$爜甯﹀嚭婧愬崟淇℃伅鏍囧織锛�0涓虹洿鎺ユ壂婧愬崟鏉$爜锛�1涓虹墿鏂欐潯鐮佸甫鍑烘簮鍗曚俊鎭級
+//                model = getSourceBill_New(HInterID, HBillNo, HBillType, oBar.HSourceBillNo, oBar.HSourceBillType, HRedBlueFlag, HMaker, 0, 0, 0, HStockOrgID, HAccessFlag, SourceFlag, oSystemParameter.omodel, ref sErrMsg);
+//                if (model == null)
+//                {
+//                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涙壂鎻忔簮鍗曞け璐ワ紒" + sErrMsg;
+//                    return null;
+//                }
+//                else
+//                {
+//                    HSourceBillType = model.HSourceBillType;
+//                    SourceFlag = true;
+//                    return model;
+//                }
+//            }
+
+//            //1銆侀娆℃壂鐮侀槻涓插崟鍒ゆ柇锛� 2銆佹簮鍗曠被鍨嬫槸鍚﹀湪婧愬崟鍒楄〃閲屽垽鏂紱3銆佸敮涓�鏉$爜鏄惁瀛樺湪鐩稿悓鏉$爜鍒ゆ柇锛� 4銆佹湁婧愬崟锛岀墿鏂欐槸鍚﹀湪婧愬崟涓垽鏂�
+//            DataSet ds2 = oCn.RunProcReturn("exec h_p_WMS_GetSourceInterID_AddBarCode " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode + "','" + HSourceBillType + "'," + DBUtility.ClsPub.BoolToString(SourceFlag) + ",'" + oSystemParameter.omodel.WMS_BarCodeMustSameSourceBill + "'," + HStockOrgID.ToString(), "h_p_WMS_GetSourceInterID_AddBarCode");
+//            if (ds2 == null || ds2.Tables[0].Rows.Count == 0)
+//            {
+//                sErrMsg = "鎵弿鐗╂枡鏉$爜锛屽垽鏂潯鐮佹槸鍚﹀湪婧愬崟涓椂鍙戠敓閿欒锛�";
+//                return null;
+//            }
+//            else
+//            {
+//                if (DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0][0]) == 1)
+//                {
+//                    sErrMsg = DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HRemark"]);
+//                    return null;
+//                }
+//                else
+//                {
+//                    oBar.HSourceInterID = DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HSourceInterID"]);
+//                    oBar.HSourceEntryID = DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HSourceEntryID"]);
+//                    oBar.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HSourceBillNo"]);
+//                    oBar.HSourceBillType = DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HSourceBillType"]);
+//                    oBar.HMaterID = DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HMaterID"]);
+//                    oBar.HinitQty = DBUtility.ClsPub.isDoule(ds2.Tables[0].Rows[0]["HQtyMust"]);    //鍓╀綑鏈壂鐮佹暟閲忥紙搴旀敹鏁伴噺-鎵爜鎬绘暟閲� 鎴�0锛夛紝闈炲敮涓�鏉$爜鐢ㄥ埌
+//                }
+//            }
+
+//            //鑾峰彇銆佸垽鏂粨搴撱�佷粨浣�
+//            DataSet ds3 = oCn.RunProcReturn("exec h_p_WMS_GetWHIDandSPID_AddBarCode " + HInterID.ToString() + ",'" + HBillType + "'," + HWhID + "," + HSPID + "," + HSCWhID + "," + HSCSPID + "," + oBar.HSourceInterID + "," + oBar.HSourceEntryID + "," + oBar.HMaterID + "," + HStockOrgID + "," + HStockOutOrgID + ",'" + oBar.HBarCodeType + "','" + oSystemParameter.omodel.WMS_WMSStockCtl + "'", "h_p_WMS_GetWHIDandSPID_AddBarCode");
+//            if (ds3 == null || ds3.Tables[0].Rows.Count == 0)
+//            {
+//                sErrMsg = "鎵弿鐗╂枡鏉$爜锛屽垽鏂粨搴撱�佷粨浣嶅�兼椂鍙戠敓閿欒锛�";
+//                return null;
+//            }
+//            else
+//            {
+//                if (DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0][0]) == 1)
+//                {
+//                    sErrMsg = DBUtility.ClsPub.isStrNull(ds3.Tables[0].Rows[0]["HRemark"]);
+//                    return null;
+//                }
+//                else
+//                {
+//                    model.HWhID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HWHID"]);
+//                    model.HSPID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HSPID"]);
+//                    model.HSCWhID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HSCWHID"]);
+//                    model.HSCSPID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HSCSPID"]);
+//                }
+//            }
+
+//            //鍒濇鑾峰彇鏉$爜鏁伴噺
+//            if (oBar.HBarCodeType == "鍞竴鏉$爜")
+//            {
+//                if (HQty > 0 && oBar.HQty > HQty)   //0<鐣岄潰閫掑叆鏁伴噺<鏉$爜妗f鏁伴噺锛屽彇閫掑叆鏁伴噺
+//                {
+//                    oBar.HQty = HQty;
+//                }
+//            }
+//            else
+//            {
+//                if (HQty > 0)               //鐣岄潰閫掑叆鏁伴噺>0锛屽彇閫掑叆鏁伴噺
+//                {
+//                    oBar.HQty = HQty;
+//                }
+//                else if (oBar.HinitQty > 0) //鐣岄潰閫掑叆鏁伴噺<0锛屾簮鍗曞墿浣欐湭鎵爜鏁伴噺>0锛屽彇婧愬崟鍓╀綑鏈壂鐮佹暟閲�
+//                {
+//                    oBar.HQty = oBar.HinitQty;
+//                }
+//            }
+
+//            //鐢熶骇棰嗘枡锛�1204锛夈�侀攢鍞嚭搴擄紙1205锛夈�佸叾浠栧嚭搴撹摑瀛楋紙1206锛夈�佸澶栧嚭搴擄紙1211锛�
+//            //澶栬喘閫�鏂欙紙1239锛夈�佷骇鍝侀��搴擄紙1245锛夈�佸叾浠栧叆搴撶孩瀛楋紙1248锛夈�佸澶栭��搴擄紙1246锛�
+//            //鐢熶骇琛ユ枡锛�1254锛�
+//            if (HBillType == "1204" || HBillType == "1205" || HBillType == "1206" || HBillType == "1211"
+//                || HBillType == "1239" || HBillType == "1245" || HBillType == "1248" || HBillType == "1246"
+//                || HBillType == "1254")
+//            {
+//                if (oSystemParameter.omodel.WMS_ERPStockCtl == "Y")
+//                {
+
+//                }
+
+
+
+
+
+
+//                //闈炲敮涓�鏉$爜鎵弿鏃跺垽鏂粨搴撲粨浣嶆槸鍚﹀凡閫夋嫨
+//                if (dal.omodel_View.HBarCodeType != "鍞竴鏉$爜")
+//                {
+//                    if (oSystemParameter.omodel.WMS_ERPStockCtl == "N")
+//                    {
+
+//                    }
+//                    else
+//                    {
+//                        //鍒ゆ柇ERP搴撳瓨   杩斿洖ERP搴撳瓨鏁伴噺
+//                        DataSet ds6 = oCn.RunProcReturn("exec h_p_IF_CheckQtyByERPICInventory " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + dal.omodel_View.HMaterID.ToString() + "," + dal.omodel_View.HAuxPropID.ToString() + ",'" + dal.omodel_View.HBatchNo + "'," + sRelQty.ToString() + "," + HOWNERID.ToString(), "h_p_IF_CheckQtyByERPICInventory");
+//                        if (ds6 == null || ds6.Tables[0].Rows.Count == 0)
+//                        {
+//                            sErrMsg = "鍒ゆ柇ERP搴撳瓨锛屾湭鐭ラ敊璇紒";
+//                            return false;
+//                        }
+//                        else
+//                        {
+//                            if (DBUtility.ClsPub.isLong(ds6.Tables[0].Rows[0][0]) == 0)
+//                            {
+//                                dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(ds6.Tables[0].Rows[0]["HMaterID"]);
+//                                HQty = DBUtility.ClsPub.isDoule(ds6.Tables[0].Rows[0]["HQty"]);
+//                            }
+//                            else
+//                            {
+//                                sErrMsg = DBUtility.ClsPub.isStrNull(ds6.Tables[0].Rows[0]["HRemark"]);
+//                                return false;
+//                            }
+//                        }
+//                    }
+//                }
+//                else
+//                {
+//                    //鍒ゆ柇鏉$爜搴撳瓨   杩斿洖搴撳瓨鏁伴噺 浠撳簱 浠撲綅
+//                    DAL.ClsKF_PonderationBillMain_Temp_View Tempdal = new DAL.ClsKF_PonderationBillMain_Temp_View();
+//                    if (Tempdal.CheckQtyByBarCode(HBillID, HBillType, sBarCode, ref HWhID, ref HSPID, sRelQty, ref sRelQty))
+//                    {
+
+//                    }
+//                    else
+//                    {
+//                        if (sRelQty == 0)
+//                        {
+//                            sErrMsg = "鏃犲簱瀛橈紒";
+//                            return false;
+//                        }
+//                        else
+//                        {
+//                            sErrMsg = "搴撳瓨涓嶈冻锛屽凡鑾峰彇瀹為檯搴撳瓨鏁伴噺锛�";
+//                        }
+//                    }
+//                }
+//            }
+//            //閲囪喘鍏ュ簱锛�1201锛夈�佷骇鍝佸叆搴擄紙1202锛夈�佸叾浠栧叆搴撹摑瀛楋紙1203锛夈�佸澶栧叆搴擄紙1210锛�
+//            //鐢熶骇閫�鏂欙紙1244锛夈�侀攢鍞��搴擄紙1247锛夈�佸叾浠栧嚭搴撶孩瀛楋紙1249锛夈�佸澶栭��鏂欙紙1238锛�
+//            else
+//            {
+//                //鍒ゆ柇骞惰幏鍙� 浠撳簱 浠撲綅淇℃伅
+//                DataSet ds4 = oCn.RunProcReturn("exec h_p_WMS_GetBillWHID " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString(), "h_p_WMS_GetBillWHID");
+//                if (ds4 == null || ds4.Tables[0].Rows.Count == 0)
+//                {
+//                    sErrMsg = "鍒ゆ柇骞惰幏鍙栦粨搴撲粨浣嶄俊鎭紝鏈煡閿欒锛�";
+//                    return false;
+//                }
+//                else
+//                {
+//                    if (DBUtility.ClsPub.isLong(ds4.Tables[0].Rows[0][0]) == 0)
+//                    {
+//                        HWhID = DBUtility.ClsPub.isLong(ds4.Tables[0].Rows[0]["HWHID"]);
+//                        HSPID = DBUtility.ClsPub.isLong(ds4.Tables[0].Rows[0]["HSPID"]);
+//                    }
+//                    else
+//                    {
+//                        sErrMsg = DBUtility.ClsPub.isStrNull(ds4.Tables[0].Rows[0]["HRemark"]);
+//                        return false;
+//                    }
+//                }
+//                //鍒ゆ柇鏉$爜鎵弿鏁伴噺   杩斿洖鍓╀綑鏈壂鎻忔暟閲�
+//                if (tem.IsBarCode_New(sBarCode, HBillType, HRedBlueFlag, ref sRelQty, ref sErrMsg))
+//                {
+
+//                }
+//                else
+//                {
+//                    sErrMsg = sErrMsg;
+//                    return false;
+//                }
+//            }
+//        }
+
+//            if (HExpressNumber == "宸ュ簭姹囨姤杞Щ鍗�")
+//            {
+//                model.HSubBillType = "1270";
+//                HExpressNumber = "";
+//            }
+//    model.HInterID = HBillID;
+//            model.HBillNo = HBillNo;
+//            model.HBillType = HBillType;
+//            model.HMaker = HMaker;
+//            //
+//            model.HMaterID = dal.omodel_View.HMaterID;
+//            model.HAuxPropID = dal.omodel_View.HAuxPropID;
+//            model.HErpClsID = dal.omodel_View.HErpClsID;
+//            model.HQty = sRelQty;
+//            model.HQtyMust = dal.omodel_View.HinitQty;
+//            model.HBarCode = dal.omodel_View.HBarCode;
+//            model.HBatchNo = dal.omodel_View.HBatchNo;
+//            model.HMTONo = dal.omodel_View.HMTONo;
+
+//            model.HWhID = HWhID;
+//            model.HStockPlaceID = HSPID;
+//            model.HSourceInterID = dal.omodel_View.HSourceInterID;
+//            model.HSourceEntryID = dal.omodel_View.HSourceEntryID;
+//            model.HSourceBillNo = dal.omodel_View.HSourceBillNo;
+//            model.HSourceBillType = HSourceBillType;
+//            model.HRedBlueFlag = HRedBlueFlag;
+//            model.HPieceQty = 1;
+//            model.HSTOCKORGID = HOWNERID;
+//            model.HOWNERID = HOWNERID;
+//            model.HCusBarCode = HExpressNumber;
+
+//            ////鑾峰彇绯荤粺鍙傛暟
+//            //Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+//            //if (oSystemParameter.ShowBill(ref sErrMsg) == false)
+//            //{
+//            //    sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+//            //    return false;
+//            //}
+//            //鐢熶骇棰嗘枡鍗�-鍏堣繘鍏堝嚭鎺у埗
+//            if (HBillType == "1204" && oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl == "Y") //绯荤粺鍙傛暟  鐢熶骇棰嗘枡鍗�-鍏堣繘鍏堝嚭鎺у埗
+//            {
+//                DataSet FIFO = oCn.RunProcReturn("exec h_p_Kf_ICInventory_FIFO_Tmp_BarCode " + HBillID.ToString() + ",'" + HBillType + "','" + model.HBatchNo + "','" + model.HBarCode + "'," + model.HQty.ToString(), "h_p_Kf_ICInventory_FIFO_Tmp_BarCode");
+//                if (FIFO == null || FIFO.Tables[0].Rows.Count == 0)
+//                {
+//                    sErrMsg = "璇锋牴鎹厛杩涘厛鍑烘竻鍗曟壂鐮侊紒";
+//                    return false;
+//                }
+//                else
+//{
+//    model.HWhID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HWHID"]);
+//    model.HStockPlaceID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HSPID"]);
+//    model.HQty = DBUtility.ClsPub.isDoule(FIFO.Tables[0].Rows[0]["HQty"]);
+//    model.HQtyMust = DBUtility.ClsPub.isDoule(FIFO.Tables[0].Rows[0]["HSumQtyMust"]);
+//    model.HSourceInterID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HSourceInterID"]);
+//    model.HSourceEntryID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HSourceEntryID"]);
+//    model.HSourceBillNo = DBUtility.ClsPub.isStrNull(FIFO.Tables[0].Rows[0]["HSourceBillNo"]);
+//    model.HSourceBillType = DBUtility.ClsPub.isStrNull(FIFO.Tables[0].Rows[0]["HSourceBillType"]);
+//}
+//            }
+
+//            //鐗╂枡鏉$爜鍐欏叆涓存椂琛ㄦ椂锛屽垽鏂粨搴撲粨浣嶆槸鍚︽纭�
+//            DataSet ds5 = oCn.RunProcReturn("exec h_p_WMS_CheckWHandSP " + model.HWhID.ToString() + "," + model.HStockPlaceID.ToString(), "h_p_WMS_CheckWHandSP");
+//if (ds5 == null || ds5.Tables[0].Rows.Count == 0)
+//{
+//    sErrMsg = "鎵弿鐗╂枡鏉$爜瀛樺叆涓存椂琛ㄦ椂鍒ゆ柇浠撳簱浠撲綅鏄惁姝g‘,鏈煡閿欒锛�";
+//    return false;
+//}
+//else
+//{
+//    if (DBUtility.ClsPub.isLong(ds5.Tables[0].Rows[0][0]) == 1)
+//    {
+//        sErrMsg = DBUtility.ClsPub.isStrNull(ds5.Tables[0].Rows[0]["HRemark"]);
+//        return false;
+//    }
+//}
+
+////灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ュ嚭鍏ュ簱鏉$爜涓存椂琛�
+//if (set_SavePonderationBillMain_Temp_Select_Qty(model, HQty, ref sErrMsg))
+//{
+
+//}
+//else
+//{
+//    sErrMsg = "鎵弿澶辫触锛�" + sErrMsg;
+//    return false;
+//}
+//return true;
+//        }
+
+//        #endregion
+
+
+//        #endregion
+
+
+        #region 妯″叿鏉$爜澶勭悊鏂规硶
+
+        #region 鎵弿妯″叿婧愬崟鏉$爜
+
+        [WebMethod]
+        public Model.ClsKf_ICStockBill_Mould get_CheckTypeByMouldSource(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HHMaker, Int64 HOWNERID, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            Model.ClsKf_ICStockBill_Mould oBar = new Model.ClsKf_ICStockBill_Mould();
+            oBar = getMouldSourceBillList(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HHMaker, HOWNERID, ref sErrMsg);
+            if (oBar == null)
+            {
+                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涙壂鎻忔簮鍗曞け璐ワ紒" + sErrMsg;
+                return null;
+            }
+            else
+            {
+                return oBar;
+            }
+        }
+
+        //灏嗘ā鍏锋簮鍗曚俊鎭瓨鍏ユā鍏峰嚭鍏ュ簱涓存椂琛�
+        [WebMethod]
+        public Model.ClsKf_ICStockBill_Mould getMouldSourceBillList(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HHMaker, Int64 HOWNERID, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            Model.ClsKf_ICStockBill_Mould oBar = new Model.ClsKf_ICStockBill_Mould();
+
+            DataSet ds1 = oCn.RunProcReturn("exec h_p_Sc_MouldStockBillMain_Temp_AddSource " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "','" + HHMaker + "'," + HOWNERID.ToString(), "h_p_Sc_MouldStockBillMain_Temp_AddSource");
+            if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
+            {
+                sErrMsg = "灏嗘簮鍗曚俊鎭瓨鍏ュ櫒鍏峰嚭鍏ュ簱涓存椂琛ㄥけ璐ワ紒";
+                return null;
+            }
+            else
+            {
+                if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
+                {
+                    oBar.HSourceBillType = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillType"]);
+                    oBar.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]);
+                    oBar.HSupID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSupID"]);
+                    oBar.HSupName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSupName"]);
+                    oBar.HDeptID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HDeptID"]);
+                    oBar.HDeptName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HDeptName"]);
+                    oBar.HStockStyle = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HStockStyle"]);
+                    oBar.HStockInOrgID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HStockInOrgID"]);
+                    oBar.HStockInOrgName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HStockInOrgName"]);
+                    oBar.HStockOutOrgID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HStockOutOrgID"]);
+                    oBar.HStockOutOrgName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HStockOutOrgName"]);
+                    return oBar;
+                }
+                else
+                {
+                    sErrMsg = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
+                    return null;
+                }
+            }
+        }
+
+
+        #endregion
+
+        //鏄剧ず妯℃不鍏峰垪琛ㄤ俊鎭�
+        [WebMethod]
+        public DataSet GetMouldBillEntry_TmpList(long HInterID, string HBillNo, string HBillType, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            DataSet DS = oCn.RunProcReturn("exec h_p_WMS_MouldBillEntryTmpList " + HInterID.ToString() + ",'" + HBillType + "'", "h_p_WMS_MouldBillEntryTmpList");
+            return DS;
+        }
+
+        //鍒犻櫎妯℃不鍏峰垪琛ㄤ腑閫変腑琛岃褰�
+        [WebMethod]
+        public bool set_DelSc_MouldStockBillMain_Temp(long HInterID, long HMouldInterID, string sHBillType, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            try
+            {
+                oCn.RunProc("Delete from Sc_MouldStockBillMain_Temp where HInterID=" + HInterID.ToString() + " and HBillType='" + sHBillType + "' and HMouldID=" + HMouldInterID.ToString() + " and HQty<>0", ref DBUtility.ClsPub.sExeReturnInfo);
+                return true;
+            }
+            catch (Exception e)
+            {
+                sErrMsg = "鍒犻櫎妯℃不鍏峰嚭鍏ュ簱涓存椂琛ㄨ褰曞け璐ワ紒" + e.Message;
+                return false;
+            }
+        }
+
+        //涓婁紶鐢熸垚妯″叿鍑哄叆搴撳崟
+        [WebMethod]
+        public bool set_SaveMouldStockBill_New(Model.ClsSc_MouldStockBillMain oMain, string sHSourceType, ref string sErrMsg)
+        {
+            //涓婁紶鍓嶅垽鏂�
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            DataSet Ds = oCn.RunProcReturn("exec h_p_Sc_PreUpload_MouldStockBill " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "'," + oMain.HSupID.ToString(), "h_p_Sc_PreUpload_MouldStockBill");
+            if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+            {
+                sErrMsg = "涓婁紶鍓嶅垽鏂暟鎹畬鏁存�уけ璐ワ紒";
+                return false;
+            }
+            else
+            {
+                if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 1)
+                {
+                    sErrMsg = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
+                    return false;
+                }
+            }
+
+            try
+            {
+                oCn.BeginTran();
+                string HMouldBillType = oMain.HBillType;
+                oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString() + "," + oMain.HCorrespondentTypeID.ToString());
+                //鏇存柊鍏宠仈鏁伴噺
+                if (oMain.HBillType == "3841" && sHSourceType == "3840")
+                {
+                    //鍣ㄥ叿鍒嗘璋冨叆鍗曪紝婧愬崟锛氬櫒鍏峰垎姝ヨ皟鍑哄崟
+                    oCn.RunProc("exec h_p_Sc_UpDateMouldMoveStockStepOutRelation_Add " + oMain.HInterID.ToString());
+                }
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sErrMsg = "鐢熸垚妯″叿鍑哄叆搴撳崟澶辫触锛�" + e.Message;
+                oCn.RollBack();
+                return false;
+            }
+        }
+
+        #region 妯″叿缂撳瓨鍒楄〃澶勭悊鏂规硶
+
+        //缂撳瓨鍒楄〃鐣岄潰锛岄�夋嫨缂栬緫鏃讹紝鍒ゆ柇鎵�閫夊崟鎹槸鍚﹀瓨鍦ㄥ凡涓婁紶璁板綍
+        [WebMethod]
+        public bool MouldTempList_Modify(Int64 sHInterID, string sHBillNo, string sHBillType, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            DataSet Ds = oCn.RunProcReturn("exec h_p_WMS_MouldTempList_Modify " + sHInterID + ",'" + sHBillNo + "','" + sHBillType + "'", "h_p_WMS_MouldTempList_Modify");
+            if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+            {
+                sErrMsg = "妯″叿缂撳瓨鍒楄〃缂栬緫鍓嶅垽鏂け璐ワ紒";
+                return false;
+            }
+            if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 0)
+            {
+                return true;
+            }
+            else
+            {
+                sErrMsg = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
+                return false;
+            }
+        }
+
+        //缂撳瓨鍒楄〃鐣岄潰锛岃繑鍥炵紦瀛樿〃澶翠俊鎭�
+        [WebMethod]
+        public DataSet GetMouldSource(string HBillType, string HSourceBillNo, string HSourceType, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            DataSet DS = oCn.RunProcReturn("exec h_p_Sc_MouldSourceList '" + HBillType.ToString() + "','" + HSourceBillNo + "','" + HSourceType + "'", "h_p_Sc_MouldSourceList");
+            return DS;
+        }
+
+        //缂撳瓨鍒楄〃鐣岄潰锛岃繑鍥炵紦瀛樺垪琛ㄤ俊鎭�
+        [WebMethod]
+        public DataSet GetSc_MouldStockBillMain_TempList(string sHBillType, string sHMaker, Int64 sHOWNERID)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            DataSet Ds = oCn.RunProcReturn("exec h_p_Sc_GetMouldStockBillMain_TempList '" + sHBillType + "','" + sHMaker + "'," + sHOWNERID.ToString(), "h_p_Sc_GetMouldStockBillMain_TempList");
+            if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+            {
+                return null;
+            }
+            else
+            {
+                return Ds;
+            }
+        }
+
+        //缂撳瓨鍒楄〃鐣岄潰锛屽垹闄ょ紦瀛樺垪琛ㄥ崟鎹�
+        [WebMethod]
+        public bool DeleteMouldBillList(Int64 HInterID, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            try
+            {
+                oCn.RunProc("Delete from Sc_MouldStockBillMain_Temp where HInterID=" + HInterID.ToString(), ref DBUtility.ClsPub.sExeReturnInfo);
+                return true;
+            }
+            catch (Exception e)
+            {
+                sErrMsg = "鍒犻櫎澶辫触锛�" + e.Message;
+                return false;
+            }
+        }
+
+        #endregion
+
+        #endregion
+
+
+
+
         #region 鍗曟嵁鍒楄〃鏁版嵁澶勭悊
 
         //鏄剧ず鐗╂枡鏄庣粏鍒楄〃銆佹ā娌诲叿鍒楄〃銆佸厛杩涘厛鍑哄垪琛ㄤ俊鎭�
@@ -33209,22 +33815,6 @@
             return DS;
         }
 
-        //鍒犻櫎妯℃不鍏峰垪琛ㄤ腑閫変腑琛岃褰�
-        [WebMethod]
-        public bool set_DelSc_MouldStockBillMain_Temp(long HInterID, long HMouldInterID, string sHBillType, ref string sErrMsg)
-        {
-            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
-            try
-            {
-                oCn.RunProc("Delete from Sc_MouldStockBillMain_Temp where HInterID=" + HInterID.ToString() + " and HBillType='" + sHBillType + "' and HMouldID=" + HMouldInterID.ToString(), ref DBUtility.ClsPub.sExeReturnInfo);
-                return true;
-            }
-            catch (Exception e)
-            {
-                sErrMsg = "鍒犻櫎妯℃不鍏峰嚭鍏ュ簱涓存椂琛ㄨ褰曞け璐ワ紒" + e.Message;
-                return false;
-            }
-        }
 
         #endregion
 
diff --git a/DLL/DAL.dll b/DLL/DAL.dll
index dfe0ed0..c2b4dc2 100644
--- a/DLL/DAL.dll
+++ b/DLL/DAL.dll
Binary files differ
diff --git a/DLL/Model.dll b/DLL/Model.dll
index 271953f..9c73546 100644
--- a/DLL/Model.dll
+++ b/DLL/Model.dll
Binary files differ

--
Gitblit v1.9.1