From 243e86af1a7c74c8bfda3bb41f29a11fef13c065 Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期三, 09 十月 2024 16:32:52 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/数据同步/钉钉同步/DD_DataSynchronizationController.cs | 290 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 243 insertions(+), 47 deletions(-) diff --git "a/WebAPI/Controllers/\346\225\260\346\215\256\345\220\214\346\255\245/\351\222\211\351\222\211\345\220\214\346\255\245/DD_DataSynchronizationController.cs" "b/WebAPI/Controllers/\346\225\260\346\215\256\345\220\214\346\255\245/\351\222\211\351\222\211\345\220\214\346\255\245/DD_DataSynchronizationController.cs" index 44f4ba3..4bb6860 100644 --- "a/WebAPI/Controllers/\346\225\260\346\215\256\345\220\214\346\255\245/\351\222\211\351\222\211\345\220\214\346\255\245/DD_DataSynchronizationController.cs" +++ "b/WebAPI/Controllers/\346\225\260\346\215\256\345\220\214\346\255\245/\351\222\211\351\222\211\345\220\214\346\255\245/DD_DataSynchronizationController.cs" @@ -16,6 +16,7 @@ using DingTalk.Api; using DingTalk.Api.Response; using System.Globalization; +using System.Linq; namespace WebAPI.Controllers { @@ -268,15 +269,26 @@ public string HExplanation;// varchar(500) --缁翠慨瑕佹眰 public string HInnerBillNo;// varchar(50) --鍐呴儴鍗曟嵁鍙� public Int64 HMouldID; + public Int64 HMouldMaintainRuleInterID; + public Int64 HMaintainItemID; public Int64 HSupID;// int --渚涘簲鍟嗭紙Gy_Supplier锛� addnew public string HRepairType;// varchar(10) --缁翠慨绫诲瀷锛堝唴閮ㄧ淮淇紝濮斿缁翠慨锛� addnew public string HNewModel;// varchar(100) --缁翠慨鍚庢柊瑙勬牸 addnew public Single HNewDesignLife;// money --鏂拌璁″鍛� public string HRemark; - + public string HPlanNo; + public string HPlanInterID; + public DateTime HRequestComDate; + public double HRecentMainModule; + public double HCumulativeModule; + public double HProductionModule; + public DateTime HRepairAccepDate; + public string HMaintainLevID; + //鍗曟嵁鍐呭 + public string HBillNo; //鍗曟嵁鍙� public string HDate; //鏃ユ湡 public string HCheckLevel; //瀹℃牳绛夌骇 public string HArea; //鍖哄煙 @@ -332,6 +344,10 @@ public Single HPlanTimes;// money --璁″垝缁翠慨宸ユ椂 public Single HTimes;// money --瀹為檯缁翠慨宸ユ椂 public string HRemark2;//澶囨敞 + public string HRepairCategory; + public string HUrgenLevel; + public string HRepairer; + public string HIsCapacityImpact; //鍗曟嵁鍐呭 public string HDate; //鏃ユ湡 @@ -510,8 +526,8 @@ //OriginatorId = "12", //鏍规嵁娴佺▼鍙戣捣浜哄伐鍙锋煡璇€�� //TaskId = "12", //浠诲姟ID銆� - //CreateFromTimeGMT = DateTime.Now.ToString("dd") == "01" ? "2022-01-01" : DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd"), //鍒涘缓鏃堕棿璧峰鍊笺�� - //CreateToTimeGMT = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), //鍒涘缓鏃堕棿缁堟鍊笺�� + //CreateFromTimeGMT = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd"), //鍒涘缓鏃堕棿璧峰鍊笺�� + //CreateToTimeGMT = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd hh:mm:ss"), //鍒涘缓鏃堕棿缁堟鍊笺�� ModifiedFromTimeGMT = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"), //淇敼鏃堕棿璧峰鍊笺�� ModifiedToTimeGMT = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), //淇敼鏃堕棿缁堟鍊笺�� @@ -2058,7 +2074,38 @@ if (getInstanceByIdResponse.Body.InstanceStatus != "COMPLETED") { - continue; + //continue; + } + + //寮�鍗曟棩鏈� + if (keys.Contains("dateField_lq0v65sv")) + { + double HDate_Temp = double.Parse(response.Body.Result[i].FormData["dateField_lq0v65sv"].ToString()); + oItem.HDate = convertFromMillisecondsToDateString(HDate_Temp, "yyyy-MM-dd HH:mm"); + } + + //妯″叿淇濆吇绾у埆 + if (keys.Contains("selectField_m1ip9j31")) + { + string HDate_Temp = response.Body.Result[i].FormData["selectField_m1ip9j31"].ToString(); + if (!HDate_Temp.Contains("涓夌骇")) + { + ds = oCN.RunProcReturn("select * from h_v_Gy_MaintainLev where 淇濆吇绾у埆浠g爜='BY-SE-002'", "h_v_Gy_MaintainLev"); + if (ds.Tables[0].Rows.Count > 0) + { + HDate_Temp = ds.Tables[0].Rows[0]["HItemID"].ToString(); + } + } + else if (HDate_Temp.Contains("涓夌骇")) + { + ds = oCN.RunProcReturn("select * from h_v_Gy_MaintainLev where 淇濆吇绾у埆浠g爜='BY-SE-003'", "h_v_Gy_MaintainLev"); + if (ds.Tables[0].Rows.Count > 0) + { + HDate_Temp = ds.Tables[0].Rows[0]["HItemID"].ToString(); + } + } + + oItem.HMaintainLevID = HDate_Temp; } //淇ā寮�濮嬫椂闂� @@ -2075,17 +2122,52 @@ oItem.HRepairEndDate = DateTime.Parse(convertFromMillisecondsToDateString(HDate_Temp, "yyyy-MM-dd HH:mm")); } - //妯″叿鎵规鍙� + //妯″叿鍗曟嵁鍙� if (keys.Contains("serialNumberField_lqaak4ts")) { string HDate_Temp = response.Body.Result[i].FormData["serialNumberField_lqaak4ts"].ToString(); - oItem.HRemark = HDate_Temp; + oItem.HBillNo = HDate_Temp; } - //妯″叿缂栫爜 - if (keys.Contains("dateField_lq4gf2ii")) + //瑕佹眰瀹屾垚鏃ユ湡 + if (keys.Contains("dateField_lq3idkvd")) { - string HDate_Temp = response.Body.Result[i].FormData["dateField_lq4gf2ii"].ToString(); + double HDate_Temp = double.Parse(response.Body.Result[i].FormData["dateField_lq3idkvd"].ToString()); + oItem.HRequestComDate = DateTime.Parse(convertFromMillisecondsToDateString(HDate_Temp, "yyyy-MM-dd HH:mm:ss")); + } + + //缁翠慨鍙楃悊鏃ユ湡 + if (keys.Contains("dateField_lq4gf2ih")) + { + double HDate_Temp = double.Parse(response.Body.Result[i].FormData["dateField_lq4gf2ih"].ToString()); + oItem.HRepairAccepDate = DateTime.Parse(convertFromMillisecondsToDateString(HDate_Temp, "yyyy-MM-dd HH:mm:ss")); + } + + //鏈�杩戜繚鍏绘ā鏁� + if (keys.Contains("numberField_lq3idkvi")) + { + string HDate_Temp = response.Body.Result[i].FormData["numberField_lq3idkvi"].ToString(); + oItem.HRecentMainModule = double.Parse(HDate_Temp); + } + + //绱妯℃暟 + if (keys.Contains("numberField_lq3idkvj")) + { + string HDate_Temp = response.Body.Result[i].FormData["numberField_lq3idkvj"].ToString(); + oItem.HCumulativeModule = double.Parse(HDate_Temp); + } + + //鏈鐢熶骇妯℃暟 + if (keys.Contains("textField_lq4vdvgh")) + { + string HDate_Temp = response.Body.Result[i].FormData["textField_lq4vdvgh"].ToString(); + oItem.HProductionModule = double.Parse(HDate_Temp); + } + + //妯″叿缂栫爜 + if (keys.Contains("selectField_lq3idkvg")) + { + string HDate_Temp = response.Body.Result[i].FormData["selectField_lq3idkvg"].ToString(); DataSet ds = oCN.RunProcReturn("select * from Gy_MouldFileMain with(nolock) where HNumber='" + HDate_Temp + "'", "Gy_MouldFileMain"); string HMouldID = "0"; if (ds.Tables[0].Rows.Count > 0) @@ -2093,6 +2175,18 @@ HMouldID = ds.Tables[0].Rows[0]["HInterID"].ToString(); } oItem.HMouldID = long.Parse(HMouldID); + oItem.HRemark = HDate_Temp; + + + //鏌ヨ淇濆吇璁″垝 + ds = oCN.RunProcReturn(@"select a.HInterID,a.HBillNo from Sc_MouldMaintainPlanBillMain a + inner join Sc_MouldMaintainPlanBillSub b on a.HInterID = b.HInterID + where a.HMouldID =" + oItem.HMouldID + " and a.HMaintainLevID = " + oItem.HMaintainLevID, "Sc_MouldMaintainPlanBillMain"); + + if (ds.Tables[0].Rows.Count > 0) { + oItem.HPlanInterID = ds.Tables[0].Rows[0]["HInterID"].ToString(); + oItem.HPlanNo = ds.Tables[0].Rows[0]["HInterID"].ToString(); + } } @@ -2116,7 +2210,7 @@ if (keys.Contains("employeeField_lq3idkvh")) { string[] HDate_Temp = JsonConvert.DeserializeObject<string[]>(JsonConvert.SerializeObject(response.Body.Result[i].FormData["employeeField_lq3idkvh"])); - DataSet ds = oCN.RunProcReturn("select * from Gy_Employee with(nolock) where HNumber='" + HDate_Temp[0] + "'", "Gy_Employee"); + DataSet ds = oCN.RunProcReturn("select * from Gy_Employee with(nolock) where hname='" + HDate_Temp[0] + "'", "Gy_Employee"); string HEmpID = "0"; if (ds.Tables[0].Rows.Count > 0) { @@ -2233,6 +2327,7 @@ } catch (Exception e) { + LogService.Write(e.Message); msg = e.Message; return false; } @@ -2268,11 +2363,33 @@ try { oCN.BeginTran(); + + string HMouldMaintainRuleInterID = "0"; + string HMaintainItemID = "0"; + string HRepairID = "0"; + DataSet dataSet = oCN.RunProcReturn(@"select a.HInterID,item.HMaintainItemID from Sc_MouldMaintainRuleBillMain a with(nolock) +inner join Sc_MouldMaintainRuleBillSub_Item item with(nolock) on a.HInterID = item.HInterID +where a.HRemark like'%閽夐拤鍚屾%'", "Sc_MouldMaintainRuleBillMain"); + + if (dataSet.Tables[0].Rows.Count > 0) + { + HMouldMaintainRuleInterID = dataSet.Tables[0].Rows[0]["HInterID"].ToString(); + HMaintainItemID = dataSet.Tables[0].Rows[0]["HMaintainItemID"].ToString(); + } + + dataSet = oCN.RunProcReturn(@"select HItemID from Gy_Repair a with(nolock) where a.HRemark like'%閽夐拤鍚屾%' and HName like'%妯″叿缁翠慨%'", "Gy_Repair"); + + if (dataSet.Tables[0].Rows.Count > 0) + { + HRepairID = dataSet.Tables[0].Rows[0]["HItemID"].ToString(); + } + foreach (MouldFileWeiXiuBaoYang oItem in lsmain) { //淇濆吇璁板綍 if (oItem.DetailColMouldMaintain.Count != 0) { + string BillType = "3819"; string sql = $@"select HInnerBillNo from Sc_MouldMaintainBillMain where HInnerBillNo = '{oItem.HInstanceID}'"; @@ -2281,7 +2398,7 @@ if (ds.Tables[0].Rows.Count == 0) { long HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); - string HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true); + //string HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true); //long HInterID = 0; //string HBillNo = ""; string sql_main = "Insert Into Sc_MouldMaintainBillMain " + @@ -2290,11 +2407,16 @@ ",HPlanNo,HPlanInterID,HMouldID,HBeginDate" + ",HEndDate" + ",HInnerBillNo,HExplanation,HMouldMaintainRuleInterID,HMaintainLevID,HLastResult" + - ")values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',getdate(),'" + oItem.HOriginator + "','" + oItem.HMakeDate + "'" + + ",HRequestComDate,HRecentMainModule,HCumulativeModule,HProductionModule" + + ",HPlanInterID,HPlanNo,HMaintainLevID)" + + "values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + oItem.HBillNo + "','"+ oItem.HDate + "','" + oItem.HOriginator + "','" + oItem.HMakeDate + "'" + ",'" + DateTime.Now.Year + "','" + DateTime.Now.Month + "','"+ oItem.HRemark + "','" + oItem.HUpdateDate + "'" + ",'','0','" + oItem.HMouldID + "','" + oItem.HRepairBeginDate + "'" + ",'" + oItem.HRepairEndDate + "'" + - ",'" + oItem.HInstanceID + "','',0,0,'OK')"; + ",'" + oItem.HInstanceID + "','',"+ HMouldMaintainRuleInterID + ",0,'OK'" + + ",'"+ oItem.HRequestComDate + "'," + oItem.HRecentMainModule + "," + oItem.HCumulativeModule + "," + oItem.HProductionModule + "" + + "," + oItem.HPlanInterID + "," + oItem.HPlanNo + "," + oItem.HMaintainLevID + ")"; + LogService.Write(sql_main); oCN.RunProc(sql_main); int i = 1; foreach (Sc_MouldMaintainBillSub oItem_Detail in oItem.DetailColMouldMaintain) @@ -2305,11 +2427,13 @@ ",HManagerID" + ",HCloseMan,HCloseType,HRemark" + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaintainResult" + - ") values('" + HInterID + "'," + i + ",0,'" + oItem_Detail.HClaim + "'" + + ") " + + "values('" + HInterID + "'," + i + ","+ HMaintainItemID + ",'" + oItem_Detail.HClaim + "'" + ",'','" + oItem_Detail.HClaim + "'" + ",'" + oItem.HEmpID + "'" + ",'','','" + oItem_Detail.HMaintainResult + "'" + - ",'0','0','','',0,0,'')"; + ",'0','0','','',0,0,'Y')"; + LogService.Write(sql_sub); oCN.RunProc(sql_sub); i += 1; } @@ -2328,7 +2452,7 @@ if (ds.Tables[0].Rows.Count == 0) { long HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); - string HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true); + //string HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true); //long HInterID = 0; //string HBillNo = ""; string sql_main = "Insert Into Sc_MouldRepairWorkBillMain " + @@ -2338,13 +2462,15 @@ ",HCycleUnit,HPlanTimes,HTimes,HEmpID,HManagerID" + ",HDeptID,HExplanation,HInnerBillNo,HMouldID" + ",HSupID,HRepairType,HNewModel,HNewDesignLife,HMainSourceBillType,HMainSourceInterID,HMainSourceEntryID" + - ")values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',getdate()" + - ",'" + DateTime.Now.Year + "','" + DateTime.Now.Month + "','','" + oItem.HOriginator + "','" + oItem.HMakeDate + "'" + - ",'0','0','" + oItem.HRepairBeginDate + "','" + oItem.HUpdateDate + "',''" + + ",HRepairAccepDate)values" + + "('" + BillType + "','" + BillType + "'," + HInterID + ",'" + oItem.HBillNo + "','"+ oItem .HDate+ "'" + + ",'" + DateTime.Now.Year + "','" + DateTime.Now.Month + "','"+ oItem.HRemark + "','" + oItem.HOriginator + "','" + oItem.HMakeDate + "'" + + ",'0','"+ HRepairID + "','" + oItem.HRepairBeginDate + "','" + oItem.HRepairEndDate + "',''" + ",'灏忔椂','" + oItem.HPlanTimes + "','" + oItem.HTimes + "','" + oItem.HEmpID + "',0" + ",'" + oItem.HDeptID + "','','" + oItem.HInstanceID + "','" + oItem.HMouldID + "'" + - ",'0','鍐呴儴缁翠慨','','" + oItem.HNewDesignLife + "','',0,0)"; - + ",'0','鍐呴儴缁翠慨','','" + oItem.HNewDesignLife + "','1',0,0" + + ",'"+ oItem.HRepairAccepDate + "')"; + LogService.Write(sql_main); oCN.RunProc(sql_main); int i = 1; foreach (Sc_MouldRepairWorkBillSub oItem_Detail in oItem.DetailColMouldRepair) @@ -2355,7 +2481,8 @@ ",HRepairID,HRepairExplanation,HManagerID,HMoney) values" + "('" + HInterID + "'," + i + ",'','','','" + oItem_Detail.HRemark + "'" + ",0,0,'','',0,0" + - ",0,'" + oItem_Detail.HRepairExplanation + "','" + oItem.HEmpID + "',0)"; + ","+ HRepairID + ",'" + oItem_Detail.HRepairExplanation + "','" + oItem.HEmpID + "',0)"; + LogService.Write(sql_sub); oCN.RunProc(sql_sub); i += 1; } @@ -2370,6 +2497,7 @@ } catch (Exception e) { + LogService.Write(e.Message); msg = e.Message; oCN.RollBack(); return false; @@ -2382,7 +2510,7 @@ #region 鑾峰彇 瀹滄惌-璁惧缁翠慨璁板綍鍗� 瀹炰緥ID鍒楄〃瀵瑰簲鐨勫疄渚嬭鎯� public bool getInstanceDetailList___EquipRepairWeiXiu_YiDa(string appType, string systemToken, string userID, string formUuid, List<string> IDList, ref List<EquipRepairWeiXiu> lsmain, ref string msg, int size = 500) { - + string a = ""; try { int startIndex = 0; @@ -2434,20 +2562,27 @@ continue; } + if (oItem.HInstanceID != "9b6e108c-b7bf-45e4-910d-5629ac30d4aa") { + continue; + } + //璁惧缂栫爜 if (keys.Contains("textField_lfg9hgys")) { string HDate_Temp = response.Body.Result[i].FormData["textField_lfg9hgys"].ToString(); - DataSet ds = oCN.RunProcReturn("select * from Gy_MouldFileMain with(nolock) where HNumber='" + HDate_Temp + "'", "Gy_MouldFileMain"); + DataSet ds = oCN.RunProcReturn("select * from Gy_EquipFileBillMain with(nolock) where HEquipFileNo='" + HDate_Temp + "'", "Gy_EquipFileBillMain"); string HEquipID = "0"; if (ds.Tables[0].Rows.Count > 0) { HEquipID = ds.Tables[0].Rows[0]["HInterID"].ToString(); + oItem.HEquipID = long.Parse(HEquipID); + oItem.HRemark2 = HDate_Temp; } - oItem.HEquipID = long.Parse(HEquipID); - oItem.HRemark2 = HDate_Temp; + else + { + continue; + } } - //缁翠慨閮ㄩ棬 if (keys.Contains("selectField_kzgkw10a")) @@ -2458,31 +2593,31 @@ if (ds.Tables[0].Rows.Count > 0) { HDeptID = ds.Tables[0].Rows[0]["HItemID"].ToString(); + oItem.HDeptID = long.Parse(HDeptID); } - oItem.HDeptID = long.Parse(HDeptID); - } + else + { + continue; + } + } //缁翠慨浜� if (keys.Contains("employeeField_lthwkdh2")) { string[] HDate_Temp = JsonConvert.DeserializeObject<string[]>(JsonConvert.SerializeObject(response.Body.Result[i].FormData["employeeField_lthwkdh2"])); - DataSet ds = oCN.RunProcReturn("select * from Gy_Employee with(nolock) where HNumber='" + HDate_Temp[0] + "'", "Gy_Employee"); + DataSet ds = oCN.RunProcReturn("select * from Gy_Employee with(nolock) where HName='" + HDate_Temp[0] + "'", "Gy_Employee"); string HEmpID = "0"; if (ds.Tables[0].Rows.Count > 0) { HEmpID = ds.Tables[0].Rows[0]["HItemID"].ToString(); + oItem.HEmpID = long.Parse(HEmpID); } - oItem.HEmpID = long.Parse(HEmpID); - } + else + { + continue; + } - //缁翠慨鏃堕棿 - if (keys.Contains("textField_l2r95oo2")) - { - string HDate_Temp = response.Body.Result[i].FormData["textField_l2r95oo2"].ToString(); - - oItem.HTimes = long.Parse(HDate_Temp); - oItem.HPlanTimes = long.Parse(HDate_Temp); } //缁翠慨鍐呭 @@ -2493,6 +2628,53 @@ oItem.HRepairContent = HDate_Temp; } + //鎶ヤ慨绫诲埆 + if (keys.Contains("multiSelectField_lfg9hgyv")) + { + string[] HDate_Temp = JsonConvert.DeserializeObject<string[]>(JsonConvert.SerializeObject(response.Body.Result[i].FormData["multiSelectField_lfg9hgyv"])); + + oItem.HRepairCategory = HDate_Temp[0]; + } + + //绱ф�ョ▼搴� + if (keys.Contains("radioField_kzgkw10c")) + { + string HDate_Temp = response.Body.Result[i].FormData["radioField_kzgkw10c"].ToString(); + + oItem.HUrgenLevel = HDate_Temp; + } + + //鎶ヤ慨浜� + if (keys.Contains("employeeField_lkasesrk")) + { + string[] HDate_Temp = JsonConvert.DeserializeObject<string[]>(JsonConvert.SerializeObject(response.Body.Result[i].FormData["employeeField_lkasesrk"])); + + oItem.HRepairer = HDate_Temp[0]; + } + + //鏄惁鏈変骇鑳藉奖鍝� + if (keys.Contains("textField_lyjddw0r")) + { + string HDate_Temp = response.Body.Result[i].FormData["textField_lyjddw0r"].ToString(); + + oItem.HIsCapacityImpact = HDate_Temp; + } + + //缁翠慨鏃堕棿 + if (keys.Contains("textField_l2r95oo2")) + { + string HDate_Temp = response.Body.Result[i].FormData["textField_l2r95oo2"].ToString(); + bool containsNumber = HDate_Temp.Any(c => char.IsDigit(c)); + + if (!containsNumber) + { + HDate_Temp = "0"; + } + //LogService.Write("1:------"+HDate_Temp+ ",2:------" + int.Parse(new string(HDate_Temp.Where(char.IsDigit).ToArray()))); + //a = HDate_Temp; + oItem.HTimes = int.Parse(new string(HDate_Temp.Where(char.IsDigit).ToArray())); + oItem.HPlanTimes = int.Parse(new string(HDate_Temp.Where(char.IsDigit).ToArray())); + } //瀛愯〃 缁翠慨瑕佹眰 缁翠慨澶囨敞(闂鎻忚堪) @@ -2502,7 +2684,7 @@ if (keys.Contains("textareaField_lthwo99r")) { string HDate_Temp = response.Body.Result[i].FormData["textareaField_lthwo99r"].ToString(); - + oItem.HExplanation = HDate_Temp; sub.HRepairExplanation = HDate_Temp; } @@ -2548,6 +2730,8 @@ } catch (Exception e) { + LogService.Write(e.Message); + a = ""; continue; } } @@ -2583,7 +2767,7 @@ int pageNumber = 1; int pageSize = 100; - //鑾峰彇妯″叿缁翠慨淇濆吇琛ㄧ殑瀹炰緥ID鍒楄〃 + //鑾峰彇璁惧缁翠慨淇濆吇琛ㄧ殑瀹炰緥ID鍒楄〃 List<string> IDList = new List<string>(); if (getInstanceIDList_YiDa(appType, systemToken, userID, formUuid, pageNumber, pageSize, ref IDList, ref msg) == false) { @@ -2600,6 +2784,14 @@ try { oCN.BeginTran(); + + DataSet dataSet = oCN.RunProcReturn(@"select HItemID from Gy_Repair a with(nolock) where a.HRemark like'%閽夐拤鍚屾%' and HName like'%璁惧缁翠慨%'", "Gy_Repair"); + string HRepairID = "0"; + if (dataSet.Tables[0].Rows.Count > 0) + { + HRepairID = dataSet.Tables[0].Rows[0]["HItemID"].ToString(); + } + foreach (EquipRepairWeiXiu oItem in lsmain) { //缁翠慨璁板綍 @@ -2622,12 +2814,14 @@ ",HEquipID,HRepairID,HPlanTimes,HEmpID,HManagerID,HTimes" + ",HDeptID,HExplanation,HInnerBillNo,HRepairBeginDate,HRepairEndDate" + ",HRepairContent,HCycleUnit,HMainSourceBillType,HMainSourceInterID,HMainSourceEntryID" + - ")values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',getdate()" + + ",HRepairCategory,HUrgenLevel,HRepairer,HIsCapacityImpact)" + + "values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',getdate()" + ",'" + DateTime.Now.Year + "','" + DateTime.Now.Month + "','"+ oItem.HRemark2 + "','" + oItem.HOriginator + "','" + oItem.HMakeDate + "'" + - ",'" + oItem.HEquipID + "','0','" + oItem.HTimes + "','" + oItem.HEmpID + "','" + oItem.HEmpID + "','" + oItem.HTimes + "'" + - ",'" + oItem.HDeptID + "','" + oItem.HExplanation + "','" + oItem.HInstanceID + "','',''" + - ",'" + oItem.HRepairContent + "','灏忔椂','','0',0)"; - + ",'" + oItem.HEquipID + "','"+ HRepairID + "','" + oItem.HTimes + "','" + oItem.HEmpID + "','" + oItem.HEmpID + "','" + oItem.HTimes + "'" + + ",'" + oItem.HDeptID + "','"+ oItem.HExplanation + "','" + oItem.HInstanceID + "','"+ oItem.HMakeDate + "','" + oItem.HUpdateDate + "'" + + ",'" + oItem.HRepairContent + "','灏忔椂','鎵嬪伐褰曞叆','0',0" + + ",'"+ oItem.HRepairCategory + "','" + oItem.HUrgenLevel + "','" + oItem.HRepairer + "','" + oItem.HIsCapacityImpact + "')"; + LogService.Write(sql_main); oCN.RunProc(sql_main); int i = 1; foreach (Sc_MouldRepairWorkBillSub oItem_Detail in oItem.DetailColMouldRepair) @@ -2638,7 +2832,8 @@ ",HRepairID,HManagerID,HRepairExplanation,HEmpID)" + "values('" + HInterID + "'," + i + ",'','','','" + oItem_Detail.HRemark + "'" + ",0,0,'','',0,0" + - ",0,'" + oItem.HEmpID + "','" + oItem_Detail.HRepairExplanation + "','" + oItem.HEmpID + "')"; + "," + HRepairID + ",'" + oItem.HEmpID + "','" + oItem_Detail.HRepairExplanation + "','" + oItem.HEmpID + "')"; + LogService.Write(sql_sub); oCN.RunProc(sql_sub); i += 1; } @@ -2653,6 +2848,7 @@ } catch (Exception e) { + LogService.Write(e.Message); msg = e.Message; oCN.RollBack(); return false; -- Gitblit v1.9.1