| | |
| | | using DingTalk.Api.Response; |
| | | using System.Globalization; |
| | | using System.Linq; |
| | | using AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models; |
| | | using System.Text.RegularExpressions; |
| | | |
| | | namespace WebAPI.Controllers |
| | | { |
| | |
| | | public long? TotalCount; |
| | | public long? PageNumber; |
| | | public List<string> Data; |
| | | } |
| | | //oa审æ¹è¿åç±» |
| | | public class OA_GetInstanceIDListResponse |
| | | { |
| | | public List<string> list;//è·åçidå表 |
| | | public string nextToken; |
| | | public bool? success; |
| | | } |
| | | |
| | | #region åå±å®¡æ ¸ç¾å°è¡¨ |
| | |
| | | |
| | | public List<Sc_MouldRepairWorkBillSub> DetailColMouldRepair = new List<Sc_MouldRepairWorkBillSub>(); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region å¼å¸¸å·¥æ¶ç³è¯·å |
| | | |
| | | #region 主表+å表 |
| | | public class Pay_ErrWorkTimesRequestBill |
| | | { |
| | | public int HInterID; |
| | | public string HBillNo; |
| | | public string HDate; |
| | | public string HInnerBillNo; |
| | | public int HDeptID; |
| | | public string HDeptName; |
| | | public int HGroupID; |
| | | public string HGroupName; |
| | | public int HMangerID; |
| | | public string HManagerName; |
| | | public int HICMOInterID; |
| | | public string HICMOBillNo; |
| | | public string HExplanation; |
| | | public double HSumRequestTimes; |
| | | public int HMaterID; |
| | | public string HMaterName; |
| | | public int HUnitID; |
| | | public string HUnitName; |
| | | public double HPlanQty; |
| | | public string HBatchNo; |
| | | public string HRemark; |
| | | |
| | | public string HMaker; |
| | | public string HMakerDate; |
| | | public string HUpdater; |
| | | public string HUpdaterDate; |
| | | public string HChecker; |
| | | public string HCheckerDate; |
| | | public string HCloseMan; |
| | | public string HCloseManDate; |
| | | public string HDeleteMan; |
| | | public string HDeleteManDate; |
| | | public string HBacker; |
| | | public string HBackerDate; |
| | | public string HBackRemark; |
| | | public List<Pay_ErrWorkTimesRequestBillSub> Pay_ErrWorkTimesRequestBillSub = new List<Pay_ErrWorkTimesRequestBillSub>(); |
| | | } |
| | | #endregion |
| | | |
| | | #region å表 |
| | | public class Pay_ErrWorkTimesRequestBillSub |
| | | { |
| | | public int HEmpID; |
| | | public string HEmpNumber; |
| | | public string HEmpName; |
| | | public int HWorkTypeID; |
| | | public string HWorkTypeNumber; |
| | | public string HWorkTypeName; |
| | | public double HPayMoney; |
| | | public string HBTimes; |
| | | public string HETimes; |
| | | public double HTimes; |
| | | public double HRelTimes; |
| | | public double HRelPay; |
| | | public string HRemark; |
| | | |
| | | public int HSourceInterID; |
| | | public int HSourceEntryID; |
| | | public string HSourceBillNo; |
| | | public string HSourceBillType; |
| | | public double HRelationQty; |
| | | public double HRelationMoney; |
| | | public string HCloseMan; |
| | | public string HEntryCloseDate; |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region éé éç¨æä½æ¹æ³ |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region oa éç¨æä½æ¹æ³ |
| | | |
| | | #region OA è·å审æ¹å®ä¾IDå表(å页) |
| | | public bool getInstanceIDList_Page_OA(string processCode,DateTime startTime, DateTime endTime,long nextToken, int maxResult, List<string> statuses, ref OA_GetInstanceIDListResponse response, ref string msg) |
| | | { |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Client client = CreateClient1(); |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.ListProcessInstanceIdsHeaders listProcessInstanceIdsHeaders = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.ListProcessInstanceIdsHeaders(); |
| | | listProcessInstanceIdsHeaders.XAcsDingtalkAccessToken = this.accessToken; |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.ListProcessInstanceIdsRequest listProcessInstanceIdsRequest = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.ListProcessInstanceIdsRequest |
| | | { |
| | | Statuses = statuses, |
| | | StartTime = getTimeMillions(startTime), |
| | | EndTime = getTimeMillions(endTime), |
| | | ProcessCode = processCode, |
| | | NextToken = nextToken, |
| | | MaxResults = maxResult, |
| | | }; |
| | | try |
| | | { |
| | | ListProcessInstanceIdsResponse listProcessInstanceIdsResponse = client.ListProcessInstanceIdsWithOptions(listProcessInstanceIdsRequest, listProcessInstanceIdsHeaders, new AlibabaCloud.TeaUtil.Models.RuntimeOptions()); |
| | | response.success = listProcessInstanceIdsResponse.Body.Success; |
| | | response.list = listProcessInstanceIdsResponse.Body.Result.List; |
| | | response.nextToken = listProcessInstanceIdsResponse.Body.Result.NextToken; |
| | | return true; |
| | | } |
| | | catch (TeaException err) |
| | | { |
| | | if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message)) |
| | | { |
| | | // err ä¸å«æ code å message 屿§ï¼å¯å¸®å©å¼åå®ä½é®é¢ |
| | | } |
| | | msg = "é误代ç " + err.Code + "ï¼" + 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.Code + "ï¼" + err.Message; |
| | | return false; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region è·å OAæå®åæ®çå®ä¾IDå表(å
¨é¨) |
| | | public bool getInstanceIDList_OA(string processCode, DateTime startTime, DateTime endTime, long nextToken, int maxResult, List<string> statuses, ref List<string> IDList, ref string msg) |
| | | { |
| | | OA_GetInstanceIDListResponse response = new OA_GetInstanceIDListResponse(); |
| | | response.nextToken = nextToken.ToString();//èµå¼åå§å¼ |
| | | do |
| | | { |
| | | nextToken = long.Parse(response.nextToken); |
| | | if (getInstanceIDList_Page_OA(processCode, startTime, endTime, nextToken, maxResult, statuses,ref response, ref msg) == false) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | for (int i = 0; i < response.list.Count; i++) |
| | | { |
| | | IDList.Add(response.list[i]); |
| | | } |
| | | |
| | | } while (response.nextToken!=null); |
| | | return true; |
| | | } |
| | | #endregion |
| | | |
| | | #region è·å OA æ ¹æ®å®ä¾IDè·åå®ä¾è¯¦æ
|
| | | public bool getInstanceDetailByInstanceID_OA(string processinstanceID,ref GetProcessInstanceResponse response, ref string msg) |
| | | { |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Client client = CreateClient1(); |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.GetProcessInstanceHeaders getProcessInstanceHeaders = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.GetProcessInstanceHeaders(); |
| | | getProcessInstanceHeaders.XAcsDingtalkAccessToken = this.accessToken; |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.GetProcessInstanceRequest getProcessInstanceRequest = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.GetProcessInstanceRequest |
| | | { |
| | | ProcessInstanceId = processinstanceID, |
| | | }; |
| | | try |
| | | { |
| | | response = client.GetProcessInstanceWithOptions(getProcessInstanceRequest, getProcessInstanceHeaders, new AlibabaCloud.TeaUtil.Models.RuntimeOptions()); |
| | | return true; |
| | | } |
| | | catch (TeaException err) |
| | | { |
| | | if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message)) |
| | | { |
| | | // err ä¸å«æ code å message 屿§ï¼å¯å¸®å©å¼åå®ä½é®é¢ |
| | | } |
| | | msg = "é误代ç " + err.Code + "ï¼" + 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.Code + "ï¼" + err.Message; |
| | | return false; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region è·å OA æ ¹æ®å®ä¾IDå表è·åå®ä¾è¯¦æ
å表 |
| | | public bool getInstanceDetailListByInstanceIDList_OA(List<string> processinstanceIDList, ref List<GetProcessInstanceResponse> responseList, ref string msg) |
| | | { |
| | | GetProcessInstanceResponse getProcessInstanceResponse = new GetProcessInstanceResponse(); |
| | | try |
| | | { |
| | | foreach(string processinstanceID in processinstanceIDList) |
| | | { |
| | | if(!getInstanceDetailByInstanceID_OA(processinstanceID,ref getProcessInstanceResponse,ref msg)) |
| | | { |
| | | return false; |
| | | } |
| | | responseList.Add(getProcessInstanceResponse); |
| | | } |
| | | return true; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | msg = e.Message; |
| | | return false; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region æ°æ®åæ¥æ¹æ³ |
| | |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region æ°æ®åæ¥-å¼å¸¸å·¥æ¶åOAéè·å |
| | | |
| | | #region ç±»åè½¬æ¢æåresponseä¸çvalue对象 |
| | | public class StatValue |
| | | { |
| | | public string Id { get; set; } |
| | | public string Label { get; set; } |
| | | public string Upper { get; set; } |
| | | public string Num { get; set; } |
| | | } |
| | | |
| | | public class ExtValue |
| | | { |
| | | public List<StatValue> StatValue { get; set; } |
| | | public string ComponentName { get; set; } |
| | | } |
| | | public class RowValue |
| | | { |
| | | public string Label { get; set; } |
| | | public object Value { get; set; } |
| | | public string Key { get; set; } |
| | | // 注æï¼è¿éä¸å®ä¹extendValue屿§ï¼å 为æä»¬ä¸éè¦å® |
| | | // public SomeType ExtendValue { get; set; } // 妿éè¦ï¼å¯ä»¥æ³¨éææå é¤è¿è¡ |
| | | } |
| | | public class Row |
| | | { |
| | | public List<RowValue> RowValue { get; set; } |
| | | public string RowNumber { get; set; } |
| | | // 注æï¼è¿éåè®¾ä½ ä¸éè¦componentNameï¼å 为JSON示ä¾ä¸æ²¡æç´æ¥å
å«å® |
| | | // ä½å¦æä½ çå®é
JSONæéæ±ä¸å
å«ï¼ä½ åºè¯¥æ·»å è¿ä¸ªå±æ§ |
| | | // public string ComponentName { get; set; } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region OAå¼å¸¸å·¥æ¶ç³è¯·å å®ä¾IDå表对åºçå®ä¾è¯¦æ
|
| | | public bool getInstanceDetailList___ErrWorkTimesRequest_OA(List<string> processinstanceIDList, DateTime startTime, DateTime endTime, ref List<Pay_ErrWorkTimesRequestBill> lsmain,ref string msg) |
| | | { |
| | | try |
| | | { |
| | | List<GetProcessInstanceResponse> getProcessInstanceResponses = new List<GetProcessInstanceResponse>(); |
| | | //è·åééresponse |
| | | if (getInstanceDetailListByInstanceIDList_OA(processinstanceIDList,ref getProcessInstanceResponses,ref msg)==false) |
| | | { |
| | | return false; |
| | | } |
| | | foreach(GetProcessInstanceResponse getProcessInstanceResponse in getProcessInstanceResponses) |
| | | { |
| | | Pay_ErrWorkTimesRequestBill oItem = new Pay_ErrWorkTimesRequestBill(); |
| | | //主表 |
| | | oItem.HDate = getProcessInstanceResponse.Body.Result.FormComponentValues[1].Value;//åæ®æ¥æè®¡æ¶æ¶é´ |
| | | DateTime dateTime1 = DateTime.ParseExact(oItem.HDate + " 00:00:00", "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); |
| | | if (!(DateTime.Compare(dateTime1, startTime)>=0&& DateTime.Compare(dateTime1, endTime) <= 0))//æ§å¶æ¶é´ |
| | | { |
| | | continue; |
| | | } |
| | | string[] deptNameAndGroupName = getProcessInstanceResponse.Body.Result.OriginatorDeptName.Split('-');//è·åé¨é¨æ¼æ¥å符串æ°ç» |
| | | oItem.HDeptName = deptNameAndGroupName[1]; |
| | | oItem.HGroupName = deptNameAndGroupName[deptNameAndGroupName.Length-1]; |
| | | //主管-è´è´£äºº |
| | | string HManagerValue = getProcessInstanceResponse.Body.Result.FormComponentValues[9].Value;//è·åçååå«åç¼è±æ |
| | | string pattern = @"[\u4e00-\u9fff]+"; // 䏿å符çUnicodeèå´ |
| | | |
| | | MatchCollection matches = Regex.Matches(HManagerValue, pattern); |
| | | |
| | | // å建ä¸ä¸ªStringBuilderæ¥æ¼æ¥ææå¹é
ç䏿å符 |
| | | System.Text.StringBuilder chineseChars = new System.Text.StringBuilder(); |
| | | foreach (Match match in matches) |
| | | { |
| | | chineseChars.Append(match.Value); |
| | | } |
| | | string HManagerName = chineseChars.ToString(); |
| | | DataSet ds = oCN.RunProcReturn("select * from Gy_Employee with(nolock) where HName='" + HManagerName + "'", "Gy_Employee"); |
| | | string HMangerID = "0"; |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | HMangerID = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | oItem.HMangerID = int.Parse(HMangerID); |
| | | //å¤çé¨é¨åçç»åç§°id |
| | | ds = oCN.RunProcReturn("select * from Gy_Department with(nolock) where HName='" + oItem.HDeptName + "'", "Gy_Department"); |
| | | string HDeptID = "0"; |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | HDeptID = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | oItem.HDeptID = int.Parse(HDeptID); |
| | | ds = oCN.RunProcReturn("select * from Gy_Group with(nolock) where HName='" + oItem.HGroupName + "'", "Gy_Group"); |
| | | string HGroupID = "0"; |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | HGroupID = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | oItem.HGroupID = int.Parse(HGroupID); |
| | | |
| | | //ååºååæç»å
容 |
| | | string tableFieldValue = getProcessInstanceResponse.Body.Result.FormComponentValues[11].Value; |
| | | List<Row> rows = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Row>>(tableFieldValue); |
| | | ExtValue extValue = Newtonsoft.Json.JsonConvert.DeserializeObject<ExtValue>(getProcessInstanceResponse.Body.Result.FormComponentValues[11].ExtValue); |
| | | oItem.HBatchNo = rows[0].RowValue[1].Value.ToString();//æ¹æ¬¡å·-订åå·ç |
| | | //ä»»å¡æè¿°-ä»»å¡ç±»å+å·¥ä½å
容 |
| | | oItem.HExplanation = getProcessInstanceResponse.Body.Result.FormComponentValues[2].Value + "-" + rows[0].RowValue[0].Value; |
| | | oItem.HSumRequestTimes = double.Parse(extValue.StatValue[1].Num);//æ»æ¶é¿ |
| | | oItem.HPlanQty = 0;//è®¡åæ°é |
| | | oItem.HRemark = "éé导å
¥" + getProcessInstanceResponse.Body.Result.Title;//夿³¨ |
| | | //循ç¯éåè·åèååç§°idï¼å·¥æ¶ |
| | | for (int i = 0; i < rows.Count; i++) |
| | | { |
| | | string[] nameArray = rows[i].RowValue[4].Value.ToString().Split(',');//è·åæ¯ä¸ªäººç人å |
| | | oItem.HPlanQty += double.Parse(rows[i].RowValue[2].Value.ToString());//è®¡åæ°é |
| | | for (int j = 0; j < int.Parse(rows[i].RowValue[5].Value.ToString()); j++) |
| | | { |
| | | Pay_ErrWorkTimesRequestBillSub pay_ErrWorkTimesRequestBillSub = new Pay_ErrWorkTimesRequestBillSub(); |
| | | ds = oCN.RunProcReturn("select * from Gy_Employee with(nolock) where HName='" + nameArray[j] + "'", "Gy_Employee"); |
| | | string HEmpID = "0"; |
| | | //设置å表èåidåç§° |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | HEmpID = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | pay_ErrWorkTimesRequestBillSub.HEmpName = nameArray[j]; |
| | | pay_ErrWorkTimesRequestBillSub.HEmpID = int.Parse(HEmpID); |
| | | pay_ErrWorkTimesRequestBillSub.HRelTimes = double.Parse(rows[i].RowValue[6].Value.ToString()); |
| | | pay_ErrWorkTimesRequestBillSub.HTimes = double.Parse(rows[i].RowValue[6].Value.ToString()); |
| | | pay_ErrWorkTimesRequestBillSub.HRelPay = double.Parse(rows[i].RowValue[10].Value.ToString()); |
| | | pay_ErrWorkTimesRequestBillSub.HPayMoney = pay_ErrWorkTimesRequestBillSub.HRelPay / pay_ErrWorkTimesRequestBillSub.HTimes; |
| | | pay_ErrWorkTimesRequestBillSub.HRemark = "éé导å
¥"; |
| | | oItem.Pay_ErrWorkTimesRequestBillSub.Add(pay_ErrWorkTimesRequestBillSub); |
| | | |
| | | } |
| | | } |
| | | lsmain.Add(oItem); |
| | | } |
| | | return true; |
| | | }catch(Exception e) |
| | | { |
| | | msg = e.Message; |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region æ°æ®åæ¥ |
| | | public bool getData_ErrWorkTimesRequest(DateTime startTime, DateTime endTime,ref string msg) |
| | | { |
| | | string processCode = "PROC-21371550-FEF1-4EDD-A827-639746E22E43"; |
| | | long nextToken = 1; |
| | | int maxResult = 20;//æå¤§20 |
| | | List<string> statues = new List<string>{"COMPLETED"}; |
| | | this.AppKey = "ding7miekiaqn4rc2ert"; |
| | | this.AppSecret = "81qMrC5SvkgjT9t2A3wUyEEENzyl9jJLeXOpjv2SNULc_HSlFZF4NE21YFCXik4K"; |
| | | getAccessToken();//设置accessToken |
| | | //è·åå·¥æ¶ç³è¯·çå®ä¾IDå表 |
| | | List<string> IDList = new List<string>(); |
| | | if (getInstanceIDList_OA(processCode,startTime,endTime,nextToken,maxResult,statues,ref IDList, ref msg) == false) |
| | | { |
| | | return false; |
| | | } |
| | | //è·å详ç»ä¿¡æ¯å¹¶éå å°å表lsmainä¸ |
| | | List<Pay_ErrWorkTimesRequestBill> lsmain = new List<Pay_ErrWorkTimesRequestBill>(); |
| | | if (getInstanceDetailList___ErrWorkTimesRequest_OA(IDList,startTime,endTime, ref lsmain, ref msg) == false) |
| | | { |
| | | return false; |
| | | } |
| | | try |
| | | { |
| | | oCN.BeginTran(); |
| | | //å 餿¶é´èå´å
ç导å
¥åæ® |
| | | DataSet dataSet = oCN.RunProcReturn(@"select HInterID from Pay_ErrWorkTimesRequestBillMain a with(nolock) where a.HRemark like '%éé导å
¥%' and HDate >= '" + startTime + "' and HDate<='" + endTime + "'", "Pay_ErrWorkTimesRequestBillMain"); |
| | | if(dataSet != null && dataSet.Tables[0].Rows.Count > 0) |
| | | { |
| | | foreach (DataRow row in dataSet.Tables[0].Rows) |
| | | { |
| | | int HInterID = row.Field<int>("HInterID"); |
| | | oCN.RunProc(@"Delete From Pay_ErrWorkTimesRequestBillMain where HInterID = " + HInterID); |
| | | oCN.RunProc(@"Delete From Pay_ErrWorkTimesRequestBillSub where HInterID = " + HInterID); |
| | | } |
| | | } |
| | | //æå
¥æ°æ® |
| | | foreach(Pay_ErrWorkTimesRequestBill oItem in lsmain) |
| | | { |
| | | if (oItem.Pay_ErrWorkTimesRequestBillSub.Count != 0) |
| | | { |
| | | string HBillType = "2231"; |
| | | long HInterID = DBUtility.ClsPub.CreateBillID(HBillType, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | string HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true); |
| | | int HYear = int.Parse(oItem.HDate.Split('-')[0]); |
| | | int HPeriod = int.Parse(oItem.HDate.Split('-')[1]); |
| | | //主表 |
| | | string sql = "insert into Pay_ErrWorkTimesRequestBillMain" + |
| | | "(HYear,HPeriod,HBillType,HBillSubType,HBillStatus,HInterID,HBillNo,HDate,HInnerBillNo,HDeptID,HGroupID,HMangerID,HICMOInterID,HICMOBillNo,HExplanation,HSumRequestTimes,HMaterID,HUnitID,HPlanQty,HBatchNo,HRemark,HMaker,HMakeDate) " + |
| | | "values(" + |
| | | "" + HYear + |
| | | "," + HPeriod + |
| | | ",'" + HBillType + |
| | | "','" + " " + |
| | | "'," + 1 + |
| | | "," + HInterID + |
| | | ",'" + HBillNo + |
| | | "','" + oItem.HDate + |
| | | "','" + " " + |
| | | "'," + oItem.HDeptID + |
| | | "," + oItem.HGroupID + |
| | | "," + oItem.HMangerID + |
| | | "," + "0" + |
| | | ",'" + " " + |
| | | "','" + oItem.HExplanation + |
| | | "'," + oItem.HSumRequestTimes + |
| | | "," + 0 + |
| | | "," + 0 + |
| | | "," + oItem.HPlanQty + |
| | | ",'" + oItem.HBatchNo + |
| | | "','" + oItem.HRemark + |
| | | "','" + "System" + |
| | | "'," + "GETDATE()" + |
| | | ")"; |
| | | //主表 |
| | | LogService.Write(sql); |
| | | oCN.RunProc(sql); |
| | | int i = 1; |
| | | foreach (Pay_ErrWorkTimesRequestBillSub oItem_Detail in oItem.Pay_ErrWorkTimesRequestBillSub) |
| | | { |
| | | sql = "insert into Pay_ErrWorkTimesRequestBillSub" + |
| | | "(HInterID,HEntryID,HEmpID,HWorkTypeID,HPayMoney,HBTimes,HETimes,HTimes,HRelTimes,HRelPay,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo" + |
| | | ",HSourceBillType,HRelationQty,HRelationMoney) " + |
| | | "values(" + |
| | | "" + HInterID + |
| | | "," + i + |
| | | "," + oItem_Detail.HEmpID + |
| | | "," + 0 + |
| | | "," + oItem_Detail.HPayMoney + |
| | | ",'" + "" + |
| | | "','" + "" + |
| | | "'," + oItem_Detail.HTimes + |
| | | "," + oItem_Detail.HRelTimes + |
| | | "," + oItem_Detail.HRelPay + |
| | | ",'" + oItem_Detail.HRemark + |
| | | "'," + 0 + |
| | | "," + 0 + |
| | | ",'" + " " + |
| | | "','" + " " + |
| | | "'," + 0 + |
| | | "," + 0 + |
| | | ")"; |
| | | LogService.Write(sql); |
| | | oCN.RunProc(sql); |
| | | i += 1; |
| | | } |
| | | } |
| | | } |
| | | oCN.Commit(); |
| | | return true; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write(e.Message); |
| | | msg = e.Message; |
| | | oCN.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region ééæ°æ®åæ¥OA |
| | | [Route("DD_DataSynchronization/DataSynchronization_DingDing_OA")] |
| | | [HttpGet] |
| | | public object DataSynchronization_DingDing_OA(DateTime startTime, DateTime endTime, string user) |
| | | { |
| | | string msg = ""; |
| | | try |
| | | { |
| | | if (getData_ErrWorkTimesRequest(startTime,endTime,ref msg) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + msg; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |