From dbb428a66a4ebe4de1deeee1f14a0f62e5d07520 Mon Sep 17 00:00:00 2001
From: ch <37327@LLOOCCY>
Date: 星期五, 24 六月 2022 10:35:05 +0800
Subject: [PATCH] 修改了AGV配送单列表界面查询按钮

---
 CLOUDWEB/WebService1.asmx.cs | 1510 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 1,480 insertions(+), 30 deletions(-)

diff --git a/CLOUDWEB/WebService1.asmx.cs b/CLOUDWEB/WebService1.asmx.cs
index 2837cd9..feaa6c8 100644
--- a/CLOUDWEB/WebService1.asmx.cs
+++ b/CLOUDWEB/WebService1.asmx.cs
@@ -23469,6 +23469,9 @@
             }
         }
 
+
+        
+
         /// <summary>
         /// 浜у搧鍏ュ簱鍗�
         /// </summary>
@@ -23617,6 +23620,88 @@
         }
 
         #endregion
+
+        [WebMethod]
+        //鏍规嵁鐗╂枡鏉$爜 杩斿洖鐗╂枡淇℃伅  瑙勬牸鍨嬪彿  鏁伴噺
+        public bool GetInfoByBarCode(string sBarCode, ref string sMaterName, ref string sMaterNumber, ref long sMaterID, ref string sMaterModel, ref long sUnitID, ref string sUnitName, ref double sQty)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            DataSet Ds = oCn.RunProcReturn("exec h_p_GetInfoByBarCode_AGV '" + sBarCode + "'", "h_p_GetInfoByBarCode_AGV");
+            if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+            {
+                return false;
+            }
+            else
+            {
+                sMaterName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterName"]);
+                sMaterNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterNumber"]);
+                sMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]);
+                sMaterModel = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterModel"]);
+                sUnitID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HUnitID"]);
+                sUnitName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUnitName"]);
+                sQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HQty"]);
+            }
+            return true;
+        }
+
+        [WebMethod]
+        public bool set_SaveKf_AGVRequestBill(Model.ClsKf_AGVRequestBillMain oMain, ref string sErrMsg)
+        {
+            if (SaveKf_AGVRequestBill(oMain, ref sErrMsg))
+            {
+                //"淇濆瓨鎴愬姛锛�";
+                sErrMsg = "淇濆瓨鎴愬姛锛�" + oMain.HBillNo;
+                return true;
+            }
+            else
+            {
+                //"淇濆瓨澶辫触锛�";
+                sErrMsg = sErrMsg;
+                return false;
+            }
+        }
+
+
+
+        /// <summary>
+        /// AGV閰嶉�佸崟
+        /// </summary>
+        /// <param name="oMain"></param>
+        /// <param name="sErrMsg"></param>
+        /// <returns></returns>
+        public bool SaveKf_AGVRequestBill(Model.ClsKf_AGVRequestBillMain oMain, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            try
+            {
+                //鎻掑叆瀛愯〃
+                oCn.RunProc("Insert Into Kf_AGVRequestBillMain   " +
+                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
+                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
+                ",HSPID,HWHID,HSCWHID,HSCSPID,HOWNERID" +
+                ") " +
+                " values('1299','1299'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "',convert(varchar(10),getdate(),120),''" +
+                ",2012,1,'" + oMain.HRemark + "','" + oMain.HMaker + "',convert(varchar(10),getdate(),120)" +
+                ", " + oMain.HSPID.ToString() + "," + oMain.HWHID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HSCSPID.ToString() + "," + oMain.HOrgID.ToString() +
+                ") ");
+                //鎻掑叆涓昏〃
+                oCn.RunProc("Insert Into Kf_AGVRequestBillSub   " +
+                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
+                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
+                 ",HSPID,HWHID,HSCWHID,HSCSPID,HQty,HMaterID,HOWNERID" +
+                ") " +
+                 " values('1299','1299'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "',convert(varchar(10),getdate(),120),''" +
+                ",2012,1,'" + oMain.HRemark + "','" + oMain.HMaker + "',convert(varchar(10),getdate(),120)" +
+                ", " + oMain.HSPID.ToString() + "," + oMain.HWHID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HSCSPID.ToString() + "," + oMain.HQty.ToString() + "," + oMain.HMaterID.ToString() + "," + oMain.HOrgID.ToString() +
+                ") ");
+                return true;
+            }
+            catch (Exception e)
+            {
+                sErrMsg = "AGV閰嶉�佸崟澶辫触锛�" + e.Message;
+                return false;
+            }
+        }
 
         #region 浜у搧閫�搴�    浜у搧鍏ュ簱锛堢孩瀛楋級   *鏃�
 
@@ -29835,6 +29920,38 @@
             }
         }
 
+        //AGV閰嶉�佸崟鍒楄〃鐣岄潰锛岃繑鍥濧GV閰嶉�佸崟淇℃伅
+        [WebMethod]
+        public DataSet GetAGVBillList_New(string sHMaker, Int64 sHOWNERID)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            DataSet Ds = oCn.RunProcReturn("exec h_p_AGVBillList_New '" + sHMaker + "'," + sHOWNERID.ToString(), "h_p_AGVBillList_New");
+            if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+            {
+                return null;
+            }
+            else
+            {
+                return Ds;
+            }
+        }
+
+        //AGV閰嶉�佸崟鍒楄〃鐣岄潰鏌ヨ鎸夐挳  鏍规嵁鍗曞彿杩囨护淇℃伅
+        [WebMethod]
+        public DataSet GetAGVBillList_BillNoQuery(string sBillNo)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            DataSet Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBillQueryList_AGV '" + sBillNo + "'", "h_p_Kf_ICStockBillQueryList_AGV");
+            if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+            {
+                return null;
+            }
+            else
+            {
+                return Ds;
+            }
+        }
+
 
 
         //宸蹭笂浼犲垪琛ㄧ晫闈紝鎾ら攢鍔熻兘锛屽垹闄MS琛ㄥ拰鏈湴鍑哄叆搴撳崟璁板綍锛屽苟鏇存柊TEMP琛ㄤ腑鐨勪笂浼犲瓧娈� HRelationInterID=0
@@ -30446,6 +30563,26 @@
                 else if (oSystemParameter.omodel.WMS_CampanyName == "鍦i緳")
                 {
                     SqlConnection ocn = new SqlConnection(@"Data Source=192.168.1.34;DataBase=master;User ID=HX_USER;PWD=lc@841022;max pool size=32767");//鍦i緳
+                    ocn.Open();
+                    SqlCommand cm = new SqlCommand(sSQL, ocn);
+                    cm.CommandTimeout = 600;
+                    SqlDataReader dr = cm.ExecuteReader();
+                    //byte[] oFile = null;
+                    if (dr.Read())
+                    {
+                        FileItem = (byte[])dr["FFile"];
+                        return true;
+                    }
+                    else
+                    {
+                        FileItem = null;
+                        sSQL = "";
+                        return false;
+                    }
+                }
+                else if (oSystemParameter.omodel.WMS_CampanyName == "妫シ")
+                {
+                    SqlConnection ocn = new SqlConnection(@"Data Source=192.168.10.66;DataBase=master;User ID=HX_USER;PWD=lc@841022;max pool size=32767");//妫シ
                     ocn.Open();
                     SqlCommand cm = new SqlCommand(sSQL, ocn);
                     cm.CommandTimeout = 600;
@@ -34114,6 +34251,49 @@
                     }
                     return oBar;
                 }
