From 771c05f5c956fe8f057ca31f6d2ed6661fa17602 Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期二, 07 二月 2023 15:56:42 +0800
Subject: [PATCH] 新增WIP系统参数,工序末道入库仓库取值类型
---
WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormImportController.cs | 41 ++++++++++++++++++++++++++++++++---------
1 files changed, 32 insertions(+), 9 deletions(-)
diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormImportController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormImportController.cs"
index c59a86a..aaa2eef 100644
--- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormImportController.cs"
+++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormImportController.cs"
@@ -36,14 +36,13 @@
file.SaveAs(ExcelPath);
NpoiHelper np = new NpoiHelper();
- DataSet ExcelDs = np.ReadExcel(ExcelPath, 1);
+ DataSet ExcelDs = np.ReadExcel(ExcelPath, 1,1,"0");
//鍒犻櫎鏂囦欢
File.Delete(ExcelPath);
//鍒涘缓涓存椂琛�
DataTable tb2 = new DataTable("dt2");
- DataTable tb3 = new DataTable("dt3");
//娣诲姞鍒楀悕
for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++)
@@ -58,6 +57,8 @@
tb2.Columns.Add("HEmpID", typeof(Int32));//鑱屽憳
tb2.Columns.Add("HUnitID", typeof(Int32));//璁¢噺鍗曚綅
tb2.Columns.Add("HSourceID", typeof(Int32));//鐢熶骇璧勬簮id
+ tb2.Columns.Add("ICMOBillHInterID", typeof(Int32));//鐢熶骇璁㈠崟涓籭d
+ tb2.Columns.Add("ICMOBillHEntryID", typeof(Int32));//鐢熶骇璁㈠崟瀛恑d
//娣诲姞鏁版嵁
for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
@@ -69,8 +70,6 @@
}
tb2.Rows.Add(row);
}
-
- ExcelDs.Tables.Add(tb2);
var error = "";
var ErrorResult = "";
@@ -122,6 +121,9 @@
tb2.Rows[i]["鐗╂枡鍚嶇О"] = ds.Tables[0].Rows[0]["浜у搧鍚嶇О"].ToString();
tb2.Rows[i]["瑙勬牸鍨嬪彿"] = ds.Tables[0].Rows[0]["瑙勬牸鍨嬪彿"].ToString();
tb2.Rows[i]["HWorkShopID"] = ds.Tables[0].Rows[0]["HDeptID"].ToString();
+ tb2.Rows[i]["ICMOBillHInterID"] = ds.Tables[0].Rows[0]["hmainid"].ToString();//鐢熶骇璁㈠崟涓籭d
+ tb2.Rows[i]["ICMOBillHEntryID"] = ds.Tables[0].Rows[0]["HEntryID"].ToString();//鐢熶骇璁㈠崟瀛恑d
+ tb2.Rows[i]["鐢熶骇璁㈠崟鏁伴噺"] = ds.Tables[0].Rows[0]["鐢熶骇浠诲姟鍗曟暟閲�"].ToString();//鐢熶骇璁㈠崟鏁伴噺
}
ds = oCN.RunProcReturn("select * from h_v_JIT_Sc_WorkBillSortBillList " +
@@ -143,7 +145,6 @@
tb2.Rows[i]["璁¢噺鍗曚綅"] = ds.Tables[0].Rows[0]["璁¢噺鍗曚綅"].ToString();
tb2.Rows[i]["鎵规鍙�"] = ds.Tables[0].Rows[0]["鎵规"].ToString();
tb2.Rows[i]["閿�鍞鍗曟暟閲�"] = ds.Tables[0].Rows[0]["閿�鍞鍗曟暟閲�"].ToString();
- tb2.Rows[i]["鐢熶骇璁㈠崟鏁伴噺"] = ds.Tables[0].Rows[0]["璁㈠崟闇�姹傛暟閲�"].ToString();
tb2.Rows[i]["鎬婚綈濂楁暟閲�"] = ds.Tables[0].Rows[0]["榻愬鏁伴噺"].ToString();
}
else
@@ -256,6 +257,7 @@
HInterID = DBUtility.ClsPub.CreateBillID_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo);//鑾峰緱涓�涓柊鐨刬d
var HICMOBillNo = list[i]["鐢熶骇璁㈠崟鍙�*"].ToString();
var HICMOEntrySEQ = list[i]["鐢熶骇璁㈠崟鏄庣粏琛屽彿*"].ToString();
+ var HProdORGID = list[i]["缁勭粐缂栫爜*"].ToString();
var HWorkShopID = list[i]["HWorkShopID"].ToString();
var HSourceID = list[i]["HSourceID"].ToString();
var HYX = list[i]["浼樺厛绾�"].ToString();
@@ -266,28 +268,44 @@
var HUnitID = list[i]["HUnitID"].ToString();
var HBatchNo = list[i]["鎵规鍙�"].ToString();
var HSeOrderBillQty = list[i]["閿�鍞鍗曟暟閲�"].ToString();
- var HOrderNeedQty = list[i]["鐢熶骇璁㈠崟鏁伴噺"].ToString();
+ var HPlanQty = list[i]["鐢熶骇璁㈠崟鏁伴噺"].ToString();
var HCompleteQty = list[i]["鎬婚綈濂楁暟閲�"].ToString();
var HOrderType = omdelMian.HOrderType;
var HDate = omdelMian.HDate;
+ var HMainSourceInterID = list[i]["ICMOBillHInterID"].ToString();
+ var HMainSourceEntryID = list[i]["ICMOBillHEntryID"].ToString();
+
+ ds = oCN.RunProcReturn($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
+ $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愭湁閲嶅,璇蜂慨鏀�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
//涓昏〃
oCN.RunProc("insert into Sc_WorkBillSortBillMain(HInterID,HBillNo,HYear,HPeriod,HBillType," +
"HBillSubType,HDate,HBillStatus,HMaker,HMakeDate,HICMOBillNo,HOrderType," +
"HICMOEntrySEQ,HWorkShopID,HSourceID, HYX, HEmpID," +
" HMaterID, HMaterName, HMaterModel, HUnitID, HBatchNo," +
- " HSeOrderBillQty, HOrderNeedQty, HCompleteQty)values" +
+ " HSeOrderBillQty, HPlanQty, HCompleteQty,HPreparatDate," +
+ "HMainSourceInterID,HMainSourceEntryID,HProdORGID,HICMOInterID_Sec,HICMOEntryID_Sec)values" +
$"({HInterID},'{HBillNo}',{DateTime.Now.Year},{DateTime.Now.Month},'{BillType}'," +
$"'{BillType}',GETDATE(),1,'{user}','{HDate}','{HICMOBillNo}','{HOrderType}'," +
$"{(HICMOEntrySEQ == "" ? 0.ToString() : HICMOEntrySEQ)},{(HWorkShopID == "" ? 0.ToString() : HWorkShopID)},{(HSourceID == "" ? 0.ToString() : HSourceID)}, {(HYX == "" ? 0.ToString() : HYX)}, {(HEmpID == "" ? 0.ToString() : HEmpID)}," +
$" {(HMaterID == "" ? 0.ToString() : HMaterID)}, '{HMaterName}', '{HMaterModel}', {(HUnitID == "" ? 0.ToString() : HUnitID)}, '{HBatchNo}'," +
- $" {(HSeOrderBillQty == "" ? 0.ToString() : HSeOrderBillQty)}, {(HOrderNeedQty == "" ? 0.ToString() : HOrderNeedQty)}, {(HCompleteQty == "" ? 0.ToString() : HCompleteQty)})");
+ $" {(HSeOrderBillQty == "" ? 0.ToString() : HSeOrderBillQty)}, {(HPlanQty == "" ? 0.ToString() : HPlanQty)}, {(HCompleteQty == "" ? 0.ToString() : HCompleteQty)},getdate()," +
+ $" {HMainSourceInterID},{HMainSourceEntryID},{HProdORGID}, {HMainSourceInterID},{HMainSourceEntryID})");
}
int SumDay = 31; //鍔ㄦ�佷袱鏈堜箣宸� DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days;
for (int j = 0; j < SumDay; j++)
{
+ //涓昏〃瀛愯〃閮芥湁鏁版嵁
if (list[i][DateTime.Now.AddDays(j).ToString("yyyy-MM-dd")].ToString() != "")
{
SumCount += 1;
@@ -301,6 +319,11 @@
{
TrueCount += 1;
}
+ }
+ //涓昏〃鏈夋暟鎹� 瀛愯〃鏃犳暟鎹�
+ if (j == 30 && SumCount == 0 && HInterID != 0 && HBillNo != "")
+ {
+ objJsonResult = AddBillSub(HInterID.ToString(), HBillNo, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd").ToString()), 0);
}
}
}
@@ -353,7 +376,7 @@
if (count != 1)
{
//鎻掑叆瀛愯〃
- oCN.RunProc("insert into Sc_WorkBillSortBillSub(HInterID,HEntryID," +
+ oCN.RunProc("insert into Sc_WorkBillSortBillSub(HInterID,HSEQ," +
"HMasterDate,HQty)" +
$"values({HInterID}, {(ds.Tables[0].Rows.Count + 1)}," +
$" '{date}', {HQTY})");
--
Gitblit v1.9.1