| | |
| | | using Tea; |
| | | using MES.Service.Modes.DingAPI; |
| | | using static System.Runtime.InteropServices.JavaScript.JSType; |
| | | using System; |
| | | using System.Security.Cryptography; |
| | | using SqlSugar.Extensions; |
| | | |
| | | namespace MES.Service.service.QC; |
| | | |
| | |
| | | // result = "未检测" |
| | | // }).ToList(); |
| | | // } |
| | | public List<QsItemIpiItem> SetQSItems(string itemNo) |
| | | public List<QsItemIpiItem> SetQSItems(string itemNo,string planName) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | var count = db.Queryable<MesQa>().Where(s => s.QsType == "1" |
| | | && s.ItemNo == itemNo && s.Fsubmit == 1).Count(); |
| | | && s.ItemNo == itemNo &&s.QaPlan == planName && s.Fsubmit == 1).Count(); |
| | | |
| | | if (count <= 0) return []; |
| | | |
| | | return db |
| | | //新增根据计划名称查询ID |
| | | decimal? QsId = db.Queryable<MesQa>() |
| | | .Where(s => s.QsType == "1" |
| | | && s.ItemNo == itemNo |
| | | && s.QaPlan == planName |
| | | && s.Fsubmit == 1) |
| | | .Select(s => s.Id) |
| | | .First(); |
| | | |
| | | return db //根据主表ID查询 |
| | | .Queryable<MesQualityStandard>() |
| | | .Where(b => b.QsType == "1" && b.ItemNo == itemNo).Select( |
| | | .Where(b => b.Pid == QsId).Select( |
| | | b => new QsItemIpiItem |
| | | { |
| | | ProjName = b.ProjName, |
| | |
| | | }).ToList(); |
| | | } |
| | | |
| | | public List<SJBadReason>? GetReason(string billNo) |
| | | public List<SJBadReason>? GetReason(string billNo)//纠正措施单获取不良信息 |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | |
| | | qsItemIpiItems.ForEach(s => s.Pid = item.gid); |
| | | return db.Insertable(qsItemIpiItems).ExecuteCommand(); |
| | | }); |
| | | item.Items = getQSItems(item.gid, null); |
| | | //item.Items = getQSItems(item.gid, null); |
| | | |
| | | //没有上下限的检验项目自动盘点为合格 |
| | | item.Items.ForEach(s => |
| | |
| | | item.Items = getQSItems(item.gid, null); |
| | | |
| | | return item; |
| | | } |
| | | |
| | | public List<string?> GetItemProj(string? itemNo) |
| | | { //获取物料所有的检验计划名称 |
| | | |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | var plans = db.Queryable<MesQa>().Where(a => a.ItemNo == itemNo && a.QsType == "1") |
| | | .Select(s => s.QaPlan) |
| | | .Distinct() |
| | | .ToList(); |
| | | |
| | | return plans; |
| | | } |
| | | |
| | | public (decimal?,string?, string?) CreateNew(string? DaaNo,string? userNo,string? planName) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | // 创建参数 |
| | | var FitemNo = new SugarParameter("PI_NO", DaaNo); |
| | | var FuserNo = new SugarParameter("PI_USER", userNo); |
| | | var FplanName = new SugarParameter("P_PLAN_NAME", planName); |
| | | |
| | | |
| | | var FRes = new SugarParameter("po_result", null, true); // 输出参数 |
| | | var FMsg = new SugarParameter("po_Message", null, true); |
| | | var FBillNo = new SugarParameter("po_BILL_NO", null, true); |
| | | |
| | | // 执行存储过程 |
| | | db.Ado.UseStoredProcedure().GetDataTable("PRC_PQC_ITEM_INSERT_JK", FitemNo, FuserNo, FplanName, FRes, FMsg, FBillNo); |
| | | |
| | | // 获取输出结果 |
| | | var Res = Convert.ToInt32(FRes.Value); |
| | | var Msg = FMsg.Value?.ToString(); |
| | | var BillNo = FBillNo.Value?.ToString(); |
| | | |
| | | Console.WriteLine($"结果: {Res}, 返回消息: {Msg},单据号:{BillNo}"); |
| | | |
| | | return (Res,Msg, BillNo); |
| | | } |
| | | |
| | | public int SetQSItemDetail(QsItemIpiItemDetail detail) |
| | |
| | | } |
| | | } |
| | | |
| | | public string DingJZCSD(JzcsdData InData) |
| | | public bool DingJZCSD(JzcsdData InData) |
| | | { |
| | | if (string.IsNullOrWhiteSpace(InData.Imodel)) |
| | | throw new Exception( "产品型号不能为空"); |
| | | |
| | | if (string.IsNullOrWhiteSpace(InData.selectedDeptID)) |
| | | throw new Exception("请选择接收部门"); |
| | | |
| | | if (string.IsNullOrWhiteSpace(InData.selectedUserID)) |
| | | throw new Exception("请选择负责人"); |
| | | |
| | | if (string.IsNullOrWhiteSpace(InData.ReplyDate)) |
| | | throw new Exception("回复日期不能为空"); |
| | | |
| | | if (string.IsNullOrWhiteSpace(InData.Reason)) |
| | | throw new Exception("问题描述不能为空"); |
| | | |
| | | if (string.IsNullOrWhiteSpace(InData.selectedADept)) |
| | | throw new Exception("审批部门不能为空"); |
| | | |
| | | |
| | | |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | |
| | | string accessToken = GetToken(); |
| | | if (string.IsNullOrEmpty(accessToken)) |
| | | { |
| | | return "获取 Access Token 失败"; |
| | | throw new Exception("获取 Access Token 失败"); |
| | | } |
| | | |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Client client = CreateClient(); |
| | |
| | | 问题描述 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 = "InnerContactField_WY9BZDYT7W00", |
| | | Value = UserId, |
| | | Value = "[\"" + string.Join("\",\"", UserId) + "\"]", |
| | | }; |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues3 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | { |
| | |
| | | { |
| | | //负责人 |
| | | Name = "InnerContactField_1I3FYOICN4N40", |
| | | Value = InData.selectedUserID |
| | | Value = "[\"" + string.Join("\",\"", InData.selectedUserID) + "\"]" |
| | | }; |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues6 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | { |
| | |
| | | { |
| | | //审批选择 |
| | | Name = "DDSelectField_WE67NWABXM80", |
| | | Value = InData.selectedADeptID, |
| | | Value = InData.selectedADept, |
| | | }; |
| | | //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.StartProcessInstanceRequestFormComponentValues formComponentValues9 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | { |
| | | //提出部门 |
| | | Name = "DepartmentField_184EOWTFMJUK0", |
| | | Value = "975745197",//固定为MES部门 |
| | | }; |
| | | AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues formComponentValues10 = new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models.StartProcessInstanceRequest.StartProcessInstanceRequestFormComponentValues |
| | | { |
| | | //产品型号 |
| | | Name = "TextField-K2AD4O5B", |
| | | Value = InData.Imodel, |
| | | }; |
| | | |
| | | |
| | | 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, |
| | | ProcessCode = "PROC-2752201A-3896-4CA7-82A1-ADBBE9F1B36A", |
| | | DeptId = 987012076, |
| | | 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 |
| | | 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> |
| | | //{ |
| | |
| | | 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)}"; |
| | | //var response = client.StartProcessInstanceWithOptions(startProcessInstanceRequest, startProcessInstanceHeaders, new RuntimeOptions()); |
| | | //return $"钉钉工作流实例启动成功: {Newtonsoft.Json.JsonConvert.SerializeObject(response.Body)}"; |
| | | return true; |
| | | } |
| | | catch (TeaException err) |
| | | { |
| | | string requestContent = Newtonsoft.Json.JsonConvert.SerializeObject(startProcessInstanceRequest); |
| | | Debug.WriteLine("startProcessInstanceRequest内容:"); |
| | | Debug.WriteLine(startProcessInstanceRequest); |
| | | return $"TeaException: Code={err.Code}, Message={err.Message}"; |
| | | |
| | | throw new Exception(err.Message); |
| | | //return $"TeaException: Code={err.Code}, Message={err.Message}"; |
| | | } |
| | | catch (Exception _err) |
| | | //catch (Exception _err) |
| | | //{ |
| | | // return $"Exception: {_err.Message}"; |
| | | //} |
| | | |
| | | catch (Exception ex) |
| | | { |
| | | return $"Exception: {_err.Message}"; |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return "您不是公司成员或还未被加入到数据库中或名字填写错误,未找到匹配的用户信息"; |
| | | throw new Exception("您不是公司成员或还未被加入到数据库中或名字填写错误,未找到匹配的用户信息"); |
| | | //return "您不是公司成员或还未被加入到数据库中或名字填写错误,未找到匹配的用户信息"; |
| | | } |
| | | } |
| | | |