From 7bd73b5076dd3256e7c28187016e4b5c73d08e2c Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期二, 21 十月 2025 09:31:02 +0800
Subject: [PATCH] excel导入送货信息;条码保存时生产日期、有效期调整
---
WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs | 55 ++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 38 insertions(+), 17 deletions(-)
diff --git a/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs b/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs
index 4eeceed..ec627f1 100644
--- a/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs
+++ b/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs
@@ -94,8 +94,10 @@
string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
string msg2 = sArray[0].ToString();//
string msg3 = sArray[1].ToString();//
- string UserName = "";
+ string UserName = sArray[2].ToString();
+ string OrganizationID = sArray[3].ToString();
ListModels oListModels = new ListModels();
+ string error = "";
try
{
#region 鑾峰彇鐢ㄦ埛浠ュ強鐩稿叧鍙傛暟
@@ -104,10 +106,11 @@
msg2 = msg2.Replace("\n", ""); //\n
lsmain = oListModels.getObjectByJson_MaterialHanding(msg2);
int get_BarCodecount = 0;
+
foreach (Model.Cls_MaterialHandingModel oItem in lsmain)
{
get_BarCodecount++;
- UserName = oItem.HMaker;
+ //UserName = oItem.HMaker;
}
DAL.ClsWeb_BarCodeBill oBill = new DAL.ClsWeb_BarCodeBill();
msg3 = msg3.Substring(1, msg3.Length - 2);
@@ -118,6 +121,14 @@
ls = oListModels.getObjectByJson_BarCodeBill(msg3);//鍒楄〃鏁版嵁model
+ if (ls.Count > 1)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姣忔鍙厑璁搁�夋嫨涓�涓墿鏂欑敓鎴愭潯鐮侊紝璇烽��鍑洪噸鏂伴�夋嫨涓�琛岀墿鏂欙紝涓嶅厑璁搁�夋嫨澶氳鐗╂枡锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
#region 鏁版嵁鍑嗗
long linterid = Pub_Class.ClsPub.CreateBillID_SRMProd("8888", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -137,8 +148,12 @@
string HKFDate= ls[0].HKFDQDate==null? DateTime.Now.ToString("yyyy/MM/dd"): ls[0].HKFDQDate;//鐢熶骇鏃ユ湡
string HKFDate_1 = string.Join("", HKFDate.Split('/').Select(x => x.PadLeft(2, '0')));
double HMinQty= ls[0].HMinQty;//鏍囧噯鍖呰鏁�
+ string HStatusMan = ls[0].HStatusMan;//宸ュ彿
+ //string HBarCodeDate = ls[0].HBarCodeDate;//宸ュ彿
+ string HBarCodeDate = ls[0].HBarCodeDate == null ? DateTime.Now.ToString("yyyy/MM/dd") : ls[0].HBarCodeDate;//鏉$爜鏃ユ湡
+ string HBarCodeDate_1 = string.Join("", HBarCodeDate.Split('-').Select(x => x.PadLeft(2, '0')));
- double HBQty= ls[0].HBQty;//鏈�灏忓寘瑁呮暟
+ double HBQty = ls[0].HBQty;//鏈�灏忓寘瑁呮暟
long HISKFPERIOD= ls[0].HISKFPERIOD;//鏄惁鍚敤淇濊川鏈�
long HBatchManager= ls[0].HBatchManager;//鏄惁鍚敤鎵瑰彿
@@ -151,8 +166,7 @@
string HMaterShortNumber = ls[0].HMaterShortNumber;
string HMaterName = ls[0].HMaterName;
//渚涘簲鍟�
- long HSupID= ls[0].HSupID;
- string HSupName= ls[0].HSupName;
+ long HSupID = lsmain[0].HSupID;
string HMaker= ls[0].HMaker;
DateTime HMakeDate= ls[0].HMakeDate;
double HQty= ls[0].HQty; //鏈鐢熸垚鏉$爜鏁伴噺
@@ -161,7 +175,8 @@
DataSet Ds;
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
oCn.BeginTran();
- Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH");
+ //Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH");
+ Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HSupID+"_"+ HMaterID+"_" + HBarCodeDate + "'", "GetLSH");
LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
#endregion
@@ -209,10 +224,10 @@
: HMinQty;
///渚涘簲鍟嗗悕绉�+@+鐗╂枡浠g爜+@+鐗╂枡绠�绉�+@+鏁伴噺+@鏉$爜鏁�+@+鏃ユ湡+@+娴佹按鍙�
LSH += 1;
- TM = $"{oItemSub.HSupName}@{oItemSub.HMaterID}@{oItemSub.HMaterName}@{currentQty}@{HKFDate_1}@{LSH}";
+ TM = $"{oItemSub.HSupName}@{oItemSub.HMaterNumber}@{oItemSub.HSubjoin}@{currentQty}@{HBarCodeDate_1}@{LSH.ToString("D7")}";
//TM = $"{oItemSub.HSupName}@{oItemSub.HMaterID}@{oItemSub.HMaterName}@{oItemSub.biaoqianzhangshu}@{HKFDate_1}@{LSH}";
// 娣诲姞鍒扮敓鎴愮殑鏉$爜鍒楄〃
- generatedBarcodes.Add(TM);
+ //generatedBarcodes.Add(TM);
Model.ClsGy_BarCodeBill_WMS_Model bar = new Model.ClsGy_BarCodeBill_WMS_Model();
// var HBarCode_verify = TM.Split('@'); //鏍¢獙鏉$爜淇℃伅
@@ -239,15 +254,20 @@
// + HKFDate + "','" + HKFDQDate + "'," + HISKFPERIOD + ")";
sql = "INSERT INTO Gy_BarCodeBill (HInterID, HBarCode, HBarCodeType, HMaterID, HUnitID, HQty, HKFDate, HKFPeriod, HKFDQDate, " +
"HBatchNo, HBarcodeQtys, HBarcodeNo, HSupID, HGroupID, HMaker, HMakeDate, HPrintQty, HEndQty, HSupflag, " +
- "HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HMTONO, HProduceDate, HExpiryDate, HISKFPERIOD) " +
+ "HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HMTONO, HISKFPERIOD,HStatusMan,HBarCodeDate,HinitQty,HSTOCKORGID,HOWNERID) " +
"VALUES (" +
- linterid.ToString() + ", '" + TM + "', '" + HBarCodeType + "', " + HMaterID + ", " + "0" + ", " + HQty + ", '" + HKFDate + "', " + HKFPeriod + ", '" + HKFDQDate + "', " +
- "'" + HBatchNo + "', " + get_BarCodecount + ", '" + virtualCount + "', " + HSupID + ", " + "0" + ", '" + ClsPub.CurUserName + "', '" + DateTime.Today.ToString("yyyy-MM-dd") + "', " + "1" + ", " + "0" + ", 1, " +
- "1, 1, '1', '" + HSourceBillType + "', '1', '" +
- HKFDate + "', '" + HKFDQDate + "', " + HISKFPERIOD + ")";
+ linterid.ToString() + ", '" + TM + "', '" + HBarCodeType + "', " + HMaterID + ", " + "0" + ", " + currentQty + ", '" + null + "', " + HKFPeriod + ", '" + null + "', '"
+ + HBatchNo + "', " + get_BarCodecount + ", '" + virtualCount + "', " + HSupID + ", " + "0" + ", '" + UserName + "',getdate()" + "," + "0" + ", " + "0" + ", 1, " +
+ "0, 0, '', '" + HSourceBillType + "', ''," +
+ HISKFPERIOD + ",'" + HStatusMan + "','" + HBarCodeDate + "','" + currentQty + "'," + OrganizationID + "," + OrganizationID + ")";
LogService.Write("鐢熸垚鏉$爜锛� " + sql);
oCn.RunProc(sql);
- oCn.RunProc("exec setLSH '" + DateTime.Today + "'");
+
+ DataSet getID = oCn.RunProcReturn("select HitemID from Gy_BarCodeBill with(nolock) where HBarCode='" + TM + "'", "Gy_BarCodeBill");
+ var getBarCodeID = (getID.Tables[0].Rows[0]["HitemID"]).ToString();
+ generatedBarcodes.Add(getBarCodeID);
+
+ oCn.RunProc("exec h_p_WMS_SetMaxNo '" + HSupID + "_" + HMaterID + "_" + HBarCodeDate + "'");
virtualCount++;
}
@@ -258,7 +278,7 @@
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "鐢熸垚鏉$爜鎴愬姛锛�";
- objJsonResult.data = generatedBarcodes; // 杩斿洖鐢熸垚鐨勬潯鐮佸垪琛�
+ objJsonResult.data =string.Join("~", generatedBarcodes); // 杩斿洖鐢熸垚鐨勬潯鐮佸垪琛�
WebAPIController.Add_Log("鏉$爜涓嬫帹", UserName, "鐢熸垚鏉$爜");
return objJsonResult;
}
@@ -342,7 +362,7 @@
}
// 灏嗛�楀彿鍒嗛殧鐨勬潯鐮佽浆鎹负SQL IN鏌ヨ鏉′欢
- var barcodeList = barcodes.Split(',');
+ var barcodeList = barcodes.Split('~');
// 鏋勫缓IN瀛愬彞锛屼负姣忎釜鏉$爜娣诲姞鍗曞紩鍙�
var inValues = new List<string>();
@@ -352,7 +372,8 @@
}
string inClause = string.Join(",", inValues);
- string sql = $"SELECT * FROM h_v_Gy_UserMaterRelationPrint WHERE HBarCode IN ({inClause})";
+
+ string sql = $"SELECT * FROM h_v_Gy_UserMaterRelationPrint WHERE HBarItemID IN ({inClause})" + " order by 鐗╂枡浠g爜,cast(娴佹按鍙� as int)";
// 鐩存帴鎵цSQL鏌ヨ
DataSet ds = oCn.RunProcReturn(sql, "h_v_Gy_UserMaterRelationPrint");
--
Gitblit v1.9.1