刘磊
2024-12-04 e3b6c01acf7228c009d861c1efea4cbcc7926abe
分容空框出库
已修改2个文件
106 ■■■■ 文件已修改
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequestChangeLocation.cs 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequestChangeLocation.cs
@@ -4,8 +4,12 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common;
using WIDESEA_Core;
using WIDESEA_Core.Enums;
using WIDESEA_DTO;
using WIDESEA_DTO.WMS;
using WIDESEA_Model.Models;
namespace WIDESEA_StoragIntegrationServices
{
@@ -24,10 +28,69 @@
                if (string.IsNullOrEmpty(json.ToString())) throw new Exception("上传参数为空");
                var result = JsonConvert.DeserializeObject<RequestReMove>(json.ToString());
                ;
                if (result.MoveType == 5) Console.WriteLine($"分容检测柜火警触发:库位{result.LocationID}");
                var location = _locationRepository.QueryFirst(x => x.AreaId == result.LocationArea && x.LocationCode == result.LocationID);
                if (location == null) throw new Exception("未知库位");
                if (result.MoveType == 5)
                {
                    Console.WriteLine($"分容检测柜火警触发:库位{result.LocationID}");
                    //查找消防站台
                    var station = _stationManagerRepository.QueryFirst(t => t.Roadway == location.RoadwayNo
                         && t.stationType == (int)StationManager.FireStation
                         /*&& t. == "Enable"*/);
                    if (station == null)
                    {
                        throw new Exception("消防站台未配置!");
                    }
                    //查找库存信息
                    var barcodeData = _stockInfoRepository.QueryFirst(t => t.LocationCode == location.LocationCode);
                    //托盘码
                    string barcode = string.Empty;
                    if (barcodeData != null)
                    {
                        barcode = barcodeData.PalletCode;
                    }
                    else
                    {
                        //无库存信息,生成随机托盘码
                        barcode = "M" + DateTime.Now.ToString("MMddHHmmss") + "-" + new Random().Next(100, 1000);
                    }
                    int taskNum = _taskRepository.GetTaskNo().Result;
                    Dt_Task task = new Dt_Task
                    {
                        CreateDate = DateTime.Now,
                        Creater = "HK",
                        CurrentAddress = result.LocationID,
                        Grade = 1,
                        Dispatchertime = DateTime.Now,
                        PalletCode = result.PalletBarcode,
                        Roadway = location.RoadwayNo,
                        SourceAddress = result.LocationID,
                        TaskState = (int)TaskOutStatusEnum.OutNew,
                        TaskType = 500,
                        TargetAddress = station.stationLocation,
                        NextAddress = station.stationChildCode,
                        TaskNum = taskNum, //_taskRepository.GetTaskNo().Result,
                        TaskId = 0,
                    };
                    // 尝试添加新任务
                    WMSTaskDTO taskDTO = new WMSTaskDTO()
                    {
                        TaskNum = task.TaskNum.Value,
                        Grade = 1,
                        PalletCode = task.PalletCode,
                        RoadWay = task.Roadway,
                        SourceAddress = task.SourceAddress,
                        TargetAddress = task.TargetAddress,
                        TaskState = task.TaskState.Value,
                        Id = 0,
                        TaskType = 500,
                    };
                }
                LogFactory.GetLog("分容移库申请").Info(true, $"\r\r--------------------------------------");
                LogFactory.GetLog("分容移库申请").Info(true, result);
                return content.OK();
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -391,24 +391,24 @@
            }
            //创建一个TrayCellsStatusDto对象,并赋值
            TrayCellsStatusDto trayCells = new TrayCellsStatusDto()
            {
                Software = "WMS",
                TrayBarcode = input.PalletCode,
                //EquipmentCode = "EQ_CWJZ01"
                EquipmentCode = input.EquiCodeMOM
            };
            //TrayCellsStatusDto trayCells = new TrayCellsStatusDto()
            //{
            //    Software = "WMS",
            //    TrayBarcode = input.PalletCode,
            //    //EquipmentCode = "EQ_CWJZ01"
            //    EquipmentCode = input.EquiCodeMOM
            //};
            // 调用GetTrayCellStatusAsync方法,获取整盘电芯
            content = await GetTrayCellStatusAsync(trayCells);
            //content = await GetTrayCellStatusAsync(trayCells);
            // 如果状态为false,则返回content
            if (!content.Status) return content;
            //if (!content.Status) return content;
            // 添加组盘信息
            // 将content.Data转换为ResultTrayCellsStatus对象
            var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
            if (result.SerialNos.Count <= 0)
                return content.Error(result.MOMMessage);
            //var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
            //if (result.SerialNos.Count <= 0)
            //    return content.Error(result.MOMMessage);
            //Console.WriteLine(result);
            //// TODO 获取本地料框属性与整盘电芯属性获取的值进行对比,如果一致则继续,否则返回错误信息
@@ -417,8 +417,8 @@
            ////    return content.Error("料框属性不存在");
            //// 调用CreateBoxingInfo方法,创建组盘信息
            var boxing = CreateBoxingInfo(result, input.PalletCode);
            if (boxing == null) return content.Error("组盘失败");
            //var boxing = CreateBoxingInfo(result, input.PalletCode);
            //if (boxing == null) return content.Error("组盘失败");
            //// 调用GetProcessApplyAsync方法,获取工艺路线
            //ProcessApplyDto process = await GetProcessApplyAsync(input, result);
@@ -436,10 +436,10 @@
            ////var processResponse = await GetProcessResponseAsync(process, input.Position);
            // 调用CreateNewTask方法,创建新任务
            content = await CreateNewTask(input);
            if (content.Status)
            {
                var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing);
            }
            //if (content.Status)
            //{
            //    var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing);
            //}
        }
        catch (Exception err)
        {
@@ -510,6 +510,8 @@
                TaskType = task.TaskType,
            };
            content.OK(data: taskDTO);
        }
        else
            content.Error("添加任务失败");
@@ -637,6 +639,7 @@
            ////// 调用GetProcessResponseAsync方法,获取工艺响应
            ////var processResponse = await GetProcessResponseAsync(process, input.Position);
            var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing);
        }
        var task = new Dt_Task