更新代码,取消MES出库单号同步标识,平库转立库功能,寄售周期判断取消,精品标识等
已修改24个文件
1004 ■■■■■ 文件已修改
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/成品仓/AGV_CPExtend.cs 387 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/extension/outbound/extend/proOutboundOrderDetail.vue 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/extension/taskinfo/extend/relocationTask.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/views/inbound/mesProInOrder.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/views/inbound/mesProInOrderDetail.vue 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/views/outbound/proOutOrderDetail.vue 276 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSClient/src/views/stock/ProStockView.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesBagInfoModel.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IProOutOrderDetailService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IStockRepository/IProStockInfoRepository.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IProStockInfoService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_MesProInOrderDetail.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Stock/Dt_ProStockInfoDetail.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderDetailService.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/ProStockInfoRepository.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/ProStockInfoService.cs 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Reloaction.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/³ÉÆ·²Ö/AGV_CPExtend.cs
@@ -28,153 +28,33 @@
                    var newTasksIn = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && x.TaskType>=TaskTypeEnum.Inbound.ObjToInt() && nameof(AGV_CPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode) && x.TaskType!=999).ToList().OrderByDescending(x => x.Grade).ThenBy(x => x.CreateDate).ToList();
                    if (newTasksIn.Count>0)
                    {
                        foreach (var task in newTasksIn)
                        {
                            try
                            {
                                if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                                    task.CurrentAddress = GetAGVAddress(task.CurrentAddress);
                                else
                                    task.NextAddress = GetAGVAddress(task.NextAddress);
                                AgvTaskDTO taskDTO = new AgvTaskDTO()
                                {
                                    TaskCode = task.AgvTaskNum,
                                    ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum,
                                    TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR",
                                    ctnrCode = task.PalletCode,
                                    PositionCodePath = new List<CodePath>()
                                    {
                                        new CodePath()
                                        {
                                            type = "05",
                                            positionCode = task.CurrentAddress
                                        },
                                        new CodePath()
                                        {
                                            type = "05",
                                            positionCode = task.NextAddress
                                        }
                                    }
                                };
                                if (taskDTO.TaskTyp== "CPC")
                                {
                                    taskDTO.Priority = task.Grade.ToString();
                                }
                                if (task.GroupId.IsNotEmptyOrNull())
                                {
                                    taskDTO.GroupId=task.GroupId;
                                }
                                if (task.TaskType==TaskTypeEnum.OutMesRworkProduct.ObjToInt())
                                {
                                    taskDTO.Priority = "127";
                                }
                                //发送AGV任务
                                WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask);
                                if (!content.Status)
                                    throw new Exception(content.Message);
                                if (taskDTO.TaskTyp == "CPC")
                                {
                                    task.Dispatchertime = DateTime.Now;
                                    _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing);
                                }
                                else
                                {
                                    task.Dispatchertime = DateTime.Now;
                                    _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing);
                                }
                                Thread.Sleep(500);
                            }
                            catch (Exception ex)
                            {
                                task.TaskState = TaskStatusEnum.Exception.ObjToInt();
                                task.ExceptionMessage = ex.Message;
                            }
                        }
                        if (newTasksIn.Count > 0)
                        {
                            _taskService.UpdateData(newTasksIn);
                        }
                        SendAgvTasks(newTasksIn);
                    }
                }
                #endregion
                DateTime _taskStartTime = DateTime.Today;
                #region å‡ºåº“推送任务1线
                {
                    var newTasksOut1 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress=="5236").OrderByDescending(x => x.Grade).ThenBy(x => x.GroupId).Take(5).ToList();
                    //按时间查找
                    var timeTasksOut1 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5236" && x.CreateDate<= _taskStartTime).OrderByDescending(x => x.Grade).ThenBy(x => x.CreateDate).Take(5).ToList();
                    //新创建任务
                    var newTasksOut1 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress=="5236").OrderByDescending(x => x.Grade).ThenBy(x => x.CreateDate).Take(5).ToList();
                    var pushTasks1= timeTasksOut1.Count<=0 ? newTasksOut1 : timeTasksOut1;
                    //当前线体任务
                    var downTasksOut1 = AllTasks.Where(x => (x.TaskState > TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5236").ToList();
                    Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.AGVStationCode == "5236");
                    IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
                    if (device != null)
                    {
                        OtherDevice otherDevice = (OtherDevice)device;
                        short stationCurrentStatus = device.Communicator.Read<short>("DB29.112");
                        if (newTasksOut1.Count > 0 && downTasksOut1.Count <= 0 && stationCurrentStatus == 1)
                        if (pushTasks1.Count > 0 && downTasksOut1.Count <= 0 && stationCurrentStatus == 1)
                        {
                            foreach (var task in newTasksOut1)
                            {
                                try
                                {
                                    if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                                        task.CurrentAddress = GetAGVAddress(task.CurrentAddress);
                                    else
                                        task.NextAddress = GetAGVAddress(task.NextAddress);
                                    AgvTaskDTO taskDTO = new AgvTaskDTO()
                                    {
                                        TaskCode = task.AgvTaskNum,
                                        ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum,
                                        TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR",
                                        ctnrCode = task.PalletCode,
                                        PositionCodePath = new List<CodePath>()
                                    {
                                        new CodePath()
                                        {
                                            type = "05",
                                            positionCode = task.CurrentAddress
                                        },
                                        new CodePath()
                                        {
                                            type = "05",
                                            positionCode = task.NextAddress
                                        }
                                    }
                                    };
                                    if (taskDTO.TaskTyp == "CPC")
                                    {
                                        taskDTO.Priority = task.Grade.ToString();
                                    }
                                    if (task.GroupId.IsNotEmptyOrNull())
                                    {
                                        taskDTO.GroupId = task.GroupId;
                                    }
                                    if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt())
                                    {
                                        taskDTO.Priority = "127";
                                    }
                                    //发送AGV任务
                                    WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask);
                                    if (!content.Status)
                                        throw new Exception(content.Message);
                                    if (taskDTO.TaskTyp == "CPC")
                                    {
                                        task.Dispatchertime = DateTime.Now;
                                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing);
                                    }
                                    else
                                    {
                                        task.Dispatchertime = DateTime.Now;
                                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    task.TaskState = TaskStatusEnum.Exception.ObjToInt();
                                    task.ExceptionMessage = ex.Message;
                                }
                            }
                            if (newTasksOut1.Count > 0)
                            {
                                _taskService.UpdateData(newTasksOut1);
                            }
                            WriteInfo("5236", $"1线5236无任务,状态{stationCurrentStatus}可下发,下发任务:{newTasksOut1.Select(x => x.TaskNum)}");
                            SendAgvTasks(pushTasks1);
                            WriteInfo("5236", $"1线5236无任务,状态{stationCurrentStatus}可下发,下发任务:{pushTasks1.Select(x => x.TaskNum)}");
                        }
                    }
                    
@@ -182,174 +62,56 @@
                #endregion
                #region å‡ºåº“推送任务2线
                {
                    var newTasksOut2 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5243").OrderByDescending(x => x.Grade).ThenBy(x => x.GroupId).Take(5).ToList();
                    //按时间查找
                    var timeTasksOut2 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5243" && x.CreateDate <= _taskStartTime).OrderByDescending(x => x.Grade).ThenBy(x => x.CreateDate).Take(5).ToList();
                    //新创建任务
                    var newTasksOut2 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5243").OrderByDescending(x => x.Grade).ThenBy(x => x.CreateDate).Take(5).ToList();
                    var pushTasks2 = timeTasksOut2.Count <= 0 ? newTasksOut2 : timeTasksOut2;
                    //当前线体任务
                    var downTasksOut2 = AllTasks.Where(x => (x.TaskState > TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5243").ToList();
                    Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.AGVStationCode == "5243");
                    IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
                    if (device != null)
                    {
                        OtherDevice otherDevice = (OtherDevice)device;
                        short stationCurrentStatus = device.Communicator.Read<short>("DB29.126");
                        if (newTasksOut2.Count > 0 && downTasksOut2.Count <= 0 && stationCurrentStatus == 1)
                        if (pushTasks2.Count > 0 && downTasksOut2.Count <= 0 && stationCurrentStatus == 1)
                        {
                            foreach (var task in newTasksOut2)
                            {
                                try
                                {
                                    if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                                        task.CurrentAddress = GetAGVAddress(task.CurrentAddress);
                                    else
                                        task.NextAddress = GetAGVAddress(task.NextAddress);
                                    AgvTaskDTO taskDTO = new AgvTaskDTO()
                                    {
                                        TaskCode = task.AgvTaskNum,
                                        ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum,
                                        TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR",
                                        ctnrCode = task.PalletCode,
                                        PositionCodePath = new List<CodePath>()
                                    {
                                        new CodePath()
                                        {
                                            type = "05",
                                            positionCode = task.CurrentAddress
                                        },
                                        new CodePath()
                                        {
                                            type = "05",
                                            positionCode = task.NextAddress
                                        }
                                    }
                                    };
                                    if (taskDTO.TaskTyp == "CPC")
                                    {
                                        taskDTO.Priority = task.Grade.ToString();
                                    }
                                    if (task.GroupId.IsNotEmptyOrNull())
                                    {
                                        taskDTO.GroupId = task.GroupId;
                                    }
                                    if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt())
                                    {
                                        taskDTO.Priority = "127";
                                    }
                                    //发送AGV任务
                                    WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask);
                                    if (!content.Status)
                                        throw new Exception(content.Message);
                                    if (taskDTO.TaskTyp == "CPC")
                                    {
                                        task.Dispatchertime = DateTime.Now;
                                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing);
                                    }
                                    else
                                    {
                                        task.Dispatchertime = DateTime.Now;
                                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    task.TaskState = TaskStatusEnum.Exception.ObjToInt();
                                    task.ExceptionMessage = ex.Message;
                                }
                            }
                            if (newTasksOut2.Count > 0)
                            {
                                _taskService.UpdateData(newTasksOut2);
                            }
                            WriteInfo("5243", $"2线5243无任务,状态{stationCurrentStatus}可下发,下发任务:{newTasksOut2.Select(x => x.TaskNum)}");
                            SendAgvTasks(pushTasks2);
                            WriteInfo("5243", $"2线5243无任务,状态{stationCurrentStatus}可下发,下发任务:{pushTasks2.Select(x => x.TaskNum)}");
                        }
                        //else
                        //{
                        //    WriteInfo(nameof(AGV_CPJob), $"2线无任务,状态{stationCurrentStatus}");
                        //}
                    }
                }
                #endregion
                #region å‡ºåº“推送任务3线
                {
                    var newTasksOut3 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5250").OrderByDescending(x => x.Grade).ThenBy(x => x.GroupId).Take(5).ToList();
                    //按时间查找
                    var timeTasksOut3 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5250" && x.CreateDate <= _taskStartTime).OrderByDescending(x => x.Grade).ThenBy(x => x.CreateDate).Take(5).ToList();
                    //新创建任务
                    var newTasksOut3 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5250").OrderByDescending(x => x.Grade).ThenBy(x => x.CreateDate).Take(5).ToList();
                    var pushTasks3 = timeTasksOut3.Count <= 0 ? newTasksOut3 : timeTasksOut3;
                    //当前线体任务
                    var downTasksOut3 = AllTasks.Where(x => (x.TaskState > TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5250").ToList();
                    Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.AGVStationCode == "5250");
                    IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
                    if (device != null)
                    {
                        OtherDevice otherDevice = (OtherDevice)device;
                        short stationCurrentStatus = device.Communicator.Read<short>("DB29.140");
                        if (newTasksOut3.Count > 0 && downTasksOut3.Count <= 0 && stationCurrentStatus == 1)
                        if (pushTasks3.Count > 0 && downTasksOut3.Count <= 0 && stationCurrentStatus == 1)
                        {
                            foreach (var task in newTasksOut3)
                            {
                                try
                                {
                                    if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                                        task.CurrentAddress = GetAGVAddress(task.CurrentAddress);
                                    else
                                        task.NextAddress = GetAGVAddress(task.NextAddress);
                                    AgvTaskDTO taskDTO = new AgvTaskDTO()
                                    {
                                        TaskCode = task.AgvTaskNum,
                                        ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum,
                                        TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR",
                                        ctnrCode = task.PalletCode,
                                        PositionCodePath = new List<CodePath>()
                                    {
                                        new CodePath()
                                        {
                                            type = "05",
                                            positionCode = task.CurrentAddress
                                        },
                                        new CodePath()
                                        {
                                            type = "05",
                                            positionCode = task.NextAddress
                                        }
                                    }
                                    };
                                    if (taskDTO.TaskTyp == "CPC")
                                    {
                                        taskDTO.Priority = task.Grade.ToString();
                                    }
                                    if (task.GroupId.IsNotEmptyOrNull())
                                    {
                                        taskDTO.GroupId = task.GroupId;
                                    }
                                    if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt())
                                    {
                                        taskDTO.Priority = "127";
                                    }
                                    //发送AGV任务
                                    WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask);
                                    if (!content.Status)
                                        throw new Exception(content.Message);
                                    if (taskDTO.TaskTyp == "CPC")
                                    {
                                        task.Dispatchertime = DateTime.Now;
                                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing);
                                    }
                                    else
                                    {
                                        task.Dispatchertime = DateTime.Now;
                                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    task.TaskState = TaskStatusEnum.Exception.ObjToInt();
                                    task.ExceptionMessage = ex.Message;
                                }
                            }
                            if (newTasksOut3.Count > 0)
                            {
                                _taskService.UpdateData(newTasksOut3);
                            }
                            WriteInfo("5250", $"3线5250无任务,状态{stationCurrentStatus}可下发,下发任务:{newTasksOut3.Select(x => x.TaskNum)}");
                            SendAgvTasks(pushTasks3);
                            WriteInfo("5250", $"3线5250无任务,状态{stationCurrentStatus}可下发,下发任务:{pushTasks3.Select(x => x.TaskNum)}");
                        }
                        //else
                        //{
                        //    WriteInfo(nameof(AGV_CPJob), $"3线无任务,状态{stationCurrentStatus}");
                        //}
                    }
                }
