| | |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Core.LogHelper; |
| | | using WIDESEAWCS_DTO; |
| | | using WIDESEAWCS_DTO.Agv; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | |
| | | using WIDESEAWCS_Tasks; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using WIDESEAWCS_Tasks.DBNames; |
| | | using WIDESEAWCS_Tasks.StackPlateJob; |
| | | using static Dm.net.buffer.ByteArrayBuffer; |
| | | |
| | | namespace WIDESEAWCS_Server.Controllers |
| | |
| | | else |
| | | { |
| | | _taskService.TaskCompleted(task.TaskNum); |
| | | if (task.TaskType==TaskTypeEnum.PrintYLOutbound.ObjToInt()) |
| | | if (task.TaskType==TaskTypeEnum.PrintYLOutbound.ObjToInt() || task.TaskType == TaskTypeEnum.OutCarton.ObjToInt()) |
| | | { |
| | | PutFinish(task.NextAddress); |
| | | } |
| | |
| | | { |
| | | return content.Error($"æªæ¾å°ç«å°é
ç½®"); |
| | | } |
| | | #region todo:临æ¶é»è¾ |
| | | if (stationManger.StationDeviceCode=="MES") |
| | | { |
| | | |
| | | RequestAGVArriveDTO requestAGVArriveDTO =new RequestAGVArriveDTO() |
| | | { |
| | | SD_WorkCentreAgvArriveNoticeInfo=new List<AgvArriveNotice> { new AgvArriveNotice() |
| | | { |
| | | DispatchPlanMaterialId=409, |
| | | WorkCentreCode="66", |
| | | LocationCode="3-ZD-ZJZZ", |
| | | CallId="4534c242-27a7-4fb6-86f5-460b09db303d" |
| | | } } |
| | | }; |
| | | WebResponseContent webResponse= _taskService.MESAvgArriveNotice(requestAGVArriveDTO); |
| | | if (webResponse.Message.Contains("\"obj\": true")) |
| | | { |
| | | return content.Error($"å
许åæ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error($"ç¦æ¢æ¾æ"); |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device == null) |
| | | { |
| | | return content.Error($"æªæ¾å°å¯¹åºè®¾å¤"); |
| | | } |
| | | if (device.DeviceCode.Contains("Plate")) |
| | | { |
| | | CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device; |
| | | StackPlateTaskCommandCommand command = commonConveyorLine.ReadCustomer<StackPlateTaskCommandCommand>(device.DeviceCode); |
| | | |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | if (command != null && command.State == 2 && command.InteractiveSignal == 1) |
| | | { |
| | | return content.OK("å
è®¸æ¾æ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢æ¾æ"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | |
| | | if (device.DeviceCode.Contains("CP"))//æåè¾é线 |
| | | { |
| | | short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode); |
| | | if (Command == 3) |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | |
| | | if (device.DeviceCode.Contains("CP"))//æåè¾é线 |
| | | { |
| | | content.OK("å
è®¸æ¾æ"); |
| | | short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode); |
| | | if (Command == 3) |
| | | { |
| | | content.OK("å
è®¸æ¾æ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢æ¾æ"); |
| | | } |
| | | } |
| | | else |
| | | else if (device.DeviceCode.Contains("Coveryor"))//æ¥é©³å° |
| | | { |
| | | return content.Error("ç¦æ¢æ¾æ"); |
| | | bool RequestPut = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_RequestPut, stationManger.StationDeviceCode); |
| | | if (!RequestPut) |
| | | { |
| | | otherDevice.SetValue(CoveryorDB.C_InTaskNum, taskNum, stationManger.StationDeviceCode); |
| | | otherDevice.SetValue(CoveryorDB.C_RequestPut, true, stationManger.StationDeviceCode); |
| | | Thread.Sleep(1000); |
| | | } |
| | | bool AllowFinish = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_AllowFinish, stationManger.StationDeviceCode); |
| | | if (AllowFinish) |
| | | { |
| | | content.OK("å
è®¸æ¾æ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢æ¾æ"); |
| | | } |
| | | } |
| | | else if (device.DeviceCode.Contains("Retract"))//伸缩货å |
| | | { |
| | | bool RequestPut = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_RequestPut, stationManger.StationDeviceCode); |
| | | if (!RequestPut) |
| | | { |
| | | otherDevice.SetValue(RetractDB.Ret_TargetAddress, Convert.ToInt16(stationManger.StationCode), stationManger.StationDeviceCode); |
| | | otherDevice.SetValue(RetractDB.Ret_RequestPut, true, stationManger.StationDeviceCode); |
| | | Thread.Sleep(1000); |
| | | } |
| | | bool AllowFinish = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_AllowFinish, stationManger.StationDeviceCode); |
| | | if (AllowFinish) |
| | | { |
| | | content.OK("å
è®¸æ¾æ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢æ¾æ"); |
| | | } |
| | | } |
| | | else if (device.DeviceCode.Contains("TrussCarton"))//æ¡æ¶ |
| | | { |
| | | bool RequestPut = otherDevice.GetValue<W_TrussCartonDB, bool>(GetCartonRequest(stationManger.StackerCraneStationCode), stationManger.StationDeviceCode); |
| | | if (!RequestPut) |
| | | { |
| | | otherDevice.SetValue(GetCartonRequest(stationManger.StackerCraneStationCode), true, stationManger.StationDeviceCode); |
| | | Thread.Sleep(1000); |
| | | } |
| | | bool AllowFinish = otherDevice.GetValue<R_TrussCartonDB, bool>(GetCarton(stationManger.StackerCraneStationCode), stationManger.StationDeviceCode); |
| | | if (AllowFinish) |
| | | { |
| | | content.OK("å
è®¸æ¾æ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢æ¾æ"); |
| | | } |
| | | } |
| | | } |
| | | else if (device.DeviceCode.Contains("Coveryor"))//æ¥é©³å° |
| | | { |
| | | bool RequestPut = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_RequestPut, stationManger.StationDeviceCode); |
| | | if (!RequestPut) |
| | | { |
| | | otherDevice.SetValue(CoveryorDB.C_InTaskNum, taskNum, stationManger.StationDeviceCode); |
| | | otherDevice.SetValue(CoveryorDB.C_RequestPut, true, stationManger.StationDeviceCode); |
| | | Thread.Sleep(1000); |
| | | } |
| | | bool AllowFinish = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_AllowFinish, stationManger.StationDeviceCode); |
| | | if (AllowFinish) |
| | | { |
| | | content.OK("å
è®¸æ¾æ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢æ¾æ"); |
| | | } |
| | | } |
| | | else if (device.DeviceCode.Contains("Retract"))//伸缩货å |
| | | { |
| | | bool RequestPut = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_RequestPut, stationManger.StationDeviceCode); |
| | | if (!RequestPut) |
| | | { |
| | | otherDevice.SetValue(RetractDB.Ret_TargetAddress, Convert.ToInt16(stationManger.StationCode), stationManger.StationDeviceCode); |
| | | otherDevice.SetValue(RetractDB.Ret_RequestPut, true, stationManger.StationDeviceCode); |
| | | Thread.Sleep(1000); |
| | | } |
| | | bool AllowFinish = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_AllowFinish, stationManger.StationDeviceCode); |
| | | if (AllowFinish) |
| | | { |
| | | content.OK("å
è®¸æ¾æ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢æ¾æ"); |
| | | } |
| | | } |
| | | |
| | | return content; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å¯¹åºè®¾å¤"); |
| | | } |
| | | |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | if (device.DeviceCode.Contains("Coveryor"))//æ¥é©³å° |
| | | if (device.DeviceCode.Contains("Plate")) |
| | | { |
| | | otherDevice.SetValue(CoveryorDB.C_PutFinish, true, stationManger.StationDeviceCode); |
| | | CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device; |
| | | commonConveyorLine.SetValue(StackPlateDBName.WriteInteractiveSignal, Convert.ToInt16(1), device.DeviceCode); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | else if (device.DeviceCode.Contains("Retract"))//伸缩货å |
| | | else |
| | | { |
| | | otherDevice.SetValue(RetractDB.Ret_PutFinish, true, stationManger.StationDeviceCode); |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | if (device.DeviceCode.Contains("Coveryor"))//æ¥é©³å° |
| | | { |
| | | otherDevice.SetValue(CoveryorDB.C_PutFinish, true, stationManger.StationDeviceCode); |
| | | } |
| | | else if (device.DeviceCode.Contains("Retract"))//伸缩货å |
| | | { |
| | | otherDevice.SetValue(RetractDB.Ret_PutFinish, true, stationManger.StationDeviceCode); |
| | | } |
| | | else if (device.DeviceCode.Contains("TrussCarton"))//çº¸ç®±æ¡æ¶ |
| | | { |
| | | otherDevice.SetValue(GetCartonPut(stationManger.StackerCraneStationCode), true, stationManger.StationDeviceCode); |
| | | } |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// è·åæ¡æ¶æ¾æä¿¡å· |
| | | /// </summary> |
| | | public W_TrussCartonDB GetCartonPut(string StationCode) |
| | | { |
| | | switch (StationCode) |
| | | { |
| | | case "1": |
| | | return W_TrussCartonDB.W_CartonPut1; |
| | | case "2": |
| | | return W_TrussCartonDB.W_CartonPut2; |
| | | case "3": |
| | | return W_TrussCartonDB.W_CartonPut3; |
| | | case "4": |
| | | return W_TrussCartonDB.W_CartonPut4; |
| | | case "5": |
| | | return W_TrussCartonDB.W_CartonPut5; |
| | | case "6": |
| | | return W_TrussCartonDB.W_CartonPut6; |
| | | default: |
| | | throw new Exception("æªå®ä¹å·¥ä½"); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// è·åæ¡æ¶è¯·æ±ä¿¡å· |
| | | /// </summary> |
| | | public W_TrussCartonDB GetCartonRequest(string StationCode) |
| | | { |
| | | switch (StationCode) |
| | | { |
| | | case "1": |
| | | return W_TrussCartonDB.W_CartonRequest1; |
| | | case "2": |
| | | return W_TrussCartonDB.W_CartonRequest2; |
| | | case "3": |
| | | return W_TrussCartonDB.W_CartonRequest3; |
| | | case "4": |
| | | return W_TrussCartonDB.W_CartonRequest4; |
| | | case "5": |
| | | return W_TrussCartonDB.W_CartonRequest5; |
| | | case "6": |
| | | return W_TrussCartonDB.W_CartonRequest6; |
| | | default: |
| | | throw new Exception("æªå®ä¹å·¥ä½"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åæ¡æ¶è¿å
¥ä¿¡å· |
| | | /// </summary> |
| | | public R_TrussCartonDB GetCarton(string StationCode) |
| | | { |
| | | switch (StationCode) |
| | | { |
| | | case "1": |
| | | return R_TrussCartonDB.R_CartonAllow1; |
| | | case "2": |
| | | return R_TrussCartonDB.R_CartonAllow2; |
| | | case "3": |
| | | return R_TrussCartonDB.R_CartonAllow3; |
| | | case "4": |
| | | return R_TrussCartonDB.R_CartonAllow4; |
| | | case "5": |
| | | return R_TrussCartonDB.R_CartonAllow5; |
| | | case "6": |
| | | return R_TrussCartonDB.R_CartonAllow6; |
| | | default: |
| | | throw new Exception("æªå®ä¹å·¥ä½"); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å¯¹åºè®¾å¤{stationManger.StationDeviceCode}"); |
| | | } |
| | | |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | |
| | | if (otherDevice.DeviceCode.Contains("CP"))//æåè¾é线 |
| | | if (device.DeviceCode.Contains("Plate")) |
| | | { |
| | | short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode); |
| | | if (Command == 2) |
| | | CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device; |
| | | StackPlateTaskCommandCommand command = commonConveyorLine.ReadCustomer<StackPlateTaskCommandCommand>(device.DeviceCode); |
| | | |
| | | if (command != null&&command.State == 2 && command.InteractiveSignal == 2) |
| | | { |
| | | content.OK("å
许åæ"); |
| | | return content.OK("å
许åæ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢åæ"); |
| | | } |
| | | } |
| | | else if (device.DeviceCode.Contains("Coveryor"))//æ¥é©³å° |
| | | else |
| | | { |
| | | bool AllowTake = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_AllowTake, stationManger.StationDeviceCode); |
| | | if (AllowTake) |
| | | { |
| | | content.OK("å
许åæ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢åæ"); |
| | | } |
| | | } |
| | | else if (device.DeviceCode.Contains("Retract"))//伸缩货å |
| | | { |
| | | bool AllowTake = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_AllowTake, stationManger.StationDeviceCode); |
| | | if (AllowTake) |
| | | { |
| | | content.OK("å
许åæ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢åæ"); |
| | | } |
| | | } |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | |
| | | if (otherDevice.DeviceCode.Contains("CP"))//æåè¾é线 |
| | | { |
| | | short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode); |
| | | if (Command == 2) |
| | | { |
| | | content.OK("å
许åæ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢åæ"); |
| | | } |
| | | } |
| | | else if (device.DeviceCode.Contains("Coveryor"))//æ¥é©³å° |
| | | { |
| | | bool AllowTake = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_AllowTake, stationManger.StationDeviceCode); |
| | | if (AllowTake) |
| | | { |
| | | content.OK("å
许åæ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢åæ"); |
| | | } |
| | | } |
| | | else if (device.DeviceCode.Contains("Retract"))//伸缩货å |
| | | { |
| | | bool AllowTake = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_AllowTake, stationManger.StationDeviceCode); |
| | | if (AllowTake) |
| | | { |
| | | content.OK("å
许åæ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢åæ"); |
| | | } |
| | | } |
| | | } |
| | | return content; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | } |
| | | |
| | | //[HttpPost, HttpGet, Route("TakeFinish"), AllowAnonymous] |
| | | /// <summary> |
| | | /// åè´§å®æ |
| | | /// </summary> |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å¯¹åºè®¾å¤"); |
| | | } |
| | | |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | if (device.DeviceCode.Contains("CP")) |
| | | if (device.DeviceCode.Contains("Plate")) |
| | | { |
| | | otherDevice.SetValue(W_ConveyorLineCPDB.W_Command, 2, stationManger.StationCode); |
| | | CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device; |
| | | commonConveyorLine.SetValue(StackPlateDBName.WriteInteractiveSignal, Convert.ToInt16(2), device.DeviceCode); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | else if (device.DeviceCode.Contains("Coveryor")) |
| | | else |
| | | { |
| | | otherDevice.SetValue(CoveryorDB.C_TakeFinish, true, stationManger.StationDeviceCode); |
| | | } |
| | | else if (device.DeviceCode.Contains("Retract"))//伸缩货å |
| | | { |
| | | otherDevice.SetValue(RetractDB.Ret_TakeFinish, true, stationManger.StationDeviceCode); |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | if (device.DeviceCode.Contains("CP")) |
| | | { |
| | | otherDevice.SetValue(W_ConveyorLineCPDB.W_Command, 2, stationManger.StationCode); |
| | | } |
| | | else if (device.DeviceCode.Contains("Coveryor")) |
| | | { |
| | | otherDevice.SetValue(CoveryorDB.C_TakeFinish, true, stationManger.StationDeviceCode); |
| | | } |
| | | else if (device.DeviceCode.Contains("Retract"))//伸缩货å |
| | | { |
| | | otherDevice.SetValue(RetractDB.Ret_TakeFinish, true, stationManger.StationDeviceCode); |
| | | } |
| | | } |
| | | |
| | | return WebResponseContent.Instance.OK(); |