From 77d1eb907a434e215096601752597e36aa88b1d4 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期一, 04 九月 2023 13:15:11 +0800
Subject: [PATCH] 工序流转卡排缸
---
WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs | 2
WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs | 1
WebAPI/Controllers/LMESController.cs | 268 ++++++++++++++++++++++++++++++++++++++++++++
WebAPI/Controllers/BaseSet/Gy_SourceController.cs | 81 +++++++++++++
4 files changed, 351 insertions(+), 1 deletions(-)
diff --git a/WebAPI/Controllers/BaseSet/Gy_SourceController.cs b/WebAPI/Controllers/BaseSet/Gy_SourceController.cs
index bbde934..5956b12 100644
--- a/WebAPI/Controllers/BaseSet/Gy_SourceController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_SourceController.cs
@@ -307,6 +307,87 @@
return model;
}
+ #region 鐢熶骇璧勬簮 鏍戝舰鍥�
+ public class TreeModel
+ {
+ public string id { get; set; }
+ public string title { get; set; }
+ public List<TreeModel> children = new List<TreeModel>();
+ }
+ [Route("Gy_Source/Gy_SourceTreeList")]
+ [HttpGet]
+ public object Gy_SourceTreeList()
+ {
+ try
+ {
+ string sql1 = string.Format("select hitemid,hnumber,hname from Gy_Source order by hnumber");
+
+ ds = oCN.RunProcReturn(sql1, "Gy_Source");
+
+ List<TreeModel> treeModels = new List<TreeModel>();
+ TreeModel first = new TreeModel();
+ first.id = "0";
+ first.title = "鐢熶骇璧勬簮璁剧疆";
+ treeModels.Add(first);
+
+ foreach (DataRow row in ds.Tables[0].Rows)
+ {
+ var strLen = row["hitemid"].ToString().Split('.');
+ if (strLen.Length == 1)
+ {
+ TreeModel tree = new TreeModel();
+ tree.id = row["hitemid"].ToString();
+ tree.title = row["hname"].ToString();
+ treeModels[0].children.Add(tree);
+ }
+ }
+ digui(ds.Tables[0], treeModels[0].children, 2);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels);
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ /// <summary>
+ /// 閫掑綊鍑芥暟
+ /// </summary>
+ public void digui(DataTable dt, List<TreeModel> tree, int num)
+ {
+ for (int m = 0; m < tree.Count; m++)
+ {
+ tree[m].children = new List<TreeModel>();
+ for (int i = 0; i < dt.Rows.Count; i++)//绗竴娆″惊鐜紝寰楀埌鎵�鏈夋牴鑺傜偣鐨勫瓙闆�
+ {
+ var strLen = dt.Rows[i]["hnumber"].ToString().Split('.');
+ if (strLen.Length == num && dt.Rows[i]["hnumber"].ToString().Contains(tree[m].id + "."))
+ {
+ TreeModel tbjson = new TreeModel();
+ tbjson.id = dt.Rows[i]["hitemid"].ToString();
+ tbjson.title = dt.Rows[i]["hname"].ToString();
+ tree[m].children.Add(tbjson);
+ }
+ }
+ var strLens = tree[m].id.Split('.');
+ for (int i = 0; i < tree[m].children.Count; i++)
+ {
+ digui(dt, tree[m].children, strLens.Length + 2);//鍐嶆鐢ㄥ瓙闆嗗幓寰幆锛屾嬁鍑哄瓙闆嗙殑瀛愰泦
+ }
+ }
+
+ }
+ #endregion
+
/// <summary>
/// 鐢熶骇璧勬簮鍒犻櫎鍔熻兘
/// </summary>
diff --git a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
index 9e8244e..22547e6 100644
--- a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
+++ b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
@@ -69,6 +69,7 @@
oItem.HBillSubType = OperationType=="5"?"SUB":"3772";
oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
+ oItem.HDate = OperationType == "5" ? DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")) : oItem.HDate;
if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
{
objJsonResult.code = "0";
diff --git a/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs b/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
index 118d58b..364928c 100644
--- a/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
+++ b/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
@@ -149,7 +149,7 @@
long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿
- DateTime HDate = mainList[0].HDate;//鏃ユ湡
+ DateTime HDate = OperationType == 4 ? DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")) : mainList[0].HDate;//鏃ユ湡
int HYear = DateTime.Now.Year;
double HPeriod = DateTime.Now.Month;
string HRemark = mainList[0].HRemark;//澶囨敞
diff --git a/WebAPI/Controllers/LMESController.cs b/WebAPI/Controllers/LMESController.cs
index 6b74fad..12bc5d0 100644
--- a/WebAPI/Controllers/LMESController.cs
+++ b/WebAPI/Controllers/LMESController.cs
@@ -117,6 +117,274 @@
}
}
+
+ /// <summary>
+ /// 宸ュ簭娴佽浆鍗″彧鏄剧ず宸ュ簭鏌撳巶鐨勬暟鎹�
+ /// </summary>
+ /// <param name="sWhere"></param>
+ /// <param name="user"></param>
+ /// <returns></returns>
+ [Route("LEMS/MES_ProcessExchangeBillList_Json")]
+ [HttpGet]
+ public object MES_ProcessExchangeBillList_Json(string sWhere, string user,int OperationType)
+ {
+ DataSet ds;
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡璇㈡潈闄�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (OperationType == 1) {
+ //鑾峰彇绯荤粺鍙傛暟
+ string Ret = "";
+ if (oSystemParameter.ShowBill(ref Ret))
+ {
+ //鍒ゆ柇瀹㈡埛涓轰箶涓�
+ if (oSystemParameter.omodel.WMS_CampanyName == "涔斾竴")
+ {
+ sWhere += " and 宸ュ簭='鏌撳巶' ";
+
+ }
+ else {
+ sWhere += " and 宸ュ簭='绮楃(' ";
+ }
+ }
+
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillList where 1 = 1 " + sWhere + " order by hmainid desc ", "h_v_Sc_ProcessExchangeBillList");
+ }
+ else
+ {
+ //鑾峰彇绯荤粺鍙傛暟
+ string Ret = "";
+ if (oSystemParameter.ShowBill(ref Ret))
+ {
+ //鍒ゆ柇瀹㈡埛涓洪緳灞辨苯閰�
+ if (oSystemParameter.omodel.WMS_CampanyName == "涔斾竴")
+ {
+
+
+ }
+ }
+
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeArrangementList where 1 = 1 " + sWhere , "h_v_Sc_ProcessExch_v_Sc_ProcessExchangeArrangementListhangeBillList");
+ }
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.list = columnNameList;
+ 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;
+ }
+ }
+
+ #region 鎺掔几鍔熻兘
+ [Route("LEMS/ProcessExchangeArrangement_Add")]
+ [HttpGet]
+ public object ProcessExchangeArrangement_Add(string HInterID_S, int HSourceID,long HOrgID,string user)
+ {
+ DataSet ds;
+ DataSet ds1;
+ try
+ {
+ var HNum = HInterID_S.Split(',');
+
+ oCN.BeginTran();
+
+ for (int j = 0; j < HNum.Length; j++)
+ {
+ long HInterID = long.Parse(HNum[j].Split('|')[0]);
+ long HEntryID = long.Parse(HNum[j].Split('|')[1]);
+ ds = oCN.RunProcReturn(@"select a.HMaterID,b.HProcID,a.HBillNo from Sc_ProcessExchangeBillMain a inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID
+where a.HInterID=" + HInterID + " and b.HEntryID=" + HEntryID, "Sc_ProcessExchangeBillMain");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ユ棤姝ゅ伐搴忔祦杞崱锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //鏌ヨ瀛愬伐鑹鸿矾绾跨墿鏂� 宸ュ簭
+ string HMaterID = ds.Tables[0].Rows[0]["HMaterID"].ToString();
+ string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString();
+
+ ds1 = oCN.RunProcReturn(@"select a.HMaterID,a.HMainProcID,b.* from Gy_RoutingBillMain a inner join Gy_RoutingBillSub b on a.HInterID=b.HInterID where a.HMaterID=" + HMaterID + " and a.HMainProcID=" + HProcID + " and a.HBillSubType='SUB'", "Gy_RoutingBillMain");
+ if (ds1.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娌℃湁鐩稿搴旂殑榛樿宸ヨ壓璺嚎,璇峰厛璁剧疆宸ヨ壓璺嚎锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ DAL.ClsSc_ProcessExchangeBill oBill = new DAL.ClsSc_ProcessExchangeBill();
+ string sReturn = "";
+ DBUtility.ClsPub.HOrgID = HOrgID;
+ oBill.ShowBill(HInterID, ref sReturn);
+
+ long HInterID1 = DBUtility.ClsPub.CreateBillID(oBill.omodel.HBillType, ref DBUtility.ClsPub.sExeReturnInfo);
+ string HBillNo = DBUtility.ClsPub.CreateBillCode(oBill.omodel.HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
+ oBill.omodel.HInterID = HInterID1;
+ oBill.omodel.HBillNo = HBillNo;
+ oBill.omodel.HBillSubType = "SUB";
+ oBill.omodel.HDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
+ oBill.omodel.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+ oBill.omodel.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
+ oBill.omodel.HMaker = user;
+ oBill.omodel.HMakeDate = DateTime.Now.ToString();
+ oBill.omodel.HMainSourceInterID = HInterID;
+ oBill.omodel.HMainSourceEntryID = HEntryID;
+ oBill.omodel.HMainSourceBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+
+ oBill.DetailColl.Clear();
+
+
+ for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
+ {
+ Model.ClsSc_ProcessExchangeBillSub oSub = new Model.ClsSc_ProcessExchangeBillSub();
+ oSub.HInterID = HInterID1;
+ oSub.HEntryID = (i + 1);
+ oSub.HProcNo = long.Parse(ds1.Tables[0].Rows[i]["HProcNo"].ToString());
+ oSub.HProcID = long.Parse(ds1.Tables[0].Rows[i]["HProcID"].ToString());
+ oSub.HWorkRemark = ds1.Tables[0].Rows[i]["HRemark"].ToString();
+ oSub.HCenterID = long.Parse(ds1.Tables[0].Rows[i]["HCenterID"].ToString());
+ oSub.HSupID = long.Parse(ds1.Tables[0].Rows[i]["HSupID"].ToString());
+ oSub.HSupFlag = ds1.Tables[0].Rows[i]["HSupFlag"].ToString() == "1" ? true : false;
+ oSub.HQty = oBill.omodel.HQty;
+ oSub.HTechnologyParameter = "";
+ oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+ oBill.DetailColl.Add(oSub);
+ }
+
+
+ bool bResult = false;
+ bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+
+ oCN.RunProc("update Sc_ProcessExchangeBillSub set HSourceID=" + HSourceID + " where HInterID=" + HInterID + " and HEntryID=" + HEntryID);
+
+ if (!bResult)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娲惧伐澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ 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
+
+ #region 鍙栨秷鎺掔几鍔熻兘
+ [Route("LEMS/ProcessExchangeArrangementDel")]
+ [HttpGet]
+ public object ProcessExchangeArrangementDel(string HInterID_S, int HSourceID, long HOrgID, string user)
+ {
+ DataSet ds;
+ DataSet ds1;
+ try
+ {
+ var HNum = HInterID_S.Split(',');
+
+ oCN.BeginTran();
+
+ for (int j = 0; j < HNum.Length; j++)
+ {
+
+ ds = oCN.RunProcReturn(@"select * from Sc_ProcessExchangeBillMain a where a.HInterID=" + HNum[j], "Sc_ProcessExchangeBillMain");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ユ棤姝ゅ瓙宸ュ簭娴佽浆鍗★紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ string HMainSourceInterID = ds.Tables[0].Rows[0]["HMainSourceInterID"].ToString();
+ string HMainSourceEntryID = ds.Tables[0].Rows[0]["HMainSourceEntryID"].ToString();
+
+ ds1 = oCN.RunProcReturn(@"select * from Sc_ProcessExchangeBillMain where HInterID=" + HMainSourceInterID, "Sc_ProcessExchangeBillMain");
+ if (ds1.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ユ棤姝ゅ瓙宸ュ簭娴佽浆鍗″搴旂殑涓诲伐搴忔祦杞崱锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ oCN.RunProc("update Sc_ProcessExchangeBillSub set HSourceID=0 where HInterID=" + HMainSourceInterID + " and HEntryID=" + HMainSourceEntryID);
+ oCN.RunProc("delete from Sc_ProcessExchangeBillMain where HInterID=" + HNum[j]);
+ oCN.RunProc("delete from Sc_ProcessExchangeBillSub where HInterID=" + HNum[j]);
+ }
+
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ 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
+
/// <summary>
/// 杩斿洖宸ュ簭娴佽浆鍗$淮鎶ゅ垪琛ㄤ粠琛�
///鍙傛暟锛歴tring sql銆�
--
Gitblit v1.9.1