From 76a6a6c378c6511f988e0b71dbec5e9e05782dac Mon Sep 17 00:00:00 2001
From: jhz <jinghz@oceic.com>
Date: 星期日, 09 十月 2022 12:37:51 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs | 104 +++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 87 insertions(+), 17 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 b38c925..8f3a078 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"
@@ -41,7 +41,7 @@
omdelMian = JsonConvert.DeserializeObject<Sc_WorkBillSortBillMain>(sWhere);
ds = oCN.RunProcReturn($"exec h_p_JIT_Sc_WorkBillSortBill_Query '{omdelMian.HPlanBeginDate}',{(omdelMian.HProdORGID == null ? 0 : omdelMian.HProdORGID)},'{omdelMian.HSeOrderBillNo}'" +
- $",'{omdelMian.HPlanEndDate.AddDays(1).AddSeconds(-1)}',{omdelMian.HMaterID},'{omdelMian.HICMOBillNo}',{omdelMian.HWorkShopID}", "h_p_JIT_Sc_WorkBillSortBill_Query");
+ $",'{omdelMian.HPlanEndDate.AddDays(1)}',{omdelMian.HMaterID},'{omdelMian.HICMOBillNo}',{omdelMian.HWorkShopID}", "h_p_JIT_Sc_WorkBillSortBill_Query");
objJsonResult.code = "1";
objJsonResult.count = 1;
@@ -176,7 +176,7 @@
var HMaterModel = list[i]["瑙勬牸鍨嬪彿"].ToString();
var HUnitID = list[i]["HUnitID"].ToString();
var HSeOrderBillQty = list[i]["閿�鍞鍗曟暟閲�"].ToString();
- var HOrderNeedQty = list[i]["璁㈠崟闇�姹傛暟閲�"].ToString();
+ //var HOrderNeedQty = list[i]["璁㈠崟闇�姹傛暟閲�"].ToString();
var HSplitQty = list[i]["鎷嗗崟鏁伴噺"].ToString();
var HDayPlanSumQty = list[i]["鏃ヨ鍒掓暟閲忔�婚噺"].ToString();
var HPlanBeginDate = list[i]["璁″垝寮�濮嬫棩鏈�"].ToString();
@@ -187,6 +187,7 @@
var HOrderLev = list[i]["璁㈠崟绛夌骇"].ToString();
var HMainSourceInterID = list[i]["婧愬崟涓诲唴鐮�"].ToString();
var HMainSourceEntryID = list[i]["婧愬崟瀛愬唴鐮�"].ToString();
+ var HPlanQty = list[i]["璁″垝鏁伴噺"].ToString();
if (HSourceID == "")
{
@@ -218,16 +219,18 @@
"HICMOEntrySEQ,HWorkShopID,HSourceID, HYX, HProdORGID," +
" HMaterID, HMaterName, HMaterModel, HUnitID, HSeOrderBillQty," +
" HOrderNeedQty, HSplitQty, HDayPlanSumQty,HPlanBeginDate," +
- "HSeOrderBillNo,HICMOBillType,HSourceStockInQty,HLeftPlanQty,HOrderLev,HPreparatDate)values" +
+ "HSeOrderBillNo,HICMOBillType,HSourceStockInQty,HLeftPlanQty,HOrderLev,HPreparatDate," +
+ "HMainSourceInterID,HMainSourceEntryID,HICMOInterID_Sec,HICMOEntryID_Sec,HPlanQty)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)}," +
$" {(HMaterID == "" ? 0.ToString() : HMaterID)}, '{HMaterName}', '{HMaterModel}', {(HUnitID == "" ? 0.ToString() : HUnitID)}, {(HSeOrderBillQty == "" ? 0.ToString() : HSeOrderBillQty)}," +
- $" {(HOrderNeedQty == "" ? 0.ToString() : HOrderNeedQty)}, {(HSplitQty == "" ? 0.ToString() : HSplitQty)}, {(HDayPlanSumQty == "" ? 0.ToString() : HDayPlanSumQty)},'{HPlanBeginDate}'," +
- $"'{HSeOrderBillNo}','{HICMOBillType}',{(HSourceStockInQty == "" ? 0.ToString() : HSourceStockInQty)},{(HLeftPlanQty == "" ? 0.ToString() : HLeftPlanQty)},'{HOrderLev}',getdate())");
+ $" 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})");
}
- oCN.RunProc($"update Sc_WorkBillSortBillMain set HDayPlanSumQty={list[i]["鏃ヨ鍒掓暟閲忔�婚噺"].ToString()} where HInterID={list[i]["hmainid"].ToString()} and HBillNo='{list[i]["鍗曟嵁鍙�"].ToString()}'");
+ oCN.RunProc($"update Sc_WorkBillSortBillMain set HDayPlanSumQty={list[i]["鏃ヨ鍒掓暟閲忔�婚噺"].ToString()} where HInterID={(HInterID==0?int.Parse(list[i]["hmainid"].ToString()):HInterID)} and HBillNo='{(HBillNo==""?list[i]["鍗曟嵁鍙�"].ToString(): HBillNo)}'");
int SumDay = 31; //鍔ㄦ�佷袱鏈堜箣宸� DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days;
@@ -264,6 +267,9 @@
objJsonResult.data = null;
return objJsonResult;
}
+
+ //鍚屾鏃ヨ鍒掑伐鍗�
+ oCN.RunProc("exec REALESE_SC_ICMOBILLSTATUS_TMP");
objJsonResult.code = "1";
objJsonResult.count = 1;
@@ -304,7 +310,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})");
@@ -323,7 +329,10 @@
#region 娓呭崟閰嶆枡鏂瑰紡
public class PRD_PPBOM
{
-
+ /// <summary>
+ /// 鏃ヨ鍒掑伐鍗曞彿
+ /// </summary>
+ public string HMainICMOBillNo { get; set; }
/// <summary>
/// 鏃ヨ鍒掑伐鍗旻ID
/// </summary>
@@ -538,6 +547,10 @@
/// </summary>
public string FHMainICMOEntryID { get; set; }
/// <summary>
+ /// 鏃ヨ鍒掕鍗曞崟鍙凤細HMainICMOBillNo
+ /// </summary>
+ public string HMainICMOBillNo { get; set; }
+ /// <summary>
/// 鏃ヨ鍒掕鍗曚富鍐呯爜锛欶HICMOInterID
/// </summary>
public string FHICMOInterID { get; set; }
@@ -643,7 +656,6 @@
{
try
{
- oCN.BeginTran();
Stopwatch sw = new Stopwatch();
omdelMian = JsonConvert.DeserializeObject<Sc_WorkBillSortBillMain>(sWhere);
string sql = $"exec JIT_qtfx {omdelMian.HProdORGID},{omdelMian.HWorkShopID},'{user}' ";
@@ -653,7 +665,14 @@
DataTable resulTable = ds.Tables[0];
if (resulTable.Rows[0][0].ToString().Contains("澶辫触"))
{
- return resulTable.Rows[0][0].ToString();
+ //閲婃斁榻愬鎿嶄綔 閬垮厤澶氫汉鍚屾椂杩涜榻愬鍒嗘瀽
+ oCN.RunProc($"update T_PRD_QTFX set FSTATUS = 0 where FPRDORGID ={omdelMian.HProdORGID} and FSTATUS = 1 ");
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = resulTable.Rows[0][0].ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
}
else
{
@@ -664,7 +683,14 @@
string fDayPlanFEntryids = string.Empty;
if (BomList.Count == 0)
{
- return "娌℃湁闇�瑕佽繘琛岄綈濂楀垎鏋愮殑鏁版嵁";
+ //閲婃斁榻愬鎿嶄綔 閬垮厤澶氫汉鍚屾椂杩涜榻愬鍒嗘瀽
+ 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;
}
else
{
@@ -713,7 +739,7 @@
from
(
select sum(HSourceStockInQty)FCXStockInQty,HICMOEntryID_Sec FPRDMOENTYID from SC_WORKBILLSORTBILLMAIN a
---where a.HInterID IN ({0})
+where a.HInterID IN ({0})
group by HICMOEntryID_Sec
) a
join AIS20210811135644..T_PRD_PPBOM T1 on a.FPRDMOENTYID = t1.FMOENTRYID
@@ -787,6 +813,7 @@
FHStockOrgID = _item.FStockOrgId,
FHPRDORGID = _item.FStockOrgId,
FPRDBillNo = _item.HICMOBillNo,
+ HMainICMOBillNo = _item.HMainICMOBillNo,
FOwnerTypeId = "",
FUnitDosage = _item.dwyl,//鍗曚綅鐢ㄩ噺
FSumPlanCount = planNeed,//璁″垝鎬绘暟閲�
@@ -830,6 +857,7 @@
FHStockOrgID = _item.FStockOrgId,
FHPRDORGID = _item.FStockOrgId,
FPRDBillNo = _item.HICMOBillNo,
+ HMainICMOBillNo = _item.HMainICMOBillNo,
FOwnerTypeId = "",
FUnitDosage = _item.dwyl,//鍗曚綅鐢ㄩ噺
FSumPlanCount = planNeed,//璁″垝鎬绘暟閲�
@@ -881,6 +909,7 @@
FHPRDORGID = _item.FStockOrgId,
FErpClsID = _item.FErpClsID,
FPRDBillNo = _item.HICMOBillNo,
+ HMainICMOBillNo = _item.HMainICMOBillNo,
FOwnerTypeId = Inventory.FOwnerTypeId,
FOwnerId = Inventory.FOwnerId,
FUnitDosage = _item.dwyl,//鍗曚綅鐢ㄩ噺
@@ -924,6 +953,7 @@
FHStockOrgID = _item.FStockOrgId,
FHPRDORGID = _item.FStockOrgId,
FPRDBillNo = _item.HICMOBillNo,
+ HMainICMOBillNo = _item.HMainICMOBillNo,
FOwnerTypeId = "",
FUnitDosage = _item.dwyl,//鍗曚綅鐢ㄩ噺
FSumPlanCount = planNeed,//璁″垝鎬绘暟閲�
@@ -960,6 +990,7 @@
insertDT.Columns.Add("FUNITDOSAGE", typeof(decimal));
insertDT.Columns.Add("FSUMPLANCOUNT", typeof(decimal));
insertDT.Columns.Add("FPRDBILLNO", typeof(string));
+ insertDT.Columns.Add("HMainICMOBillNo", typeof(string));
insertDT.Columns.Add("FOWNERID", typeof(long));
insertDT.Columns.Add("FOWNERTYPEID", typeof(string));
insertDT.Columns.Add("FPLANDATE", typeof(DateTime));
@@ -991,6 +1022,7 @@
dr["FUNITDOSAGE"] = item.FUnitDosage;
dr["FSUMPLANCOUNT"] = item.FSumPlanCount;
dr["FPRDBILLNO"] = item.FPRDBillNo;
+ dr["HMainICMOBillNo"] = item.HMainICMOBillNo;
dr["FOWNERID"] = item.FOwnerId == null ? "0" : item.FOwnerId;
dr["FOWNERTYPEID"] = item.FOwnerTypeId;
dr["FPLANDATE"] = item.FPlanDate.ToString("yyyy-MM-dd");
@@ -1017,12 +1049,12 @@
", HICMOEntryID, HMaterID, HStockORGID, HStockQty, HLeftQty" +
", HProdORGID, HUnitDosage, HSumPlanQty, HICMOBillNo, HOwnerID" +
", HOwnerTypeID, HPlanDate, HComplete, HLackQty, HOccupyQty" +
- ", HCompleteQty1, HErpClsID, HWorkShopID, HWHID, HOccupyPickedQTY)values" +
+ ", HCompleteQty1, HErpClsID, HWorkShopID, HWHID, HOccupyPickedQTY,HMainICMOBillNo)values" +
$"({item["FID"].ToString()}, 1, {item["FHMAINICMOINTERIDR"].ToString()}, {item["FHMAINICMOENTRYID"].ToString()}, {item["FHICMOINTERID"].ToString()}" +
$", {item["FHICMOENTRYID"].ToString()}, {item["FHMATERID"].ToString()}, {item["FHSTOCKORGID"].ToString()}, {item["FHSTOCKQTY"].ToString()}, {item["FHLEFTQTY"].ToString()}" +
$" , {item["FHPRDORGID"].ToString()}, {item["FUNITDOSAGE"].ToString()}, {item["FSUMPLANCOUNT"].ToString()}, '{item["FPRDBILLNO"].ToString()}', {item["FOWNERID"].ToString()}" +
$", '{item["FOWNERTYPEID"].ToString()}', '{item["FPLANDATE"].ToString()}','{item["FCOMPLETE"].ToString()}', {item["FLACKCOUNT"].ToString()}, {item["FOCCUPYCOUNT"].ToString()}" +
- $", {item["FCOMPLETECOUNT1"].ToString()}, {item["FERPCLSID"].ToString()}, {item["FWORKSHOPID"].ToString()}, {item["FSTOCKID"].ToString()}, {item["FOCCUPYPICKEDCOUNT"].ToString()})");
+ $", {item["FCOMPLETECOUNT1"].ToString()}, {item["FERPCLSID"].ToString()}, {item["FWORKSHOPID"].ToString()}, {item["FSTOCKID"].ToString()}, {item["FOCCUPYPICKEDCOUNT"].ToString()}, '{item["HMainICMOBillNo"].ToString()}')");
}
LogService.Write("鎵归噺鎻掑叆鍒版暟鎹簱鐢ㄦ椂锛�" + sw.Elapsed);
//鎵ц瀹屾垚鍚� 鏇存柊鏃ヨ鍒掑伐鍗曠姸鎬�
@@ -1045,8 +1077,6 @@
sw.Stop();//缁撴潫璁℃椂
LogService.Write("榻愬鍒嗘瀽杩愯鎬绘椂闀匡細" + sw.Elapsed);
- oCN.Commit();
-
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "鎿嶄綔鎴愬姛";
@@ -1055,7 +1085,6 @@
}
catch (Exception e)
{
- oCN.RollBack();
LogService.Write("鎿嶄綔澶辫触锛�" + e.Message.ToString());
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -1124,5 +1153,46 @@
}
#endregion
+ #region 鐢熶骇鏃ヨ鍒掑钩鍙� 鐢熶骇璁㈠崟鏌ヨ
+ [Route("JIT_DayPlanPlatFormBill/JIT_ICMOBillList")]
+ [HttpGet]
+ public object JIT_ICMOBillList(string hmainid, string HEntryID)
+ {
+ try
+ {
+ DataSet dt = new DataSet();
+ oCN.RunProc("exec h_p_ICMOBillList_PrimarySubTable");
+ ds = oCN.RunProcReturn($"select * from ##ICMOBillList where 婧愬崟涓诲唴鐮� in({hmainid}) and 婧愬崟瀛愬唴鐮� in({HEntryID})", "##ICMOBillList");
+
+ for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+ {
+ dt = oCN.RunProcReturn($"select * from h_v_JIT_Sc_WorkBillSortBillList where 婧愬崟涓诲唴鐮� in({ds.Tables[0].Rows[i]["婧愬崟涓诲唴鐮�"].ToString()}) and 婧愬崟瀛愬唴鐮� in({ds.Tables[0].Rows[i]["婧愬崟瀛愬唴鐮�"].ToString()})", "h_v_JIT_Sc_WorkBillSortBillList");
+ if (dt.Tables[0].Rows.Count > 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鐢熶骇鏄庣粏琛岄噸澶�,閲嶅鐨勭敓浜ц鍗曞彿:"+ ds.Tables[0].Rows[i]["鐢熶骇璁㈠崟鍙�"].ToString()+",鏄庣粏琛屽彿:"+ ds.Tables[0].Rows[i]["鐢熶骇璁㈠崟鏄庣粏琛屽彿"].ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ 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