@@ -498,6 +260,75 @@
            }
        }
        /// <summary>
        /// ä¸‹å‘AGV任务
        /// </summary>
        /// <param name="tasks"></param>
        public void SendAgvTasks(List<Dt_Task> tasks)
        {
            foreach (var task in tasks)
            {
                try
                {
                    if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                        task.CurrentAddress = GetAGVAddress(task.CurrentAddress);
                    else
                        task.NextAddress = GetAGVAddress(task.NextAddress);
                    AgvTaskDTO taskDTO = new AgvTaskDTO()
                    {
                        TaskCode = task.AgvTaskNum,
                        ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum,
                        TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR",
                        ctnrCode = task.PalletCode,
                        PositionCodePath = new List<CodePath>()
                                    {
                                        new CodePath()
                                        {
                                            type = "05",
                                            positionCode = task.CurrentAddress
                                        },
                                        new CodePath()
                                        {
                                            type = "05",
                                            positionCode = task.NextAddress
                                        }
                                    }
                    };
                    if (taskDTO.TaskTyp == "CPC")
                    {
                        taskDTO.Priority = task.Grade.ToString();
                    }
                    if (task.GroupId.IsNotEmptyOrNull())
                    {
                        taskDTO.GroupId = task.GroupId;
                    }
                    if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt())
                    {
                        taskDTO.Priority = "127";
                    }
                    //发送AGV任务
                    WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask);
                    if (!content.Status)
                        throw new Exception(content.Message);
                    if (taskDTO.TaskTyp == "CPC")
                    {
                        task.Dispatchertime = DateTime.Now;
                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing);
                    }
                    else
                    {
                        task.Dispatchertime = DateTime.Now;
                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing);
                    }
                }
                catch (Exception ex)
                {
                    task.TaskState = TaskStatusEnum.Exception.ObjToInt();
                    task.ExceptionMessage = ex.Message;
                    _taskService.UpdateTask(task, TaskStatusEnum.Exception);
                }
            }
        }
        /// <summary>
        /// èŽ·å–AGV地址
        /// </summary>
        /// <param name="Address"></param>
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/extension/outbound/extend/proOutboundOrderDetail.vue
@@ -4,8 +4,8 @@
      v-model="dialogFormVisible"
      :on-model-close="closeCustomModel"
      :lazy="true"
      width="20%"
      :padding="15"
      width="25%"
      :padding="20"
      title="选择出库线体"
    >   
        <div> 
