From 32d6353746ea867727cb43a04a6927afa40ee0b1 Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期五, 23 九月 2022 14:40:44 +0800
Subject: [PATCH] 森楷其他入库、其他出库、销售出库扫码物料条码调用方法新增、优化

---
 CLOUDWEB/WebService1.asmx.cs |  514 ++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 288 insertions(+), 226 deletions(-)

diff --git a/CLOUDWEB/WebService1.asmx.cs b/CLOUDWEB/WebService1.asmx.cs
index fb66468..487baa7 100644
--- a/CLOUDWEB/WebService1.asmx.cs
+++ b/CLOUDWEB/WebService1.asmx.cs
@@ -4684,7 +4684,8 @@
 
                         if (HReturn.Contains("\"IsSuccess\":false") == true)
                         {
-                            sErrMsg = "鐢熸垚鐢熶骇姹囨姤鍗曞け璐ワ紒" + HReturn + sJson;
+                            sErrMsg = "鐢熸垚鐢熶骇姹囨姤鍗曞け璐ワ紒" + HReturn;
+                            //sErrMsg = "鐢熸垚鐢熶骇姹囨姤鍗曞け璐ワ紒" + HReturn + sJson;
                             LogService.Write("鐢熸垚鐢熶骇姹囨姤鍗曪紙婧愬崟锛氱敓浜ц鍗曪級澶辫触锛�" + HReturn + sJson);   //鍐欏叆txt鏂囨湰
                             oCn.RollBack();
                             return false;
@@ -36676,81 +36677,21 @@
                     //鍒ゆ柇鏄惁鍚敤涓�閿壂鐮佹ā寮忥紝Y涓哄惎鐢紝鏈惎鐢ㄦ椂鍙壂鎻忕墿鏂欐潯鐮�
                     if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N")
                     {
-                        //鏍规嵁鍗曚釜鏉$爜鑾峰彇瀵瑰簲鏁存墭鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃
-                        string sBarCode_New;
-                        DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode_ScanStyle '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillType + "','鏁存墭鎵爜'", "h_p_WMS_BeforeCheckToBarCode_ScanStyle");
-                        if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
+                        if (set_SavePonderationBillMain_Temp_BarCode_SenKai(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, "鏁存墭鎵爜", ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
                         {
-                            sErrMsg = "鑾峰彇鏁存墭鏉$爜淇℃伅鍙戠敓閿欒锛�";
-                            return null;
+                            oBar.HSourceBillType = sHSourceBillType;
+                            oBar.HSourceBillNo = sHSourceBillNo;
+                            oBar.HSupID = sHSupID;
+                            oBar.HSupName = sHSupName;
+                            oBar.HDeptID = sHDeptID;
+                            oBar.HDeptName = sHDeptName;
                         }
                         else
                         {
-                            if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1)
-                            {
-                                sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]);
-                                return null;
-                            }
-                            else if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 2)
-                            {
-                                sErrMsg = "姝ゆā鍧椾笉鍏佽鍙嶅悜鎷嗙爜锛�";
-                                return null;
-                            }
-                            else
-                            {
-                                if (HBillType == "1203")
-                                {
-                                    HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]);
-                                    HSourceBillType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillType"]);
-
-                                    Int64 sMulSourceFlag = 0;   //澶氭簮鍗曟爣蹇楋紙0涓洪潪澶氭簮鍗曟ā寮忥紝1涓哄婧愬崟妯″紡锛�
-                                    if (oSystemParameter.omodel.Kf_OtherInBill_MulSourceBill.ToUpper() == "Y") //绯荤粺鍙傛暟  鍏朵粬鍏ュ簱鍗�-澶氭簮鍗曟ā寮�
-                                    {
-                                        sMulSourceFlag = 1;
-                                    }
-
-                                    //灏嗘簮鍗曚俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-                                    DataSet dsyd = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_OtherIn " + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddSourceBarCode_OtherIn");
-                                    if (dsyd == null || dsyd.Tables[0].Rows.Count == 0)
-                                    {
-                                        sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涘皢鏉$爜瀵瑰簲婧愬崟淇℃伅瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃澶辫触锛�";
-                                        return null;
-                                    }
-                                    else
-                                    {
-                                        if (DBUtility.ClsPub.isLong(dsyd.Tables[0].Rows[0][0]) == 0)
-                                        {
-                                            SourceFlag = true;
-                                        }
-                                        else
-                                        {
-                                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛�" + DBUtility.ClsPub.isStrNull(dsyd.Tables[0].Rows[0]["HRemark"]);
-                                            return null;
-                                        }
-                                    }
-                                }
-
-                                for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
-                                {
-                                    sBarCode_New = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
-                                    if (set_SavePonderationBillMain_Temp_BarCode(sBarCode_New, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
-                                    {
-                                        oBar.HSourceBillType = sHSourceBillType;
-                                        oBar.HSourceBillNo = sHSourceBillNo;
-                                        oBar.HSupID = sHSupID;
-                                        oBar.HSupName = sHSupName;
-                                        oBar.HDeptID = sHDeptID;
-                                        oBar.HDeptName = sHDeptName;
-                                    }
-                                    else
-                                    {
-                                        sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忓け璐ワ紒" + sBarCode_New + sErrMsg;
-                                        return null;
-                                    }
-                                }
-                            }
-                            return oBar;
+                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忓け璐ワ紒" + sBarCode + sErrMsg;
+                            return null;
                         }
