自动化立体仓库 - WMS系统
#
Administrator
2 天以前 19cbe75e901c3fcf005b8ceafe50f3ad51f67e82
src/main/java/com/zy/asrs/task/handler/WorkLogHandler.java
@@ -1,8 +1,10 @@
package com.zy.asrs.task.handler;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.alibaba.fastjson.JSONObject;
import com.core.common.Cools;
import com.zy.asrs.entity.WaitPakin;
import com.zy.asrs.entity.LocDetl;
import com.zy.asrs.entity.WrkDetl;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.*;
@@ -17,6 +19,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
/**
 * Created by vincent on 2020/7/6
@@ -39,6 +42,12 @@
    private WaitPakinLogService waitPakinLogService;
    @Autowired
    private OrderService orderService;
    @Autowired
    private ErpTokenService erpTokenService;
    @Autowired
    private LocDetlService locDetlService;
    @Autowired
    private ApiLogService apiLogService;
    @Transactional
    public ReturnT<String> start(WrkMast wrkMast) {
@@ -67,6 +76,31 @@
                if (wrkMast.getIoType() == 1) {
                    // 入库通知单
                    if (!Cools.isEmpty(wrkMast.getBarcode())) {
                        if(wrkMast.getSourceStaNo().equals("1015")){
                            String request = "{\"barcode\":\"" + wrkMast.getBarcode() + "\"}";
                            log.info("ERP入库上报请求: workNo={}, request={}", wrkMast.getWrkNo(), request);
                            JSONObject res = erpTokenService.stockIn(wrkMast.getBarcode());
                            log.info("ERP入库上报响应: workNo={}, response={}", wrkMast.getWrkNo(), res == null ? null : res.toJSONString());
                            apiLogService.save("erp.stockIn", "erpTokenService.stockIn", null, null, request,
                                    res == null ? null : res.toJSONString(),
                                    res != null && Boolean.TRUE.equals(res.getBoolean("success")));
                            if (res != null && Boolean.TRUE.equals(res.getBoolean("success"))) {
                                JSONObject data = res.getJSONObject("data");
                                String tlocation = data == null ? null : data.getString("tlocation");
                                if (!Cools.isEmpty(tlocation) && !Cools.isEmpty(wrkMast.getLocNo())) {
                                    List<LocDetl> detls = locDetlService.selectList(new EntityWrapper<LocDetl>()
                                            .eq("loc_no", wrkMast.getLocNo()));
                                    if (!Cools.isEmpty(detls)) {
                                        for (LocDetl detl : detls) {
                                            detl.setStandby1(tlocation);
                                            locDetlService.updateById(detl);
                                        }
                                    }
                                }
                            }
                        }
                        // 保存入库通知档历史档
                        if (!waitPakinLogService.save(wrkMast.getBarcode())) {
//                            exceptionHandle("保存入库通知档历史档[workNo={0}]失败", wrkMast.getWrkNo());
@@ -93,6 +127,35 @@
            // 出库 --------------------------------------------------------------------------------
            } else if (wrkMast.getWrkSts() == 15) {
                if(wrkMast.getIsSuplus()!=null && wrkMast.getIsSuplus()==1 && wrkMast.getExitMk().equals("Y")){
                    List<WrkDetl> wrkDetls1 = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no",wrkMast.getWrkNo()));
                    WrkDetl wrkDetl = wrkDetls1.get(0);
                    String request = "{\"barcode\":\"" + wrkMast.getBarcode() + "\",\"anfme\":" + wrkDetl.getAnfme() + "}";
                    log.info("ERP退料上报请求: workNo={}, request={}", wrkMast.getWrkNo(), request);
                    JSONObject res = erpTokenService.stockBack(wrkMast.getBarcode(),wrkDetl.getAnfme(),null);
                    log.info("ERP退料上报响应: workNo={}, response={}", wrkMast.getWrkNo(), res == null ? null : res.toJSONString());
                    apiLogService.save("erp.stockBack", "erpTokenService.stockBack", null, null, request,
                            res == null ? null : res.toJSONString(),
                            res != null && Boolean.TRUE.equals(res.getBoolean("success")));
                    if (res != null && Boolean.TRUE.equals(res.getBoolean("success"))) {
                    }
                }else if(Objects.isNull(wrkMast.getLocNo())){
                    String request = "{\"barcode\":\"" + wrkMast.getBarcode() + "\"}";
                    log.info("ERP出库上报请求: workNo={}, request={}", wrkMast.getWrkNo(), request);
                    JSONObject res = erpTokenService.stockOut(wrkMast.getBarcode(),null);
                    log.info("ERP出库上报响应: workNo={}, response={}", wrkMast.getWrkNo(), res == null ? null : res.toJSONString());
                    apiLogService.save("erp.stockOut", "erpTokenService.stockOut", null, null, request,
                            res == null ? null : res.toJSONString(),
                            res != null && Boolean.TRUE.equals(res.getBoolean("success")));
                    if (res != null && Boolean.TRUE.equals(res.getBoolean("success"))) {
                    }
                }
//                if (!Objects.isNull(wrkMast.getWrkCode())) {
//                    return FAIL;
//                }
//                if (!Cools.isEmpty(wrkDetls)) {
//                    if (!orderService.saveHandlerOrder(Boolean.FALSE, wrkMast, wrkDetls)) {
//                        exceptionHandle("生成手动出库单据[workNo={0}]失败", wrkMast.getWrkNo());