Administrator
6 天以前 f18dee1034da10cdd537f4cef94a6bcbe141c6a8
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -1,16 +1,13 @@
package com.zy.asrs.service.impl;
import com.alibaba.fastjson.JSON;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.exception.CoolException;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.*;
import com.zy.common.utils.HttpHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -24,26 +21,16 @@
    @Autowired
    private WrkMastService wrkMastService;
    @Autowired
    private LocMastService locMastService;
    @Autowired
    private WaitPakinService waitPakinService;
    @Autowired
    private WrkMastLogService wrkMastLogService;
    @Autowired
    private WrkDetlLogService wrkDetlLogService;
    @Autowired
    private WrkDetlService wrkDetlService;
    @Autowired
    private ApiLogService apiLogService;
    @Value("${wms.url}")
    private String wmsUrl;
    @Value("${wms.inboundTaskApplyPath}")
    private String inboundTaskApplyPath;
    @Value("${wms.movePath}")
    private String movePath;
    @Value("${wms.taskStatusFeedbackPath}")
    private String taskStatusFeedbackPath;
    private ToWmsService toWmsService;
    @Override
    @Transactional
@@ -76,31 +63,8 @@
        HashMap<String, Object> headParam = new HashMap<>();
        headParam.put("TaskNo", wrkMast.getTaskNo());
        headParam.put("Result", 0);//完成
        toWmsService.addReportLog(wrkMast);
        try {
            String response;
            log.error("wcs手动完结任务上报wms={}", wrkMast);
            response = new HttpHandler.Builder()
                    // .setHeaders(headParam)
                    .setUri(wmsUrl)
                    .setPath(taskStatusFeedbackPath)
                    .setJson(JSON.toJSONString(headParam))
                    .build()
                    .doPost();
            apiLogService.save("wcs手动完成任务上报wms"
                    , wmsUrl + taskStatusFeedbackPath
                    , null
                    , "127.0.0.1"
                    , JSON.toJSONString(headParam)
                    , response
                    , true
            );
        } catch (Exception e) {
            log.error("wcs手动完结任务上报wms失败={}", wrkMast);
            log.error("wcs手动完结任务上报wms失败,报错信息:", e);
//                        throw new CoolException("wcs派发入库任务上报wms失败");
        }
    }
    @Override
@@ -139,7 +103,7 @@
                locSts = "D";
                // 库位转移 ===>> D.空桶/空栈板
            } else if (wrkMast.getIoType() == 11) {
                locSts = wrkMast.getFullPlt().equalsIgnoreCase("N") ? "D" : "F";
                locSts = "F";
                // 库位转移:目标库位
                LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
                if (Cools.isEmpty(locMast)) {
@@ -183,30 +147,7 @@
        HashMap<String, Object> headParam = new HashMap<>();
        headParam.put("TaskNo", wrkMast.getTaskNo());
        headParam.put("Result", 1);//取消
        toWmsService.addReportLog(wrkMast);
        try {
            String response;
            log.error("wcs手动取消任务上报wms={}", wrkMast);
            response = new HttpHandler.Builder()
                    // .setHeaders(headParam)
                    .setUri(wmsUrl)
                    .setPath(taskStatusFeedbackPath)
                    .setJson(JSON.toJSONString(headParam))
                    .build()
                    .doPost();
            apiLogService.save("wcs手动取消任务上报wms"
                    , wmsUrl + taskStatusFeedbackPath
                    , null
                    , "127.0.0.1"
                    , JSON.toJSONString(headParam)
                    , response
                    , true
            );
        } catch (Exception e) {
            log.error("wcs手动取消任务上报wms失败={}", wrkMast);
            log.error("wcs手动取消任务上报wms失败,报错信息:", e);
//                        throw new CoolException("wcs派发入库任务上报wms失败");
        }
    }
}