+                        return oBar;
                     }
                     //涓�閿壂鐮佹ā寮忥紝鏍规嵁鏉$爜鍓嶇紑璧� 涓嶅悓鏂规硶锛堜粨搴撱�佷粨浣嶃�侀儴闂級锛堟簮鍗曘�佺墿鏂欐潯鐮侊級
                     else
@@ -36771,81 +36712,21 @@
                         //鏃犺繑鍥炴暟鎹垯涓虹墿鏂欐潯鐮�
                         if (Dss == null || Dss.Tables[0].Rows.Count == 0)
                         {
-                            //鏍规嵁鍗曚釜鏉$爜鑾峰彇瀵瑰簲鏁存墭鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃
-                            string sBarCode_New;
-                            DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode_ScanStyle '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillType + "','鏁存墭鎵爜'", "h_p_WMS_BeforeCheckToBarCode_ScanStyle");
-                            if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
+                            if (set_SavePonderationBillMain_Temp_BarCode_SenKai(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, "鏁存墭鎵爜", ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
                             {
-                                sErrMsg = "鑾峰彇鏁存墭鏉$爜淇℃伅鍙戠敓閿欒锛�";
-                                return null;
+                                oBar.HSourceBillType = sHSourceBillType;
+                                oBar.HSourceBillNo = sHSourceBillNo;
+                                oBar.HSupID = sHSupID;
+                                oBar.HSupName = sHSupName;
+                                oBar.HDeptID = sHDeptID;
+                                oBar.HDeptName = sHDeptName;
                             }
                             else
                             {
-                                if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1)
-                                {
-                                    sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]);
-                                    return null;
-                                }
-                                else if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 2)
-                                {
-                                    sErrMsg = "姝ゆā鍧椾笉鍏佽鍙嶅悜鎷嗙爜锛�";
-                                    return null;
-                                }
-                                else
-                                {
-                                    if (HBillType == "1203")
-                                    {
-                                        HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]);
-                                        HSourceBillType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillType"]);
-
-                                        Int64 sMulSourceFlag = 0;   //澶氭簮鍗曟爣蹇楋紙0涓洪潪澶氭簮鍗曟ā寮忥紝1涓哄婧愬崟妯″紡锛�
-                                        if (oSystemParameter.omodel.Kf_OtherInBill_MulSourceBill.ToUpper() == "Y") //绯荤粺鍙傛暟  鍏朵粬鍏ュ簱鍗�-澶氭簮鍗曟ā寮�
-                                        {
-                                            sMulSourceFlag = 1;
-                                        }
-
-                                        //灏嗘簮鍗曚俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-                                        DataSet dsyd = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_OtherIn " + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddSourceBarCode_OtherIn");
-                                        if (dsyd == null || dsyd.Tables[0].Rows.Count == 0)
-                                        {
-                                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涘皢鏉$爜瀵瑰簲婧愬崟淇℃伅瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃澶辫触锛�";
-                                            return null;
-                                        }
-                                        else
-                                        {
-                                            if (DBUtility.ClsPub.isLong(dsyd.Tables[0].Rows[0][0]) == 0)
-                                            {
-                                                SourceFlag = true;
-                                            }
-                                            else
-                                            {
-                                                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛�" + DBUtility.ClsPub.isStrNull(dsyd.Tables[0].Rows[0]["HRemark"]);
-                                                return null;
-                                            }
-                                        }
-                                    }
-
-                                    for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
-                                    {
-                                        sBarCode_New = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
-                                        if (set_SavePonderationBillMain_Temp_BarCode(sBarCode_New, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
-                                        {
-                                            oBar.HSourceBillType = sHSourceBillType;
-                                            oBar.HSourceBillNo = sHSourceBillNo;
-                                            oBar.HSupID = sHSupID;
-                                            oBar.HSupName = sHSupName;
-                                            oBar.HDeptID = sHDeptID;
-                                            oBar.HDeptName = sHDeptName;
-                                        }
-                                        else
-                                        {
-                                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忓け璐ワ紒" + sBarCode_New + sErrMsg;
-                                            return null;
-                                        }
-                                    }
-                                }
-                                return oBar;
+                                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忓け璐ワ紒" + sBarCode + sErrMsg;
+                                return null;
                             }
