1
yangpeixing
15 小时以前 f1bd65a40104bdb65c93bea3b50381ab6d2c3837
1

1
已修改2个文件
127 ■■■■ 文件已修改
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs 59 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs 68 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs
@@ -1,25 +1,28 @@
using System;
using MailKit.Search;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.WebSockets;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.Enums;
using WIDESEA_Core;
using WIDESEA_Model.Models;
using WIDESEA_Core.Helper;
using Microsoft.Extensions.Logging;
using MailKit.Search;
using System.Reflection.Metadata;
using static WIDESEA_ITaskInfoService.ITaskService;
using static WIDESEA_Common.HouseInventoryIn;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using WIDESEA_Common;
using Parameter = WIDESEA_Common.Parameter;
using WIDESEA_Core.LogHelper;
using WIDESEA_DTO.Task;
using WIDESEA_Core.TaskEnum;
using WIDESEA_Model.Models.Inbound;
using WIDESEA_Common.Log;
using WIDESEA_Common.OrderEnum;
using WIDESEA_Core;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_Core.LogHelper;
using WIDESEA_Core.TaskEnum;
using WIDESEA_DTO.Task;
using WIDESEA_Model.Models;
using WIDESEA_Model.Models.Inbound;
using static WIDESEA_Common.HouseInventoryIn;
using static WIDESEA_ITaskInfoService.ITaskService;
using Parameter = WIDESEA_Common.Parameter;
namespace WIDESEA_TaskInfoService
{
@@ -353,6 +356,30 @@
                _unitOfWorkManage.BeginTran();
                int taskId = BaseDal.AddData(newTask);
                newTask.TaskId = taskId;
                List<Dt_StockInfoDetail> stockInfoDetails = stockInfo.Details;
                foreach (var stockInfoDetail in stockInfoDetails)
                {
                    WriteLog.Write_Log("API", "入库—请求LED", "请求成功", new { 请求报文 = 1 });
                    var postData = new
                    {
                        DeviceCode = newTask.CurrentAddress,    // 屏幕编号
                        MaterialCode = stockInfoDetail.MaterielCode,//物料类型
                        SendNum = stockInfoDetail.OutboundQuantity,//发料数
                        BackNum = stockInfoDetail.StockQuantity - stockInfoDetail.OutboundQuantity//回库数
                    };
                    WriteLog.Write_Log("API", "入库—请求LED", "请求成功", new { 请求报文2 = postData });
                    string json = Newtonsoft.Json.JsonConvert.SerializeObject(postData);
                    WriteLog.Write_Log("API", "入库—请求LED", "请求成功", new { 请求报文3 = json });
                    using (var client = new HttpClient())
                    {
                        var content = new StringContent(json, Encoding.UTF8, "application/json");
                        var response = client.PostAsync(LEDAPI, content).Result;
                        string result = response.Content.ReadAsStringAsync().Result;
                        WriteLog.Write_Log("API", "入库—请求LED", "请求成功", new { 请求报文 = response, 接收报文 = result });
                    }
                    WriteLog.Write_Log("API", "入库—请求LED", "请求成功", new { 请求报文 = 4 });
                }
                if (returnOrder != null)
                {
                    returnOrder.OrderStatus = InOrderStatusEnum.入库中.ObjToInt();
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -1849,7 +1849,7 @@
                                    _outboundService.NewOutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails1);
                                    AddCPRetrueOrder(stockInfo, outboundOrder, outboundOrderDetails1);
                                    AddCPRetrueOrder(task,stockInfo, outboundOrder, outboundOrderDetails1);
                                    // 区分单据数据来源更新货位状态
                                    if (outboundOrder.System == null)
@@ -2081,7 +2081,7 @@
                                    _outboundService.NewOutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails);
                                    AddCPRetrueOrder(stockInfo, outboundOrder, outboundOrderDetails);
                                    AddCPRetrueOrder(task,stockInfo, outboundOrder, outboundOrderDetails);
                                    // 区分单据数据来源更新货位状态
                                    if (outboundOrder.System == null)
@@ -2396,7 +2396,7 @@
                // 更新库存状态 回库单
                AddRetrueOrder(stockInfo, inboundOrder);
                AddRetrueOrder(task,stockInfo, inboundOrder);
                // 区分单据数据来源更新货位状态
