| | |
| | | if (flag && value != null) |
| | | { |
| | | OtherDevice device = (OtherDevice)value; |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StackerCraneCode == device.DeviceCode && x.StationType == 33); |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StackerCraneCode == device.DeviceCode && x.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt() && x.IsOccupied == 0); |
| | | 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(); |
| | | if (deviceProRead != null && deviceProWrite != null && item.IsOccupied == 0) |
| | | if (deviceProRead != null && deviceProWrite != null) |
| | | { |
| | | short Allow = device.GetValue<R_MDDB, short>(R_MDDB.R_MDAllow, 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 ReceiveDoneState = device.GetValue<W_MDDB, short>(W_MDDB.W_MDReceiveDone, item.StackerCraneCode); |
| | | #endregion |
| | | |
| | | //ç åç¶æ |
| | | short PackState = device.GetValue<R_MDDB, short>(GetPackStateEnum(item.StackerCraneStationCode), item.StackerCraneCode); |
| | | |
| | | //ç åæ°é |
| | | short PackNum = device.GetValue<R_MDDB, short>(GetPackNumEnum(item.StackerCraneStationCode), item.StackerCraneCode); |
| | | if (R_MDStatus1 == 1 || R_MDStatus2 == 1 || R_MDStatus3 == 1 || R_MDStatus4 == 1) |
| | | { |
| | | Thread.Sleep(500); |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDReceiveDone.ToString()).DeviceProDataBlock, 0); |
| | | 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}æ¸
é¤ä¸åæ è¯ä¿¡å·"); |
| | | } |
| | | continue; |
| | | } |
| | | if (PackState == 2) |
| | | { |
| | | Thread.Sleep(200); |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == GetPackSendEnum(item.StackerCraneStationCode).ToString()).DeviceProDataBlock, 0); |
| | | WriteInfo(item.StationName, $"{item.StationName}æ¸
é¤å·¥ä½ç»æä¿¡å·"); |
| | | continue; |
| | | } |
| | | var axis = _packaxisRepository.QueryFirst(x => x.DeviceCode == item.StackerCraneCode && x.StationCode == Convert.ToInt32(item.StackerCraneStationCode)); |
| | | if (axis != null) |
| | |
| | | if (Convert.ToInt32(PackNum) == axis.PackNum) |
| | | { |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == GetPackSendEnum(item.StackerCraneStationCode).ToString()).DeviceProDataBlock, 2); |
| | | WriteInfo(item.StationName, $"{item.StationName}åå
¥å·¥ä½ç»æä¿¡å·"); |
| | | continue; |
| | | } |
| | | |
| | | ConsoleHelper.WriteInfoLine($"ç åå·¥ä½{item.StationCode}ç¶æ{Allow}"); |
| | | //ç åç³è¯· |
| | | if (Allow == 3 || Allow == 7) |
| | | { |
| | |
| | | |
| | | if (task != null) |
| | | { |
| | | 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 == W_MDDB.W_MDSendID.ToString()).DeviceProDataBlock, Convert.ToInt16(item.StackerCraneStationCode)); |
| | | //åå
¥å·¥ä½å
许ç å |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == GetPackSendEnum(item.StackerCraneStationCode).ToString()).DeviceProDataBlock, 1); |
| | | |
| | | #region è·ååå
¥ç åXãYãZåæ |
| | | (int, int, int) result = GetAxis(PackNum, axis, item.StackerCraneStationCode); |
| | | |
| | | WriteInfo(item.StationName, $"ç åæ°éã{PackNum}ãï¼ä¸åç ååæ XãYãZã{result.Serialize()}ã"); |
| | | |
| | | |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDX.ToString()).DeviceProDataBlock, result.Item1); |
| | | |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDY.ToString()).DeviceProDataBlock, result.Item2); |
| | | |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDZ.ToString()).DeviceProDataBlock, result.Item3); |
| | | |
| | | WriteInfo(item.StationName, $"ç åæ°éã{PackNum}ãï¼ä¸åç ååæ XãYãZã{result.Serialize()}ã"); |
| | | #endregion |
| | | |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDA.ToString()).DeviceProDataBlock, 1); |
| | | |
| | | //åå
¥ä¸åæ è¯ |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDReceiveDone.ToString()).DeviceProDataBlock, 3); |
| | | |
| | | //æ´æ°ä»»å¡ä¿¡æ¯ |
| | | //_taskService.TaskCompleted(task.TaskNum); |
| | | task.TaskState = TaskStatusEnum.Finish.ObjToInt(); |
| | | //_taskRepository.UpdateData(task); |
| | | Thread.Sleep(1500); |
| | | //_taskService.TaskCompleted(task.TaskNum); |
| | | Thread.Sleep(1000); |
| | | WriteInfo(item.StationName, $"ä»»å¡å·{task.TaskNum}ç å"); |
| | | return Task.CompletedTask; |
| | | } |
| | |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç åæ°é |
| | | /// </summary> |
| | | public R_MDDB GetPackNumEnum(string StationCode) |
| | | { |
| | | switch (StationCode) |
| | |
| | | throw new Exception("æªå®ä¹å·¥ä½"); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// ç åç¶æ |
| | | /// </summary> |
| | | public R_MDDB GetPackStateEnum(string StationCode) |
| | | { |
| | | switch (StationCode) |
| | |
| | | throw new Exception("æªå®ä¹å·¥ä½"); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// ç åå·¥ä½ |
| | | /// </summary> |
| | | public W_MDDB GetPackSendEnum(string StationCode) |
| | | { |
| | | switch (StationCode) |