bklLiudl
2024-09-02 9885a8a2f98104f5ee63dd5ab8023095a1d8b9f6
Wms/WMS.BLL/BllQualityServer/InspectionRequestServer.cs
@@ -5,6 +5,7 @@
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
@@ -204,41 +205,56 @@
                Db.Insertable(exTask).ExecuteCommand();
                // 调用Limes接口发起请验
                var jsonData = JsonConvert.SerializeObject(QcNoModel);
                string response = "";
                try
                {
                    var time1 = DateTime.Now;//发送时间 .ToString("yyyy-MM-dd HH:mm:ss")
                    response = HttpHelper.DoPost(url, jsonData, "上传ERP取样消耗量过账", "ERP");
                    var time2 = DateTime.Now;//返回时间 .ToString("yyyy-MM-dd HH:mm:ss")
                List<string> list1 = new List<string>();
                list1.Add(taskNo);
                //更改任务的发送返回时间//
                var time1 = DateTime.Now;//发送时间 .ToString("yyyy-MM-dd HH:mm:ss")
                var time2 = DateTime.Now;//返回时间 .ToString("yyyy-MM-dd HH:mm:ss")
                new TaskServer().EditTaskIssueOk(list1, time1, time2);
                    ////解析返回数据
                    var limesModel = JsonConvert.DeserializeObject<LimesModel>(response);
                    List<string> list1 = new List<string>();
                    list1.Add(taskNo);
                    if (limesModel.Success == 0)
                    {
                        //更改任务的发送返回时间//
                        new TaskServer().EditTaskIssueOk(list1, time1, time2);
                // 更新请验单信息
                data.Status = "2";
                data.UpdateTime = time;
                data.UpdateUser = userId;
                        // 更新请验单信息
                        data.Status = "2";
                        data.UpdateTime = time;
                        data.UpdateUser = userId;
                Db.Updateable(data).ExecuteCommand();
                        Db.Updateable(data).ExecuteCommand();
                    }
                    if (limesModel.Success == -1)
                    {
                        new TaskServer().EditTaskIssueNo(list1, time1, time2, limesModel.Message);
                        throw new Exception(limesModel.Message);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
                // 调用ERP接口回传取样消耗
                //var jsonData = JsonConvert.SerializeObject(QcNoModel);
                //string response = "";
                //try
                //{
                //    var time1 = DateTime.Now;//发送时间 .ToString("yyyy-MM-dd HH:mm:ss")
                //    response = HttpHelper.DoPost(url, jsonData, "上传ERP取样消耗量过账", "ERP");
                //    var time2 = DateTime.Now;//返回时间 .ToString("yyyy-MM-dd HH:mm:ss")
                //    ////解析返回数据
                //    var limesModel = JsonConvert.DeserializeObject<LimesModel>(response);
                //    List<string> list1 = new List<string>();
                //    list1.Add(taskNo);
                //    if (limesModel.Success == 0)
                //    {
                //        //更改任务的发送返回时间//
                //        new TaskServer().EditTaskIssueOk(list1, time1, time2);
                //        // 更新请验单信息
                //        data.Status = "2";
                //        data.UpdateTime = time;
                //        data.UpdateUser = userId;
                //        Db.Updateable(data).ExecuteCommand();
                //    }
                //    if (limesModel.Success == -1)
                //    {
                //        new TaskServer().EditTaskIssueNo(list1, time1, time2, limesModel.Message);
                //        throw new Exception(limesModel.Message);
                //    }
                //}
                //catch (Exception ex)
                //{
                //    throw new Exception(ex.Message);
                //}
                //添加操作日志记录
                var k = new OperationCrServer().AddLogOperationCr("质量管理", "质检请验", model.Code, "关单", $"关闭了{model.Code}请验单!", userId);