+                //鍏朵粬鍏ュ簱  妫シ涓撶敤
+                else if (HBillType == "1203" && oSystemParameter.omodel.WMS_CampanyName == "妫シ") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                {
+                    //鏍规嵁鍗曚釜鏉$爜鑾峰彇瀵瑰簲鏁存墭鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃
+                    string sBarCode_New;
+                    DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode '" + sBarCode + "'", "h_p_WMS_BeforeCheckToBarCode");
+                    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++)
+                            {
+                                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;
+                    }
+                }
                 //鐢熶骇鍏ュ簱  澶氭簮鍗曟ā寮�
                 else if (HBillType == "1202" && oSystemParameter.omodel.Kf_ProductInBill_MulSourceBill == "Y")
                 {
@@ -35694,6 +35874,1276 @@
         #endregion
 
 
+        #region 鐗╂枡鏉$爜璋冪敤鏂规硶
+
+        #region 涓�閿壂鐮�
+
+        //涓�閿壂鐮佹ā寮忥紝鏍规嵁鏉$爜鍓嶇紑璧� 涓嶅悓鏂规硶锛堜粨搴撱�佷粨浣嶃�侀儴闂級锛堟簮鍗曘�佺墿鏂欐潯鐮侊級
+        [WebMethod]
+        public Model.ClsKf_ICStockBill_WMS get_CheckTypeByBarCode_New(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 sErrMsg)
+        {
+            try
+            {
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
+                DAL.ClsKF_PonderationBillMain_Temp_Ctl tem = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
+                Model.ClsKF_PonderationBillMain_Temp model = new Model.ClsKF_PonderationBillMain_Temp();
+                string sHSourceBillType = "";
+                string sHSourceBillNo = "";
+                Int64 sHSupID = 0;
+                string sHSupName = "";
+                Int64 sHDeptID = 0;
+                string sHDeptName = "";
+                string sHBarType = "";
+                sBarCode = sBarCode.Trim();
+                string sBarCodePrefix = sBarCode.Substring(0, Math.Min(3, sBarCode.Length));//鎴彇鏉$爜鍓嶄笁浣嶅瓧绗︿覆
+
+                //鑾峰彇绯荤粺鍙傛暟
+                Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+                if (oSystemParameter.ShowBill(ref sErrMsg) == false)
+                {
+                    sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                    return null;
+                }
+                //閿�鍞嚭搴撱�侀攢鍞��搴撴ā鍧楁壂鐮佹祦绋�   椋為緳涓撶敤
+                if ((HBillType == "1205" || HBillType == "1247") && oSystemParameter.omodel.WMS_CampanyName == "椋為緳") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                {
+                    //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ュ嚭鍏ュ簱鏉$爜涓存椂琛�
+                    if (set_SavePonderationBillMain_Temp_FeiLong(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 sHBarType, ref sErrMsg))
+                    {
+                        oBar.HBarType = sHBarType;
+                        oBar.HSourceBillType = sHSourceBillType;
+                        oBar.HSourceBillNo = sHSourceBillNo;
+                        oBar.HSupID = sHSupID;
+                        oBar.HSupName = sHSupName;
+                        oBar.HDeptID = sHDeptID;
+                        oBar.HDeptName = sHDeptName;
+                    }
+                    else
+                    {
+                        sErrMsg = "锛�" + sErrMsg;
+                        return null;
+                    }
+                    return oBar;
+                }
+                //鍏朵粬鍏ュ簱  妫シ涓撶敤
+                else if (HBillType == "1203" && oSystemParameter.omodel.WMS_CampanyName == "妫シ") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                {
+                    //鏍规嵁鍗曚釜鏉$爜鑾峰彇瀵瑰簲鏁存墭鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃
+                    string sBarCode_New;
+                    DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode '" + sBarCode + "'", "h_p_WMS_BeforeCheckToBarCode");
+                    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++)
+                            {
+                                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;
+                    }
+                }
+                //閿�鍞嚭搴�  妫シ涓撶敤
+                else if (HBillType == "1205" && oSystemParameter.omodel.WMS_CampanyName == "妫シ") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                {
+                    //鏍规嵁鍗曚釜鏉$爜鑾峰彇瀵瑰簲鏁存墭鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃
+                    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)
+                    {
+                        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 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;
+                    }
+                }
+                //鐢熶骇鍏ュ簱  澶氭簮鍗曟ā寮�
+                else if (HBillType == "1202" && oSystemParameter.omodel.Kf_ProductInBill_MulSourceBill == "Y")
+                {
+                    oBar = get_CheckTypeByBarCode_MulSourceBill(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, oSystemParameter.omodel, ref sErrMsg);
+                    if (oBar == null)
+                    {
+                        return null;
+                    }
+                    else
+                    {
+                        return oBar;
+                    }
+                }
+                else
+                {
+                    //鍒ゆ柇鏄惁鍚敤涓�閿壂鐮佹ā寮忥紝Y涓哄惎鐢紝鏈惎鐢ㄦ椂鍙壂鎻忕墿鏂欐潯鐮�
+                    if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N")
+                    {
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鍗氭棩绉戞妧" || oSystemParameter.omodel.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameter.omodel.WMS_CampanyName == "鏉窞鏂帿灏�" || oSystemParameter.omodel.WMS_CampanyName == "濂ラ偊") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                        {
+                            DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View();
+                            if (dal.GetInfoByNumber_View(sBarCode))
+                            {
+                                //濡傛灉鏄墭鐩樻潯鐮佸垎瑙e苟妯℃嫙鎵爜
+                                if (dal.omodel_View.HBarCodeType == "鎵樼洏鏉$爜")
+                                {
+                                    //鍒嗚В鎵樻潯鐮佸緱鍒版槑缁嗘潯鐮佷俊鎭啓鍏ュ嚭鍏ュ簱鏉$爜涓存椂琛�
+                                    DataSet dsTBarCode;
+                                    string sBarCode_MX;
+                                    dsTBarCode = oCn.RunProcReturn("select HBarCode HBarCodeMX from Sc_PackUnionBillSub_Sum " +
+                                    " Where HBarCode_Pack = '" + sBarCode + "'", "Sc_PackUnionBillSub_Sum");
+                                    if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
+                                    {
+                                        sErrMsg = "娌℃湁鎵惧埌鎵樼洏鏉$爜瀵瑰簲瀛愭潯鐮佽褰曪紒";
+                                        return null;
+                                    }
+                                    else
+                                    {
+                                        for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
+                                        {
+                                            sBarCode_MX = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeMX"]);
+                                            if (set_SavePonderationBillMain_Temp_BarCode(sBarCode_MX, 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_MX + sErrMsg;
+                                                //sErrMsg = "鎵弿澶辫触锛�" + sErrMsg;
+                                                return null;
+                                            }
+                                        }
+                                        return oBar;
+                                    }
+                                }
+                                else
+                                {
+                                    //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ュ嚭鍏ュ簱鏉$爜涓存椂琛�
+                                    if (set_SavePonderationBillMain_Temp_BarCode(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))
+                                    {
+                                        oBar.HSourceBillType = sHSourceBillType;
+                                        oBar.HSourceBillNo = sHSourceBillNo;
+                                        oBar.HSupID = sHSupID;
+                                        oBar.HSupName = sHSupName;
+                                        oBar.HDeptID = sHDeptID;
+                                        oBar.HDeptName = sHDeptName;
+                                    }
+                                    else
+                                    {
+                                        sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忓け璐ワ紒" + sErrMsg;
+                                        return null;
+                                    }
+                                    return oBar;
+                                }
+                            }
+                            else
+                            {
+                                sErrMsg = "娌℃湁鎵惧埌璇ユ潯鐮侊紒";
+                                return null;
+                            }
+                        }
+                        else
+                        {
+                            if (sBarCodePrefix == "PAK")
+                            {
+                                //灏嗘ā娌诲叿淇℃伅鍐欏叆妯℃不鍏峰嚭鍏ュ簱涓存椂琛�
+                                DataSet Mould = oCn.RunProcReturn("exec h_p_WMS_AddMouldBarCode '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HRedBlueFlag + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddMouldBarCode");
+                                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 (set_SavePonderationBillMain_Temp_BarCode(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))
+                                {
+                                    oBar.HSourceBillType = sHSourceBillType;
+                                    oBar.HSourceBillNo = sHSourceBillNo;
+                                    oBar.HSupID = sHSupID;
+                                    oBar.HSupName = sHSupName;
+                                    oBar.HDeptID = sHDeptID;
+                                    oBar.HDeptName = sHDeptName;
+                                }
+                                else
+                                {
+                                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忓け璐ワ紒" + sErrMsg;
+                                    return null;
+                                }
+                                return oBar;
+                            }
+                        }
+                    }
+                    //涓�閿壂鐮佹ā寮忥紝鏍规嵁鏉$爜鍓嶇紑璧� 涓嶅悓鏂规硶锛堜粨搴撱�佷粨浣嶃�侀儴闂級锛堟簮鍗曘�佺墿鏂欐潯鐮侊級
+                    else
+                    {
+                        string sRedBlue = "钃濆瓧";
+                        if (HRedBlueFlag)
+                        {
+                            sRedBlue = "绾㈠瓧";
+                        }
+                        else
+                        {
+                            sRedBlue = "钃濆瓧";
+                        }
+                        DataSet Dss;
+                        //鏍规嵁閫掑叆鐨勬潯鐮佸墠涓変綅锛屽垽鏂潯鐮佺被鍨嬶紙浠撳簱銆佷粨浣嶃�侀儴闂ㄣ�佹簮鍗曘�佺墿鏂欐潯鐮侊級
+                        Dss = oCn.RunProcReturn(" select HSourceName,BarCodeType from Xt_BarCodeType where HSourceNumber= '" + sBarCodePrefix + "'", "Xt_BarCodeType");
+
+                        //鏃犺繑鍥炴暟鎹垯涓虹墿鏂欐潯鐮�
+                        if (Dss == null || Dss.Tables[0].Rows.Count == 0)
+                        {
+                            if (oSystemParameter.omodel.WMS_CampanyName == "鍗氭棩绉戞妧" || oSystemParameter.omodel.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameter.omodel.WMS_CampanyName == "鏉窞鏂帿灏�" || oSystemParameter.omodel.WMS_CampanyName == "濂ラ偊") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                            {
+                                DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View();
+                                if (dal.GetInfoByNumber_View(sBarCode))
+                                {
+                                    //濡傛灉鏄墭鐩樻潯鐮佸垎瑙e苟妯℃嫙鎵爜
+                                    if (dal.omodel_View.HBarCodeType == "鎵樼洏鏉$爜")
+                                    {
+                                        //鍒嗚В鎵樻潯鐮佸緱鍒版槑缁嗘潯鐮佷俊鎭啓鍏ュ嚭鍏ュ簱鏉$爜涓存椂琛�
+                                        DataSet dsTBarCode;
+                                        string sBarCode_MX;
+                                        dsTBarCode = oCn.RunProcReturn("select HBarCode HBarCodeMX from Sc_PackUnionBillSub_Sum " +
+                                        " Where HBarCode_Pack = '" + sBarCode + "'", "Sc_PackUnionBillSub_Sum");
+                                        if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
+                                        {
+                                            sErrMsg = "娌℃湁鎵惧埌鎵樼洏鏉$爜瀵瑰簲瀛愭潯鐮佽褰曪紒";
+                                            return null;
+                                        }
+                                        else
+                                        {
+                                            for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
+                                            {
+                                                sBarCode_MX = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeMX"]);
+                                                if (set_SavePonderationBillMain_Temp_BarCode(sBarCode_MX, 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_MX + sErrMsg;
+                                                    //sErrMsg = "鎵弿澶辫触锛�" + sErrMsg;
+                                                    return null;
+                                                }
+                                            }
+                                            return oBar;
+                                        }
+                                    }
+                                    else
+                                    {
+                                        //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ュ嚭鍏ュ簱鏉$爜涓存椂琛�
+                                        if (set_SavePonderationBillMain_Temp_BarCode(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))
+                                        {
+                                            oBar.HSourceBillType = sHSourceBillType;
+                                            oBar.HSourceBillNo = sHSourceBillNo;
+                                            oBar.HSupID = sHSupID;
+                                            oBar.HSupName = sHSupName;
+                                            oBar.HDeptID = sHDeptID;
+                                            oBar.HDeptName = sHDeptName;
+                                        }
+                                        else
+                                        {
+                                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忓け璐ワ紒" + sErrMsg;
+                                            return null;
+                                        }
+                                        return oBar;
+                                    }
+                                }
+                                else
+                                {
+                                    sErrMsg = "娌℃湁鎵惧埌璇ユ潯鐮侊紒";
+                                    return null;
+                                }
+                            }
+                            else
+                            {
+                                if (sBarCodePrefix == "PAK")
+                                {
+                                    //灏嗘ā娌诲叿淇℃伅鍐欏叆妯℃不鍏峰嚭鍏ュ簱涓存椂琛�
+                                    DataSet Mould = oCn.RunProcReturn("exec h_p_WMS_AddMouldBarCode '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HRedBlueFlag + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddMouldBarCode");
+                                    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 (set_SavePonderationBillMain_Temp_BarCode(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))
+                                    {
+                                        oBar.HSourceBillType = sHSourceBillType;
+                                        oBar.HSourceBillNo = sHSourceBillNo;
+                                        oBar.HSupID = sHSupID;
+                                        oBar.HSupName = sHSupName;
+                                        oBar.HDeptID = sHDeptID;
+                                        oBar.HDeptName = sHDeptName;
+                                    }
+                                    else
+                                    {
+                                        sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忓け璐ワ紒" + sErrMsg;
+                                        return null;
+                                    }
+                                    return oBar;
+                                }
+                            }
+                        }
+                        else
+                        {
+                            string sBarBillName = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HSourceName"]);
+                            string sBarBillType = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["BarCodeType"]);
+
+                            //鍒ゆ柇鏉$爜绫诲瀷涓� 鍩虹璧勬枡鏉$爜 鎴� 婧愬崟鏉$爜
+                            if (sBarBillType == "鍩虹璧勬枡鏉$爜")
+                            {
+                                //浠撳簱鏉$爜
+                                if (sBarBillName == "浠撳簱")
+                                {
+                                    DAL.ClsIF_Warehouse_View dal = new DAL.ClsIF_Warehouse_View();
+                                    //灏嗛�掑叆鐨勬潯鐮佸幓鎺夊墠涓変綅鍚庤浆鍖栨垚鏁村舰,TryParse涓嶈兘杞崲鎴愭暣鏁版椂杩斿洖false锛屽苟杩斿洖ID=0
+                                    int ID;
+                                    if (int.TryParse(sBarCode.Remove(0, 3), out ID))
+                                    {
+                                        if (dal.GetInfoByID(ID, HOWNERID))
+                                        {
+                                            oBar.HBarType = "浠撳簱鏉$爜";
+                                            oBar.HWhID = dal.omodel.HItemID;
+                                            oBar.HWhNumber = dal.omodel.HNumber;
+                                            oBar.HWhName = dal.omodel.HName;
+                                            oBar.HSPFlag = dal.omodel.HIsStockMgr;
+                                            return oBar;
+                                        }
+                                        else
+                                        {
+                                            sErrMsg = "鏃犳晥浠撳簱鏉$爜锛�";
+                                            return null;
+                                        }
+                                    }
+                                    else
+                                    {
+                                        sErrMsg = "閿欒鐨勪粨搴撴潯鐮侊紒";
+                                        return null;
+                                    }
+                                }
+                                //浠撲綅鏉$爜
+                                else if (sBarBillName == "浠撲綅")
+                                {
+                                    DAL.ClsIF_StockPlace_View dal = new DAL.ClsIF_StockPlace_View();
+                                    //灏嗛�掑叆鐨勬潯鐮佸幓鎺夊墠涓変綅鍚庤浆鍖栨垚鏁村舰
+                                    int sHSPID;
+                                    int sHWHID;
+                                    string[] sArray = sBarCode.Remove(0, 3).Split(';');
+                                    if (int.TryParse(sArray[1], out sHSPID) && int.TryParse(sArray[0], out sHWHID))
+                                    {
+                                        if (dal.GetInfoByID(sHSPID, sHWHID, HOWNERID))
+                                        {
+                                            oBar.HBarType = "浠撲綅鏉$爜";
+                                            oBar.HSPID = dal.omodel.HItemID;
+                                            oBar.HSPNumber = dal.omodel.HNumber;
+                                            oBar.HSPName = dal.omodel.HName;
+                                            oBar.HWhID = dal.omodel.HWHID;
+                                            oBar.HWhNumber = dal.omodel.HWhNumber;
+                                            oBar.HWhName = dal.omodel.HWhName;
+                                            return oBar;
+                                        }
+                                        else
+                                        {
+                                            sErrMsg = "鏃犳晥浠撲綅鏉$爜锛�";
+                                            return null;
+                                        }
+                                    }
+                                    else
+                                    {
+                                        sErrMsg = "閿欒鐨勪粨浣嶆潯鐮侊紒";
+                                        return null;
+                                    }
+                                }
+                                //閮ㄩ棬鏉$爜
+                                else if (sBarBillName == "閮ㄩ棬")
+                                {
+                                    DAL.ClsIF_Department_View dal = new DAL.ClsIF_Department_View();
+                                    //灏嗛�掑叆鐨勬潯鐮佸幓鎺夊墠涓変綅鍚庤浆鍖栨垚鏁村舰
+                                    int ID;
+                                    if (int.TryParse(sBarCode.Remove(0, 3), out ID))
+                                    {
+                                        if (dal.GetInfoByID(ID))
+                                        {
+                                            oBar.HBarType = "閮ㄩ棬鏉$爜";
+                                            oBar.HDeptID = dal.omodel.HItemID;
+                                            oBar.HDeptNumber = dal.omodel.HNumber;
+                                            oBar.HDeptName = dal.omodel.HName;
+                                            return oBar;
+                                        }
+                                        else
+                                        {
+                                            sErrMsg = "鏃犳晥閮ㄩ棬鏉$爜锛�";
+                                            return null;
+                                        }
+                                    }
+                                    else
+                                    {
+                                        sErrMsg = "閿欒鐨勯儴闂ㄦ潯鐮侊紒";
+                                        return null;
+                                    }
+                                }
+                                else
+                                {
+                                    sErrMsg = "鏃犳晥鍩虹璧勬枡鏉$爜锛�";
+                                    return null;
+                                }
+                            }
+                            //婧愬崟鏉$爜
+                            else if (sBarBillType == "婧愬崟鏉$爜")
+                            {
+                                //褰撹鍗曟嵁绫诲瀷鐨勭郴缁熷弬鏁帮細澶氭簮鍗曟ā寮�   鏃讹紝涓嶅厑璁告壂鎻忓師鍗�
+
+
+                                //=======================
+                                DataSet Ds = oCn.RunProcReturn(" select HSourceName from Xt_BarCodeType where HSourceNumber= '" + sBarCodePrefix + "' and HBillType= '" + HBillType + "'", "Xt_BarCodeType");
+
+                                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+                                {
+                                    sErrMsg = "鎵�鎵簮鍗曟潯鐮佷笉灞炰簬姝ゆā鍧楁簮鍗曡寖鍥达紒";
+                                    return null;
+                                }
+                                else
+                                {
+                                    sBarBillName = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceName"]);
+                                    //鎵弿婧愬崟鏉$爜鏃跺垽鏂槸鍚﹀凡缁忔壂鎻忚繃婧愬崟淇℃伅
+                                    if (SourceFlag)
+                                    {
+                                        sErrMsg = "鏄庣粏淇℃伅鍒楄〃宸叉湁鎵爜璁板綍锛屼笉鍏佽澶氭鎵弿婧愬崟鏉$爜锛�";
+                                        return null;
+                                    }
+                                    else
+                                    {
+                                        //浜у搧鍏ュ簱鍗� 婧愬崟锛氱敓浜т换鍔″崟
+                                        if (sBarBillName == "鐢熶骇浠诲姟鍗�" && HBillType == "1202")
+                                        {
+                                            DAL.Cls_S_IF_ICMOBill_Lite dal = new DAL.Cls_S_IF_ICMOBill_Lite();
+                                            DataSet DS;
+                                            //鏍规嵁鍗曟嵁鍙疯幏鍙栬繃婊ゆ潯浠�
+                                            string sWhere = " Where 鍗曟嵁鍙� like '" + sBarCode + "'";
+                                            DS = dal.DisSourceBillList(sWhere);
+                                            if (DS == null || DS.Tables[0].Rows.Count <= 0)
+                                            {
+                                                sErrMsg = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+                                                return null;
+                                            }
+                                            oBar.HBarType = "婧愬崟鏉$爜";
+                                            oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
+                                            oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
+                                            oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
+                                            oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
+                                            oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
+                                            oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
+                                        }
+                                        //浜у搧鍏ュ簱鍗� 婧愬崟锛氱敓浜ф眹鎶ュ崟
+                                        else if (sBarBillName == "鐢熶骇姹囨姤鍗�" && HBillType == "1202")
+                                        {
+                                            DAL.Cls_S_IF_ICMOReportBill_Lite dal = new DAL.Cls_S_IF_ICMOReportBill_Lite();
+                                            DataSet DS;
+                                            //鏍规嵁鍗曟嵁鍙疯幏鍙栬繃婊ゆ潯浠�
+                                            string sWhere = " Where 鍗曟嵁鍙� like '" + sBarCode + "'";
+                                            DS = dal.DisSourceBillList(sWhere);
+                                            if (DS == null || DS.Tables[0].Rows.Count <= 0)
+                                            {
+                                                sErrMsg = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+                                                return null;
+                                            }
+                                            oBar.HBarType = "婧愬崟鏉$爜";
+                                            oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
+                                            oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
+                                            oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
+                                            oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
+                                            oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
+                                            oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
+                                        }
+                                        //澶栬喘鍏ュ簱鍗� 婧愬崟锛氶噰璐鍗�
+                                        else if (sBarBillName == "閲囪喘璁㈠崟" && HBillType == "1201")
+                                        {
+                                            DAL.Cls_S_IF_POOrderBill_Lite dal = new DAL.Cls_S_IF_POOrderBill_Lite();
+                                            DataSet DS;
+                                            //鏍规嵁鍗曟嵁鍙疯幏鍙栬繃婊ゆ潯浠�
+                                            string sWhere = " Where 鍗曟嵁鍙� like '" + sBarCode + "'";
+                                            DS = dal.DisSourceBillList(sWhere);
+                                            if (DS == null || DS.Tables[0].Rows.Count <= 0)
+                                            {
+                                                sErrMsg = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+                                                return null;
+                                            }
+                                            oBar.HBarType = "婧愬崟鏉$爜";
+                                            oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
+                                            oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
+                                            oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
+                                            oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
+                                            oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
+                                            oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
+                                        }
+                                        //澶栬喘鍏ュ簱鍗� 婧愬崟锛氭敹鏂欓�氱煡鍗�
+                                        else if (sBarBillName == "鏀舵枡閫氱煡鍗�" && HBillType == "1201")
+                                        {
+                                            DAL.Cls_S_IF_POInStockBill_Lite dal = new DAL.Cls_S_IF_POInStockBill_Lite();
+                                            DataSet DS;
+                                            //鏍规嵁鍗曟嵁鍙疯幏鍙栬繃婊ゆ潯浠�
+                                            string sWhere = " Where 鍗曟嵁鍙� like '" + sBarCode + "' and isnull(HBillSubType,0)=12510 ";
+                                            DS = dal.DisSourceBillList(sWhere);
+                                            if (DS == null || DS.Tables[0].Rows.Count <= 0)
+                                            {
+                                                sErrMsg = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+                                                return null;
+                                            }
+                                            oBar.HBarType = "婧愬崟鏉$爜";
+                                            oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
+                                            oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
+                                            oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
+                                            oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
+                                            oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
+                                            oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
+                                        }
+                                        //濮斿鍏ュ簱鍗� 婧愬崟锛氬澶栬鍗�
+                                        else if (sBarBillName == "濮斿璁㈠崟" && HBillType == "1210")
+                                        {
+                                            DAL.Cls_S_IF_WWOrderBill_Lite dal = new DAL.Cls_S_IF_WWOrderBill_Lite();
+                                            DataSet DS;
+                                            //鏍规嵁鍗曟嵁鍙疯幏鍙栬繃婊ゆ潯浠�
+                                            string sWhere = " Where 鍗曟嵁鍙� like '" + sBarCode + "'";
+                                            DS = dal.DisSourceBillList(sWhere);
+                                            if (DS == null || DS.Tables[0].Rows.Count <= 0)
+                                            {
+                                                sErrMsg = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+                                                return null;
+                                            }
+                                            oBar.HBarType = "婧愬崟鏉$爜";
+                                            oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
+                                            oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
+                                            oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
+                                            oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
+                                            oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
+                                            oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
+                                        }
+                                        //濮斿鍏ュ簱鍗� 婧愬崟锛氭敹鏂欓�氱煡鍗�-濮斿
+                                        else if (sBarBillName == "鏀舵枡閫氱煡鍗�-濮斿" && HBillType == "1210")
+                                        {
+                                            DAL.Cls_S_IF_POStockInBill_Lite dal = new DAL.Cls_S_IF_POStockInBill_Lite();
+                                            DataSet DS;
+                                            //鏍规嵁鍗曟嵁鍙疯幏鍙栬繃婊ゆ潯浠�
+                                            string sWhere = " Where 鍗曟嵁鍙� like '" + sBarCode + "' and isnull(HBillSubType,0)=12511 ";
+                                            DS = dal.DisSourceBillList(sWhere);
+                                            if (DS == null || DS.Tables[0].Rows.Count <= 0)
+                                            {
+                                                sErrMsg = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+                                                return null;
+                                            }
+                                            oBar.HBarType = "婧愬崟鏉$爜";
+                                            oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
+                                            oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
+                                            oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
+                                            oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
+                                            oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
+                                            oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
+                                        }
+                                        //棰嗘枡鍑哄簱 婧愬崟锛氱敓浜т换鍔″崟-鎶曟枡
+                                        else if (sBarBillName == "鐢熶骇浠诲姟鍗�-鎶曟枡" && HBillType == "1204")
+                                        {
+                                            DAL.Cls_S_IF_PPBomBillList_Lite dal = new DAL.Cls_S_IF_PPBomBillList_Lite();
+                                            DataSet DS;
+                                            //鏍规嵁鍗曟嵁鍙疯幏鍙栬繃婊ゆ潯浠�
+                                            string sWhere = " Where 鍗曟嵁鍙� like '" + sBarCode + "'";
+                                            DS = dal.DisSourceBillList(sWhere);
+                                            if (DS == null || DS.Tables[0].Rows.Count <= 0)
+                                            {
+                                                sErrMsg = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+                                                return null;
+                                            }
+                                            oBar.HBarType = "婧愬崟鏉$爜";
+                                            oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
+                                            oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
+                                            oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
+                                            oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
+                                            oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
+                                            oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
+                                        }
+                                        //閿�鍞嚭搴� 婧愬崟锛氶攢鍞鍗�
+                                        else if (sBarBillName == "閿�鍞鍗�" && HBillType == "1205")
+                                        {
+                                            DAL.Cls_S_IF_SEOrderBill_Lite dal = new DAL.Cls_S_IF_SEOrderBill_Lite();
+                                            DataSet DS;
+                                            //鏍规嵁鍗曟嵁鍙疯幏鍙栬繃婊ゆ潯浠�
+                                            string sWhere = " Where 鍗曟嵁鍙� like '" + sBarCode + "'";
+                                            DS = dal.DisSourceBillList(sWhere);
+                                            if (DS == null || DS.Tables[0].Rows.Count <= 0)
+                                            {
+                                                sErrMsg = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+                                                return null;
+                                            }
+                                            oBar.HBarType = "婧愬崟鏉$爜";
+                                            oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
+                                            oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
+                                            oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
+                                            oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
+                                            oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
+                                            oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
+                                            oBar.HCustom = Convert.ToString(DS.Tables[0].Rows[0]["HCustom"]);
+                                        }
+                                        //閿�鍞嚭搴� 婧愬崟锛氬彂璐ч�氱煡鍗�
+                                        else if (sBarBillName == "鍙戣揣閫氱煡鍗�" && HBillType == "1205")
+                                        {
+                                            DAL.Cls_S_IF_SeOutStockBill_Lite dal = new DAL.Cls_S_IF_SeOutStockBill_Lite();
+                                            DataSet DS;
+                                            //鏍规嵁鍗曟嵁鍙疯幏鍙栬繃婊ゆ潯浠�
+                                            string sWhere = " Where 鍗曟嵁鍙� like '" + sBarCode + "'";
+                                            DS = dal.DisSourceBillList(sWhere);
+                                            if (DS == null || DS.Tables[0].Rows.Count <= 0)
+                                            {
+                                                sErrMsg = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+                                                return null;
+                                            }
+                                            oBar.HBarType = "婧愬崟鏉$爜";
+                                            oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
+                                            oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
+                                            oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
+                                            oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
+                                            oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
+                                            oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
+                                            oBar.HCustom = Convert.ToString(DS.Tables[0].Rows[0]["HCustom"]);
+                                        }
+                                        //濮斿鍑哄簱鍗� 婧愬崟锛氬澶栬鍗�-鎶曟枡
+                                        else if (sBarBillName == "濮斿璁㈠崟-鎶曟枡" && HBillType == "1211")
+                                        {
+                                            DAL.Cls_S_IF_WWPPBomBill_Lite dal = new DAL.Cls_S_IF_WWPPBomBill_Lite();
+                                            DataSet DS;
+                                            //鏍规嵁鍗曟嵁鍙疯幏鍙栬繃婊ゆ潯浠�
+                                            string sWhere = " Where 鍗曟嵁鍙� like '" + sBarCode + "'";
+                                            DS = dal.DisSourceBillList(sWhere);
+                                            if (DS == null || DS.Tables[0].Rows.Count <= 0)
+                                            {
+                                                sErrMsg = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+                                                return null;
+                                            }
+                                            oBar.HBarType = "婧愬崟鏉$爜";
+                                            oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
+                                            oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
+                                            oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
+                                            oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
+                                            oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
+                                            oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
+                                        }
+                                        else
+                                        {
+                                            sErrMsg = "婧愬崟绫诲瀷鍚嶇О璁剧疆涓嶆纭紒";
+                                            return null;
+                                        }
+                                        // 灏嗘簮鍗曚俊鎭啓鍏� 涓存椂缂撳瓨琛�
+                                        if (tem.AddNew_Source(HBillID, HBillNo, HBillType, oBar.HSourceBillNo, oBar.HSourceBillType, sRedBlue, ref sErrMsg))
+                                        {
+                                            return oBar;
+                                        }
+                                        else
+                                        {
+                                            sErrMsg = "淇濆瓨婧愬崟淇℃伅澶辫触锛�" + sErrMsg;
+                                            return null;
+                                        }
+                                    }
+                                }
+                            }
+                            else
+                            {
+                                sErrMsg = "鏃犳晥鏉$爜绫诲瀷锛�";
+                                return null;
+                            }
+                        }
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                sErrMsg = e.Message + ";" + e.StackTrace;
+                return null;
+            }
+
+        }
+
+        #endregion
+
+
+        #region 鎵弿鐗╂枡鏉$爜      璋冩嫧
+
+        [WebMethod]
+        public Model.ClsKf_ICStockBill_WMS get_BarCode_MoveStock(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Int64 HSCWHID, Int64 HSCSPID, Double HQty, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HStockInOrgID, Int64 HStockOutOrgID, string HScanStyle, ref string sErrMsg)
+        {
+            try
+            {
+                //鑾峰彇绯荤粺鍙傛暟
+                Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+                if (oSystemParameter.ShowBill(ref sErrMsg) == false)
+                {
+                    sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                    return null;
+                }
+
+                sBarCode = sBarCode.Trim();
+                if (sBarCode == "")
+                {
+                    sErrMsg = "鏉$爜涓嶈兘涓虹┖锛岃鎵弿鏉$爜锛�";
+                    return null;
+                }
+                else
+                {
+                    //鍒ゆ柇鏉$爜鏄惁鍚壒娈婄鍙� # 锛屽鏋滃惈鏈夊垯 鎷嗗垎
+                    string[] NewBarCode;
+                    if (sBarCode.CompareTo("#") > 0)
+                    {
+                        NewBarCode = sBarCode.Split(Convert.ToChar("#"));
+                        sBarCode = NewBarCode[0];
+                    }
+                }
+
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
+                DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View();
+                string sBarCodePrefix = sBarCode.Substring(0, Math.Min(3, sBarCode.Length));//鎴彇鏉$爜鍓嶄笁浣嶅瓧绗︿覆
+
+                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(dal.omodel_View.HBarCodeType == "")
+                                {
+                                    //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                                    if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock(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
+                                {
+                                    DataSet dsTBarCode = oCn.RunProcReturn("select HBarCode,HBarCodeType,HMaterID,HAuxPropID,HBatchNo,HQty,HMTONo from Gy_BarCodeBill with(nolock) where HStopflag=0 and HOutStockCounts=0 and HBarCode_Pack= '" + dal.omodel_View.HBarCode_Pack + "'", "Gy_BarCodeBill");
+                                    if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
+                                    {
+                                        sErrMsg = "鑾峰彇鏁存墭鏉$爜淇℃伅鍙戠敓閿欒锛�";
+                                        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.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, 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, 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, oSystemParameter.omodel, ref sErrMsg))
+                                    {
+                                        sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
+                                        return null;
+                                    }
+                                    return oBar;
+                                }
+                            }
+                        }
+                    }
+                    else
+                    {
+                        sErrMsg = "鏉$爜妗f涓笉瀛樺湪璇ユ潯鐮侊紝璇风‘璁ゆ潯鐮佹槸鍚︽纭垨鏄惁宸茶鍒犻櫎锛�";
+                        return null;
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                sErrMsg = e.Message + ";" + e.StackTrace;
+                return null;
+            }
+        }
+
+        //鎵弿鐗╂枡鏉$爜  瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃      璋冩嫧
+        [WebMethod]
+        public bool set_SavePonderationBillMain_Temp_BarCode_MoveStock(Model.ClsGy_BarCodeBill_WMS_Model_View omodel_View, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Int64 HSCWHID, Int64 HSCSPID, Double HQty, bool SourceFlag, string HSourceBillType, Int64 HStockInOrgID, Int64 HStockOutOrgID, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, 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 oMain = new Model.ClsKF_PonderationBillMain_Temp();
+
+            //鍒ゆ柇璋冨叆浠撳簱銆佷粨浣嶆槸鍚︽湁鏁�
+            if (HWhID == 0)
+            {
+                sErrMsg = "璋冨叆浠撳簱娌℃湁閫夋嫨锛�";
+                return false;
+            }
+            else
+            {
+                //鏍规嵁浠撳簱ID锛屽垽鏂槸鍚﹀惎鐢ㄤ粨浣�
+                DataSet dsWh = oCn.RunProcReturn(" select HSPFlag from Gy_Warehouse with(nolock) where HItemID= " + HWhID.ToString() + " and HUSEORGID= " + HStockInOrgID.ToString(), "Gy_Warehouse");
+                if (dsWh == null || dsWh.Tables[0].Rows.Count == 0)
+                {
+                    sErrMsg = "鎵�閫夎皟鍏ヤ粨搴撲笉灞炰簬璇ヨ皟鍏ョ粍缁囷紒";
+                    return false;
+                }
+                else if (HSPID == 0 && DBUtility.ClsPub.isBool(dsWh.Tables[0].Rows[0]["HSPFlag"]) == true)
+                {
+                    sErrMsg = "璋冨叆浠撲綅娌℃湁閫夋嫨锛�";
+                    return false;
+                }
+            }
+
+            //1銆侀娆℃壂鐮侀槻涓插崟鍒ゆ柇锛� 2銆佹簮鍗曠被鍨嬫槸鍚﹀湪婧愬崟鍒楄〃閲屽垽鏂紱3銆佸敮涓�鏉$爜鏄惁瀛樺湪鐩稿悓鏉$爜鍒ゆ柇锛� 4銆佹湁婧愬崟锛岀墿鏂欐槸鍚﹀湪婧愬崟涓垽鏂�
+            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_MoveStock '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillType + "'," + DBUtility.ClsPub.BoolToString(SourceFlag), "h_p_WMS_AddBarCode_MoveStock");
+            if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
+            {
+                sErrMsg = "鍒ゆ柇鎵�鎵潯鐮佹槸鍚﹀湪鍗曟嵁涓彂鐢熼敊璇紒";
+                return false;
+            }
+            else
+            {
+                if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
+                {
+                    omodel_View.HMaterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HMaterID"]);
+                    omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]);
+                    omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceEntryID"]);
+                    omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceInterID"]);
+                    omodel_View.HSourceQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[0]["HQtyMust"]);     //婧愬崟鍙壂鏁伴噺
+                }
+                else
+                {
+                    sErrMsg = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
+                    return false;
+                }
+            }
+
+            double sRelQty = 0;
+            //鑾峰彇鎵爜鏁伴噺
+            if (omodel_View.HBarCodeType == "鍞竴鏉$爜")
+            {
+                if (HQty > 0 && omodel_View.HQty > HQty)
+                {
+                    sRelQty = HQty;
+                }
+                else
+                {
+                    sRelQty = omodel_View.HQty;
+                }
+
+                //鐩存帴璋冩嫧 鏈夋簮鍗曟壂鐮侊紝鏍规嵁绯荤粺鍙傛暟锛氱洿鎺ヨ皟鎷�-搴旀敹鏁伴噺 鎺у埗鎵爜鏁伴噺鑳藉惁鍙秴鍗曟嵁鏁伴噺锛堝皬浜庣瓑浜庡簲鏀躲�佸畬鍏ㄧ瓑浜庡簲鏀躲�佷笉鎺у埗锛�
+                if (HBillType == "1207" && omodel_View.HSourceInterID != 0
+                    && (oSystemParameterMain.Kf_MoveStockBill_MustQtyCtl == "灏忎簬绛変簬搴旀敹" || oSystemParameterMain.Kf_MoveStockBill_MustQtyCtl == "瀹屽叏绛変簬搴旀敹"))
+                {
+                    if (omodel_View.HSourceQty == 0)
+                    {
+                        sErrMsg = "鎵�鎵墿鏂欏湪鍗曟嵁涓墿浣欏彲鎵暟閲忎负0锛屼笉鍏佽鎵爜锛�";
+                        return false;
+                    }
+                    else if (sRelQty > omodel_View.HSourceQty)
+                    {
+                        sErrMsg = "鎵�鎵弿鏉$爜鏁伴噺涓� " + sRelQty.ToString() + " 澶т簬瀵瑰簲婧愬崟鍓╀綑鍙壂鎻忔暟閲�" + omodel_View.HSourceQty.ToString() + "锛屼笉鍏佽鎵爜锛�";
+                        return false;
+                    }
+                }
+            }
+            else
+            //鎵规鏉$爜銆佸搧绉嶆潯鐮�
+            {
+                if (HQty > 0)
+                {
+                    sRelQty = HQty;
+                }
+                else if (omodel_View.HSourceQty > 0)
+                {
+                    sRelQty = omodel_View.HSourceQty;
+                }
+                else
+                {
+                    sRelQty = omodel_View.HQty;
+                }
+
+                //鐩存帴璋冩嫧 鏈夋簮鍗曟壂鐮侊紝鏍规嵁绯荤粺鍙傛暟锛氱洿鎺ヨ皟鎷ㄦ牎楠�-搴旀敹鏁伴噺 鎺у埗鎵爜鏁伴噺鑳藉惁鍙秴鍗曟嵁鏁伴噺锛堝皬浜庣瓑浜庡簲鏀躲�佸畬鍏ㄧ瓑浜庡簲鏀躲�佷笉鎺у埗锛�
+                if (HBillType == "1207" && omodel_View.HSourceInterID != 0
+                    && (oSystemParameterMain.Kf_MoveStockBill_MustQtyCtl == "灏忎簬绛変簬搴旀敹" || oSystemParameterMain.Kf_MoveStockBill_MustQtyCtl == "瀹屽叏绛変簬搴旀敹"))
+                {
+                    if (omodel_View.HSourceQty == 0)
+                    {
+                        sErrMsg = "鎵�鎵墿鏂欏湪鍗曟嵁涓墿浣欏彲鎵暟閲忎负0锛屼笉鍏佽鎵爜锛�";
+                        return false;
+                    }
+                    else if (sRelQty > omodel_View.HSourceQty)
+                    {
+                        sErrMsg = "鎵�鎵弿鏉$爜鏁伴噺涓� " + sRelQty.ToString() + " 澶т簬瀵瑰簲婧愬崟鍓╀綑鍙壂鎻忔暟閲�" + omodel_View.HSourceQty.ToString() + "锛屼笉鍏佽鎵爜锛�";
+                        return false;
+                    }
+                }
+            }
+
+            double sWMSQty = 0;     //鏉$爜搴撳瓨鏁伴噺
+            double sERPQty = 0;     //ERP搴撳瓨鏁伴噺
+            if (omodel_View.HBarCodeType == "鍞竴鏉$爜")
+            {
+                //鍒ゆ柇鏉$爜搴撳瓨    搴撳瓨鎺у埗-WMS璐熷簱瀛樻帶鍒�
+                if (oSystemParameterMain.WMS_WMSStockCtl == "Y")
+                {
+                    //鍒ゆ柇ERP搴撳瓨   杩斿洖ERP搴撳瓨鏁伴噺
+                    DataSet DsWMS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS_GetWHAndSP " + HBillID.ToString() + ",'" + HBillType + "','" + omodel_View.HBarCode + "'," + HSCWHID.ToString() + "," + HSCSPID.ToString(), "h_p_KF_ICInventory_WMS_GetWHAndSP");
+                    if (DsWMS == null || DsWMS.Tables[0].Rows.Count == 0)
+                    {
+                        sErrMsg = "鍒ゆ柇WMS鏉$爜搴撳瓨锛屽彂鐢熼敊璇紒";
+                        return false;
+                    }
+                    else
+                    {
+                        HSCWHID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]);
+                        HSCSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]);
+                        sWMSQty = DBUtility.ClsPub.isDoule(DsWMS.Tables[0].Rows[0]["HKFQty"]);
+                        //鍒ゆ柇鎵弿鏉$爜鏁伴噺涓庢潯鐮佸簱瀛樻暟閲�
+                        if (sRelQty > sWMSQty)
+                        {
+                            sRelQty = sWMSQty;
+                        }
+                    }
+                }
+            }
+
+            //鍒ゆ柇璋冨嚭浠撳簱銆佷粨浣嶆槸鍚︽湁鏁�
+            if (HSCWHID == 0)
+            {
+                sErrMsg = "璋冨嚭浠撳簱娌℃湁閫夋嫨锛�";
+                return false;
+            }
+            else
+            {
+                //鏍规嵁浠撳簱ID锛屽垽鏂槸鍚﹀惎鐢ㄤ粨浣�
+                DataSet dsSCWH = oCn.RunProcReturn(" select HSPFlag from Gy_Warehouse with(nolock) where HItemID= " + HSCWHID.ToString() + " and HUSEORGID= " + HStockOutOrgID.ToString(), "Gy_Warehouse");
+                if (dsSCWH == null || dsSCWH.Tables[0].Rows.Count == 0)
+                {
+                    sErrMsg = "鎵�閫夎皟鍑轰粨搴撲笉灞炰簬璇ヨ皟鍑虹粍缁囷紒";
+                    return false;
+                }
+                else if (HSCSPID == 0 && DBUtility.ClsPub.isBool(dsSCWH.Tables[0].Rows[0]["HSPFlag"]) == true)
+                {
+                    sErrMsg = "璋冨嚭浠撲綅娌℃湁閫夋嫨锛�";
+                    return false;
+                }
+            }
+
+            //鍒ゆ柇ERP搴撳瓨   搴撳瓨鎺у埗-ERP璐熷簱瀛樻帶鍒�
+            if (oSystemParameterMain.WMS_ERPStockCtl == "Y")
+            {
+                //鍒ゆ柇ERP搴撳瓨   杩斿洖ERP搴撳瓨鏁伴噺
+                DataSet DsERP = oCn.RunProcReturn("exec h_p_IF_CheckQtyByERPICInventory " + HBillID.ToString() + ",'" + HBillType + "','" + omodel_View.HBarCode + "'," + HSCWHID.ToString() + "," + HSCSPID.ToString() + "," + omodel_View.HMaterID.ToString() + "," + omodel_View.HAuxPropID.ToString() + ",'" + omodel_View.HBatchNo + "'," + sRelQty.ToString() + "," + HStockOutOrgID.ToString(), "h_p_IF_CheckQtyByERPICInventory");
+                if (DsERP == null || DsERP.Tables[0].Rows.Count == 0)
+                {
+                    sErrMsg = "鍒ゆ柇ERP搴撳瓨锛屽彂鐢熼敊璇紒";
+                    return false;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isLong(DsERP.Tables[0].Rows[0][0]) == 0)
+                    {
+                        sERPQty = DBUtility.ClsPub.isDoule(DsERP.Tables[0].Rows[0]["HQty"]);
+                        sRelQty = sERPQty;
+                    }
+                    else
+                    {
+                        sErrMsg = DBUtility.ClsPub.isStrNull(DsERP.Tables[0].Rows[0]["HRemark"]);
+                        return false;
+                    }
+                }
+            }
+
+            if (sRelQty == 0)
+            {
+                sErrMsg = "鎵�鎵弿鏉$爜鏃犳潯鐮佸簱瀛樻垨瀵瑰簲鐗╂枡鏃燛RP搴撳瓨锛�";
+                return false;
+            }
+
+            if(HWhID ==HSCWHID && HSPID == HSCSPID)
+            {
+                sErrMsg = "璋冨叆浠撳簱銆佷粨浣嶄笉鑳戒笌璋冨嚭浠撳簱銆佷粨浣嶇浉鍚岋紒";
+                return false;
+            }
+
+            string sBillTypeOneScan = "";   //鏄惁鍚敤涓�娆℃壂鐮佹帶鍒讹紙'Y'涓哄惎鐢級
+            if (HBillType == "1207" && oSystemParameterMain.Kf_MoveStockBill_BillTypeOneScan == "Y")
+            {
+                //鐩存帴璋冩嫧鍗�
+                sBillTypeOneScan = "Y";
+            }
+            if (sBillTypeOneScan == "Y")
+            {
+                //涓�娆℃壂鐮佹帶鍒讹紝鍚屼竴鏉$爜銆佸悓涓�鍗曟嵁绫诲瀷锛屽湪WMS琛ㄥ拰TEMP琛ㄩ噷锛屽彧鍏佽杩涜涓�娆℃壂鐮�
+                DataSet ds = oCn.RunProcReturn("exec h_p_WMS_CheckBarCodeOneScan " + HBillID.ToString() + ",'" + omodel_View.HBarCode + "','" + HBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + HSCWHID.ToString() + "," + HSCSPID.ToString() + ",'" + 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;
+                    }
+                }
+            }
+
+            oMain.HInterID = HBillID;
+            oMain.HBillNo = HBillNo;
+            oMain.HBillType = HBillType;
+            oMain.HMaker = HMaker;
+            oMain.HMaterID = omodel_View.HMaterID;
+            oMain.HAuxPropID = omodel_View.HAuxPropID;
+            oMain.HQty = sRelQty;
+            oMain.HQtyMust = 0;
+            oMain.HBarCode = omodel_View.HBarCode;
+            oMain.HBatchNo = omodel_View.HBatchNo;
+            oMain.HMTONo = omodel_View.HMTONo;
+            oMain.HWhID = HWhID;
+            oMain.HStockPlaceID = HSPID;
+            oMain.HSCWHID = HSCWHID;
+            oMain.HOutStockPlaceID = HSCSPID;
+            oMain.HSourceInterID = omodel_View.HSourceInterID;
+            oMain.HSourceEntryID = omodel_View.HSourceEntryID;
+            oMain.HSourceBillNo = omodel_View.HSourceBillNo;
+            oMain.HSourceBillType = HSourceBillType;
+            oMain.HRedBlueFlag = false;
+            oMain.HPieceQty = 1;
+            oMain.HSTOCKORGID = HStockOutOrgID;
+            oMain.HOWNERID = HStockInOrgID;
+
+            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) " +
+                " Values(" + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'," + oMain.HMaterID.ToString() + "," + oMain.HAuxPropID.ToString() + "," + oMain.HProcID.ToString() +
+                "," + oMain.HWhID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HStockPlaceID.ToString() + "," + oMain.HOutStockPlaceID.ToString() + "," + oMain.HGroupID.ToString() + ",'" + oMain.HAddr + "'" +
+                "," + oMain.HQtyMust.ToString() + "," + oMain.HQty.ToString() + "," + oMain.HPieceQty.ToString() + ",'" + oMain.HBatchNo + "','" + oMain.HBarCode + "',''" +
+                ",'" + oMain.HMaker + "',getdate()," + oMain.HSourceInterID.ToString() + "," + oMain.HSourceEntryID.ToString() + ",'" + oMain.HSourceBillType + "','" + oMain.HSourceBillNo + "'" +
+                "," + oMain.HRelationInterID.ToString() + "," + oMain.HRelationEntryID.ToString() + ",'" + oMain.HRelationBillNo + "'," + Convert.ToString(oMain.HRedBlueFlag ? 1 : 0) + ",'" + oMain.HMTONo + "',0" +
+                "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + "," + oMain.HSTOCKORGID.ToString() + ",'','',0" +
+                ",0,0,'" + oMain.HCusBarCode + "',0)");
+            return true;
+        }
+
+        #endregion
+
+        #endregion
+
+
         //        #region 鎵弿鐗╂枡鏉$爜璋冪敤鏂规硶
 
         //        #region 鎵弿鐗╂枡鏉$爜
