#
zjj
2023-12-08 d436bdacae4e68f83b6a22726bf7b9deaefd697a
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.R;
import com.core.common.SpringUtils;
import com.core.exception.CoolException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zy.asrs.domain.enums.TaskStatusType;
@@ -91,7 +92,7 @@
    private String movePath;
    public void generateStoreWrkFile() throws IOException {
    public void generateStoreWrkFile() throws IOException, InterruptedException {
        // 根据输送线plc遍历
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 遍历入库口
@@ -148,7 +149,7 @@
                        staProtocol.setWorkNo(workNo);
                        staProtocol.setStaNo(inSta.getBackSta().shortValue());
                        devpThread.setPakMk(staProtocol.getSiteId(), false);
                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol));
                        TaskWrk taskWrk = taskWrkMapper.selectByWrkNo(Integer.valueOf(workNo));
                        if (taskWrk != null) {
@@ -164,18 +165,32 @@
                    }
                    String barcode = barcodeThread.getBarcode();
                    if(!Cools.isEmpty(barcode)) {
                        StaDescService staDescService = SpringUtils.getBean(StaDescService.class);
                        StaDesc staDesc1 = staDescService.selectOne(new EntityWrapper<StaDesc>().eq("stn_no",inSta.getBackSta()));
                        ToWmsDTO toWmsDTO = new ToWmsDTO();
                        Map<String, Object> map = new HashMap<>();
                        map.put("x-api-key","7a15b5db-29b6-552c-8cff-0cfec3756da2");
                        List<Integer> list = openServiceImpl.getInEnableRoadway();
                        TaskWrk taskWrk = taskWrkService.selectOne(new EntityWrapper<TaskWrk>().eq("barcode", barcode).eq("crn_no",inSta.getBarcode()));
                        TaskWrk taskWrk = taskWrkService.selectOne(new EntityWrapper<TaskWrk>().eq("barcode", barcode).eq("crn_no",staDesc1.getCrnNo()));
                        if (Cools.isEmpty(taskWrk)){
                            continue;
                        }
                        if (taskWrk.getTargetPoint() != null && taskWrk.getStartPoint() != null && taskWrk.getWrkNo() != null){
                        if (taskWrk.getTargetPoint() != null && taskWrk.getStartPoint() != null && taskWrk.getWrkNo() != null && taskWrk.getWrkNo().shortValue() != workNo){
                            //获取堆垛机站点
                            StaDesc staDesc = new StaDesc();
                            if (devp.getId() <= 1){
                                staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>()
                                        .eq("crn_no", taskWrk.getCrnNo()).eq("type_no",1).lt("crn_stn", 200));
                            }else {
                                staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>()
                                        .eq("crn_no", taskWrk.getCrnNo()).eq("type_no",1).ge("crn_stn", 200));
                            }
                            staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue());
                            staProtocol.setStaNo(inSta.getStaNo().shortValue());
                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            staProtocol.setStaNo(staDesc.getCrnStn().shortValue());
                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol));
                            Thread.sleep(200);
                        }else {
                            //TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo());
                            toWmsDTO.setWarehouseId("1688469798893297665");
@@ -199,7 +214,7 @@
                            JSONObject jsonObject = JSON.parseObject(response);
                            if (jsonObject.getInteger("code").equals(200)) {
                                GetWmsDto getWmsDto = JSON.parseObject(jsonObject.get("data").toString(), GetWmsDto.class);
                                taskWrk.setOriginTargetPoint(getWmsDto.getTargetLocationCode());
                                taskWrk.setTargetPoint(Utils.getWcsLocNo(getWmsDto.getTargetLocationCode()));
                                taskWrk.setStartPoint(String.valueOf(inSta.getBackSta()));
                                if (!taskWrkService.updateById(taskWrk)){
@@ -844,7 +859,7 @@
            if (taskWrk.getIoType() == 1) {
                //入库任务
                taskWrk.setWrkSts(4);//3.吊车入库中 => 4.入库完成
                taskWrk.setStatus(TaskStatusType.COMPLETE.id);
                //taskWrk.setStatus(TaskStatusType.COMPLETE.id);
                taskWrk.setModiTime(now);
                taskWrkService.updateById(taskWrk);