add
zongzhibin
2024-11-24 272ea6040258a7adfc807123036378915860fb90
CC/iWareCC_ASRS/ThreadService/02_BZ39¹¤Î»£¨²¹°åºó¹¤Î»£©/Outbound/3¡¢DataProcess_RobotBuffer_FinishTaskForOutbound.cs
@@ -1,4 +1,5 @@
using Admin.NET.Application;
using iWareCC.StationService;
using iWareCommon.Common.Globle;
using iWareCommon.Utils;
using iWareModel;
@@ -21,7 +22,7 @@
            LogType logType = LogType.DataProcess_RobotBuffer_FinishTaskForOutbound;
            while (true)
            {
                Thread.Sleep(2000);//休眠2秒,将休眠写到前面,是为了下面的continue方法执行后不显示错误信息的提示!!!【EditBy shaocx,2022-05-24】
                Thread.Sleep(500);//休眠2秒,将休眠写到前面,是为了下面的continue方法执行后不显示错误信息的提示!!!【EditBy shaocx,2022-05-24】
                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = string.Empty;
                try
                {
@@ -31,12 +32,12 @@
                        var obj = FormCC.stationView.R_StationForReadCommList.Where(x => x.StationCode == rgvLocation.ToString()).FirstOrDefault();
                        if (obj.R_OutboundFinish)
                        {
                            var result = obj.R_OutboundNumber;
                            if (string.IsNullOrEmpty(result))
                            {
                                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()}- å‡ºåº“库位号是空的,此次循环结束";
                                continue;
                            }
                            //var result = obj.R_OutboundNumber;
                            //if (string.IsNullOrEmpty(result))
                            //{
                            //    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()}- å‡ºåº“库位号是空的,此次循环结束";
                            //    continue;
                            //}
                            var result2 = obj.R_Outbound_TaskID;
                            if (result2 == 0)
@@ -49,8 +50,8 @@
                            using (WmsDBModel wmsDB = new WmsDBModel())
                            {
                                var task = wmsDB.wms_rbline_task.Where(x => x.PlaceCode == obj.R_OutboundNumber
                                && x.TaskNo == obj.R_Outbound_TaskID.ToString()
                                var task = wmsDB.wms_rbline_task.Where(x =>
                                 x.TaskNo == obj.R_Outbound_TaskID.ToString()
                                && x.RbTaskType == (int)RbTaskTypeEnum.出库任务
                                && x.TaskStatus == (int)TaskStatusEnum.已下发).FirstOrDefault();
                                if (task == null)
@@ -77,6 +78,21 @@
                                var place = StationHandler.GetPlaceByPlaceCode(task.PlaceCode, wmsDB);
                                place.PlaceStatus = (int)PlaceStatusEnum.正常;
                                //给PLC推送任务完成确认信号
                                using (StationServiceClient client = new StationServiceClient())
                                {
                                    var res = await client.OutboundFinishConfirmAsync((int)EDevice.Station, true, rgvLocation);
                                    if (!res.result)
                                    {
                                        SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()}-下发出库任务 å¤±è´¥,OutboundFinishConfirmAsync è¿”回:{res.resMsg}";
                                        continue;
                                    }
                                    else
                                    {
                                        Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-下发出库任务 æˆåŠŸ,OutboundFinishConfirmAsync,参数: ç«™ç‚¹{rgvLocation}");
                                    }
                                }
                                wmsDB.SaveChanges();
                            }
                        }