From e3d40db116e17fa1401ebb3bb04ea246f74db79b Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期一, 18 四月 2022 14:26:33 +0800
Subject: [PATCH] 车间仓库对照列表 提料计划信息表列表 要料计划信息表列表
---
WebAPI/Models/JIT_NeedMaterPlanConfigBillSub.cs | 26 ++
WebAPI/Models/Cg_PODemandPlanConfigBillSub.cs | 26 ++
WebAPI/Controllers/SCGL/Sc_JIT_ComplementGoodBillController.cs | 652 ++++++++++++++++++++++++++++++++++++++++++++++++++
WebAPI/Models/Gy_WorkWarehouseBillMainSub.cs | 16 +
WebAPI/WebAPI.csproj | 3
5 files changed, 721 insertions(+), 2 deletions(-)
diff --git a/WebAPI/Controllers/SCGL/Sc_JIT_ComplementGoodBillController.cs b/WebAPI/Controllers/SCGL/Sc_JIT_ComplementGoodBillController.cs
index b39afef..3a9d87e 100644
--- a/WebAPI/Controllers/SCGL/Sc_JIT_ComplementGoodBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_JIT_ComplementGoodBillController.cs
@@ -1,4 +1,6 @@
-锘縰sing System;
+锘縰sing DBUtility;
+using Newtonsoft.Json.Linq;
+using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
@@ -10,11 +12,17 @@
{
public class Sc_JIT_ComplementGoodBillController : ApiController
{
+ ClsXt_BaseBillMain omdelMian = new ClsXt_BaseBillMain();
+ List<Gy_WorkWarehouseBillMainSub> omodelsub = new List<Gy_WorkWarehouseBillMainSub>();
+ List<Cg_PODemandPlanConfigBillSub> omodelPODsub = new List<Cg_PODemandPlanConfigBillSub>();
+ List<JIT_NeedMaterPlanConfigBillSub> omodelNeedsub = new List<JIT_NeedMaterPlanConfigBillSub>();
private json objJsonResult = new json();
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
DataSet ds;
- #region 鏃ヨ鍒掑钩鍙板熀纭�璧勬枡 杞﹂棿浠撳簱瀵圭収鍒楄〃
+ #region 鏃ヨ鍒掑钩鍙板熀纭�璧勬枡 杞﹂棿浠撳簱瀵圭収
+
+ #region 杞﹂棿浠撳簱瀵圭収鍒楄〃
[Route("Sc_JIT_ComplementGoodBill/ComplementGoodBillList")]
[HttpGet]
public object ComplementGoodBillList(string sWhere, string user)
@@ -50,6 +58,646 @@
}
#endregion
+ #region 杞﹂棿浠撳簱瀵圭収 娣诲姞/淇敼
+ [Route("Sc_JIT_ComplementGoodBill/AddComplementGoodBillList")]
+ [HttpPost]
+ public object AddComplementGoodBillList([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("JIT_ComplementGoodBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsXt_BaseBillMain>(msg2);
+ string BillType = "4612";
+
+
+ if (OperationType == 1)//鏂板
+ {
+ //涓昏〃
+ oCN.RunProc("insert into Gy_WorkWarehouseBillMain(HInterID,HBillNo,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillStatus,HMaker,HMakeDate,HOrgId)" +
+ $"values({omdelMian.HInterID}, '{omdelMian.HBillNo}',{DateTime.Now.Year}, {DateTime.Now.Month}, '{BillType}', '{BillType}', GETDATE(), 1, '{omdelMian.HMaker}', GETDATE(),{omdelMian.HPRDORGID})");
+ }
+ 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 + "'");
+ }
+ //淇濆瓨瀛愯〃
+ 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)
+ {
+ omodelsub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_WorkWarehouseBillMainSub>>(msg3);
+ int i = 1;
+ //鎻掑叆瀛愯〃
+ foreach (Models.Gy_WorkWarehouseBillMainSub oSub in omodelsub)
+ {
+ oCN.RunProc("insert into Gy_WorkWarehouseBillMainSub(HInterID,HEntryID,HRemark,HWorkShopID," +
+ "HWorkShopName,HWHID,HWHName) " +
+ "values("
+ + omdelMian.HInterID.ToString() + "," + (hentryid == -1 ? i : hentryid) + ",'" + oSub.HRemark + "'," + (oSub.HWorkShopID==null?0:oSub.HWorkShopID)
+ + ",'" +oSub.HWorkShopName + "'," + (oSub.HWHID==null?0: oSub.HWHID) + ",'" + oSub.HWHName.ToString()+ "') ");
+ i++;
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ #endregion
+
+ #region 杞﹂棿浠撳簱瀵圭収鍒犻櫎
+ [Route("Sc_JIT_ComplementGoodBill/DelComplementGoodBillList")]
+ [HttpGet]
+ public object DelComplementGoodBillList(string HInterID, string HEntryID, string User)
+ {
+ try
+ {
+ //鍒犻櫎鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("JIT_ComplementGoodBill_Drop", 1, false, User))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愬垹闄わ紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ds = oCN.RunProcReturn("select * from h_v_JIT_Gy_WorkWarehouseBillList where 1=1 and hmainid=" + HInterID, "h_v_JIT_Gy_WorkWarehouseBillList");
+
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ if (ds.Tables[0].Rows[0]["鍗曟嵁鐘舵��"].ToString() != "1")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "褰撳墠鍗曟嵁涓嶈兘鍒犻櫎锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();//寮�鍚簨鍔�
+
+ if (ds.Tables[0].Rows.Count == 1)
+ {
+ oCN.RunProc($"delete from Gy_WorkWarehouseBillMain where HInterID={HInterID}");
+ }
+ oCN.RunProc($"delete from Gy_WorkWarehouseBillMainSub where HInterID={HInterID} and HEntryID={HEntryID}");
+
+ oCN.Commit();//缁撴潫浜嬪姟
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "褰撳墠鍗曟嵁涓嶅瓨鍦�,鏃犳硶鍒犻櫎锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();//鍥炴粴浜嬪姟
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #endregion
+
+ #region 鏃ヨ鍒掑钩鍙板熀纭�璧勬枡 鎻愭枡璁″垝淇℃伅
+
+ #region 鎻愭枡璁″垝淇℃伅鍒楄〃
+ [Route("Sc_JIT_ComplementGoodBill/PODemandPlanConfigBillList")]
+ [HttpGet]
+ public object PODemandPlanConfigBillList(string sWhere, string user)
+ {
+ try
+ {
+ //鏌ヨ鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("Cg_PODemandPlanConfigBill_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愭煡璇紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ds = oCN.RunProcReturn("select * from h_v_JIT_Cg_PODemandPlanConfigBillList where 1=1 " + sWhere + " order by hmainid desc ", "h_v_JIT_Cg_PODemandPlanConfigBillList");
+
+ 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 = e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鎻愭枡璁″垝淇℃伅 娣诲姞/淇敼
+ [Route("Sc_JIT_ComplementGoodBill/AddPODemandPlanConfigBillList")]
+ [HttpPost]
+ public object AddPODemandPlanConfigBillList([FromBody] JObject sMainSub)
+ {
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ oCN.BeginTran();
+ //淇濆瓨涓昏〃
+ objJsonResult = AddPODBillMain(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 AddPODBillMain(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_PODemandPlanConfigBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsXt_BaseBillMain>(msg2);
+ string BillType = "4611";
+
+
+ if (OperationType == 1)//鏂板
+ {
+ //涓昏〃
+ oCN.RunProc("insert into Cg_PODemandPlanConfigBillMain(HInterID,HBillNo,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillStatus,HMaker,HMakeDate,HOrgId)" +
+ $"values({omdelMian.HInterID}, '{omdelMian.HBillNo}',{DateTime.Now.Year}, {DateTime.Now.Month}, '{BillType}', '{BillType}', GETDATE(), 1, '{omdelMian.HMaker}', GETDATE(), {omdelMian.HPRDORGID})");
+ }
+ else if (OperationType == 3)
+ {
+ //淇敼
+ oCN.RunProc("UpDate Cg_PODemandPlanConfigBillMain set " +
+ " HOrgId='" + omdelMian.HPRDORGID + "'" +
+ ",HUpDater='" + omdelMian.HMaker + "'" +
+ ",HUpDateDate='" + DateTime.Now + "'" +
+ " where HInterID=" + omdelMian.HInterID.ToString());
+
+ //鍒犻櫎瀛愯〃
+ oCN.RunProc("delete from Cg_PODemandPlanConfigBillSub where HInterID='" + omdelMian.HInterID.ToString() + "' and HEntryID='" + hentryid + "'");
+ }
+ //淇濆瓨瀛愯〃
+ objJsonResult = AddPODBillSub(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 AddPODBillSub(string msg3, int hentryid)
+ {
+ omodelPODsub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Cg_PODemandPlanConfigBillSub>>(msg3);
+ int i = 1;
+ //鎻掑叆瀛愯〃
+ foreach (Models.Cg_PODemandPlanConfigBillSub oSub in omodelPODsub)
+ {
+ oCN.RunProc("insert into Cg_PODemandPlanConfigBillSub(HInterID,HEntryID,HRemark,HSupplierID,HSupplierName,HMaterID," +
+ "HMaterName, HMaterModel, HJITMaterGroup, HJITSafeStock, HJITMaterDemand, HJITBatchQty, HDeliveryPeriod, " +
+ "HLeadTime, HLeadTime_Sec, HDeliveryMode, HDeliveryDaysCtrl)values" +
+ $"({omdelMian.HInterID}, {(hentryid == -1 ? i : hentryid) }, '{oSub.HRemark}', {(oSub.HSupplierID==null?0: oSub.HSupplierID)}, '{oSub.HSupplierName}', {(oSub.HMaterID == null ? 0 : oSub.HMaterID)}," +
+ $" '{oSub.HMaterName}', '{oSub.HMaterModel}', '{oSub.HJITMaterGroup}', {(oSub.HJITSafeStock == null ? 0 : oSub.HJITSafeStock)}, {(oSub.HJITMaterDemand == null ? 0 : oSub.HJITMaterDemand)},{(oSub.HJITBatchQty == null ? 0 : oSub.HJITBatchQty)},{(oSub.HDeliveryPeriod == null ? 0 : oSub.HDeliveryPeriod)}," +
+ $" {(oSub.HLeadTime == null ? 0 : oSub.HLeadTime)}, {(oSub.HLeadTime_Sec == null ? 0 : oSub.HLeadTime_Sec)}, '{oSub.HDeliveryMode}', {(oSub.HDeliveryDaysCtrl == null ? 0 : oSub.HDeliveryDaysCtrl)}) ");
+ i++;
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ #endregion
+
+ #region 鎻愭枡璁″垝淇℃伅鍒犻櫎
+ [Route("Sc_JIT_ComplementGoodBill/DelPODemandPlanConfigBillList")]
+ [HttpGet]
+ public object DelPODemandPlanConfigBillList(string HInterID, string HEntryID, string User)
+ {
+ try
+ {
+ //鍒犻櫎鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("Cg_PODemandPlanConfigBill_Drop", 1, false, User))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愬垹闄わ紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ds = oCN.RunProcReturn("select * from h_v_JIT_Cg_PODemandPlanConfigBillList where 1=1 and hmainid=" + HInterID, "h_v_JIT_Cg_PODemandPlanConfigBillList");
+
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ if (ds.Tables[0].Rows[0]["鍗曟嵁鐘舵��"].ToString() != "1")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "褰撳墠鍗曟嵁涓嶈兘鍒犻櫎锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();//寮�鍚簨鍔�
+
+ if (ds.Tables[0].Rows.Count == 1)
+ {
+ oCN.RunProc($"delete from Cg_PODemandPlanConfigBillMain where HInterID={HInterID}");
+ }
+ oCN.RunProc($"delete from Cg_PODemandPlanConfigBillSub where HInterID={HInterID} and HEntryID={HEntryID}");
+
+ oCN.Commit();//缁撴潫浜嬪姟
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "褰撳墠鍗曟嵁涓嶅瓨鍦�,鏃犳硶鍒犻櫎锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();//鍥炴粴浜嬪姟
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #endregion
+
+ #region 鏃ヨ鍒掑钩鍙板熀纭�璧勬枡 瑕佹枡璁″垝淇℃伅
+
+ #region 瑕佹枡璁″垝淇℃伅鍒楄〃
+ [Route("Sc_JIT_ComplementGoodBill/NeedMaterPlanConfigBillList")]
+ [HttpGet]
+ public object NeedMaterPlanConfigBillList(string sWhere, string user)
+ {
+ try
+ {
+ //鏌ヨ鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("JIT_NeedMaterPlanConfigBill_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愭煡璇紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ds = oCN.RunProcReturn("select * from h_v_JIT_NeedMaterPlanConfigBillList where 1=1 " + sWhere + " order by hmainid desc ", "h_v_JIT_NeedMaterPlanConfigBillList");
+
+ 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 = e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 瑕佹枡璁″垝淇℃伅鍒楄〃 娣诲姞/淇敼
+ [Route("Sc_JIT_ComplementGoodBill/AddNeedMaterPlanConfigBillList")]
+ [HttpPost]
+ public object AddNeedMaterPlanConfigBillList([FromBody] JObject sMainSub)
+ {
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ oCN.BeginTran();
+ //淇濆瓨涓昏〃
+ objJsonResult = AddNeedBillMain(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 AddNeedBillMain(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("JIT_NeedMaterPlanConfigBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsXt_BaseBillMain>(msg2);
+ string BillType = "4615";
+
+
+ if (OperationType == 1)//鏂板
+ {
+ //涓昏〃
+
+ oCN.RunProc("insert into JIT_NeedMaterPlanConfigBillMain(HInterID,HBillNo,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillStatus,HMaker,HMakeDate,HOrgId)" +
+ $"values({omdelMian.HInterID}, '{omdelMian.HBillNo}',{DateTime.Now.Year}, {DateTime.Now.Month}, '{BillType}', '{BillType}', GETDATE(), 1, '{omdelMian.HMaker}', GETDATE(), {omdelMian.HPRDORGID})");
+ }
+ else if (OperationType == 3)
+ {
+ //淇敼
+ oCN.RunProc("UpDate JIT_NeedMaterPlanConfigBillMain set " +
+ " HOrgId='" + omdelMian.HPRDORGID + "'" +
+ ",HUpDater='" + omdelMian.HMaker + "'" +
+ ",HUpDateDate='" + DateTime.Now + "'" +
+ " where HInterID=" + omdelMian.HInterID.ToString());
+
+ //鍒犻櫎瀛愯〃
+ oCN.RunProc("delete from JIT_NeedMaterPlanConfigBillSub where HInterID='" + omdelMian.HInterID.ToString() + "' and HEntryID='" + hentryid + "'");
+ }
+ //淇濆瓨瀛愯〃
+ objJsonResult = AddNeedBillSub(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 AddNeedBillSub(string msg3, int hentryid)
+ {
+ omodelNeedsub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JIT_NeedMaterPlanConfigBillSub>>(msg3);
+ int i = 1;
+ //鎻掑叆瀛愯〃
+ foreach (Models.JIT_NeedMaterPlanConfigBillSub oSub in omodelNeedsub)
+ {
+ oCN.RunProc("insert into JIT_NeedMaterPlanConfigBillSub(HInterID,HEntryID,HRemark,HWorkShopID,HWorkShopName,HMaterID," +
+ "HMaterName, HMaterModel, HJITMaterGroup, HJITSafeStock, HJITMaterDemand, HJITBatchQty, HDeliveryPeriod, " +
+ "HLeadTime, HLeadTime_Sec, HDeliveryMode, HDeliveryDaysCtrl)values" +
+ $"({omdelMian.HInterID}, {(hentryid == -1 ? i : hentryid) }, '{oSub.HRemark}', {(oSub.HWorkShopID == null ? 0 : oSub.HWorkShopID)}, '{oSub.HWorkShopName}', {(oSub.HMaterID == null ? 0 : oSub.HMaterID)}," +
+ $" '{oSub.HMaterName}', '{oSub.HMaterModel}', '{oSub.HJITMaterGroup}', {(oSub.HJITSafeStock == null ? 0 : oSub.HJITSafeStock)}, {(oSub.HJITMaterDemand == null ? 0 : oSub.HJITMaterDemand)},{(oSub.HJITBatchQty == null ? 0 : oSub.HJITBatchQty)},{(oSub.HDeliveryPeriod == null ? 0 : oSub.HDeliveryPeriod)}," +
+ $" {(oSub.HLeadTime == null ? 0 : oSub.HLeadTime)}, {(oSub.HLeadTime_Sec == null ? 0 : oSub.HLeadTime_Sec)}, '{oSub.HDeliveryMode}', {(oSub.HDeliveryDaysCtrl == null ? 0 : oSub.HDeliveryDaysCtrl)}) ");
+ i++;
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ #endregion
+
+ #region 瑕佹枡璁″垝淇℃伅鍒犻櫎
+ [Route("Sc_JIT_ComplementGoodBill/DelNeedMaterPlanConfigBillList")]
+ [HttpGet]
+ public object DelNeedMaterPlanConfigBillList(string HInterID, string HEntryID, string User)
+ {
+ try
+ {
+ //鍒犻櫎鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("JIT_NeedMaterPlanConfigBill_Drop", 1, false, User))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愬垹闄わ紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ds = oCN.RunProcReturn("select * from h_v_JIT_NeedMaterPlanConfigBillList where 1=1 and hmainid=" + HInterID, "h_v_JIT_NeedMaterPlanConfigBillList");
+
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ if (ds.Tables[0].Rows[0]["鍗曟嵁鐘舵��"].ToString() != "1")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "褰撳墠鍗曟嵁涓嶈兘鍒犻櫎锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();//寮�鍚簨鍔�
+
+ if (ds.Tables[0].Rows.Count == 1)
+ {
+ oCN.RunProc($"delete from JIT_NeedMaterPlanConfigBillMain where HInterID={HInterID}");
+ }
+ oCN.RunProc($"delete from JIT_NeedMaterPlanConfigBillSub where HInterID={HInterID} and HEntryID={HEntryID}");
+
+ oCN.Commit();//缁撴潫浜嬪姟
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "褰撳墠鍗曟嵁涓嶅瓨鍦�,鏃犳硶鍒犻櫎锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();//鍥炴粴浜嬪姟
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #endregion
+
}
}
\ No newline at end of file
diff --git a/WebAPI/Models/Cg_PODemandPlanConfigBillSub.cs b/WebAPI/Models/Cg_PODemandPlanConfigBillSub.cs
new file mode 100644
index 0000000..f88c2dc
--- /dev/null
+++ b/WebAPI/Models/Cg_PODemandPlanConfigBillSub.cs
@@ -0,0 +1,26 @@
+锘縰sing DBUtility;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+ public class Cg_PODemandPlanConfigBillSub: ClsXt_BaseBillSub
+ {
+ public int? HSupplierID;
+ public string HSupplierName { get; set; }
+ public int? HMaterID;
+ public string HMaterName { get; set; }
+ public string HMaterModel { get; set; }
+ public string HJITMaterGroup { get; set; }
+ public int? HJITSafeStock;
+ public int? HJITMaterDemand;
+ public int? HJITBatchQty;
+ public int? HDeliveryPeriod;
+ public int? HLeadTime;
+ public int? HLeadTime_Sec;
+ public int? HDeliveryDaysCtrl;
+ public string HDeliveryMode { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/Gy_WorkWarehouseBillMainSub.cs b/WebAPI/Models/Gy_WorkWarehouseBillMainSub.cs
new file mode 100644
index 0000000..ddcd7af
--- /dev/null
+++ b/WebAPI/Models/Gy_WorkWarehouseBillMainSub.cs
@@ -0,0 +1,16 @@
+锘縰sing DBUtility;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+ public class Gy_WorkWarehouseBillMainSub: ClsXt_BaseBillSub
+ {
+ public int? HWorkShopID;//鐢熶骇杞﹂棿
+ public string HWorkShopName;//鐢熶骇杞﹂棿鍚嶇О
+ public int? HWHID;//浠撳簱
+ public string HWHName;//浠撳簱鍚嶇О
+ }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/JIT_NeedMaterPlanConfigBillSub.cs b/WebAPI/Models/JIT_NeedMaterPlanConfigBillSub.cs
new file mode 100644
index 0000000..15cec55
--- /dev/null
+++ b/WebAPI/Models/JIT_NeedMaterPlanConfigBillSub.cs
@@ -0,0 +1,26 @@
+锘縰sing DBUtility;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+ public class JIT_NeedMaterPlanConfigBillSub : ClsXt_BaseBillSub
+ {
+ public int? HWorkShopID;
+ public string HWorkShopName { get; set; }
+ public int? HMaterID;
+ public string HMaterName { get; set; }
+ public string HMaterModel { get; set; }
+ public string HJITMaterGroup { get; set; }
+ public int? HJITSafeStock;
+ public int? HJITMaterDemand;
+ public int? HJITBatchQty;
+ public int? HDeliveryPeriod;
+ public int? HLeadTime;
+ public int? HLeadTime_Sec;
+ public int? HDeliveryDaysCtrl;
+ public string HDeliveryMode { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index a7c1d92..a82e8da 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -516,6 +516,7 @@
<Compile Include="HttpClient.cs" />
<Compile Include="InvokeHelper.cs" />
<Compile Include="Log.cs" />
+ <Compile Include="Models\Cg_PODemandPlanConfigBillSub.cs" />
<Compile Include="Models\ClsGy_StockCheckItemBill.cs" />
<Compile Include="Models\ClsQK_PackingBill.cs" />
<Compile Include="Models\ClsSb_EquipRepairSendWorkBillMain.cs" />
@@ -532,8 +533,10 @@
<Compile Include="Models\ClsWW_PPBomBillSub.cs" />
<Compile Include="Models\Cls_InventoryAnalysisList.cs" />
<Compile Include="Models\GetWeekList.cs" />
+ <Compile Include="Models\Gy_WorkWarehouseBillMainSub.cs" />
<Compile Include="Models\HBarCodeList.cs" />
<Compile Include="Models\HSouceOrderList.cs" />
+ <Compile Include="Models\JIT_NeedMaterPlanConfigBillSub.cs" />
<Compile Include="Models\jsonScanline.cs" />
<Compile Include="Models\ScanLineCode.cs" />
<Compile Include="Models\宸ヨ祫绠$悊\ClsGy_ClassTimePrj_Model.cs" />
--
Gitblit v1.9.1