schangxiang@126.com
2024-11-21 60735779c303c2dd10feea45d7fd761103b225e0
CC/iWareCC_ASRS/WmsTask/AutoSalverMaterialBindTask.cs
@@ -33,10 +33,10 @@
            while (true)
            {
                Thread.Sleep(2000);//休眠2秒,将休眠写到前面,是为了下面的continue方法执行后不显示错误信息的提示!!!【EditBy shaocx,2022-05-24】
                SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask = string.Empty;
                SystemWarningMsg._lbl_alert_DataProcess_BZ39 = string.Empty;
                try
                {
                    if (SystemValue.isAllowRuning_AutoSalverMaterialBindTask && SystemValue.isStartedModel)
                    if (SystemValue.isAllowRuning_DataProcess_BZ39 && SystemValue.isStartedModel)
                    {
                        EDevice rgvLocation = EDevice.入库口1019;
                        var stationCode = Convert.ToInt32(rgvLocation).ToString();
@@ -50,25 +50,25 @@
                            if (isSys_HasCatogryForRgvStattion)
                            {
                                SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask = $"{rgvLocation.ToString()}-系统有库存,此次循环结束";
                                SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-系统有库存,此次循环结束";
                                continue;
                            }
                            if (isExistOtherTaskDoing)
                            {
                                SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask = $"{rgvLocation.ToString()}-有任务占用该站点,此次循环结束";
                                SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-有任务占用该站点,此次循环结束";
                                continue;
                            }
                            if (!isGD_HasCatogryForRgvStattion)
                            {
                                SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask = $"{rgvLocation.ToString()}-光电显示无货,此次循环结束";
                                SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-光电显示无货,此次循环结束";
                                continue;
                            }
                            SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask = $"{rgvLocation.ToString()}-光电有货";
                            SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-光电有货";
                            //需要读取 发动机扫描枪的信息
                            var _scan_CargoNo = FormCC.rgvView.R_1019_CargoNoScan;
                            if (string.IsNullOrEmpty(_scan_CargoNo))
                            {
                                SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask = $"读取的{rgvLocation.ToString()}位置,发动机码为空,不允许自动组盘";
                                SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"读取的{rgvLocation.ToString()}位置,发动机码为空,不允许自动组盘";
                                continue;
                            }
@@ -85,26 +85,26 @@
                            var _scan_salverCode = FormCC.rgvView.R_1019_Scan;
                            if (string.IsNullOrEmpty(_scan_salverCode))
                            {
                                SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask = $"读取的{rgvLocation.ToString()}位置,托盘码为空,不允许自动组盘";
                                SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"读取的{rgvLocation.ToString()}位置,托盘码为空,不允许自动组盘";
                                continue;
                            }
                            var isSys_HasCatogryForSalverCode = StoreHandler.IsSys_HasCatogryForSalverCode(context, _scan_salverCode, ref store);
                            if (isSys_HasCatogryForSalverCode)
                            {
                                SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask = $"读取的{rgvLocation.ToString()}位置,托盘码为{_scan_salverCode},该托盘库存已存在,在立库库位{store.SrmStationCode},在RGV库位{store.RgvStationCode},不允许自动组盘";
                                SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"读取的{rgvLocation.ToString()}位置,托盘码为{_scan_salverCode},该托盘库存已存在,在立库库位{store.SrmStationCode},在RGV库位{store.RgvStationCode},不允许自动组盘";
                                continue;
                            }
                            var isExistOtherTaskDoingForSalverCode = PartTaskHandler.IsExistOtherTaskDoingForSalverCode(stationCode);
                            if (isExistOtherTaskDoingForSalverCode)
                            {
                                SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask = $"读取的{rgvLocation.ToString()}位置,托盘码为{_scan_salverCode},该托盘已经有未结束的任务被占用,不允许自动组盘";
                                SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"读取的{rgvLocation.ToString()}位置,托盘码为{_scan_salverCode},该托盘已经有未结束的任务被占用,不允许自动组盘";
                                continue;
                            }
                            //符合条件,即将进行自动组盘
                            alertMsg = $"读取的{rgvLocation.ToString()}位置,发动机码为{_scan_CargoNo},托盘码为{_scan_salverCode},符合条件,即将进行自动组盘";
                            SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask = alertMsg;
                            Log4NetHelper.WriteInfoLog(LogType.AutoSalverMaterialBindTask, alertMsg);
                            SystemWarningMsg._lbl_alert_DataProcess_BZ39 = alertMsg;
                            Log4NetHelper.WriteInfoLog(LogType.DataProcess_BZ39, alertMsg);
                            try
                            {
@@ -114,16 +114,16 @@
                                if (v_btjResult.success == false)
                                {
                                    alertMsg = $"读取的{rgvLocation.ToString()}位置,发动机码为{_scan_CargoNo},托盘码为{_scan_salverCode},本体机接收API 请求失败:WMS返回消息为->{v_btjResult.msg}";
                                    SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask = alertMsg;
                                    Log4NetHelper.WriteInfoLog(LogType.AutoSalverMaterialBindTask, alertMsg);
                                    Log4NetHelper.WriteErrorLog(LogType.AutoSalverMaterialBindTask, alertMsg, null);
                                    SystemWarningMsg._lbl_alert_DataProcess_BZ39 = alertMsg;
                                    Log4NetHelper.WriteInfoLog(LogType.DataProcess_BZ39, alertMsg);
                                    Log4NetHelper.WriteErrorLog(LogType.DataProcess_BZ39, alertMsg, null);
                                    continue;
                                }
                                else
                                {
                                    alertMsg = $"读取的{rgvLocation.ToString()}位置,发动机码为{_scan_CargoNo},托盘码为{_scan_salverCode},本体机接收API 请求成功:WMS返回消息为->{v_btjResult.msg}";
                                    SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask = alertMsg;
                                    Log4NetHelper.WriteInfoLog(LogType.AutoSalverMaterialBindTask, alertMsg);
                                    SystemWarningMsg._lbl_alert_DataProcess_BZ39 = alertMsg;
                                    Log4NetHelper.WriteInfoLog(LogType.DataProcess_BZ39, alertMsg);
                                }
                                //调用API
@@ -137,24 +137,24 @@
                                if (ret.success)
                                {
                                    alertMsg = $"读取的{rgvLocation.ToString()}位置,发动机码为{_scan_CargoNo},托盘码为{_scan_salverCode},自动组盘请求WMSAPI成功!";
                                    SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask = alertMsg;
                                    Log4NetHelper.WriteInfoLog(LogType.AutoSalverMaterialBindTask, alertMsg);
                                    SystemWarningMsg._lbl_alert_DataProcess_BZ39 = alertMsg;
                                    Log4NetHelper.WriteInfoLog(LogType.DataProcess_BZ39, alertMsg);
                                }
                                else
                                {
                                    alertMsg = $"读取的{rgvLocation.ToString()}位置,发动机码为{_scan_CargoNo},托盘码为{_scan_salverCode},自动组盘请求WMSAPI失败:WMS返回消息为->{ret.msg}";
                                    SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask = alertMsg;
                                    Log4NetHelper.WriteInfoLog(LogType.AutoSalverMaterialBindTask, alertMsg);
                                    Log4NetHelper.WriteErrorLog(LogType.AutoSalverMaterialBindTask, alertMsg, null);
                                    SystemWarningMsg._lbl_alert_DataProcess_BZ39 = alertMsg;
                                    Log4NetHelper.WriteInfoLog(LogType.DataProcess_BZ39, alertMsg);
                                    Log4NetHelper.WriteErrorLog(LogType.DataProcess_BZ39, alertMsg, null);
                                }
                            }
                            catch (Exception ex)
                            {
                                alertMsg = $"读取的{rgvLocation.ToString()}位置,发动机码为{_scan_CargoNo},托盘码为{_scan_salverCode},自动组盘请求WMSAPI失败:出现异常->{ex.Message}";
                                SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask = alertMsg;
                                Log4NetHelper.WriteInfoLog(LogType.AutoSalverMaterialBindTask, alertMsg);
                                Log4NetHelper.WriteErrorLog(LogType.AutoSalverMaterialBindTask, alertMsg, ex);
                                SystemWarningMsg._lbl_alert_DataProcess_BZ39 = alertMsg;
                                Log4NetHelper.WriteInfoLog(LogType.DataProcess_BZ39, alertMsg);
                                Log4NetHelper.WriteErrorLog(LogType.DataProcess_BZ39, alertMsg, ex);
                            }
                        }
@@ -162,8 +162,8 @@
                }
                catch (Exception ex)
                {
                    SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask += "自动组盘 出现异常:" + ex.Message + SysGloble.SPLIT_STR;
                    Log4NetHelper.WriteErrorLog(LogType.AutoSalverMaterialBindTask, "AutoSalverMaterialBindTask 出现异常:" + ex.Message, ex);
                    SystemWarningMsg._lbl_alert_DataProcess_BZ39 += "自动组盘 出现异常:" + ex.Message + SysGloble.SPLIT_STR;
                    Log4NetHelper.WriteErrorLog(LogType.DataProcess_BZ39, "AutoSalverMaterialBindTask 出现异常:" + ex.Message, ex);
                }
            }