From ab08bd8ba626120eba10d22919948a1f9e112141 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期日, 24 四月 2022 17:01:08 +0800
Subject: [PATCH] 提料计划单 编辑功能
---
WebAPI/Models/Cg_PODemandPlanBillMain.cs | 19 +++
WebAPI/Models/Cg_PODemandPlanBillSub.cs | 48 +++++++++
WebAPI/Controllers/SCGL/Cg_PODemandPlanBillController.cs | 146 +++++++++++++++++++++++++++++
WebAPI/WebAPI.csproj | 2
WebAPI/Controllers/SCGL/Sc_WorkBillSortBillController.cs | 44 +++++++-
5 files changed, 250 insertions(+), 9 deletions(-)
diff --git a/WebAPI/Controllers/SCGL/Cg_PODemandPlanBillController.cs b/WebAPI/Controllers/SCGL/Cg_PODemandPlanBillController.cs
index 4f7d441..234b4a7 100644
--- a/WebAPI/Controllers/SCGL/Cg_PODemandPlanBillController.cs
+++ b/WebAPI/Controllers/SCGL/Cg_PODemandPlanBillController.cs
@@ -15,6 +15,8 @@
public DataSet ds = new DataSet();
public WebServer webserver = new WebServer();
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ Cg_PODemandPlanBillMain omdelMian = new Cg_PODemandPlanBillMain();
+ List<Cg_PODemandPlanBillSub> omodelsub = new List<Cg_PODemandPlanBillSub>();
#region 鎻愭枡璁″垝鍗� 鍒楄〃
[Route("Cg_PODemandPlanBill/Cg_PODemandPlanBillList")]
@@ -52,6 +54,150 @@
}
#endregion
+ #region 鎻愭枡璁″垝鍗� 娣诲姞/淇敼
+ [Route("Cg_PODemandPlanBill/AddPODemandPlanBillList")]
+ [HttpPost]
+ public object AddPODemandPlanBillList([FromBody] JObject sMainSub)
+ {
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ oCN.BeginTran();
+ //淇濆瓨涓昏〃
+ objJsonResult = AddBillMain(msg1);
+ if (objJsonResult.code == "0")
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ public json AddBillMain(string msg1)
+ {
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string msg3 = sArray[1].ToString();
+
+ int hentryid = int.Parse(sArray[2].ToString());//瀛愯〃鐨勯『搴廼d
+ int OperationType = int.Parse(sArray[3].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼
+ string user = sArray[4].ToString();
+ try
+ {
+ if (!DBUtility.ClsPub.Security_Log("Cg_PODemandPlanBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<Cg_PODemandPlanBillMain>(msg2);
+ string BillType = "4608";
+
+
+ if (OperationType == 1)//鏂板
+ {
+ //涓昏〃
+ oCN.RunProc("insert into Cg_PODemandPlanBillMain(HInterID,HBillNo,HYear,HPeriod,HBillType" +
+ ",HBillSubType,HDate,HBillStatus,HMaker,HMakeDate" +
+ ",HSubORGID ,HAddress,HPURCHASEORGID,HSupplierID ,HSettleCurrId" +
+ ",HRemark,HExplanation)" +
+ $"values({omdelMian.HInterID}, '{omdelMian.HBillNo}', {DateTime.Now.Year}, {DateTime.Now.Month}, '{BillType}'" +
+ $", '{BillType}','{omdelMian.HDate}',1, '{omdelMian.HMaker}',GETDATE()," +
+ $"{omdelMian.HSubORGID},'{omdelMian.HAddress}',{omdelMian.HPURCHASEORGID}, {omdelMian.HSupplierID}, {omdelMian.HSettleCurrId}" +
+ $",'{omdelMian.HRemark}','{omdelMian.HExplanation}')");
+ }
+ else if (OperationType == 3)
+ {
+ //淇敼
+ oCN.RunProc($"update Cg_PODemandPlanBillMain set HUpDater='{omdelMian.HMaker}',HUpDateDate=GETDATE()" +
+ $",HSubORGID={omdelMian.HSubORGID},HAddress='{omdelMian.HAddress}',HPURCHASEORGID={omdelMian.HPURCHASEORGID}" +
+ $",HSupplierID={omdelMian.HSupplierID},HSettleCurrId={omdelMian.HSettleCurrId}" +
+ $",HRemark='{omdelMian.HRemark}',HExplanation='{omdelMian.HExplanation}' where HInterID={omdelMian.HInterID}");
+ }
+ //淇濆瓨瀛愯〃
+ objJsonResult = AddBillSub(msg3, hentryid);
+ if (objJsonResult.code == "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ public json AddBillSub(string msg3, int hentryid)
+ {
+ if (hentryid != -1)
+ {
+ //鑾峰彇琛ㄦ牸鏁版嵁
+ ds = oCN.RunProcReturn($"select * from h_v_JIT_Cg_PODemandPlanBillList where 鍗曟嵁鍙�='{omdelMian.HBillNo}'", "h_v_JIT_Cg_PODemandPlanBillList");
+ //鍒犻櫎瀛愯〃
+ oCN.RunProc("delete from Cg_PODemandPlanBillSub where HInterID='" + omdelMian.HInterID.ToString() + "' and HEntryID='" + hentryid + "'");
+ }
+
+
+ omodelsub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Cg_PODemandPlanBillSub>>(msg3);
+ int i = 1;
+ //鎻掑叆瀛愯〃
+ foreach (Models.Cg_PODemandPlanBillSub oSub in omodelsub)
+ {
+ oCN.RunProc("insert into Cg_PODemandPlanBillSub(HInterID,HEntryID,HLaterReason,HMaterID,HMaterName" +
+ ", HMaterModel, HUnitID, HErpClsID, HQty, HRemark" +
+ ", HPURCHASEORGID, HStatus, HFixleadTime, HDayPlanBillNo, HSourceInterID" +
+ ", HSourceEntryID, HSourceBillNo, HSourceBillType, HWorkShopID, HDayPlanDate" +
+ ", HRelationQty1, HPOOrderInterID, HPOOrderEntryID, HPOOrderBillNo, HPOOrderBillSEQ" +
+ ", HWWOrderInterID, HWWOrderEntryID, HWWOrderBillNo, HPurchaseDeptID, HCloseTypeSub" +
+ ", HCloseMan, HEntryCloseDate, HSendQty, HReciveQty, HCloseStatus" +
+ ", HRemoveQty, HSeOrderBillNo, HUnReciveQty, HPOOrderBillDate, HPOOrderBillDeliveryDate" +
+ ", HPOOrderBillRemark, HPOOrderBillNote)" +
+ $"values({omdelMian.HInterID}, {(hentryid == -1 ? i : omodelsub.Count == 1 ? hentryid : i == 1 ? hentryid : (i + ds.Tables[0].Rows.Count - 1))}, '{oSub.HLaterReason}', {(oSub.HMaterID == null ? 0 : oSub.HMaterID)}, '{oSub.HMaterName}'" +
+ $", '{oSub.HMaterModel}', {(oSub.HUnitID == null ? 0 : oSub.HUnitID)}, '{oSub.HErpClsID}', {(oSub.HQty == null ? 0 : oSub.HQty)}, '{oSub.HRemark}'" +
+ $", {(oSub.HPURCHASEORGID == null ? 0 : oSub.HPURCHASEORGID)}, '{oSub.HStatus}', {(oSub.HFixleadTime == null ? 0 : oSub.HFixleadTime)}, '{oSub.HDayPlanBillNo}', {oSub.HSourceInterID}" +
+ $", {oSub.HSourceEntryID}, '{oSub.HSourceBillNo}', '{oSub.HSourceBillType}', {(oSub.HWorkShopID == null ? 0 : oSub.HWorkShopID)}, '{oSub.HDayPlanDate}'" +
+ $", {(oSub.HRelationQty1 == null ? 0 : oSub.HRelationQty1)}, {(oSub.HPOOrderInterID == null ? 0 : oSub.HPOOrderInterID)},{(oSub.HPOOrderEntryID == null ? 0 : oSub.HPOOrderEntryID)}, '{oSub.HPOOrderBillNo}',{(oSub.HPOOrderBillSEQ == null ? 0 : oSub.HPOOrderBillSEQ)}" +
+ $",{(oSub.HWWOrderInterID == null ? 0 : oSub.HWWOrderInterID)},{(oSub.HWWOrderEntryID == null ? 0 : oSub.HWWOrderEntryID)}, '{oSub.HWWOrderBillNo}',{(oSub.HPurchaseDeptID == null ? 0 : oSub.HPurchaseDeptID)}, '{(oSub.HCloseTypeSub==true?1:0)}'" +
+ $", '{oSub.HCloseMan}','{oSub.HEntryCloseDate}',{(oSub.HSendQty == null ? 0 : oSub.HSendQty)},{(oSub.HReciveQty == null ? 0 : oSub.HReciveQty)}, '{(oSub.HCloseStatus==true?1:0)}'" +
+ $",{(oSub.HRemoveQty == null ? 0 : oSub.HRemoveQty)}, '{oSub.HSeOrderBillNo}',{(oSub.HUnReciveQty == null ? 0 : oSub.HUnReciveQty)}, '{oSub.HPOOrderBillDate}', '{oSub.HPOOrderBillDeliveryDate}'" +
+ $", '{oSub.HPOOrderBillRemark}', '{oSub.HPOOrderBillNote}')");
+ i++;
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ #endregion
+
#region 鎻愭枡璁″垝鍗� 鍒犻櫎
[Route("Cg_PODemandPlanBill/DelPODemandPlanBillList")]
[HttpGet]
diff --git a/WebAPI/Controllers/SCGL/Sc_WorkBillSortBillController.cs b/WebAPI/Controllers/SCGL/Sc_WorkBillSortBillController.cs
index c04e494..fbf08e6 100644
--- a/WebAPI/Controllers/SCGL/Sc_WorkBillSortBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_WorkBillSortBillController.cs
@@ -138,14 +138,34 @@
else if (OperationType == 3)
{
//淇敼
- oCN.RunProc("UpDate Gy_WorkWarehouseBillMain set " +
- " HOrgId='" + omdelMian.HPRDORGID + "'" +
- ",HUpDater='" + omdelMian.HMaker + "'" +
- ",HUpDateDate='" + DateTime.Now + "'" +
- " where HInterID=" + omdelMian.HInterID.ToString());
-
- //鍒犻櫎瀛愯〃
- oCN.RunProc("delete from Gy_WorkWarehouseBillMainSub where HInterID='" + omdelMian.HInterID.ToString() + "' and HEntryID='" + hentryid + "'");
+ oCN.RunProc($"update Sc_WorkBillSortBillMain set HUpDater='{omdelMian.HMaker}',HUpDateDate=GETDATE()" +
+ $", HRemark='{omdelMian.HRemark}', HPrintQty={(omdelMian.HPrintQty == null ? 0 : omdelMian.HPrintQty)}" +
+ $", HDeptID={omdelMian.HDeptID}, HSeOrderBillNo='{omdelMian.HSeOrderBillNo}', HSourceQty= {(omdelMian.HSourceQty == null ? 0 : omdelMian.HSourceQty)}" +
+ $", HInStockQty={(omdelMian.HInStockQty == null ? 0 : omdelMian.HInStockQty)}, HMaterID={omdelMian.HMaterID}" +
+ $", HMaterName= '{omdelMian.HMaterName}', HMaterModel= '{omdelMian.HMaterModel}', HGroupID={omdelMian.HGroupID}" +
+ $", HWorkShopID={omdelMian.HWorkShopID}, HRelationQty={(omdelMian.HRelationQty == null ? 0 : omdelMian.HRelationQty)}" +
+ $", HUnitID={omdelMian.HUnitID}, HWorkerID={omdelMian.HWorkerID}, HSourceID={omdelMian.HSourceID}" +
+ $", HBeginWorkTimes={(omdelMian.HBeginWorkTimes == null ? 0 : omdelMian.HBeginWorkTimes)}, HInStockOwnerTypeID= '{omdelMian.HInStockOwnerTypeID}'" +
+ $", HSplitRelationQty={(omdelMian.HSplitRelationQty == null ? 0 : omdelMian.HSplitRelationQty)}, HOrderLev='{omdelMian.HOrderLev}'" +
+ $", HWorkQty={(omdelMian.HWorkQty == null ? 0 : omdelMian.HWorkQty)}" +
+ $", HSplitPlanQty={(omdelMian.HSplitPlanQty == null ? 0 : omdelMian.HSplitPlanQty)}, HOwnerTypeID='{omdelMian.HOwnerTypeID}'" +
+ $", HPlanBeginDate= '{omdelMian.HPlanBeginDate}', HPlanEndDate='{omdelMian.HPlanEndDate}', HICMOBillNo='{omdelMian.HICMOBillNo}'" +
+ $", HOwnerID={omdelMian.HOwnerID}, HBatchNo='{omdelMian.HBatchNo}', HYX={(omdelMian.HYX == null ? 0 : omdelMian.HYX)}" +
+ $", HProdTimes={(omdelMian.HProdTimes == null ? 0 : omdelMian.HProdTimes)}, HEntrustORGID={omdelMian.HEntrustORGID}" +
+ $", HPlanQty={(omdelMian.HPlanQty == null ? 0 : omdelMian.HPlanQty)}, HPreparatDate='{omdelMian.HPreparatDate}'" +
+ $", HOrderNeedQty={(omdelMian.HOrderNeedQty == null ? 0 : omdelMian.HOrderNeedQty)}, HOrderCommitDate='{omdelMian.HOrderCommitDate}'" +
+ $", HCompleteQty={(omdelMian.HCompleteQty == null ? 0 : omdelMian.HCompleteQty)}" +
+ $", HSeOrderBillQty={(omdelMian.HSeOrderBillQty == null ? 0 : omdelMian.HSeOrderBillQty)}, HICMOInterID={(omdelMian.HICMOInterID == null ? 0 : omdelMian.HICMOInterID)}" +
+ $", HKTQ={(omdelMian.HKTQ == null ? 0 : omdelMian.HKTQ)}, HStockInORGID={(omdelMian.HStockInORGID == null ? 0 : omdelMian.HStockInORGID)}" +
+ $", HDayPlanSumQty={(omdelMian.HDayPlanSumQty == null ? 0 : omdelMian.HDayPlanSumQty)}" +
+ $", HSourceBillNo='{omdelMian.HSourceBillNo}', HICMOEntryID={(omdelMian.HICMOEntryID == null ? 0 : omdelMian.HICMOEntryID)}" +
+ $", HMainInterID={(omdelMian.HMainInterID == null ? 0 : omdelMian.HMainInterID)}, HProdORGID={omdelMian.HProdORGID}" +
+ $", HLeftPlanQty={(omdelMian.HLeftPlanQty == null ? 0 : omdelMian.HLeftPlanQty)}" +
+ $", HEmpID={(omdelMian.HEmpID == null ? 0 : omdelMian.HEmpID)}, HInStockOwnerID={omdelMian.HInStockOwnerID}, HICMOEntrySEQ={(omdelMian.HICMOEntrySEQ == null ? 0 : omdelMian.HICMOEntrySEQ)}" +
+ $", HICMOBillType='{omdelMian.HICMOBillType}', HCloseCount={(omdelMian.HCloseCount == null ? 0 : omdelMian.HCloseCount)}" +
+ $", HOrderType= '{omdelMian.HOrderType}', HSplitQty={(omdelMian.HSplitQty == null ? 0 : omdelMian.HSplitQty)}, HSourceStockInQty={(omdelMian.HSourceStockInQty == null ? 0 : omdelMian.HSourceStockInQty)}" +
+ $", HPriority={(omdelMian.HPriority == null ? 0 : omdelMian.HPriority)}, HLocked='{(omdelMian.HLocked == true ? 1 : 0)}'" +
+ $", HHangUp='{(omdelMian.HHangUp == true ? 1 : 0)}' where HInterID={omdelMian.HInterID}");
}
//淇濆瓨瀛愯〃
objJsonResult = AddBillSub(msg3, hentryid);
@@ -176,6 +196,12 @@
public json AddBillSub(string msg3, int hentryid)
{
+ //鑾峰彇琛ㄦ牸鏁版嵁
+ ds = oCN.RunProcReturn($"select * from h_v_JIT_Sc_WorkBillSortBillList where 鍗曟嵁鍙�='{omdelMian.HBillNo}'", "h_v_JIT_Sc_WorkBillSortBillList");
+
+ //鍒犻櫎瀛愯〃
+ oCN.RunProc("delete from Sc_WorkBillSortBillSub where HInterID='" + omdelMian.HInterID.ToString() + "' and HEntryID='" + hentryid + "'");
+
omodelsub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Sc_WorkBillSortBillSub>>(msg3);
int i = 1;
//鎻掑叆瀛愯〃
@@ -185,7 +211,7 @@
", HRptFinishQty, HTimes, HUseTimes, HBTimes, HETimes" +
", HDateSub, HCloseMan, HEntryCloseDate, HCloseTypeSub, HColumn" +
", HLockedSub, HComplete, HStatusTag, HIsHandModify)" +
- $"values({omdelMian.HInterID}, {(hentryid == -1 ? i : hentryid)}, '{oSub.HRemark}', '{oSub.HMasterDate}', {(oSub.HQty == null ? 0: oSub.HQty)}" +
+ $"values({omdelMian.HInterID}, {(hentryid == -1 ? i : omodelsub.Count==1? hentryid:i==1? hentryid:(i+ds.Tables[0].Rows.Count-1))}, '{oSub.HRemark}', '{oSub.HMasterDate}', {(oSub.HQty == null ? 0: oSub.HQty)}" +
$", {(oSub.HRptFinishQty == null ? 0: oSub.HRptFinishQty)}, {(oSub.HTimes == null ? 0: oSub.HTimes)}, {(oSub.HUseTimes == null ? 0: oSub.HUseTimes)}, '{oSub.HBTimes}', '{oSub.HETimes}'" +
$", '{oSub.HDateSub}', '{oSub.HCloseMan}', '{oSub.HEntryCloseDate}', {(oSub.HCloseTypeSub == true ? 1 : 0)}, '{oSub.HColumn}'" +
$", '{(oSub.HLockedSub == true ? 1 : 0)}', '{oSub.HComplete}', '{(oSub.HStatusTag == true ? 1 : 0)}', '{(oSub.HIsHandModify == true ? 1 : 0)}')");
diff --git a/WebAPI/Models/Cg_PODemandPlanBillMain.cs b/WebAPI/Models/Cg_PODemandPlanBillMain.cs
new file mode 100644
index 0000000..8b4dc1a
--- /dev/null
+++ b/WebAPI/Models/Cg_PODemandPlanBillMain.cs
@@ -0,0 +1,19 @@
+锘縰sing DBUtility;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+ public class Cg_PODemandPlanBillMain: ClsXt_BaseBillMain
+ {
+ public string HDocumentStatus { get; set; }
+ public string HAddress { get; set; }
+ public string HExplanation { get; set; }
+ public int HSubORGID;
+ public int HSupplierID;
+ public int HPURCHASEORGID;
+ public int HSettleCurrId;
+ }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/Cg_PODemandPlanBillSub.cs b/WebAPI/Models/Cg_PODemandPlanBillSub.cs
new file mode 100644
index 0000000..f57d183
--- /dev/null
+++ b/WebAPI/Models/Cg_PODemandPlanBillSub.cs
@@ -0,0 +1,48 @@
+锘縰sing DBUtility;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+ public class Cg_PODemandPlanBillSub : ClsXt_BaseBillSub
+ {
+ public double? HRelationQty1;
+ public double? HQty;
+ public double? HSendQty;
+ public double? HReciveQty;
+ public double? HRemoveQty;
+ public double? HUnReciveQty;
+ public int? HPOOrderInterID;
+ public int? HPOOrderEntryID;
+ public int? HWWOrderInterID;
+ public int? HWWOrderEntryID;
+ public int? HPURCHASEORGID;
+ public int? HStockInOrgID;
+ public int? HInStocKOwnerID;
+ public int? HUnitID;
+ public int? HMaterID;
+ public int? HFixleadTime;
+ public int? HPOOrderBillSEQ;
+ public int? HOrderEmpID;
+ public int? HWorkShopID;
+ public int? HPurchaseDeptID;
+ public string HPOOrderBillNo { get; set; }
+ public string HWWOrderBillNo { get; set; }
+ public string HMaterName { get; set; }
+ public string HMaterModel { get; set; }
+ public string HStatus { get; set; }
+ public string HLaterReason { get; set; }
+ public string HErpClsID { get; set; }
+ public string HPOOrderBillRemark { get; set; }
+ public string HPOOrderBillNote { get; set; }
+ public string HSeOrderBillNo { get; set; }
+ public string HDayPlanBillNo { get; set; }
+ public DateTime? HDayPlanDate= DateTime.Parse("1900-01-01 00:00:00");
+ public DateTime? HPOOrderBillDate= DateTime.Parse("1900-01-01 00:00:00");
+ public DateTime? HPOOrderBillDeliveryDate= DateTime.Parse("1900-01-01 00:00:00");
+ public bool HCloseStatus;
+ public bool HCloseTypeSub;
+ }
+}
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index fbd7ae6..c840fc0 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -519,6 +519,8 @@
<Compile Include="HttpClient.cs" />
<Compile Include="InvokeHelper.cs" />
<Compile Include="Log.cs" />
+ <Compile Include="Models\Cg_PODemandPlanBillMain.cs" />
+ <Compile Include="Models\Cg_PODemandPlanBillSub.cs" />
<Compile Include="Models\Cg_PODemandPlanConfigBillSub.cs" />
<Compile Include="Models\ClsGy_StockCheckItemBill.cs" />
<Compile Include="Models\ClsQK_PackingBill.cs" />
--
Gitblit v1.9.1