@@ -187,6 +187,7 @@
      formFields1: {
        LineCode: "",
        Grade: "0",
        IsFineWorks: "0",
      },
      formRules1:[[
          {
@@ -208,6 +209,15 @@
          {
            title: "是否优先",
            field: "Grade",
            data: [],
            required: false,
            type: "switch",
          },
        ],
          [
          {
            title: "指定精品",
            field: "IsFineWorks",
            data: [],
            required: false,
            type: "switch",
@@ -489,12 +499,13 @@
      var keys = this.selection.map((item) => item.id); // èŽ·å–é€‰ä¸­è¡Œçš„id
      this.http
        .post("api/Task/OutProductTask?stationCode="+this.formFields1.LineCode +"&grade="+this.formFields1.Grade, keys, "数据处理中")
        .post("api/Task/OutProductTask?stationCode="+this.formFields1.LineCode +"&grade="+this.formFields1.Grade+"&isFineWorks="+this.formFields1.isFineWorks, keys, "数据处理中")
        .then((x) => {
          if (!x.status) return this.$message.error(x.message);
          this.$message.success("操作成功");
          this.formFields1.LineCode="";
          this.formFields1.Grade="0";
          this.formFields1.isFineWorks="0";
          this.dialogFormVisible=false;
          this.$parent.refresh();
          this.showDetialBox = false;
@@ -558,6 +569,7 @@
    closeCustomModel() {
      this.formFields1.LineCode="";
      this.formFields1.Grade="0";
      this.formFields1.isFineWorks="0";
          this.dialogFormVisible=false;
          this.$parent.refresh();
    },
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/extension/taskinfo/extend/relocationTask.vue
@@ -5,7 +5,7 @@
        :lazy="true"
        width="600px"
        :padding="15"
        title="打印"
        title="手动移库"
      >
        <div>
          <el-form>
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/views/inbound/mesProInOrder.vue
@@ -244,6 +244,14 @@
        width: 150,
        align: "left",
      },
      {
          field: "isFineWorks",
          title: "是否精品",
          type: "string",
          width: 80,
          align: "left",
          bind: { key: "enableEnum", data: [] },
        },
    {
        field: "overInQuantity",
        title: "上架数量",
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/views/inbound/mesProInOrderDetail.vue
@@ -18,79 +18,46 @@
      sortName: "id",
    });
    const editFormFields = ref({
      deviceCode: "",
      deviceName: "",
      deviceType: "",
      deviceStatus: "",
      deviceIp: "",
      devicePort: "",
      devicePlcType: "",
      deviceRemark: "",
    });
    const editFormOptions = ref([
      [
        {
          title: "物料编号",
          required: true,
          field: "materielCode",
          type: "string",
        },
        {
          title: "单据编号",
          required: true,
          field: "materielName",
          type: "string",
        },
        {
          title: "批次号",
          required: true,
          field: "orderNo",
          type: "string",
        },
        {
          title: "序列号",
          required: true,
          field: "serialNumber",
          type: "string",
        },
      ],
      ]
    ]);
    const searchFormFields = ref({
      materielCode: "",
      materielName: "",
      orderNo: "",
      bagNo: "",
      productCode: "",
      isFineWorks: "",
      productVersion: "",
      dateCode: "",
      lotNumber: "",
      saleOrder: "",
      createDate: "",
    });
    const searchFormOptions = ref([
      [
        { title: "物料编号", field: "materielCode" },
        { title: "物料名称", field: "materielName" },
        { title: "单据编号", field: "orderNo" },
        { title: "内包号", field: "bagNo",type:"like" },
        { title: "产品编码", field: "productCode", type: "like" },
        { title: "是否精品", field: "isFineWorks" ,type: "select",
          dataKey: "enableEnum",
          data: [],},
        { title: "版本", field: "productVersion",type:"like" },
      ],
      [
        { title: "周期", field: "dateCode", type: "like" },
        { title: "批次", field: "lotNumber" , type: "like"},
        { title: "ERP工单", field: "saleOrder" , type: "like"},
        { title: "创建时间", field: "createDate", type: "datetime" },
      ],
    ]);
    const columns = ref([
      {
        field: "id",
        title: "Id",
        type: "int",
        width: 90,
        hidden: true,
        readonly: true,
        require: true,
        align: "left",
      },
      {
        field: "orderId",
        title: "入库单主键",
        type: "string",
        width: 90,
        align: "left",
      },
      {
        field: "bagNo",
        title: "内包号",
        type: "string",
        width: 150,
        width: 180,
        align: "left",
      },
      {
@@ -100,6 +67,14 @@
        width: 150,
        align: "left",
      },
      {
          field: "isFineWorks",
          title: "是否精品",
          type: "string",
          width: 80,
          align: "left",
          bind: { key: "enableEnum", data: [] },
        },
    {
        field: "overInQuantity",
        title: "上架数量",
@@ -190,12 +165,6 @@
        type: "string",
        width: 200,
        align: "left",
      }, {
        field: "remark",
        title: "备注",
        type: "string",
        width: 200,
        align: "left",
      },
      {
        field: "creater",
@@ -217,6 +186,7 @@
        type: "string",
        width: 100,
        align: "left",
        hidden: true,
      },
      {
        field: "modifyDate",
@@ -224,6 +194,7 @@
        type: "datetime",
        width: 160,
        align: "left",
        hidden: true,
      },
      {
        field: "remark",
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/views/outbound/proOutOrderDetail.vue
@@ -85,176 +85,132 @@
      ],
    ]);
    const searchFormFields = ref({
      deviceCode: "",
      pCode: "",
      deviceType: "",
      deviceStatus: "",
    });
    const searchFormOptions = ref([
      [
        { title: "设备编号", field: "deviceCode" },
        { title: "产品编码", field: "pCode", type: "like" },
        { title: "设备类型", field: "deviceType" },
        { title: "设备状态", field: "deviceStatus" },
      ],
    ]);
    const columns = ref([
      {
        field: "id",
        title: "Id",
        type: "int",
        width: 90,
        hidden: true,
        readonly: true,
        align: "left",
      },
      {
        field: "proOrderId",
        title: "出库单主键",
        type: "string",
        width: 90,
        align: "left",
        hidden: true,
      },
      {
        field: "rowId",
        title: "出库单行号",
        type: "int",
        width: 150,
        align: "left",
      },
      {
        field: "proOrderDetailStatus",
        title: "订单明细状态",
        type: "int",
        width: 180,
        align: "left",
      },
      {
        field: "saleOrder",
        title: "销售订单号",
        type: "string",
        width: 150,
        align: "left",
      },
      {
        field: "customer",
        title: "客户",
        type: "string",
        width: 90,
        align: "left",
      },
      {
        field: "factoryCode",
        title: "工厂",
        type: "string",
        width: 90,
        align: "left",
      },
      {
        field: "pCode",
        title: "产品编码",
        type: "string",
        width: 120,
        align: "left",
      },
      {
        field: "dateCode",
        title: "产品周期",
        type: "string",
        width: 120,
        align: "left",
      },
      {
        field: "pVer",
        title: "产品版本",
        type: "string",
        width: 200,
        align: "left",
      },
      {
        field: "pLot",
        title: "产品批次",
        type: "string",
        width: 200,
        align: "left",
      },
      {
        field: "qtyPcs",
        title: "合格PCS数",
        type: "string",
        width: 120,
        align: "left",
      },
      {
        field: "overQtyPcs",
        title: "已出数量",
        type: "string",
        width: 120,
        align: "left",
      },
      {
        field: "xQty",
        title: "x板数",
        type: "string",
        width: 120,
        align: "left",
      },
      {
        field: "xSite",
        title: "x板位",
        type: "string",
        width: 120,
        align: "left",
      },
      {
        field: "unit",
        title: "单位",
        type: "string",
        width: 120,
        align: "left",
      },
      {
        field: "spareQty",
        title: "备品数",
        type: "string",
        width: 120,
        align: "left",
      },
      {
        field: "creater",
        title: "创建人",
        type: "string",
        width: 90,
        align: "left",
      },
      {
        field: "createDate",
        title: "创建时间",
        type: "datetime",
        width: 160,
        align: "left",
      },
      {
        field: "modifier",
        title: "修改人",
        type: "string",
        width: 100,
        align: "left",
      },
      {
        field: "modifyDate",
        title: "修改时间",
        type: "datetime",
        width: 160,
        align: "left",
      },
      {
        field: "remark",
        title: "备注",
        type: "string",
        width: 100,
        align: "left",
      },
    {
          field: "id",
          title: "Id",
          type: "int",
          width: 90,
          hidden: true,
          readonly: true,
          require: true,
          align: "left",
        },
        {
          field: "proOrderId",
          title: "出库单主键",
          type: "string",
          width: 90,
          align: "left",
          hidden: true,
        },
        {
          field: "pCode",
          title: "产品编码",
          type: "string",
          width: 150,
          align: "left",
        },
        {
          field: "pVer",
          title: "产品版本",
          type: "string",
          width: 90,
          align: "left",
        },
        {
          field: "saleOrder",
          title: "销售订单号",
          type: "string",
          width: 90,
          align: "left",
        },
        {
          field: "orderQuantity",
          title: "单据数量",
          type: "string",
          width: 90,
          align: "left",
          edit: { type: "number" },
          required: true,
        },
        {
          field: "rowNo",
          title: "行号",
          type: "string",
          width: 90,
          align: "left",
          edit: { type: "number" },
          required: true,
        },
        {
          field: "lockQuantity",
          title: "锁定数量",
          type: "int",
          width: 120,
          align: "left",
        },
        {
          field: "overOutQuantity",
          title: "已出数量",
          type: "string",
          width: 200,
          align: "left",
        },
        {
          field: "proOrderDetailStatus",
          title: "订单明细状态",
          type: "string",
          width: 180,
          align: "left",
          bind: { key: "orderDetailStatusEnum", data: [] },
        },
        {
          field: "creater",
          title: "创建人",
          type: "string",
          width: 90,
          align: "left",
        },
        {
          field: "createDate",
          title: "创建时间",
          type: "datetime",
          width: 160,
          align: "left",
        },
        {
          field: "modifier",
          title: "修改人",
          type: "string",
          width: 100,
          align: "left",
        },
        {
          field: "modifyDate",
          title: "修改时间",
          type: "datetime",
          width: 160,
          align: "left",
        },
        {
          field: "remark",
          title: "备注",
          type: "string",
          width: 100,
          align: "left",
        },
    ]);
    const detail = ref({
      cnName: "#detailCnName",
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/views/stock/ProStockView.vue
@@ -108,6 +108,14 @@
          align: "left",
          bind: { key: "proStockAttributeEnum", data: [] },
        },
        {
          field: "isFineWorks",
          title: "是否精品",
          type: "string",
          width: 80,
          align: "left",
          bind: { key: "enableEnum", data: [] },
        },
        // {
        //   field: "roadwayNo",
        //   title: "巷道编号",
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesBagInfoModel.cs
@@ -33,7 +33,7 @@
        public List<MESBagDetail> BagDetails { get; set; }
    }
    /// <summary>
    /// MES内包入库
    /// MES外包入库
    /// </summary>
    public class MesBoxInfoModel
    {
@@ -103,6 +103,10 @@
        /// å†…包明细
        /// </summary>
        public List<MESBagItem> BagItems { get; set; }
        /// <summary>
        /// æ˜¯å¦ç²¾å“
        /// </summary>
        public int IsFineWorks { get; set; }
    }
    /// <summary>
    /// å†…包明细
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IProOutOrderDetailService.cs
@@ -17,7 +17,7 @@
        /// <summary>
        /// åˆ†é…åº“存处理货位数据
        /// </summary>
        (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(List<Dt_ProOutOrderDetail> proOutOrderDetails);
        (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(List<Dt_ProOutOrderDetail> proOutOrderDetails, bool isFineWorks = false);
        /// <summary>
        /// å‡ºåº“任务数据处理
        /// </summary>
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_IStockRepository/IProStockInfoRepository.cs
@@ -13,7 +13,7 @@
        /// <summary>
        /// æŸ¥æ‰¾å¯ç”¨åº“å­˜
        /// </summary>
        List<Dt_ProStockInfo> GetProStocks(Dt_ProOutOrderDetail proOutOrderDetail,List<string> locationInfos);
        List<Dt_ProStockInfo> GetProStocks(Dt_ProOutOrderDetail proOutOrderDetail,List<string> locationInfos, bool isFineWorks = false);
        /// <summary>
        /// èŽ·å–æˆå“åº“å­˜
        /// </summary>
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IProStockInfoService.cs
@@ -22,7 +22,7 @@
        /// <summary>
        /// æŸ¥æ‰¾å¯ç”¨åº“å­˜
        /// </summary>
        List<Dt_ProStockInfo> GetUseableStocks(int warehoseId, Dt_ProOutOrderDetail proOutOrderDetail);
        List<Dt_ProStockInfo> GetUseableStocks(int warehoseId, Dt_ProOutOrderDetail proOutOrderDetail, bool isFineWorks = false);
        /// <summary>
        /// èŽ·å–å‡ºåº“åº“å­˜
        /// </summary>
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs
@@ -337,7 +337,7 @@
        /// MES成品内包信息接收
        /// </summary>
        /// <returns></returns>
        MesResponseContent BagInfoSync(MesBagInfoModel bagInfoModel);
        MesResponseContent BagInfoSync(MesBagInfoModel bagInfoModel, string formSign = "");
        /// <summary>
        /// MES成品外包信息接收
        /// </summary>
@@ -377,7 +377,7 @@
        /// <param name="ProOutNo">出库订单号</param>
        /// <param name="StationCode">站台地址</param>
        /// <returns></returns>
        Task<WebResponseContent> OutProductTask(int[] keys, string StationCode, int Grade);
        Task<WebResponseContent> OutProductTask(int[] keys, string StationCode, int Grade, bool isFineWorks = false);
        Task<WebResponseContent> OutProScrapTask(int[] keys, string StationCode, int Grade);
        /// <summary>
        /// æˆå“ä½™æ–™é€€åº“入仓
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs
@@ -194,10 +194,9 @@
                    {
                        //float stockMaxQty = stockInfo.Details.Max(x => x.StockQuantity);
                        //float stockMinQty = stockInfo.Details.Min(x => x.StockQuantity);
                        Dt_StockInfoDetail? addstockInfoDetail = stockInfo.Details?.FirstOrDefault();
                        addstockInfoDetail.Id = 0;
                        addstockInfoDetail.StockQuantity = (takeStockOrderDetail.Qty - takeStockOrderDetail.SysQty);
                        addStockDetails.Add(addstockInfoDetail);
                        Dt_StockInfoDetail addstockInfoDetail = stockInfo.Details.OrderByDescending(x=>x.Id).FirstOrDefault();
                        addstockInfoDetail.StockQuantity = takeStockOrderDetail.Qty;
                        updateStockDetails.Add(addstockInfoDetail);
                    }
                    else if (takeStockOrderDetail.Qty==0) //盘亏
                    {
@@ -266,14 +265,6 @@
                    {
                        _stockInfoDetailRepository.DeleteAndMoveIntoHty(delStockDetails, App.User.UserId == 0 ? OperateTypeEnum.自动完成 : OperateTypeEnum.人工完成);
                    }
                    if (addStockDetails.Count>0)
                    {
                        addStockDetails.ForEach(x =>
                        {
                            x.Status = StockStatusEmun.盘点库存完成.ObjToInt();
                        });
                        _stockInfoDetailRepository.AddData(addStockDetails);
                    }
                    if (updateStockDetails.Count>0)
                    {
                        updateStockDetails.ForEach(x =>
@@ -299,12 +290,12 @@
                            Createtime = takeStockOrder.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"),
                            Details = new List<TakeDetailsItem>()
                        };
                        foreach (var item in takeStockOrderDetails)
                        foreach (var item in takeStockOrderDetails.Where(x=>x.Qty!=x.SysQty))
                        {
                            TakeDetailsItem takeDetailsItem = new TakeDetailsItem()
                            {
                                MaterialsCode = item.MaterielCode,
                                LocationCode = item.LocationCode,
                                LocationCode = warehouse.WarehouseCode,
                                Lotno = item.BatchNo,
                                Sysqty = item.SysQty.ObjToDecimal(),
                                Qty = item.Qty.ObjToDecimal()
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_MesProInOrderDetail.cs
@@ -102,6 +102,11 @@
        [SugarColumn(IsNullable = true, ColumnDescription = "包装时间")]
        public DateTime PackingDate { get; set; }
        /// <summary>
        /// æ˜¯å¦ç²¾å“
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "是否精品")]
        public int IsFineWorks { get; set; }
        /// <summary>
        /// å¤‡æ³¨
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "备注")]
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Stock/Dt_ProStockInfoDetail.cs
@@ -137,6 +137,11 @@
        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "销售指派版本")]
        public string SpecifyVer { get; set; }
        /// <summary>
        /// æ˜¯å¦ç²¾å“
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "是否精品")]
        public int IsFineWorks { get; set; }
        /// <summary>
        /// å¤‡æ³¨
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "备注")]
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderDetailService.cs
@@ -95,7 +95,7 @@
        /// <summary>
        /// åˆ†é…åº“存处理货位数据
        /// </summary>
        public (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(List<Dt_ProOutOrderDetail> proOutOrderDetails)
        public (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(List<Dt_ProOutOrderDetail> proOutOrderDetails, bool isFineWorks = false)
        {
            List<Dt_ProStockInfo> outStocks = new List<Dt_ProStockInfo>();
            List<Dt_OutProStockInfo> outProStockInfos = new List<Dt_OutProStockInfo>();
@@ -110,7 +110,7 @@
            {
                float needQty = item.QtyPcs;
                //查找可用库存
                List<Dt_ProStockInfo> stockInfoss = _stockInfoService.ProStockInfoService.GetUseableStocks(proOutOrder.WarehouseId, item);
                List<Dt_ProStockInfo> stockInfoss = _stockInfoService.ProStockInfoService.GetUseableStocks(proOutOrder.WarehouseId, item, isFineWorks);
                if (!stockInfoss.Any())
                {
                    throw new Exception("未找到可分配库存");
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/ProStockInfoRepository.cs
@@ -22,11 +22,10 @@
            _basicRepository = basicRepository;
        }
        //根据明细数据查找可用库存库存
        public List<Dt_ProStockInfo> GetProStocks(Dt_ProOutOrderDetail proOutOrderDetail,List<string> locationInfos)
        public List<Dt_ProStockInfo> GetProStocks(Dt_ProOutOrderDetail proOutOrderDetail,List<string> locationInfos, bool isFineWorks = false)
        {
            List<Dt_ProStockInfo>? proStockInfos = null;
            bool isCanLot= string.IsNullOrEmpty(proOutOrderDetail.PLot);
            bool isCanDate = string.IsNullOrEmpty(proOutOrderDetail.DateCode);
            bool isCanVer = string.IsNullOrEmpty(proOutOrderDetail.OutSpecifyVer);
            ////判断客户出入规则
            //Dt_CustomerInfo customerInfo = _basicRepository.CustomerInfoRepository.QueryFirst(x=>x.Code== proOutOrderDetail.Customer);
@@ -57,7 +56,7 @@
                    v.ProductCode == proOutOrderDetail.PCode
                    && v.ProductVersion.StartsWith(proOutOrderDetail.PVer.Substring(0,1)) 
                    && (isCanLot ? isCanLot : v.ProductCode == proOutOrderDetail.PLot)
                    && (isCanDate ? isCanDate : v.DateCode == proOutOrderDetail.DateCode)
                    && (isFineWorks ? !isCanLot : v.IsFineWorks == 1)
                ))
                .ToList();
            //}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_StockService/ProStockInfoService.cs
@@ -97,10 +97,10 @@
            return content;
        }
        //查找可用库存
        public List<Dt_ProStockInfo> GetUseableStocks(int warehoseId,Dt_ProOutOrderDetail proOutOrderDetail)
        public List<Dt_ProStockInfo> GetUseableStocks(int warehoseId,Dt_ProOutOrderDetail proOutOrderDetail, bool isFineWorks = false)
        {
            List<string> locationCodes = _basicRepository.LocationInfoRepository.GetCanOutLocationCodes(warehoseId);
            return BaseDal.GetProStocks(proOutOrderDetail,locationCodes);
            return BaseDal.GetProStocks(proOutOrderDetail,locationCodes, isFineWorks);
        }
        /// <summary>
        /// MES提库可用库存
@@ -126,10 +126,8 @@
        {
            List<Dt_ProStockInfo> assignOutStocks =new List<Dt_ProStockInfo>();
            bool isCanLot = string.IsNullOrEmpty(outOrderDetail.PLot);
            bool isCanDate = string.IsNullOrEmpty(outOrderDetail.DateCode);
            float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Where(x => x.ProductCode == outOrderDetail.PCode && x.ProductVersion.StartsWith(outOrderDetail.PVer.Substring(0, 1))
                            && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot)
                            && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode))
                            && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot))
                        .Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x);
            //stockInfos = stockInfos.OrderBy(x => x.Id).ToList();
            
