| | |
| | | |
| | | } |
| | | #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 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 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 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 |
| | | |
| | | #region éé éç¨æä½æ¹æ³ |
| | |
| | | //OriginatorId = "12", //æ ¹æ®æµç¨åèµ·äººå·¥å·æ¥è¯¢ã |
| | | |
| | | //TaskId = "12", //ä»»å¡IDã |
| | | CreateFromTimeGMT = DateTime.Now.ToString("dd") == "01"?"2022-01-01":DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd"), //å建æ¶é´èµ·å§å¼ã |
| | | CreateFromTimeGMT = DateTime.Now.ToString("dd") == "01"?"2022-01-01":DateTime.Now.AddDays(-14).ToString("yyyy-MM-dd"), //å建æ¶é´èµ·å§å¼ã |
| | | CreateToTimeGMT = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), //å建æ¶é´ç»æ¢å¼ã |
| | | |
| | | PageSize = pageSize, //å页大å°ã |
| | |
| | | } |
| | | } |
| | | #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 æ°æ®åæ¥æ¹æ³ |
| | |
| | | } |
| | | #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_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.HRemark = HDate_Temp; |
| | | } |
| | | |
| | | //模å
·ç¼ç |
| | | if (keys.Contains("dateField_lq4gf2ii")) |
| | | { |
| | | string HDate_Temp = response.Body.Result[i].FormData["dateField_lq4gf2ii"].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); |
| | | } |
| | | |
| | | |
| | | //ç»´ä¿®é¨é¨ |
| | | 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 HNumber='" + 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) |
| | | { |
| | | 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(); |
| | | 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" + |
| | | ")values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',getdate(),'" + 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')"; |
| | | 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 + ",0,'" + oItem_Detail.HClaim + "'" + |
| | | ",'','" + oItem_Detail.HClaim + "'" + |
| | | ",'" + oItem.HEmpID + "'" + |
| | | ",'','','" + oItem_Detail.HMaintainResult + "'" + |
| | | ",'0','0','','',0,0,'')"; |
| | | 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" + |
| | | ")values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',getdate()" + |
| | | ",'" + DateTime.Now.Year + "','" + DateTime.Now.Month + "','','" + oItem.HOriginator + "','" + oItem.HMakeDate + "'" + |
| | | ",'0','0','" + oItem.HRepairBeginDate + "','" + oItem.HUpdateDate + "',''" + |
| | | ",'å°æ¶','" + oItem.HPlanTimes + "','" + oItem.HTimes + "','" + oItem.HEmpID + "',0" + |
| | | ",'" + oItem.HDeptID + "','','" + oItem.HInstanceID + "','" + oItem.HMouldID + "'" + |
| | | ",'0','å
é¨ç»´ä¿®','','" + oItem.HNewDesignLife + "','',0,0)"; |
| | | |
| | | 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" + |
| | | ",0,'" + oItem_Detail.HRepairExplanation + "','" + oItem.HEmpID + "',0)"; |
| | | oCN.RunProc(sql_sub); |
| | | i += 1; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | oCN.Commit(); |
| | | return true; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | 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) |
| | | { |
| | | |
| | | 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 (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"); |
| | | 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; |
| | | } |
| | | |
| | | |
| | | //ç»´ä¿®é¨é¨ |
| | | 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); |
| | | } |
| | | |
| | | |
| | | //维修人 |
| | | 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"); |
| | | 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("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); |
| | | } |
| | | |
| | | //ç»´ä¿®å
容 |
| | | if (keys.Contains("textField_l2r9bvwk")) |
| | | { |
| | | string HDate_Temp = response.Body.Result[i].FormData["textField_l2r9bvwk"].ToString(); |
| | | |
| | | oItem.HRepairContent = HDate_Temp; |
| | | } |
| | | |
| | | |
| | | //å表 ç»´ä¿®è¦æ± ç»´ä¿®å¤æ³¨(é®é¢æè¿°) |
| | | |
| | | Sc_MouldRepairWorkBillSub sub = new Sc_MouldRepairWorkBillSub(); |
| | | |
| | | //ç»´ä¿®è¦æ± |
| | | if (keys.Contains("textareaField_lthwo99r")) |
| | | { |
| | | string HDate_Temp = response.Body.Result[i].FormData["textareaField_lthwo99r"].ToString(); |
| | | |
| | | 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) |
| | | { |
| | | 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(); |
| | | 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" + |
| | | ")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)"; |
| | | |
| | | 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" + |
| | | ",0,'" + oItem.HEmpID + "','" + oItem_Detail.HRepairExplanation + "','" + oItem.HEmpID + "')"; |
| | | oCN.RunProc(sql_sub); |
| | | i += 1; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | oCN.Commit(); |
| | | return true; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | msg = e.Message; |
| | | oCN.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | |