From 234ff8b8d5182ee379b44262591dbde707181c8e Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期四, 30 十月 2025 11:03:17 +0800
Subject: [PATCH] 添加小卫物料条码解析方法

---
 CLOUDWEB/WebService1.asmx.cs |  234 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 234 insertions(+), 0 deletions(-)

diff --git a/CLOUDWEB/WebService1.asmx.cs b/CLOUDWEB/WebService1.asmx.cs
index 2957819..bcf6fc7 100644
--- a/CLOUDWEB/WebService1.asmx.cs
+++ b/CLOUDWEB/WebService1.asmx.cs
@@ -59590,6 +59590,91 @@
                                     return null;
                                 }
                             }
+                            else if (oSystemParameter.omodel.WMS_CampanyName == "灏忓崼")
+                            {
+                                //瑙f瀽鏉$爜
+                                if (!GetJXBarCode_XiaoWei(sBarCode, HQty, HStockOrgID, 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涓笉瀛樺湪璇ユ潯鐮侊紝璇风‘璁ゆ潯鐮佹槸鍚︽纭垨鏄惁宸茶鍒犻櫎锛�";
@@ -62881,6 +62966,155 @@
 
         #endregion
 
+        #region 灏忓崼鏉$爜瑙f瀽
+
+        [WebMethod]
+        public bool GetJXBarCode_XiaoWei(string sBarCode, Double HQty,long HStockOrgID, ref string sErrMsg)
+        {
+            try
+            {
+                //鏉$爜瑙f瀽
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                string[] str = sBarCode.Split('@');
+
+                //閫氳繃鏉$爜瀛楁鏁伴噺杩涘叆涓嶅悓鐨勮В鏋愭柟寮忥紝鍥犱负鏈夊悓涓�涓暟缁勪綅缃紝濉啓鐨勬槸涓嶅悓瀛楁鐨勫唴瀹癸紝姣斿鏈夌殑绗笁浣嶆樉绀虹殑鏄壒鍙蜂俊鎭紝鏈夌殑绗笁浣嶆樉绀虹殑鏄墿鏂欏悕绉颁俊鎭�
+                if (str.Length == 4)
+                {
+                    DataSet ds;
+                    string HMaterNumber = str[0];
+                    string HSupNumber = str[1];
+                    string HBatchNo = str[2];
+                    string HBarQty = str[3];
+
+                    string HSupIDs = "0";
+                    //鏌ヨ渚涘簲鍟�
+                    ds = oCn.RunProcReturn("select * from Gy_Supplier with(nolock) where HNumber ='" + HSupNumber + "' and HUSEORGID=" + HStockOrgID, "Gy_Supplier");
+                    if (ds.Tables[0].Rows.Count == 0)
+                    {
+                        sErrMsg = "鏉$爜瑙f瀽澶辫触,璇风‘璁ゆ潯鐮佷緵搴斿晢鏄惁姝g‘!";
+                        return false;
+                    }
+                    else
+                    {
+                        HSupIDs = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                    }
+
+                    string HMaterNames = "";
+                    string HMaterModels = "";
+                    string HMaterIDs = "0";
+                    string HISKFPERIOD = "0";// 淇濊川鏈熷惎鐢ㄦ爣璁�
+                    string HUnitIDs = "0";
+                    //鏌ヨ鐗╂枡
+                    ds = oCn.RunProcReturn("select  HUnitID,HItemID,HName,HModel,case HISKFPERIOD when 1 then '1' else '0' end HISKFPERIOD from Gy_Material a with(nolock) where HNumber='" + HMaterNumber + "' and HUSEORGID=" + HStockOrgID + " order by a.HISKFPERIOD desc", "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();
+                        HISKFPERIOD = ds.Tables[0].Rows[0]["HISKFPERIOD"].ToString();
+                        HUnitIDs = ds.Tables[0].Rows[0]["HUnitID"].ToString();
+                    }
+                    DateTime HDate = DateTime.Now;//鏃ユ湡
+                    string HProduceDate = "";//鐢熶骇鏃ユ湡
+                    string HExpiryDate = "";//淇濊川鏈熻嚦
+
+                    string HSourceInterIDs = "0";
+                    string HSourceEntryIDs = "0";
+                    string HSourceBillNos = "";
+                    string HInnerBillNos = "";
+
+                    //鏃ユ湡鑾峰彇鏂瑰紡
+                    string HBarCodeType = "鎵规鏉$爜";
+                    Int64 HMaterID = int.Parse(HMaterIDs);
+                    Int64 HUnitID = int.Parse(HUnitIDs);
+
+                    Int64 HSupID = int.Parse(HSupIDs);
+                    Int64 HGroupID = 0;
+                    int HPrintQty = 1;
+
+                    Int64 HSourceInterID = int.Parse(HSourceInterIDs);
+                    Int64 HSourceEntryID = int.Parse(HSourceEntryIDs);
+                    string HSourceBillNo = HSourceBillNos;
+                    string HSourceBillType = "";
+                    string HWei = "0";      //灏炬暟
+
+                    Int64 HBarcodeQtys = 0;     //鎬绘墭鏁�
+                    Int64 HBarcodeNo = 0;       //鎵樺彿
+                    Int64 HDeptID = 0;
+                    string HRemark = "鏉$爜瑙f瀽";
+
+                    Int64 HCusID = 0;
+                    string HCusType = "";
+                    DateTime HEndDate = DateTime.Now;
+                    string HWorkLineName = "";
+
+                    long HOrgID = HStockOrgID;
+                    string HSeOrderBillNo = "";
+                    Int64 HInterIDs = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo);
+                    Int64 HEntryID = 1;
+
+                    bool HGiveAwayFlag = false;
+
+                    string HMaterName = HMaterNames;
+                    string HMaterModel = HMaterModels;
+                    string HPinfan = "";
+                    string HMTONo = "";
+                    Int64 HAuxPropID = 0;
+                    string HInnerBillNo = HInnerBillNos;
+
+
+                    //Int64 HWhID = 0;
+                    //Int64 HSPID = 0;
+
+                    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,HISKFPERIOD " +
+                                ") values ("
+                                + "'" + sBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HBarQty.ToString()
+                                + ",'" + HBatchNo + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'admin',getdate()," + HPrintQty.ToString() + "," + HBarQty.ToString()
+                                + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'"
+                                + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + ",0,0,'" + HRemark + "'"
+                                + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "',getdate()" 
+                                + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterIDs.ToString() + "," + HEntryID.ToString() + ""
+                                + ", " + DBUtility.ClsPub.BoolToString(HGiveAwayFlag)
+                                + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "','" + HProduceDate + "','" + HExpiryDate + "'," + HISKFPERIOD + ")");
+
+                    return true;
+                }
+                else if (str.Length == 5)
+                {                   
+                    //鍙﹀涓�绉嶈В鏋愭柟娉�
+
+                    return true;
+                }
+                else
+                {
+                    sErrMsg = "鏉$爜瑙f瀽澶辫触,璇风‘璁ゆ潯鐮佹槸鍚︽纭�!";
+                    return false;
+                }
+
+                
+            }
+            catch (Exception e)
+            {
+                sErrMsg = e.Message + ";" + e.StackTrace;
+                return false;
+            }
+        }
+
+        #endregion
+
         #endregion
 
 

--
Gitblit v1.9.1