自动化立体仓库 - WMS系统
#
lsh
2023-05-20 4922157a14d005f4b86e79f3ade1abc38fc0f0ee
src/main/java/com/zy/asrs/task/handler/WorkLogHandler.java
@@ -11,6 +11,7 @@
import com.zy.asrs.service.impl.MobileServiceImpl;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.utils.PostMesDataUtils;
import com.zy.common.constant.MesConstant;
import com.zy.common.utils.HttpHandler;
import lombok.extern.slf4j.Slf4j;
@@ -63,45 +64,39 @@
            WrkDetl wrkDetl = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()));
            if (wrkMast.getWrkSts() == 5 && wrkMast.getIoType() == 1) {
                if(wrkDetl != null){
                    CombParam combParam = new CombParam();
                    combParam.setPackNo(wrkDetl.getZpallet());
//                    combParam.setPackName(wrkDetl.getMatnr());
                    combParam.setLocNo(wrkMast.getLocNo());
                    combParam.setPackSts(1);
                    combParam.setRequestTime(DateUtils.convert(new Date()));
                    result = postMesData(inpath,combParam);
//                    CombParam combParam = new CombParam();
//                    combParam.setPackNo(wrkDetl.getMatnr());
////                    combParam.setPackName(wrkDetl.getMaktx());
//                    combParam.setLocNo(wrkMast.getLocNo());
//                    combParam.setPackSts(1);
//                    combParam.setRequestTime(DateUtils.convert(new Date()));
//                    result = new PostMesDataUtils().postMesData("MES系统",mesUrl,inpath,combParam);
                    // 保存入库通知档历史档
                    if (!waitPakinLogService.save(wrkMast.getBarcode())) {
                        exceptionHandle("保存入库通知档历史档[workNo={0}]失败", wrkMast.getWrkNo());
                    }
                    // 删除入库通知档
                    if (!waitPakinService.delete(new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode()))) {
                        exceptionHandle("删除入库通知档[workNo={0}]失败", wrkMast.getWrkNo());
                    WaitPakin pakin = waitPakinService.selectOne(new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode()));
                    if (pakin!=null){
                        if (!waitPakinLogService.save(wrkMast.getBarcode())) {
                            exceptionHandle("保存入库通知档历史档[workNo={0}]失败", wrkMast.getWrkNo());
                        }
                        // 删除入库通知档
                        if (!waitPakinService.delete(new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode()))) {
                            exceptionHandle("删除入库通知档[workNo={0}]失败", wrkMast.getWrkNo());
                        }
                    }
                }
            } else if (wrkMast.getWrkSts() == 15 && wrkMast.getIoType() == 101){
                if(wrkDetl != null){
                    CombParam combParam = new CombParam();
                    combParam.setPackNo(wrkDetl.getZpallet());
                    combParam.setPackName(wrkDetl.getMatnr());
                    combParam.setLocNo(wrkMast.getLocNo());
                    combParam.setPackSts(0);
                    combParam.setRequestTime(DateUtils.convert(new Date()));
                    result = postMesData(outPath,combParam);
                }
            }else if(wrkMast.getWrkSts() == 4 && wrkMast.getIoType() == 11){
                if(wrkDetl != null){
                    CombParam combParam = new CombParam();
                    combParam.setPackNo(wrkDetl.getZpallet());
                    combParam.setLocNo(wrkMast.getLocNo());
                    combParam.setPackSts(5);
                    combParam.setRequestTime(DateUtils.convert(new Date()));
                    result = postMesData(inpath,combParam);
                }
//                if(wrkDetl != null){
//                    CombParam combParam = new CombParam();
//                    combParam.setPackNo(wrkDetl.getMatnr());
////                    combParam.setPackName(wrkDetl.getMatnr());
//                    combParam.setLocNo(wrkMast.getSourceLocNo());
////                    combParam.setPackSts(0);
//                    combParam.setRequestTime(DateUtils.convert(new Date()));
//                    result = new PostMesDataUtils().postMesData("MES系统",mesUrl,outPath,combParam);
//                }
            }
            if(null != result && !result.isSuccess()){
                return result;
            }
//            if(null != result && !result.isSuccess()){
//                return result;
//            }
            /*...........................赣州新增..............以上.............赣州新增...........................*/
@@ -131,47 +126,4 @@
        }
        return SUCCESS;
    }
    /*...........................赣州新增..............以下.............赣州新增...........................*/
    private ReturnT<String> postMesData(String mesPath,Object combParam){
        if(combParam != null){
            String response = "";
            boolean success = false;
            try {
                response = new HttpHandler.Builder()
                        .setUri(mesUrl)
                        .setPath(mesPath)
                        .setJson(JSON.toJSONString(combParam))
                        .build()
                        .doPost();
                JSONObject jsonObject = JSON.parseObject(response);
                if (jsonObject.getInteger("code").equals(200)) {
                    success = true;
                } else {
                    log.error("请求接口失败!!!url:{};request:{};response:{}", mesUrl+mesPath, JSON.toJSONString(combParam), response);
                    throw new CoolException("上报mes系统失败");
                }
            } catch (Exception e) {
                log.error("fail", e);
//                      TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                return FAIL.setMsg(e.getMessage());
            } finally {
                try {
                    // 保存接口日志
                    apiLogService.save(
                            "成品库入库上报",
                            mesUrl + mesPath,
                            null,
                            "127.0.0.1",
                            JSON.toJSONString(combParam),
                            response,
                            success
                    );
                } catch (Exception e) { log.error("", e); }
            }
        }
        return SUCCESS;
    }
    /*...........................赣州新增..............以上.............赣州新增...........................*/
}