| | |
| | | using DingTalk.Api; |
| | | using DingTalk.Api.Response; |
| | | using System.Globalization; |
| | | using System.Linq; |
| | | |
| | | namespace WebAPI.Controllers |
| | | { |
| | |
| | | public string HOriginator; //å起人 |
| | | public string HTitle; //åæ®æ é¢ |
| | | |
| | | public string HInstanceStatus; //å®ä¾ç¶æ |
| | | public string HApprovedResult; //审æ¹ç»æ |
| | | |
| | | //åæ®å
容 |
| | | public string HDate; //æ¥æ |
| | |
| | | public string HOriginator; //å起人 |
| | | public string HTitle; //åæ®æ é¢ |
| | | |
| | | public string HInstanceStatus; //å®ä¾ç¶æ |
| | | public string HApprovedResult; //审æ¹ç»æ |
| | | |
| | | //åæ®å
容 |
| | | public string HDate; //æ¥æ |
| | |
| | | public string HOriginator; //å起人 |
| | | public string HTitle; //åæ®æ é¢ |
| | | |
| | | public string HInstanceStatus; //å®ä¾ç¶æ |
| | | public string HApprovedResult; //审æ¹ç»æ |
| | | |
| | | //åæ®å
容 |
| | | public string HEmployeeID; //æåID |
| | |
| | | public string HOriginator; //å起人 |
| | | public string HTitle; //åæ®æ é¢ |
| | | |
| | | public string HInstanceStatus; //å®ä¾ç¶æ |
| | | public string HApprovedResult; //审æ¹ç»æ |
| | | |
| | | //åæ®å
容 |
| | | public string HQuestionType; //é®é¢åç±» |
| | |
| | | public string HWorkAge; |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region 模å
·ä¿å
»ç»´ä¿®è¡¨ |
| | | public class MouldFileWeiXiuBaoYang |
| | | { |
| | | //ClsSb_MouldRepairWorkBillSub |
| | | //åæ®ä¿¡æ¯ |
| | | public string HMakerID; //å建人ID |
| | | public string HMaker; //å建人åç§° |
| | | public string HMakeDate; //åå»ºæ¥æ |
| | | public string HUpdaterID; //ä¿®æ¹äººID |
| | | public string HUpdater; //ä¿®æ¹äººåç§° |
| | | public string HUpdateDate; //ä¿®æ¹æ¥æ |
| | | public string HInstanceID; //åæ®å®ä¾ID |
| | | public string HOriginator; //å起人 |
| | | public string HTitle; //åæ®æ é¢ |
| | | public Int64 HEquipID;// --设å¤ID(Gy_EquipMent) |
| | | public Int64 HRepairID;// --维修项ç®(Gy_Repair) |
| | | public DateTime HRepairBeginDate;// --ç»´ä¿®å¼å§æ¥æ |
| | | public DateTime HRepairEndDate;// --ç»´ä¿®ç»ææ¥æ |
| | | public string HRepairContent;// --ç»´ä¿®å
容 |
| | | public string HCycleUnit;// varchar(10) --æ¶é´åä½(å°æ¶ï¼å¤©) |
| | | public double HPlanTimes;// money --计åç»´ä¿®å·¥æ¶ |
| | | public double HTimes;// money --å®é
ç»´ä¿®å·¥æ¶ |
| | | public Int64 HEmpID;// int --维修人(Gy_Employee) |
| | | public Int64 HManagerID;// int --è´è´£äºº(Gy_Employee) |
| | | public Int64 HDeptID;// int --ç»´ä¿®é¨é¨(Gy_Department) |
| | | 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; //åºå |
| | | public string HEmployeeID; //æåID |
| | | public string HEmplpyee; //æååç§° |
| | | |
| | | public List<Sc_MouldRepairWorkBillSub> DetailColMouldRepair = new List<Sc_MouldRepairWorkBillSub>(); |
| | | public List<Sc_MouldMaintainBillSub> DetailColMouldMaintain = new List<Sc_MouldMaintainBillSub>(); |
| | | } |
| | | |
| | | //ç»´ä¿®å表 |
| | | public class Sc_MouldRepairWorkBillSub |
| | | { |
| | | public string HRepairExplanation; |
| | | public string HRemark; |
| | | } |
| | | |
| | | //ä¿å
»å表 |
| | | public class Sc_MouldMaintainBillSub |
| | | { |
| | | public string HClaim; |
| | | public string HMaintainResult; |
| | | } |
| | | #endregion |
| | | |
| | | #region 设å¤ç»´ä¿®è®°å½è¡¨ |
| | | public class EquipRepairWeiXiu |
| | | { |
| | | //åæ®ä¿¡æ¯ |
| | | public string HMakerID; //å建人ID |
| | | public string HMaker; //å建人åç§° |
| | | public string HMakeDate; //åå»ºæ¥æ |
| | | public string HUpdaterID; //ä¿®æ¹äººID |
| | | public string HUpdater; //ä¿®æ¹äººåç§° |
| | | public string HUpdateDate; //ä¿®æ¹æ¥æ |
| | | public string HInstanceID; //åæ®å®ä¾ID |
| | | public string HOriginator; //å起人 |
| | | public string HTitle; //åæ®æ é¢ |
| | | public Int64 HEmpID;// int --维修人 |
| | | public Int64 HManagerID;// int --è´è´£äºº |
| | | public Int64 HSecManagerID;// int --éªæ¶ |
| | | public Int64 HDeptID;// int --ç»´ä¿®é¨é¨ |
| | | public string HExplanation;// varchar(200) --ç»´ä¿®è¦æ± |
| | | public string HInnerBillNo;// varchar(50) --å
é¨åæ®å· |
| | | public string HRemark; //å å·¥è¦æ± |
| | | |
| | | public Int64 HEquipID;// int --设å¤ID(Gy_EquipMent) |
| | | public Int64 HRepairID;//int --维修项ç®(Gy_Repair) |
| | | public DateTime HRepairBeginDate;// datetime --ç»´ä¿®å¼å§æ¥æ |
| | | public DateTime HRepairEndDate;//datetime --ç»´ä¿®ç»ææ¥æ |
| | | public string HRepairContent;//varchar(500) --ç»´ä¿®å
容 |
| | | public string HCycleUnit;//varchar(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; //æ¥æ |
| | | public string HCheckLevel; //å®¡æ ¸ç级 |
| | | public string HArea; //åºå |
| | | public string HEmployeeID; //æåID |
| | | public string HEmplpyee; //æååç§° |
| | | |
| | | public List<Sc_MouldRepairWorkBillSub> DetailColMouldRepair = new List<Sc_MouldRepairWorkBillSub>(); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | |
| | | //OriginatorId = "12", //æ ¹æ®æµç¨åèµ·äººå·¥å·æ¥è¯¢ã |
| | | |
| | | //TaskId = "12", //ä»»å¡IDã |
| | | CreateFromTimeGMT = 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"), //ä¿®æ¹æ¶é´ç»æ¢å¼ã |
| | | |
| | | PageSize = pageSize, //å页大å°ã |
| | | PageNumber = pageNumber, //å页页ç |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region è·å 宿 æ ¹æ®æµç¨å®ä¾IDè·åæµç¨å®ä¾ |
| | | public bool getInstanceStatusByInstanceID__YiDa(string appType, string systemToken, string userID, string instanceID, ref GetInstanceByIdResponse response, ref string msg) |
| | | { |
| | | AlibabaCloud.SDK.Dingtalkyida_1_0.Client client = CreateClient5(); |
| | | AlibabaCloud.SDK.Dingtalkyida_1_0.Models.GetInstanceByIdHeaders getInstanceByIdHeaders = new AlibabaCloud.SDK.Dingtalkyida_1_0.Models.GetInstanceByIdHeaders(); |
| | | getInstanceByIdHeaders.XAcsDingtalkAccessToken = this.accessToken; |
| | | AlibabaCloud.SDK.Dingtalkyida_1_0.Models.GetInstanceByIdRequest getInstanceByIdRequest = new AlibabaCloud.SDK.Dingtalkyida_1_0.Models.GetInstanceByIdRequest |
| | | { |
| | | SystemToken = systemToken, |
| | | Language = "12", |
| | | UserId = userID, |
| | | AppType = appType, |
| | | }; |
| | | try |
| | | { |
| | | GetInstanceByIdResponse getInstanceByIdResponse = client.GetInstanceByIdWithOptions(instanceID, getInstanceByIdRequest, getInstanceByIdHeaders, new AlibabaCloud.TeaUtil.Models.RuntimeOptions()); |
| | | response = getInstanceByIdResponse; |
| | | return true; |
| | | } |
| | | catch (TeaException err) |
| | | { |
| | | if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message)) |
| | | { |
| | | // err ä¸å«æ code å message 屿§ï¼å¯å¸®å©å¼åå®ä½é®é¢ |
| | | } |
| | | msg = err.Message; |
| | | return false; |
| | | } |
| | | catch (Exception _err) |
| | | { |
| | | TeaException err = new TeaException(new Dictionary<string, object> |
| | | { |
| | | { "message", _err.Message } |
| | | }); |
| | | if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message)) |
| | | { |
| | | // err ä¸å«æ code å message 屿§ï¼å¯å¸®å©å¼åå®ä½é®é¢ |
| | | } |
| | | msg = _err.Message; |
| | | return false; |
| | | } |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region æ°æ®åæ¥æ¹æ³ |
| | |
| | | int startindex = response.Body.Result[i].Title.IndexOf("zh_CN") + 8; |
| | | oItem.HTitle = startIndex + response.Body.Result[i].Title.Substring(startindex).Replace("\"}", "").Replace("'", ""); |
| | | |
| | | if (keys.Contains("dateField_lo6w37hk")) |
| | | //å®¡æ ¸ç¾å°è¡¨ |
| | | //if (keys.Contains("dateField_lo6w37hk")) |
| | | //{ |
| | | // double HDate_Temp = double.Parse(response.Body.Result[i].FormData["dateField_lo6w37hk"].ToString()); |
| | | // oItem.HDate = convertFromMillisecondsToDateString(HDate_Temp, "yyyy-MM-dd"); |
| | | //} |
| | | |
| | | //if (keys.Contains("selectField_lockncvh_id")) |
| | | //{ |
| | | // oItem.HArea = response.Body.Result[i].FormData["selectField_lockncvh_id"].ToString().Replace("'", ""); |
| | | //} |
| | | |
| | | //if (keys.Contains("selectField_lockncvg_id")) |
| | | //{ |
| | | // oItem.HCheckLevel = response.Body.Result[i].FormData["selectField_lockncvg_id"].ToString().Replace("'", ""); |
| | | //} |
| | | |
| | | //if (keys.Contains("employeeField_lo6w37hf")) |
| | | //{ |
| | | // oItem.HEmplpyee = ((List<object>)response.Body.Result[i].FormData["employeeField_lo6w37hf"])[0].ToString().Replace("'",""); |
| | | //} |
| | | |
| | | //if (keys.Contains("employeeField_lo6w37hf_id")) |
| | | //{ |
| | | // oItem.HEmployeeID = ((List<object>)response.Body.Result[i].FormData["employeeField_lo6w37hf_id"])[0].ToString().Replace("'", ""); |
| | | //} |
| | | |
| | | |
| | | //ç¾å°è¡¨ |
| | | if (keys.Contains("dateField_ls9ma7h3")) |
| | | { |
| | | double HDate_Temp = double.Parse(response.Body.Result[i].FormData["dateField_lo6w37hk"].ToString()); |
| | | double HDate_Temp = double.Parse(response.Body.Result[i].FormData["dateField_ls9ma7h3"].ToString()); |
| | | oItem.HDate = convertFromMillisecondsToDateString(HDate_Temp, "yyyy-MM-dd"); |
| | | } |
| | | |
| | | if (keys.Contains("selectField_lockncvh_id")) |
| | | if (keys.Contains("selectField_ls9ma7h9")) |
| | | { |
| | | oItem.HArea = response.Body.Result[i].FormData["selectField_lockncvh_id"].ToString().Replace("'", ""); |
| | | oItem.HArea = response.Body.Result[i].FormData["selectField_ls9ma7h9"].ToString().Replace("'", ""); |
| | | } |
| | | |
| | | if (keys.Contains("selectField_lockncvg_id")) |
| | | if (keys.Contains("selectField_ls9ma7h7")) |
| | | { |
| | | oItem.HCheckLevel = response.Body.Result[i].FormData["selectField_lockncvg_id"].ToString().Replace("'", ""); |
| | | oItem.HCheckLevel = response.Body.Result[i].FormData["selectField_ls9ma7h7"].ToString().Replace("'", ""); |
| | | } |
| | | |
| | | if (keys.Contains("employeeField_lo6w37hf")) |
| | | if (keys.Contains("employeeField_ls9ma7h5")) |
| | | { |
| | | oItem.HEmplpyee = ((List<object>)response.Body.Result[i].FormData["employeeField_lo6w37hf"])[0].ToString().Replace("'",""); |
| | | oItem.HEmplpyee = ((List<object>)response.Body.Result[i].FormData["employeeField_ls9ma7h5"])[0].ToString().Replace("'", ""); |
| | | } |
| | | |
| | | if (keys.Contains("employeeField_lo6w37hf_id")) |
| | | if (keys.Contains("employeeField_ls9ma7h5_id")) |
| | | { |
| | | oItem.HEmployeeID = ((List<object>)response.Body.Result[i].FormData["employeeField_lo6w37hf_id"])[0].ToString().Replace("'", ""); |
| | | oItem.HEmployeeID = ((List<object>)response.Body.Result[i].FormData["employeeField_ls9ma7h5_id"])[0].ToString().Replace("'", ""); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //è·åå®ä¾ç¶æ |
| | | GetInstanceByIdResponse response1 = new GetInstanceByIdResponse(); |
| | | if (getInstanceStatusByInstanceID__YiDa(appType, systemToken, userID, oItem.HInstanceID, ref response1, ref msg) == false) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | oItem.HInstanceStatus = response1.Body.InstanceStatus; |
| | | if (oItem.HInstanceStatus == "RUNNING") |
| | | { |
| | | oItem.HInstanceStatus = "è¿è¡ä¸"; |
| | | } |
| | | else if (oItem.HInstanceStatus == "TERMINATED") |
| | | { |
| | | oItem.HInstanceStatus = "å·²ç»æ¢"; |
| | | } |
| | | else if (oItem.HInstanceStatus == "COMPLETED") |
| | | { |
| | | oItem.HInstanceStatus = "已宿"; |
| | | } |
| | | else if (oItem.HInstanceStatus == "ERROR") |
| | | { |
| | | oItem.HInstanceStatus = "å¼å¸¸"; |
| | | } |
| | | |
| | | oItem.HApprovedResult = response1.Body.ApprovedResult; |
| | | if (oItem.HApprovedResult == "agree") |
| | | { |
| | | oItem.HApprovedResult = "åæ"; |
| | | } |
| | | else if (oItem.HApprovedResult == "disagree") |
| | | { |
| | | oItem.HApprovedResult = "æç»"; |
| | | } |
| | | else |
| | | { |
| | | oItem.HApprovedResult = ""; |
| | | } |
| | | |
| | | |
| | | |
| | | lsmain.Add(oItem); |
| | | }catch(Exception e) |
| | | { |
| | |
| | | string appType = "APP_MMBPP3IFGFBX3VQAIKYX"; |
| | | string systemToken = "TP866A81107FVI9LBFQRZ9953YWZ2GYR2W6OL1L"; |
| | | string userID = "1933673646699149"; |
| | | string formUuid = "FORM-IQ8666B17ZZE7NQSA01K3DUN78UI3J1Z2W6OLX"; |
| | | //string formUuid = "FORM-IQ8666B17ZZE7NQSA01K3DUN78UI3J1Z2W6OLX"; //åå±å®¡æ ¸ç¾å°è¡¨ |
| | | string formUuid = "FORM-A01FFB0B63A34F18B7753F695F49190DJEY7"; //ç¾å°è¡¨ |
| | | int pageNumber = 1; |
| | | int pageSize = 100; |
| | | |
| | |
| | | |
| | | try |
| | | { |
| | | oCN.BeginTran(); |
| | | oCN.BeginTran(); |
| | | foreach (YD_FenCengShenHeQianDaoBiao oItem in lsmain) |
| | | { |
| | | string sql_searchRepeat = "select * from DD_FenCengShenHeQianDaoBiao where HInstanceID = '" + oItem.HInstanceID + "'"; |
| | |
| | | string sql_main = "insert into DD_FenCengShenHeQianDaoBiao" + |
| | | "(HMakerID,HMakeDate,HUpdaterID,HUpdater,HUpdateDate,HInstanceID,HOriginator,HTitle" + |
| | | ",HDate" + |
| | | ",HCheckLevel,HArea,HEmployeeID,HEmplpyee) " + |
| | | ",HCheckLevel,HArea,HEmployeeID,HEmplpyee" + |
| | | ",HInstanceStatus,HApprovedResult) " + |
| | | "values(" + |
| | | "'" + oItem.HMakerID + "'" + |
| | | ",'" + oItem.HMakeDate + "'" + |
| | |
| | | ",'" + (oItem.HArea==null?"": oItem.HArea) + "'" + |
| | | ",'" + (oItem.HEmployeeID==null?"": oItem.HEmployeeID) + "'" + |
| | | ",'" + (oItem.HEmplpyee==null?"": oItem.HEmplpyee) + "'" + |
| | | ",'" + (oItem.HInstanceStatus == null ? "" : oItem.HInstanceStatus) + "'" + |
| | | ",'" + (oItem.HApprovedResult == null ? "" : oItem.HApprovedResult) + "'" + |
| | | ")"; |
| | | |
| | | oCN.RunProc(sql_main); |
| | |
| | | { |
| | | oItem.HRiskRemak_Result = response.Body.Result[i].FormData["textareaField_lxblb9xa"].ToString().Replace("'", ""); |
| | | } |
| | | |
| | | |
| | | |
| | | //è·åå®ä¾ç¶æ |
| | | GetInstanceByIdResponse response1 = new GetInstanceByIdResponse(); |
| | | if (getInstanceStatusByInstanceID__YiDa(appType, systemToken, userID, oItem.HInstanceID, ref response1, ref msg) == false) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | oItem.HInstanceStatus = response1.Body.InstanceStatus; |
| | | if (oItem.HInstanceStatus == "RUNNING") |
| | | { |
| | | oItem.HInstanceStatus = "è¿è¡ä¸"; |
| | | } |
| | | else if (oItem.HInstanceStatus == "TERMINATED") |
| | | { |
| | | oItem.HInstanceStatus = "å·²ç»æ¢"; |
| | | } |
| | | else if (oItem.HInstanceStatus == "COMPLETED") |
| | | { |
| | | oItem.HInstanceStatus = "已宿"; |
| | | } |
| | | else if (oItem.HInstanceStatus == "ERROR") |
| | | { |
| | | oItem.HInstanceStatus = "å¼å¸¸"; |
| | | } |
| | | |
| | | oItem.HApprovedResult = response1.Body.ApprovedResult; |
| | | if (oItem.HApprovedResult == "agree") |
| | | { |
| | | oItem.HApprovedResult = "åæ"; |
| | | } |
| | | else if (oItem.HApprovedResult == "disagree") |
| | | { |
| | | oItem.HApprovedResult = "æç»"; |
| | | } |
| | | else |
| | | { |
| | | oItem.HApprovedResult = ""; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | lsmain.Add(oItem); |
| | | }catch(Exception e) |
| | | { |
| | |
| | | string sql_main = "insert into DD_XianChangBianHuaDianPingShenDan" + |
| | | "(HMakerID,HMakeDate,HUpdaterID,HUpdater,HUpdateDate,HInstanceID,HOriginator,HTitle" + |
| | | ",HDate" + |
| | | ",HDept,HChangeType,HRiskLevel,HChangeContent,HRiskRemark_Safe,HRiskRemark_Study,HRiskRemark_Quality,HRiskRemark_Equipment,HRiskRemark_Product,HRiskRemark_Result) " + |
| | | ",HDept,HChangeType,HRiskLevel,HChangeContent,HRiskRemark_Safe,HRiskRemark_Study,HRiskRemark_Quality,HRiskRemark_Equipment,HRiskRemark_Product,HRiskRemark_Result" + |
| | | ",HInstanceStatus,HApprovedResult) " + |
| | | "values(" + |
| | | "'" + oItem.HMakerID + "'" + |
| | | ",'" + oItem.HMakeDate + "'" + |
| | |
| | | ",'" + (oItem.HRiskRemark_Equipment==null?"": oItem.HRiskRemark_Equipment) + "'" + |
| | | ",'" + (oItem.HRiskRemark_Product==null?"": oItem.HRiskRemark_Product) + "'" + |
| | | ",'" + (oItem.HRiskRemak_Result==null?"": oItem.HRiskRemak_Result) + "'" + |
| | | ",'" + (oItem.HInstanceStatus == null ? "" : oItem.HInstanceStatus) + "'" + |
| | | ",'" + (oItem.HApprovedResult == null ? "" : oItem.HApprovedResult) + "'" + |
| | | ")"; |
| | | |
| | | oCN.RunProc(sql_main); |
| | |
| | | oItem.HCloseConfirm = response.Body.Result[i].FormData["selectField_ltpe6mdd"].ToString().Replace("'", ""); |
| | | } |
| | | |
| | | //è·åå®ä¾ç¶æ |
| | | GetInstanceByIdResponse response1 = new GetInstanceByIdResponse(); |
| | | if(getInstanceStatusByInstanceID__YiDa(appType, systemToken, userID, oItem.HInstanceID, ref response1, ref msg) == false) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | oItem.HInstanceStatus = response1.Body.InstanceStatus; |
| | | if(oItem.HInstanceStatus == "RUNNING") |
| | | { |
| | | oItem.HInstanceStatus = "è¿è¡ä¸"; |
| | | }else if(oItem.HInstanceStatus== "TERMINATED") |
| | | { |
| | | oItem.HInstanceStatus = "å·²ç»æ¢"; |
| | | } |
| | | else if (oItem.HInstanceStatus == "COMPLETED") |
| | | { |
| | | oItem.HInstanceStatus = "已宿"; |
| | | } |
| | | else if (oItem.HInstanceStatus == "ERROR") |
| | | { |
| | | oItem.HInstanceStatus = "å¼å¸¸"; |
| | | } |
| | | |
| | | oItem.HApprovedResult = response1.Body.ApprovedResult; |
| | | if (oItem.HApprovedResult== "agree") |
| | | { |
| | | oItem.HApprovedResult = "åæ"; |
| | | }else if(oItem.HApprovedResult== "disagree") |
| | | { |
| | | oItem.HApprovedResult = "æç»"; |
| | | } |
| | | else |
| | | { |
| | | oItem.HApprovedResult = ""; |
| | | } |
| | | |
| | | lsmain.Add(oItem); |
| | | } |
| | | catch (Exception e) |
| | |
| | | ",HCheckLevel,HCheckArea,HPhoto_NoSatisfyRequire,HDescription_NoSatisfyRequire,HQuestionType,HRequire_ModifyDate,HEmployeeID_Duty,HEmployee_Duty" + |
| | | ",HQuestionIsNoModify" + |
| | | ",HReason_NoModify,HReasonAnalysis,HMethod_Modify" + |
| | | ",HDate_Achieve,HFile_Evidence,HCloseConfirm" + |
| | | ",HDate_Achieve,HFile_Evidence,HCloseConfirm,HInstanceStatus,HApprovedResult" + |
| | | ") " + |
| | | "values(" + |
| | | "'" + oItem.HMakerID + "'" + |
| | |
| | | "," + (oItem.HDate_Achieve==null?"null":"'"+ oItem.HDate_Achieve+ "'") + "" + |
| | | ",'" + (oItem.HFile_Evidence==null?"": oItem.HFile_Evidence) + "'" + |
| | | ",'" + (oItem.HCloseConfirm==null?"": oItem.HCloseConfirm) + "'" + |
| | | |
| | | ",'" + (oItem.HInstanceStatus==null?"":oItem.HInstanceStatus) + "'" + |
| | | ",'" + (oItem.HApprovedResult==null?"":oItem.HApprovedResult) + "'" + |
| | | ")"; |
| | | |
| | | oCN.RunProc(sql_main); |
| | |
| | | oItem.HDept_Duty = response.Body.Result[i].FormData["selectField_lxcunmsu"].ToString().Replace("'", ""); |
| | | } |
| | | |
| | | |
| | | //è·åå®ä¾ç¶æ |
| | | GetInstanceByIdResponse response1 = new GetInstanceByIdResponse(); |
| | | if (getInstanceStatusByInstanceID__YiDa(appType, systemToken, userID, oItem.HInstanceID, ref response1, ref msg) == false) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | oItem.HInstanceStatus = response1.Body.InstanceStatus; |
| | | if (oItem.HInstanceStatus == "RUNNING") |
| | | { |
| | | oItem.HInstanceStatus = "è¿è¡ä¸"; |
| | | } |
| | | else if (oItem.HInstanceStatus == "TERMINATED") |
| | | { |
| | | oItem.HInstanceStatus = "å·²ç»æ¢"; |
| | | } |
| | | else if (oItem.HInstanceStatus == "COMPLETED") |
| | | { |
| | | oItem.HInstanceStatus = "已宿"; |
| | | } |
| | | else if (oItem.HInstanceStatus == "ERROR") |
| | | { |
| | | oItem.HInstanceStatus = "å¼å¸¸"; |
| | | } |
| | | |
| | | oItem.HApprovedResult = response1.Body.ApprovedResult; |
| | | if (oItem.HApprovedResult == "agree") |
| | | { |
| | | oItem.HApprovedResult = "åæ"; |
| | | } |
| | | else if (oItem.HApprovedResult == "disagree") |
| | | { |
| | | oItem.HApprovedResult = "æç»"; |
| | | } |
| | | else |
| | | { |
| | | oItem.HApprovedResult = ""; |
| | | } |
| | | |
| | | |
| | | |
| | | List<YD_QRQCWenTiTiJiaoBiaoSub1> sub1List = new List<YD_QRQCWenTiTiJiaoBiaoSub1>(); |
| | | if (keys_main.Contains("tableField_lx4azand")) |
| | |
| | | oCN.BeginTran(); |
| | | foreach (YD_QRQCWenTiTiJiaoBiao oItem in lsmain) |
| | | { |
| | | ////夿忮 å®ä¾ç¶ææ¯å¦ä¸º"已宿"ä¸ å®¡æ¹ç»æä¸º"åæ",è¥æ¯ååæ¥æ°æ®ï¼å¦åä¸è¿è¡åæ¥æ°æ® |
| | | //if (!(oItem.HInstanceStatus == "已宿" && oItem.HApprovedResult == "åæ")) |
| | | //{ |
| | | // continue; |
| | | //} |
| | | |
| | | string sql_searchRepeat = "select * from DD_QRQCWenTiTiJiaoBiao where HInstanceID = '" + oItem.HInstanceID + "'"; |
| | | DataSet ds_searchRepeat = oCN.RunProcReturn(sql_searchRepeat, "DD_QRQCWenTiTiJiaoBiao"); |
| | | if (ds_searchRepeat != null && ds_searchRepeat.Tables[0].Rows.Count > 0) |
| | |
| | | } |
| | | |
| | | string sql_main = "insert into DD_QRQCWenTiTiJiaoBiao" + |
| | | "(HMakerID,HMakeDate,HUpdaterID,HUpdater,HUpdateDate,HInstanceID,HOriginator,HTitle,HQuestionType,HDept_Duty) " + |
| | | "(HMakerID,HMakeDate,HUpdaterID,HUpdater,HUpdateDate,HInstanceID,HOriginator,HTitle,HQuestionType,HDept_Duty" + |
| | | ",HInstanceStatus,HApprovedResult) " + |
| | | "values(" + |
| | | "'" + oItem.HMakerID + "'" + |
| | | ",'" + oItem.HMakeDate + "'" + |
| | |
| | | |
| | | ",'" + (oItem.HQuestionType==null?"": oItem.HQuestionType) + "'" + |
| | | ",'" + (oItem.HDept_Duty==null?"": oItem.HDept_Duty) + "'" + |
| | | ",'" + (oItem.HInstanceStatus == null ? "" : oItem.HInstanceStatus) + "'" + |
| | | ",'" + (oItem.HApprovedResult == null ? "" : oItem.HApprovedResult) + "'" + |
| | | ")"; |
| | | oCN.RunProc(sql_main); |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | string[] studyLevelList = new string[] {"","é«ä¸","ä¸ä¸","大ä¸","æ¬ç§","","","å
¶ä»","åä¸","å°å¦" }; |
| | | |
| | | |
| | | for (int i = 0; i < response.Result.Count; i++) |
| | | { |
| | | List<string> fieldNameList = new List<string>(); |
| | |
| | | { |
| | | int index = fieldNameList.IndexOf("å¦å"); |
| | | oItem.HStudyLevel = response.Result[i].FieldDataList[index].FieldValueList[0].Value; |
| | | if (oItem.HStudyLevel != null && oItem.HStudyLevel != "") |
| | | { |
| | | long studyLevelIndex = DBUtility.ClsPub.isLong(oItem.HStudyLevel); |
| | | if (studyLevelIndex >= studyLevelList.Length) |
| | | { |
| | | studyLevelIndex = 0; |
| | | } |
| | | oItem.HStudyLevel = studyLevelList[studyLevelIndex]; |
| | | } |
| | | } |
| | | |
| | | if (fieldNameList.IndexOf("é¨é¨") >= 0) |
| | |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region æ°æ®åæ¥-模å
·ç»´ä¿®ä¿å
Ȍ |
| | | #region è·å 宿-模å
·ç»´ä¿®ä¿å
»å å®ä¾IDå表对åºçå®ä¾è¯¦æ
|
| | | public bool getInstanceDetailList___MouldFileWeiXiuBaoYang_YiDa(string appType, string systemToken, string userID, string formUuid, List<string> IDList, ref List<MouldFileWeiXiuBaoYang> lsmain, ref string msg, int size = 500) |
| | | { |
| | | |
| | | try |
| | | { |
| | | int startIndex = 0; |
| | | int endIndex = startIndex + size; |
| | | if (endIndex > IDList.Count) |
| | | { |
| | | endIndex = IDList.Count; |
| | | } |
| | | |
| | | while (startIndex < endIndex && endIndex <= IDList.Count) |
| | | { |
| | | List<string> IDList_temp = new List<string>(); |
| | | for (int i = startIndex; i < endIndex; i++) |
| | | { |
| | | IDList_temp.Add(IDList[i]); |
| | | } |
| | | |
| | | BatchGetFormDataByIdListResponse response = new BatchGetFormDataByIdListResponse(); |
| | | if (getInstanceDetailListByInstanceIDList_YiDa(appType, systemToken, formUuid, userID, IDList_temp, ref response, ref msg) == false) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | for (int i = 0; i < response.Body.Result.Count; i++) |
| | | { |
| | | try |
| | | { |
| | | |
| | | |
| | | List<string> keys = new List<string>(response.Body.Result[i].FormData.Keys); |
| | | |
| | | MouldFileWeiXiuBaoYang oItem = new MouldFileWeiXiuBaoYang(); |
| | | oItem.HMakerID = response.Body.Result[i].CreatorUserId.Replace("'", ""); |
| | | oItem.HMaker = response.Body.Result[i].CreatorUserId.Replace("'", ""); |
| | | oItem.HMakeDate = response.Body.Result[i].CreateTimeGMT.Replace("T", " ").Replace("Z", "").Replace("'", ""); |
| | | oItem.HUpdaterID = response.Body.Result[i].ModifyUser.UserId.Replace("'", ""); |
| | | oItem.HUpdater = response.Body.Result[i].ModifyUser.Name.NameInChinese.Replace("'", ""); |
| | | oItem.HUpdateDate = response.Body.Result[i].ModifiedTimeGMT.Replace("T", " ").Replace("Z", "").Replace("'", ""); |
| | | oItem.HInstanceID = response.Body.Result[i].FormInstanceId.Replace("'", ""); |
| | | oItem.HOriginator = response.Body.Result[i].Originator.Name.NameInChinese.Replace("'", ""); |
| | | |
| | | GetInstanceByIdResponse getInstanceByIdResponse = new GetInstanceByIdResponse(); ; |
| | | if (!getInstanceStatusByInstanceID__YiDa(appType, systemToken, userID, oItem.HInstanceID, ref getInstanceByIdResponse, ref msg)) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | if (getInstanceByIdResponse.Body.InstanceStatus != "COMPLETED") |
| | | { |
| | | //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 ä¿å
»çº§å«ä»£ç ='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 ä¿å
»çº§å«ä»£ç ='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; |
| | | } |
| | | |
| | | //修模å¼å§æ¶é´ |
| | | if (keys.Contains("dateField_lq4gf2ih")) |
| | | { |
| | | double HDate_Temp = double.Parse(response.Body.Result[i].FormData["dateField_lq4gf2ih"].ToString()); |
| | | oItem.HRepairBeginDate = DateTime.Parse(convertFromMillisecondsToDateString(HDate_Temp, "yyyy-MM-dd HH:mm")); |
| | | } |
| | | |
| | | //ä¿®æ¨¡ç»ææ¶é´ |
| | | if (keys.Contains("dateField_lq4gf2ii")) |
| | | { |
| | | double HDate_Temp = double.Parse(response.Body.Result[i].FormData["dateField_lq4gf2ii"].ToString()); |
| | | 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.HBillNo = HDate_Temp; |
| | | } |
| | | |
| | | //è¦æ±å®ææ¥æ |
| | | if (keys.Contains("dateField_lq3idkvd")) |
| | | { |
| | | 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) |
| | | { |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | |
| | | //ç»´ä¿®é¨é¨ |
| | | if (keys.Contains("selectField_lq3idkva")) |
| | | { |
| | | string HDate_Temp = response.Body.Result[i].FormData["selectField_lq3idkva"].ToString(); |
| | | DataSet ds = oCN.RunProcReturn("select * from Gy_Department with(nolock) where HName='" + HDate_Temp + "'", "Gy_Department"); |
| | | string HDeptID = "0"; |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | HDeptID = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | oItem.HDeptID = long.Parse(HDeptID); |
| | | } |
| | | |
| | | //æ°è®¾è®¡å¯¿å½ |
| | | oItem.HNewDesignLife = 30000; |
| | | |
| | | //维修人 |
| | | 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 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); |
| | | } |
| | | |
| | | //ç»´ä¿®æ¶é´ |
| | | if (keys.Contains("numberField_lq3ixr9j")) |
| | | { |
| | | string HDate_Temp = response.Body.Result[i].FormData["numberField_lq3ixr9j"].ToString(); |
| | | |
| | | oItem.HTimes = long.Parse(HDate_Temp); |
| | | oItem.HPlanTimes = long.Parse(HDate_Temp); |
| | | } |
| | | |
| | | //å表 ç»´ä¿®è¦æ± ç»´ä¿®å¤æ³¨(é®é¢æè¿°) |
| | | if (keys.Contains("tableField_lq3ixr9b")) |
| | | { |
| | | List<Dictionary<string, object>> dic = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(JsonConvert.SerializeObject(response.Body.Result[i].FormData["tableField_lq3ixr9b"])); |
| | | for (int ij = 0; ij < dic.Count; ij++) |
| | | { |
| | | Sc_MouldRepairWorkBillSub oItemSub = new Sc_MouldRepairWorkBillSub(); |
| | | |
| | | List<string> keys_Sub = new List<string>(dic[ij].Keys); |
| | | |
| | | //ç»´ä¿®è¦æ± |
| | | if (keys_Sub.Contains("textareaField_lq3ixr9e")) |
| | | { |
| | | oItemSub.HRepairExplanation = dic[ij]["textareaField_lq3ixr9e"].ToString(); |
| | | } |
| | | |
| | | //夿³¨ |
| | | if (keys_Sub.Contains("textField_lq3ixr9d")) |
| | | { |
| | | oItemSub.HRemark = dic[ij]["textField_lq3ixr9d"].ToString(); |
| | | } |
| | | oItem.DetailColMouldRepair.Add(oItemSub); |
| | | } |
| | | } |
| | | |
| | | string HRemark = ""; |
| | | //å表 ä¿å
»å¤æ³¨(é®é¢æè¿°) |
| | | if (keys.Contains("textareaField_ltpf2wiw")) |
| | | { |
| | | HRemark = response.Body.Result[i].FormData["textareaField_ltpf2wiw"].ToString(); |
| | | |
| | | } |
| | | |
| | | //å表 å
·ä½è¦æ± ä¿å
»é¡¹ç® |
| | | if (keys.Contains("checkboxField_ltpf2wif")) |
| | | { |
| | | string[] HDate_Temp = JsonConvert.DeserializeObject<string[]>(JsonConvert.SerializeObject(response.Body.Result[i].FormData["checkboxField_ltpf2wif"])); |
| | | |
| | | for (int ij = 0; ij < HDate_Temp.Length; ij++) |
| | | { |
| | | Sc_MouldMaintainBillSub oItemSub = new Sc_MouldMaintainBillSub(); |
| | | |
| | | oItemSub.HClaim = HDate_Temp[ij]; |
| | | oItemSub.HMaintainResult = HRemark; |
| | | oItem.DetailColMouldMaintain.Add(oItemSub); |
| | | } |
| | | |
| | | } |
| | | |
| | | int startindex = response.Body.Result[i].Title.IndexOf("zh_CN") + 8; |
| | | oItem.HTitle = startIndex + response.Body.Result[i].Title.Substring(startindex).Replace("\"}", "").Replace("'", ""); |
| | | |
| | | if (keys.Contains("dateField_lo6w37hk")) |
| | | { |
| | | double HDate_Temp = double.Parse(response.Body.Result[i].FormData["dateField_lo6w37hk"].ToString()); |
| | | oItem.HDate = convertFromMillisecondsToDateString(HDate_Temp, "yyyy-MM-dd"); |
| | | } |
| | | |
| | | if (keys.Contains("selectField_lockncvh_id")) |
| | | { |
| | | oItem.HArea = response.Body.Result[i].FormData["selectField_lockncvh_id"].ToString().Replace("'", ""); |
| | | } |
| | | |
| | | if (keys.Contains("selectField_lockncvg_id")) |
| | | { |
| | | oItem.HCheckLevel = response.Body.Result[i].FormData["selectField_lockncvg_id"].ToString().Replace("'", ""); |
| | | } |
| | | |
| | | if (keys.Contains("employeeField_lo6w37hf")) |
| | | { |
| | | oItem.HEmplpyee = ((List<object>)response.Body.Result[i].FormData["employeeField_lo6w37hf"])[0].ToString().Replace("'", ""); |
| | | } |
| | | |
| | | if (keys.Contains("employeeField_lo6w37hf_id")) |
| | | { |
| | | oItem.HEmployeeID = ((List<object>)response.Body.Result[i].FormData["employeeField_lo6w37hf_id"])[0].ToString().Replace("'", ""); |
| | | } |
| | | |
| | | lsmain.Add(oItem); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | startIndex = endIndex; |
| | | endIndex += size; |
| | | if (endIndex > IDList.Count) |
| | | { |
| | | endIndex = IDList.Count; |
| | | } |
| | | } |
| | | |
| | | |
| | | return true; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write(e.Message); |
| | | msg = e.Message; |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region æ°æ®åæ¥ |
| | | public bool getData_MouldFileWeiXiuBaoYang(ref string msg) |
| | | { |
| | | //è·å åå±å®¡æ ¸è¡¨ å®ä¾IDå表 |
| | | string appType = "APP_CSD7RLFJ3CTU330N3SCV"; |
| | | string systemToken = "9T566BD1NWMGH17C93CKA9M4AS0D233TNU0QL82"; |
| | | string userID = "011113050243860353"; |
| | | string formUuid = "FORM-30C78F46E77E46A9AA8778214CEFE6B5J0AN"; |
| | | int pageNumber = 1; |
| | | int pageSize = 100; |
| | | |
| | | //è·å模å
·ç»´ä¿®ä¿å
»è¡¨çå®ä¾IDå表 |
| | | List<string> IDList = new List<string>(); |
| | | if (getInstanceIDList_YiDa(appType, systemToken, userID, formUuid, pageNumber, pageSize, ref IDList, ref msg) == false) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | //è·å详ç»ä¿¡æ¯å¹¶éå å°å表lsmainä¸ |
| | | List<MouldFileWeiXiuBaoYang> lsmain = new List<MouldFileWeiXiuBaoYang>(); |
| | | if (getInstanceDetailList___MouldFileWeiXiuBaoYang_YiDa(appType, systemToken, userID, formUuid, IDList, ref lsmain, ref msg) == false) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | 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}'"; |
| | | DataSet ds = oCN.RunProcReturn(sql, "Sc_MouldMaintainBillMain"); |
| | | |
| | | 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); |
| | | //long HInterID = 0; |
| | | //string HBillNo = ""; |
| | | string sql_main = "Insert Into Sc_MouldMaintainBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate" + |
| | | ",HYear,HPeriod,HRemark,HUpDateDate" + |
| | | ",HPlanNo,HPlanInterID,HMouldID,HBeginDate" + |
| | | ",HEndDate" + |
| | | ",HInnerBillNo,HExplanation,HMouldMaintainRuleInterID,HMaintainLevID,HLastResult" + |
| | | ",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 + "','',"+ 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) |
| | | { |
| | | string sql_sub = "Insert into Sc_MouldMaintainBillSub_Item" + |
| | | " (HInterID,HEntryID,HMaintainItemID,HMaintainItem" + |
| | | ",HMaintainPart,HClaim" + |
| | | ",HManagerID" + |
| | | ",HCloseMan,HCloseType,HRemark" + |
| | | ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaintainResult" + |
| | | ") " + |
| | | "values('" + HInterID + "'," + i + ","+ HMaintainItemID + ",'" + oItem_Detail.HClaim + "'" + |
| | | ",'','" + oItem_Detail.HClaim + "'" + |
| | | ",'" + oItem.HEmpID + "'" + |
| | | ",'','','" + oItem_Detail.HMaintainResult + "'" + |
| | | ",'0','0','','',0,0,'Y')"; |
| | | LogService.Write(sql_sub); |
| | | oCN.RunProc(sql_sub); |
| | | i += 1; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | //ç»´ä¿®è®°å½ |
| | | if (oItem.DetailColMouldRepair.Count != 0) |
| | | { |
| | | string BillType = "3807"; |
| | | string sql = $@"select HInnerBillNo from Sc_MouldRepairWorkBillMain |
| | | where HInnerBillNo = '{oItem.HInstanceID}'"; |
| | | DataSet ds = oCN.RunProcReturn(sql, "Sc_MouldRepairWorkBillMain"); |
| | | |
| | | 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); |
| | | //long HInterID = 0; |
| | | //string HBillNo = ""; |
| | | string sql_main = "Insert Into Sc_MouldRepairWorkBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + |
| | | ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + |
| | | ",HEquipID,HRepairID,HRepairBeginDate,HRepairEndDate,HRepairContent" + |
| | | ",HCycleUnit,HPlanTimes,HTimes,HEmpID,HManagerID" + |
| | | ",HDeptID,HExplanation,HInnerBillNo,HMouldID" + |
| | | ",HSupID,HRepairType,HNewModel,HNewDesignLife,HMainSourceBillType,HMainSourceInterID,HMainSourceEntryID" + |
| | | ",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 + "','1',0,0" + |
| | | ",'"+ oItem.HRepairAccepDate + "')"; |
| | | LogService.Write(sql_main); |
| | | oCN.RunProc(sql_main); |
| | | int i = 1; |
| | | foreach (Sc_MouldRepairWorkBillSub oItem_Detail in oItem.DetailColMouldRepair) |
| | | { |
| | | string sql_sub = "Insert into Sc_MouldRepairWorkBillSub " + |
| | | " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + |
| | | ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + |
| | | ",HRepairID,HRepairExplanation,HManagerID,HMoney) values" + |
| | | "('" + HInterID + "'," + i + ",'','','','" + oItem_Detail.HRemark + "'" + |
| | | ",0,0,'','',0,0" + |
| | | ","+ HRepairID + ",'" + oItem_Detail.HRepairExplanation + "','" + oItem.HEmpID + "',0)"; |
| | | LogService.Write(sql_sub); |
| | | oCN.RunProc(sql_sub); |
| | | i += 1; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | oCN.Commit(); |
| | | return true; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write(e.Message); |
| | | msg = e.Message; |
| | | oCN.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region æ°æ®åæ¥-设å¤ç»´ä¿®è®°å½å |
| | | #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; |
| | | int endIndex = startIndex + size; |
| | | if (endIndex > IDList.Count) |
| | | { |
| | | endIndex = IDList.Count; |
| | | } |
| | | |
| | | while (startIndex < endIndex && endIndex <= IDList.Count) |
| | | { |
| | | List<string> IDList_temp = new List<string>(); |
| | | for (int i = startIndex; i < endIndex; i++) |
| | | { |
| | | IDList_temp.Add(IDList[i]); |
| | | } |
| | | |
| | | BatchGetFormDataByIdListResponse response = new BatchGetFormDataByIdListResponse(); |
| | | if (getInstanceDetailListByInstanceIDList_YiDa(appType, systemToken, formUuid, userID, IDList_temp, ref response, ref msg) == false) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | for (int i = 0; i < response.Body.Result.Count; i++) |
| | | { |
| | | try |
| | | { |
| | | List<string> keys = new List<string>(response.Body.Result[i].FormData.Keys); |
| | | |
| | | EquipRepairWeiXiu oItem = new EquipRepairWeiXiu(); |
| | | oItem.HMakerID = response.Body.Result[i].CreatorUserId.Replace("'", ""); |
| | | oItem.HMaker = response.Body.Result[i].CreatorUserId.Replace("'", ""); |
| | | oItem.HMakeDate = response.Body.Result[i].CreateTimeGMT.Replace("T", " ").Replace("Z", "").Replace("'", ""); |
| | | oItem.HUpdaterID = response.Body.Result[i].ModifyUser.UserId.Replace("'", ""); |
| | | oItem.HUpdater = response.Body.Result[i].ModifyUser.Name.NameInChinese.Replace("'", ""); |
| | | oItem.HUpdateDate = response.Body.Result[i].ModifiedTimeGMT.Replace("T", " ").Replace("Z", "").Replace("'", ""); |
| | | oItem.HInstanceID = response.Body.Result[i].FormInstanceId.Replace("'", ""); |
| | | oItem.HOriginator = response.Body.Result[i].Originator.Name.NameInChinese.Replace("'", ""); |
| | | |
| | | GetInstanceByIdResponse getInstanceByIdResponse = new GetInstanceByIdResponse(); ; |
| | | if (!getInstanceStatusByInstanceID__YiDa(appType, systemToken, userID, oItem.HInstanceID, ref getInstanceByIdResponse, ref msg)) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | if (getInstanceByIdResponse.Body.InstanceStatus != "COMPLETED") |
| | | { |
| | | 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_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; |
| | | } |
| | | else |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | //ç»´ä¿®é¨é¨ |
| | | if (keys.Contains("selectField_kzgkw10a")) |
| | | { |
| | | string HDate_Temp = response.Body.Result[i].FormData["selectField_kzgkw10a"].ToString(); |
| | | DataSet ds = oCN.RunProcReturn("select * from Gy_Department with(nolock) where HName='" + HDate_Temp + "'", "Gy_Department"); |
| | | string HDeptID = "0"; |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | HDeptID = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | 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 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); |
| | | } |
| | | else |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | } |
| | | |
| | | //ç»´ä¿®å
容 |
| | | if (keys.Contains("textField_l2r9bvwk")) |
| | | { |
| | | string HDate_Temp = response.Body.Result[i].FormData["textField_l2r9bvwk"].ToString(); |
| | | |
| | | 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())); |
| | | } |
| | | |
| | | //å表 ç»´ä¿®è¦æ± ç»´ä¿®å¤æ³¨(é®é¢æè¿°) |
| | | |
| | | Sc_MouldRepairWorkBillSub sub = new Sc_MouldRepairWorkBillSub(); |
| | | |
| | | //ç»´ä¿®è¦æ± |
| | | if (keys.Contains("textareaField_lthwo99r")) |
| | | { |
| | | string HDate_Temp = response.Body.Result[i].FormData["textareaField_lthwo99r"].ToString(); |
| | | oItem.HExplanation = HDate_Temp; |
| | | sub.HRepairExplanation = HDate_Temp; |
| | | } |
| | | |
| | | //夿³¨ |
| | | if (keys.Contains("textField_l2r95oo0")) |
| | | { |
| | | string HDate_Temp = response.Body.Result[i].FormData["textField_l2r95oo0"].ToString(); |
| | | |
| | | sub.HRemark = HDate_Temp; |
| | | } |
| | | oItem.DetailColMouldRepair.Add(sub); |
| | | |
| | | int startindex = response.Body.Result[i].Title.IndexOf("zh_CN") + 8; |
| | | oItem.HTitle = startIndex + response.Body.Result[i].Title.Substring(startindex).Replace("\"}", "").Replace("'", ""); |
| | | |
| | | if (keys.Contains("dateField_lo6w37hk")) |
| | | { |
| | | double HDate_Temp = double.Parse(response.Body.Result[i].FormData["dateField_lo6w37hk"].ToString()); |
| | | oItem.HDate = convertFromMillisecondsToDateString(HDate_Temp, "yyyy-MM-dd"); |
| | | } |
| | | |
| | | if (keys.Contains("selectField_lockncvh_id")) |
| | | { |
| | | oItem.HArea = response.Body.Result[i].FormData["selectField_lockncvh_id"].ToString().Replace("'", ""); |
| | | } |
| | | |
| | | if (keys.Contains("selectField_lockncvg_id")) |
| | | { |
| | | oItem.HCheckLevel = response.Body.Result[i].FormData["selectField_lockncvg_id"].ToString().Replace("'", ""); |
| | | } |
| | | |
| | | if (keys.Contains("employeeField_lo6w37hf")) |
| | | { |
| | | oItem.HEmplpyee = ((List<object>)response.Body.Result[i].FormData["employeeField_lo6w37hf"])[0].ToString().Replace("'", ""); |
| | | } |
| | | |
| | | if (keys.Contains("employeeField_lo6w37hf_id")) |
| | | { |
| | | oItem.HEmployeeID = ((List<object>)response.Body.Result[i].FormData["employeeField_lo6w37hf_id"])[0].ToString().Replace("'", ""); |
| | | } |
| | | |
| | | lsmain.Add(oItem); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write(e.Message); |
| | | a = ""; |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | startIndex = endIndex; |
| | | endIndex += size; |
| | | if (endIndex > IDList.Count) |
| | | { |
| | | endIndex = IDList.Count; |
| | | } |
| | | } |
| | | |
| | | |
| | | return true; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | msg = e.Message; |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region æ°æ®åæ¥ |
| | | public bool getData_EquipRepairWeiXiu(ref string msg) |
| | | { |
| | | //è·å åå±å®¡æ ¸è¡¨ å®ä¾IDå表 |
| | | string appType = "APP_E2A54CQBDX3TZN51JGBI"; |
| | | string systemToken = "YKB660C1ZPNW58JDZKAP318W5VQE2RRMQL2YKZK"; |
| | | string userID = "011113050243860353"; |
| | | string formUuid = "FORM-OM566O7177LW0ARJ5IMFF63NTFKA34G9RL2YKN1"; |
| | | int pageNumber = 1; |
| | | int pageSize = 100; |
| | | |
| | | //è·å设å¤ç»´ä¿®ä¿å
»è¡¨çå®ä¾IDå表 |
| | | List<string> IDList = new List<string>(); |
| | | if (getInstanceIDList_YiDa(appType, systemToken, userID, formUuid, pageNumber, pageSize, ref IDList, ref msg) == false) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | //è·å详ç»ä¿¡æ¯å¹¶éå å°å表lsmainä¸ |
| | | List<EquipRepairWeiXiu> lsmain = new List<EquipRepairWeiXiu>(); |
| | | if (getInstanceDetailList___EquipRepairWeiXiu_YiDa(appType, systemToken, userID, formUuid, IDList, ref lsmain, ref msg) == false) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | 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) |
| | | { |
| | | //ç»´ä¿®è®°å½ |
| | | if (oItem.DetailColMouldRepair.Count != 0) |
| | | { |
| | | string BillType = "3910"; |
| | | string sql = $@"select HInnerBillNo from Sb_EquipRepairWorkBillMain |
| | | where HInnerBillNo = '{oItem.HInstanceID}'"; |
| | | DataSet ds = oCN.RunProcReturn(sql, "Sb_EquipRepairWorkBillMain"); |
| | | |
| | | 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); |
| | | //long HInterID = 0; |
| | | //string HBillNo = ""; |
| | | string sql_main = "Insert Into Sb_EquipRepairWorkBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + |
| | | ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + |
| | | ",HEquipID,HRepairID,HPlanTimes,HEmpID,HManagerID,HTimes" + |
| | | ",HDeptID,HExplanation,HInnerBillNo,HRepairBeginDate,HRepairEndDate" + |
| | | ",HRepairContent,HCycleUnit,HMainSourceBillType,HMainSourceInterID,HMainSourceEntryID" + |
| | | ",HRepairCategory,HUrgenLevel,HRepairer,HIsCapacityImpact)" + |
| | | "values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',getdate()" + |
| | | ",'" + DateTime.Now.Year + "','" + DateTime.Now.Month + "','"+ oItem.HRemark2 + "','" + oItem.HOriginator + "','" + oItem.HMakeDate + "'" + |
| | | ",'" + 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) |
| | | { |
| | | string sql_sub = "Insert into Sb_EquipRepairWorkBillSub " + |
| | | " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + |
| | | ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + |
| | | ",HRepairID,HManagerID,HRepairExplanation,HEmpID)" + |
| | | "values('" + HInterID + "'," + i + ",'','','','" + oItem_Detail.HRemark + "'" + |
| | | ",0,0,'','',0,0" + |
| | | "," + HRepairID + ",'" + oItem.HEmpID + "','" + oItem_Detail.HRepairExplanation + "','" + oItem.HEmpID + "')"; |
| | | LogService.Write(sql_sub); |
| | | oCN.RunProc(sql_sub); |
| | | i += 1; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | oCN.Commit(); |
| | | return true; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write(e.Message); |
| | | msg = e.Message; |
| | | oCN.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | |