From c7a507c5d77652d5ceb722ff032f68514d369deb Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期二, 24 九月 2024 10:02:17 +0800 Subject: [PATCH] 收料通知单同步双计量单位;打印模板设置;json版本 --- WebAPI/Controllers/BarCodeController.cs | 77 ++++++++++++++++++++++++++++++-------- 1 files changed, 60 insertions(+), 17 deletions(-) diff --git a/WebAPI/Controllers/BarCodeController.cs b/WebAPI/Controllers/BarCodeController.cs index fe0ca61..b2a2bcf 100644 --- a/WebAPI/Controllers/BarCodeController.cs +++ b/WebAPI/Controllers/BarCodeController.cs @@ -23,7 +23,7 @@ { private JsonResult objJsonResult = new JsonResult(); private json objjson = new json(); - public new ClsCNSRM oCn = new ClsCNSRM(); + public new ClsCN oCn = new ClsCN(); //鑾峰彇绯荤粺鍙傛暟 Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); public T ScriptDeserialize<T>(string strJson) @@ -47,7 +47,7 @@ string msg1 = _value.ToString(); try { - SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM(); + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); oCn.RunProc("exec H_p_SRM_BarCodeBill_PrintQty '" + msg1 + "'"); objJsonResult.code = "0"; objJsonResult.count = 0; @@ -132,7 +132,7 @@ string WeiShu = ""; //灏炬暟 //string sKFDate = DateTime.Now.ToString("yyyy-MM-dd"); DataSet Ds; - SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM(); + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls) { if (ClsPub.isLong(oItemSub.HMaterID) != 0) @@ -339,7 +339,7 @@ string WeiShu = ""; //灏炬暟 //string sKFDate = DateTime.Now.ToString("yyyy-MM-dd"); DataSet Ds; - SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM(); + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH"); LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]); foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls) @@ -551,7 +551,7 @@ string sDay = ""; //鏃� string WeiShu = ""; //灏炬暟 DataSet Ds; - SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM(); + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH"); LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]); foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls) @@ -585,7 +585,7 @@ TM = "0" + TM; } //TM = "B" + TM; - TM = "SRM" + "B" + TM; + TM = "SRM" + "B" + TM; if (HSumQty - HMinQty > 0) { @@ -604,6 +604,13 @@ } HMinQty = HSumQty; } + + if (FCusName.Contains("娣诲悍绉戞妧")) + { + //澶栫鎵规鏉$爜瑙勫垯锛歋RMB+缁勭粐+鏂欏彿+鎵规+锛�+鏁伴噺 + TM = "SRMB" + "100" + oItemSub.HMaterNumber + oItemSub.HBatchNo + "锛�" + HMinQty; + } + Model.ClsGy_BarCodeBill_WMS_Model bar = new Model.ClsGy_BarCodeBill_WMS_Model(); bar.HBarCode = TM; bar.HMaterID = oItemSub.HMaterID; @@ -632,6 +639,7 @@ bar.HSupBatchNo = oItemSub.HSupBatchNo; bar.HSupMaterNumber = oItemSub.HSupMaterNumber; bar.HISKFPERIOD = oItemSub.HISKFPERIOD; + bar.HMaterNumber = oItemSub.HMaterNumber; ls2.Add(bar); } } @@ -697,8 +705,19 @@ { TM2 = "0" + TM2; } - bar2.HMaterID = oItemSub2.HMaterID; - bar2.HBarCode = oItemSub2.HBarCode + "-" + TM2; + + if (FCusName.Contains("娣诲悍绉戞妧")) + { + //鍐呯鎵规鏉$爜瑙勫垯锛歋RM+缁勭粐+鏂欏彿+鎵规+锛�+鏁伴噺 + TM2 = "SRM" + "100" + oItemSub2.HMaterNumber + oItemSub2.HBatchNo + "锛�" + HWXQty; + bar2.HBarCode = TM2; + } + else + { + bar2.HBarCode = oItemSub2.HBarCode + "-" + TM2; + } + + bar2.HMaterID = oItemSub2.HMaterID; bar2.HUnitID = oItemSub2.HUnitID; bar2.HQty = HWXQty; bar2.HBatchNo = DBUtility.ClsPub.isStrNull(oItemSub2.HBatchNo); @@ -779,6 +798,12 @@ HBarCode = $"{oItemSub.HMaterID}"; HBarCodeType = "鍝佺鐮乢澶栫"; } + + if (FCusName.Contains("娣诲悍绉戞妧")) + { + //HBarCodeType = "鎵规鏉$爜"; + } + string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" + ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO,HSupBatchNo,HSupMaterNumber,HProduceDate,HExpiryDate,HISKFPERIOD " + @@ -823,6 +848,12 @@ HBarCode = $"{oItemSub.HMaterID}"; HBarCodeType = "鍝佺鐮�"; } + + if (FCusName.Contains("娣诲悍绉戞妧")) + { + //HBarCodeType = "鎵规鏉$爜"; + } + string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" + ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO ,HSupBatchNo,HSupMaterNumber,HProduceDate,HExpiryDate,HISKFPERIOD" + @@ -927,7 +958,7 @@ string sPeriod = ""; //鏈� string sDay = ""; //鏃� DataSet Ds; - SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM(); + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH"); LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]); foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls) @@ -1375,7 +1406,7 @@ { string VsWhere = ""; string PcWhere = ""; - SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM(); + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DataSet ds; string sql = " Where hsupid in (select HSupID from h_v_Gy_UserSupplierList where 鐢ㄦ埛=''" + HSupNo.Trim() + "'') " + sqlWhere; @@ -1395,7 +1426,7 @@ { objjson.code = "0"; objjson.count = 0; - objjson.Message = "鑾峰彇澶辫触"; + objjson.Message = "鏃犵浉鍏虫潯鐮佷俊鎭紒"; objjson.data = null; return objjson; } @@ -1596,7 +1627,7 @@ string sDay = ""; //鏃� string WeiShu = ""; //灏炬暟 DataSet Ds; - SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM(); + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); oCn.BeginTran(); Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH"); LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]); @@ -1873,6 +1904,7 @@ + "','" + HBatchNo + "','" + SubModel.Count + "','" + count + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1" + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "','" + HKFDate + "','" + HKFDQDate + "'," + HISKFPERIOD + ")"; + LogService.Write("鐢熸垚澶栫鏉$爜锛� " + sql); oCn.RunProc(sql); oCn.RunProc("exec setLSH '" + DateTime.Today + "'"); count++; @@ -1919,6 +1951,7 @@ + "','" + HBatchNo + "','" + SubModel.Count + "','" + _count + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1" + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "','" + HKFDate + "','" + HKFDQDate + "'," + HISKFPERIOD + ")"; + LogService.Write("鐢熸垚鍐呯鏉$爜锛� "+ sql); oCn.RunProc(sql); _count++; } @@ -1951,6 +1984,7 @@ } catch (Exception e) { + LogService.Write("鐢熸垚鏉$爜鍙戠敓閿欒锛� " + e); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "" + e.Message + DBUtility.ClsPub.sExeReturnInfo; @@ -2105,11 +2139,20 @@ oCN.RunProc($"update Cg_POOrderBillSub set HBarcodeCount -= {dr["HQty"]} where HInterID ={dr["HSourceInterID"]} and HEntryID ={dr["HSourceEntryID"]}"); //鍙嶅啓鎵撳嵃鏁伴噺鍒板澶栬鍗� if (dr["HBarCodeType"].ToString() == "绠卞彿鍐呮潯鐮�" && dr["HSourceBillType"].ToString() == "1601") - oCN.RunProc($"update WW_EntrustOrderBillSub set HBarcodeCount -= {dr["HQty"]} where HInterID ={dr["HSourceInterID"]} and HEntryID ={dr["HSourceEntryID"]}"); - //鍙嶅啓鎵撳嵃鏁伴噺鍒伴�佽揣鍗� 锛堜笉闇�瑕佸弽鍐� 閫佽揣鍗曠洿鎺ユ槸鍏宠仈鏌ヨ鍙栫殑鏁伴噺 娌℃湁鍦ㄦ簮鍗曚笂鍋氫繚瀛橈級 - if (dr["HSourceBillType"].ToString() == "1103") - oCN.RunProc("Delete From Gy_BarCodeBill where HItemID in(" + dr["HItemID"] + ") "); - //oCN.RunProc($"update WW_EntrustOrderBillSub set HBarcodeCount -= {dr["HQty"]} where HInterID ={dr["HSourceInterID"]} and HEntryID ={dr["HSourceEntryID"]}"); + oCN.RunProc($"update WW_EntrustOrderBillSub set HBarcodeCount -= {dr["HQty"]} where HInterID ={dr["HSourceInterID"]} and HEntryID ={dr["HSourceEntryID"]}"); + if (FCusName.Contains("娣诲悍绉戞妧")) + { + _HBarCodeType = "绠卞彿鍐呮潯鐮�"; + if (dr["HSourceBillType"].ToString() == "1103" && dr["HBarCodeType"].ToString() == _HBarCodeType) + oCN.RunProc($"update Cg_POInStockBillSub set HRelationBarCodeQty -= {dr["HQty"]} where HInterID ={dr["HSourceInterID"]} and HEntryID ={dr["HSourceEntryID"]}"); + } + else + { + //鍙嶅啓鎵撳嵃鏁伴噺鍒伴�佽揣鍗� 锛堜笉闇�瑕佸弽鍐� 閫佽揣鍗曠洿鎺ユ槸鍏宠仈鏌ヨ鍙栫殑鏁伴噺 娌℃湁鍦ㄦ簮鍗曚笂鍋氫繚瀛橈級 + if (dr["HSourceBillType"].ToString() == "1103") + oCN.RunProc("Delete From Gy_BarCodeBill where HItemID in(" + dr["HItemID"] + ") "); + //oCN.RunProc($"update WW_EntrustOrderBillSub set HBarcodeCount -= {dr["HQty"]} where HInterID ={dr["HSourceInterID"]} and HEntryID ={dr["HSourceEntryID"]}"); + } } } oCN.RunProc("Delete From Gy_BarCodeBill where HItemID in(" + HInterID + ") "); -- Gitblit v1.9.1