1
z8018
2025-05-06 7da6f394864ba0412c1ac58ba7752862de7d3f3d
项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineOutJob.cs
@@ -104,25 +104,20 @@
                            if (!string.IsNullOrEmpty(barcode))
                            {
                                OrderInfo orderInfo = _orderDetailsService.GetOrderInfoByBarcode(barcode);
                                if (orderInfo.Width > AppSettings.Get("MaxWidth").ObjToInt() && orderInfo.Width < AppSettings.Get("MinWidth").ObjToInt())
                                {
                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(orderInfo.Length));
                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(orderInfo.Width));
                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(orderInfo.Thickness));
                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, dischargeStation);
                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTaskNum, 999);
                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationResponse, true);
                                }
                                else
                                _orderDetailsService.ToMes(barcode, 3);
                                if (orderInfo.Width >= AppSettings.Get("MinWidth").ObjToInt() && orderInfo.Width <= AppSettings.Get("MaxWidth").ObjToInt() && orderInfo.Length >= AppSettings.Get("MinLength").ObjToInt() && orderInfo.Length <= AppSettings.Get("MaxLength").ObjToInt() || orderInfo.Length >= AppSettings.Get("MinWidth").ObjToInt() && orderInfo.Length <= AppSettings.Get("MaxWidth").ObjToInt() && orderInfo.Width >= AppSettings.Get("MinLength").ObjToInt() && orderInfo.Width <= AppSettings.Get("MaxLength").ObjToInt())
                                {
                                    Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == barcode);
                                    if (task == null)
                                    {
                                        try
                                        {
                                            task = _taskService.GenerateTask(orderInfo);
                                            if (task != null)
                                            var (taskFlag, gTask, message) = _taskService.GenerateTask(orderInfo);
                                            if (taskFlag && gTask != null)
                                            {
                                                task = gTask;
                                                if (!string.IsNullOrEmpty(task.ItemInfo))
                                                {
                                                    string[] itemInfos = task.ItemInfo.Split("*");
@@ -137,6 +132,33 @@
                                                otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(task.TargetAddress));
                                                otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTaskNum, task.TaskNum);
                                                otherDevice.SetValue(ConveyorLineStationDBName.WCSStationResponse, true);
                                            }
                                            else
                                            {
                                                //if (message.Contains("10001"))
                                                //{
                                                //    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(orderInfo.Length));
                                                //    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(orderInfo.Width));
                                                //    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(orderInfo.Thickness));
                                                //    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, dischargeStation);
                                                //    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTaskNum, 999);
                                                //    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationResponse, true);
                                                //}
                                                //else if (message.Contains("10002"))
                                                //{
                                                //    WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}", message);
                                                //}
                                                //else
                                                {
                                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(orderInfo.Length));
                                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(orderInfo.Width));
                                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(orderInfo.Thickness));
                                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, dischargeStation);
                                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTaskNum, 998);
                                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationResponse, true);
                                                    WriteError(nameof(CommonConveyorLineOutJob), message);
                                                }
                                            }
                                        }
                                        catch (Exception ex)
@@ -167,6 +189,32 @@
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (!string.IsNullOrEmpty(task.ItemInfo))
                                        {
                                            string[] itemInfos = task.ItemInfo.Split("*");
                                            if (itemInfos.Length == 3)
                                            {
                                                otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(itemInfos[0]));
                                                otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(itemInfos[1]));
                                                otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(itemInfos[2]));
                                            }
                                        }
                                        otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(task.TargetAddress));
                                        otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTaskNum, task.TaskNum);
                                        otherDevice.SetValue(ConveyorLineStationDBName.WCSStationResponse, true);
                                    }
                                }
                                else
                                {
                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(orderInfo.Length));
                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(orderInfo.Width));
                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, Convert.ToInt32(orderInfo.Thickness));
                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTarget, dischargeStation);
                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationTaskNum, 999);
                                    otherDevice.SetValue(ConveyorLineStationDBName.WCSStationResponse, true);
                                }
                            }
                            else