| | |
| | | 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 |
| | | { |
| | | public partial class TaskService |
| | | { |
| | | |
| | | |
| | | /// <summary> |
| | | /// 仅申请任务,让WCS根据路由确定下一地址 |
| | |
| | | if (stockInfo.StockStatus == StockStatusEmun.合托出库完成.ObjToInt()) |
| | | { |
| | | |
| | | } |
| | | if (stockInfo.StockStatus == StockStatusEmun.盘点出库完成.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该托盘{palletCode}未盘点"); |
| | | } |
| | | ///判断是否存在回库单,进行回原库位逻辑 |
| | | string returnOrderNo = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.OrderNo; |
| | |
| | | _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(); |
| | |
| | | //查询仓库托盘货物类型 |
| | | public int GetPalletType(Dt_Warehouse warehouse, string palletCode) |
| | | { |
| | | if (warehouse.WarehouseCode == WarehouseEnum.SC01_BC.ObjToString() || warehouse.WarehouseCode == WarehouseEnum.SC02_BC.ObjToString()) |
| | | if (warehouse.WarehouseCode.Contains("BC")) |
| | | { |
| | | |
| | | Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 3)); |
| | | if (palletTypeInfo == null) |
| | | { |
| | |
| | | } |
| | | return palletTypeInfo.PalletType; |
| | | } |
| | | //else if (warehouse.WarehouseCode == WarehouseEnum.HA152.ObjToString()) |
| | | //{ |
| | | // Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 2)); |
| | | // if (palletTypeInfo == null) |
| | | // { |
| | | // throw new Exception($"托盘号错误"); |
| | | // } |
| | | // return palletTypeInfo.PalletType; |
| | | //} |
| | | //else if (warehouse.WarehouseCode == WarehouseEnum.HA57.ObjToString()) |
| | | //{ |
| | | // Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 3)); |
| | | // if (palletTypeInfo == null) |
| | | // { |
| | | // throw new Exception($"托盘号错误"); |
| | | // } |
| | | // return palletTypeInfo.PalletType; |
| | | //} |
| | | return -1; |
| | | else |
| | | { |
| | | Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 2)); |
| | | if (palletTypeInfo == null) |
| | | { |
| | | throw new Exception($"托盘号错误"); |
| | | } |
| | | return palletTypeInfo.PalletType; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | |