From d1b14d00d9ee4ff4a1b271e6b4fe094f5049a55f Mon Sep 17 00:00:00 2001 From: duhe <226547893@qq.com> Date: 星期一, 17 三月 2025 09:23:16 +0800 Subject: [PATCH] 采购入库单:下推采购退料单 --- WebAPI/Controllers/MJGL/Sc_MouldDotCheckRuleBillController.cs | 512 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 508 insertions(+), 4 deletions(-) diff --git a/WebAPI/Controllers/MJGL/Sc_MouldDotCheckRuleBillController.cs b/WebAPI/Controllers/MJGL/Sc_MouldDotCheckRuleBillController.cs index 908f915..ae9c12e 100644 --- a/WebAPI/Controllers/MJGL/Sc_MouldDotCheckRuleBillController.cs +++ b/WebAPI/Controllers/MJGL/Sc_MouldDotCheckRuleBillController.cs @@ -8,7 +8,10 @@ using System.Net.Http; using System.Web.Http; using WebAPI.Models; - +using System.Web; +using WebAPI.Controllers.SCGL.鏃ヨ鍒掔鐞�; +using System.IO; +using SyntacticSugar.constant; namespace WebAPI.Controllers.MJGL { public class Sc_MouldDotCheckRuleBillController : ApiController @@ -40,6 +43,56 @@ string sql = "select * from h_v_Sc_MouldDotCheckRuleBillList where 1 = 1" + sWhere + " order by hmainid desc"; ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldDotCheckRuleBillList"); + + //娣诲姞鍒楀悕 + 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 ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 鍣ㄥ叿鐐规瑙勭▼鍗曞垪琛� + [Route("Sc_MouldDotCheckRuleBill/Sc_MouldDotCheckRuleListPDA")] + [HttpGet] + public object Sc_MouldDotCheckRuleListPDA(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + //鍙嶅簭鍒楀寲浼犻�掔殑鍊� + //HlpBill com = JsonConvert.DeserializeObject<HlpBill>(sWhere.ToString()); + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Sc_MouldDotCheckRuleBillList", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + string sql = "select * from h_v_Sc_MouldDotCheckRuleListByMould where 1 = 1" + sWhere + " order by hmainid desc"; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldDotCheckRuleListByMould"); //娣诲姞鍒楀悕 foreach (DataColumn col in ds.Tables[0].Columns) @@ -146,7 +199,7 @@ item.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� item.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� item.HRelationQty = 0; //鍏宠仈鏁伴噺 - oBill.DetailCol.Add(item); + oBill.DetailColl.Add(item); } @@ -254,7 +307,7 @@ } SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); //鑾峰彇鐐规椤圭洰缂栬緫鏁版嵁 - string sql = "select 鐐规椤圭洰ID HDotCheckItemID,鐐规椤圭洰浠g爜 HDotCheckItemNumber,鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart,鍏蜂綋瑕佹眰 HClaim,璐熻矗浜篒D HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜哄悕绉� HManagerName,瀛愬娉�2 HRemark from h_v_Sc_MouldDotCheckRuleBillSub where 1 = 1 " + Swhere + ""; + string sql = "select * from h_v_Sc_MouldDotCheckRuleBillSub where 1 = 1 " + Swhere + ""; ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldDotCheckRuleBillSub"); ////鑾峰彇閰嶄欢椤圭洰缂栬緫鏁版嵁 //string sql1 = "select 閰嶄欢ID HMaterID,閰嶄欢浠g爜 HMaterNumber,閰嶄欢鍚嶇О HMaterName,鍗曚綅ID HUnitID,璁¢噺鍗曚綅浠g爜 HUnitNumber,璁¢噺鍗曚綅鍚嶇О HUnitName,鐢ㄩ噺 HQty,瀛愬娉�1 HRemark,鏍囧噯鐢ㄩ噺 HQtyMust from h_v_Sc_MouldDotCheckRuleBillSub_Item where 1 = 1 " + Swhere + ""; @@ -266,6 +319,7 @@ objJsonResult.count = 1; objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; objJsonResult.list = list; + objJsonResult.data = ds.Tables[0]; } catch (Exception e) { @@ -283,7 +337,7 @@ [HttpGet] public object DeleteMouldDotCheckRuleBill(string HInterID, string user) { - if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainRuleBill_Delete", 1, false, user)) + if (!DBUtility.ClsPub.Security_Log("Sc_MouldDotCheckPlanBill_Delete", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -341,5 +395,455 @@ } } #endregion + + #region[鍣ㄥ叿鐐规璁板綍琛紝閫夌偣妫�璁″垝鑾峰彇鐐规璁″垝娓呭崟淇℃伅] + [Route("Sc_MouldDotCheckPlanBill/Sc_MouldDotCheckPlanBill_PlanList")] + [HttpGet] + public object Sc_MouldDotCheckPlanBill_PlanList(string HInterID, string HDate) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + ds = oCN.RunProcReturn("exec h_p_Sc_MouldDotCheck_GetPlanList " + HInterID + ",'" + HDate + "'", "h_p_Sc_MouldDotCheck_GetPlanList"); + + if (ds.Tables[0].Rows.Count != 0 || ds != null) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + 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 鍣ㄥ叿鐐规瑙勭▼ 鏂囦欢瀵煎叆淇濆瓨 + #region 鍣ㄥ叿鐐规瑙勭▼ 鏂囦欢涓婁紶 + [Route("Sc_MouldDotCheckRuleBill/Sc_MouldDotCheckRuleBill_Excel")] + [HttpPost] + public object Sc_MouldDotCheckRuleBill_Excel() + { + try + { + //鑾峰彇鏂囦欢鍚嶇О + var file = HttpContext.Current.Request.Files[0]; + //鑾峰彇鏂囦欢鐗╃悊璺緞 + string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName); + //淇濆瓨鏂囦欢 + file.SaveAs(ExcelPath); + + NpoiHelper np = new NpoiHelper(); + DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0"); + + //鍒犻櫎鏂囦欢 + File.Delete(ExcelPath); + + //鍒涘缓涓存椂琛� + DataTable tb2 = new DataTable("dt2"); + + //娣诲姞鍒楀悕 + for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++) + { + tb2.Columns.Add(ExcelDs.Tables[0].Rows[0][i].ToString()); + } + + //妯℃澘缂哄皯鍒� 浣嗛渶瑕佷粠鏁版嵁搴撲腑鏌ヨ鍑烘潵鏄剧ず鍦ㄩ〉闈㈢殑瀛楁 + tb2.Columns.Add("HOrgID", typeof(Int32));//缁勭粐ID + tb2.Columns.Add("HDotCheckItemID", typeof(Int32));//鐐规椤圭洰ID + tb2.Columns.Add("HManagerID", typeof(Int32));//璐熻矗浜篒D + tb2.Columns.Add("HMouldID", typeof(Int32));//鍣ㄥ叿ID + tb2.Columns.Add("HDotCheckItemClassID", typeof(Int32));//鐐规椤圭洰鍒嗙被 + //娣诲姞鏁版嵁 + for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++) + { + DataRow row = tb2.NewRow(); + for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++) + { + row[j] = ExcelDs.Tables[0].Rows[i][j].ToString(); + } + tb2.Rows.Add(row); + } + + + var error = ""; + + //鏌ヨ娌℃湁鐨勫垪 + if (!tb2.Columns.Contains("缁勭粐浠g爜")) + error += "娌℃湁鎵惧埌銆愮粍缁囦唬鐮併�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("缁勭粐鍚嶇О")) + error += "娌℃湁鎵惧埌銆愮粍缁囧悕绉般�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("瑙勭▼缂栧彿")) + error += "娌℃湁鎵惧埌銆愯绋嬬紪鍙枫�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("瑙勭▼鍚嶇О")) + error += "娌℃湁鎵惧埌銆愯绋嬪悕绉般�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("鍣ㄥ叿缂栫爜")) + error += "娌℃湁鎵惧埌銆愬櫒鍏风紪鐮併�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("鍣ㄥ叿鍚嶇О")) + error += "娌℃湁鎵惧埌銆愬櫒鍏峰悕绉般�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("鍛ㄦ湡鍗曚綅")) + error += "娌℃湁鎵惧埌銆愬懆鏈熷崟浣嶃�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("鐐规鍛ㄦ湡")) + error += "娌℃湁鎵惧埌銆愮偣妫�鍛ㄦ湡銆戠殑鏍囬,"; + + if (!tb2.Columns.Contains("鎽樿")) + error += "娌℃湁鎵惧埌銆愭憳瑕併�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("琛ㄥご澶囨敞")) + error += "娌℃湁鎵惧埌銆愯〃澶村娉ㄣ�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("鐐规椤圭洰浠g爜")) + error += "娌℃湁鎵惧埌銆愮偣妫�椤圭洰浠g爜銆戠殑鏍囬,"; + + if (!tb2.Columns.Contains("鐐规椤圭洰鍚嶇О")) + error += "娌℃湁鎵惧埌銆愮偣妫�椤圭洰鍚嶇О銆戠殑鏍囬,"; + + if (!tb2.Columns.Contains("鐐规閮ㄤ綅")) + error += "娌℃湁鎵惧埌銆愮偣妫�閮ㄤ綅銆戠殑鏍囬,"; + + if (!tb2.Columns.Contains("鍏蜂綋瑕佹眰")) + error += "娌℃湁鎵惧埌銆愬叿浣撹姹傘�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("璐熻矗浜轰唬鐮�")) + error += "娌℃湁鎵惧埌銆愯礋璐d汉浠g爜銆戠殑鏍囬,"; + + if (!tb2.Columns.Contains("璐熻矗浜�")) + error += "娌℃湁鎵惧埌銆愯礋璐d汉銆戠殑鏍囬,"; + + if (!tb2.Columns.Contains("琛ㄤ綋澶囨敞")) + error += "娌℃湁鎵惧埌銆愯〃浣撳娉ㄣ�戠殑鏍囬,"; + + if (error.Length > 0) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = $"Excel妯℃澘瀛樺湪閿欒,{error}\r\n"; + objJsonResult.data = null; + return objJsonResult; + } + + for (int i = 0; i <= tb2.Rows.Count - 1; i++) + { + string HName = ""; + string HNum = ""; + string HORGNumber = ""; + string HORGName = ""; + string HManagerName = ""; + string HManagerNumber = ""; + string HDotCheckItemNumber = ""; + string HDotCheckItemName = ""; + string HMouldNumber = ""; + string HMouldName = ""; + + HName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["瑙勭▼缂栧彿"].ToString()); + HNum = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["瑙勭▼鍚嶇О"].ToString()); + HMouldNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鍣ㄥ叿缂栫爜"].ToString()); + HMouldName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鍣ㄥ叿鍚嶇О"].ToString()); + HORGNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["缁勭粐浠g爜"].ToString()); + HORGName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["缁勭粐鍚嶇О"].ToString()); + HManagerNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["璐熻矗浜轰唬鐮�"].ToString()); + HManagerName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["璐熻矗浜�"].ToString()); + HDotCheckItemNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鐐规椤圭洰浠g爜"].ToString()); + HDotCheckItemName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鐐规椤圭洰鍚嶇О"].ToString()); + + //妫�鏌� + int index = i + 1; + //缁勭粐 + if (HORGNumber != "") + { + //鏌ヨ缁勭粐 + ds = oCN.RunProcReturn("select * from Xt_ORGANIZATIONS where HNumber='" + HORGNumber + "' and Hname='" + HORGName + "'", "Xt_ORGANIZATIONS"); + + if (ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,缁勭粐涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + tb2.Rows[i]["HOrgID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); + } + string HORGid = ds.Tables[0].Rows[0]["HItemID"].ToString(); + } + else + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,缁勭粐浠g爜涓虹┖"; + objJsonResult.data = null; + return objJsonResult; + } + //鍣ㄥ叿 + if (HMouldNumber != "") + { + ds = oCN.RunProcReturn("select * from Gy_MouldFileMain where HMouldNo='" + HMouldNumber + "' and Hname='" + HMouldName + "'", "Gy_MouldFileMain"); + + if (ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,鍣ㄥ叿涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + tb2.Rows[i]["HMouldID"] = ds.Tables[0].Rows[0]["HInterID"].ToString(); + } + } + else + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,鍣ㄥ叿浠g爜涓虹┖"; + objJsonResult.data = null; + return objJsonResult; + } + //鐐规椤圭洰浠g爜 + if (HDotCheckItemNumber != "") + { + + ds = oCN.RunProcReturn("select * from Gy_DotCheck where HNumber='" + HDotCheckItemNumber + "' and Hname='" + HDotCheckItemName + "'", "Gy_DotCheck"); + + if (ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,鐐规椤圭洰涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + tb2.Rows[i]["HDotCheckItemID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); + tb2.Rows[i]["HDotCheckItemClassID"] = ds.Tables[0].Rows[0]["HDotCheckItemClassID"].ToString(); + } + string HDotCheckItemID = ds.Tables[0].Rows[0]["HItemID"].ToString(); + } + else + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,鐐规椤圭洰浠g爜涓虹┖"; + objJsonResult.data = null; + return objJsonResult; + } + //璐熻矗浜轰唬鐮� + if (HManagerNumber != "") + { + //鏌ヨ缁勭粐 + ds = oCN.RunProcReturn("select * from Gy_Employee where HNumber='" + HManagerNumber + "' and Hname='" + HManagerName + "'", "Gy_Employee"); + + if (ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,璐熻矗浜轰笉瀛樺湪锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + tb2.Rows[i]["HManagerID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); + } + } + //鍣ㄥ叿鐐规瑙勭▼鍚嶇О + if (HName == "") + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,鍣ㄥ叿鐐规瑙勭▼鍚嶇О涓嶈兘涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + //鍣ㄥ叿鐐规瑙勭▼浠g爜 + if (HNum == "") + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,鍣ㄥ叿鐐规瑙勭▼浠g爜涓嶈兘涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + + objJsonResult.code = CodeConstant.SUCCEED; + objJsonResult.count = CountConstant.SUCCEED; + objJsonResult.Message = error; + objJsonResult.data = tb2; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 鍣ㄥ叿鐐规瑙勭▼椤圭洰 瀵煎叆(淇濆瓨) + [Route("Sc_MouldDotCheckRuleBill/Sc_MouldDotCheckRuleBill_btnSave")] + [HttpPost] + public object Sc_MouldDotCheckRuleBill_btnSave([FromBody] JObject sMainSub) + { + var _value = sMainSub["sMainSub"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { "&鍜�" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); + string user = sArray[1].ToString(); + try + { + if (!DBUtility.ClsPub.Security_Log("Sc_MouldDotCheckRuleBill_Edit", 1, false, user)) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + List<object> Excel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<object>>(msg2); + List<Dictionary<string, string>> list = new List<Dictionary<string, string>>(); + + foreach (JObject item in Excel) + { + Dictionary<string, string> dic = new Dictionary<string, string>(); + foreach (var itm in item.Properties()) + { + dic.Add(itm.Name, itm.Value.ToString()); + } + list.Add(dic); + } + + oCN.BeginTran(); + int i = 1; + foreach (Dictionary<string, string> item in list) + { + string HBillType = "3834"; + string HMaker = user;//鍒跺崟浜� + DateTime HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + long HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + long HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); + string HOrgID = item["HOrgID"].ToString();//缁勭粐ID + string HMouldID = item["HMouldID"].ToString();//鍣ㄥ叿ID + string HName = item["瑙勭▼鍚嶇О"].ToString(); + string HBillNo = item["瑙勭▼缂栧彿"].ToString(); + string HCycleUnit = item["鍛ㄦ湡鍗曚綅"].ToString(); + string HCheckCycle = item["鐐规鍛ㄦ湡"].ToString(); + string HExplanation = item["鎽樿"].ToString(); + string HRemark = item["琛ㄥご澶囨敞"].ToString(); + //瀛愯〃 + string HDotCheckItemID = item["HDotCheckItemID"].ToString();//鐐规椤圭洰 + string HDotCheckItemClassID = item["HDotCheckItemClassID"].ToString();//鐐规鍒嗙被椤圭洰 + string HManagerID = item["HManagerID"].ToString()==""? "0": item["HManagerID"].ToString();//璐熻矗浜� + string HDotCheckPart = item["鐐规閮ㄤ綅"].ToString(); + string HClaim = item["鍏蜂綋瑕佹眰"].ToString(); + string HSubRemark = item["琛ㄤ綋澶囨敞"].ToString(); + string HDotCheckItem = item["鐐规椤圭洰鍚嶇О"].ToString(); + ds = oCN.RunProcReturn("select * from Sc_MouldDotCheckRuleBillMain where HBillNo='" + HBillNo + "'", "Sc_MouldDotCheckRuleBillMain"); + + if (ds.Tables[0].Rows.Count == 0) + { + long HInterID = DBUtility.ClsPub.CreateBillID(HBillType, ref DBUtility.ClsPub.sExeReturnInfo); + //鎻掑叆涓昏〃 + oCN.RunProc("Insert Into Sc_MouldDotCheckRuleBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + + ",HMouldID,HBeginDate,HEndDate,HCycleUnit,HCheckCycle,HExplanation,HInnerBillNo" + + ") " + + " values('" + HBillType + "','" + HBillType + "'," + HInterID.ToString() + ",'" + HBillNo + "','" + HDate + "'" + + ", " + HYear.ToString() + "," + HPeriod.ToString() + ",'" + HRemark + "','" + HMaker + "',getdate()" + + ", " + HMouldID.ToString() + ", '" + DateTime.Now.ToShortDateString() + "','" + DateTime.Now.AddMonths(1).ToShortDateString() + "','" + HCycleUnit + "', " + HCheckCycle.ToString() + ",'" + HExplanation + "','" + "" + "'" + + + ") "); + //鎻掑叆瀛愯〃 + oCN.RunProc("Insert into Sc_MouldDotCheckRuleBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim,HManagerID,HDotCheckItemClassID,HDotCheckItemMethodID" + + ") values(" + + HInterID.ToString() + "," + 1 + ",'" + "" + "'," + DateTime.Now.ToShortDateString() + "," + Convert.ToString(false ? 1 : 0) + ",'" + HSubRemark + "'" + + "," + 0 + "," + 0 + ",'" + "" + "','" + "" + "'," + 0 + "," + 0 + + "," + HDotCheckItemID.ToString() + ",'" + HDotCheckItem + "','" + HDotCheckPart + "','" + HClaim + "'," + HManagerID.ToString() + "," + HDotCheckItemClassID + "," + 0 + + ") "); + } + else + { + long HInterID = long.Parse(ds.Tables[0].Rows[0]["HInterID"].ToString()); + //鑾峰彇鏈�澶у瓙id + DataSet ds2 = oCN.RunProcReturn("select max(HEntryID) HEntryID from Sc_MouldDotCheckRuleBillSub where HInterID='" + HInterID + "'", "Sc_MouldDotCheckRuleBillSub"); + long HEntryID = 1; + if (ds2.Tables[0].Rows.Count > 0) + { + HEntryID = long.Parse(ds2.Tables[0].Rows[0]["HEntryID"].ToString()) + 1; + } + //鎻掑叆瀛愯〃 + oCN.RunProc("Insert into Sc_MouldDotCheckRuleBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim,HManagerID,HDotCheckItemClassID,HDotCheckItemMethodID" + + ") values(" + + HInterID.ToString() + "," + HEntryID + ",'" + "" + "'," + DateTime.Now.ToShortDateString() + "," + Convert.ToString(false ? 1 : 0) + ",'" + HSubRemark + "'" + + "," + 0 + "," + 0 + ",'" + "" + "','" + "" + "'," + 0 + "," + 0 + + "," + HDotCheckItemID.ToString() + ",'" + HDotCheckItem + "','" + HDotCheckPart + "','" + HClaim + "'," + HManagerID.ToString() + "," + HDotCheckItemClassID + "," + 0 + + ") "); + } + + i++; + } + + oCN.Commit(); + + objJsonResult.code = CodeConstant.SUCCEED; + objJsonResult.count = CountConstant.SUCCEED; + objJsonResult.Message = "瀵煎叆鎴愬姛!"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + LogService.Write(e); + oCN.RollBack(); + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + #endregion + } } \ No newline at end of file -- Gitblit v1.9.1