From bdc4ac06a7e97bde465c257bd2afcababbdc6a3d Mon Sep 17 00:00:00 2001
From: 杨乐 <yang.le.192@qq.com>
Date: 星期一, 17 一月 2022 17:34:21 +0800
Subject: [PATCH] 工序计划单 编辑
---
WebAPI/Models/ClsSc_ProcessPlanMain.cs | 38 +++++++++
WebAPI/Controllers/Sc_ProcessMangementController.cs | 148 +++++++++++++++++++++++++++++++++++-
WebAPI/Models/ClsSc_ProcessPlanSub.cs | 45 +++++++++++
WebAPI/WebAPI.csproj | 2
4 files changed, 228 insertions(+), 5 deletions(-)
diff --git a/WebAPI/Controllers/Sc_ProcessMangementController.cs b/WebAPI/Controllers/Sc_ProcessMangementController.cs
index 8a045aa..f004cab 100644
--- a/WebAPI/Controllers/Sc_ProcessMangementController.cs
+++ b/WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -17,6 +17,10 @@
private json objJsonResult = new json();
+
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ DataSet ds;
+
///<summary>
///灏佽鐘舵�佺爜鍙婅繑鍥炰俊鎭殑鍏敤鏂规硶銆�
///鍙傛暟锛欴ataSet銆�
@@ -218,6 +222,9 @@
return GetObjectJson(ds);
}
+ #region 宸ュ簭璁″垝鍗�
+ List<ClsSc_ProcessPlanSub> DetailColl = new List<ClsSc_ProcessPlanSub>();
+ ClsSc_ProcessPlanMain omodel = new ClsSc_ProcessPlanMain();
/// <summary>
/// 杩斿洖鐢熶骇宸ュ簭璁″垝鍗曞垪琛�
///鍙傛暟锛歴tring sql銆�
@@ -253,11 +260,142 @@
return GetObjectJson(ds);
}
- /// <summary>
- /// 杩斿洖鐢熶骇宸ュ簭娲惧伐鍗曞垪琛�
- /// </summary>
- /// <param name="sWhere"></param>
- /// <returns></returns>
+ //宸ュ簭璁″垝鍗� 淇濆瓨/缂栬緫
+ [Route("Sc_ProcessMangement/AddBill")]
+ [HttpPost]
+ public object AddBill([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淇敼
+ try
+ {
+ omodel = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsSc_ProcessPlanMain>(msg2);
+ string BillType = "3715";
+
+
+ if (OperationType == 1)//鏂板
+ {
+ //涓昏〃
+ oCN.RunProc("Insert Into Sc_ProcessPlanMain " +
+ "(HYear,HPeriod,HBillType,HBillSubType,HInterID" +
+ ",HDate,HBillNo,HBillStatus,HCheckItemNowID,HCheckItemNextID" +
+ ",HICMOInterID,HICMOBillNo,HMaterID,HMaterNumber,HUnitID" +
+ ",HUnitNumber,HPlanQty,HPlanBeginDate,HPlanEndDate,HExplanation" +
+ ",HRemark,HInnerBillNo,HMaker,HMakeDate" +
+ ") " +
+ " values(" + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + BillType + "','" + BillType + "'," + omodel.HInterID.ToString() +
+ ",'" + omodel.HDate.ToShortDateString() + "','" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + "," + omodel.HCheckItemNowID.ToString() + "," + omodel.HCheckItemNextID.ToString() +
+ "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HMaterID.ToString() + ",'" + omodel.HMaterNumber + "'," + omodel.HUnitID.ToString() +
+ ",'" + omodel.HUnitNumber + "'," + omodel.HPlanQty.ToString() + ",'" + omodel.HPlanBeginDate.ToShortDateString() + "','" + omodel.HPlanEndDate.ToShortDateString() + "','" + omodel.HExplanation + "'" +
+ ",'" + omodel.HRemark + "','" + omodel.HInnerBillNo + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
+ ") ");
+ }
+ else if (OperationType == 3)
+ {
+ //淇敼
+
+
+ //鍒犻櫎瀛愯〃
+
+ }
+ //淇濆瓨瀛愯〃
+ 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)
+ {
+ DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_ProcessPlanSub>>(msg3);
+ int i = 1;
+ //鎻掑叆瀛愯〃
+ foreach (Models.ClsSc_ProcessPlanSub oSub in DetailColl)
+ {
+ oCN.RunProc("Insert into Sc_ProcessPlanSub " +
+ " (HInterID,HEntryID,HBillNo,HProcNo,HProcID,HWorkingQty" +
+ ",HProcNumber,HWorkRemark,HCenterID,HDeptID,HDeptNumber" +
+ ",HGroupID,HGroupNumber,HWorkerID,HWorkerNumber,HSourceID" +
+ ",HQty,HTimeUnit,HPlanWorkTimes,HPlanBeginDate,HPlanEndDate" +
+ ",HICMOInterID,HICMOBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
+ ",HCloseMan,HCloseType,HRemark,HSourceInterID,HSourceEntryID" +
+ ",HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+ ",HBeginDayQty,HBeginFixQty,HFixWorkDays,HTrunWorkDays,HReadyTimes" +
+ ",HReadyTime,HQueueTime,HMoveTime,HBatchNo" +
+ ") values("
+ + omodel.HInterID.ToString() + "," +(hentryid==-1?i: hentryid) + ",'" + oSub.HBillNo + "'," + oSub.HProcNo.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HWorkingQty.ToString() +
+ ",'" + oSub.HProcNumber + "','" + oSub.HWorkRemark + "'," + oSub.HCenterID.ToString() + "," + oSub.HDeptID.ToString() + ",'" + oSub.HDeptNumber + "'" +
+ "," + oSub.HGroupID.ToString() + ",'" + oSub.HGroupNumber + "'," + oSub.HWorkerID.ToString() + ",'" + oSub.HWorkerNumber + "'," + oSub.HSourceID.ToString() +
+ "," + oSub.HQty.ToString() + ",'" + oSub.HTimeUnit + "'," + oSub.HPlanWorkTimes.ToString() + ",'" + oSub.HPlanBeginDate.ToShortDateString() + "','" + oSub.HPlanEndDate.ToShortDateString() + "'" +
+ "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
+ ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() +
+ ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
+ "," + oSub.HBeginDayQty.ToString() + "," + oSub.HBeginFixQty.ToString() + "," + oSub.HFixWorkDays.ToString() + "," + oSub.HTrunWorkDays.ToString() + "," + oSub.HReadyTimes.ToString() +
+ "," + oSub.HReadyTime.ToString() + "," + oSub.HQueueTime.ToString() + "," + oSub.HMoveTime.ToString() + ",'" + oSub.HBatchNo + "'" +
+ ") ");
+ i++;
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ #endregion
+ /// <summary>
+ /// 杩斿洖鐢熶骇宸ュ簭娲惧伐鍗曞垪琛�
+ /// </summary>
+ /// <param name="sWhere"></param>
+ /// <returns></returns>
[Route("Sc_ProcessMangement/MES_Sc_ProcessSendWorkMain_Json")]
[HttpGet]
public object MES_Sc_ProcessSendWorkMain_Json(string sWhere)
diff --git a/WebAPI/Models/ClsSc_ProcessPlanMain.cs b/WebAPI/Models/ClsSc_ProcessPlanMain.cs
new file mode 100644
index 0000000..dcfd6b6
--- /dev/null
+++ b/WebAPI/Models/ClsSc_ProcessPlanMain.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WebAPI.Models
+{
+ public class ClsSc_ProcessPlanMain : DBUtility.ClsXt_BaseBillMain
+ {
+ public string HBillSubType;// varchar(10) --类型(普通)
+ public Int64 HCheckItemNowID;// int --当前审核项目(默认值 0)
+ public Int64 HCheckItemNextID;// int --待审核项目(默认值 0)
+ public Int64 HICMOInterID;// int --任务单ID(界面不显示)
+ public string HICMOBillNo;// varchar(50) --任务单号
+ public Int64 HMaterID;// int --产品ID
+ public string HMaterNumber;// varchar(100) --产品代码
+ public Int64 HUnitID;// int --单位ID
+ public string HUnitNumber;// varchar(50) --单位代码
+ public double HPlanQty;// dec(18,8) --生产数量
+ public DateTime HPlanBeginDate;// datetime --计划开工日期
+ public DateTime HPlanEndDate;// datetime --计划完工日期
+ public string HExplanation;// varchar(500) --摘要
+ public string HInnerBillNo;// varchar(50) --内部单据号
+ public bool HCloseType;// bit --关闭类型 (默认为0)
+
+
+ public int HWorkerID;
+ public int HProcNo;
+ public int HProcID;
+ public int HGroupID;
+ public int HDeptID;
+ public int HQty;
+ public int HSourceInterID;// int --源单内码
+ public int HSourceEntryID;// int --源单子内码
+ public string HSourceBillNo;// varchar(50) --源单号
+ public string HSourceBillType;// varchar(10) --源单类型
+ public int HSourceID;
+ }
+}
diff --git a/WebAPI/Models/ClsSc_ProcessPlanSub.cs b/WebAPI/Models/ClsSc_ProcessPlanSub.cs
new file mode 100644
index 0000000..75cd335
--- /dev/null
+++ b/WebAPI/Models/ClsSc_ProcessPlanSub.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WebAPI.Models
+{
+ public class ClsSc_ProcessPlanSub : DBUtility.ClsXt_BaseBillSub
+ {
+ public string HBillNo;// varchar(50) --工序计划单号(不可编辑,自动生成)
+ public Int64 HProcNo;// int --工序号
+ public Int64 HProcID;// int --工序
+ public string HProcNumber;// varchar(50) --工序代码
+ public string HWorkRemark;// varchar(200) --加工说明
+ public Int64 HCenterID;// int --工作中心ID
+ public Int64 HDeptID;// int --加工车间(部门ID)
+ public string HDeptNumber;// varchar(50) --加工车间代码(部门代码)
+ public Int64 HGroupID;// int --班组ID
+ public string HGroupNumber;// varchar(50) --班组代码
+ public Int64 HWorkerID;// int --操作工ID
+ public string HWorkerNumber;// varchar(50) --操作工代码
+ public Int64 HSourceID;// int --生产资源ID
+ public double HQty;// dec(18,8) --计划数量
+ public string HTimeUnit;// varchar(50) --时间单位(小时,分钟)
+ public Single HPlanWorkTimes;// money --工序计划加工时间
+ public DateTime? HPlanBeginDate;// datetime --工序计划开工日期
+ public DateTime? HPlanEndDate;// datetime --计划完工日期
+ public Int64 HICMOInterID;// int --任务单ID
+ public string HICMOBillNo;// varchar(50) --任务单号
+ public Int64 HSeOrderInterID;// int --销售订单主ID
+ public Int64 HSeOrderEntryID;// int --销售子ID
+ public string HSeOrderBillNo;// varchar(50) --销售订单号
+ public string HRemark;// --备注
+ public string HBatchNo;// --
+ public double HWorkingQty;
+ //新增
+ public Single HBeginDayQty; //money --开工余量(天数) addnew
+ public Single HBeginFixQty; //money --开工余量(固数) addnew
+ public Single HFixWorkDays; //money --上道固定天数 addnew
+ public Single HTrunWorkDays; //money --上道循环周期(暂不用) addnew
+ public Single HReadyTimes; //money --本道准备时间(暂不用) addnew
+ public Single HReadyTime; //money --准备时间( 默认为0) addnew
+ public Single HQueueTime; //money --排队时间( 默认为0) addnew
+ public Single HMoveTime; //money --转移时间( 默认为0) addnew
+ }
+}
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index 68e02bb..e461890 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -503,6 +503,8 @@
<Compile Include="Models\ClsSb_MouldRepairWorkBillSub.cs" />
<Compile Include="Models\ClsSc_PackUnionBillMain.cs" />
<Compile Include="Models\ClsSc_PackUnionBillSub.cs" />
+ <Compile Include="Models\ClsSc_ProcessPlanMain.cs" />
+ <Compile Include="Models\ClsSc_ProcessPlanSub.cs" />
<Compile Include="Models\ClsSc_ProcessReportMain.cs" />
<Compile Include="Models\ClsSc_ProcessReportSub.cs" />
<Compile Include="Models\ClsWW_PPBomBillMain.cs" />
--
Gitblit v1.9.1