From 1e846aea31e8d7fd74dd134b5bf01b1b005baef8 Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期四, 20 六月 2024 10:14:41 +0800
Subject: [PATCH] 斯莫尔条码解析调整

---
 CLOUDWEB/WebService1.asmx.cs |  606 +++++++++++++++++++++++++++++++-----------------------
 1 files changed, 346 insertions(+), 260 deletions(-)

diff --git a/CLOUDWEB/WebService1.asmx.cs b/CLOUDWEB/WebService1.asmx.cs
index 82c81b7..de000b2 100644
--- a/CLOUDWEB/WebService1.asmx.cs
+++ b/CLOUDWEB/WebService1.asmx.cs
@@ -49904,8 +49904,97 @@
                         }
                         else
                         {
-                            sErrMsg = "鏉$爜妗f涓笉瀛樺湪璇ユ潯鐮侊紝璇风‘璁ゆ潯鐮佹槸鍚︽纭垨鏄惁宸茶鍒犻櫎锛�";
-                            return null;
+                            //鏉窞鏂帿灏旓紝鏉$爜涓嶅瓨鍦紝瑙f瀽鏉$爜鍚庢墽琛屾壂鐮佹搷浣�
+                            if (oSystemParameter.omodel.WMS_CampanyName == "鏉窞鏂帿灏�")
+                            {
+                                //瑙f瀽鏉$爜
+                                if (!GetJXBarCode_SiMoEr(sBarCode, HQty, ref sErrMsg))
+                                {
+                                    return null;
+                                }
+
+                                if (dal.GetInfoByBarCode_View(sBarCode))
+                                {
+                                    if (dal.omodel_View.HStopflag)
+                                    {
+                                        sErrMsg = "鏉$爜宸茶绂佺敤锛屼笉鍏佽鎵弿锛�";
+                                        return null;
+                                    }
+                                    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"]);
+
+                                                        //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                                                        oBar = get_SavePonderationBillMain_Temp_BarCode(dal.omodel_View, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, SourceFlag, HSourceBillType, HStockOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg);
+                                                        if (oBar == null)
+                                                        {
+                                                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涙壂鎻忓け璐ワ紒" + dal.omodel_View.HBarCode + sErrMsg;
+                                                            return null;
+                                                        }
+                                                        SourceFlag = true;
+                                                    }
+                                                }
+                                                return oBar;
+                                            }
+                                        }
+                                        else
+                                        //鏉$爜绫诲瀷涓嶄负鎵樼洏鏉$爜
+                                        {
+                                            //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                                            oBar = get_SavePonderationBillMain_Temp_BarCode(dal.omodel_View, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, SourceFlag, HSourceBillType, HStockOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg);
+                                            if (oBar == null)
+                                            {
+                                                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涙壂鎻忓け璐ワ紒" + sErrMsg;
+                                                return null;
+                                            }
+                                            else
+                                            {
+                                                return oBar;
+                                            }
+                                        }
+                                    }
+                                }
+                                else
+                                {
+                                    sErrMsg = "鏉$爜妗f涓笉瀛樺湪璇ユ潯鐮侊紝璇风‘璁ゆ潯鐮佹槸鍚︽纭垨鏄惁宸茶鍒犻櫎锛�";
+                                    return null;
+                                }
+                            }
+                            else
+                            {
+                                sErrMsg = "鏉$爜妗f涓笉瀛樺湪璇ユ潯鐮侊紝璇风‘璁ゆ潯鐮佹槸鍚︽纭垨鏄惁宸茶鍒犻櫎锛�";
+                                return null;
+                            }
                         }
                     }
                 }