@@ -36811,16 +38261,16 @@
                                 {
                                     for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
                                     {
-                                        dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCode"]);
-                                        dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCodeType"]);
-                                        dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HMaterID"]);
-                                        dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HAuxPropID"]);
-                                        dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBatchNo"]);
-                                        dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[0]["HQty"]);
-                                        dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceInterID"]);
-                                        dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceEntryID"]);
-                                        dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]);
-                                        dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HMTONo"]);
+                                        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"]);
 
                                         //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
                                         if (!set_SavePonderationBillMain_Temp_BarCode_MoveStockBillCheck(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg))
@@ -37418,16 +38868,16 @@
                                     {
                                         for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
                                         {
-                                            dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCode"]);
-                                            dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCodeType"]);
-                                            dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HMaterID"]);
-                                            dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HAuxPropID"]);
-                                            dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBatchNo"]);
-                                            dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[0]["HQty"]);
-                                            dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceInterID"]);
-                                            dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceEntryID"]);
-                                            dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]);
-                                            dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HMTONo"]);
+                                            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"]);
 
                                             //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
                                             if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg))
@@ -37501,16 +38951,16 @@
                                         {
                                             for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
                                             {
-                                                dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCode"]);
-                                                dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCodeType"]);
-                                                dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HMaterID"]);
-                                                dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HAuxPropID"]);
-                                                dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBatchNo"]);
-                                                dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[0]["HQty"]);
-                                                dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceInterID"]);
-                                                dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceEntryID"]);
-                                                dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]);
-                                                dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HMTONo"]);
+                                                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"]);
 
                                                 //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
                                                 if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg))

--
Gitblit v1.9.1