From e20bcf27cc3a5be833991c26be7ac46de8403bf5 Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期四, 04 五月 2023 17:08:46 +0800
Subject: [PATCH] 调拨扫描物料条码调用方法修改

---
 CLOUDWEB/WebService1.asmx.cs |  401 ++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 295 insertions(+), 106 deletions(-)

diff --git a/CLOUDWEB/WebService1.asmx.cs b/CLOUDWEB/WebService1.asmx.cs
index 4195531..d610d39 100644
--- a/CLOUDWEB/WebService1.asmx.cs
+++ b/CLOUDWEB/WebService1.asmx.cs
@@ -46951,7 +46951,8 @@
                     return null;
                 }
 
-                if (sBarCode.Trim() == "")
+                sBarCode = sBarCode.Trim();
+                if (sBarCode == "")
                 {
                     sErrMsg = "鏉$爜涓嶈兘涓虹┖锛岃鎵弿鏉$爜锛�";
                     return null;
@@ -47087,7 +47088,7 @@
                 else
                 {
                     //鏍规嵁閫掑叆鐨勬潯鐮佸墠涓変綅锛屽垽鏂潯鐮佺被鍨嬶紙浠撳簱鏉$爜銆佷粨浣嶆潯鐮併�侀儴闂ㄦ潯鐮併�佹簮鍗曟潯鐮併�佺墿鏂欐潯鐮侊級
-                    DataSet Dss = oCn.RunProcReturn(" select HSourceName,BarCodeType,HSourceBillType from Xt_BarCodeType with(nolock) where HSourceNumber= '" + sBarCodePrefix + "'", "Xt_BarCodeType");
+                    DataSet Dss = oCn.RunProcReturn(" select HSourceName,BarCodeType,HSourceBillType from Xt_BarCodeType with(nolock) where HSourceNumber= '" + sBarCodePrefix + "' and (HBillType = '' or HBillType ='" + HBillType + "')", "Xt_BarCodeType");
 
                     //鏃犺繑鍥炴暟鎹垯涓虹墿鏂欐潯鐮�
                     if (Dss == null || Dss.Tables[0].Rows.Count == 0)
@@ -48257,134 +48258,322 @@
                 DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View();
                 string sBarCodePrefix = sBarCode.Substring(0, Math.Min(3, sBarCode.Length));//鎴彇鏉$爜鍓嶄笁浣嶅瓧绗︿覆
 
-                if (sBarCodePrefix == "PAK")
+                //鏍规嵁绯荤粺鍙傛暟锛屽垽鏂槸鍚﹀惎鐢ㄤ竴閿壂鐮佹ā寮忥紝Y涓哄惎鐢�
+                //鏈惎鐢紝鍙壂鎻忕墿鏂欐潯鐮�
+                if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N")
                 {
-                    bool HRedBlueFlag = false;
-                    //灏嗘ā娌诲叿淇℃伅鍐欏叆妯℃不鍏峰嚭鍏ュ簱涓存椂琛�
-                    DataSet Mould = oCn.RunProcReturn("exec h_p_WMS_AddMouldBarCode_New '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + HSCWHID.ToString() + "," + HSCSPID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HRedBlueFlag + "','" + HMaker + "'," + HStockOutOrgID.ToString(), "h_p_WMS_AddMouldBarCode_New");
-                    if (Mould == null || Mould.Tables[0].Rows.Count == 0)
+                    if (sBarCodePrefix == "PAK")
                     {
-                        sErrMsg = "灏嗘ā娌诲叿淇℃伅鍐欏叆妯℃不鍏峰嚭鍏ュ簱涓存椂琛ㄥけ璐ワ紒";
-                        return null;
-                    }
-                    else
-                    {
-                        if (DBUtility.ClsPub.isLong(Mould.Tables[0].Rows[0][0]) == 0)
+                        bool HRedBlueFlag = false;
+                        //灏嗘ā娌诲叿淇℃伅鍐欏叆妯℃不鍏峰嚭鍏ュ簱涓存椂琛�
+                        DataSet Mould = oCn.RunProcReturn("exec h_p_WMS_AddMouldBarCode_New '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + HSCWHID.ToString() + "," + HSCSPID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HRedBlueFlag + "','" + HMaker + "'," + HStockOutOrgID.ToString(), "h_p_WMS_AddMouldBarCode_New");
+                        if (Mould == null || Mould.Tables[0].Rows.Count == 0)
                         {
-                            oBar.HBarType = "妯℃不鍏锋潯鐮�";
-                            return oBar;
-                        }
-                        else
-                        {
-                            sErrMsg = DBUtility.ClsPub.isStrNull(Mould.Tables[0].Rows[0]["HRemark"]);
-                            return null;
-                        }
-                    }
-                }
-                else
-                {
-                    if (dal.GetInfoByBarCode_View(sBarCode))
-                    {
-                        if (dal.omodel_View.HStopflag)
-                        {
-                            sErrMsg = "鏉$爜宸茶绂佺敤锛屼笉鍏佽鎵弿锛�";
+                            sErrMsg = "灏嗘ā娌诲叿淇℃伅鍐欏叆妯℃不鍏峰嚭鍏ュ簱涓存椂琛ㄥけ璐ワ紒";
                             return null;
                         }
                         else
                         {
-                            //妫シ涓撶敤
-                            if (oSystemParameter.omodel.WMS_CampanyName == "妫シ") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                            if (DBUtility.ClsPub.isLong(Mould.Tables[0].Rows[0][0]) == 0)
                             {
-                                if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock_SenKai(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, "鏁存墭鎵爜", oSystemParameter.omodel, ref sErrMsg))
-                                {
-                                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
-                                    return null;
-                                }
+                                oBar.HBarType = "妯℃不鍏锋潯鐮�";
                                 return oBar;
                             }
                             else
                             {
-                                //鎵樼洏鏉$爜  鍗撳姏
-                                if (dal.omodel_View.HBarCodeType == "鎵樼洏鏉$爜" && oSystemParameter.omodel.WMS_CampanyName == "鍗撳姏")
+                                sErrMsg = DBUtility.ClsPub.isStrNull(Mould.Tables[0].Rows[0]["HRemark"]);
+                                return null;
+                            }
+                        }
+                    }
+                    else
+                    {
+                        if (dal.GetInfoByBarCode_View(sBarCode))
+                        {
+                            if (dal.omodel_View.HStopflag)
+                            {
+                                sErrMsg = "鏉$爜宸茶绂佺敤锛屼笉鍏佽鎵弿锛�";
+                                return null;
+                            }
+                            else
+                            {
+                                //妫シ涓撶敤
+                                if (oSystemParameter.omodel.WMS_CampanyName == "妫シ") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
                                 {
-                                    //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-                                    if (!set_SavePonderationBillMain_Temp_BarCode_Pack_MoveStock_ZhuoLi(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, oSystemParameter.omodel, ref sErrMsg))
-                                    {
-                                        sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐墭鏉$爜澶辫触锛�" + sErrMsg;
-                                        return null;
-                                    }
-                                    return oBar;
-                                }
-                                //鍒ゆ柇鏉$爜绫诲瀷鏄惁涓烘墭鐩樻潯鐮侊紝濡傛灉鏄墭鐩樻潯鐮佸垯鍒嗚В骞舵ā鎷熸壂鐮�
-                                else if (dal.omodel_View.HBarCodeType == "鎵樼洏鏉$爜")
-                                {
-                                    //鍒嗚В鎵樼洏鏉$爜寰楀埌鏄庣粏鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃
-                                    DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToTPBarCode '" + sBarCode + "'", "h_p_WMS_BeforeCheckToTPBarCode");
-                                    if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
-                                    {
-                                        sErrMsg = "鍒嗚В鎵樼洏鏉$爜鍙戠敓閿欒锛�";
-                                        return null;
-                                    }
-                                    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
-                                        {
-                                            for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
-                                            {
-                                                dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
-                                                dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeType"]);
-                                                dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HMaterID"]);
-                                                dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HAuxPropID"]);
-                                                dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBatchNo"]);
-                                                dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[i]["HQty"]);
-                                                dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HSourceInterID"]);
-                                                dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HSourceEntryID"]);
-                                                dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HSourceBillNo"]);
-                                                dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HMTONo"]);
-                                                //鏃犳簮鍗曠姸鎬侊紝璁剧疆婧愬崟绫诲瀷涓�-1
-                                                if (SourceFlag == false)
-                                                {
-                                                    HSourceBillType = "-1";
-                                                }
-                                                if (i != 0)
-                                                {
-                                                    SourceFlag = true;
-                                                }
-
-                                                //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-                                                if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg))
-                                                {
-                                                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
-                                                    return null;
-                                                }
-                                            }
-                                        }
-                                        return oBar;
-                                    }
-                                }
-                                else
-                                //鏉$爜绫诲瀷涓嶄负鎵樼洏鏉$爜
-                                {
-                                    //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-                                    if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg))
+                                    if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock_SenKai(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, "鏁存墭鎵爜", oSystemParameter.omodel, ref sErrMsg))
                                     {
                                         sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
                                         return null;
                                     }
                                     return oBar;
                                 }
+                                else
+                                {
+                                    //鎵樼洏鏉$爜  鍗撳姏
+                                    if (dal.omodel_View.HBarCodeType == "鎵樼洏鏉$爜" && oSystemParameter.omodel.WMS_CampanyName == "鍗撳姏")
+                                    {
+                                        //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                                        if (!set_SavePonderationBillMain_Temp_BarCode_Pack_MoveStock_ZhuoLi(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, oSystemParameter.omodel, ref sErrMsg))
+                                        {
+                                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐墭鏉$爜澶辫触锛�" + sErrMsg;
+                                            return null;
+                                        }
+                                        return oBar;
+                                    }
+                                    //鍒ゆ柇鏉$爜绫诲瀷鏄惁涓烘墭鐩樻潯鐮侊紝濡傛灉鏄墭鐩樻潯鐮佸垯鍒嗚В骞舵ā鎷熸壂鐮�
+                                    else if (dal.omodel_View.HBarCodeType == "鎵樼洏鏉$爜")
+                                    {
+                                        //鍒嗚В鎵樼洏鏉$爜寰楀埌鏄庣粏鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃
+                                        DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToTPBarCode '" + sBarCode + "'", "h_p_WMS_BeforeCheckToTPBarCode");
+                                        if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
+                                        {
+                                            sErrMsg = "鍒嗚В鎵樼洏鏉$爜鍙戠敓閿欒锛�";
+                                            return null;
+                                        }
+                                        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
+                                            {
+                                                for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
+                                                {
+                                                    dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
+                                                    dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeType"]);
+                                                    dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HMaterID"]);
+                                                    dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HAuxPropID"]);
+                                                    dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBatchNo"]);
+                                                    dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[i]["HQty"]);
+                                                    dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HSourceInterID"]);
+                                                    dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HSourceEntryID"]);
+                                                    dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HSourceBillNo"]);
+                                                    dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HMTONo"]);
+                                                    //鏃犳簮鍗曠姸鎬侊紝璁剧疆婧愬崟绫诲瀷涓�-1
+                                                    if (SourceFlag == false)
+                                                    {
+                                                        HSourceBillType = "-1";
+                                                    }
+                                                    if (i != 0)
+                                                    {
+                                                        SourceFlag = true;
+                                                    }
+
+                                                    //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                                                    if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg))
+                                                    {
+                                                        sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
+                                                        return null;
+                                                    }
+                                                }
+                                            }
+                                            return oBar;
+                                        }
+                                    }
+                                    else
+                                    //鏉$爜绫诲瀷涓嶄负鎵樼洏鏉$爜
+                                    {
+                                        //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                                        if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg))
+                                        {
+                                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
+                                            return null;
+                                        }
+                                        return oBar;
+                                    }
+                                }
+                            }
+                        }
+                        else
+                        {
+                            sErrMsg = "鏉$爜妗f涓笉瀛樺湪璇ユ潯鐮侊紝璇风‘璁ゆ潯鐮佹槸鍚︽纭垨鏄惁宸茶鍒犻櫎锛�";
+                            return null;
+                        }
+                    }
+                }
+                //鍚敤锛屾牴鎹潯鐮佸墠缂�璧颁笉鍚屾柟娉曪紙浠撳簱鏉$爜銆佷粨浣嶆潯鐮併�侀儴闂ㄦ潯鐮併�佹簮鍗曟潯鐮併�佺墿鏂欐潯鐮侊級
+                else
+                {
+                    //鏍规嵁閫掑叆鐨勬潯鐮佸墠涓変綅锛屽垽鏂潯鐮佺被鍨嬶紙浠撳簱鏉$爜銆佷粨浣嶆潯鐮併�侀儴闂ㄦ潯鐮併�佹簮鍗曟潯鐮併�佺墿鏂欐潯鐮侊級
+                    DataSet Dss = oCn.RunProcReturn(" select HSourceName,BarCodeType,HSourceBillType from Xt_BarCodeType with(nolock) where HSourceNumber= '" + sBarCodePrefix + "' and (HBillType = '' or HBillType ='" + HBillType + "')", "Xt_BarCodeType");
+
+                    //鏃犺繑鍥炴暟鎹垯涓虹墿鏂欐潯鐮�
+                    if (Dss == null || Dss.Tables[0].Rows.Count == 0)
+                    {
+                        if (sBarCodePrefix == "PAK")
+                        {
+                            bool HRedBlueFlag = false;
+                            //灏嗘ā娌诲叿淇℃伅鍐欏叆妯℃不鍏峰嚭鍏ュ簱涓存椂琛�
+                            DataSet Mould = oCn.RunProcReturn("exec h_p_WMS_AddMouldBarCode_New '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + HSCWHID.ToString() + "," + HSCSPID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HRedBlueFlag + "','" + HMaker + "'," + HStockOutOrgID.ToString(), "h_p_WMS_AddMouldBarCode_New");
+                            if (Mould == null || Mould.Tables[0].Rows.Count == 0)
+                            {
+                                sErrMsg = "灏嗘ā娌诲叿淇℃伅鍐欏叆妯℃不鍏峰嚭鍏ュ簱涓存椂琛ㄥけ璐ワ紒";
+                                return null;
+                            }
+                            else
+                            {
+                                if (DBUtility.ClsPub.isLong(Mould.Tables[0].Rows[0][0]) == 0)
+                                {
+                                    oBar.HBarType = "妯℃不鍏锋潯鐮�";
+                                    return oBar;
+                                }
+                                else
+                                {
+                                    sErrMsg = DBUtility.ClsPub.isStrNull(Mould.Tables[0].Rows[0]["HRemark"]);
+                                    return null;
+                                }
+                            }
+                        }
+                        else
+                        {
+                            if (dal.GetInfoByBarCode_View(sBarCode))
+                            {
+                                if (dal.omodel_View.HStopflag)
+                                {
+                                    sErrMsg = "鏉$爜宸茶绂佺敤锛屼笉鍏佽鎵弿锛�";
+                                    return null;
+                                }
+                                else
+                                {
+                                    //妫シ涓撶敤
+                                    if (oSystemParameter.omodel.WMS_CampanyName == "妫シ") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                                    {
+                                        if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock_SenKai(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, "鏁存墭鎵爜", oSystemParameter.omodel, ref sErrMsg))
+                                        {
+                                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
+                                            return null;
+                                        }
+                                        return oBar;
+                                    }
+                                    else
+                                    {
+                                        //鎵樼洏鏉$爜  鍗撳姏
+                                        if (dal.omodel_View.HBarCodeType == "鎵樼洏鏉$爜" && oSystemParameter.omodel.WMS_CampanyName == "鍗撳姏")
+                                        {
+                                            //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                                            if (!set_SavePonderationBillMain_Temp_BarCode_Pack_MoveStock_ZhuoLi(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, oSystemParameter.omodel, ref sErrMsg))
+                                            {
+                                                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐墭鏉$爜澶辫触锛�" + sErrMsg;
+                                                return null;
+                                            }
+                                            return oBar;
+                                        }
+                                        //鍒ゆ柇鏉$爜绫诲瀷鏄惁涓烘墭鐩樻潯鐮侊紝濡傛灉鏄墭鐩樻潯鐮佸垯鍒嗚В骞舵ā鎷熸壂鐮�
+                                        else if (dal.omodel_View.HBarCodeType == "鎵樼洏鏉$爜")
+                                        {
+                                            //鍒嗚В鎵樼洏鏉$爜寰楀埌鏄庣粏鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃
+                                            DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToTPBarCode '" + sBarCode + "'", "h_p_WMS_BeforeCheckToTPBarCode");
+                                            if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
+                                            {
+                                                sErrMsg = "鍒嗚В鎵樼洏鏉$爜鍙戠敓閿欒锛�";
+                                                return null;
+                                            }
+                                            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
+                                                {
+                                                    for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
+                                                    {
+                                                        dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
+                                                        dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeType"]);
+                                                        dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HMaterID"]);
+                                                        dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HAuxPropID"]);
+                                                        dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBatchNo"]);
+                                                        dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[i]["HQty"]);
+                                                        dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HSourceInterID"]);
+                                                        dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HSourceEntryID"]);
+                                                        dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HSourceBillNo"]);
+                                                        dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HMTONo"]);
+                                                        //鏃犳簮鍗曠姸鎬侊紝璁剧疆婧愬崟绫诲瀷涓�-1
+                                                        if (SourceFlag == false)
+                                                        {
+                                                            HSourceBillType = "-1";
+                                                        }
+                                                        if (i != 0)
+                                                        {
+                                                            SourceFlag = true;
+                                                        }
+
+                                                        //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                                                        if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg))
+                                                        {
+                                                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
+                                                            return null;
+                                                        }
+                                                    }
+                                                }
+                                                return oBar;
+                                            }
+                                        }
+                                        else
+                                        //鏉$爜绫诲瀷涓嶄负鎵樼洏鏉$爜
+                                        {
+                                            //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                                            if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg))
+                                            {
+                                                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
+                                                return null;
+                                            }
+                                            return oBar;
+                                        }
+                                    }
+                                }
+                            }
+                            else
+                            {
+                                sErrMsg = "鏉$爜妗f涓笉瀛樺湪璇ユ潯鐮侊紝璇风‘璁ゆ潯鐮佹槸鍚︽纭垨鏄惁宸茶鍒犻櫎锛�";
+                                return null;
                             }
                         }
                     }