@@ -49946,262 +50035,6 @@
                         }
                         else
                         {
-                            if (oSystemParameter.omodel.WMS_CampanyName == "鏉窞鏂帿灏�")
-                            {
-                                if (!dal.GetInfoByBarCode_View(sBarCode))
-                                {
-                                    //鏉$爜瑙f瀽
-                                    string[] str = sBarCode.Split('@');
-
-                                    if (str[0] != "CMR")
-                                    {
-                                        sErrMsg = "鏉$爜瑙f瀽澶辫触,璇风‘璁ゆ潯鐮佹槸鍚︽纭�!";
-                                        return null;
-                                    }
-
-                                    int HOrgIDs = 0;
-                                    //鏌ヨ缁勭粐
-                                    DataSet ds = oCn.RunProcReturn("select * from Xt_ORGANIZATIONS where HNumber='" + str[1] + "' ", "Xt_ORGANIZATIONS");
-                                    if (ds.Tables[0].Rows.Count == 0)
-                                    {
-                                        sErrMsg = "鏉$爜瑙f瀽澶辫触,璇风‘璁ゆ潯鐮佺粍缁囨槸鍚︽纭�!";
-                                        return null;
-                                    }
-                                    else
-                                    {
-                                        HOrgIDs = int.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());
-                                    }
-
-                                    string HMaterNames = "";
-                                    string HMaterModels = "";
-                                    string HMaterIDs = "0";
-                                    //鏌ヨ鐗╂枡
-                                    ds = oCn.RunProcReturn("select  * from Gy_Material where HNumber='" + str[4] + "' and HUSEORGID=" + HOrgIDs, "Gy_Material");
-
-
-                                    if (ds.Tables[0].Rows.Count == 0)
-                                    {
-                                        sErrMsg = "鏉$爜瑙f瀽澶辫触,璇风‘璁ゆ潯鐮佺墿鏂欐槸鍚︽纭�!";
-                                        return null;
-                                    }
-                                    else
-                                    {
-                                        HMaterIDs = ds.Tables[0].Rows[0]["HItemID"].ToString();
-                                        HMaterNames = ds.Tables[0].Rows[0]["HName"].ToString();
-                                        HMaterModels = ds.Tables[0].Rows[0]["HModel"].ToString();
-
-                                    }
-                                    string HSupIDs = "0";
-                                    //鏌ヨ渚涘簲鍟�
-                                    ds = oCn.RunProcReturn("select * from Gy_Supplier where HNumber='" + str[2] + "' and HUSEORGID=" + HOrgIDs, "Gy_Supplier");
-                                    if (ds.Tables[0].Rows.Count == 0)
-                                    {
-                                        //sErrMsg = "鏉$爜瑙f瀽澶辫触,璇风‘璁ゆ潯鐮佷緵搴斿晢鏄惁姝g‘!";
-                                        //return null;
-                                    }
-                                    else
-                                    {
-                                        HSupIDs = ds.Tables[0].Rows[0]["HItemID"].ToString();
-                                    }
-
-                                    string HSourceInterIDs = "0";
-                                    string HSourceEntryIDs = "0";
-                                    string HSourceBillNos = "0";
-                                    string HUnitIDs = "0";
-                                    //鏌ヨ閲囪喘璁㈠崟
-                                    ds = oCn.RunProcReturn(@"select  a.HInterID,b.HEntryID,a.HBillNo,b.HUnitID from Cg_POOrderBillMain a
-inner join Cg_POOrderBillSub b on a.HInterID = b.HInterID where HBillNo='" + str[3] + "' and b.HMaterID=" + HMaterIDs, "Cg_POOrderBillMain");
-                                    if (ds.Tables[0].Rows.Count == 0)
-                                    {
-                                        //sErrMsg = "鏉$爜瑙f瀽澶辫触,璇风‘璁ゆ潯鐮侀噰璐鍗曟槸鍚︽纭�!";
-                                        //return null;
-                                    }
-                                    else
-                                    {
-                                        HSourceInterIDs = ds.Tables[0].Rows[0]["HInterID"].ToString();
-                                        HSourceEntryIDs = ds.Tables[0].Rows[0]["HEntryID"].ToString();
-                                        HSourceBillNos = ds.Tables[0].Rows[0]["HBillNo"].ToString();
-                                        HUnitIDs = ds.Tables[0].Rows[0]["HUnitID"].ToString();
-                                    }
-
-                                    string HInnerBillNos = "";
-                                    //鏌ヨ鍐呴儴閲囪喘璁㈠崟鍙�
-                                    ds = oCn.RunProcReturn(@" select * from h_v_IF_POInStockList where 閲囪喘璁㈠崟鍙�= '" + str[3] + "' ", "h_v_IF_POInStockList");
-                                    if (ds.Tables[0].Rows.Count == 0)
-                                    {
-                                        HInnerBillNos = str[3];
-                                        //HInnerBillNos = "9624";
-                                        //sErrMsg = "鏉$爜瑙f瀽澶辫触,璇风‘璁ゆ潯鐮佸唴閮ㄩ噰璐鍗曞彿鏄惁姝g‘!";
-                                        //return null;
-                                    }
-                                    else
-                                    {
-                                        HInnerBillNos = ds.Tables[0].Rows[0]["鍐呴儴閲囪喘璁㈠崟鍙�"].ToString();
-                                    }
-
-                                    if (HQty == 0)
-                                    {
-                                        HQty = double.Parse(str[6]);
-                                    }
-
-
-                                    //鏃ユ湡鑾峰彇鏂瑰紡
-                                    string sDate = DateTime.Now.ToString();
-                                    string HWei = "0";      //灏炬暟
-                                    string HBarCodeType = "鎵规鏉$爜";
-                                    Int64 HMaterID = int.Parse(HMaterIDs);
-                                    Int64 HAuxPropID = 0;
-                                    Int64 HUnitID = int.Parse(HUnitIDs);
-                                    double HQty2 = HQty;
-                                    string HBatchNo2 = str[5];
-                                    Int64 HSupID = int.Parse(HSupIDs);
-                                    Int64 HGroupID = 0;
-                                    int HPrintQty = 0;
-                                    Int64 HSourceInterID = int.Parse(HSourceInterIDs);
-                                    Int64 HSourceEntryID = int.Parse(HSourceEntryIDs);
-                                    HSourceBillNo = HSourceBillNos;
-                                    //HSourceBillType = "1102";
-                                    Int64 HBarcodeNo = 0;       //鎵樺彿
-                                    Int64 HBarcodeQtys = 0;     //鎬绘墭鏁�
-                                    Int64 HDeptID = 0;
-                                    //Int64 HWhID = 0;
-                                    //Int64 HSPID = 0;
-                                    string HRemark = "鏉$爜瑙f瀽";
-                                    string HMaterName = HMaterNames;
-                                    string HMaterModel = HMaterModels;
-                                    string HPinfan = "";
-                                    string HMTONo = "";
-                                    Int64 HCusID = 0;
-                                    string HCusType = "";
-                                    DateTime HEndDate = DateTime.Now;
-                                    string HWorkLineName = "";
-                                    string HSeOrderBillNo = "";
-                                    string HInnerBillNo = HInnerBillNos;
-                                    bool HGiveAwayFlag = false;
-                                    Int64 HEntryID = 1;
-                                    Int64 HInterIDs = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo);
-                                    int HOrgID = HOrgIDs;
-
-
-                                    oCn.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
-                                                       ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
-                                                       ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
-                                                       ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
-                                                       ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
-                                                       ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " +
-                                                       ",HGiveAwayFlag " +
-                                                       ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo" +
-                                                       ",HProduceDate,HExpiryDate " +
-                                                       ") values ("
-                                                       + "'" + sBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString()
-                                                       + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString()
-                                                       + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'"
-                                                       + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'"
-                                                       + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + sDate + "'"
-                                                       + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterIDs.ToString() + "," + HEntryID.ToString() + ""
-                                                       + ", " + DBUtility.ClsPub.BoolToString(HGiveAwayFlag)
-                                                       + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "','','')");
-
-
-                                }
-
-                                if (dal.GetInfoByBarCode_View(sBarCode))
-                                {
-                                    HQty = dal.omodel_View.HQty;
-
-                                    if (dal.omodel_View.HStopflag)
-                                    {
-                                        sErrMsg = "鏉$爜宸茶绂佺敤锛屼笉鍏佽鎵弿锛�";
-                                        return null;
-                                    }
-                                    else
-                                    {
-                                        //鍒ゆ柇鏉$爜绫诲瀷鏄惁涓烘墭鐩樻潯鐮侊紝濡傛灉鏄墭鐩樻潯鐮佸垯鍒嗚В骞舵ā鎷熸壂鐮�
-                                        if (dal.omodel_View.HBarCodeType == "鎵樼洏鏉$爜")
-                                        {
-                                            if (oSystemParameter.omodel.WMS_CampanyName == "鏉窞鏂帿灏�")
-                                            {
-                                                //鍒嗚В鎵樼洏鏉$爜寰楀埌鏄庣粏鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃
-                                                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"]);
-
-                                                            //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-                                                            oBar = get_SavePonderationBillMain_Temp_BarCode(dal.omodel_View, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, SourceFlag, HSourceBillType, HStockOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg);
-                                                            if (oBar == null)
-                                                            {
-                                                                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涙壂鎻忓け璐ワ紒" + dal.omodel_View.HBarCode + sErrMsg;
-                                                                return null;
-                                                            }
-                                                            SourceFlag = true;
-                                                        }
-                                                    }
-                                                    return oBar;
-                                                }
-                                            }
-                                            else
-                                            {
-                                                //灏嗘墭鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃
-                                                oBar = get_SavePonderationBillMain_Temp_PackBarCode(dal.omodel_View, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, 0, 0, SourceFlag, HSourceBillType, HStockOrgID, HStockOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg);
-                                                if (oBar == null)
-                                                {
-                                                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涙壂鎻忓け璐ワ紒" + sErrMsg;
-                                                    return null;
-                                                }
-                                                else
-                                                {
-                                                    return oBar;
-                                                }
-                                            }
-                                        }
-                                        else
-                                        //鏉$爜绫诲瀷涓嶄负鎵樼洏鏉$爜
-                                        {
-                                            //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-                                            oBar = get_SavePonderationBillMain_Temp_BarCode(dal.omodel_View, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, SourceFlag, HSourceBillType, HStockOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg);
-                                            if (oBar == null)
-                                            {
-                                                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涙壂鎻忓け璐ワ紒" + sErrMsg;
-                                                return null;
-                                            }
-                                            else
-                                            {
-                                                return oBar;
-                                            }
-                                        }
-                                    }
-                                }
-                                else
-                                {
-                                    sErrMsg = "鏉$爜妗f涓笉瀛樺湪璇ユ潯鐮侊紝璇风‘璁ゆ潯鐮佹槸鍚︽纭垨鏄惁宸茶鍒犻櫎锛�";
-                                    return null;
-                                }
-                            }
-
                             if (dal.GetInfoByBarCode_View(sBarCode))
                             {
                                 if (dal.omodel_View.HStopflag)
@@ -50292,8 +50125,97 @@
                             }
                             else
                             {
-                                sErrMsg = "鏉$爜妗f涓笉瀛樺湪璇ユ潯鐮侊紝璇风‘璁ゆ潯鐮佹槸鍚︽纭垨鏄惁宸茶鍒犻櫎锛�";
-                                return null;
+                                //鏉窞鏂帿灏旓紝鏉$爜涓嶅瓨鍦紝瑙f瀽鏉$爜鍚庢墽琛屾壂鐮佹搷浣�
+                                if (oSystemParameter.omodel.WMS_CampanyName == "鏉窞鏂帿灏�")
+                                {
+                                    //瑙f瀽鏉$爜
+                                    if (!GetJXBarCode_SiMoEr(sBarCode, HQty, ref sErrMsg))
+                                    {
+                                        return null;
+                                    }
+
+                                    if (dal.GetInfoByBarCode_View(sBarCode))
+                                    {
+                                        if (dal.omodel_View.HStopflag)
+                                        {
+                                            sErrMsg = "鏉$爜宸茶绂佺敤锛屼笉鍏佽鎵弿锛�";
+                                            return null;
+                                        }
+                                        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"]);
+
+                                                            //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                                                            oBar = get_SavePonderationBillMain_Temp_BarCode(dal.omodel_View, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, SourceFlag, HSourceBillType, HStockOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg);
+                                                            if (oBar == null)
+                                                            {
+                                                                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涙壂鎻忓け璐ワ紒" + dal.omodel_View.HBarCode + sErrMsg;
+                                                                return null;
+                                                            }
+                                                            SourceFlag = true;
+                                                        }
+                                                    }
+                                                    return oBar;
+                                                }
+                                            }
+                                            else
+                                            //鏉$爜绫诲瀷涓嶄负鎵樼洏鏉$爜
+                                            {
+                                                //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                                                oBar = get_SavePonderationBillMain_Temp_BarCode(dal.omodel_View, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, SourceFlag, HSourceBillType, HStockOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg);
+                                                if (oBar == null)
+                                                {
+                                                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涙壂鎻忓け璐ワ紒" + sErrMsg;
+                                                    return null;
+                                                }
+                                                else
+                                                {
+                                                    return oBar;
+                                                }
+                                            }
+                                        }
+                                    }
+                                    else
+                                    {
+                                        sErrMsg = "鏉$爜妗f涓笉瀛樺湪璇ユ潯鐮侊紝璇风‘璁ゆ潯鐮佹槸鍚︽纭垨鏄惁宸茶鍒犻櫎锛�";
+                                        return null;
+                                    }
+                                }
+                                else
+                                {
+                                    sErrMsg = "鏉$爜妗f涓笉瀛樺湪璇ユ潯鐮侊紝璇风‘璁ゆ潯鐮佹槸鍚︽纭垨鏄惁宸茶鍒犻櫎锛�";
+                                    return null;
+                                }
                             }
                         }
                     }