@@ -141,14 +139,12 @@
                    Dt_ProStockInfo stockInfo = stockInfos[index];
                    float useableStockQuantity = stockInfo.proStockInfoDetails
                        .Where(x => x.ProductCode == outOrderDetail.PCode && x.ProductVersion.StartsWith(outOrderDetail.PVer.Substring(0,1))
                            && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot)
                            && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode))
                            && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot))
                        .Sum(x => x.StockPcsQty - x.OutboundQuantity);
                    if (useableStockQuantity < needQuantity && useableStockQuantity >0)
                    {
                        stockInfo.proStockInfoDetails.Where(x => x.ProductCode == outOrderDetail.PCode && x.ProductVersion.StartsWith(outOrderDetail.PVer.Substring(0, 1))
                            && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot)
                            && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode)).ToList().ForEach(x => x.OutboundQuantity = x.StockPcsQty);
                            && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot)).ToList().ForEach(x => x.OutboundQuantity = x.StockPcsQty);
                        needQuantity -= useableStockQuantity;
                    }
                    else
@@ -158,8 +154,7 @@
                            //满足条件进行分配
                            if ((x.StockPcsQty > x.OutboundQuantity)
                                && x.ProductCode == outOrderDetail.PCode && x.ProductVersion.StartsWith(outOrderDetail.PVer.Substring(0, 1)) 
                                && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot)
                                && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode))
                                && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot))
                            {
                                if (x.StockPcsQty - x.OutboundQuantity >= needQuantity)
                                {
@@ -182,52 +177,6 @@
                    index++;
                }
            }
            #region æˆå“å¯ç”¨åº“存不足不进行分配
            //else
            //{
            //    for (int i = 0; i < stockInfos.Count; i++)
            //    {
            //        Dt_ProStockInfo stockInfo = stockInfos[i];
            //        float useableStockQuantity = stockInfo.proStockInfoDetails
            //            .Where(x => x.ProductCode == outOrderDetail.PCode && x.ProductVersion == outOrderDetail.PVer
            //                && (isCanLot ? isCanLot : x.BagNo == outOrderDetail.PLot)
            //                && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode))
            //            .Sum(x => x.StockPcsQty - x.OutboundQuantity);
            //        if (useableStockQuantity < needQuantity)
            //        {
            //            stockInfo.proStockInfoDetails.ForEach(x => x.OutboundQuantity = x.StockPcsQty);
            //            needQuantity -= useableStockQuantity;
            //        }
            //        else
            //        {
            //            stockInfo.proStockInfoDetails.ForEach(x =>
            //            {
            //                if (x.StockPcsQty > x.OutboundQuantity && x.ProductCode == outOrderDetail.PCode && x.ProductVersion == outOrderDetail.PVer
            //                    && (isCanLot ? isCanLot : x.BagNo == outOrderDetail.PLot)
            //                    && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode))
            //                {
            //                    if (x.StockPcsQty - x.OutboundQuantity >= needQuantity)
            //                    {
            //                        x.OutboundQuantity += needQuantity;
            //                        needQuantity = 0;
            //                    }
            //                    else
            //                    {
            //                        needQuantity -= (x.StockPcsQty - x.OutboundQuantity);
            //                        x.OutboundQuantity = x.StockPcsQty;
            //                    }
            //                }
            //            });
            //        }
            //        stockInfo.proStockInfoDetails.ForEach(x =>
            //        {
            //            x.OutDetailSaleNo = outOrderDetail.SaleOrder;
            //            x.OutDetailId = outOrderDetail.Id;
            //        });
            //        assignOutStocks.Add(stockInfo);
            //    }
            //}
            #endregion
            residueQuantity = needQuantity;
            return assignOutStocks;
        }
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs
@@ -30,7 +30,7 @@
        /// MES成品入库单接收
        /// </summary>
        /// <returns></returns>
        public MesResponseContent BagInfoSync(MesBagInfoModel bagInfoModel)
        public MesResponseContent BagInfoSync(MesBagInfoModel bagInfoModel, string formSign = "")
        {
            MesResponseContent content = new MesResponseContent();
            try
@@ -111,6 +111,7 @@
                            ERPOrder = child.ERPOrder,
                            SaleOrder = child.SaleOrder,
                            MoNumber = child.MoNumber,
                            IsFineWorks=item.IsFineWorks,
                        };
                        mesProInOrderDetails.Add(mesProInOrderDetail);
                    }