@@ -2586,9 +2586,7 @@
                            CompeletedNum++;
                        }
                        else if (newOutboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
                        {
                            newOutboundOrderDetail.OrderDetailStatus = OutboundStatusEnum.出库中.ObjToInt();
                        {
                            inboundOrder.OrderStatus = OutboundStatusEnum.出库中.ObjToInt();
                        }
                    }
@@ -2866,7 +2864,7 @@
                App.User.UserId == 0 ? OperateType.自动完成 : OperateType.人工完成);
        }
        private void AddRetrueOrder(Dt_StockInfo stockInfo, Dt_OutboundOrder outboundOrder)
        private void AddRetrueOrder(Dt_Task task,Dt_StockInfo stockInfo, Dt_OutboundOrder outboundOrder)
        {
            Dt_StockInfoDetail stockInfoDetail = _stockService.StockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
           .Where(x => x.StockId == stockInfo.Id).First();
@@ -2890,6 +2888,26 @@
            }
            else
            {
                WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = 1 });
                var postData = new
                {
                    DeviceCode = task.NextAddress,    // 屏幕编号
                    MaterialCode = stockInfoDetail.MaterielCode,//物料类型
                    SendNum = stockInfoDetail.OutboundQuantity,//发料数
                    BackNum = stockInfoDetail.StockQuantity - stockInfoDetail.OutboundQuantity//回库数
                };
                WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文2 = postData });
                string json = Newtonsoft.Json.JsonConvert.SerializeObject(postData);
                WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文3 = json });
                using (var client = new HttpClient())
                {
                    var content = new StringContent(json, Encoding.UTF8, "application/json");
                    var response = client.PostAsync(LEDAPI, content).Result;
                    string result = response.Content.ReadAsStringAsync().Result;
                    WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = response, 接收报文 = result });
                }
                WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = 4 });
                decimal returnQuantity = stockInfoDetail.StockQuantity - stockInfoDetail.OutboundQuantity;
                if (returnQuantity > 0)
                {
@@ -2963,21 +2981,25 @@
                }
                else
                {
                    WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = 1 });
                    var postData = new
                    {
                        DeviceCode = task.NextAddress,    // 屏幕编号
                        MaterialCode = outboundOrder.Details.FirstOrDefault()?.MaterielCode,//物料类型
                        BackNum = stockInfoDetail.StockQuantity - stockInfoDetail.OutboundQuantity,//回库数
                        SendNum = outboundOrder.Details.FirstOrDefault()?.OrderQuantity//发料数
                        MaterialCode = stockInfoDetail.MaterielCode,//物料类型
                        SendNum = stockInfoDetail.OutboundQuantity,//发料数
                        BackNum = stockInfoDetail.StockQuantity - stockInfoDetail.OutboundQuantity//回库数
                    };
                    WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文2 = postData });
                    string json = Newtonsoft.Json.JsonConvert.SerializeObject(postData);
                    WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文3 = json });
                    using (var client = new HttpClient())
                    {
                        var content = new StringContent(json, Encoding.UTF8, "application/json");
                        var response = client.PostAsync(LEDAPI, content).Result;
                        string result = response.Content.ReadAsStringAsync().Result;
                        WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = response, 接收报文 = result });
                    }
                    WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = 4 });
                    bool allowCompeted = stockInfo.Details.All(x => x.StockQuantity == x.OutboundQuantity);
                    if (allowCompeted)
@@ -3038,7 +3060,7 @@
        }
        //成品回库单
        private void AddCPRetrueOrder(Dt_StockInfo stockInfo, Dt_NewOutboundOrder outboundOrder, List<Dt_NewOutboundOrderDetail> outboundOrderDetails)
        private void AddCPRetrueOrder(Dt_Task task,Dt_StockInfo stockInfo, Dt_NewOutboundOrder outboundOrder, List<Dt_NewOutboundOrderDetail> outboundOrderDetails)
        {
            List<Dt_StockInfoDetail> stockInfoDetails = _stockService.StockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
                .Where(x => x.StockId == stockInfo.Id)
@@ -3092,6 +3114,28 @@
                }
                else
                {
                    foreach(var stockInfoDetail in stockInfoDetails)
                    {
                        WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = 1 });
                        var postData = new
                        {
                            DeviceCode = task.NextAddress,    // 屏幕编号
                            MaterialCode = stockInfoDetail.MaterielCode,//物料类型
                            SendNum = stockInfoDetail.OutboundQuantity,//发料数
                            BackNum = stockInfoDetail.StockQuantity - stockInfoDetail.OutboundQuantity//回库数
                        };
                        WriteLog.Write_Log("API", "成品库入库—请求LED", "请求成功", new { 请求报文2 = postData });
                        string json = Newtonsoft.Json.JsonConvert.SerializeObject(postData);
                        WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文3 = json });
                        using (var client = new HttpClient())
                        {
                            var content = new StringContent(json, Encoding.UTF8, "application/json");
                            var response = client.PostAsync(LEDAPI, content).Result;
                            string result = response.Content.ReadAsStringAsync().Result;
                            WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = response, 接收报文 = result });
                        }
                        WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = 4 });
                    }
                    var groupedDetails = outboundOrderDetails
                        .GroupBy(d => new { d.MaterielCode, d.BatchNo })
                        .ToList();