@@ -52574,7 +52496,171 @@
 
         #endregion
 
+        #region 鏂帿灏旀潯鐮佽В鏋�
 
+        [WebMethod]
+        public bool GetJXBarCode_SiMoEr(string sBarCode, Double HQty, ref string sErrMsg)
+        {
+            try
+            {
+                //鏉$爜瑙f瀽
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                string[] str = sBarCode.Split('@');
+
+                if (str[0] != "CMR")
+                {
+                    sErrMsg = "鏉$爜瑙f瀽澶辫触,璇风‘璁ゆ潯鐮佹槸鍚︽纭�!";
+                    return false;
+                }
+
+                int HOrgIDs = 0;
+                //鏌ヨ缁勭粐
+                DataSet ds = oCn.RunProcReturn("select * from Xt_ORGANIZATIONS with(nolock) where HNumber='" + str[1] + "' ", "Xt_ORGANIZATIONS");
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    sErrMsg = "鏉$爜瑙f瀽澶辫触,璇风‘璁ゆ潯鐮佺粍缁囨槸鍚︽纭�!";
+                    return false;
+                }
+                else
+                {
+                    HOrgIDs = int.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());
+                }
+
+                string HMaterNames = "";
+                string HMaterModels = "";
+                string HMaterIDs = "0";
+                //鏌ヨ鐗╂枡
+                ds = oCn.RunProcReturn("select  * from Gy_Material with(nolock) where HNumber='" + str[4] + "' and HUSEORGID=" + HOrgIDs, "Gy_Material");
+
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    sErrMsg = "鏉$爜瑙f瀽澶辫触,璇风‘璁ゆ潯鐮佺墿鏂欐槸鍚︽纭�!";
+                    return false;
+                }
+                else
+                {
+                    HMaterIDs = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                    HMaterNames = ds.Tables[0].Rows[0]["HName"].ToString();
+                    HMaterModels = ds.Tables[0].Rows[0]["HModel"].ToString();
+                }
+                string HSupIDs = "0";
+                //鏌ヨ渚涘簲鍟�
+                ds = oCn.RunProcReturn("select * from Gy_Supplier with(nolock) where HNumber='" + str[2] + "' and HUSEORGID=" + HOrgIDs, "Gy_Supplier");
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    //sErrMsg = "鏉$爜瑙f瀽澶辫触,璇风‘璁ゆ潯鐮佷緵搴斿晢鏄惁姝g‘!";
+                    //return false;
+                }
+                else
+                {
+                    HSupIDs = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                }
+
+                string HSourceInterIDs = "0";
+                string HSourceEntryIDs = "0";
+                string HSourceBillNos = "0";
+                string HUnitIDs = "0";
+                //鏌ヨ閲囪喘璁㈠崟
+                ds = oCn.RunProcReturn(@"select  a.HInterID,b.HEntryID,a.HBillNo,b.HUnitID from Cg_POOrderBillMain a with(nolock) inner join Cg_POOrderBillSub b with(nolock) on a.HInterID = b.HInterID where HBillNo='" + str[3] + "' and b.HMaterID=" + HMaterIDs, "Cg_POOrderBillMain");
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    //sErrMsg = "鏉$爜瑙f瀽澶辫触,璇风‘璁ゆ潯鐮侀噰璐鍗曟槸鍚︽纭�!";
+                    //return false;
+                }
+                else
+                {
+                    HSourceInterIDs = ds.Tables[0].Rows[0]["HInterID"].ToString();
+                    HSourceEntryIDs = ds.Tables[0].Rows[0]["HEntryID"].ToString();
+                    HSourceBillNos = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+                    HUnitIDs = ds.Tables[0].Rows[0]["HUnitID"].ToString();
+                }
+
+                string HInnerBillNos = "";
+                //鏌ヨ鍐呴儴閲囪喘璁㈠崟鍙�
+                ds = oCn.RunProcReturn(@" select * from h_v_IF_POInStockList where 閲囪喘璁㈠崟鍙�= '" + str[3] + "' ", "h_v_IF_POInStockList");
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    HInnerBillNos = str[3];
+                    //HInnerBillNos = "9624";
+                    //sErrMsg = "鏉$爜瑙f瀽澶辫触,璇风‘璁ゆ潯鐮佸唴閮ㄩ噰璐鍗曞彿鏄惁姝g‘!";
+                    //return false;
+                }
+                else
+                {
+                    HInnerBillNos = ds.Tables[0].Rows[0]["鍐呴儴閲囪喘璁㈠崟鍙�"].ToString();
+                }
+
+                if (HQty == 0)
+                {
+                    HQty = double.Parse(str[6]);
+                }
+
+                //鏃ユ湡鑾峰彇鏂瑰紡
+                string sDate = DateTime.Now.ToString();
+                string HWei = "0";      //灏炬暟
+                string HBarCodeType = "鎵规鏉$爜";
+                Int64 HMaterID = int.Parse(HMaterIDs);
+                Int64 HAuxPropID = 0;
+                Int64 HUnitID = int.Parse(HUnitIDs);
+                double HQty2 = HQty;
+                string HBatchNo2 = str[5];
+                Int64 HSupID = int.Parse(HSupIDs);
+                Int64 HGroupID = 0;
+                int HPrintQty = 0;
+                Int64 HSourceInterID = int.Parse(HSourceInterIDs);
+                Int64 HSourceEntryID = int.Parse(HSourceEntryIDs);
+                string HSourceBillNo = HSourceBillNos;
+                string HSourceBillType = "1102";
+                Int64 HBarcodeNo = 0;       //鎵樺彿
+                Int64 HBarcodeQtys = 0;     //鎬绘墭鏁�
+                Int64 HDeptID = 0;
+                //Int64 HWhID = 0;
+                //Int64 HSPID = 0;
+                string HRemark = "鏉$爜瑙f瀽";
+                string HMaterName = HMaterNames;
+                string HMaterModel = HMaterModels;
+                string HPinfan = "";
+                string HMTONo = "";
+                Int64 HCusID = 0;
+                string HCusType = "";
+                DateTime HEndDate = DateTime.Now;
+                string HWorkLineName = "";
+                string HSeOrderBillNo = "";
+                string HInnerBillNo = HInnerBillNos;
+                bool HGiveAwayFlag = false;
+                Int64 HEntryID = 1;
+                Int64 HInterIDs = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo);
+                int HOrgID = HOrgIDs;
+
+                oCn.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
+                            ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
+                            ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
+                            ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
+                            ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
+                            ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " +
+                            ",HGiveAwayFlag " +
+                            ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo" +
+                            ",HProduceDate,HExpiryDate " +
+                            ") values ("
+                            + "'" + sBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString()
+                            + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'admin',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString()
+                            + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'"
+                            + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + ",0,0,'" + HRemark + "'"
+                            + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + sDate + "'"
+                            + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterIDs.ToString() + "," + HEntryID.ToString() + ""
+                            + ", " + DBUtility.ClsPub.BoolToString(HGiveAwayFlag)
+                            + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "','','')");
+
+                return true;
+            }
+            catch (Exception e)
+            {
+                sErrMsg = e.Message + ";" + e.StackTrace;
+                return false;
+            }
+        }
+
+        #endregion
 
         #endregion
 

--
Gitblit v1.9.1