|
@@ -1,19 +1,12 @@
|
|
|
package com.ruoyi.ams.agv.ndc.thread;
|
|
|
|
|
|
-import com.ruoyi.ams.business.IBusinessService;
|
|
|
-import com.ruoyi.ams.config.domain.dto.AgvCallDTO;
|
|
|
-import com.ruoyi.ams.config.domain.dto.AgvCallItemDTO;
|
|
|
-import com.ruoyi.ams.config.domain.dto.LotattDTO;
|
|
|
-import com.ruoyi.base.constant.Constant;
|
|
|
+import com.ruoyi.ams.nieyan.service.AgvCallProxyService;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.hard.modbus.tcp.ButtonBoxClient;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
public class AutoButtonBoxTask {
|
|
@@ -21,90 +14,52 @@ public class AutoButtonBoxTask {
|
|
|
@Autowired(required = false)
|
|
|
private ButtonBoxClient buttonBoxClient;
|
|
|
@Autowired
|
|
|
- private IBusinessService businessService;
|
|
|
-
|
|
|
+ private AgvCallProxyService agvCallProxyService;
|
|
|
+ // 裹膜区库位id
|
|
|
+ public static final String FILM_WRAPPING_AREA_POINT = "10639";
|
|
|
|
|
|
- /**
|
|
|
- * 1.读取按钮是否被按下
|
|
|
- * 2.根据按下的按钮触发模具搬运任务
|
|
|
- * 3.任务生成成功,按钮盒灭灯,并且清除按下标记
|
|
|
- */
|
|
|
public void run() {
|
|
|
-// Boolean readBtn01 = buttonBoxClient.readBtn01();
|
|
|
-// Boolean readBtn02 = buttonBoxClient.readBtn02();
|
|
|
-// if (readBtn01) {
|
|
|
-// buttonTask01();
|
|
|
-// }
|
|
|
-// if (readBtn02) {
|
|
|
-// buttonTask02();
|
|
|
-// }
|
|
|
+
|
|
|
+ ButtonBoxClient.BUTTON_BOX_NO button_box_no = ButtonBoxClient.BUTTON_BOX_NO.A;
|
|
|
+
|
|
|
+ Boolean readBtn01 = buttonBoxClient.readBtn01(button_box_no);
|
|
|
+ Boolean readBtn02 = buttonBoxClient.readBtn02(button_box_no);
|
|
|
+ if (readBtn01) {
|
|
|
+ buttonTask01(button_box_no);
|
|
|
+ }
|
|
|
+ // 两个按钮同时按下,只会生效一个
|
|
|
+ if (!readBtn01 && readBtn02) {
|
|
|
+ buttonTask02(button_box_no);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 按钮1业务(冲边任务)
|
|
|
- */
|
|
|
- public void buttonTask01() {
|
|
|
-// log.info("按钮1已经被按下");
|
|
|
-// // 下发模具搬运任务(冲边)
|
|
|
-// AgvCallDTO agvCallDTO = new AgvCallDTO();
|
|
|
-// agvCallDTO.setWarehouseId(Constant.WAREHOUSE_ID);
|
|
|
-// agvCallDTO.setLocationFrom("");
|
|
|
-// List<AgvCallItemDTO> agvCallItemDTOList = new ArrayList<>();
|
|
|
-// AgvCallItemDTO agvCallItemDTO = new AgvCallItemDTO();
|
|
|
-// agvCallItemDTO.setSku("冲边模具");
|
|
|
-// LotattDTO lotattDTO = new LotattDTO();
|
|
|
-// lotattDTO.setLotatt01("冲边模具");
|
|
|
-// agvCallItemDTO.setLotattDTO(lotattDTO);
|
|
|
-// agvCallItemDTOList.add(agvCallItemDTO);
|
|
|
-// agvCallDTO.setAgvCallItemDTOList(agvCallItemDTOList);
|
|
|
-// AjaxResult ajaxResult = businessService.agvCall(1l, agvCallDTO);
|
|
|
-// if (!ajaxResult.isSuccess()) {
|
|
|
-// log.error("下发模具搬运任务(冲边)失败:" + ajaxResult.getMsg());
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// try {
|
|
|
-// Thread.sleep(10000);
|
|
|
-// } catch (InterruptedException e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-// // 清除按下标记
|
|
|
-// buttonBoxClient.clearBtn01();
|
|
|
-// // 灭灯
|
|
|
-// buttonBoxClient.writeLamp01Death();
|
|
|
-// log.info("按钮1已经灭灯");
|
|
|
+ public void buttonTask01(ButtonBoxClient.BUTTON_BOX_NO button_box_no) {
|
|
|
+ log.info("裹膜区-按钮1已经被按下");
|
|
|
+ AjaxResult ajaxResult = agvCallProxyService.productsDownLineWrappingFilmLSN(FILM_WRAPPING_AREA_POINT, null
|
|
|
+ , "按钮盒", null);
|
|
|
+ if (!ajaxResult.isSuccess()) {
|
|
|
+ log.info(ajaxResult.getMsg());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 清除按下标记
|
|
|
+ buttonBoxClient.clearBtn01(button_box_no);
|
|
|
+ // 灭灯
|
|
|
+ buttonBoxClient.writeLamp01Death(button_box_no);
|
|
|
+ log.info("裹膜区-按钮1已经灭灯");
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 按钮2业务(硫化任务)
|
|
|
- */
|
|
|
- public void buttonTask02() {
|
|
|
-// log.info("按钮2已经被按下");
|
|
|
-// // 下发模具搬运任务(硫化)
|
|
|
-// AgvCallDTO agvCallDTO = new AgvCallDTO();
|
|
|
-// agvCallDTO.setWarehouseId(Constant.WAREHOUSE_ID);
|
|
|
-// agvCallDTO.setLocationFrom("");
|
|
|
-// List<AgvCallItemDTO> agvCallItemDTOList = new ArrayList<>();
|
|
|
-// AgvCallItemDTO agvCallItemDTO = new AgvCallItemDTO();
|
|
|
-// agvCallItemDTO.setSku("硫化模具");
|
|
|
-// LotattDTO lotattDTO = new LotattDTO();
|
|
|
-// lotattDTO.setLotatt01("硫化模具");
|
|
|
-// agvCallItemDTO.setLotattDTO(lotattDTO);
|
|
|
-// agvCallItemDTOList.add(agvCallItemDTO);
|
|
|
-// agvCallDTO.setAgvCallItemDTOList(agvCallItemDTOList);
|
|
|
-// AjaxResult ajaxResult = businessService.agvCall(1l, agvCallDTO);
|
|
|
-// if (!ajaxResult.isSuccess()) {
|
|
|
-// log.error("下发模具搬运任务(硫化)失败:" + ajaxResult.getMsg());
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// try {
|
|
|
-// Thread.sleep(10000);
|
|
|
-// } catch (InterruptedException e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-// // 清除按下标记
|
|
|
-// buttonBoxClient.clearBtn02();
|
|
|
-// // 灭灯
|
|
|
-// buttonBoxClient.writeLamp02Death();
|
|
|
-// log.info("按钮2已经灭灯");
|
|
|
+ public void buttonTask02(ButtonBoxClient.BUTTON_BOX_NO button_box_no) {
|
|
|
+ log.info("裹膜区-按钮2已经被按下");
|
|
|
+ AjaxResult ajaxResult = agvCallProxyService.productsDownLineWrappingFilmLHN(FILM_WRAPPING_AREA_POINT, null
|
|
|
+ , "按钮盒", null);
|
|
|
+ if (!ajaxResult.isSuccess()) {
|
|
|
+ log.info(ajaxResult.getMsg());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 清除按下标记
|
|
|
+ buttonBoxClient.clearBtn02(button_box_no);
|
|
|
+ // 灭灯
|
|
|
+ buttonBoxClient.writeLamp02Death(button_box_no);
|
|
|
+ log.info("裹膜区-按钮2已经灭灯");
|
|
|
}
|
|
|
}
|