From c14d65aa45f6fe0eedd558bc0de345a0ccd6e22a Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期四, 25 五月 2023 16:43:41 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/Sc_MouldOtherInBillController.cs | 588 +++++++++++++++++++++++++++++++++------------------------- 1 files changed, 334 insertions(+), 254 deletions(-) diff --git a/WebAPI/Controllers/Sc_MouldOtherInBillController.cs b/WebAPI/Controllers/Sc_MouldOtherInBillController.cs index 9e51174..60534ae 100644 --- a/WebAPI/Controllers/Sc_MouldOtherInBillController.cs +++ b/WebAPI/Controllers/Sc_MouldOtherInBillController.cs @@ -1,10 +1,10 @@ 锘縰sing Newtonsoft.Json.Linq; +using Pub_Class; using System; using System.Collections.Generic; using System.Data; using System.Web.Http; using WebAPI.Models; -using Pub_Class; namespace WebAPI.Controllers { /** @@ -12,10 +12,15 @@ */ public class Sc_MouldOtherInBillController : ApiController { + public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛� + private json objJsonResult = new json(); public DataSet ds = new DataSet(); public WebServer webserver = new WebServer(); - SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + public DAL.ClsSc_MouldScrapInBill BillNew0 = new DAL.ClsSc_MouldScrapInBill(); //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫� + public DAL.ClsSc_MouldScrapInBill BillOld0 = new DAL.ClsSc_MouldScrapInBill(); //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫� + /// <summary> /// 鏍规嵁鍖呰鍗� 杩斿洖姝ゅ寘瑁呭崟鍐呯殑鐩稿叧淇℃伅 @@ -23,17 +28,17 @@ /// <returns></returns> /// <summary> - /// 妯″叿鍏朵粬鍏ュ簱鍗曞垪琛� + /// 妫�鍏风淮淇伐鍗曞垪琛� /// </summary> /// <returns></returns> - [Route("Sc_MouldOtherInBill/GetMouldOtherInBillList")] + [Route("Sc_CheckToolsRepair/GetCheckToolsRepairWorkBillList")] [HttpGet] - public object GetMouldOtherInBillList(string sWhere) + public object GetCheckToolsRepairWorkBillList(string sWhere) { try { - ds = Sc_MouldOtherInBillList_s(sWhere); + ds = Sc_CheckToolsRepairWorkBillList_s(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objJsonResult.code = "0"; @@ -64,105 +69,324 @@ #region sql璇彞 - public static DataSet Sc_MouldOtherInBillList_s(string sWhere) + public static DataSet Sc_CheckToolsRepairWorkBillList_s(string sWhere) { - return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldOtherInBillList ", "h_v_Sc_MouldOtherInBillList"); + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_CheckToolsRepairWorkBillList ", "h_v_Sc_CheckToolsRepairWorkBillList"); } - #endregion + #region 鍏朵粬鍏ュ簱鍗� - /// <summary> - /// 淇敼鍗曟嵁-淇濆瓨鎸夐挳 - ///鍙傛暟锛歴tring sql銆� - ///杩斿洖鍊硷細object銆� - /// </summary> - [Route("Sc_MouldOtherInBill/AddBill1")] - [HttpPost] - public object AddBill1([FromBody] JObject oMain) + #region 鍏朵粬鍏ュ簱鍗曞垪琛� + + [Route("Sc_MouldOtherInBill/GetMouldOtherInBill")] + [HttpGet] + public object GetMouldOtherInBill(string sWhere,string user, string Organization) { - try { - DAL.ClsSc_MouldOtherInBill oMould = new DAL.ClsSc_MouldOtherInBill(); + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Sc_MouldOtherInBillList", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } - var _value = oMain["oMain"].ToString(); - string msg1 = _value.ToString(); - string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); - string msg2 = sArray[0].ToString(); - string msg3 = sArray[1].ToString(); - string msg4 = sArray[2].ToString(); - string msg5 = sArray[3].ToString(); - //鍙嶅簭鍒楀寲 - msg2 = "[" + msg2.ToString() + "]"; - List<Sc_MouldStockBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Sc_MouldStockBillMain>>(msg2); + ds = Sc_MouldOtherInBill(sWhere, Organization); - long HItemID = list[0].HInterID; - string HBillNo = list[0].HBillNo; - DateTime HDate = list[0].HDate; - long HSCWHID = list[0].HSCWHID; - long HWHID = list[0].HWHID; - long HSupID = list[0].HSupID; - long HSecManagerID = list[0].HSecManagerID; - long HRepairID = list[0].HRepairID; - long HManagerID = list[0].HManagerID; - string HUpDater = list[0].HUpDater; - long HDeptID = list[0].HDeptID; - - - - - - - //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� - oCN.BeginTran(); - //涓昏〃 - oCN.RunProc("Update Sc_MouldStockBillMain set " + - " HSCWHID=" + HSCWHID + - ",HWHID=" + HWHID + - ",HSupID=" + HSupID + - ",HSecManagerID=" + HSecManagerID + - ",HManagerID= " + HManagerID + " Where HInterID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); - //淇敼瀛愰」鐩唬鐮� - //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_EquipMent,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); - //灏嗕笂绾� 涓洪潪鏈骇 - //oCN.RunProc("Update Gy_EquipMent set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); - // - oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; - objJsonResult.Message = "淇敼鍗曟嵁鎴愬姛锛�"; - //objJsonResult.data = null; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; return objJsonResult; } - catch (Exception e) + catch (Exception ex) { - oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } - - - /// <summary> - /// 妯″叿鍏ュ簱鍗曞垪琛ㄥ垹闄ゆ寜閽� - ///鍙傛暟锛歴tring sql銆� - ///杩斿洖鍊硷細object銆� - /// </summary> - [Route("Sc_MouldOtherInBill/Delete_Json")] - [HttpGet] - public object Delete_Json(long HItemID) + public static DataSet Sc_MouldOtherInBill(string sWhere, string Organization) { - DAL.ClsSc_MouldOtherInBill oMould = new DAL.ClsSc_MouldOtherInBill(); + string sql1 = string.Format(@"select * from h_v_Sc_MouldOtherInBillList where 搴撳瓨缁勭粐='" + Organization + "'"); + if (sWhere == null || sWhere.Equals("")) + { + return new SQLHelper.ClsCN().RunProcReturn(sql1 + "order by 鍒跺崟鏃ユ湡 desc", "h_v_Sc_MouldOtherInBillList"); + } + else + { + string sql = sql1 + sWhere+ "order by 鍒跺崟鏃ユ湡 desc"; + return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldOtherInBillList"); + } + + } + + #endregion + + #region[鍣ㄥ叿鍏朵粬鍏ュ簱鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁] + [Route("Sc_MouldOtherInBill/Sc_MouldOtherInBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_MouldOtherInBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldOtherInBillList where hmainid= " + HID + " ", "h_v_Sc_MouldOtherInBillList"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄩ��搴撳崟鍙�" }; + + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + + #region[鍣ㄥ叿鍏朵粬鍏ュ簱鍗曠紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁] + [Route("Sc_MouldOtherInBill/Sc_MouldOtherInBillListProjectDetai")] + [HttpGet] + public object Sc_MouldOtherInBillListProjectDetai(string sqlWhere) + { + DataSet ds; + DataSet ds1; + List<object> list = new List<object>(); try { - if (oMould.omodel.HBillStatus > 1) + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,鎵规 HBatchNo, + 璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 绱Н浣跨敤瀵垮懡 HUseLife, 搴斿彂鏁伴噺 HQtyMust, 瀹炲彂鏁伴噺 HQty, + 鍗曚环 HPrice, 閲戦 HMoney,鏀舵枡浠撳簱ID HWHID, 鏀舵枡浠撳簱浠g爜 HWHCode, 鏀舵枡浠撳簱 HWHName,HSPID, + 浠撲綅浠g爜 HSPCode, 浠撲綅 HSPName,琛ㄤ綋澶囨敞 HRemark,HStockOrgID FROM h_v_Sc_MouldOtherInBillList"), "h_v_Sc_MouldOtherInBillList"); + + } + else + { + //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; + string sql1 = string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,鎵规 HBatchNo, + 璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 绱Н浣跨敤瀵垮懡 HUseLife, 搴斿彂鏁伴噺 HQtyMust, 瀹炲彂鏁伴噺 HQty, + 鍗曚环 HPrice, 閲戦 HMoney,鏀舵枡浠撳簱ID HWHID, 鏀舵枡浠撳簱浠g爜 HWHCode, 鏀舵枡浠撳簱 HWHName,HSPID, + 浠撲綅浠g爜 HSPCode, 浠撲綅 HSPName,琛ㄤ綋澶囨敞 HRemark,HStockOrgID FROM h_v_Sc_MouldOtherInBillList where 1 = 1 "); + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldOtherInBillList"); + + } + //鏌ユ眹鎬� + ds1 = oCN.RunProcReturn(string.Format(@"select 鐗╂枡浠g爜,max(鐗╂枡鍚嶇О)鐗╂枡鍚嶇О,瑙勬牸鍨嬪彿,max(鍗曟嵁鍙�)鍗曟嵁鍙�,鎵规,sum(瀹炲彂鏁伴噺)瀹炲彂鏁伴噺, + 鏀舵枡浠撳簱ID,max(鏀舵枡浠撳簱浠g爜)鏀舵枡浠撳簱浠g爜,max(鏀舵枡浠撳簱)鏀舵枡浠撳簱,琛ㄤ綋澶囨敞 from h_v_Sc_MouldOtherInBillList + where 1=1 " + sqlWhere + " group by 鐗╂枡浠g爜,瑙勬牸鍨嬪彿,鏀舵枡浠撳簱ID,鎵规,琛ㄤ綋澶囨敞"), "h_v_Sc_MouldOtherInBillList"); + + list.Add(ds.Tables[0]); + list.Add(ds1.Tables[0]); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.list = list; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + #region 鍣ㄥ叿鍏朵粬鍏ュ簱鍗曚繚瀛�/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿棰嗙敤鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MouldOtherInBill/SaveGetMouldOtherInBillList")] + [HttpPost] + public object SaveGetMouldOtherInBillList([FromBody] JObject msg) + { + var _value = msg["msg"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); + string msg3 = sArray[1].ToString(); + string msg4 = sArray[2].ToString(); + + string UserName = ""; + ListModels oListModels = new ListModels(); + try + { + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Sc_MouldOtherInBill_Edit", 1, false, msg4)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + DLL.ClsSc_MouldOtherInBill oBill = new DLL.ClsSc_MouldOtherInBill(); + List<Model.ClsSc_MouldOtherInBillMain> lsmain = new List<Model.ClsSc_MouldOtherInBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sc_MouldOtherInBillMain(msg2); + foreach (Model.ClsSc_MouldOtherInBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3841"; + oItem.HBillSubType = "3841"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + //琛ㄤ綋鏁版嵁 + //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� + msg3 = msg3.Substring(1, msg3.Length - 2); + msg3 = msg3.Replace("\\", ""); + msg3 = msg3.Replace("\n", ""); //\n + //msg2 = msg2.Replace("'", "鈥�"); + List<Model.ClsSc_MouldStockBillSub> ls = new List<Model.ClsSc_MouldStockBillSub>(); + ls = oListModels.getObjectByJson_Gy_MouldStockBillSub(msg3); + int i = 0; + foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + + //oItemSub.HRepairCheckID = 0; //楠屾敹椤圭洰ID + //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'in','{oBill.omodel.HInterID.ToString()}' "); + oCn.RunProc(sql); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼鎴愬姛 + //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 1,{oBill.omodel.HInterID.ToString()},' ' "); + string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); + oCn.RunProc(sql); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + objJsonResult.data = 1; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = 1; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + #endregion + + #region [鍣ㄥ叿鍏朵粬鍏ュ簱鍗曞垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿澶勭悊棰嗙敤鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sc_MouldOtherInBill/DeltetMouldOtherInBill")] + [HttpGet] + public object DeltetMouldOtherInBill(string HInterID,string user) + { + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Sc_MouldOtherOutBill_Delete", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); + if (lngBillKey == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + DLL.ClsSc_MouldOtherInBill oBill = new DLL.ClsSc_MouldOtherInBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -170,7 +394,7 @@ objJsonResult.data = null; return objJsonResult; } - if (oMould.omodel.HChecker != "") + if (oBill.omodel.HChecker != "") { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -178,195 +402,51 @@ objJsonResult.data = null; return objJsonResult; } - // - if (oMould.DeleteBill(HItemID, ref DBUtility.ClsPub.sExeReturnInfo)) - { - ////鍐欏叆鏃ュ織 - //ClsPub.Add_Log("", "鍒犻櫎椤圭洰锛屼唬鐮侊細" + oMould.omodel.hn + ",鍚嶇О锛�" + oMould.omodel.HName, ClsPub.CurUserName); - //鏇存柊涓婄骇涓� 鏈骇 - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = "鍒犻櫎鎴愬姛"; - objJsonResult.data = null; - return objJsonResult; - } - else - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍒犻櫎澶辫触"; - objJsonResult.data = null; - return objJsonResult; - } - //ds = oCN.RunProcReturn("delete from Gy_Department where HItemID = " + HItemID, "Gy_Department"); - - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = "鍒犻櫎鎴愬姛"; - objJsonResult.data = null; - return objJsonResult; - } - catch (Exception e) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "Exception锛�" + e.ToString(); - objJsonResult.data = null; - return objJsonResult; - } - } - - - - -/// <summary> -/// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 -///鍙傛暟锛歴tring sql銆� -///杩斿洖鍊硷細object銆� -/// </summary> -[Route("Sc_MouldOtherInBill/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(); - try - { - msg2 = "[" + msg2.ToString() + "]"; - List<Sc_MouldStockBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Sc_MouldStockBillMain>>(msg2); - string BillType = "3795"; - long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D - string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿 - DateTime HDate = mainList[0].HDate;//鏃ユ湡 - int HYear = 2021; - double HPeriod = 1; - string HRemark = mainList[0].HRemark;//澶囨敞 - string HMaker = mainList[0].HMaker;//鍒跺崟浜� - long HSCWHID = mainList[0].HSCWHID;// - long HSupID = mainList[0].HSupID;// - long HEmpID = mainList[0].HEmpID; - long HManagerID = mainList[0].HManagerID;// - long HWHID = mainList[0].HWHID;// - long HProcID = mainList[0].HProcID;// - long HSecManagerID = mainList[0].HSecManagerID;// - long HKeeperID = mainList[0].HKeeperID;// - long HDeptID = mainList[0].HDeptID; - string HExplanation = mainList[0].HExplanation;// - string HInnerBillNo = mainList[0].HInnerBillNo;// - string HRedBlueFlag = mainList[0].HRedBlueFlag;// - string HRepairType = mainList[0].HRepairType;// - long HRepairID = mainList[0].HRepairID;// - - //涓昏〃 - oCN.RunProc("Insert Into Sc_MouldStockBillMain " + - "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + - ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + - ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + - ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + - ") " + - " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" + - "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()" + - "," + HSupID + "," + HWHID + "," + HSCWHID + "," + HEmpID + "," + HManagerID + "," + HSecManagerID + - "," + HKeeperID + "," + HDeptID + ",'" + HExplanation + "','" + HInnerBillNo + "','" + HRedBlueFlag + "'" + - ") "); - - //淇濆瓨瀛愯〃 - objJsonResult = AddBillSub(msg3, HInterID); - if (objJsonResult.code == "0") + //鍒犻櫎鍓嶆煡鎵惧綋鍓嶅崟鎹殑鎵�鏈夊櫒鍏稩D + //string swhere = ""; + //DataSet ds = oCn.RunProcReturn("select HMaterID from Sc_MouldStockBillSub where HinterID=" + HInterID, "Sc_MouldStockBillSub"); + //for (var i = 0; i < ds.Tables[0].Rows.Count; i++) + //{ + // swhere = swhere + ds.Tables[0].Rows[i]["HMaterID"].ToString() + ","; + //} + //swhere = swhere.Substring(0, swhere.Length - 1); + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) { + //鍒犻櫎鎴愬姛淇敼鍣ㄥ叿妗f浣嶇疆 + //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 0,0,'{swhere}' "); + string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); + oCn.RunProc(sql); objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = objJsonResult.Message; + objJsonResult.count = 1; + objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = null; - objJsonResult.data = null; - return objJsonResult; + else + { + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } } - catch (Exception e) + else { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.Message = "鍗曟嵁鏈壘鍒�"; objJsonResult.data = null; return objJsonResult; } } + #endregion - public json AddBillSub(string msg3, long HInterID) - { - List<Sc_MouldStockBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Sc_MouldStockBillSub>>(msg3); - for (int i = 0; i < subList.ToArray().Length; i++) - { - long HMaterID = 0;//鐗╂枡ID - long HPropertyID = 0;// - long HSecUnitID = 0;// - long HUnitID = 0;// - long HWHID = 0;// - long HSCWHID = 0;// - long HSPID = 0;// - long HSCSPID = 0;// - long HSPGroupID = 0;// - long HLifeUnitID = 0;// - - oCN.RunProc("Insert into Sc_MouldStockBillSub " + - " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + - ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + - ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + - ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + - ",HDesignLife,HLeaveLife,HUseLife,HUseLifeQty" + - ",HSCSPID,HSPGroupID,HBatchNo" + - ",HNewModel,HWallThickness,HHardness,HLastProdModel,HDiameter,HBackFlag" + - ",HQtyRel,HNewLifeQty,HNowModel,HNowLife" + - ",HMouldType,HInitModel,HInitDesignLife,HLifeUnitID" + - ") values(" - + HInterID + "," + i + ",'','','','" + subList[i].HRemark + "'" + - "," + subList[i].HSourceInterID + "," + subList[i].HSourceEntryID + ",'" + subList[i].HSourceBillNo + "','" + subList[i].HSourceBillType + "','" + subList[i].HrelationQty + "','" + subList[i].HrelationQty + "'" + - "," + HMaterID + "," + HPropertyID + "," + HSecUnitID + ",'" + subList[i].HSecUnitRate + "','" + HUnitID + "','" + subList[i].HQtyMust + "'" + - ",'" + subList[i].HQty + "','" + subList[i].HPrice + "','" + subList[i].HMoney + "'," + HWHID + "," + HSCWHID + "," + HSPID + - ",'" + subList[i].HDesignLife + "','" + subList[i].HLeaveLife + "','" + subList[i].HUseLife + "','" + subList[i].HUseLifeQty + "'" + - "," + HSCSPID + "," + HSPGroupID + ",'" + subList[i].HBatchNo + "'" + - ",'" + subList[i].HNewModel + "','" + subList[i].HWallThickness + "','" + subList[i].HHardness + "','" + subList[i].HLastProdModel + "','" + subList[i].HDiameter + "','" + subList[i].HBackFlag + "'" + - ",'" + subList[i].HQtyRel + "','" + subList[i].HNewLifeQty + "','" + subList[i].HNowModel + "','" + subList[i].HNowLife + "'" + - ",'" + subList[i].HMouldType + "','" + subList[i].HInitModel + "','" + subList[i].HInitDesignLife + "'," + HLifeUnitID + - ") "); - } - - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = null; - objJsonResult.data = null; - return objJsonResult; - } } -} \ No newline at end of file +} +#endregion +#endregion \ No newline at end of file -- Gitblit v1.9.1