+                            return oBar;
                         }
                         else
                         {
@@ -37763,50 +37644,21 @@
                     //鍒ゆ柇鏄惁鍚敤涓�閿壂鐮佹ā寮忥紝Y涓哄惎鐢紝鏈惎鐢ㄦ椂鍙壂鎻忕墿鏂欐潯鐮�
                     if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N")
                     {
-                        //鏍规嵁鍗曚釜鏉$爜鑾峰彇瀵瑰簲鏁存墭鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃
-                        string sBarCode_New;
-                        DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode_ScanStyle '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillType + "','" + HScanStyle + "'", "h_p_WMS_BeforeCheckToBarCode_ScanStyle");
-                        if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
+                        if (set_SavePonderationBillMain_Temp_BarCode_SenKai(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, HScanStyle, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
                         {
-                            sErrMsg = "鑾峰彇鏁存墭鏉$爜淇℃伅鍙戠敓閿欒锛�";
-                            return null;
+                            oBar.HSourceBillType = sHSourceBillType;
+                            oBar.HSourceBillNo = sHSourceBillNo;
+                            oBar.HSupID = sHSupID;
+                            oBar.HSupName = sHSupName;
+                            oBar.HDeptID = sHDeptID;
+                            oBar.HDeptName = sHDeptName;
                         }
                         else
                         {
-                            if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1)
-                            {
-                                sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]);
-                                return null;
-                            }
-                            else if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 2)
-                            {
-                                oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HInterID=" + HBillID.ToString() + " and HBillType='" + HBillType + "' and HBarCode='" + sBarCode + "'", ref DBUtility.ClsPub.sExeReturnInfo);
-                                return oBar;
-                            }
-                            else
-                            {
-                                for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
-                                {
-                                    sBarCode_New = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
-                                    if (set_SavePonderationBillMain_Temp_BarCode(sBarCode_New, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
-                                    {
-                                        oBar.HSourceBillType = sHSourceBillType;
-                                        oBar.HSourceBillNo = sHSourceBillNo;
-                                        oBar.HSupID = sHSupID;
-                                        oBar.HSupName = sHSupName;
-                                        oBar.HDeptID = sHDeptID;
-                                        oBar.HDeptName = sHDeptName;
-                                        SourceFlag = true;
-                                    }
-                                    else
-                                    {
-                                        sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忓け璐ワ紒" + sBarCode_New + sErrMsg;
-                                        return null;
-                                    }
-                                }
-                            }
-                            return oBar;
+                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忓け璐ワ紒" + sBarCode + sErrMsg;
+                            return null;
                         }
+                        return oBar;
                     }
                     //涓�閿壂鐮佹ā寮忥紝鏍规嵁鏉$爜鍓嶇紑璧� 涓嶅悓鏂规硶锛堜粨搴撱�佷粨浣嶃�侀儴闂級锛堟簮鍗曘�佺墿鏂欐潯鐮侊級
                     else
@@ -37818,50 +37670,21 @@
                         //鏃犺繑鍥炴暟鎹垯涓虹墿鏂欐潯鐮�
                         if (Dss == null || Dss.Tables[0].Rows.Count == 0)
                         {
-                            //鏍规嵁鍗曚釜鏉$爜鑾峰彇瀵瑰簲鏁存墭鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃
-                            string sBarCode_New;
-                            DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode_ScanStyle '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillType + "','" + HScanStyle + "'", "h_p_WMS_BeforeCheckToBarCode_ScanStyle");
-                            if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
+                            if (set_SavePonderationBillMain_Temp_BarCode_SenKai(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, HScanStyle, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
                             {
-                                sErrMsg = "鑾峰彇鏁存墭鏉$爜淇℃伅鍙戠敓閿欒锛�";
-                                return null;
+                                oBar.HSourceBillType = sHSourceBillType;
+                                oBar.HSourceBillNo = sHSourceBillNo;
+                                oBar.HSupID = sHSupID;
+                                oBar.HSupName = sHSupName;
+                                oBar.HDeptID = sHDeptID;
+                                oBar.HDeptName = sHDeptName;
                             }
                             else
                             {
-                                if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1)
-                                {
-                                    sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]);
-                                    return null;
-                                }
-                                else if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 2)
-                                {
-                                    oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HInterID=" + HBillID.ToString() + " and HBillType='" + HBillType + "' and HBarCode='" + sBarCode + "'", ref DBUtility.ClsPub.sExeReturnInfo);
-                                    return oBar;
-                                }
-                                else
-                                {
-                                    for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
-                                    {
-                                        sBarCode_New = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
-                                        if (set_SavePonderationBillMain_Temp_BarCode(sBarCode_New, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
-                                        {
-                                            oBar.HSourceBillType = sHSourceBillType;
-                                            oBar.HSourceBillNo = sHSourceBillNo;
-                                            oBar.HSupID = sHSupID;
-                                            oBar.HSupName = sHSupName;
-                                            oBar.HDeptID = sHDeptID;
-                                            oBar.HDeptName = sHDeptName;
-                                            SourceFlag = true;
-                                        }
-                                        else
-                                        {
-                                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忓け璐ワ紒" + sBarCode_New + sErrMsg;
-                                            return null;
-                                        }
-                                    }
-                                }
-                                return oBar;
+                                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忓け璐ワ紒" + sBarCode + sErrMsg;
+                                return null;
                             }
+                            return oBar;
                         }
                         else
                         {
@@ -38638,6 +38461,248 @@
 
         #endregion
 
+        #region 鎵弿鐗╂枡鏉$爜  瀛樺叆鍑哄叆搴撴潯鐮佷复鏃惰〃  妫シ涓撶敤
+
+        //鎵弿鐗╂枡鏉$爜    淇濆瓨鍒板嚭鍏ュ簱鏉$爜涓存椂琛�(鐗╂枡)
+        [WebMethod]
+        public bool set_SavePonderationBillMain_Temp_BarCode_SenKai(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, bool HRedBlueFlag, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HOWNERID, string HExpressNumber, string HScanStyle, 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();
+            DAL.ClsKF_PonderationBillMain_Temp_Ctl tem = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
+            Model.ClsKF_PonderationBillMain_Temp model = new Model.ClsKF_PonderationBillMain_Temp();
+            DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View();
+            //double sRelQty = 0;
+            string sBarCode_New = "";
+
+            //鍒ゆ柇鏉$爜鏄惁鍚壒娈婄鍙� # 锛屽鏋滃惈鏈夊垯 鎷嗗垎
+            string[] NewBarCode;
+            if (sBarCode.Contains("#"))
+            {
+                NewBarCode = sBarCode.Split(Convert.ToChar("#"));
+                sBarCode = NewBarCode[0];
+                HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]);
+            }
+
+            //鑾峰彇绯荤粺鍙傛暟
+            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+            if (oSystemParameter.ShowBill(ref sErrMsg) == false)
+            {
+                sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                return false;
+            }
+
+            if (dal.GetInfoByNumber_View(sBarCode))
+            {
+                //鏍规嵁鍗曚釜鏉$爜鑾峰彇瀵瑰簲鏁存墭鏉$爜淇℃伅
+                DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode_ScanStyle '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillType + "','" + HScanStyle + "'", "h_p_WMS_BeforeCheckToBarCode_ScanStyle");
+                if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
+                {
+                    sErrMsg = "鑾峰彇鏁存墭鏉$爜淇℃伅鍙戠敓閿欒锛�";
+                    return false;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1)
+                    {
+                        sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]);
+                        return false;
+                    }
+                    else if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 2)
+                    {
+                        if (HBillType == "1205" || HBillType == "1206")
+                        {
+                            oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HInterID=" + HBillID.ToString() + " and HBillType='" + HBillType + "' and HBarCode='" + sBarCode + "'", ref DBUtility.ClsPub.sExeReturnInfo);
+                            return true;
+                        }
+                        else
+                        {
+                            sErrMsg = "姝ゆā鍧椾笉鍏佽鍙嶅悜鎷嗙爜锛�";
+                            return false;
+                        }
+                    }
+                    else
+                    {
+                        dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]);
+                        dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceEntryID"]);
+                        dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceInterID"]);
+                        HSourceBillType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillType"]);
+                        //鑾峰彇浠撳簱浠撲綅淇℃伅
+                        if (HWhID == 0)
+                        {
+                            HWhID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HWHID"]);
+                            HSPID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSPID"]);
+                        }
+                        else
+                        {
+                            if (HBillType != "1203" && (HWhID != DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HWHID"]) || HSPID != DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSPID"])))
+                            {
+                                sErrMsg = "鏉$爜瀵瑰簲鐗╂枡鍦ㄧ晫闈㈡墍閫変粨搴撱�佷粨浣嶄笂鏃犲簱瀛橈紒";
+                                return false;
+                            }
+                        }
+
+                        //灏嗘暣鎵樻潯鐮佸搴旂殑鏉$爜缂栧彿鎷兼垚涓�涓插瓧绗︿覆
+                        for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
+                        {
+                            sBarCode_New = sBarCode_New + "," + DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
+                        }
+                        sBarCode_New = sBarCode_New.Remove(0, 1);   //鍘绘帀瀛楃涓茬涓�涓瓧绗�
+
+                        if (HBillType == "1203")
+                        {
+                            HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]);
+                            HSourceBillType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillType"]);
+
+                            Int64 sMulSourceFlag = 0;   //澶氭簮鍗曟爣蹇楋紙0涓洪潪澶氭簮鍗曟ā寮忥紝1涓哄婧愬崟妯″紡锛�
+                            if (oSystemParameter.omodel.Kf_OtherInBill_MulSourceBill.ToUpper() == "Y") //绯荤粺鍙傛暟  鍏朵粬鍏ュ簱鍗�-澶氭簮鍗曟ā寮�
+                            {
+                                sMulSourceFlag = 1;
+                            }
+
+                            //灏嗘簮鍗曚俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                            DataSet dsyd = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_OtherIn " + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddSourceBarCode_OtherIn");
+                            if (dsyd == null || dsyd.Tables[0].Rows.Count == 0)
+                            {
+                                sErrMsg = "灏嗘潯鐮佸搴旀簮鍗曚俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛ㄥけ璐ワ紒";
+                                return false;
+                            }
+                            else
+                            {
+                                if (DBUtility.ClsPub.isLong(dsyd.Tables[0].Rows[0][0]) == 0)
+                                {
+                                    sHSourceBillType = DBUtility.ClsPub.isStrNull(dsyd.Tables[0].Rows[0]["HSourceBillType"]);
+                                    sHSourceBillNo = DBUtility.ClsPub.isStrNull(dsyd.Tables[0].Rows[0]["HSourceBillNo"]);
+                                    sHSupID = DBUtility.ClsPub.isLong(dsyd.Tables[0].Rows[0]["HSupID"]);
+                                    sHSupName = DBUtility.ClsPub.isStrNull(dsyd.Tables[0].Rows[0]["HSupName"]);
+                                    sHDeptID = DBUtility.ClsPub.isLong(dsyd.Tables[0].Rows[0]["HDeptID"]);
+                                    sHDeptName = DBUtility.ClsPub.isStrNull(dsyd.Tables[0].Rows[0]["HDeptName"]);
+                                    HSourceBillType = DBUtility.ClsPub.isStrNull(dsyd.Tables[0].Rows[0]["HSourceBillType"]);
+                                }
+                                else
+                                {
+                                    sErrMsg = DBUtility.ClsPub.isStrNull(dsyd.Tables[0].Rows[0]["HRemark"]);
+                                    return false;
+                                }
+                            }
+                        }
+                        else
+                        {
+                            //鏃犳簮鍗曠姸鎬侊紝璁剧疆婧愬崟绫诲瀷涓�-1
+                            if (SourceFlag == false)
+                            {
+                                HSourceBillType = "-1";
+                            }
+                        }
+                    }
+                }
+
+                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 = dal.omodel_View.HQty;
+                model.HQtyMust = 0;
+                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;
+
+                //鐗╂枡鏉$爜鍐欏叆涓存椂琛ㄦ椂锛屽垽鏂粨搴撲粨浣嶆槸鍚︽纭�
+                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;
+                    }
+                }
+
+                string sOneScanCtl = "N";       //涓�娆℃壂鐮佹帶鍒讹紙'Y'涓烘帶鍒讹級
+                if (HBillType == "1203" && oSystemParameter.omodel.Kf_OtherInBill_BillTypeOneScan.ToUpper() == "Y")
+                {
+                    sOneScanCtl = "Y";
+                }
+                else if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBill_BillTypeOneScan.ToUpper() == "Y")
+                {
+                    sOneScanCtl = "Y";
+                }
+                else if (HBillType == "1206" && oSystemParameter.omodel.Kf_OtherOutBill_BillTypeOneScan.ToUpper() == "Y")
+                {
+                    sOneScanCtl = "Y";
+                }
+
+                //涓�娆℃壂鐮佹帶鍒讹紝鍚屼竴鏉$爜銆佸悓涓�鍗曟嵁绫诲瀷锛屽湪WMS琛ㄥ拰TEMP琛ㄩ噷锛屽彧鍏佽杩涜涓�娆℃壂鐮�
+                if (dal.omodel_View.HBarCodeType == "鍞竴鏉$爜" && sOneScanCtl == "Y")
+                {
+                    DataSet ds = oCn.RunProcReturn("exec h_p_WMS_CheckBarCodeOneScan " + model.HInterID.ToString() + ",'" + DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCode"]) + "','" + model.HBillType + "'," + model.HWhID.ToString() + "," + model.HStockPlaceID.ToString() + "," + model.HSCWHID.ToString() + "," + model.HOutStockPlaceID.ToString() + ",'" + model.HMaker + "'", "h_p_WMS_CheckBarCodeOneScan");
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                    }
+                    else
+                    {
+                        if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 1)
+                        {
+                            sErrMsg = "瀵逛笉璧凤紝鎮ㄦ壂鎻忕殑鏉″舰鐮佸凡琚壂鎻忚繃锛屼笉绗﹀悎涓�娆℃壂鐮佺郴缁熷弬鏁扮殑瑕佹眰锛�";
+                            return false;
+                        }
+                    }
+                }
+
+                //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ュ嚭鍏ュ簱鏉$爜涓存椂琛�
+                oCn.RunProc("Insert into KF_PonderationBillMain_Temp " +
+                "(HInterID,HBillNo,HBillType,HMaterID,HAuxPropID,HProcID" +
+                ",HWhID,HSCWHID,HStockPlaceID,HOutStockPlaceID,HGroupID,HAddr" +
+                ",HQtyMust,HQty,HPieceQty,HBatchNo,HBarCode,HBarCode_Pack" +
+                ",HMaker,HMakeDate,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
+                ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag,HMTONo,HPlanMode" +
+                ",HSTOCKORGID,HOtherOrgID,HOWNERID,HOWNERTYPEID,HExpressNumber,HSubBillType" +
+                ",HCusID,HDeptID,HCusBarCode,HMulSourceBill) " +
+                " select " + model.HInterID.ToString() + ",'" + model.HBillNo + "','" + model.HBillType + "',HMaterID,HAuxPropID," + model.HProcID.ToString() +
+                "," + model.HWhID.ToString() + "," + model.HSCWHID.ToString() + "," + model.HStockPlaceID.ToString() + "," + model.HOutStockPlaceID.ToString() + "," + model.HGroupID.ToString() + ",'" + model.HAddr + "'" +
+                "," + model.HQtyMust.ToString() + ",HQty," + model.HPieceQty.ToString() + ",HBatchNo,HBarCode,''" +
+                ",'" + model.HMaker + "',getdate()," + model.HSourceInterID.ToString() + "," + model.HSourceEntryID.ToString() + ",'" + model.HSourceBillType + "','" + model.HSourceBillNo + "'" +
+                "," + model.HRelationInterID.ToString() + "," + model.HRelationEntryID.ToString() + ",'" + model.HRelationBillNo + "'," + Convert.ToString(model.HRedBlueFlag ? 1 : 0) + ",'" + model.HMTONo + "',0" +
+                "," + model.HSTOCKORGID.ToString() + "," + model.HOWNERID.ToString() + "," + model.HSTOCKORGID.ToString() + ",'','','" + model.HSubBillType + "'" +
+                ",0,0,'" + model.HCusBarCode + "'," + model.HMulSourceBill.ToString() +
+                "from  Gy_BarCodeBill with(nolock) where charindex(',' + HBarCode + ',',',' + '" + sBarCode_New + "' + ',')>0"
+                );
+                return true;
+                }
+            else
+            {
+                sErrMsg = "鏃犳晥鏉$爜";
+                return false;
+            }
+        }
+
+        #endregion
+
         #region 涓�閿壂鐮�    閿�鍞嚭搴撱�侀攢鍞��搴撴ā鍧� 椋為緳涓撶敤
 
         [WebMethod]
@@ -39336,7 +39401,7 @@
         #region 灏嗘簮鍗曚俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�     鐢熶骇姹囨姤銆佺敓浜у叆搴撱�侀噰璐叆搴撱�佸澶栧叆搴撱�佸叾浠栧叆搴�
 
         [WebMethod]
-        public Model.ClsKf_ICStockBill_WMS get_SourceBill_New(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HStockOrgID, Int64 HAccessFlag, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
+        public Model.ClsKf_ICStockBill_WMS get_SourceBill_MaterBarCode(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HStockOrgID, Int64 HAccessFlag, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
         {
             SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
             Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
@@ -39344,7 +39409,7 @@
             if (HBillType == "3711")
             {
                 //鐢熶骇姹囨姤鍗�
-                oBar = get_SourceBarCode_OtherIn_New(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HStockOrgID, HAccessFlag, oSystemParameterMain, ref sErrMsg);
+                oBar = get_SourceBill_ICMOReport(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HStockOrgID, HAccessFlag, oSystemParameterMain, ref sErrMsg);
                 if (oBar == null)
                 {
                     return null;
@@ -39429,7 +39494,7 @@
             }
 
             //灏嗘簮鍗曚俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_OtherIn " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HStockOrgID.ToString() + "," + HAccessFlag.ToString(), "h_p_WMS_AddSourceBarCode_OtherIn");
+            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_ICMOReport " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HStockOrgID.ToString() + "," + HAccessFlag.ToString(), "h_p_WMS_AddSourceBarCode_ICMOReport");
             if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
             {
                 sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涘皢婧愬崟淇℃伅瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃澶辫触锛�";
@@ -39447,9 +39512,6 @@
                     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.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"]);
                     return oBar;
                 }
                 else
@@ -41484,7 +41546,7 @@
                 && (HBillType == "1201" || HBillType == "1202" || HBillType == "1203" || HBillType == "1210" || HBillType == "3711"))
             {
                 Int64 HAccessFlag = 1;   //鏄惁鐗╂枡鏉$爜甯﹀嚭婧愬崟淇℃伅鏍囧織锛�0涓虹洿鎺ユ壂婧愬崟鏉$爜锛�1涓虹墿鏂欐潯鐮佸甫鍑烘簮鍗曚俊鎭級
-                oBar = get_SourceBill_New(HInterID, HBillNo, HBillType, omodel_View.HSourceBillNo, omodel_View.HSourceBillType, HMaker, HStockOrgID, HAccessFlag, oSystemParameterMain, ref sErrMsg);
+                oBar = get_SourceBill_MaterBarCode(HInterID, HBillNo, HBillType, omodel_View.HSourceBillNo, omodel_View.HSourceBillType, HMaker, HStockOrgID, HAccessFlag, oSystemParameterMain, ref sErrMsg);
                 if (oBar == null)
                 {
                     return null;

--
Gitblit v1.9.1