From 9ba27cdf1503d91a1a582cf86c9800cd6cc9429b Mon Sep 17 00:00:00 2001
From: zgq <519541279@qq.com>
Date: 星期一, 22 二月 2021 05:50:09 +0800
Subject: [PATCH] nothing

---
 WebAPI/Properties/PublishProfiles/WEBAPI.pubxml.user |    6 +-
 WebAPI/Controllers/MoveStockBillController.cs        |  112 ++++++++++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 103 insertions(+), 15 deletions(-)

diff --git a/WebAPI/Controllers/MoveStockBillController.cs b/WebAPI/Controllers/MoveStockBillController.cs
index 0116978..f86d8e4 100644
--- a/WebAPI/Controllers/MoveStockBillController.cs
+++ b/WebAPI/Controllers/MoveStockBillController.cs
@@ -44,7 +44,7 @@
         public DataSet ds = new DataSet();
         public ClsGy_BarCodeBill_WMS_Model_View oView = new ClsGy_BarCodeBill_WMS_Model_View();
         public ClsKF_PonderationBillMain_Temp model = new ClsKF_PonderationBillMain_Temp();
-        private JsonResult objJsonResult = new JsonResult();
+        public JsonResult objJsonResult = new JsonResult();
         private json objjson = new json();
 
         /// <summary>
@@ -285,6 +285,7 @@
                 string sErrMsg = "";
                 bool sBool = false;
                 double sRelQty = 0;
+                double sRelQty2 = 0;
                 oView = webserver.get_InfoByBarCode_Source(sCode, sInterID, ref sBool, ref DBUtility.ClsPub.sErrInfo);
                 if (oView == null)
                 {
@@ -294,17 +295,18 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+
                 if (oView.HBarCodeType == "鍞竴鏉$爜" && sQty > 0 && oView.HQty < sQty)
                 {
-                    sRelQty = oView.HQty;
+                    sRelQty2 = oView.HQty;
                 }
                 else if (sQty > 0)
                 {
-                    sRelQty = sQty;
+                    sRelQty2 = sQty;
                 }
                 else
                 {
-                    sRelQty = oView.HQty;
+                    sRelQty2 = oView.HQty;
                 }
 
                 model.HInterID = DBUtility.ClsPub.isLong(sInterID);
@@ -320,6 +322,9 @@
                 model.HBarCode = oView.HBarCode;
                 model.HBatchNo = oView.HBatchNo;
                 model.HMTONo = oView.HMTONo;
+
+                //model.HWhID = oView.HWHID;
+                //model.HStockPlaceID = oView.HSPID;
 
                 model.HWhID = DBUtility.ClsPub.isLong(HWHID);
                 model.HStockPlaceID = DBUtility.ClsPub.isLong(HSPID);
@@ -340,22 +345,21 @@
 
                 WebS.WebService1 oWebs = new WebS.WebService1();
                 //if (webserver.set_SavePonderationBillMain_Temp_Qty(model, sQty, ref DBUtility.ClsPub.sErrInfo))
-                bool flag = oWebs.Get_CheckQtyByBarCode_GetWhAndSP(model.HInterID, model.HBillType, model.HBarCode, ref SCWhID, ref SCSPID, sRelQty, ref sRelQty);
-                if (flag)
+                objJsonResult = CheckQtyByBarCode_Json(model.HInterID, model.HBillType, model.HBarCode, ref SCWhID, ref SCSPID, sRelQty2, ref sRelQty);
+                
+                if (objJsonResult.count == 1)
                 {
                     sQty = sRelQty;
+                    model.HSCWHID = SCWhID;
+                    model.HOutStockPlaceID = SCSPID;
                 }
-                else if (sRelQty == 0)
+                else if (objJsonResult.count == 0)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "2-鏃犲簱瀛橈紒";
                     objJsonResult.data = null;
                     return objJsonResult;
-                }
-                else
-                {
-                    sQty = sRelQty;
                 }
 
                 if (oWebs.set_SavePonderationBillMain_Temp_Qty(model, sQty, ref DBUtility.ClsPub.sErrInfo))
@@ -371,7 +375,7 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "4-鎵爜澶辫触锛�" + DBUtility.ClsPub.sErrInfo;
-                    objJsonResult.data = null;
+                    objJsonResult.data = model.HBarCode;
                     return objJsonResult;
                 }
             }
@@ -382,6 +386,90 @@
             }
         }
 
