| | |
| | | using iWareCC.BLL; |
| | | using Admin.NET.Application; |
| | | using iWareCC.Common.Helper; |
| | | using iWareCC.DeviceThreadFactory; |
| | | using iWareCC.Forms; |
| | | using iWareCC.RgvService; |
| | | using iWareCC.SrmService; |
| | | using iWareCC.StationService; |
| | | using iWareCC.ThreadService; |
| | | using iWareCC.ThreadService._03_BZ12_机器人码包工位_; |
| | | using iWareCC.ThreadService._04_BZ21_搬运整垛机器人_; |
| | | using iWareCC.WCF; |
| | | using iWareCommon; |
| | | using iWareCommon.Common.Globle; |
| | | using iWareCommon.Utils; |
| | | using iWareModel; |
| | | using iWareModel.Entity.AGV; |
| | | using iWareSql.DataAccess; |
| | | using iWareSql.DBModel; |
| | | using iWareSql.Orm; |
| | | using iWareSql.WmsDBModel; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.Linq; |
| | | using System.Linq.Expressions; |
| | | using System.Net; |
| | | using System.ServiceModel; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | using XiGang.Core.Model; |
| | | using XiGang.Core.Model.ViewModels; |
| | | |
| | | |
| | | namespace iWareCC |
| | | { |
| | | public partial class FormCC : Form |
| | | { |
| | | |
| | | /// <summary> |
| | | /// 全局—是否可以运行执行出库模式 |
| | | /// </summary> |
| | | public static bool IsAllowRunOutMode = false; |
| | | |
| | | /// <summary> |
| | | /// 当前下发出库任务的包号 |
| | | /// </summary> |
| | | public static string currHandlerPackageCodeForIssueOutboundTask = ""; |
| | | |
| | | /// <summary> |
| | | /// 1号堆垛机入库口扫码强制验证通过 |
| | | /// </summary> |
| | |
| | | |
| | | public static RgvView rgvView;//Rgv实体类 |
| | | public static RgvService.RgvServiceClient rgvServiceClient = null; |
| | | |
| | | public static StationView stationView;//站点实体类 |
| | | public static StationServiceClient stationServiceClient = null; |
| | | public FormCC() |
| | | { |
| | | InitializeComponent(); |
| | |
| | | tskGetRgv1Info = new Thread(GetRgvInfo); |
| | | tskGetRgv1Info.Start(); |
| | | |
| | | var tskGetStationInfo = new Thread(GetStationInfo); |
| | | tskGetStationInfo.Start(); |
| | | |
| | | //堆垛机UI赋值 |
| | | SetSrmUI(); |
| | | |
| | | tskSetSrmLable = new Thread(SrmRead_Label); |
| | | tskSetSrmLable.Start(); |
| | | |
| | | #endregion |
| | | |
| | | #region 设置显示UI |
| | | tskSetSrmLable = new Thread(SrmRead_Label); |
| | | tskSetSrmLable.Start(); |
| | | tskSetRgvLable = new Thread(SetRgvLable); |
| | | tskSetRgvLable.Start(); |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 服务线程启动 |
| | | |
| | | //堆垛机任务服务线程启动 |
| | | var srmService = DeviceThreadServiceFactory.GetHandle(EDeviceType.堆垛机); |
| | | srmService.StartService(); |
| | | //var srmService = DeviceThreadServiceFactory.GetHandle(EDeviceType.堆垛机); |
| | | // srmService.StartService(); |
| | | //RGV任务服务线程启动 |
| | | var rgvService = DeviceThreadServiceFactory.GetHandle(EDeviceType.RGV); |
| | | rgvService.StartService(); |
| | | //var rgvService = DeviceThreadServiceFactory.GetHandle(EDeviceType.RGV); |
| | | // rgvService.StartService(); |
| | | |
| | | |
| | | //处理【下发中】的出库计划任务 |
| | | new Thread(OutPlanTaskDecompose.HandlerIssuingTask).Start(); |
| | | |
| | | //任务分解线程-出库 |
| | | new Thread(MainTaskDecompose.HandlerMainTaskDecompose).Start(); |
| | | new Thread(DataProcess_RobotBuffer_ModeChange.Handler).Start(); |
| | | |
| | | //任务分解线程-组盘入库 |
| | | new Thread(MainTaskDecompose_ZPRK.HandlerMainTaskDecompose_ZPRK).Start(); |
| | | new Thread(DataProcess_RobotBuffer_IssueOutboundTask.Handler).Start(); |
| | | |
| | | //空托盘转运任务 |
| | | new Thread(EmptySalverTransferTask.Handler).Start(); |
| | | |
| | | //自动组盘任务 |
| | | new Thread(AutoSalverMaterialBindTask.Handler).Start(); |
| | | new Thread(DataProcess_RobotBuffer_AutoQiTaoOutbound.Handler).Start(); |
| | | |
| | | //自动组盘下发任务 |
| | | new Thread(AutoIssueInStoreTask.Handler).Start(); |
| | | new Thread(DataProcess_RobotBuffer_FinishTaskForOutbound.Handler).Start(); |
| | | |
| | | //重新获取发动机信息 |
| | | new Thread(AutoUpdateEngineInfoTask.Handler).Start(); |
| | | new Thread(DataProcess_RobotBuffer_ForceOutbound.Handler).Start(); |
| | | |
| | | //1014库位转运到1020线程 |
| | | new Thread(Place1014To1020Task.Handler).Start(); |
| | | new Thread(DataProcess_RobotBuffer_FinishTask.Handler).Start(); |
| | | |
| | | ////1009库位增加库存线程 |
| | | //new Thread(Place1009AddStoreTask.Handler).Start(); |
| | | new Thread(DataProcess_BZ01.Handler).Start(); |
| | | |
| | | |
| | | new Thread(DataProcess_269.Handler).Start(); |
| | | |
| | | |
| | | new Thread(DataProcess_BZ39.Handler).Start(); |
| | | new Thread(DataProcess_BZ39_IssueInboundTask.Handler).Start(); |
| | | new Thread(DataProcess_BZ12.Hander).Start(); |
| | | new Thread(DataProcess_BZ12_IssueTask.Handler).Start(); |
| | | |
| | | |
| | | new Thread(DataProcess_BZ12_FinishTask.Handler).Start(); |
| | | |
| | | new Thread(DataProcess_BZ21.Hander).Start(); |
| | | new Thread(DataProcess_BZ21_IssueTask.Handler).Start(); |
| | | |
| | | new Thread(DataProcess_BZ21_FinishTask.Handler).Start(); |
| | | new Thread(DeleteData).Start(); |
| | | |
| | | new Thread(LineInSacnResult.HandlerLineInSacnResult).Start(); |
| | | new Thread(PushPackageCodeToMes.Handler).Start(); |
| | | new Thread(PushPaperCutToMes.Handler).Start(); |
| | | |
| | | |
| | | new Thread(DataProcess_ValidateQiTao.Handler).Start(); |
| | | |
| | | //*/ |
| | | #endregion |
| | | |
| | | new Thread(GetAgvVehicles).Start();//AGV车辆信息 |
| | | // new Thread(GetAgvVehicles).Start();//AGV车辆信息 |
| | | |
| | | new Thread(OutTaskRetryToMes.Handler).Start(); |
| | | // new Thread(OutTaskRetryToMes.Handler).Start(); |
| | | |
| | | //暂时不启用虚拟出入库功能 |
| | | new Thread(VirtualTaskNoOutPlanTaskHandler.Handler).Start(); |
| | | // new Thread(VirtualTaskNoOutPlanTaskHandler.Handler).Start(); |
| | | } |
| | | private void FormCC_Load(object sender, EventArgs e) |
| | | { |
| | |
| | | } |
| | | else |
| | | {//正式模式 |
| | | rgvServiceClient = new RgvServiceClient(); |
| | | stationServiceClient = new StationServiceClient(); |
| | | } |
| | | |
| | | this.lbl_IsSimulationPLC.BackColor = IsSimulationPLC ? Color.Red : Color.Green; |
| | |
| | | //此处快速启动 调试模式,用于开发用 |
| | | //btn_Start_Click(null, null); |
| | | } |
| | | |
| | | |
| | | |
| | | #region 堆垛机线程和UI处理 |
| | | |
| | | /// <summary> |
| | | /// 设置1/2号堆垛机的前端显示 |
| | |
| | | |
| | | var showNowTime = "(" + DateTimeHelper.ConvertToStringForOnlyShowTime(DateTime.Now) + ")"; |
| | | //设置堆垛机任务下发和任务确认线程消息 |
| | | this.lbl_Alter_Srm1Release.Text = showNowTime + SystemWarningMsg._lbl_Alert_Srm1Release; |
| | | this.lbl_Alert_Srm2Release.Text = showNowTime + SystemWarningMsg._lbl_Alert_Srm2Release; |
| | | this.lbl_Alert_Srm3Release.Text = showNowTime + SystemWarningMsg._lbl_Alert_Srm3Release; |
| | | this.lbl_Alert_DataProcess_BZ39_IssueInboundTask.Text = showNowTime + SystemWarningMsg._lbl_Alert_DataProcess_BZ39_IssueInboundTask; |
| | | this.lbl_Alert_DataProcess_RobotBuffer_ForceOutbound.Text = showNowTime + SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_ForceOutbound; |
| | | this.lbl_Alert_DataProcess_BZ12.Text = showNowTime + SystemWarningMsg._lbl_alert_DataProcess_BZ12; |
| | | this.lbl_Alert_Srm4Release.Text = showNowTime + SystemWarningMsg._lbl_Alert_Srm4Release; |
| | | //设置堆垛机任务下发和任务完成确认线程消息 |
| | | this.lbl_Alter_Srm1ReleaseFinish.Text = showNowTime + SystemWarningMsg._lbl_Alert_Srm1ReleaseFinish; |
| | | this.lbl_Alert_Srm2ReleaseFinish.Text = showNowTime + SystemWarningMsg._lbl_Alert_Srm2ReleaseFinish; |
| | | this.lbl_Alert_Srm3ReleaseFinish.Text = showNowTime + SystemWarningMsg._lbl_Alert_Srm3ReleaseFinish; |
| | | this.lbl_Alert_Srm4ReleaseFinish.Text = showNowTime + SystemWarningMsg._lbl_Alert_Srm4ReleaseFinish; |
| | | this.lbl_Alert_DataProcess_BZ12_FinishTask.Text = showNowTime + SystemWarningMsg._lbl_Alert_DataProcess_BZ12_FinishTask; |
| | | this.lbl_Alert_DataProcess_BZ21_FinishTask.Text = showNowTime + SystemWarningMsg._lbl_Alert_DataProcess_BZ21_FinishTask; |
| | | |
| | | this.lbl_Alert_RgvRelease.Text = showNowTime + SystemWarningMsg._lbl_Alert_RgvRelease; |
| | | this.lbl_Alert_RgvReleaseFinish.Text = showNowTime + SystemWarningMsg._lbl_Alert_RgvReleaseFinish; |
| | | this.lbl_Alert_RgvReleaseFinish_BuChang.Text = showNowTime + SystemWarningMsg._lbl_Alert_RgvReleaseFinish_BuChang; |
| | | |
| | | this.lbl_Alert_HandlerIssuingTask.Text = showNowTime + SystemWarningMsg._lbl_Alert_HandlerIssuingTask; |
| | | |
| | | this.lbl_Alert_VirtualTaskNoOutPlanTaskHandler.Text = showNowTime + SystemWarningMsg._lbl_Alert_VirtualTaskNoOutPlanTaskHandler; |
| | | this.lbl_Alert_PushPaperCutToMes.Text = showNowTime + SystemWarningMsg._lbl_Alert_PushPaperCutToMes; |
| | | this.lbl_Alert_PushPackageCodeToMes.Text = showNowTime + SystemWarningMsg._lbl_Alert_PushPackageCodeToMes; |
| | | |
| | | this.lbl_MainTaskDecompose.Text = showNowTime + SystemWarningMsg._lbl_Alert_MainTaskDecompose; |
| | | this.lbl_Alert_DataProcess_BZ12_IssueTask.Text = showNowTime + SystemWarningMsg._lbl_Alert_DataProcess_BZ12_IssueTask; |
| | | |
| | | this.lbl_MainTaskDecompose_ZPRK.Text = showNowTime + SystemWarningMsg._lbl_Alert_MainTaskDecompose_ZPRK; |
| | | this.lbl_Alert_DataProcess_RobotBuffer_FinishTask.Text = showNowTime + SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTask; |
| | | |
| | | this.lbl_Alert_LineInScan.Text = showNowTime + SystemWarningMsg._lbl_Alert_LineInScan; |
| | | this.lbl_DataProcess_BZ21_IssueTask.Text = showNowTime + SystemWarningMsg._lbl_Alert_DataProcess_BZ21_IssueTask; |
| | | |
| | | this.lbl_DataProcess_RobotBuffer_ModeChange.Text = showNowTime + SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_ModeChange; |
| | | |
| | | this.lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound.Text = showNowTime + SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound; |
| | | |
| | | this.lbl_Alert_DeleteData.Text = showNowTime + SystemWarningMsg._lbl_Alert_DeleteData; |
| | | |
| | | this.lbl_Alert_EmptySalverTransfer.Text = showNowTime + SystemWarningMsg._lbl_Alert_EmptySalverTransfer; |
| | | this.lbl_Alert_DataProcess_RobotBuffer_AutoQiTaoOutbound.Text = showNowTime + SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_AutoQiTaoOutbound; |
| | | |
| | | this.lbl_alert_AutoSalverMaterialBindTask.Text = showNowTime + SystemWarningMsg._lbl_alert_AutoSalverMaterialBindTask; |
| | | this.lbl_Alter_DataProcess_BZ21.Text = showNowTime + SystemWarningMsg._lbl_Alert_DataProcess_BZ21; |
| | | |
| | | this.lbl_alert_AutoIssueInStoreTask.Text = showNowTime + SystemWarningMsg._lbl_alert_AutoIssueInStoreTask; |
| | | this.lbl_alert_DataProcess_BZ39.Text = showNowTime + SystemWarningMsg._lbl_alert_DataProcess_BZ39; |
| | | |
| | | this.lbl_alert_AutoUpdateEngineInfoTask.Text = showNowTime + SystemWarningMsg._lbl_alert_AutoUpdateEngineInfoTask; |
| | | this.lbl_alert_DataProcess_BZ01.Text = showNowTime + SystemWarningMsg._lbl_alert_DataProcess_BZ01; |
| | | |
| | | this.lbl_Alert_Place1014ClearStoreTask.Text = showNowTime + SystemWarningMsg._lbl_Alert_Place1014To1020TaskTask; |
| | | this.lbl_alert_DataProcess_269.Text = showNowTime + SystemWarningMsg._lbl_alert_DataProcess_269; |
| | | |
| | | |
| | | this.lbl_Alter_OutTaskRetryToMes.Text = showNowTime + SystemWarningMsg._lbl_Alert_OutTaskRetryToMes; |
| | | this.lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask.Text = showNowTime + SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Log4NetHelper.WriteErrorLog(iWareCommon.Utils.LogType.SrmTheadService, "方法SrmRead_Label出现异常:" + ex.Message, ex); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | |
| | | #region 堆垛机线程和UI处理 |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取堆垛机的实时信息 |
| | |
| | | { |
| | | for (int i = 0; i < waringList.Count; i++) |
| | | { |
| | | DeviceWarningHandler.SaveWarning(device, iWareCommon.Utils.LogType.SrmTheadService, |
| | | DeviceWarningHandler.SaveWarning(device, iWareCommon.Utils.LogType.DataProcess_BZ39_IssueInboundTask, |
| | | waringList[i].Code, waringList[i].Address, waringList[i].Context);//新增报警 |
| | | warningAddressList.Add(waringList[i].Address); |
| | | } |
| | | } |
| | | } |
| | | DeviceWarningHandler.AutoCloseWarning(device, iWareCommon.Utils.LogType.SrmTheadService, warningAddressList);//自动关闭报警 |
| | | DeviceWarningHandler.AutoCloseWarning(device, iWareCommon.Utils.LogType.DataProcess_BZ39_IssueInboundTask, warningAddressList);//自动关闭报警 |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Log4NetHelper.WriteErrorLog(iWareCommon.Utils.LogType.SrmTheadService, "获取" + device.ToString() + "的实时信息异常:" + ex.Message, ex); |
| | | Log4NetHelper.WriteErrorLog(iWareCommon.Utils.LogType.DataProcess_BZ39_IssueInboundTask, "获取" + device.ToString() + "的实时信息异常:" + ex.Message, ex); |
| | | continue; |
| | | } |
| | | }; |
| | |
| | | }; |
| | | realTimeList.Add(obj); |
| | | |
| | | DeviceSrmRealTimeHandler.Update(realTimeList, iWareCommon.Utils.LogType.SrmTheadService); |
| | | DeviceSrmRealTimeHandler.Update(realTimeList, iWareCommon.Utils.LogType.DataProcess_BZ39_IssueInboundTask); |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | for (int i = 0; i < waringList.Count; i++) |
| | | { |
| | | DeviceWarningHandler.SaveWarning(EDevice.RGV, iWareCommon.Utils.LogType.RgvThreadService, |
| | | DeviceWarningHandler.SaveWarning(EDevice.RGV, iWareCommon.Utils.LogType.StationThreadService, |
| | | waringList[i].Codek__BackingField, waringList[i].Addressk__BackingField, waringList[i].Contextk__BackingField);//新增报警 |
| | | warningAddressList.Add(waringList[i].Addressk__BackingField); |
| | | } |
| | |
| | | { |
| | | tb_Rgv_Alter.Text = ""; |
| | | } |
| | | DeviceWarningHandler.AutoCloseWarning(EDevice.RGV, iWareCommon.Utils.LogType.RgvThreadService, warningAddressList);//自动关闭报警 |
| | | DeviceWarningHandler.AutoCloseWarning(EDevice.RGV, iWareCommon.Utils.LogType.StationThreadService, warningAddressList);//自动关闭报警 |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | rgvView = null; |
| | | Log4NetHelper.WriteErrorLog(iWareCommon.Utils.LogType.RgvThreadService, "获取RGV信息出现异常:" + ex.Message, ex); |
| | | Log4NetHelper.WriteErrorLog(iWareCommon.Utils.LogType.StationThreadService, "获取RGV信息出现异常:" + ex.Message, ex); |
| | | continue; |
| | | } |
| | | } |
| | |
| | | }; |
| | | realTimeList.Add(obj); |
| | | } |
| | | DeviceRgvRealTimeHandler.Update(realTimeList, iWareCommon.Utils.LogType.RgvThreadService); |
| | | DeviceRgvRealTimeHandler.Update(realTimeList, iWareCommon.Utils.LogType.StationThreadService); |
| | | |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region AGV |
| | | |
| | | #region 站点线程和UI处理 |
| | | |
| | | /// <summary> |
| | | /// 获取AGV车辆列表 |
| | | /// 设置站点的UI显示 |
| | | /// </summary> |
| | | public void GetAgvVehicles() |
| | | /// <param name="obj"></param> |
| | | private void SetStationLable(object obj) |
| | | { |
| | | while (true) |
| | | { |
| | | Thread.Sleep(cycleDelay_Device); |
| | | try |
| | | { |
| | | if (SystemValue.isAllowRuning_Agv && SystemValue.isStartedModel) |
| | | { |
| | | AGVRetModel list = AgvRequestHelper.GetVehicles(); |
| | | AgvHandler.SaveAgvData(list); |
| | | |
| | | List<String> warningAddressList = new List<string>(); |
| | | if (list.alarms != null && list.alarms.errors != null && list.alarms.errors.Count > 0) |
| | | { |
| | | var waringList = list.alarms.errors; |
| | | if (waringList != null && waringList.Count > 0) |
| | | { |
| | | for (int i = 0; i < waringList.Count; i++) |
| | | { |
| | | DeviceWarningHandler.SaveWarning(EDevice.AGV, iWareCommon.Utils.LogType.AGVTheadService, |
| | | waringList[i].code, waringList[i].code, waringList[i].desc);//新增报警 |
| | | warningAddressList.Add(waringList[i].code); |
| | | } |
| | | } |
| | | } |
| | | DeviceWarningHandler.AutoCloseWarning(EDevice.AGV, iWareCommon.Utils.LogType.AGVTheadService, warningAddressList);//自动关闭报警 |
| | | this.lbl_Alert_Agv.Text = "获取AGV车辆信息成功"; |
| | | } |
| | | //lbRgv_Y.Text = "当前行走位置: " + rgv.R_RgvPosition; |
| | | //lbRgv_X.Text = "当前区域位置: " + rgv.R_RgvPosition; |
| | | //ERgvState _ERgvState = (ERgvState)Enum.Parse(typeof(ERgvState), rgv.R_State.ToString()); |
| | | //lbRgvWorkState.Text = "工作状态: " + _ERgvState.ToString(); |
| | | //lbRgvTaskId.Text = "任务号: " + rgv.R_TaskNo; |
| | | //lbRgvIsAuto.Text = "工作模式: " + (rgv.ModeName); |
| | | //lbRgvAlert.Text = rgv.R_AlarmCode.ToString(); |
| | | //if (rgv.R_Alarm == false) |
| | | //{ |
| | | // //检测是否有心跳 |
| | | // using (var rgvService = new RgvService.RgvServiceClient()) |
| | | // { |
| | | // //检测是否有心跳 |
| | | // var isRgvHandShare = RgvBLL.IsRgvHandShare(rgvService); |
| | | // if (!isRgvHandShare) |
| | | // { |
| | | // lbRgvAlert.Text = "RGV没有心跳"; |
| | | // } |
| | | // } |
| | | //} |
| | | //else |
| | | //{ |
| | | // lbRgvAlert.Text = rgv.R_AlarmCode.ToString(); |
| | | //} |
| | | |
| | | //// ERgvEvent _ERgvEvent = (ERgvEvent)Enum.Parse(typeof(ERgvEvent), rgv.r_ev.ToString()); |
| | | ////lbRgvEvent.Text = "事 件:" + _ERgvEvent.ToString(); |
| | | //lbRgvTaskFinish.Text = "任务完成:" + rgv.R_TaskFinish; |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | catch (Exception) |
| | | { |
| | | Log4NetHelper.WriteErrorLog(iWareCommon.Utils.LogType.CCWCFService, "获取AGV车辆列表 出现异常:" + ex.Message, ex); |
| | | this.lbl_Alert_Agv.Text = "获取AGV车辆信息异常:" + ex.Message; |
| | | } |
| | | finally |
| | | { |
| | | Thread.Sleep(5000);//5秒一次 |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取Station信息 |
| | | /// </summary> |
| | | /// <param name="obj"></param> |
| | | private void GetStationInfo(object obj) |
| | | { |
| | | while (true) |
| | | { |
| | | Thread.Sleep(1000);//1秒钟读取一次 |
| | | try |
| | | { |
| | | if (stationServiceClient == null) |
| | | { |
| | | continue; |
| | | } |
| | | stationView = stationServiceClient.GetStationInfo((int)EDevice.Station); |
| | | |
| | | |
| | | _CommmonShowAgvStation(); |
| | | |
| | | |
| | | ////显示RGV任务完成和完成确认信号 |
| | | //this.lbl_R_RGV_Finish.Text = "RGV任务完成:" + rgvView.R_RGV_Finish; |
| | | //this.lbl_W_RGV_FinishACK.Text = "RGV任务完成确认:" + rgvView.W_RGV_FinishACK; |
| | | |
| | | //this.lbl_RgvCoordinate.Text = "RGV实时坐标:" + rgvView.R_RGV_Coordinate; |
| | | |
| | | /* |
| | | //解析RGV对象 |
| | | foreach (var item in rgvView.R_RgvForReadCommList) |
| | | { |
| | | var control = ControlHelper.GetControlInstance(this.tPTransAsrs, "btn_" + item.StationCode); |
| | | if (item.R_AlarmCode > 0) |
| | | {//有报警 |
| | | if (control != null) |
| | | { |
| | | var btn = control as Button; |
| | | btn.BackColor = Color.Red; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (control != null) |
| | | { |
| | | var btn = control as Button; |
| | | if (item.StationCode == ((int)EDevice.RGV1040).ToString()) |
| | | { |
| | | btn.BackColor = Color.Gold; |
| | | } |
| | | else if (item.StationCode == ((int)EDevice.拆盘机1020).ToString()) |
| | | { |
| | | btn.BackColor = Color.DodgerBlue; |
| | | } |
| | | else if (item.StationCode == ((int)EDevice.提升机1030).ToString()) |
| | | { |
| | | btn.BackColor = Color.SteelBlue; |
| | | } |
| | | else |
| | | { |
| | | btn.BackColor = Color.SeaGreen; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //显示RGV报警信息 |
| | | List<String> warningAddressList = new List<string>(); |
| | | if (rgvView.R_Rgv_WarningDBList != null && rgvView.R_Rgv_WarningDBList.Length > 0) |
| | | { |
| | | tb_Rgv_Alter.Text = String.Join(",", rgvView.R_Rgv_WarningDBList.Select(x => x.Contextk__BackingField).ToArray()); |
| | | //保存报警 |
| | | var waringList = rgvView.R_Rgv_WarningDBList.ToList(); |
| | | if (waringList != null && waringList.Count > 0) |
| | | { |
| | | for (int i = 0; i < waringList.Count; i++) |
| | | { |
| | | DeviceWarningHandler.SaveWarning(EDevice.RGV, iWareCommon.Utils.LogType.RgvThreadService, |
| | | waringList[i].Codek__BackingField, waringList[i].Addressk__BackingField, waringList[i].Contextk__BackingField);//新增报警 |
| | | warningAddressList.Add(waringList[i].Addressk__BackingField); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | tb_Rgv_Alter.Text = ""; |
| | | } |
| | | DeviceWarningHandler.AutoCloseWarning(EDevice.RGV, iWareCommon.Utils.LogType.RgvThreadService, warningAddressList);//自动关闭报警 |
| | | |
| | | //*/ |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | rgvView = null; |
| | | Log4NetHelper.WriteErrorLog(iWareCommon.Utils.LogType.StationThreadService, "获取站点信息出现异常:" + ex.Message, ex); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 其他线程 |
| | | |
| | |
| | | using (var opcClinet = new SrmService.SrmServiceClient()) |
| | | { |
| | | var result = opcClinet.SendEStop((int)_EDevice); |
| | | Log4NetHelper.WriteInfoLog(iWareCommon.Utils.LogType.SrmTheadService, "字符串:" + JsonConvert.SerializeObject(result)); |
| | | Log4NetHelper.WriteInfoLog(iWareCommon.Utils.LogType.DataProcess_BZ39_IssueInboundTask, "字符串:" + JsonConvert.SerializeObject(result)); |
| | | if (result.result) |
| | | { |
| | | WZ.Useful.Commons.MessageUtil.ShowTips("发送" + _EDevice.ToString() + "急停指令成功"); |
| | |
| | | this.lbl_ModelText.Text = title + currentCheckModelText; |
| | | SetAllCheckBoxChecked(true); |
| | | //将特殊的取消 |
| | | this.ckHandlerIssuingTask.Checked = false; |
| | | this.ckMainTaskDecompose.Checked = false; |
| | | this.ck_DataProcess_BZ12_IssueTask.Checked = false; |
| | | this.ck_DataProcess_BZ21_IssueTask.Checked = false; |
| | | |
| | | this.gBoxThread.Enabled = true; |
| | | } |
| | |
| | | private void CommonCheckedChanged(object sender, EventArgs e) |
| | | { |
| | | //堆垛机1任务下发 |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_SrmTaskThreadService_1, ckBSrm1Release); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_SrmTaskThreadService_1, ckB_DataProcess_BZ39_IssueInboundTask); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_SrmTaskThreadService_1_Finish, ckBSrm1FinishedHandle); |
| | | |
| | | //堆垛机2任务下发 |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_SrmTaskThreadService_2, ckBSrm2Release); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_SrmTaskThreadService_2_Finish, ckBSrm2FinishedHandle); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_SrmTaskThreadService_2, ckBDataProcess_RobotBuffer_ForceOutbound); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_SrmTaskThreadService_2_Finish, ckBDataProcess_BZ12_FinishTask); |
| | | |
| | | //堆垛机3任务下发 |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_SrmTaskThreadService_3, ckBSrm3Release); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_SrmTaskThreadService_3_Finish, ckBSrm3FinishedHandle); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_SrmTaskThreadService_3, ckBDataProcess_BZ12); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_SrmTaskThreadService_3_Finish, ckBDataProcess_BZ21_FinishTask); |
| | | |
| | | //堆垛机4任务下发 |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_SrmTaskThreadService_4, ckBSrm4Release); |
| | |
| | | |
| | | //RGV任务下发 |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_RgvThreadService, ckBRgvRelease); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_RgvThreadService_Finish, ckBRgvFinishedHandle); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_RgvThreadService_Finish_BuChang, ckBRgvFinishedHandle_BuChang); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_RgvThreadService_Finish, ckB_PushPaperCutToMes); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_RgvThreadService_Finish_BuChang, ck_PushPackageCodeToMes); |
| | | |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_HandlerIssuingTask, ckHandlerIssuingTask); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_HandlerIssuingTask, ck_DataProcess_BZ12_IssueTask); |
| | | |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_VirtualTaskNoOutPlanTaskHandler, ck_VirtualTaskNoOutPlanTaskHandler); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_RobotBuffer_FinishTask, ck_DataProcess_RobotBuffer_FinishTask); |
| | | |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_MainTaskDecompose, ckMainTaskDecompose); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_MainTaskDecompose, ck_DataProcess_BZ21_IssueTask); |
| | | |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_MainTaskDecompose_ZPRK, ckMainTaskDecompose_ZPRK); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_RobotBuffer_ModeChange, ck_DataProcess_RobotBuffer_ModeChange); |
| | | |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_LineInScan, checkBox_LineInScan); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_ValidateQiTao, ck_DataProcess_ValidateQiTao); |
| | | |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_RobotBuffer_FinishTaskForOutbound, checkBox_DataProcess_RobotBuffer_FinishTaskForOutbound); |
| | | |
| | | |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DeleteData, ckDeleteData); |
| | | |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_Agv, ckAgv); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_RobotBuffer_AutoQiTaoOutbound, ckDataProcess_RobotBuffer_AutoQiTaoOutbound); |
| | | |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_EmptySalverTransfer, ckEmptySalverTransfer); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_BZ39, ck_DataProcess_BZ39); |
| | | |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_AutoSalverMaterialBindTask, ck_AutoSalverMaterialBindTask); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_BZ01, ck_AutoIssueInStoreTask); |
| | | |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_AutoIssueInStoreTask, ck_AutoIssueInStoreTask); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_269, ck_DataProcess_269); |
| | | |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_AutoUpdateEngineInfoTask, ck_AutoUpdateEngineInfoTask); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_RobotBuffer_IssueOutboundTask, ck_DataProcess_RobotBuffer_IssueOutboundTask); |
| | | |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_Place1014To1020Task, ckPlace1014ClearStoreTask); |
| | | |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_OutTaskRetryToMes, checkBox_OutTaskRetryToMes); |
| | | DoCommonCheckedChanged(ref SystemValue.isAllowRuning_OutTaskRetryToMes, checkBox_DataProcess_BZ21); |
| | | } |
| | | |
| | | private void DoCommonCheckedChanged(ref bool isAllowValue, CheckBox cb) |
| | |
| | | DialogResult dr = MessageBox.Show("确定要启动【" + currentCheckModelText + "】模式吗?", "启动模式", messButton); |
| | | if (dr == DialogResult.OK)//如果点击“确定”按钮 |
| | | { |
| | | using (DbModel edm = new DbModel()) |
| | | using (WmsDBModel edm = new WmsDBModel()) |
| | | { |
| | | var ccSystem = BasicDataSetHandler.GetCCSystem(edm); |
| | | if (ccSystem == null) |
| | |
| | | /// <returns></returns> |
| | | private bool CommonStopService() |
| | | { |
| | | using (DbModel edm = new DbModel()) |
| | | using (WmsDBModel edm = new WmsDBModel()) |
| | | { |
| | | var ccSystem = BasicDataSetHandler.GetCCSystem(edm); |
| | | if (ccSystem == null) |
| | |
| | | ccSystem.Machine = string.Empty; |
| | | ccSystem.LastMachine = Dns.GetHostName(); |
| | | ccSystem.LastUnLineTime = DateTime.Now; |
| | | ccSystem.ModifyTime = DateTime.Now; |
| | | ccSystem.UpdateTime = DateTime.Now; |
| | | |
| | | int i = edm.SaveChanges(); |
| | | if (i <= 0) |
| | |
| | | this.btn_Start.BackColor = default_btn_Start_Color;//还原颜色 |
| | | } |
| | | } |
| | | |
| | | this.lbl_RobotMode.Text = "缓存岛机器人模式:" + (IsAllowRunOutMode ? "出库模式" : "入库模式"); |
| | | this.lbl_currHandlerPackageCodeForIssueOutboundTask.Text = "当前下发出库任务的包号:" + currHandlerPackageCodeForIssueOutboundTask; |
| | | } |
| | | } |
| | | |
| | |
| | | "转换后:" + "\r\n" + |
| | | JsonConvert.SerializeObject(retModel); |
| | | } |
| | | |
| | | private void lbl_Alert_Place1014ClearStoreTask_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | } |
| | | |
| | | private void button24_Click(object sender, EventArgs e) |
| | | { |
| | | //强制该包号出库 |
| | | var packageCode = this.tb_PackageCode.Text.Trim(); |
| | | |
| | | var alertMsg = ""; |
| | | CC_DataProcess_RobotBuffer_ForceOutbound.Handler(packageCode, ref alertMsg); |
| | | if (!string.IsNullOrEmpty(alertMsg)) |
| | | { |
| | | MessageBox.Show("错误:" + alertMsg); |
| | | } |
| | | else |
| | | { |
| | | MessageBox.Show("已处理"); |
| | | } |
| | | } |
| | | |
| | | private void button25_Click(object sender, EventArgs e) |
| | | { |
| | | var packageCode = this.tb_PackageCode.Text.Trim(); |
| | | |
| | | var alertMsg = ""; |
| | | using (WmsDBModel db = new WmsDBModel()) |
| | | { |
| | | var upiList = db.mes_batchOrderUPI_new.Where(x => x.PackageCode == packageCode).ToList(); |
| | | foreach (var item in upiList) |
| | | { |
| | | item.AreaCode = (int)AreaCodeEnum.无区域; |
| | | item.UpiStatus = (int)UpiStatusEnum.初始; |
| | | } |
| | | |
| | | var pList = db.mes_package_gather.Where(x => x.PackageCode == packageCode).ToList(); |
| | | foreach (var item in pList) |
| | | { |
| | | item.AreaCode = (int)AreaCodeEnum.无区域; |
| | | item.UpiStatus = (int)UpiStatusEnum.初始; |
| | | } |
| | | |
| | | db.SaveChanges(); |
| | | } |
| | | if (!string.IsNullOrEmpty(alertMsg)) |
| | | { |
| | | MessageBox.Show("错误:" + alertMsg); |
| | | } |
| | | else |
| | | { |
| | | MessageBox.Show("已处理"); |
| | | } |
| | | } |
| | | } |
| | | } |