@@ -177,18 +178,21 @@
                newTask.TaskId = taskId;
                Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand();
                //上传ERP
                WebResponseContent responseContent = _inboundOrderService.FeedbackProIn(mesProInOrder);
                if (string.IsNullOrEmpty(formSign))
                {
                    WebResponseContent responseContent = _inboundOrderService.FeedbackProIn(mesProInOrder);
                    if (!responseContent.Status)
                    {
                        //mesProInOrder.UpErpStatus = WhetherEnum.False.ObjToInt();
                        //mesProInOrder.Remark = responseContent.Message;
                        throw new Exception(responseContent.Message);
                    }
                    else
                    {
                        mesProInOrder.UpErpStatus = WhetherEnum.True.ObjToInt();
                    }
                }
                _proInStatisticsService.SaveStatic(bagInfoModel);
                if (!responseContent.Status)
                {
                    //mesProInOrder.UpErpStatus = WhetherEnum.False.ObjToInt();
                    //mesProInOrder.Remark = responseContent.Message;
                    throw new Exception(responseContent.Message);
                }
                else
                {
                    mesProInOrder.UpErpStatus = WhetherEnum.True.ObjToInt();
                }
                Db.InsertNav(mesProInOrder).Include(x => x.Details).ExecuteCommand();
                _unitOfWorkManage.CommitTran();
                //推送任务
