自动化立体仓库 - WMS系统
#
LSH
2023-02-13 30155d34eade43e1713ee1022a9af4d4744acda1
src/main/java/com/zy/asrs/task/handler/StandingHandler.java
@@ -12,6 +12,7 @@
import com.zy.asrs.service.*;
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.model.enums.WorkNoType;
import com.zy.common.service.CommonService;
@@ -62,7 +63,7 @@
            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
                    .eq("fire_status", 0)
                    .eq("loc_sts", "F")
                    .eq("pack_status", 4));
                    .eq("pack_status", 5));
            Integer ioType = 101;   //入出库类型
            //静置完成出库站104
            for(LocMast locMast : locMasts){
@@ -115,14 +116,14 @@
                    if (locMast.getLocSts().equals("F")) {
                        locMast.setLocSts("R");
                        locMast.setModiTime(now);
                        locMast.setPackStatus(5); //5:静置完成
                        locMast.setPackStatus(6); //6:静置完成
                        CombParam combParam = new CombParam();
                        combParam.setPackNo(locMast.getBarcode());
                        combParam.setLocNo(locMast.getLocNo());
                        combParam.setPackSts(6);
                        combParam.setRequestTime(DateUtils.convert(new Date()));
                        postMesData(inpath,combParam);
                        new PostMesDataUtils().postMesData("MES系统",mesUrl,inpath,combParam);
                        if (!locMastService.updateById(locMast)) {
                            throw new CoolException("预约库位状态失败,库位号:"+locMast.getLocNo());
@@ -139,46 +140,6 @@
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return FAIL.setMsg(e.getMessage());
        }
        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 {
                    // 保存接口日志
                    //                            MesConstant.URL + MesConstant.PAKIN_URL,
                    apiLogService.save(
                            "成品库入库上报",
                            mesUrl + mesPath,
                            null,
                            "127.0.0.1",
                            JSON.toJSONString(combParam),
                            response,
                            success
                    );
                } catch (Exception e) { log.error("", e); }
            }
        }
        return SUCCESS;
    }