+        //鏍规嵁鏉$爜 鏁伴噺 鍒ゆ柇鏉$爜搴撳瓨 鏄惁鍏呰冻 骞朵笖甯﹀嚭 浠撳簱浠撲綅
+        public JsonResult CheckQtyByBarCode_Json(long InterID, string sBillType, string sBarCode, ref long HWHID, ref long HSPID, double sQty, ref double sRelQty)
+        {
+            DataSet DS;
+            DataSet DSErp;
+            try
+            {
+                //鍗曟潯鐮侊紝涓�寮犲崟鎹竴鏉℃潯鐮�(鍑尝)
+                //DS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS_GetWHAndSP_Single " + InterID.ToString() + ",'" + sBillType + "','" + sBarCode + "'," + HWHID.ToString() + "," + HSPID.ToString(), "h_p_KF_ICInventory_WMS_GetWHAndSP_Single", ref DBUtility.ClsPub.sExeReturnInfo);
+                //鍒ゆ柇鏉$爜搴撳瓨
+                DS = new SQLHelper.ClsCN().RunProcReturn("exec h_p_KF_ICInventory_WMS_GetWHAndSP " + InterID.ToString() + ",'" + sBillType + "','" + sBarCode + "'," + HWHID.ToString() + "," + HSPID.ToString(), "h_p_KF_ICInventory_WMS_GetWHAndSP", ref DBUtility.ClsPub.sExeReturnInfo);
+                if (DS.Tables[0].Rows.Count == 0)
+                {
+                    sRelQty = 0;
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "4-鎵爜澶辫触锛�";
+                    objJsonResult.data = DS;
+                    return objJsonResult;
+                }
+                else
+                {
+                    double sKFQty = 0;
+                    double sKFQtyErp = 0;
+                    sKFQty = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HKFQty"]);
+                    HWHID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HWhID"]);
+                    HSPID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HSPID"]);
+                    //鐩存帴杩斿洖999
+                    DSErp = new SQLHelper.ClsCN().RunProcReturn("exec h_p_IF_ICInventory_WMS_GetWHAndSP " + InterID.ToString() + ",'" + sBillType + "','" + sBarCode + "'," + HWHID.ToString() + "," + HSPID.ToString(), "h_p_IF_ICInventory_WMS_GetWHAndSP", ref DBUtility.ClsPub.sExeReturnInfo);
+                    if (DSErp.Tables[0].Rows.Count == 0)
+                    {
+                        sRelQty = 0;//涓嶄細璧�
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "4-鎵爜澶辫触锛�";
+                        objJsonResult.data = DS;
+                        return objJsonResult;
+                    }
+                    sKFQtyErp = DBUtility.ClsPub.isDoule(DSErp.Tables[0].Rows[0]["HKFQty"]);//9999
+                    if (sQty > sKFQty && sQty > sKFQtyErp) //褰撳簱瀛樺皬浜庢爣绛炬暟閲忔椂 鍙栧簱瀛樻暟閲�
+                    {
+                        sRelQty = sKFQtyErp;
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "4-鎵爜澶辫触锛�";
+                        objJsonResult.data = DS;
+                        return objJsonResult;
+                    }
+                    else if (sQty > sKFQty && sQty < sKFQtyErp)  //褰撳簱瀛樺皬浜庢爣绛炬暟閲忔椂 鍙栧簱瀛樻暟閲�
+                    {
+                        sRelQty = sKFQty;
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "4-鎵爜澶辫触锛�";
+                        objJsonResult.data = DS;
+                        return objJsonResult;
+                    }
+                    else if (sQty < sKFQty && sQty > sKFQtyErp)//鏃犳晥
+                    {
+                        sRelQty = sKFQtyErp;
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "4-鎵爜澶辫触锛�";
+                        objJsonResult.data = DS;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        sRelQty = sQty;
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "4-鎵爜澶辫触锛�";
+                        objJsonResult.data = DS;
+                        return objJsonResult;
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                sRelQty = 0;
+                throw (e);
+            }
+        }
+
         /// <summary>
         /// 鐢熸垚璋冩嫧鍗�
         /// </summary>
diff --git a/WebAPI/Properties/PublishProfiles/WEBAPI.pubxml.user b/WebAPI/Properties/PublishProfiles/WEBAPI.pubxml.user
index c09c677..ad2ac95 100644
--- a/WebAPI/Properties/PublishProfiles/WEBAPI.pubxml.user
+++ b/WebAPI/Properties/PublishProfiles/WEBAPI.pubxml.user
@@ -157,10 +157,10 @@
       <publishTime>11/24/2014 11:18:48</publishTime>
     </File>
     <File Include="bin/WebAPI.dll">
-      <publishTime>02/21/2021 11:56:27</publishTime>
+      <publishTime>02/22/2021 03:20:59</publishTime>
     </File>
     <File Include="bin/WebAPI.pdb">
-      <publishTime>02/21/2021 11:56:27</publishTime>
+      <publishTime>02/22/2021 03:20:59</publishTime>
     </File>
     <File Include="bin/WebAPI.XmlSerializers.dll">
       <publishTime>02/04/2021 21:35:21</publishTime>
@@ -334,7 +334,7 @@
       <publishTime>02/05/2021 20:24:19</publishTime>
     </File>
     <File Include="Web.config">
-      <publishTime>02/21/2021 12:21:03</publishTime>
+      <publishTime>02/22/2021 03:21:33</publishTime>
     </File>
   </ItemGroup>
 </Project>
\ No newline at end of file

--
Gitblit v1.9.1