@@ -440,7 +444,7 @@
            mesShipOrderDetails.Add(orderDetail);
            MesShipmentOrderSync shipmentOrderSync = new MesShipmentOrderSync()
            {
                ShipmentOrder = proOutOrder.ProOutOrderNo+"-"+ outProStockInfo.TaskNum,
                ShipmentOrder = proOutOrder.ProOutOrderNo,
                PlantShipDate = proOutOrder.PlantShipDate.ToString("yyyy-MM-dd HH:mm:ss"),
                Customer = proOutOrderDetail.EndCustomer,
                FactoryCode = proOutOrderDetail.FactoryCode,
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -360,7 +360,7 @@
                });
                //更新任务状态
                task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
                FeedBackWCSTaskCompleted(taskNum);
                _unitOfWorkManage.BeginTran();
                BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.人工完成 : OperateTypeEnum.自动完成);
                _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId);
@@ -391,7 +391,7 @@
                        _inboundOrderService.FeedbackInboundOrder(inboundOrder.Id);
                    }
                }
                FeedBackWCSTaskCompleted(taskNum);
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
@@ -496,8 +496,8 @@
                    x.ProOutDetailStatus = StockStatusEmun.入库完成.ObjToInt();
                });
                #region todo:临时更新所有研发转成品
                if (proStockInfo.ProStockAttribute == ProStockAttributeEnum.研发.ObjToInt())
                #region todo:临时更新所有研发或尾数转成品
                if (proStockInfo.ProStockAttribute == ProStockAttributeEnum.研发.ObjToInt() || proStockInfo.ProStockAttribute == ProStockAttributeEnum.尾数.ObjToInt())
                {
                    proStockInfo.ProStockAttribute = ProStockAttributeEnum.成品.ObjToInt();
                    proStockInfo.WarehouseId = locationInfo.WarehouseId;
@@ -702,7 +702,7 @@
                }
                task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
                FeedBackWCSTaskCompleted(taskNum);
                _unitOfWorkManage.BeginTran();
                if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt() || task.TaskType == TaskTypeEnum.OutQuality.ObjToInt() || task.TaskType == TaskTypeEnum.OutAllocate.ObjToInt() || task.TaskType == TaskTypeEnum.MesHandPickOutbound.ObjToInt() || task.TaskType == TaskTypeEnum.MesHandOutbound.ObjToInt())
