222
schangxiang@126.com
2024-11-23 00f88de97d7ff3bdca5a445f17fa25c3fd28a1db
CC/iWareCC_ASRS/ThreadService/02_BZ39¹¤Î»£¨²¹°åºó¹¤Î»£©/DataProcess_RobotBuffer_ModeChange.cs
@@ -27,16 +27,16 @@
        public static async void Handler()
        {
            var alertMsg = "";
            LogType logType = LogType.DataProcess_BZ39;
            LogType logType = LogType.DataProcess_RobotBuffer_ModeChange;
            while (true)
            {
                Thread.Sleep(2000);//休眠2秒,将休眠写到前面,是为了下面的continue方法执行后不显示错误信息的提示!!!【EditBy shaocx,2022-05-24】
                SystemWarningMsg._lbl_alert_DataProcess_BZ39 = string.Empty;
                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_ModeChange = string.Empty;
                try
                {
                    if (SystemValue.isAllowRuning_DataProcess_BZ39 && SystemValue.isStartedModel)
                    if (SystemValue.isAllowRuning_DataProcess_RobotBuffer_ModeChange && SystemValue.isStartedModel)
                    {
                        var rgvLocation = StationLocationEnum.BZ39.ToString();
                        if (FormCC.IsAllowRunOutMode)
                        {
                            using (WmsDBModel wmsDB = new WmsDBModel())
@@ -44,7 +44,7 @@
                                var rbRunMode = wmsDB.wms_rbline_runmode.FirstOrDefault();
                                if (rbRunMode.LineRunMode == (int)RbRunModeEnum.出库模式)
                                {
                                    SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"已经是出库模式了,此次循环结束";
                                    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_ModeChange = $"已经是出库模式了,此次循环结束";
                                    continue;
                                }
                                rbRunMode.LineRunMode = (int)RbRunModeEnum.出库模式;
@@ -52,19 +52,19 @@
                                rbRunMode.UpdateTime = DateTime.Now;
                                //推送给PLC切换模式
                                //using (StationServiceClient client = new StationServiceClient())
                                //{
                                //    var res = await client.WriteOutStoreTaskInfoAsync((int)EDevice.Station, rgvLocation, doTask.PlaceCode, Convert.ToInt32(doTask.TaskNo));
                                //    if (!res.result)
                                //    {
                                //        SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-下发出库任务 å¤±è´¥,WriteOutStoreTaskInfoAsync è¿”回:{res.resMsg}";
                                //        continue;
                                //    }
                                //    else
                                //    {
                                //        Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-下发出库任务 æˆåŠŸ,WriteOutStoreTaskInfoAsync,参数: ç«™ç‚¹{rgvLocation}");
                                //    }
                                //}
                                using (StationServiceClient client = new StationServiceClient())
                                {
                                    var res = await client.ChangeModeAsync((int)EDevice.Station, (int)RbRunModeEnum.出库模式, rgvLocation);
                                    if (!res.result)
                                    {
                                        SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_ModeChange = $"{rgvLocation.ToString()}-推送给PLC切换模式 å¤±è´¥,ChangeModeAsync è¿”回:{res.resMsg}";
                                        continue;
                                    }
                                    else
                                    {
                                        Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-推送给PLC切换模式 æˆåŠŸ,ChangeModeAsync,参数: ç«™ç‚¹{rgvLocation}");
                                    }
                                }
                                wmsDB.SaveChanges();
@@ -74,7 +74,7 @@
                }
                catch (Exception ex)
                {
                    SystemWarningMsg._lbl_alert_DataProcess_BZ39 += " å‡ºçް异叏:" + ex.Message + SysGloble.SPLIT_STR;
                    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_ModeChange += " å‡ºçް异叏:" + ex.Message + SysGloble.SPLIT_STR;
                    Log4NetHelper.WriteErrorLog(logType, " å‡ºçŽ°å¼‚å¸¸ï¼š" + ex.Message, ex);
                }
            }