123
ZY
2025-04-25 1a1e3398d15027a65e56e0ed82e54f3a4feea0b6
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -17,32 +17,27 @@
import java.util.Date;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
@Slf4j
@Service
public class WorkServiceImpl implements WorkService {
    @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
@@ -72,34 +67,11 @@
            throw new CoolException("修改工作档失败");
        }
        HashMap<String,Object> headParam = new HashMap<>();
        headParam.put("TaskNo",wrkMast.getTaskNo());
        headParam.put("Result",0);//完成
        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
@@ -179,33 +151,10 @@
        if (!wrkMastRes || !locMastRes) {
            throw new CoolException("保存数据失败");
        }
        HashMap<String,Object> headParam = new HashMap<>();
        headParam.put("TaskNo",wrkMast.getTaskNo());
        headParam.put("Result",1);//取消
        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失败");
        }
    }
}