From 957b51cfdeb4374d817086a2ca761c75545e206d Mon Sep 17 00:00:00 2001 From: wtt <1985833171@qq.com> Date: 星期四, 28 十一月 2024 16:59:56 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/Sc_MouldRepairInBillListController.cs | 3258 +++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 2,709 insertions(+), 549 deletions(-) diff --git a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs index 205b36f..081f353 100644 --- a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs +++ b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs @@ -4,6 +4,8 @@ using System; using System.Collections.Generic; using System.Data; +using System.IO; +using System.Web; using System.Web.Http; using ViewAPI; using WebAPI.Models; @@ -22,9 +24,11 @@ public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); public DAL.ClsSc_MouldScrapInBill BillNew0 = new DAL.ClsSc_MouldScrapInBill(); //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫� public DAL.ClsSc_MouldScrapInBill BillOld0 = new DAL.ClsSc_MouldScrapInBill(); //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫� + string fileip = System.Configuration.ConfigurationManager.AppSettings["FileIP"]; /// <summary> @@ -425,6 +429,7 @@ { try { + List<object> columnNameList = new List<object>(); if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainPlanBillList", 1, false, user)) { objJsonResult.code = "0"; @@ -436,12 +441,21 @@ ds = Sc_MouldMaintainPlanBillList_s(sWhere); + //娣诲姞鍒楀悕 + 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鍒楀璞$殑鍒楀悕 + } + //if (ds.Tables[0].Rows.Count != 0 || ds != null) //{ objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess锛�"; objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; return objJsonResult; //} //else @@ -592,6 +606,49 @@ } #endregion + #region 鍣ㄥ叿瀵垮懡鑰楃敤鍒嗘瀽鎶ヨ〃 + [Route("Sc_MouldRepairInBillList/Get_Sc_MouldLifeUsePicReport")] + [HttpGet] + public object Get_Sc_MouldLifeUsePicReport(string sWhere) + { + try + { + List<object> columnNameList = new List<object>(); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_Sc_MouldLifeUsePicReport order by 鏈堜唤 desc", "h_v_Sc_MouldLifeUsePicReport"); + } + else + { + string sql1 = "select * from h_v_Sc_MouldLifeUsePicReport where 1 = 1 "; + string sql = sql1 + sWhere + " order by 鏃ユ湡 "; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldLifeUsePicReport"); + } + //娣诲姞鍒楀悕 + 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.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion /// <summary> @@ -1020,6 +1077,17 @@ oBill.DetailColl.Add(oItemSub); } + + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } + //淇濆瓨 //淇濆瓨瀹屾瘯鍚庡鐞� bool bResult; @@ -1163,12 +1231,20 @@ return objJsonResult; } + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } ClsPub.CurUserName = user; BillOld.MvarItemKey = "Kf_ICStockBillMain"; oCN.BeginTran();//寮�濮嬩簨鍔� - - //Type 1 瀹℃牳 2 鍙嶅鏍� if (Type == 1) @@ -1266,7 +1342,6 @@ return objJsonResult; } //=========================================================== - //鍙嶅鏍稿崟鎹� if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_MoveStockBill_AfterUnCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) @@ -1550,6 +1625,7 @@ { try { + List<object> columnNameList = new List<object>(); //瀹氫箟澹版槑鍙橀噺 锛屾妸閫氳繃 new List<object>()鍒涘缓鐨� 瀹炰緥锛岃祴鍊肩粰鍙橀噺 //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄� if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockBillQuery", 1, false, user)) { @@ -1569,11 +1645,18 @@ string sql = "select * from h_v_IF_MoveStockBillList where 1=1 " + sWhere+ "order by hmainid desc"; ds = oCN.RunProcReturn(sql, "h_v_IF_MoveStockBillList"); } + foreach (DataColumn col in ds.Tables[0].Columns)//閬嶅巻ds涓涓�涓〃锛圱ables[0]锛夌殑鎵�鏈夊垪锛圕olumns锛夋瘡娆″惊鐜腑锛宑ol鍙橀噺浼氭寔鏈夊綋鍓嶅垪鐨勫紩鐢� + { + Type dataType = col.DataType; //鑾峰彇褰撳墠鏁版嵁绫诲瀷浼犲叆 鑷畾涔夊彉閲廳atadataType + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //瀛楃涓叉嫾鎺� // 灏嗗垪鍚嶅拰鏁版嵁绫诲瀷淇℃伅鎷兼帴鎴愪竴涓狫SON鏍煎紡鐨勫瓧绗︿覆 + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess锛�"; objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; return objJsonResult; } @@ -1630,9 +1713,19 @@ } //================================================================================== + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } + oCN.BeginTran(); - //鍒嗗竷寮忚皟鍏ュ崟鏂板鍥炲~鍒嗗竷寮忚皟鍑哄崟鍏宠仈鏁伴噺 + //鐩存帴璋冩嫧鍗� 鍒犻櫎 鎾ら攢 鍥炲~ 璋冩嫧鐢宠鍗� 鍏宠仈鏁伴噺 oCN.RunProc("exec h_p_Kf_UpDateRelation_MoveStockRequestToPOStockIn_Del " + HInterID); oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID); @@ -1682,6 +1775,43 @@ } #endregion + #region 鐩存帴璋冩嫧鍗� 鏍规嵁涓诲唴鐮佷笌瀛愬唴鐮佽幏鍙栬皟鎷ㄧ敵璇峰崟鏁版嵁 + [Route("Kf_MoveStockBill/loadKf_MoveStockBillMain_Push")] + [HttpGet] + public object loadKf_MoveStockBillMain_Push(long HInterID, long HSubID) + { + try + { + + ds = oCN.RunProcReturn("select * from h_v_IF_MoveStockRequestBillList_Litee where hmainid =" + HInterID + " and hsubid = " + HSubID, "h_v_IF_MoveStockRequestBillList_Litee"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏈煡璇㈠埌婧愬崟淇℃伅锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + #endregion @@ -1695,6 +1825,7 @@ { try { + List<object> columnNameList = new List<object>(); //瀹氫箟澹版槑鍙橀噺 锛屾妸閫氳繃 new List<object>()鍒涘缓鐨� 瀹炰緥锛岃祴鍊肩粰鍙橀噺 //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄� if (!DBUtility.ClsPub.Security_Log("Kf_SellOutBillQuery", 1, false, user)) { @@ -1706,6 +1837,12 @@ } ds = Sc_GetSellOutBillList(sWhere); + foreach (DataColumn col in ds.Tables[0].Columns)//閬嶅巻ds涓涓�涓〃锛圱ables[0]锛夌殑鎵�鏈夊垪锛圕olumns锛夋瘡娆″惊鐜腑锛宑ol鍙橀噺浼氭寔鏈夊綋鍓嶅垪鐨勫紩鐢� + { + Type dataType = col.DataType; //鑾峰彇褰撳墠鏁版嵁绫诲瀷浼犲叆 鑷畾涔夊彉閲廳atadataType + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //瀛楃涓叉嫾鎺� // 灏嗗垪鍚嶅拰鏁版嵁绫诲瀷淇℃伅鎷兼帴鎴愪竴涓狫SON鏍煎紡鐨勫瓧绗︿覆 + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } //if (ds.Tables[0].Rows.Count != 0 || ds != null) //{ @@ -1713,6 +1850,7 @@ objJsonResult.count = 1; objJsonResult.Message = "Sucess锛�"; objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; return objJsonResult; //} //else @@ -1733,6 +1871,66 @@ return objJsonResult; } } + + #region 閿�鍞嚭搴撳崟鍒楄〃-鍒嗛〉 + /// <summary> + /// 閿�鍞嚭搴撳崟鍒楄〃 + /// </summary> + /// <returns></returns> + [Route("Kf_SellOutBill/GetSellOutBillList_byPage")] + [HttpGet] + public object GetSellOutBillList_byPage(string sWhere, string user, string Organization, int page, int size) + { + try + { + List<object> columnNameList = new List<object>(); //瀹氫箟澹版槑鍙橀噺 锛屾妸閫氳繃 new List<object>()鍒涘缓鐨� 瀹炰緥锛岃祴鍊肩粰鍙橀噺 + //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄� + if (!DBUtility.ClsPub.Security_Log("Kf_SellOutBillQuery", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏌ヨ鏉冮檺!"; + objJsonResult.data = null; + return objJsonResult; + } + + sWhere = sWhere.Replace("'", "''"); + + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("exec h_p_IF_SellOutBillList " + page + "," + size + ",'" + Organization + "'," + "''", "h_p_IF_SellOutBillList"); + } + else + { + ds = oCN.RunProcReturn("exec h_p_IF_SellOutBillList " + page + "," + size + ",'" + Organization + "','" + sWhere + "'", "h_p_IF_SellOutBillList"); + } + + //娣诲姞鍒楀悕 + 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 = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); + objJsonResult.Message = "Sucess锛�"; + objJsonResult.list = columnNameList; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + /// <summary> ///閿�鍞嚭搴撳崟鍒犻櫎鍔熻兘 /// </summary> @@ -1780,7 +1978,7 @@ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; - objJsonResult.count = 1; + objJsonResult.count = 0; objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; objJsonResult.data = null; return objJsonResult; @@ -1789,23 +1987,36 @@ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; - objJsonResult.count = 1; + objJsonResult.count = 0; objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; return objJsonResult; } //================================================================================== + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } oCN.BeginTran(); //閿�鍞嚭搴撳垹闄ゅ洖濉攢鍞鍗曞叧鑱旀暟閲� - //oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToSellOut_Delete " + HInterID); + oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToSellOut_Delete " + HInterID); - //oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID); - //oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID); + //閿�鍞嚭搴撳垹闄ゅ洖濉敹璐ч�氱煡鍗曞叧鑱旀暟閲� + oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOutStockToPOStockIn_Delete " + HInterID); - string sql = "exec h_p_WMS_ICStockBillAndWMS_Delete " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','1205'"; - oCn.RunProc(sql); + + oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID); + oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID); + + //string sql = "exec h_p_WMS_ICStockBillAndWMS_Delete " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','1205'"; + //oCn.RunProc(sql); //鍒犻櫎鍚庢帶鍒�================================================================================== string sql2 = "exec h_p_Kf_SellOutBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; @@ -1814,7 +2025,7 @@ { s = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; objJsonResult.code = "0"; - objJsonResult.count = 1; + objJsonResult.count = 0; objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s; objJsonResult.data = null; oCN.RollBack(); @@ -1824,7 +2035,7 @@ { s = ds.Tables[0].Rows[0]["HRemark"].ToString(); objJsonResult.code = "0"; - objJsonResult.count = 1; + objJsonResult.count = 0; objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s; objJsonResult.data = null; oCN.RollBack(); @@ -2000,6 +2211,17 @@ oBill.DetailColl.Add(oItemSub); } + + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } + //淇濆瓨 //淇濆瓨瀹屾瘯鍚庡鐞� bool bResult; @@ -2096,6 +2318,7 @@ { try { + List<object> columnNameList = new List<object>(); //瀹氫箟澹版槑鍙橀噺 锛屾妸閫氳繃 new List<object>()鍒涘缓鐨� 瀹炰緥锛岃祴鍊肩粰鍙橀噺 //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄� if (!DBUtility.ClsPub.Security_Log("Kf_OtherOutBillQuery", 1, false, user)) { @@ -2115,13 +2338,21 @@ string sql = "select * from h_v_Kf_OtherOutBillList where 1 = 1 " + sWhere+ " order by hmainid desc"; ds = oCN.RunProcReturn(sql, "h_v_Kf_OtherOutBillList"); } - + foreach (DataColumn col in ds.Tables[0].Columns)//閬嶅巻ds涓涓�涓〃锛圱ables[0]锛夌殑鎵�鏈夊垪锛圕olumns锛夋瘡娆″惊鐜腑锛宑ol鍙橀噺浼氭寔鏈夊綋鍓嶅垪鐨勫紩鐢� + { + Type dataType = col.DataType; //鑾峰彇褰撳墠鏁版嵁绫诲瀷浼犲叆 鑷畾涔夊彉閲廳atadataType + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //瀛楃涓叉嫾鎺� // 灏嗗垪鍚嶅拰鏁版嵁绫诲瀷淇℃伅鎷兼帴鎴愪竴涓狫SON鏍煎紡鐨勫瓧绗︿覆 + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } //if (ds.Tables[0].Rows.Count != 0 || ds != null) + + //{ objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess锛�"; - objJsonResult.data = ds.Tables[0]; + objJsonResult.data = ds.Tables[0];//浠g爜灏嗙涓�涓狣ataTable锛堢储寮曚负0锛夎祴鍊肩粰objJsonResult鐨刣ata灞炴�� + objJsonResult.list = columnNameList;//灏哻olumnNameList璧嬪�肩粰objJsonResult鐨刲ist灞炴�� return objJsonResult; //} //else @@ -2203,6 +2434,17 @@ return objJsonResult; } //================================================================================== + + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } + oCN.BeginTran(); oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID); @@ -2309,6 +2551,17 @@ objJsonResult.count = 0; objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; + return objJsonResult; + } + + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; return objJsonResult; } @@ -2958,6 +3211,17 @@ oBill.DetailColl.Add(oItemSub); } + + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } + //淇濆瓨 //淇濆瓨瀹屾瘯鍚庡鐞� bool bResult; @@ -3101,6 +3365,16 @@ return objJsonResult; } + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } ClsPub.CurUserName = user; BillOld.MvarItemKey = "Kf_ICStockBillMain"; @@ -3153,7 +3427,6 @@ } //================================================================================== - //瀹℃牳鍗曟嵁 if (!oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_ICStockBill_AfterCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) { @@ -3204,7 +3477,6 @@ return objJsonResult; } //=========================================================== - //鍙嶅鏍稿崟鎹� if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_ICStockBill_AfterUnCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) @@ -3497,6 +3769,7 @@ { try { + List<object> columnNameList = new List<object>(); //瀹氫箟澹版槑鍙橀噺 锛屾妸閫氳繃 new List<object>()鍒涘缓鐨� 瀹炰緥锛岃祴鍊肩粰鍙橀噺 //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄� if (!DBUtility.ClsPub.Security_Log("Kf_OtherInBillQuery", 1, false, user)) { @@ -3516,13 +3789,19 @@ string sql = "select * from h_v_Kf_OtherInBillList where 1 = 1 " + sWhere+ " order by hmainid desc"; ds = oCN.RunProcReturn(sql, "h_v_Kf_OtherInBillList"); } - + foreach (DataColumn col in ds.Tables[0].Columns)//閬嶅巻ds涓涓�涓〃锛圱ables[0]锛夌殑鎵�鏈夊垪锛圕olumns锛夋瘡娆″惊鐜腑锛宑ol鍙橀噺浼氭寔鏈夊綋鍓嶅垪鐨勫紩鐢� + { + Type dataType = col.DataType; //鑾峰彇褰撳墠鏁版嵁绫诲瀷浼犲叆 鑷畾涔夊彉閲廳atadataType + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //瀛楃涓叉嫾鎺� // 灏嗗垪鍚嶅拰鏁版嵁绫诲瀷淇℃伅鎷兼帴鎴愪竴涓狫SON鏍煎紡鐨勫瓧绗︿覆 + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } //if (ds.Tables[0].Rows.Count != 0 || ds != null) //{ objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess锛�"; - objJsonResult.data = ds.Tables[0]; + objJsonResult.data = ds.Tables[0];//浠g爜灏嗙涓�涓狣ataTable锛堢储寮曚负0锛夎祴鍊肩粰objJsonResult鐨刣ata灞炴�� + objJsonResult.list = columnNameList;//灏哻olumnNameList璧嬪�肩粰objJsonResult鐨刲ist灞炴�� return objJsonResult; //} //else @@ -3617,7 +3896,15 @@ } //================================================================================== - + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } oCN.BeginTran(); @@ -3681,6 +3968,7 @@ { try { + List<object> columnNameList = new List<object>(); //瀹氫箟澹版槑鍙橀噺 锛屾妸閫氳繃 new List<object>()鍒涘缓鐨� 瀹炰緥锛岃祴鍊肩粰鍙橀噺 //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄� if (!DBUtility.ClsPub.Security_Log("Kf_EntrustInBillQuery", 1, false, user)) { @@ -3699,13 +3987,20 @@ string sql = "select * from h_v_Kf_EntrustInBillList where 1 = 1 " + sWhere+ " order by hmainid desc"; ds = oCN.RunProcReturn(sql, "h_v_Kf_EntrustInBillList"); } + foreach (DataColumn col in ds.Tables[0].Columns)//閬嶅巻ds涓涓�涓〃锛圱ables[0]锛夌殑鎵�鏈夊垪锛圕olumns锛夋瘡娆″惊鐜腑锛宑ol鍙橀噺浼氭寔鏈夊綋鍓嶅垪鐨勫紩鐢� + { + Type dataType = col.DataType; //鑾峰彇褰撳墠鏁版嵁绫诲瀷浼犲叆 鑷畾涔夊彉閲廳atadataType + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //瀛楃涓叉嫾鎺� // 灏嗗垪鍚嶅拰鏁版嵁绫诲瀷淇℃伅鎷兼帴鎴愪竴涓狫SON鏍煎紡鐨勫瓧绗︿覆 + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } //if (ds.Tables[0].Rows.Count != 0 || ds != null) //{ objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess锛�"; - objJsonResult.data = ds.Tables[0]; + objJsonResult.data = ds.Tables[0];//浠g爜灏嗙涓�涓狣ataTable锛堢储寮曚负0锛夎祴鍊肩粰objJsonResult鐨刣ata灞炴�� + objJsonResult.list = columnNameList;//灏哻olumnNameList璧嬪�肩粰objJsonResult鐨刲ist灞炴�� return objJsonResult; //} //else @@ -3797,8 +4092,8 @@ lsmain = oListModels.getObjectByJson_Gy_MouldRepairWorkBillMain(msg2); foreach (Model.ClsSb_MouldRepairWorkBillMain oItem in lsmain) { - //oItem.HMaker = ""; - UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HMaker = msg4; + UserName = msg4; //鍒跺崟浜� oItem.HBillType = "3807"; oItem.HBillSubType = "3807"; //oItem.HBillNo = ""; //鍗曟嵁鍙� @@ -4445,7 +4740,7 @@ { //ds = oCN.RunProcReturn("select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub", "Sc_MouldRepairCheckBillSub"); - ds = oCN.RunProcReturn("select HRepairCheckID,楠屾敹椤圭洰浠g爜 HRepairCheckCode,楠屾敹椤圭洰 HRepairCheckName,楠屾敹鍐呭 HRepairCheckContent,HManagerSonID HManagerID,瀛愯礋璐d汉浠g爜 HManagerCode,瀛愯礋璐d汉 HManagerName,澶囨敞 HRemark from h_v_Sc_MouldRepairCheckBillList_Edit", "h_v_Sc_MouldRepairCheckBillList_Edit"); + ds = oCN.RunProcReturn("select * from h_v_Sc_MouldRepairCheckBillList_Edit", "h_v_Sc_MouldRepairCheckBillList_Edit"); objJsonResult.code = "0"; objJsonResult.count = 1; @@ -4456,7 +4751,7 @@ { //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; - string sql1 = "select HRepairCheckID,楠屾敹椤圭洰浠g爜 HRepairCheckCode,楠屾敹椤圭洰 HRepairCheckName,楠屾敹鍐呭 HRepairCheckContent,HManagerSonID HManagerID,瀛愯礋璐d汉浠g爜 HManagerCode,瀛愯礋璐d汉 HManagerName,澶囨敞 HRemark from h_v_Sc_MouldRepairCheckBillList_Edit where 1 = 1 "; + string sql1 = "select * from h_v_Sc_MouldRepairCheckBillList_Edit where 1 = 1 "; string sql = sql1 + sqlWhere; ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldRepairCheckBillList_Edit"); @@ -4597,7 +4892,7 @@ foreach (Model.ClsSc_MouldConkBookBillMain oItem in lsmain) { //oItem.HMaker = ""; - UserName = oItem.HMaker; //鍒跺崟浜� + UserName = msg4; //鍒跺崟浜� DBUtility.ClsPub.CurUserName = UserName; oItem.HBillType = "3815"; oItem.HBillSubType = "3815"; @@ -4867,7 +5162,7 @@ string msg3 = sArray[1].ToString(); string msg4 = sArray[2].ToString(); string msg5 = sArray[3].ToString(); - + string msg6 = sArray[4].ToString(); string UserName = ""; ListModels oListModels = new ListModels(); @@ -4884,6 +5179,7 @@ DAL.ClsSc_MouldMaintainPlanBill oBill = new DAL.ClsSc_MouldMaintainPlanBill(); List<Model.ClsSc_MouldMaintainPlanBillMain> lsmain = new List<Model.ClsSc_MouldMaintainPlanBillMain>(); + msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Gy_MouldMaintainPlanBillMain(msg2); @@ -4893,11 +5189,14 @@ UserName = oItem.HMaker; //鍒跺崟浜� oItem.HBillType = "3818"; oItem.HBillSubType = "3818"; + oItem.HMainSourceInterID = oItem.HMouldMaintainRuleID; + oItem.HMainSourceBillNo = oItem.HMouldMaintainRuleNo; //oItem.HInterID =0; //oItem.HBillNo = ""; oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); //oItem.HMakeDate = ""; //oItem.HYear = ""; //oItem.HPeriod = ""; @@ -4984,6 +5283,32 @@ oBill.DetailColl.Add(oItemSub); } + + //琛ㄤ綋鏁版嵁 + //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� + //濡傛灉鏄紪杈戝氨鍏佽淇濆瓨,鍚﹀垯涓嶅厑璁� + if (oBill.omodel.HInterID != 0) + { + msg6 = msg6.Substring(1, msg6.Length - 2); + msg6 = msg6.Replace("\\", ""); + msg6 = msg6.Replace("\n", ""); + List<Model.ClsSc_MouldMaintainPlanBillSub_Plan> lss = new List<Model.ClsSc_MouldMaintainPlanBillSub_Plan>(); + lss = oListModels.getObjectByJson_Sc_MouldMaintainPlanBillSub_Plan(msg6); + int l = 0; + foreach (Model.ClsSc_MouldMaintainPlanBillSub_Plan oItem in lss) + { + + l++; + oItem.HEntryID = l; + oItem.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItem.HCloseType = false; //鍏抽棴绫诲瀷 + oItem.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItem.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + oItem.HRelationQty = 0; //鍏宠仈鏁伴噺 + oBill.DetailCol2.Add(oItem); + } + } + //淇濆瓨 //淇濆瓨瀹屾瘯鍚庡鐞� bool bResult; @@ -5050,7 +5375,7 @@ { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); //鑾峰彇淇濆吇椤圭洰缂栬緫鏁版嵁 - string sql = "select 淇濆吇椤圭洰ID HMaintainItemID, 淇濆吇椤圭洰浠g爜 HMaintainItemNumber,淇濆吇椤圭洰 HMaintainItem,淇濆吇閮ㄤ綅 HMaintainPart,鍏蜂綋瑕佹眰 HClaim,璐熻矗浜篒D,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜哄悕绉� HManagerName,瀛愬娉�2 HRemark,HMouldMaintainRuleID,HEquipDotCheckNo from h_v_Sc_MouldMaintainPlanBillSub_Item where 1 = 1 " + sqlWhere + ""; + string sql = "select 淇濆吇椤圭洰ID HMaintainItemID, 淇濆吇椤圭洰浠g爜 HMaintainItemNumber,淇濆吇椤圭洰 HMaintainItem,淇濆吇閮ㄤ綅 HMaintainPart,鍏蜂綋瑕佹眰 HClaim,璐熻矗浜篒D HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜哄悕绉� HManagerName,瀛愬娉�2 HRemark,HMouldMaintainRuleID,HEquipDotCheckNo from h_v_Sc_MouldMaintainPlanBillSub_Item where 1 = 1 " + sqlWhere + ""; ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldMaintainPlanBillSub_Item"); //鑾峰彇閰嶄欢椤圭洰缂栬緫鏁版嵁 @@ -5076,6 +5401,55 @@ return objJsonResult; } #endregion + + #region[鍣ㄥ叿淇濆吇璁板綍琛紝閫変繚鍏昏鍒掕幏鍙栦繚鍏昏鍒掓竻鍗曚俊鎭痌 + [Route("Sc_MouldMaintainPlanBill/Sc_MouldMaintainPlanBill_PlanList")] + [HttpGet] + public object Sc_MouldMaintainPlanBill_PlanList(string HInterID, string HDate) + { + DataSet ds, ds1; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + List<DataTable> tableList = new List<DataTable>(); + + //鑾峰彇淇濆吇椤圭洰 + ds = oCN.RunProcReturn("exec h_p_Sc_MouldMaintain_GetPlanList " + HInterID + ",'" + HDate + "'", "h_p_Sc_MouldMaintain_GetPlanList"); + + //鑾峰彇閰嶄欢椤圭洰缂栬緫鏁版嵁 + string sql1 = "select 閰嶄欢ID HMaterID, 閰嶄欢浠g爜 HMaterNumber,閰嶄欢鍚嶇О HMaterName,鍗曚綅ID HUnitID,璁¢噺鍗曚綅浠g爜 HUnitNumber,璁¢噺鍗曚綅鍚嶇О HUnitName,鐢ㄩ噺 HQty,鏍囧噯鐢ㄩ噺 HQtyMust,瀛愬娉�1 HRemark,瑙勬牸鍨嬪彿 HMaterSpec from h_v_Sc_MouldMaintainPlanBillSub where hmainid = " + HInterID + ""; + ds1 = oCN.RunProcReturn(sql1, "h_v_Sc_MouldMaintainPlanBillSub"); + + tableList.Add(ds.Tables[0]); + tableList.Add(ds1.Tables[0]); + + if (ds.Tables[0].Rows.Count != 0 || ds != null) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = tableList; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "娌℃湁鏌ヨ鍒版暟鎹俊鎭紒"; + objJsonResult.data = tableList; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙戠敓寮傚父锛屾病鏈夎繑鍥炰换浣曡鍒掞紒" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + #region [妯″叿淇濆吇璁″垝鍗曞垹闄ゅ姛鑳絔 /// <summary> /// 妯″叿缁翠慨鍗曞垹闄ゅ姛鑳� @@ -5250,7 +5624,7 @@ foreach (Model.ClsSc_MouldMaintainBillMain oItem in lsmain) { UserName = oItem.HMaker; //鍒跺崟浜� - DBUtility.ClsPub.CurUserName = UserName; + DBUtility.ClsPub.CurUserName = msg5; oItem.HBillType = "3819"; oItem.HBillSubType = "3819"; @@ -5380,6 +5754,142 @@ } #endregion + #region 妯″叿淇濆吇璁板綍琛� 淇濆瓨/缂栬緫PDA + /// <summary> + /// 淇濆瓨妯″叿缁翠慨鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MouldMaintainBill/SaveGetMouldMaintainBillListPDA")] + [HttpPost] + public object SaveGetMouldMaintainBillListPDA([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 msg5 = sArray[2].ToString(); + + string UserName = ""; + ListModels oListModels = new ListModels(); + try + { + if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainBill_Edit", 1, false, msg5)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + DAL.ClsSc_MouldMaintainBill oBill = new DAL.ClsSc_MouldMaintainBill(); + List<Model.ClsSc_MouldMaintainBillMain> lsmain = new List<Model.ClsSc_MouldMaintainBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sc_MouldMaintainBillMain(msg2); + foreach (Model.ClsSc_MouldMaintainBillMain oItem in lsmain) + { + UserName = oItem.HMaker; //鍒跺崟浜� + DBUtility.ClsPub.CurUserName = UserName; + oItem.HBillType = "3819"; + oItem.HBillSubType = "3819"; + + //oItem.HInterID =0; + //oItem.HBillNo = ""; + oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + //oItem.HMakeDate = ""; + //oItem.HYear = ""; + //oItem.HPeriod = ""; + //oItem.HRemark = ""; + //oItem.HCycleUnit = ""; + //oItem.HCheckCycle = ""; + //oItem.HBeginDate = ""; + //oItem.HEndDate = ""; + //oItem.HInnerBillNo = ""; + //oItem.HExplanation = ""; + + //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_MouldMaintainRuleBillSub_Item> ls = new List<Model.ClsSc_MouldMaintainRuleBillSub_Item>(); + ls = oListModels.getObjectByJson_Sc_MouldMaintainRuleBillSub_Item(msg3); + int i = 0; + foreach (Model.ClsSc_MouldMaintainRuleBillSub_Item oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + //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; //鍏宠仈鏁伴噺 + oBill.DetailCol.Add(oItemSub); + + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + 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[妯″叿淇濆吇璁板綍琛ㄧ紪杈戞椂鑾峰彇琛ㄥご鏁版嵁] [Route("Sc_MouldMaintainBill/Sc_MouldMaintainBillListCheckDetai")] [HttpGet] @@ -5455,7 +5965,7 @@ } SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); //鑾峰彇淇濆吇椤圭洰缂栬緫鏁版嵁 - string sql = "select HMaintainItemID, 淇濆吇椤圭洰浠g爜 HMaintainItemNumber,淇濆吇椤圭洰鍚嶇О HMaintainItem,淇濆吇閮ㄤ綅 HMaintainPart,鍏蜂綋瑕佹眰 HClaim,HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName,琛ㄤ綋澶囨敞 HRemark from h_v_Sc_MouldMaintainBillListItem where 1 = 1 " + Swhere + ""; + string sql = "select HMaintainItemID, 淇濆吇椤圭洰浠g爜 HMaintainItemNumber,淇濆吇椤圭洰鍚嶇О HMaintainItem,淇濆吇閮ㄤ綅 HMaintainPart,鍏蜂綋瑕佹眰 HClaim,HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName,琛ㄤ綋澶囨敞 HRemark,淇濆吇缁撴灉 HMaintainResult from h_v_Sc_MouldMaintainBillListItem where 1 = 1 " + Swhere + ""; ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldMaintainBillListItem"); //鑾峰彇閰嶄欢椤圭洰缂栬緫鏁版嵁 string sql1 = "select HMaterID, 閰嶄欢浠g爜 HMaterNumber,閰嶄欢鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,HUnitID,鍗曚綅浠g爜 HUnitNumber,鍗曚綅鍚嶇О HUnitName,瀹為檯鐢ㄩ噺 HQty,鏍囧噯鐢ㄩ噺 HQtyMust,HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName,琛ㄤ綋澶囨敞 HRemark from h_v_Sc_MouldMaintainBillList where 1 = 1 " + Swhere + ""; @@ -5526,9 +6036,54 @@ return objJsonResult; } - bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); - if (IsDete) + //=========================================Begin 鍒犻櫎鍓嶆帶鍒� Begin========================================= + string sql1 = "exec h_p_Sc_MouldMaintainBill_BeforeDelCtrl " + HInterID + "," + user; + ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldMaintainBill_BeforeDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //===========================================End 鍒犻櫎鍓嶆帶鍒� End=========================================== + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + + //=========================================Begin 鍒犻櫎鍚庢帶鍒� Begin========================================= + string sql2 = "exec h_p_Sc_MouldMaintainBill_AfterDelCtrl " + HInterID + "," + user; + ds = oCN.RunProcReturn(sql2, "h_p_Sc_MouldMaintainBill_AfterDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //===========================================End 鍒犻櫎鍚庢帶鍒� End=========================================== + + if (IsDete) + { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; @@ -5550,6 +6105,160 @@ objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "鍗曟嵁鏈壘鍒�"; + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 妯″叿淇濆吇璁板綍鍗曞鏍�/鍙嶅鏍稿姛鑳� + [Route("Sc_MouldMaintainBill/CheckSc_MouldMaintainBill")] + [HttpGet] + public object CheckSc_MouldMaintainBill(string HInterID, int Type, string user, string HBillSubType) + { + DAL.ClsSc_MouldMaintainBill BillOld = new DAL.ClsSc_MouldMaintainBill(); + try + { + //鍒ゆ柇鏄惁鏈夊鏍告潈闄� + if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainBill_Check", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁瀹℃牳鏉冮檺!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + BillOld.MvarItemKey = "Sc_MouldMaintainBillMain"; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 瀹℃牳 2 鍙嶅鏍� + if (Type == 1) + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳 + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶉渶瑕佸啀瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + } + + //瀹℃牳鍓嶆帶鍒� + string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); + sql = "exec h_p_Sc_MouldMaintainBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldMaintainBill_BeforeCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + + + //瀹℃牳鍗曟嵁 + if (!BillOld.CheckBill(Int64.Parse(HInterID), HBillNo, "h_p_Sc_MouldMaintainBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍� + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插弽瀹℃牳!涓嶉渶瑕佸啀鍙嶅鏍�!"; + objJsonResult.data = null; + return objJsonResult; + } + } + + //鍙嶅鏍稿墠鎺у埗 + string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); + sql = "exec h_p_Sc_MouldMaintainBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldMaintainBill_BeforeUnCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + + //鍙嶅鏍稿崟鎹� + if (!BillOld.AbandonCheck(Int64.Parse(HInterID), HBillNo, "h_p_Sc_MouldMaintainBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + + oCN.Commit();//鎻愪氦浜嬪姟 + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString(); objJsonResult.data = null; return objJsonResult; } @@ -5757,7 +6466,7 @@ { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); //鑾峰彇鐐规椤圭洰缂栬緫鏁版嵁 - ds = oCN.RunProcReturn("select HDotCheckItem, HDotCheckPart , HClaim, a.HRemark,a.HManagerID,e.HNumber HManagerCode,e.HName HManagerName from Sc_MouldDotCheckBillSub a left join Gy_Employee e on a.HManagerID=e.HItemID where 1=1 " + sqlWhere, "Sc_MouldDotCheckBillSub"); + ds = oCN.RunProcReturn("select * from h_v_Sc_MouldDotCheckBill_Edit where 1=1 " + sqlWhere, "h_v_Sc_MouldDotCheckBill_Edit"); //鑾峰彇閰嶄欢椤圭洰缂栬緫鏁版嵁 ds1 = oCN.RunProcReturn(@"select b.HMaterID, mt.Hnumber HMaterNumber ,mt.HName HMaterName, b.HUnitID ,u2.hnumber HUnitNumber,u2.HName HUnitName,b.HQty,b.HQtyMust,b.HRemark @@ -5770,7 +6479,7 @@ objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; - objJsonResult.data = null; + objJsonResult.data = ds.Tables[0]; objJsonResult.list = list; } @@ -5911,8 +6620,6 @@ string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); string msg4 = sArray[2].ToString(); - //string msg5 = sArray[3].ToString(); - string UserName = ""; ListModels oListModels = new ListModels(); @@ -5933,28 +6640,14 @@ msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Sc_MouldDotCheckPlanBillMain(msg2); foreach (Model.ClsSc_MouldDotCheckPlanBillMain oItem in lsmain) - { - //oItem.HMaker = ""; + { UserName = oItem.HMaker; //鍒跺崟浜� oItem.HBillType = "3820"; oItem.HBillSubType = "3820"; - - //oItem.HInterID =0; - //oItem.HBillNo = ""; + oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 - oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); - //oItem.HMakeDate = ""; - //oItem.HYear = ""; - //oItem.HPeriod = ""; - //oItem.HRemark = ""; - //oItem.HCycleUnit = ""; - //oItem.HCheckCycle = ""; - //oItem.HBeginDate = ""; - //oItem.HEndDate = ""; - //oItem.HInnerBillNo = ""; - //oItem.HExplanation = ""; - - //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { objJsonResult.code = "0"; @@ -5979,7 +6672,7 @@ i++; oItemSub.HEntryID = i; - //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 //oItemSub.HRemark = ""; //澶囨敞 @@ -5987,43 +6680,10 @@ oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 - oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 - //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 - //HMaterID = "";//閰嶄欢浠g爜 - //HUnitID = "";//鍗曚綅浠g爜 - //HQty = "";//瀹為檯鐢ㄩ噺 - //HQtyMust = "";//鍗曚綅鐢ㄩ噺 - //HRemark = "";//澶囨敞 + oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 oBill.DetailColl.Add(oItemSub); - - } - - ////閰嶄欢椤硅〃浣撴暟鎹� - ////鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� - //msg5 = msg5.Substring(1, msg5.Length - 2); - //msg5 = msg5.Replace("\\", ""); - //msg5 = msg5.Replace("\n", ""); //\n - // //msg2 = msg2.Replace("'", "鈥�"); - //List<Model.ClsSc_MouldDotCheckPlanBillSub_Item> ls1 = new List<Model.ClsSc_MouldDotCheckPlanBillSub_Item>(); - //ls1 = oListModels.getObjectByJson_Sc_MouldDotCheckPlanBillSub_Item(msg5); - //int j = 0; - //foreach (Model.ClsSc_MouldDotCheckPlanBillSub_Item oItemSub in ls1) - //{ - - // j++; - // oItemSub.HEntryID = j; - // //oItemSub.HCloseMan = ""; //琛屽叧闂� - // oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); - // oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 - - // oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� - // oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� - - // oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 - // oBill.DetailCol.Add(oItemSub); - //} - + } //淇濆瓨 //淇濆瓨瀹屾瘯鍚庡鐞� bool bResult; @@ -6092,8 +6752,7 @@ { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); //鑾峰彇鐐规椤圭洰缂栬緫鏁版嵁 - ds = oCN.RunProcReturn(@"select a.HDotCheckItemID,HDotCheckItem, HDotCheckPart , HClaim, a.HRemark,a.HManagerID,e.HNumber HManagerCode,e.HName HManagerName from Sc_MouldDotCheckPlanBillSub a - left join Gy_Employee e on a.HManagerID=e.HItemID + ds = oCN.RunProcReturn(@"select * from h_v_Sc_MouldDotCheckPlanBill_Edit where 1=1 " + sqlWhere, "Sc_MouldDotCheckPlanBillSub"); ////鑾峰彇閰嶄欢椤圭洰缂栬緫鏁版嵁 //ds1 = oCN.RunProcReturn(@"select b.HMaterID, mt.Hnumber HMaterNumber ,mt.HName HMaterName, b.HUnitID @@ -6106,7 +6765,7 @@ objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; - objJsonResult.data = null; + objJsonResult.data = ds.Tables[0]; objJsonResult.list = list; } catch (Exception e) @@ -6201,10 +6860,169 @@ } #endregion + #region 鍣ㄥ叿鐐规璁″垝鍗曞鏍�/鍙嶅鏍稿姛鑳� + [Route("Sc_MouldDotCheckPlanBill/CheckSc_MouldDotCheckPlanBill")] + [HttpGet] + public object CheckSc_MouldDotCheckPlanBill(string HInterID, int Type, string user) + { + DAL.ClsSc_MouldDotCheckPlanBill BillOld = new DAL.ClsSc_MouldDotCheckPlanBill(); + try + { + //鍒ゆ柇鏄惁鏈夊鏍告潈闄� + if (!DBUtility.ClsPub.Security_Log("Sc_MouldDotCheckPlanBill_Check", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愬鏍�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 瀹℃牳 2 鍙嶅鏍� + if (Type == 1) + { + if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + //鑷姩鐢熸垚鐐规璁″垝鍗� + oCN.RunProc("exec h_p_Sc_MouldDotCheckPlan_Auto " + HInterID); + } + else + { + if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + + oCN.Commit();//鎻愪氦浜嬪姟 + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region[鍣ㄥ叿鐐规璁″垝琛ㄧ紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁--淇濆吇璁″垝] + [Route("Sc_MouldDotCheckPlanBill/GetPlanList")] + [HttpGet] + public object GetPlanList_Check(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_Sc_MouldDotCheckPlanList", "h_v_Sc_MouldDotCheckPlanList"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + string sql1 = "select * from h_v_Sc_MouldDotCheckPlanList where 1 = 1 "; + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldDotCheckPlanList"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁″垝锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion #endregion - + #region 鏍规嵁鍣ㄥ叿鏉$爜鏌ユ壘鍣ㄥ叿妗f淇℃伅PDA + [Route("QJ_PDA_MouldDotCheckBill/txtHBarCode_KeyDown")] + [HttpGet] + public object txtHBarCode_KeyDown(string HBarCode) + { + try + { + if (HBarCode == null || HBarCode.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏉″舰鐮佷笉鑳戒负绌猴紒"; + objJsonResult.data = null; + return objJsonResult; + } + //寰楀埌淇℃伅 + ds = oCN.RunProcReturn("select top 1 * from Gy_MouldFileMain where HBarCode= '" + HBarCode + "'", "Gy_MouldFileMain"); + //鍐欏叆淇℃伅 + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏈煡璇㈠埌鍣ㄥ叿淇℃伅锛�"; + objJsonResult.data = null; + return objJsonResult; + } + 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 = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion #region 妯″叿鎶ュ簾鍏ュ簱鍗� @@ -6281,7 +7099,208 @@ } #endregion - #region 妯″叿鎶ュ簾鍏ュ簱鍗曚繚瀛�/缂栬緫 + #region 妯″叿鎶ュ簾鍏ュ簱鍗曚繚瀛�/缂栬緫 20240702浣滃簾 + /// <summary> + /// 淇濆瓨妯″叿鎶ュ簾鍏ュ簱鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + //[Route("Sc_MouldScrapInHouseBill/SaveGetMouldScrapInHouseBillList")] + //[HttpPost] + //public object SaveGetMouldScrapInHouseBillList([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 refSav = sArray[2].ToString(); + // string msg4 = sArray[3].ToString(); + + // string UserName = ""; + // string s = ""; + // ListModels oListModels = new ListModels(); + // try + // { + // //缂栬緫鏉冮檺 + // if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapRequestBill_Edit", 1, false, msg4)) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + // } + + // DLL.ClsSc_MouldScrapInBill oBill = new DLL.ClsSc_MouldScrapInBill(); + // List<Models.ClsSc_MouldStockBillMain> lsmain = new List<Models.ClsSc_MouldStockBillMain>(); + // msg2 = msg2.Replace("\\", ""); + // msg2 = msg2.Replace("\n", ""); //\n + // lsmain = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillMain(msg2); + // foreach (Models.ClsSc_MouldStockBillMain oItem in lsmain) + // { + // if (refSav == "Add") + // { + // //鍗曟嵁鍙锋槸鍚﹂噸澶� + // if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld0.omodel.HInterID)) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + // objJsonResult.data = 1; + // return objJsonResult; + // } + // } + // if (refSav == "Update") + // { + // if (BillOld0.ShowBill(oItem.HInterID, ref s) == false) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "姝ゅ崟鎹湁璇紒"; + // objJsonResult.data = 1; + // return objJsonResult; + // } + // //鍒ゆ柇鏄惁鍙紪杈� + // if (BillOld0.omodel.HChecker != "" && BillOld0.omodel.HChecker != null) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�"; + // objJsonResult.data = 1; + // return objJsonResult; + // } + // if (BillOld0.omodel.HBillStatus > 1) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒"; + // objJsonResult.data = 1; + // return objJsonResult; + // } + // if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld0, ref s)) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = s + "锛屼笉鍏佽淇敼"; + // objJsonResult.data = 1; + // return objJsonResult; + // } + // } + // //oItem.HMaker = ""; + // UserName = oItem.HMaker; //鍒跺崟浜� + // oItem.HBillType = "3831"; + // oItem.HBillSubType = "3831"; + // //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<Models.ClsSc_MouldStockBillSub> ls = new List<Models.ClsSc_MouldStockBillSub>(); + // ls = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillSub(msg3); + // int i = 0; + // foreach (Models.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 妯″叿鎶ュ簾鍏ュ簱鍗曚繚瀛�/缂栬緫 20240702 /// <summary> /// 淇濆瓨妯″叿鎶ュ簾鍏ュ簱鍗� /// </summary> @@ -6291,175 +7310,137 @@ [HttpPost] public object SaveGetMouldScrapInHouseBillList([FromBody] JObject msg) { + DAL.ClsSc_MouldScrapInBill oBill = new DAL.ClsSc_MouldScrapInBill(); + 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 refSav = sArray[2].ToString(); - string msg4 = sArray[3].ToString(); - - string UserName = ""; - string s = ""; - ListModels oListModels = new ListModels(); + string sMainStr = sArray[0].ToString(); //涓昏〃鏁版嵁 + string sSubStr = sArray[1].ToString(); //瀛愯〃鏁版嵁 + string OperationType = sArray[2].ToString(); //鎿嶄綔绫诲瀷锛圓dd鏂板銆乁pdate缂栬緫锛� + string HMaker = sArray[3].ToString(); //鍒跺崟浜� try { - //缂栬緫鏉冮檺 - if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapRequestBill_Edit", 1, false, msg4)) + //鍒ゆ柇鏉冮檺 + if (OperationType == "Add") + { + BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; + //鍒ゆ柇鏂板鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapRequestBill", 1, false, HMaker)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏂板鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify; + //鍒ゆ柇缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapRequestBill_Edit", 1, false, HMaker)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒"; + objJsonResult.data = null; + return objJsonResult; + } + } + //琛ㄥご璧嬪�� + sMainStr = sMainStr.Replace("\\", ""); + sMainStr = sMainStr.Replace("\n", ""); + sMainStr = "[" + sMainStr.ToString() + "]"; + List<Model.ClsSc_MouldStockBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillMain>>(sMainStr); + foreach (Model.ClsSc_MouldStockBillMain oItem in lsmain) + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oItem.HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s; + objJsonResult.data = null; + return objJsonResult; + } + + oItem.HYear = sYear; + oItem.HPeriod = sPeriod; + DBUtility.ClsPub.CurUserName = oItem.HMaker; + oBill.omodel = oItem; + } + //琛ㄤ綋璧嬪�� + //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� + sSubStr = sSubStr.Substring(1, sSubStr.Length - 2); + sSubStr = sSubStr.Replace("\\", ""); + sSubStr = sSubStr.Replace("\n", ""); + sSubStr = "[" + sSubStr.ToString() + "]"; + List<Model.ClsSc_MouldStockBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(sSubStr); + int i = 0; + foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls) + { + i++; + oItemSub.HEntryID = i; + oBill.DetailColl.Add(oItemSub); + } + + string sErrMsg = ""; + bool bResult; + //鑾峰彇绯荤粺鍙傛暟 + if (oSystemParameter.ShowBill(ref sErrMsg) == true) + { + //淇濆瓨 + if (OperationType == "Add") //鏂板淇濆瓨 + { + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + + if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 + { + //淇敼鍣ㄥ叿妗f浣嶇疆 + 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); + + if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 + { + //淇敼鍣ㄥ叿妗f浣嶇疆 + string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); + oCn.RunProc(sql); + } + } + } + else { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg; objJsonResult.data = null; return objJsonResult; } - DLL.ClsSc_MouldScrapInBill oBill = new DLL.ClsSc_MouldScrapInBill(); - List<Models.ClsSc_MouldStockBillMain> lsmain = new List<Models.ClsSc_MouldStockBillMain>(); - msg2 = msg2.Replace("\\", ""); - msg2 = msg2.Replace("\n", ""); //\n - lsmain = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillMain(msg2); - foreach (Models.ClsSc_MouldStockBillMain oItem in lsmain) - { - if (refSav == "Add") - { - //鍗曟嵁鍙锋槸鍚﹂噸澶� - if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld0.omodel.HInterID)) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; - objJsonResult.data = 1; - return objJsonResult; - } - } - if (refSav == "Update") - { - if (BillOld0.ShowBill(oItem.HInterID, ref s) == false) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "姝ゅ崟鎹湁璇紒"; - objJsonResult.data = 1; - return objJsonResult; - } - //鍒ゆ柇鏄惁鍙紪杈� - if (BillOld0.omodel.HChecker != "" && BillOld0.omodel.HChecker != null) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�"; - objJsonResult.data = 1; - return objJsonResult; - } - if (BillOld0.omodel.HBillStatus > 1) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒"; - objJsonResult.data = 1; - return objJsonResult; - } - if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld0, ref s)) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = s + "锛屼笉鍏佽淇敼"; - objJsonResult.data = 1; - return objJsonResult; - } - } - //oItem.HMaker = ""; - UserName = oItem.HMaker; //鍒跺崟浜� - oItem.HBillType = "3831"; - oItem.HBillSubType = "3831"; - //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<Models.ClsSc_MouldStockBillSub> ls = new List<Models.ClsSc_MouldStockBillSub>(); - ls = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillSub(msg3); - int i = 0; - foreach (Models.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; + objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; //鎴愬姛锛� + objJsonResult.data = null; return objJsonResult; } else @@ -6467,7 +7448,7 @@ objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; - objJsonResult.data = 1; + objJsonResult.data = null; return objJsonResult; } } @@ -6475,8 +7456,8 @@ { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); - objJsonResult.data = 1; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message; + objJsonResult.data = null; return objJsonResult; } } @@ -6745,7 +7726,158 @@ } #endregion - #region 妯″叿澶勭悊鍑哄簱鍗曚繚瀛�/缂栬緫 + #region 妯″叿澶勭悊鍑哄簱鍗曚繚瀛�/缂栬緫 20240702浣滃簾 + /// <summary> + /// 淇濆瓨妯″叿澶勭悊鍑哄簱鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + //[Route("Sc_MouldScrapOutHouseBill/SaveGetMouldScrapOutHouseBillList")] + //[HttpPost] + //public object SaveGetMouldScrapOutHouseBillList([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_MouldScrapOutBill_Edit", 1, false, msg4)) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + // } + + // DLL.ClsSc_MouldScrapOutBill oBill = new DLL.ClsSc_MouldScrapOutBill(); + // List<Model.ClsSc_MouldStockBillMain> lsmain = new List<Model.ClsSc_MouldStockBillMain>(); + // msg2 = msg2.Replace("\\", ""); + // msg2 = msg2.Replace("\n", ""); //\n + // lsmain = oListModels.getObjectByJson_Gy_MouldScrapOutHouseBillMain(msg2); + // foreach (Model.ClsSc_MouldStockBillMain oItem in lsmain) + // { + // //oItem.HMaker = ""; + // UserName = oItem.HMaker; //鍒跺崟浜� + // oItem.HBillType = "3832"; + // oItem.HBillSubType = "3832"; + // //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_MouldScrapOutHouseBillSub(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 'out','{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 妯″叿澶勭悊鍑哄簱鍗曚繚瀛�/缂栬緫 20240702 /// <summary> /// 淇濆瓨妯″叿澶勭悊鍑哄簱鍗� /// </summary> @@ -6755,125 +7887,126 @@ [HttpPost] public object SaveGetMouldScrapOutHouseBillList([FromBody] JObject msg) { + DAL.ClsSc_MouldScrapOutBill oBill = new DAL.ClsSc_MouldScrapOutBill(); + 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(); + string sMainStr = sArray[0].ToString(); //涓昏〃鏁版嵁 + string sSubStr = sArray[1].ToString(); //瀛愯〃鏁版嵁 + string HMaker = sArray[2].ToString(); //鍒跺崟浜� try { //缂栬緫鏉冮檺 - if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapOutBill_Edit", 1, false, msg4)) + if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapOutBill_Edit", 1, false, HMaker)) { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏂板/缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒"; + objJsonResult.data = null; + return objJsonResult; + } + //琛ㄥご璧嬪�� + sMainStr = sMainStr.Replace("\\", ""); + sMainStr = sMainStr.Replace("\n", ""); + sMainStr = "[" + sMainStr.ToString() + "]"; + List<Model.ClsSc_MouldStockBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillMain>>(sMainStr); + foreach (Model.ClsSc_MouldStockBillMain oItem in lsmain) + { + if (oItem.HInterID == 0) + { + BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; + } + else + { + BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify; + } + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oItem.HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s; + objJsonResult.data = null; + return objJsonResult; + } + + oItem.HYear = sYear; + oItem.HPeriod = sPeriod; + DBUtility.ClsPub.CurUserName = oItem.HMaker; + oBill.omodel = oItem; + } + //琛ㄤ綋璧嬪�� + //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� + sSubStr = sSubStr.Substring(1, sSubStr.Length - 2); + sSubStr = sSubStr.Replace("\\", ""); + sSubStr = sSubStr.Replace("\n", ""); + sSubStr = "[" + sSubStr.ToString() + "]"; + List<Model.ClsSc_MouldStockBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(sSubStr); + int i = 0; + foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls) + { + i++; + oItemSub.HEntryID = i; + oBill.DetailColl.Add(oItemSub); + } + + string sErrMsg = ""; + bool bResult; + //鑾峰彇绯荤粺鍙傛暟 + if (oSystemParameter.ShowBill(ref sErrMsg) == true) + { + //淇濆瓨 + if (oBill.omodel.HInterID == 0) //鏂板淇濆瓨 + { + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + + if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 + { + //淇敼鍣ㄥ叿妗f浣嶇疆 + string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'out','{oBill.omodel.HInterID.ToString()}' "); + oCn.RunProc(sql); + } + } + else //缂栬緫淇濆瓨 + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + + if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 + { + //淇敼鍣ㄥ叿妗f浣嶇疆 + string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); + oCn.RunProc(sql); + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg; objJsonResult.data = null; return objJsonResult; } - DLL.ClsSc_MouldScrapOutBill oBill = new DLL.ClsSc_MouldScrapOutBill(); - List<Model.ClsSc_MouldStockBillMain> lsmain = new List<Model.ClsSc_MouldStockBillMain>(); - msg2 = msg2.Replace("\\", ""); - msg2 = msg2.Replace("\n", ""); //\n - lsmain = oListModels.getObjectByJson_Gy_MouldScrapOutHouseBillMain(msg2); - foreach (Model.ClsSc_MouldStockBillMain oItem in lsmain) - { - //oItem.HMaker = ""; - UserName = oItem.HMaker; //鍒跺崟浜� - oItem.HBillType = "3832"; - oItem.HBillSubType = "3832"; - //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_MouldScrapOutHouseBillSub(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 'out','{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; + objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; //鎴愬姛锛� + objJsonResult.data = null; return objJsonResult; } else @@ -6881,7 +8014,7 @@ objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; - objJsonResult.data = 1; + objJsonResult.data = null; return objJsonResult; } } @@ -6889,8 +8022,8 @@ { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); - objJsonResult.data = 1; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message; + objJsonResult.data = null; return objJsonResult; } } @@ -7337,7 +8470,159 @@ } #endregion - #region 妯″叿閫�搴撳崟淇濆瓨/缂栬緫 + #region 妯″叿閫�搴撳崟淇濆瓨/缂栬緫 20240702浣滃簾 + /// <summary> + /// 淇濆瓨妯″叿閫�搴撳崟 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + //[Route("Sc_MouldProdBackBill/SaveGetMouldProdBackBillList")] + //[HttpPost] + //public object SaveGetMouldProdBackBillList([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_MouldProdBackBill_Edit", 1, false, msg4)) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "娌℃湁淇濆瓨鏉冮檺"; + // objJsonResult.data = null; + // return objJsonResult; + // } + + // DLL.ClsSc_MouldProdBackBill oBill = new DLL.ClsSc_MouldProdBackBill(); + // List<Model.ClsSc_MouldProdBackBillMain> lsmain = new List<Model.ClsSc_MouldProdBackBillMain>(); + // msg2 = msg2.Replace("\\", ""); + // msg2 = msg2.Replace("\n", ""); //\n + // lsmain = oListModels.getObjectByJson_Gy_MouldProdBackBillMain(msg2); + // foreach (Model.ClsSc_MouldProdBackBillMain oItem in lsmain) + // { + // //oItem.HMaker = ""; + // UserName = oItem.HMaker; //鍒跺崟浜� + // oItem.HBillType = "3803"; + // oItem.HBillSubType = "3803"; + // //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_MouldProdBackBillSub> ls = new List<Model.ClsSc_MouldProdBackBillSub>(); + // ls = oListModels.getObjectByJson_Gy_MouldProdBackBillSub(msg3); + // int i = 0; + // foreach (Model.ClsSc_MouldProdBackBillSub 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 sql1 = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'in','{oBill.omodel.HInterID.ToString()}' "); + // oCn.RunProc(sql1); + // } + // 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) + // { + // string sql =string.Format($"exec h_p_Sc_MouldProdBackBillList '{oBill.omodel.HBillNo}' ") ; + // oCn.RunProc(sql); + // 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 妯″叿閫�搴撳崟淇濆瓨/缂栬緫 20240702 /// <summary> /// 淇濆瓨妯″叿閫�搴撳崟 /// </summary> @@ -7347,126 +8632,127 @@ [HttpPost] public object SaveGetMouldProdBackBillList([FromBody] JObject msg) { + DAL.ClsSc_MouldProdBackBill oBill = new DAL.ClsSc_MouldProdBackBill(); + 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(); + string sMainStr = sArray[0].ToString(); //涓昏〃鏁版嵁 + string sSubStr = sArray[1].ToString(); //瀛愯〃鏁版嵁 + string HMaker = sArray[2].ToString(); //鍒跺崟浜� try { - if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdBackBill_Edit", 1, false, msg4)) + //鍒ゆ柇鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdBackBill_Edit", 1, false, HMaker)) { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "娌℃湁淇濆瓨鏉冮檺"; + objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏂板/缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒"; + objJsonResult.data = null; + return objJsonResult; + } + //琛ㄥご璧嬪�� + sMainStr = sMainStr.Replace("\\", ""); + sMainStr = sMainStr.Replace("\n", ""); + sMainStr = "[" + sMainStr.ToString() + "]"; + List<Model.ClsSc_MouldProdBackBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldProdBackBillMain>>(sMainStr); + foreach (Model.ClsSc_MouldProdBackBillMain oItem in lsmain) + { + if (oItem.HInterID == 0) + { + BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; + } + else + { + BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify; + } + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oItem.HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s; + objJsonResult.data = null; + return objJsonResult; + } + + oItem.HYear = sYear; + oItem.HPeriod = sPeriod; + DBUtility.ClsPub.CurUserName = oItem.HMaker; + oBill.omodel = oItem; + } + //琛ㄤ綋璧嬪�� + //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� + sSubStr = sSubStr.Substring(1, sSubStr.Length - 2); + sSubStr = sSubStr.Replace("\\", ""); + sSubStr = sSubStr.Replace("\n", ""); + sSubStr = "[" + sSubStr.ToString() + "]"; + List<Model.ClsSc_MouldStockBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(sSubStr); + int i = 0; + foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls) + { + i++; + oItemSub.HEntryID = i; + oBill.DetailColl.Add(oItemSub); + } + + string sErrMsg = ""; + bool bResult; + //鑾峰彇绯荤粺鍙傛暟 + if (oSystemParameter.ShowBill(ref sErrMsg) == true) + { + //淇濆瓨 + if (oBill.omodel.HInterID == 0) //鏂板淇濆瓨 + { + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + + if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 + { + //淇敼鍣ㄥ叿妗f浣嶇疆 + string sql1 = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'in','{oBill.omodel.HInterID.ToString()}' "); + oCn.RunProc(sql1); + } + } + else //缂栬緫淇濆瓨 + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + + if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 + { + //淇敼鍣ㄥ叿妗f浣嶇疆 + string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); + oCn.RunProc(sql); + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg; objJsonResult.data = null; return objJsonResult; } - DLL.ClsSc_MouldProdBackBill oBill = new DLL.ClsSc_MouldProdBackBill(); - List<Model.ClsSc_MouldProdBackBillMain> lsmain = new List<Model.ClsSc_MouldProdBackBillMain>(); - msg2 = msg2.Replace("\\", ""); - msg2 = msg2.Replace("\n", ""); //\n - lsmain = oListModels.getObjectByJson_Gy_MouldProdBackBillMain(msg2); - foreach (Model.ClsSc_MouldProdBackBillMain oItem in lsmain) - { - //oItem.HMaker = ""; - UserName = oItem.HMaker; //鍒跺崟浜� - oItem.HBillType = "3803"; - oItem.HBillSubType = "3803"; - //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_MouldProdBackBillSub> ls = new List<Model.ClsSc_MouldProdBackBillSub>(); - ls = oListModels.getObjectByJson_Gy_MouldProdBackBillSub(msg3); - int i = 0; - foreach (Model.ClsSc_MouldProdBackBillSub 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 sql1 = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'in','{oBill.omodel.HInterID.ToString()}' "); - oCn.RunProc(sql1); - } - 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) { - string sql =string.Format($"exec h_p_Sc_MouldProdBackBillList '{oBill.omodel.HBillNo}' ") ; - oCn.RunProc(sql); + string sql = string.Format($"exec h_p_Sc_MouldProdBackBillList '{oBill.omodel.HBillNo}' "); objJsonResult.code = "0"; objJsonResult.count = 1; - objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; - //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); - objJsonResult.data = 1; + objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; //鎴愬姛锛� + objJsonResult.data = null; return objJsonResult; } else @@ -7474,7 +8760,7 @@ objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; - objJsonResult.data = 1; + objJsonResult.data = null; return objJsonResult; } } @@ -7482,8 +8768,8 @@ { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); - objJsonResult.data = 1; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message; + objJsonResult.data = null; return objJsonResult; } } @@ -7790,7 +9076,158 @@ } #endregion - #region 妯″叿棰嗙敤鍗曚繚瀛�/缂栬緫 + #region 妯″叿棰嗙敤鍗曚繚瀛�/缂栬緫 20240702浣滃簾 + /// <summary> + /// 淇濆瓨妯″叿棰嗙敤鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + //[Route("Sc_MouldProdOutBill/SaveGetMouldProdOutBillList")] + //[HttpPost] + //public object SaveGetMouldProdOutBillList([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_MouldProdOutBill_Edit", 1, false, msg4)) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "娌℃湁淇濆瓨鏉冮檺"; + // objJsonResult.data = null; + // return objJsonResult; + // } + // DLL.ClsSc_MouldProdOutBill oBill = new DLL.ClsSc_MouldProdOutBill(); + // List<Model.ClsSc_MouldProdOutBillMain> lsmain = new List<Model.ClsSc_MouldProdOutBillMain>(); + // msg2 = msg2.Replace("\\", ""); + // msg2 = msg2.Replace("\n", ""); //\n + // lsmain = oListModels.getObjectByJson_Gy_MouldProdOutBillMain(msg2); + // foreach (Model.ClsSc_MouldProdOutBillMain oItem in lsmain) + // { + // //oItem.HMaker = ""; + // UserName = oItem.HMaker; //鍒跺崟浜� + // oItem.HBillType = "3802"; + // oItem.HBillSubType = "3802"; + // //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 'out','{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 妯″叿棰嗙敤鍗曚繚瀛�/缂栬緫 20240702 /// <summary> /// 淇濆瓨妯″叿棰嗙敤鍗� /// </summary> @@ -7800,125 +9237,126 @@ [HttpPost] public object SaveGetMouldProdOutBillList([FromBody] JObject msg) { + DAL.ClsSc_MouldProdOutBill oBill = new DAL.ClsSc_MouldProdOutBill(); + 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(); + string sMainStr = sArray[0].ToString(); //涓昏〃鏁版嵁 + string sSubStr = sArray[1].ToString(); //瀛愯〃鏁版嵁 + string HMaker = sArray[2].ToString(); //鍒跺崟浜� try { //妯″潡鍚嶏紝鍐欏叆鏃ュ織锛屾姤閿欐锛岀敤鎴峰悕 - if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdOutBill_Edit", 1, false, msg4)) + if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdOutBill_Edit", 1, false, HMaker)) { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "娌℃湁淇濆瓨鏉冮檺"; + objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏂板/缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒"; objJsonResult.data = null; return objJsonResult; } - DLL.ClsSc_MouldProdOutBill oBill = new DLL.ClsSc_MouldProdOutBill(); - List<Model.ClsSc_MouldProdOutBillMain> lsmain = new List<Model.ClsSc_MouldProdOutBillMain>(); - msg2 = msg2.Replace("\\", ""); - msg2 = msg2.Replace("\n", ""); //\n - lsmain = oListModels.getObjectByJson_Gy_MouldProdOutBillMain(msg2); + //琛ㄥご璧嬪�� + sMainStr = sMainStr.Replace("\\", ""); + sMainStr = sMainStr.Replace("\n", ""); + sMainStr = "[" + sMainStr.ToString() + "]"; + List<Model.ClsSc_MouldProdOutBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldProdOutBillMain>>(sMainStr); foreach (Model.ClsSc_MouldProdOutBillMain oItem in lsmain) { - //oItem.HMaker = ""; - UserName = oItem.HMaker; //鍒跺崟浜� - oItem.HBillType = "3802"; - oItem.HBillSubType = "3802"; - //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) == "") + if (oItem.HInterID == 0) + { + BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; + } + else + { + BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify; + } + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID)) { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; - objJsonResult.data = 1; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = null; return objJsonResult; } + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oItem.HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s; + objJsonResult.data = null; + return objJsonResult; + } + + oItem.HYear = sYear; + oItem.HPeriod = sPeriod; + DBUtility.ClsPub.CurUserName = oItem.HMaker; 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); + sSubStr = sSubStr.Substring(1, sSubStr.Length - 2); + sSubStr = sSubStr.Replace("\\", ""); + sSubStr = sSubStr.Replace("\n", ""); + sSubStr = "[" + sSubStr.ToString() + "]"; + List<Model.ClsSc_MouldStockBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(sSubStr); 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); - } - //淇濆瓨 - //淇濆瓨瀹屾瘯鍚庡鐞� + + string sErrMsg = ""; bool bResult; - if (oBill.omodel.HInterID == 0) + //鑾峰彇绯荤粺鍙傛暟 + if (oSystemParameter.ShowBill(ref sErrMsg) == true) { - // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); - bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); - string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'out','{oBill.omodel.HInterID.ToString()}' "); - oCn.RunProc(sql); + //淇濆瓨 + if (oBill.omodel.HInterID == 0) //鏂板淇濆瓨 + { + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + + if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 + { + //淇敼鍣ㄥ叿妗f浣嶇疆 + string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'out','{oBill.omodel.HInterID.ToString()}' "); + oCn.RunProc(sql); + } + } + else //缂栬緫淇濆瓨 + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + + if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 + { + //淇敼鍣ㄥ叿妗f浣嶇疆 + string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); + 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); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg; + objJsonResult.data = null; + return objJsonResult; } + if (bResult) { objJsonResult.code = "0"; objJsonResult.count = 1; - objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; - //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); - objJsonResult.data = 1; + objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; //鎴愬姛锛� + objJsonResult.data = null; return objJsonResult; } else @@ -7926,7 +9364,7 @@ objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; - objJsonResult.data = 1; + objJsonResult.data = null; return objJsonResult; } } @@ -7934,8 +9372,8 @@ { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); - objJsonResult.data = 1; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message; + objJsonResult.data = null; return objJsonResult; } } @@ -8512,6 +9950,728 @@ } #endregion + #region [妯″叿瀵垮懡璋冩暣鍗曞鏍搞�佸弽瀹℃牳] + /// <summary> + /// + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param> + /// <param name="CurUserName">瀹℃牳浜�</param> + /// <returns></returns> + [Route("Sc_MouldLifeChangeBill/AuditSc_MouldLifeChangeBillList")] + [HttpGet] + public object AuditSc_MouldLifeChangeBillList(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "Sc_MouldLifeChangeBill_Check"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID灏忎簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); + DAL.ClsSc_MouldLifeChangeBill oBill = new DAL.ClsSc_MouldLifeChangeBill(); + //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HCloseMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //瀹℃牳鍒ゆ柇 + { + if (oBill.omodel.HChecker.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍稿垽鏂� + { + if (oBill.omodel.HChecker.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + + oCn.BeginTran();//寮�濮嬩簨鐗� + + if (IsAudit == 0) //瀹℃牳鎻愪氦 + { + + //===============================Begin 瀹℃牳鍓嶆帶鍒� Begin=============================== + string sql = "exec h_p_Sc_MouldLifeChangeBill_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCn.RunProcReturn(sql, "h_p_Sc_MouldLifeChangeBill_BeforeCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + oCn.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + oCn.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //=================================End 瀹℃牳鍓嶆帶鍒� End================================= + + //瀹℃牳鎻愪氦 + if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + + //===============================Begin 瀹℃牳鍚庢帶鍒� Begin=============================== + string sql2 = "exec h_p_Sc_MouldLifeChangeBill_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCn.RunProcReturn(sql2, "h_p_Sc_MouldLifeChangeBill_AfterCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + oCn.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + oCn.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //=================================End 瀹℃牳鍚庢帶鍒� End================================= + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + oCn.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍告彁浜� + { + //===============================Begin 鍙嶅鏍稿墠鎺у埗 Begin=============================== + string sql = "exec h_p_Sc_MouldLifeChangeBill_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCn.RunProcReturn(sql, "h_p_Sc_MouldLifeChangeBill_BeforeUnCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + oCn.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + oCn.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //=================================End 鍙嶅鏍稿墠鎺у埗 End================================= + //鍙嶅鏍告彁浜bandonCheck + if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + //===============================Begin 鍙嶅鏍稿悗鎺у埗 Begin=============================== + string sql2 = "exec h_p_Sc_MouldLifeChangeBill_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'"; + ds = oCn.RunProcReturn(sql2, "h_p_Sc_MouldLifeChangeBill_AfterUnCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + oCn.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:鍙嶅鏍稿悗鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + oCn.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //=================================End 鍙嶅鏍稿悗鎺у埗 End================================= + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍告垚鍔�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + + oCn.Commit();//鎻愪氦浜嬬墿 + 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 鍣ㄥ叿淇濆吇璁″垝鍗曞鏍�/鍙嶅鏍稿姛鑳� + [Route("Sc_MouldMaintainPlanBill/CheckSc_MouldMaintainPlanBill")] + [HttpGet] + public object CheckSc_MouldMaintainPlanBill(string HInterID, int Type, string user) + { + DAL.ClsSc_MouldMaintainPlanBill BillOld = new DAL.ClsSc_MouldMaintainPlanBill(); + try + { + //鍒ゆ柇鏄惁鏈夊鏍告潈闄� + if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainPlanBill_Check", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愬鏍�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 瀹℃牳 2 鍙嶅鏍� + if (Type == 1) + { + if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + //鑷姩鐢熸垚鐐规璁″垝鍗� + oCN.RunProc("exec h_p_Sc_MouldMaintainPlan_Auto " + HInterID); + } + else + { + if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + + oCN.Commit();//鎻愪氦浜嬪姟 + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region[鍣ㄥ叿淇濆吇璁″垝琛ㄧ紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁--淇濆吇璁″垝] + [Route("Sc_MouldMaintainPlanBill/GetPlanList")] + [HttpGet] + public object GetPlanList(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_Sc_MouldMaintainPlanList", "h_v_Sc_MouldMaintainPlanList"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + string sql1 = "select * from h_v_Sc_MouldMaintainPlanList where 1 = 1 "; + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldMaintainPlanList"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁″垝锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + #region 鍣ㄥ叿鐐规璁板綍鎷嶇収涓婁紶 + [Route("Sc_MouldDotCheckBill/UploadFile")] + [HttpPost] + public object UploadFile() + { + + string HBillNo = HttpContext.Current.Request.Params["HBillNo"]; //鍗曟嵁鍙� + string HRemark = HttpContext.Current.Request.Params["HRemark"]; //澶囨敞 + string HUserName = HttpContext.Current.Request.Params["HUserName"]; //鍒涘缓浜� + HttpPostedFile files = HttpContext.Current.Request.Files["file"]; + string path = HttpContext.Current.Server.MapPath("~/../Files/MouldFolder/" + HBillNo); + //string path = @"D:\\Files\\"+ HBillNo; + dynamic dyResult = UpLoadFile(files, path, HBillNo, HRemark, HUserName); + if (dyResult != null && dyResult.result == 1) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "涓婁紶鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = dyResult.returnval; + objJsonResult.data = null; + return objJsonResult; + } + + } + + public dynamic UpLoadFile(HttpPostedFile files, string path, string HBillNo, string HRemark, string HUserName) + { + dynamic Result_Ob = new { result = 1, returnval = "涓婁紶鎴愬姛锛�" }; + string filePath = Path.GetFullPath(files.FileName);//鏂囦欢涓婁紶璺緞 + string fileExtension = Path.GetExtension(files.FileName);// 鏂囦欢鎵╁睍鍚� + string filename = files.FileName;//鏂囦欢鍚� + string fileSavePath = path;// 涓婁紶淇濆瓨璺緞 + int filesize = files.ContentLength;//鑾峰彇涓婁紶鏂囦欢鐨勫ぇ灏忓崟浣嶄负瀛楄妭byte + int Maxsize = 40000 * 1024;//瀹氫箟涓婁紶鏂囦欢鐨勬渶澶х┖闂村ぇ灏忎负40M + try + { + if (files == null || files.ContentLength <= 0) + { + Result_Ob = new { result = 0, returnval = "鏂囦欢涓嶈兘涓虹┖!" }; + return Result_Ob; + } + if (filesize >= Maxsize) + { + Result_Ob = new { result = 0, returnval = "涓婁紶鏂囦欢瓒呰繃40M锛屼笉鑳戒笂浼狅紒" }; + return Result_Ob; + } + + string fileurl = Path.Combine(fileSavePath, filename); + if (Directory.Exists(fileurl) == true) //濡傛灉瀛樺湪閲嶅悕鏂囦欢灏辨彁绀� + { + Result_Ob = new { result = 0, returnval = "瀛樺湪鍚屽悕鏂囦欢锛�" }; + return Result_Ob; + } + //鍒犻櫎鏁版嵁琛ㄦ暟鎹� + ds = oCN.RunProcReturn("delete from MES_AccessoriesList where HSourceBillNo ='" + HBillNo + "' and HFileName='" + filename + "'", "MES_AccessoriesList"); + if (Directory.Exists(path)) + { + File.Delete(fileurl); //鍒犻櫎鎸囧畾鏂囦欢 + files.SaveAs(fileurl); + string StrPath = "/files/MouldFolder/" + HBillNo + "/" + filename; + if (File.Exists(fileurl)) + { + //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱 + //鍐欏叆鏁版嵁琛� + oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" + + ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" + + ",HFileClsID,HSourceBillNo" + + ") values('" + + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" + + ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize + + "','" + 0 + "','" + HBillNo + + "') "); + } + else + { + Result_Ob = new { result = 0, returnval = "涓婁紶澶辫触锛佹鏂囦欢涓烘伓鎰忔枃浠�" }; + } + } + else + { + Directory.CreateDirectory(fileSavePath); //娣诲姞鏂囦欢澶� + files.SaveAs(fileurl); + string StrPath = "/files/MouldFolder/" + HBillNo + "/" + filename; + if (File.Exists(fileurl)) + { + //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱 + //鍐欏叆鏁版嵁琛� + oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" + + ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" + + ",HFileClsID,HSourceBillNo" + + ") values('" + + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" + + ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize + + "','" + 0 + "','" + HBillNo + + "') "); + } + else + { + Result_Ob = new { result = 0, returnval = "涓婁紶澶辫触锛佹鏂囦欢涓烘伓鎰忔枃浠�" }; + } + } + + } + catch (Exception e) + { + Result_Ob = new { result = 0, returnval = e.Message }; + } + return Result_Ob; + } + + /// <summary> + /// 鏍规嵁鍗曟嵁鍙锋煡鎵句笂浼犳枃浠跺垪琛� + /// </summary> + /// <param name="sWhere"></param> + /// <returns></returns> + [Route("Sc_MouldDotCheckBill/Filelist")] + [HttpGet] + public object Filelist(string HBillNo) + { + var url = fileip + "/files/MouldFolder/" + HBillNo + "/"; + //@"C:\\files\\" + try + { + ds = oCN.RunProcReturn("select *,'" + url + "'+CAST(HFileName as varchar(200))as url from MES_AccessoriesList where HSourceBillNo='" + HBillNo + "'", "MES_AccessoriesList"); + 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 = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + /// <summary> + /// 鏍规嵁ID,鍗曟嵁鍙�,鏂囦欢鍚� 鍒犻櫎鏂囦欢 + /// </summary> + /// <param name="sWhere"></param> + /// <returns></returns> + [Route("Sc_MouldDotCheckBill/DeleteFilelist")] + [HttpGet] + public object DeleteFilelist(string HItemID, string HSourceBillNo, string HFileName) + { + try + { + + oCN.RunProc("delete from MES_AccessoriesList where HItemID =" + HItemID); + string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/../Files/MouldFolder/" + HSourceBillNo), HFileName); + File.Delete(fileurl); //鍒犻櫎鎸囧畾鏂囦欢 + 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; + } + } + #endregion + + #region 鍣ㄥ叿淇濆吇璁板綍鎷嶇収涓婁紶 + [Route("Sc_MouldMaintainBill/UploadFile")] + [HttpPost] + public object UploadFile_Maintain() + { + + string HBillNo = HttpContext.Current.Request.Params["HBillNo"]; //鍗曟嵁鍙� + string HRemark = HttpContext.Current.Request.Params["HRemark"]; //澶囨敞 + string HUserName = HttpContext.Current.Request.Params["HUserName"]; //鍒涘缓浜� + HttpPostedFile files = HttpContext.Current.Request.Files["file"]; + string path = HttpContext.Current.Server.MapPath("~/../Files/MouldFolder/" + HBillNo); + //string path = @"D:\\Files\\"+ HBillNo; + dynamic dyResult = UpLoadFile_Maintain(files, path, HBillNo, HRemark, HUserName); + if (dyResult != null && dyResult.result == 1) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "涓婁紶鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = dyResult.returnval; + objJsonResult.data = null; + return objJsonResult; + } + + } + + public dynamic UpLoadFile_Maintain(HttpPostedFile files, string path, string HBillNo, string HRemark, string HUserName) + { + dynamic Result_Ob = new { result = 1, returnval = "涓婁紶鎴愬姛锛�" }; + string filePath = Path.GetFullPath(files.FileName);//鏂囦欢涓婁紶璺緞 + string fileExtension = Path.GetExtension(files.FileName);// 鏂囦欢鎵╁睍鍚� + string filename = files.FileName;//鏂囦欢鍚� + string fileSavePath = path;// 涓婁紶淇濆瓨璺緞 + int filesize = files.ContentLength;//鑾峰彇涓婁紶鏂囦欢鐨勫ぇ灏忓崟浣嶄负瀛楄妭byte + int Maxsize = 40000 * 1024;//瀹氫箟涓婁紶鏂囦欢鐨勬渶澶х┖闂村ぇ灏忎负40M + try + { + if (files == null || files.ContentLength <= 0) + { + Result_Ob = new { result = 0, returnval = "鏂囦欢涓嶈兘涓虹┖!" }; + return Result_Ob; + } + if (filesize >= Maxsize) + { + Result_Ob = new { result = 0, returnval = "涓婁紶鏂囦欢瓒呰繃40M锛屼笉鑳戒笂浼狅紒" }; + return Result_Ob; + } + + string fileurl = Path.Combine(fileSavePath, filename); + if (Directory.Exists(fileurl) == true) //濡傛灉瀛樺湪閲嶅悕鏂囦欢灏辨彁绀� + { + Result_Ob = new { result = 0, returnval = "瀛樺湪鍚屽悕鏂囦欢锛�" }; + return Result_Ob; + } + //鍒犻櫎鏁版嵁琛ㄦ暟鎹� + ds = oCN.RunProcReturn("delete from MES_AccessoriesList where HSourceBillNo ='" + HBillNo + "' and HFileName='" + filename + "'", "MES_AccessoriesList"); + if (Directory.Exists(path)) + { + File.Delete(fileurl); //鍒犻櫎鎸囧畾鏂囦欢 + files.SaveAs(fileurl); + string StrPath = "/files/MouldFolder/" + HBillNo + "/" + filename; + if (File.Exists(fileurl)) + { + //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱 + //鍐欏叆鏁版嵁琛� + oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" + + ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" + + ",HFileClsID,HSourceBillNo" + + ") values('" + + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" + + ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize + + "','" + 0 + "','" + HBillNo + + "') "); + } + else + { + Result_Ob = new { result = 0, returnval = "涓婁紶澶辫触锛佹鏂囦欢涓烘伓鎰忔枃浠�" }; + } + } + else + { + Directory.CreateDirectory(fileSavePath); //娣诲姞鏂囦欢澶� + files.SaveAs(fileurl); + string StrPath = "/files/MouldFolder/" + HBillNo + "/" + filename; + if (File.Exists(fileurl)) + { + //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱 + //鍐欏叆鏁版嵁琛� + oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" + + ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" + + ",HFileClsID,HSourceBillNo" + + ") values('" + + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" + + ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize + + "','" + 0 + "','" + HBillNo + + "') "); + } + else + { + Result_Ob = new { result = 0, returnval = "涓婁紶澶辫触锛佹鏂囦欢涓烘伓鎰忔枃浠�" }; + } + } + + } + catch (Exception e) + { + Result_Ob = new { result = 0, returnval = e.Message }; + } + return Result_Ob; + } + + /// <summary> + /// 鏍规嵁鍗曟嵁鍙锋煡鎵句笂浼犳枃浠跺垪琛� + /// </summary> + /// <param name="sWhere"></param> + /// <returns></returns> + [Route("Sc_MouldMaintainBill/Filelist")] + [HttpGet] + public object Filelist_Maintain(string HBillNo) + { + var url = fileip + "/files/MouldFolder/" + HBillNo + "/"; + //@"C:\\files\\" + try + { + ds = oCN.RunProcReturn("select *,'" + url + "'+CAST(HFileName as varchar(200))as url from MES_AccessoriesList where HSourceBillNo='" + HBillNo + "'", "MES_AccessoriesList"); + 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 = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + /// <summary> + /// 鏍规嵁ID,鍗曟嵁鍙�,鏂囦欢鍚� 鍒犻櫎鏂囦欢 + /// </summary> + /// <param name="sWhere"></param> + /// <returns></returns> + [Route("Sc_MouldMaintainBill/DeleteFilelist")] + [HttpGet] + public object DeleteFilelist_Maintain(string HItemID, string HSourceBillNo, string HFileName) + { + try + { + + oCN.RunProc("delete from MES_AccessoriesList where HItemID =" + HItemID); + string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/../Files/MouldFolder/" + HSourceBillNo), HFileName); + File.Delete(fileurl); //鍒犻櫎鎸囧畾鏂囦欢 + 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; + } + } + #endregion + } } \ No newline at end of file -- Gitblit v1.9.1