From 898a695edb40a65c3ab2bfa23ced763bd084e28d Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期五, 28 六月 2024 18:06:46 +0800
Subject: [PATCH] 异常反馈单,保存时,如果抄送为空,就不追加值,增加异常反馈单列表查询
---
WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormImportController.cs | 95 ++++++++++++++++++++++++++++++++++++++---------
1 files changed, 77 insertions(+), 18 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 2406df5..328fade 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"
@@ -55,10 +55,13 @@
tb2.Columns.Add("鍗曟嵁鍙�", typeof(string));
tb2.Columns.Add("HWorkShopID", typeof(Int32));//鐢熶骇杞﹂棿
tb2.Columns.Add("HEmpID", typeof(Int32));//鑱屽憳
+ tb2.Columns.Add("鍛樺伐", typeof(string));//鑱屽憳
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
+ tb2.Columns.Add("HProdORGID", typeof(Int32));//缁勭粐id
+ tb2.Columns.Add("HSeOrderBillNo", typeof(string));//閿�鍞鍗曞彿
//娣诲姞鏁版嵁
for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
@@ -104,8 +107,10 @@
ds = oCN.RunProcReturn(sql1, "h_v_IF_ICMOBillList");
if (ds.Tables[0].Rows.Count == 0)
+ {
error += $"娌℃湁鐢熶骇璁㈠崟淇℃伅锛岀敓浜ц鍗曞彿:{ tb2.Rows[i]["鐢熶骇璁㈠崟鍙�*"].ToString()},鐢熶骇杞﹂棿缂栫爜:{tb2.Rows[i]["鐢熶骇杞﹂棿缂栫爜*"].ToString()}" +
- $",鐢熶骇璁㈠崟鏄庣粏琛屽彿:{ tb2.Rows[i]["鐢熶骇璁㈠崟鏄庣粏琛屽彿*"].ToString()},鐗╂枡缂栫爜:{ tb2.Rows[i]["鐗╂枡缂栫爜*"].ToString()}";
+ $",鐢熶骇璁㈠崟鏄庣粏琛屽彿:{ tb2.Rows[i]["鐢熶骇璁㈠崟鏄庣粏琛屽彿*"].ToString()},鐗╂枡缂栫爜:{ tb2.Rows[i]["鐗╂枡缂栫爜*"].ToString()}";
+ }
if (error.Length > 0)
{
@@ -124,6 +129,7 @@
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();//鐢熶骇璁㈠崟鏁伴噺
+ tb2.Rows[i]["HSeOrderBillNo"] = ds.Tables[0].Rows[0]["閿�鍞鍗曞彿"].ToString();//閿�鍞鍗曞彿
}
ds = oCN.RunProcReturn("select * from h_v_JIT_Sc_WorkBillSortBillList " +
@@ -141,6 +147,7 @@
tb2.Rows[i]["HSourceID"] = ds.Tables[0].Rows[0]["HSourceID"].ToString();
tb2.Rows[i]["HEmpID"] = ds.Tables[0].Rows[0]["HEmpID"].ToString();
tb2.Rows[i]["鍛樺伐缂栫爜"] = ds.Tables[0].Rows[0]["鑱屽憳浠g爜"].ToString();
+ tb2.Rows[i]["鍛樺伐"] = ds.Tables[0].Rows[0]["鑱屽憳"].ToString();
tb2.Rows[i]["HUnitID"] = ds.Tables[0].Rows[0]["HUnitID"].ToString();
tb2.Rows[i]["璁¢噺鍗曚綅"] = ds.Tables[0].Rows[0]["璁¢噺鍗曚綅"].ToString();
tb2.Rows[i]["鎵规鍙�"] = ds.Tables[0].Rows[0]["鎵规"].ToString();
@@ -151,18 +158,61 @@
{
//鍛樺伐
ds = oCN.RunProcReturn($"select * from Gy_Employee where HNumber='{tb2.Rows[i]["鍛樺伐缂栫爜"].ToString()}'", "Gy_Employee");
- if (ds.Tables[0].Rows.Count > 0)
- tb2.Rows[i]["鍛樺伐缂栫爜"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+ if (ds.Tables[0].Rows.Count > 0) {
+ tb2.Rows[i]["HEmpID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+ tb2.Rows[i]["鍛樺伐"] = ds.Tables[0].Rows[0]["HName"].ToString();
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = $"绗瑊i + 1}琛�,鍛樺伐鏌ユ棤鏁版嵁!";
+ objJsonResult.data = tb2;
+ return objJsonResult;
+ }
//璁¢噺鍗曚綅
ds = oCN.RunProcReturn($"select * from Gy_Unit where HNumber='{tb2.Rows[i]["璁¢噺鍗曚綅"].ToString()}'", "Gy_Unit");
if (ds.Tables[0].Rows.Count > 0)
+ {
tb2.Rows[i]["HUnitID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = $"绗瑊i + 1}琛�,璁¢噺鍗曚綅鏌ユ棤鏁版嵁!";
+ objJsonResult.data = tb2;
+ return objJsonResult;
+ }
//鐢熶骇璧勬簮
ds = oCN.RunProcReturn($"select * from Gy_Source where HNumber='{tb2.Rows[i]["鐢熶骇璧勬簮缂栫爜*"].ToString()}'", "Gy_Source");
if (ds.Tables[0].Rows.Count > 0)
+ {
tb2.Rows[i]["HSourceID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+ }
+ else {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = $"绗瑊i+1}琛�,鐢熶骇璧勬簮鏌ユ棤鏁版嵁!";
+ objJsonResult.data = tb2;
+ return objJsonResult;
+ }
+ }
+ //缁勭粐
+ ds = oCN.RunProcReturn($"select * from Xt_ORGANIZATIONS where HNumber='{tb2.Rows[i]["缁勭粐缂栫爜*"].ToString()}'", "Xt_ORGANIZATIONS");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ tb2.Rows[i]["HProdORGID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = $"绗瑊i + 1}琛�,缁勭粐鏌ユ棤鏁版嵁!";
+ objJsonResult.data = tb2;
+ return objJsonResult;
}
}
@@ -245,10 +295,11 @@
}
- int TrueCount = 0, SumCount = 0;
+
for (int i = 0; i < list.Count; i++)
{
+ int TrueCount = 0, SumCount = 0;
long HInterID = 0;
var HBillNo = "";
if (list[i]["鍗曟嵁鍙�"].ToString() == "" && list[i]["hmainid"].ToString() == "")
@@ -257,6 +308,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]["HProdORGID"].ToString();
var HWorkShopID = list[i]["HWorkShopID"].ToString();
var HSourceID = list[i]["HSourceID"].ToString();
var HYX = list[i]["浼樺厛绾�"].ToString();
@@ -273,9 +325,12 @@
var HDate = omdelMian.HDate;
var HMainSourceInterID = list[i]["ICMOBillHInterID"].ToString();
var HMainSourceEntryID = list[i]["ICMOBillHEntryID"].ToString();
+ var HSeOrderBillNo = list[i]["HSeOrderBillNo"].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");
+ string sql = $"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
+ $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}";
+ LogService.Write("sql:" + sql);
+ ds = oCN.RunProcReturn(sql, "Sc_WorkBillSortBillMain");
if (ds.Tables[0].Rows.Count > 0)
{
objJsonResult.code = "0";
@@ -291,19 +346,23 @@
"HICMOEntrySEQ,HWorkShopID,HSourceID, HYX, HEmpID," +
" HMaterID, HMaterName, HMaterModel, HUnitID, HBatchNo," +
" HSeOrderBillQty, HPlanQty, HCompleteQty,HPreparatDate," +
- "HMainSourceInterID,HMainSourceEntryID)values" +
+ "HMainSourceInterID,HMainSourceEntryID,HProdORGID,HICMOInterID_Sec,HICMOEntryID_Sec" +
+ ",HSeOrderBillNo)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)}, {(HPlanQty == "" ? 0.ToString() : HPlanQty)}, {(HCompleteQty == "" ? 0.ToString() : HCompleteQty)},getdate()," +
- $" {HMainSourceInterID},{HMainSourceEntryID})");
+ $" {HMainSourceInterID},{HMainSourceEntryID},{HProdORGID}, {HMainSourceInterID},{HMainSourceEntryID}" +
+ $",'{HSeOrderBillNo}')");
}
int SumDay = 31; //鍔ㄦ�佷袱鏈堜箣宸� DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days;
for (int j = 0; j < SumDay; j++)
{
+ LogService.Write("1:" + list[i][DateTime.Now.AddDays(j).ToString("yyyy-MM-dd")].ToString());
+ LogService.Write("2:" + DateTime.Now.AddDays(j).ToString("yyyy-MM-dd"));
//涓昏〃瀛愯〃閮芥湁鏁版嵁
if (list[i][DateTime.Now.AddDays(j).ToString("yyyy-MM-dd")].ToString() != "")
{
@@ -325,16 +384,17 @@
objJsonResult = AddBillSub(HInterID.ToString(), HBillNo, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd").ToString()), 0);
}
}
+ if (TrueCount != SumCount)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
}
- if (TrueCount != SumCount)
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = objJsonResult.Message;
- objJsonResult.data = null;
- return objJsonResult;
- }
+
objJsonResult.code = "1";
objJsonResult.count = 1;
@@ -356,7 +416,6 @@
{
//鑾峰彇琛ㄦ牸鏁版嵁
ds = oCN.RunProcReturn($"select * from h_v_JIT_Sc_WorkBillSortBillList where 鍗曟嵁鍙�='{HBillNo}'", "h_v_JIT_Sc_WorkBillSortBillList");
-
int count = 0;
if (ds.Tables[0].Rows.Count > 0)
{
@@ -375,7 +434,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