| | |
| | | using DbType = System.Data.DbType; |
| | | using System.Data; |
| | | using static Microsoft.EntityFrameworkCore.DbLoggerCategory; |
| | | using AlibabaCloud.TeaUtil.Models; |
| | | using MES.Service.Modes.QcIssueResult; |
| | | using Newtonsoft.Json; |
| | | using System.Diagnostics; |
| | | using Tea; |
| | | using MES.Service.Modes.DingAPI; |
| | | using static System.Runtime.InteropServices.JavaScript.JSType; |
| | | |
| | | namespace MES.Service.service.QC; |
| | | |
| | |
| | | //if (StringUtil.IsNotNullOrEmpty(queryObj.StatusUser)) |
| | | // lineNo = _baseService.getUserLineNo(queryObj.StatusUser); |
| | | |
| | | var data = db.Queryable<SJPageResult, Womdaa, Womcaa> ((a, |
| | | da,ca) => |
| | | var data = db.Queryable<SJPageResult, Womdaa, Womcaa, SysDepartment, MesUserDepartmentQc,MesItems> ((a, |
| | | da,ca,d,dq,i) => |
| | | new JoinQueryInfos( |
| | | JoinType.Left, Convert.ToDecimal(a.Pbaid) == da.Id, // 关联工单信息 |
| | | JoinType.Left, da.Daa021 == ca.Caa020//任务单,用于查询销售订单号 |
| | | JoinType.Left, da.Daa021 == ca.Caa020,//任务单,用于查询销售订单号 |
| | | JoinType.Left, d.Departmentid == Convert.ToDecimal(da.Daa013),//查询车间 |
| | | JoinType.Left, dq.Departmentcode == d.Departmentcode,//查询用户权限 |
| | | JoinType.Left, i.Id == Convert.ToDecimal(da.Daa002)//查询用户权限 |
| | | )) |
| | | //.WhereIF(lineNo != null && lineNo.Length > 0, |
| | | // a => lineNo.Contains(a.line)) |
| | |
| | | StringUtil.IsNotNullOrEmpty(queryObj.Result) && |
| | | !"未完成".Equals(queryObj.Result), |
| | | a => a.FSubmit == "1") |
| | | .Select((a, da, ca) => new SJPageResult |
| | | //匹配权限 |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.LoginUser), |
| | | (a, da, ca, d, dq) => dq.Usercode == queryObj.LoginUser) |
| | | //匹配搜索字符串 |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue), |
| | | (a, da, ca, d, dq,i) => |
| | | a.BillNo.ToLower().Contains(queryObj.SearchValue.ToLower())|| |
| | | i.ItemName.ToLower() .Contains(queryObj.SearchValue.ToLower()) || |
| | | ca.Caa015.ToLower().Contains(queryObj.SearchValue.ToLower()) || |
| | | i.ItemNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .Select((a, da, ca, d, dq) => new SJPageResult |
| | | { |
| | | Id = a.Id, |
| | | BillNo = a.BillNo, |
| | |
| | | Daa004 = a.Daa004, |
| | | Daa008 = a.Daa008, |
| | | LineName = a.LineName, |
| | | |
| | | // 映射额外的字段(销售订单号) |
| | | SaleOrder = ca.Caa015 |
| | | SaleOrder = ca.Caa015, |
| | | DepartName = d.Departmentname |
| | | }) |
| | | .OrderBy(a => a.CreateTime, OrderByType.Desc); |
| | | var items = data.ToPageList(queryObj.PageIndex, queryObj.Limit,ref totalCount); |
| | |
| | | }).ToList(); |
| | | } |
| | | |
| | | public List<SJBadReason>? GetReason(string billNo) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | var count = db.Queryable<SJBadReason>().Where(s => s.BillNo == billNo).Count(); |
| | | |
| | | if (count <= 0) return null; |
| | | |
| | | var reason = db |
| | | .Queryable<SJBadReason>() |
| | | .Where(s => s.BillNo == billNo).Select( |
| | | b => new SJBadReason |
| | | { |
| | | Reason =b.Reason |
| | | }).ToList(); |
| | | |
| | | return reason; |
| | | } |
| | | |
| | | public List<QsItemIpiItem> getQSItems(decimal? pid, decimal? id) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | var qsItemIpiItems = db |
| | | .Queryable<QsItemIpiItem>() |
| | | .WhereIF(pid > 0, a => a.Pid == pid) |
| | | .WhereIF(id > 0, a => a.Id == id).ToList(); |
| | | var qsItemIpiItems = db.Queryable<QsItemIpiItem>().WhereIF(pid > 0, a => a.Pid == pid).WhereIF(id > 0, a => a.Id == id).ToList(); |
| | | |
| | | var array = qsItemIpiItems.Select(s => s.Id).ToArray(); |
| | | var qsItemIpiItemDetails = db.Queryable<QsItemIpiItemDetail>() |
| | | .Where(s => array.Contains(s.Pid)) |
| | | .GroupBy(s => s.Pid) |
| | | var qsItemIpiItemDetails = db.Queryable<QsItemIpiItemDetail>().Where(s => array.Contains(s.Pid)).GroupBy(s => s.Pid) |
| | | .Select(s => new |
| | | { |
| | | s.Pid, |
| | |
| | | }); |
| | | |
| | | //使用linq表达式过滤出图片id不为空的数据 |
| | | var itemIpiItems = |
| | | qsItemIpiItems.Where(s => s.Picture is { Length: > 0 }) |
| | | .ToList(); |
| | | var itemIpiItems =qsItemIpiItems.Where(s => s.Picture is { Length: > 0 }).ToList(); |
| | | if (itemIpiItems.Count > 0) |
| | | itemIpiItems.ForEach(s => |
| | | { |
| | |
| | | db => |
| | | { |
| | | qsItemIpiReq.StatusDate = DateTime.Now; |
| | | var pid = db.Insertable(qsItemIpiReq) |
| | | .ExecuteReturnIdentity(); |
| | | var pid = db.Insertable(qsItemIpiReq).ExecuteReturnIdentity(); |
| | | qsItemIpiReq.Id = pid; |
| | | |
| | | item.gid = pid; |
| | | |
| | | qsItemIpiItems.ForEach(s => s.Pid = pid); |
| | | |
| | | return db.Insertable(qsItemIpiItems) |
| | | .ExecuteCommand(); |
| | | return db.Insertable(qsItemIpiItems).ExecuteCommand(); |
| | | }); |
| | | item.Items = getQSItems(qsItemIpiReq.Id, null); |
| | | |
| | |
| | | |
| | | public QsItem SaveItem(QsItem item) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | var del = db.Deleteable<QsItemIpiItem>() |
| | | .Where(s=>s.Pid == item.gid) |
| | | .ExecuteCommand(); |
| | | |
| | | //QsItemIpiItemDetail |
| | | var del1 = db.Deleteable<QsItemIpiItemDetail>() |
| | | .Where(s => s.Gid == item.gid) |
| | | .ExecuteCommand(); |
| | | |
| | | var qsItemIpiItems = item.Items; |
| | | SqlSugarHelper.UseTransactionWithOracle( |
| | | db => |
| | | { |
| | | qsItemIpiItems.ForEach(s => s.Pid = item.gid); |
| | | |
| | | return db.Insertable(qsItemIpiItems) |
| | | .ExecuteCommand(); |
| | | return db.Insertable(qsItemIpiItems).ExecuteCommand(); |
| | | }); |
| | | item.Items = getQSItems(item.gid, null); |
| | | |
| | | //没有上下限的检验项目自动盘点为合格 |
| | | item.Items.ForEach(s => |
| | | { |
| | | if (s.MaxValue != null || s.StandardValue != null || |
| | | s.MinValue != null) return; |
| | | if (s.MaxValue != null || s.StandardValue != null || s.MinValue != null) |
| | | { |
| | | return; |
| | | } |
| | | var detail = new QsItemIpiItemDetail(); |
| | | detail.Pid = s.Id; |
| | | detail.Gid = item.gid; |
| | |
| | | item.CreateDate = DateTime.Now; |
| | | result.Add(item); |
| | | } |
| | | |
| | | return db.Insertable(result).ExecuteCommand(); |
| | | }); |
| | | |
| | |
| | | return SqlSugarHelper.UseTransactionWithOracle(db => |
| | | { |
| | | return db.Updateable<QsItemIpiItem>() |
| | | .SetColumns(it => |
| | | it.Notes == dto.Remarks) //SetColumns是可以叠加的 写2个就2个字段赋值 |
| | | .SetColumns(it =>it.Notes == dto.Remarks) //SetColumns是可以叠加的 写2个就2个字段赋值 |
| | | .Where(it => it.Id == dto.pid) |
| | | .ExecuteCommand(); |
| | | }); |
| | |
| | | return SqlSugarHelper.UseTransactionWithOracle(db => |
| | | { |
| | | return db.Updateable<QsItemIpiItemDetail>() |
| | | .SetColumns(it => |
| | | it.Remarks == dto.Remarks) //SetColumns是可以叠加的 写2个就2个字段赋值 |
| | | .SetColumns(it =>it.Remarks == dto.Remarks) //SetColumns是可以叠加的 写2个就2个字段赋值 |
| | | .Where(it => it.Id == dto.id) |
| | | .ExecuteCommand(); |
| | | }); |
| | |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取钉钉部门 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<DingDept> getDingDept() |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | return db.Queryable<DingDept>() |
| | | .Where(b => b.NoChild== 1) |
| | | .Select(b => new DingDept |
| | | { |
| | | Id=b.Id, |
| | | Name=b.Name |
| | | }) |
| | | .ToList(); |
| | | } |
| | | |
| | | public List<DeptNode> BuildDeptTree() |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | var flatList = db.Queryable<DingDept>() |
| | | .ToList(); |
| | | var lookup = flatList.ToDictionary( |
| | | d => d.Id, |
| | | d => new DeptNode |
| | | { |
| | | Id = d.Id, |
| | | Label = d.Name, |
| | | Value = d.Id |
| | | }); |
| | | |
| | | List<DeptNode> roots = new(); |
| | | |
| | | foreach (var dept in flatList) |
| | | { |
| | | if ((dept.Pid > 0 && lookup.ContainsKey(dept.Pid))) |
| | | { |
| | | lookup[dept.Pid].Children.Add(lookup[dept.Id]); |
| | | } |
| | | else |
| | | { |
| | | // parentId 为 null 的就是根节点 |
| | | roots.Add(lookup[dept.Id]); |
| | | } |
| | | } |
| | | |
| | | return roots; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取钉钉员工 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<DingStaff> getDingUser() |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | return db.Queryable<DingStaff>() |
| | | .Select(b => new DingStaff |
| | | { |
| | | StaffName=b.StaffName, |
| | | Id=b .Id |
| | | }) |
| | | .ToList(); |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 异常处置单推送钉钉 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static AlibabaCloud.SDK.Dingtalkworkflow_1_0.Client CreateClient() |
| | | { |
| | | AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config(); |
| | | config.Protocol = "https"; |
| | | config.RegionId = "central"; |
| | | return new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Client(config); |
| | | } |
| | | |
| | | public static AlibabaCloud.SDK.Dingtalkoauth2_1_0.Client CreateClient1() |
| | | { |
| | | AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config(); |
| | | config.Protocol = "https"; |
| | | config.RegionId = "central"; |
| | | return new AlibabaCloud.SDK.Dingtalkoauth2_1_0.Client(config); |
| | | } |
| | | |
| | | |
| | | public string GetToken() |
| | | { |
| | | AlibabaCloud.SDK.Dingtalkoauth2_1_0.Client client = CreateClient1(); |
| | | AlibabaCloud.SDK.Dingtalkoauth2_1_0.Models.GetAccessTokenRequest getAccessTokenRequest = new AlibabaCloud.SDK.Dingtalkoauth2_1_0.Models.GetAccessTokenRequest |
| | | { |
| | | AppKey = "dingyzos0r1bizj7g6lr", |
| | | AppSecret = "-HP4RvK2OUbqhG3iBUpd_TPe5MZRj8cfLc0b8Skt8rhC3I38kVLY9SS8P3kLWFcH", |
| | | }; |
| | | |
| | | try |
| | | { |
| | | var response = client.GetAccessToken(getAccessTokenRequest); |
| | | return response.Body.AccessToken; // 返回获取到的 Access Token |
| | | } |
| | | catch (TeaException err) |
| | | { |
| | | Console.WriteLine($"TeaException: Code={err.Code}, Message={err.Message}"); |
| | | return null; |
| | | } |
| | | catch (Exception _err) |
| | | { |
| | | Console.WriteLine($"Exception: {_err.Message}"); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public string DingJZCSD(JzcsdData InData) |
| | | { |
| | | |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | decimal numUserId = db.Queryable<DingStaff>() |
| | | .Where(t => t.StaffName == InData.Fname) |
| | | .Select(t => t.Id) |
| | | .First(); |
| | | if (numUserId > 0) |
| | | { |
| | | string UserId = Convert.ToString(numUserId); |
| | | |
| | | |
| | | // 使用 JSON 序列化输出对象的详细内容 |
| | | string InDataJson = JsonConvert.SerializeObject(InData, Formatting.Indented); |
| | | Debug.WriteLine("InDataDetail: " + InDataJson); |
| | | |
| | | // 获取 Access Token |
| | | string accessToken = GetToken(); |
| | | if (string.IsNullOrEmpty(accessToken)) |
| | | { |
| | | return "获取 Access Token 失败"; |
| | | } |
| | | |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Client client = CreateClient(); |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceHeaders startProcessInstanceHeaders = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceHeaders(); |
| | | Debug.WriteLine(accessToken); |
| | | startProcessInstanceHeaders.XAcsDingtalkAccessToken = accessToken; // 使用获取到的 Access Token |
| | | /* |
| | | 产品型号 TextField-K2AD4O5B |
| | | 纠正事项来源 DDMultiSelectField_19MZJHE2ZWM80 |
| | | 提出人员 InnerContactField_WY9BZDYT7W00 |
| | | 提出日期 DDDateField_JD4ISXXCNLS0 |
| | | 接收部门 DepartmentField_SLLT1GL6RC00 |
| | | 负责人 InnerContactField_1I3FYOICN4N40 |
| | | 回复日期 DDDateField_1NPTPIPNEI1S0 |
| | | 问题描述 TextareaField_1FUN513WLK4G0 |
| | | 审批选择 DDSelectField_WE67NWABXM80 |
| | | */ |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues0 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | { |
| | | //产品型号 |
| | | Name = "TextField-K2AD4O5B", |
| | | Value = InData.Imodel |
| | | }; |
| | | |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues1 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | { |
| | | //纠正事项来源 |
| | | Name = "DDMultiSelectField_19MZJHE2ZWM80", |
| | | Value = InData.Source |
| | | /* Value = JsonConvert.SerializeObject(new[] { |
| | | new { value = InData.Source, label = "内部审核" } |
| | | })*/ |
| | | }; |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues2 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | { |
| | | //提出人员 |
| | | Name = "InnerContactField_WY9BZDYT7W00", |
| | | Value = UserId, |
| | | }; |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues3 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | { |
| | | //提出日期 |
| | | Name = "DDDateField_JD4ISXXCNLS0", |
| | | Value = DateTime.Now.ToString("yyyy-MM-dd"), |
| | | }; |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues4 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | { |
| | | //接收部门 |
| | | Name = "DepartmentField_SLLT1GL6RC00", |
| | | Value = InData.selectedDeptID, |
| | | }; |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues5 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | { |
| | | //负责人 |
| | | Name = "InnerContactField_1I3FYOICN4N40", |
| | | Value = InData.selectedUserID |
| | | }; |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues6 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | { |
| | | //回复日期 |
| | | Name = "DDDateField_1NPTPIPNEI1S0", |
| | | Value = InData.ReplyDate, |
| | | }; |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues7 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | { |
| | | //问题描述 |
| | | Name = "TextareaField_1FUN513WLK4G0", |
| | | Value = InData.Reason, |
| | | }; |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues8 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | { |
| | | //审批选择 |
| | | Name = "DDSelectField_WE67NWABXM80", |
| | | Value = InData.selectedADeptID, |
| | | }; |
| | | //AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues8 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | //{ |
| | | // //DDSelectField_WE67NWABXM80 |
| | | // Name = "InnerContactField_1I3FYOICN4N40", |
| | | // Value = InData.se, |
| | | //}; |
| | | //AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues9 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | //{ |
| | | // //回复日期 |
| | | // Name = "DDDateField_1NPTPIPNEI1S0", |
| | | // Value = Convert.ToString(DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()), |
| | | //}; |
| | | //AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues10 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | //{ |
| | | // //提出部门 |
| | | // Name = "DepartmentField_184EOWTFMJUK0", |
| | | // Value = "挑选内容", |
| | | //}; |
| | | //AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues11 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | //{ |
| | | // //纠正措施 |
| | | // Name = "TextareaField_1PZP4OZ8GSKG0", |
| | | // Value = InData.Action, |
| | | //}; |
| | | //AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues12 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | //{ |
| | | // //纠正措施负责人 |
| | | // Name = "InnerContactField_9PR03WUFX7O0", |
| | | // Value = ActionUserId, |
| | | //}; |
| | | //AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues13 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | //{ |
| | | // //实例ID |
| | | // Name = "api_instanceId", |
| | | // Value = accessToken, |
| | | //}; |
| | | //AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues14 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | //{ |
| | | // //计划完成时间 |
| | | // Name = "DDDateField_1G5HG8KPCY2O0", |
| | | // Value = "否", |
| | | //}; |
| | | //AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues15 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | //{ |
| | | // //提出日期 |
| | | // Name = "DDDateField_JD4ISXXCNLS0", |
| | | // Value = Convert.ToString(DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()), |
| | | //}; |
| | | //AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues16 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | //{ |
| | | // //原因分析 |
| | | // Name = "TextareaField_N3W50F154DS0", |
| | | // Value = InData., |
| | | //}; |
| | | //AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues17 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | //{ |
| | | // //产品型号 |
| | | // Name = "TextField-K2AD4O5B", |
| | | // Value = "附件", |
| | | //}; |
| | | |
| | | //AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestTargetSelectActioners targetSelectActioners0 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestTargetSelectActioners |
| | | //{ |
| | | // // |
| | | // ActionerKey = "null", |
| | | // ActionerUserIds = new List<string> |
| | | //{ |
| | | // UserId |
| | | //}, |
| | | //}; |
| | | //AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestApprovers approvers0 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestApprovers |
| | | //{ |
| | | // ActionType = "OR", |
| | | // UserIds = new List<string> |
| | | //{ |
| | | // UserId |
| | | //}, |
| | | //}; |
| | | |
| | | |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest startProcessInstanceRequest = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest |
| | | { |
| | | OriginatorUserId = UserId, |
| | | ProcessCode = "PROC-BBA5632D-DC7C-4267-A3E2-757E2B7023BC", |
| | | DeptId = 1, |
| | | FormComponentValues = new List<AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues> |
| | | { |
| | | formComponentValues1,formComponentValues2,formComponentValues3, formComponentValues4, formComponentValues5, formComponentValues6, formComponentValues7, formComponentValues8 |
| | | //formComponentValues9,formComponentValues10, formComponentValues11, formComponentValues12, formComponentValues13, formComponentValues14 |
| | | }, |
| | | // TargetSelectActioners = new List<AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestTargetSelectActioners> |
| | | //{ |
| | | // targetSelectActioners0 |
| | | //}, |
| | | // Approvers = new List<AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestApprovers> |
| | | //{ |
| | | // approvers0 |
| | | //}, |
| | | CcList = new List<string> |
| | | { |
| | | UserId |
| | | }, |
| | | CcPosition = "START", |
| | | |
| | | }; |
| | | // 序列化 FormComponentValues 列表为 JSON 格式 |
| | | string formComponentValuesJson = JsonConvert.SerializeObject(startProcessInstanceRequest.FormComponentValues, Formatting.Indented); |
| | | Debug.WriteLine("FormComponentValues: " + formComponentValuesJson); |
| | | try |
| | | { |
| | | string requestContent = Newtonsoft.Json.JsonConvert.SerializeObject(startProcessInstanceRequest); |
| | | Debug.WriteLine("startProcessInstanceRequest内容:"); |
| | | Debug.WriteLine(requestContent); |
| | | var response = client.StartProcessInstanceWithOptions(startProcessInstanceRequest, startProcessInstanceHeaders, new RuntimeOptions()); |
| | | return $"钉钉工作流实例启动成功: {Newtonsoft.Json.JsonConvert.SerializeObject(response.Body)}"; |
| | | } |
| | | catch (TeaException err) |
| | | { |
| | | string requestContent = Newtonsoft.Json.JsonConvert.SerializeObject(startProcessInstanceRequest); |
| | | Debug.WriteLine("startProcessInstanceRequest内容:"); |
| | | Debug.WriteLine(startProcessInstanceRequest); |
| | | return $"TeaException: Code={err.Code}, Message={err.Message}"; |
| | | } |
| | | catch (Exception _err) |
| | | { |
| | | return $"Exception: {_err.Message}"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return "您不是公司成员或还未被加入到数据库中或名字填写错误,未找到匹配的用户信息"; |
| | | } |
| | | } |
| | | |
| | | } |