+                    //浠撳簱鏉$爜銆佷粨浣嶆潯鐮併�侀儴闂ㄦ潯鐮併�佹簮鍗曟潯鐮�
                     else
                     {
-                        sErrMsg = "鏉$爜妗f涓笉瀛樺湪璇ユ潯鐮侊紝璇风‘璁ゆ潯鐮佹槸鍚︽纭垨鏄惁宸茶鍒犻櫎锛�";
-                        return null;
+                        string sBarBillName = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HSourceName"]);
+                        string sBarBillType = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["BarCodeType"]);
+                        string sSourceBillType = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HSourceBillType"]);
+
+                        //鍒ゆ柇鏉$爜绫诲瀷涓� 鍩虹璧勬枡鏉$爜 鎴� 婧愬崟鏉$爜
+                        if (sBarBillType == "鍩虹璧勬枡鏉$爜")
+                        {
+                            oBar = get_BaseSet(sBarCode, HStockOutOrgID, sBarBillName, ref sErrMsg);
+                            if (oBar == null)
+                            {
+                                sErrMsg = "鍚敤涓�閿壂鐮佹ā寮忥紝" + sErrMsg;
+                                return null;
+                            }
+                            else
+                            {
+                                return oBar;
+                            }
+                        }
+                        //婧愬崟鏉$爜
+                        else if (sBarBillType == "婧愬崟鏉$爜")
+                        {
+                            oBar = get_BillBarCode(HBillID, HBillNo, HBillType, sBarCode, sSourceBillType, HMaker, 0, 0, 0, HStockOutOrgID, oSystemParameter.omodel, ref sErrMsg);
+                            if (oBar == null)
+                            {
+                                sErrMsg = "鍚敤涓�閿壂鐮佹ā寮忥紝" + sErrMsg;
+                                return null;
+                            }
+                            else
+                            {
+                                oBar.HBarType = "婧愬崟鏉$爜";
+                                return oBar;
+                            }
+                        }
+                        else
+                        {
+                            sErrMsg = "鍚敤涓�閿壂鐮佹ā寮忥紝鎵�鎵潯鐮佸墠缂�璁剧疆閿欒锛�";
+                            return null;
+                        }
                     }
                 }
             }

--
Gitblit v1.9.1