@@ -771,14 +771,14 @@
                _unitOfWorkManage.CommitTran();
                //PP出库任务完成判断。。。。。。。。。。。。。。。。。
                if (warehouse.WarehouseCode == WarehouseEnum.HA58.ToString() && task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
                {
                    _outboundService.MesPPOutboundOrderService.Repository.UpdateData(mesPPOutboundOrders);
                    MesMaterialLotaAceptModel model = GetMesMaterialLotaAceptModel(stockInfo, stockInfo.Details.FirstOrDefault(), mesPPOutboundOrders.FirstOrDefault().TaskNo, warehouse.WarehouseCode, stockInfo.Details.Where(x => x.MaterielCode == mesPPOutboundOrders.FirstOrDefault().MaterialCode).Sum(x => x.StockQuantity));
                    UploadMesMaterialLotaAcept(model);
                    _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.自动完成 : OperateTypeEnum.人工完成);
                    _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateTypeEnum.自动完成 : OperateTypeEnum.人工完成);
                }
                //if (warehouse.WarehouseCode == WarehouseEnum.HA58.ToString() && task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
                //{
                //    _outboundService.MesPPOutboundOrderService.Repository.UpdateData(mesPPOutboundOrders);
                //    MesMaterialLotaAceptModel model = GetMesMaterialLotaAceptModel(stockInfo, stockInfo.Details.FirstOrDefault(), mesPPOutboundOrders.FirstOrDefault().TaskNo, warehouse.WarehouseCode, stockInfo.Details.Where(x => x.MaterielCode == mesPPOutboundOrders.FirstOrDefault().MaterialCode).Sum(x => x.StockQuantity));
                //    UploadMesMaterialLotaAcept(model);
                //    _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.自动完成 : OperateTypeEnum.人工完成);
                //    _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateTypeEnum.自动完成 : OperateTypeEnum.人工完成);
                //}
                if (warehouse.WarehouseCode != WarehouseEnum.HA64.ToString() && task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
                {
                    _outboundService.OutboundOrderService.TestOutUpload(outboundOrderDetails.FirstOrDefault().OrderId, outStockLockInfos);
@@ -788,7 +788,7 @@
                    MesMaterialLotaAceptModel model = GetMesMaterialLotaAceptModel(stockInfo, stockInfo.Details.FirstOrDefault(), mesOutboundOrders.FirstOrDefault().TaskNo, warehouse.WarehouseCode, stockInfo.Details.Where(x => x.MaterielCode == mesOutboundOrders.FirstOrDefault().MaterialCode).Sum(x => x.StockQuantity));
                    UploadMesMaterialLotaAcept(model);
                }
                FeedBackWCSTaskCompleted(taskNum);
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
@@ -1012,6 +1012,7 @@
            }
            return content;
        }
        //报废出库完成
        public WebResponseContent OutProScrapCompleted(Dt_Task task)
        {
            WebResponseContent content = new WebResponseContent();
@@ -1030,7 +1031,6 @@
                    return content.Error("未找到成品出库详情");
                }
                //获取成品报废单
                Dt_ErpProScrapSheet erpProScrapSheet = _outboundRepository.ErpProScrapSheetRepository.Db.Queryable<Dt_ErpProScrapSheet>().Where(x => x.ProScrapSheetOrderNo == outProStockInfo.OrderNo).Includes(x=>x.Details).First();
                if (erpProScrapSheet == null)
                {
@@ -1045,13 +1045,22 @@
                {
                    return content.Error($"成品报废单明细行{erpProScrapSheetDetail.Id}已完成");
                }
                erpProScrapSheetDetail.ScrapProDetailStatus = OutOrderStatusEnum.出库完成.ObjToInt();
                //获取当前库存
                Dt_ProStockInfo proStockInfo = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>().Where(x => x.PalletCode == task.PalletCode).Includes(x => x.proStockInfoDetails).First();
                if (proStockInfo == null)
                {
                    return content.Error($"未找到{task.PalletCode}库存信息");
                }
                if (((int)outProStockInfo.AssignQuantity+erpProScrapSheetDetail.OverScrapPcsQty) == erpProScrapSheetDetail.ScrapPcsQty)
                {
                    erpProScrapSheetDetail.OverScrapPcsQty += (int)outProStockInfo.AssignQuantity;
                    erpProScrapSheetDetail.ScrapProDetailStatus = OutOrderStatusEnum.出库完成.ObjToInt();
                }
                else
                {
                    erpProScrapSheetDetail.OverScrapPcsQty += (int)outProStockInfo.AssignQuantity;
                }
                List<Dt_ProStockInfoDetail> proStockInfoDetails = proStockInfo.proStockInfoDetails;
                if (proStockInfoDetails.Count <= 0)
                {
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs
@@ -185,7 +185,7 @@
        /// <param name="ProOutNo">出库订单号</param>
        /// <param name="StationCode">站台地址</param>
        /// <returns></returns>
        public async Task<WebResponseContent> OutProductTask(int[] keys, string StationCode, int Grade)
        public async Task<WebResponseContent> OutProductTask(int[] keys, string StationCode, int Grade,bool isFineWorks=false)
        {
            WebResponseContent content = new WebResponseContent();
            try
@@ -207,7 +207,7 @@
                List<Dt_OutProStockInfo> outProStockInfos = new List<Dt_OutProStockInfo>();
                List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>();
                (List<Dt_Task>, List<Dt_ProStockInfo>?, List<Dt_ProOutOrderDetail>?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>?) result =
                OutProductTaskDataHandle(_ProOutOrderDetails);
                OutProductTaskDataHandle(_ProOutOrderDetails, isFineWorks);
                if (result.Item2 != null && result.Item2.Count > 0)
                {
                    proStockInfos.AddRange(result.Item2);
@@ -632,7 +632,7 @@
        /// å¤„理成品出库数据
        /// </summary>
        /// <returns></returns>
        public (List<Dt_Task>, List<Dt_ProStockInfo>?, List<Dt_ProOutOrderDetail>?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>?) OutProductTaskDataHandle(List<Dt_ProOutOrderDetail> proOutOrderDetails)
        public (List<Dt_Task>, List<Dt_ProStockInfo>?, List<Dt_ProOutOrderDetail>?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>?) OutProductTaskDataHandle(List<Dt_ProOutOrderDetail> proOutOrderDetails, bool isFineWorks = false)
        {
            List<Dt_Task> tasks = new List<Dt_Task>();
            List<Dt_ProStockInfo> proStockInfos = new List<Dt_ProStockInfo>();
@@ -640,7 +640,7 @@
            List<Dt_OutProStockInfo> outProStockInfos=new List<Dt_OutProStockInfo>();
            List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>();
            //分配库存
            (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) result = _outboundService.ProOutOrderDetailService.AssignProStockOut(proOutOrderDetails);
            (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) result = _outboundService.ProOutOrderDetailService.AssignProStockOut(proOutOrderDetails, isFineWorks);
            if (result.Item1!=null&&result.Item1.Count>0)
            {
                //获取成品单
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Reloaction.cs
@@ -240,7 +240,7 @@
                    return WebResponseContent.Instance.Error($"未找到对应的终点货位信息");
                }
                task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
                FeedBackWCSTaskCompleted(task.TaskNum);
                _unitOfWorkManage.BeginTran();
                stockInfo.LocationCode = locationInfoEnd.LocationCode;
                stockInfo.StockStatus = StockStatusEmun.入库完成.ObjToInt();
@@ -249,7 +249,7 @@
                _basicService.LocationInfoService.UpdateLocationStatus(locationInfoEnd, stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId);
                BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? WIDESEA_Core.Enums.OperateTypeEnum.人工完成 : WIDESEA_Core.Enums.OperateTypeEnum.自动完成);
                _unitOfWorkManage.CommitTran();
                FeedBackWCSTaskCompleted(task.TaskNum);
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs
@@ -184,7 +184,7 @@
        [HttpPost, Route("BagInfoSync"), AllowAnonymous]
        public MesResponseContent BagInfoSync([FromBody] Root<MesBagInfoModel> model)
        {
            return _taskService.BagInfoSync(model.Content);
            return _taskService.BagInfoSync(model.Content, model.From!="PK" ? "" : model.From);
        }
        /// <summary>
        /// MES成品外包信息接收
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs
@@ -194,9 +194,9 @@
        /// <param name="StationCode">站台地址</param>
        /// <returns></returns>
        [HttpPost, HttpGet, Route("OutProductTask"), AllowAnonymous]
        public async Task<WebResponseContent> OutProductTask([FromBody] int[] keys, string StationCode, int Grade)
        public async Task<WebResponseContent> OutProductTask([FromBody] int[] keys, string StationCode, int Grade,int isFineWorks=0)
        {
            return await Service.OutProductTask(keys, StationCode, Grade);
            return await Service.OutProductTask(keys, StationCode, Grade,Convert.ToBoolean(isFineWorks));
        }
        /// <summary>
        /// æˆå“ä½™æ–™é€€åº“入仓