From 7d074703a8364c27ca38cbb8f82ebd2f6e85cf22 Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期二, 07 一月 2025 14:46:27 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs | 173 +++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 149 insertions(+), 24 deletions(-)
diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
index c362c5f..d4efe32 100644
--- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
+++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
@@ -98,6 +98,40 @@
return objJsonResult;
}
}
+
+ /// <summary>
+ /// 鏍规嵁鐐瑰嚮琛屾爣棰樻椂闂存煡璇㈢己鏂欏垎鏋�
+ /// </summary>
+ /// <param name="sWhere"></param>
+ /// <param name="user"></param>
+ /// <returns></returns>
+ [Route("JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillHDateTimeList")]
+ [HttpGet]
+ public object JIT_DayPlanPlatFormBillHDateTimeList(string sWhere)
+ {
+ try
+ {
+ MaterialShorAnalysis Report = JsonConvert.DeserializeObject<MaterialShorAnalysis>(sWhere);
+
+ ds = oCN.RunProcReturn($"exec h_p_JIT_MaterialShorAnalysisReportList {Report.HORGID},'{Report.HBEGINDATE}','{Report.HENDDATE}' ", "h_p_JIT_PODemandPlanBill_ReportList");
+
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ //objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
#endregion
#region 鐢熶骇鏃ヨ鍒掑钩鍙� 淇濆瓨
@@ -160,6 +194,10 @@
LogService.CustomWriteLog("2:", DateTime.Now.ToString("yyyy-MM-dd"));
int TrueCount = 0, SumCount = 0;
+ LogService.CustomWriteLog("list.Count:"+ list.Count, DateTime.Now.ToString("yyyy-MM-dd"));
+
+ string sReturn = "";
+ oSystemParameter.ShowBill(ref sReturn);
for (int i = 0; i < list.Count; i++)
{
@@ -169,6 +207,7 @@
var HBillNo = "";
if (list[i]["鍗曟嵁鍙�"].ToString() == "" && list[i]["hmainid"].ToString() == "")
{
+ LogService.CustomWriteLog("2.01:" + i, DateTime.Now.ToString("yyyy-MM-dd"));
var HICMOBillNo = list[i]["鐢熶骇璁㈠崟鍙�"].ToString();
var HOrderType = list[i]["璁㈠崟绫诲瀷"].ToString();
var HICMOEntrySEQ = list[i]["鐢熶骇璁㈠崟鏄庣粏琛屽彿"].ToString();
@@ -178,7 +217,7 @@
var HProdORGID = list[i]["HProdORGID"].ToString();
var HMaterID = list[i]["HMaterID"].ToString();
var HMaterName = list[i]["鐗╂枡鍚嶇О"].ToString();
- var HMaterModel = list[i]["瑙勬牸鍨嬪彿"].ToString();
+ var HMaterModel = list[i]["瑙勬牸鍨嬪彿"].ToString().Replace("'", "''");
var HUnitID = list[i]["HUnitID"].ToString();
var HSeOrderBillQty = list[i]["閿�鍞鍗曟暟閲�"].ToString();
//var HOrderNeedQty = list[i]["璁㈠崟闇�姹傛暟閲�"].ToString();
@@ -194,17 +233,24 @@
var HMainSourceInterID = list[i]["婧愬崟涓诲唴鐮�"].ToString();
var HMainSourceEntryID = list[i]["婧愬崟瀛愬唴鐮�"].ToString();
var HPlanQty = list[i]["璁″垝鏁伴噺"].ToString();
+ var HEmpID = list[i]["HEmpID"].ToString();
+ var HWorkQty = list[i]["灏忔椂浜ц兘"].ToString();
- if (HSourceID == ""|| HSourceID == "0")
+ LogService.CustomWriteLog("2.05:" + i, DateTime.Now.ToString("yyyy-MM-dd"));
+
+ if (oSystemParameter.omodel.WMS_CampanyName != "娣诲悍绉戞妧") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤
{
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愪笉鑳戒负绌�!";
- objJsonResult.data = null;
- return objJsonResult;
- }
+ if (HSourceID == "" || HSourceID == "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愪笉鑳戒负绌�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
- ds = oCN.RunProcReturn($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
+ 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)
{
@@ -226,7 +272,7 @@
" HOrderNeedQty, HSplitQty, HDayPlanSumQty,HPlanBeginDate," +
"HSeOrderBillNo,HICMOBillType,HSourceStockInQty,HLeftPlanQty,HOrderLev,HPreparatDate," +
"HMainSourceInterID,HMainSourceEntryID,HICMOInterID_Sec,HICMOEntryID_Sec,HPlanQty" +
- ",HICMOInterID,HICMOEntryID,HPlanEndDate)values" +
+ ",HICMOInterID,HICMOEntryID,HPlanEndDate,HEmpID,HWorkQty)values" +
$"({HInterID},'{HBillNo}',{DateTime.Now.Year},{DateTime.Now.Month},'{BillType}'," +
$"'{BillType}',GETDATE(),1,'{user}',getdate(),'{HICMOBillNo}','{HOrderType}'," +
$"{(HICMOEntrySEQ == "" ? 0.ToString() : HICMOEntrySEQ)},{(HWorkShopID == "" ? 0.ToString() : HWorkShopID)},{(HSourceID == "" ? 0.ToString() : HSourceID)}, {(HYX == "" ? 0.ToString() : HYX)}, {(HProdORGID == "" ? 0.ToString() : HProdORGID)}," +
@@ -234,7 +280,7 @@
$" 0, {(HSplitQty == "" ? 0.ToString() : HSplitQty)}, {(HDayPlanSumQty == "" ? 0.ToString() : HDayPlanSumQty)},'{HPlanBeginDate}'," +
$"'{HSeOrderBillNo}','{HICMOBillType}',{(HSourceStockInQty == "" ? 0.ToString() : HSourceStockInQty)},{(HLeftPlanQty == "" ? 0.ToString() : HLeftPlanQty)},'{HOrderLev}',getdate()," +
$"{HMainSourceInterID},{HMainSourceEntryID},{HMainSourceInterID},{HMainSourceEntryID},{HPlanQty}," +
- $"{HMainSourceInterID},{HMainSourceEntryID},'{HPlanEndDate}')";
+ $"{HMainSourceInterID},{HMainSourceEntryID},'{HPlanEndDate}','{HEmpID}','{HWorkQty}')";
//LogService.Write("sql:" + sql);
//涓昏〃
@@ -242,6 +288,7 @@
}
else
{
+ LogService.CustomWriteLog("2.0:" + i, DateTime.Now.ToString("yyyy-MM-dd"));
HBillNo = list[i]["鍗曟嵁鍙�"].ToString();
HInterID = int.Parse(list[i]["hmainid"].ToString());
var HMainSourceInterID = list[i]["婧愬崟涓诲唴鐮�"].ToString();
@@ -260,14 +307,20 @@
var HPlanEndDate = list[i]["璁″垝缁撴潫鏃ユ湡"].ToString();
var HSplitQty = list[i]["鎷嗗崟鏁伴噺"].ToString();
- if (HSourceID == "" || HSourceID == "0")
+ LogService.CustomWriteLog("2.1:"+i, DateTime.Now.ToString("yyyy-MM-dd"));
+
+ if (oSystemParameter.omodel.WMS_CampanyName != "娣诲悍绉戞妧") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤
{
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愪笉鑳戒负绌�!";
- objJsonResult.data = null;
- return objJsonResult;
+ if (HSourceID == "" || HSourceID == "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愪笉鑳戒负绌�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
}
+
var str = 0;
if (!int.TryParse(HYX, out str))
{
@@ -283,12 +336,16 @@
if (ds.Tables[0].Rows.Count > 1)
{
+ LogService.CustomWriteLog("绗�" + i + 1 + "琛岀敓浜ц祫婧愭湁閲嶅,璇蜂慨鏀�", DateTime.Now.ToString("yyyy-MM-dd"));
+ LogService.CustomWriteLog($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
+ $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", DateTime.Now.ToString("yyyy-MM-dd"));
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愭湁閲嶅,璇蜂慨鏀�!";
objJsonResult.data = null;
return objJsonResult;
}
+ LogService.CustomWriteLog("2.2:" + i, DateTime.Now.ToString("yyyy-MM-dd"));
oCN.RunProc($"update Sc_WorkBillSortBillMain set HSourceID={(HSourceID == "" ? 0.ToString() : HSourceID)},HYX={HYX}" +
$",HWorkQty={HWorkQty},HProdTimes={HProdTimes},HReadyTimes={HReadyTimes},HLastBeginDate='{HLastBeginDate}'" +
@@ -300,6 +357,7 @@
int SumDay = 31; //鍔ㄦ�佷袱鏈堜箣宸� DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days;
+ LogService.CustomWriteLog("2.3:" + i, DateTime.Now.ToString("yyyy-MM-dd"));
for (int j = 0; j < SumDay; j++)
{
//涓昏〃瀛愯〃閮芥湁鏁版嵁
@@ -325,6 +383,8 @@
}
}
+ LogService.CustomWriteLog("2.4:" + i, DateTime.Now.ToString("yyyy-MM-dd"));
+
if (TrueCount != SumCount)
{
objJsonResult.code = "0";
@@ -335,10 +395,12 @@
}
}
-
+ LogService.CustomWriteLog("2.5:", DateTime.Now.ToString("yyyy-MM-dd"));
//鍚屾鏃ヨ鍒掑伐鍗�
oCN.RunProc("exec REALESE_SC_ICMOBILLSTATUS_TMP");
+
+ LogService.CustomWriteLog("2.6:", DateTime.Now.ToString("yyyy-MM-dd"));
objJsonResult.code = "1";
objJsonResult.count = 1;
@@ -357,7 +419,7 @@
}
public json AddBillSub(string HInterID, string HBillNo, DateTime date, double HQTY, Dictionary<string, string> dic)
- {
+ {
//鑾峰彇琛ㄦ牸鏁版嵁
ds = oCN.RunProcReturn($"select * from h_v_JIT_Sc_WorkBillSortBillList where 鍗曟嵁鍙�='{HBillNo}'", "h_v_JIT_Sc_WorkBillSortBillList");
int count = 0;
@@ -374,14 +436,14 @@
}
}
}
-
+
if (count != 1)
{
//鎻掑叆瀛愯〃
oCN.RunProc("insert into Sc_WorkBillSortBillSub(HInterID,HSEQ," +
"HMasterDate,HQty,HUseTimes)" +
$"values({HInterID}, {(ds.Tables[0].Rows.Count + 1)}," +
- $" '{date}', {HQTY},{(dic["灏忔椂浜ц兘"] == "0" ? 0 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString()))})");
+ $" '{date}', {HQTY},{ ((dic["灏忔椂浜ц兘"] == "0.0000" ? 0 : dic["灏忔椂浜ц兘"] == "0" ? 0 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString())).ToString() == "闈炴暟瀛�" ? 0 : dic["灏忔椂浜ц兘"] == "0.0000" ? 0 : dic["灏忔椂浜ц兘"] == "0" ? 0 : HQTY / float.Parse(dic["灏忔椂浜ц兘"].ToString())) })");
}
objJsonResult.code = "1";
@@ -742,6 +804,19 @@
//LogService.Write("榻愬鍒嗘瀽sql:" + sql);
List<PRD_PPBOM> BomList = new List<PRD_PPBOM>();
DataTable resulTable = ds.Tables[0];
+
+ if (ds.Tables[0].Rows.Count < 1 || ds == null)
+ {
+ //閲婃斁榻愬鎿嶄綔 閬垮厤澶氫汉鍚屾椂杩涜榻愬鍒嗘瀽
+ oCN.RunProc($"update T_PRD_QTFX set FSTATUS = 0 where FPRDORGID ={omdelMian.HProdORGID} and FSTATUS = 1 ");
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "娌℃湁闇�瑕佽繘琛岄綈濂楀垎鏋愮殑鏁版嵁";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
if (resulTable.Rows[0][0].ToString().Contains("澶辫触"))
{
//閲婃斁榻愬鎿嶄綔 閬垮厤澶氫汉鍚屾椂杩涜榻愬鍒嗘瀽
@@ -783,9 +858,10 @@
sw.Start();//寮�濮嬭鏃�
//鑾峰彇褰撳墠鍗虫椂搴撳瓨 搴撳瓨鏁伴噺+搴撳瓨缁勭粐+鐗╂枡+璐т富+浠撳簱
+ //鍘熸煡璇㈠嵆鏃跺簱瀛樻柟寮忥細select * from h_v_jit_InventoryList
ds = oCN.RunProcReturn(@"
-select * from h_v_jit_InventoryList
-", "h_v_jit_InventoryList");
+exec h_p_jit_Inventory_UsableList
+", "h_p_jit_Inventory_UsableList");
ListInventory = ds.ToModelList<PRD_Inventory>();
//杞﹂棿 浠撳簱瀵圭収鍒楄〃
ds = oCN.RunProcReturn(@"
@@ -1540,6 +1616,10 @@
else if (oSystemParameter.omodel.WMS_CampanyName == "鍑礉濂堢壒")
{
sqlName = "AIS20210820164804";
+ }
+ else if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧")
+ {
+ sqlName = "AIS20240809105013";
}
else
{
@@ -2559,7 +2639,7 @@
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "鐢熶骇鏄庣粏琛岄噸澶�,閲嶅鐨勭敓浜ц鍗曞彿:" + ds.Tables[0].Rows[i]["鐢熶骇璁㈠崟鍙�"].ToString() + ",鏄庣粏琛屽彿:" + ds.Tables[0].Rows[i]["鐢熶骇璁㈠崟鏄庣粏琛屽彿"].ToString();
+ objJsonResult.Message = "鐢熶骇鏄庣粏琛岄噸澶�,閲嶅鐨勭敓浜ц鍗曞彿:" + dt.Tables[0].Rows[i]["鐢熶骇璁㈠崟鍙�"].ToString() + ",鏄庣粏琛屽彿:" + dt.Tables[0].Rows[i]["鐢熶骇璁㈠崟鏄庣粏琛屽彿"].ToString();
objJsonResult.data = null;
return objJsonResult;
}
@@ -2770,5 +2850,50 @@
}
}
#endregion
+
+ #region 鐢熶骇鏃ヨ鍒掑钩鍙� 鏍规嵁杞﹂棿娣诲姞鏈帓浜х敓浜ц鍗�
+ [Route("JIT_DayPlanPlatFormBill/JIT_ICMOBillListByDept")]
+ [HttpGet]
+ public object JIT_ICMOBillListByDept(string HDeptID)
+ {
+ try
+ {
+ //鏌ヨ閫夋嫨杞﹂棿涓湭鎺掍骇杩囩殑鐢熶骇璁㈠崟淇℃伅锛堟坊搴风鎶�--鐢熶骇璁㈠崟鐘舵�佷负涓嬭揪锛�
+ ds = oCN.RunProcReturn($"exec h_p_JIT_ICMOBillListByDept '{HDeptID}'", "h_p_JIT_ICMOBillListByDept");
+
+ if (ds.Tables[0].Rows.Count > 0 && ds != null)
+ {
+ //鏁版嵁琛ㄦ牸娣诲姞鍔ㄦ�佹棩鏈�
+ for (int j = 1; j <= 31; j++)
+ {
+ ds.Tables[0].Columns.Add(DateTime.Now.AddDays(j - 1).ToString("yyyy-MM-dd"), typeof(Int32));
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ユ棤鏁版嵁锛屽綋鍓嶆墍閫夎溅闂翠笅鏆傛棤鏈帓浜т笖璁㈠崟鐘舵�佷负涓嬭揪鐨勭敓浜ц鍗曚俊鎭紒";
+ objJsonResult.data = "";
+ return objJsonResult;
+ }
+
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
}
}
\ No newline at end of file
--
Gitblit v1.9.1