| | |
| | | var ret = plcStackeConn.SetPlcDBValue(PLCDataTypeEnum.Bit, "DB119", "0", PLCTaskAction.boDemo == true ? "1" : "0"); |
| | | if (ret.IsSucceed) |
| | | { |
| | | await _sysConfigService.UpdateConfigValue("sys_demo", context.BoDemo.Value); |
| | | if (PLCTaskAction.boDemo) |
| | | { |
| | | // 写入plc抓箱品种 |
| | | var rett = plcStackeConn.SetPlcDBValue(PLCDataTypeEnum.Short, "DB111", "0", "1"); |
| | | if (rett.IsSucceed) |
| | | { |
| | | await _sysConfigService.UpdateConfigValue("sys_demo", context.BoDemo.Value); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var rett = plcStackeConn.SetPlcDBValue(PLCDataTypeEnum.Short, "DB111", "0", "0"); |
| | | if (rett.IsSucceed) |
| | | { |
| | | await _sysConfigService.UpdateConfigValue("sys_demo", context.BoDemo.Value); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | else |
| | | { |
| | | PLCTaskAction.boDrumReversal = !PLCTaskAction.boDrumReversal; |
| | | |
| | | await _plcHubContext.Clients.All.UpdateService( |
| | | new PLCServiceModel() |
| | | { |
| | | BoRunningState = PLCTaskAction.boRunningState, |
| | | BoRefresh = PLCTaskAction.boRefresh, |
| | | BoOffline = PLCTaskAction.boOffline, |
| | | BoDemo = PLCTaskAction.boDemo, |
| | | BoDrumReversal = PLCTaskAction.boDrumReversal, |
| | | Error = "与PCL交互失败,操作失败!" |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | PLCTaskAction.boDrumReversal = !PLCTaskAction.boDrumReversal; |
| | | |
| | | await _plcHubContext.Clients.All.UpdateService( |
| | | new PLCServiceModel() |
| | | { |
| | | BoRunningState = PLCTaskAction.boRunningState, |
| | | BoRefresh = PLCTaskAction.boRefresh, |
| | | BoOffline = PLCTaskAction.boOffline, |
| | | BoDemo = PLCTaskAction.boDemo, |
| | | BoDrumReversal = PLCTaskAction.boDrumReversal, |
| | | Error = "PCL未连接,操作失败!" |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | await _plcHubContext.Clients.All.UpdateService(new PLCServiceModel() { BoRunningState = PLCTaskAction.boRunningState, BoRefresh = PLCTaskAction.boRefresh, BoOffline = PLCTaskAction.boOffline, BoDemo = PLCTaskAction.boDemo, BoDrumReversal = PLCTaskAction.boDrumReversal }); |