| | |
| | | if (flag && value != null) |
| | | { |
| | | OtherDevice device = (OtherDevice)value; |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StackerCraneCode == device.DeviceCode && x.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt() && x.IsOccupied == 0); |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.CraneCode == device.DeviceCode); |
| | | foreach (var item in stationMangers) |
| | | { |
| | | //è·ååè®® |
| | | DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StackerCraneCode && x.DeviceProParamType == nameof(R_MDDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StackerCraneCode && x.DeviceProParamType == nameof(W_MDDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.CraneCode && x.DeviceProParamType == nameof(R_MDDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.CraneCode && x.DeviceProParamType == nameof(W_MDDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | if (deviceProRead != null && deviceProWrite != null) |
| | | { |
| | | short Allow = device.GetValue<R_MDDB, short>(R_MDDB.R_MDAllow, item.StackerCraneCode); |
| | | short Allow = device.GetValue<R_MDDB, short>(R_MDDB.R_MDAllow, item.CraneCode); |
| | | |
| | | #region 读åå·¥ä½ç¶æ |
| | | short R_MDStatus1 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus1, item.StackerCraneCode); |
| | | short R_MDStatus2 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus2, item.StackerCraneCode); |
| | | short R_MDStatus3 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus3, item.StackerCraneCode); |
| | | short R_MDStatus4 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus4, item.StackerCraneCode); |
| | | short R_MDStatus1 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus1, item.CraneCode); |
| | | short R_MDStatus2 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus2, item.CraneCode); |
| | | short R_MDStatus3 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus3, item.CraneCode); |
| | | short R_MDStatus4 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus4, item.CraneCode); |
| | | |
| | | short ReceiveDoneState = device.GetValue<W_MDDB, short>(W_MDDB.W_MDReceiveDone, item.StackerCraneCode); |
| | | short ReceiveDoneState = device.GetValue<W_MDDB, short>(W_MDDB.W_MDReceiveDone, item.CraneCode); |
| | | #endregion |
| | | //ç åç¶æ |
| | | short PackState = device.GetValue<R_MDDB, short>(GetPackStateEnum(item.StackerCraneStationCode), item.StackerCraneCode); |
| | | short PackState = device.GetValue<R_MDDB, short>(GetPackStateEnum(item.CraneStationCode), item.CraneCode); |
| | | //ç åæ°é |
| | | short PackNum = device.GetValue<R_MDDB, short>(GetPackNumEnum(item.StackerCraneStationCode), item.StackerCraneCode); |
| | | short PackNum = device.GetValue<R_MDDB, short>(GetPackNumEnum(item.CraneStationCode), item.CraneCode); |
| | | if (R_MDStatus1 == 1 || R_MDStatus2 == 1 || R_MDStatus3 == 1 || R_MDStatus4 == 1) |
| | | { |
| | | Thread.Sleep(200); |
| | | if (ReceiveDoneState != 0) |
| | | { |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDReceiveDone.ToString()).DeviceProDataBlock, 0); |
| | | WriteInfo(item.StackerCraneCode, $"{item.StackerCraneCode}æ¸
é¤ä¸åæ è¯ä¿¡å·"); |
| | | WriteInfo(item.CraneCode, $"{item.CraneCode}æ¸
é¤ä¸åæ è¯ä¿¡å·"); |
| | | } |
| | | continue; |
| | | } |
| | | if (PackState == 2) |
| | | { |
| | | Thread.Sleep(200); |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == GetPackSendEnum(item.StackerCraneStationCode).ToString()).DeviceProDataBlock, 0); |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == GetPackSendEnum(item.CraneStationCode).ToString()).DeviceProDataBlock, 0); |
| | | WriteInfo(item.StationName, $"{item.StationName}æ¸
é¤å·¥ä½ç»æä¿¡å·"); |
| | | continue; |
| | | } |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == GetPackSendEnum(item.StackerCraneStationCode).ToString()).DeviceProDataBlock, 2); |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == GetPackSendEnum(item.CraneStationCode).ToString()).DeviceProDataBlock, 2); |
| | | WriteInfo(item.StationName, $"{item.StationName}åå
¥å·¥ä½ç»æä¿¡å·"); |
| | | //è·åå½åä»»å¡ |
| | | Dt_Task task = _taskRepository.QueryData(x => x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.DeviceCode == device.DeviceCode).OrderBy(x => x.TaskNum).FirstOrDefault(); |
| | |
| | | if (task != null) |
| | | { |
| | | //åå
¥å·¥ä½å· |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDSendID.ToString()).DeviceProDataBlock, Convert.ToInt16(item.StackerCraneStationCode)); |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDSendID.ToString()).DeviceProDataBlock, Convert.ToInt16(item.CraneStationCode)); |
| | | //åå
¥å·¥ä½å
许ç å |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == GetPackSendEnum(item.StackerCraneStationCode).ToString()).DeviceProDataBlock, 1); |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == GetPackSendEnum(item.CraneStationCode).ToString()).DeviceProDataBlock, 1); |
| | | |
| | | #region è·ååå
¥ç åXãYãZåæ |
| | | |