自动化立体仓库 - WMS系统
野心家
2 天以前 9ac70efe81c1909d63b89f9b18c4f367c0584ceb
src/main/java/com/zy/common/web/WcsController.java
@@ -52,10 +52,10 @@
    @Autowired
    private  MatService matService;
    @Value("mes.url")
    @Value("${mes.url}")
    private String mesUrl;
    @Value("mes.inPath")
    @Value("${mes.inPath}")
    private String inpath;
    @PostMapping("/pakin/loc/v1")
@@ -69,45 +69,16 @@
            return R.error("源站编号不能为空");
        }
        if (Cools.isEmpty(param.getPackNo())) {
            return R.error("packNo不能为空");
        }
        Date now = new Date();
        if (param.getSourceStaNo()==109){
            try{
                Mat mat = matService.selectByMatnr(param.getPackNo());
                if (Cools.isEmpty(mat)){
                    return R.error("商品信息档案未查询到pack信息"+param.getPackNo());
                }
                WaitPakin waitPakin = new WaitPakin();
                waitPakin.setMatnr(mat.getMatnr());// Pack码
                waitPakin.setMaktx(mat.getMaktx());
                waitPakin.setZpallet(param.getBarcode());   //托盘码
                waitPakin.setIoStatus("N");     // 入出状态
                waitPakin.setAnfme(1.0);  // 数量
                waitPakin.setStatus("Y");    // 状态
                waitPakin.setManuDate(mat.getManuDate());
                waitPakin.setAppeUser(null);
                waitPakin.setAppeTime(now);
                waitPakin.setModiUser(null);
                waitPakin.setModiTime(now);
                waitPakin.setDeadWarn(mat.getDeadWarn());
                if (!waitPakinService.insert(waitPakin)) {
                    throw new CoolException("保存入库通知档失败");
                }
            }catch (Exception e){
            }
        }
        List<WaitPakin> waitPakins = null;
        if (param.getIoType() == 1) {
            if (Cools.isEmpty(param.getBarcode())) {
                return R.error("条码不能为空");
            }
            waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()));
            if (Cools.isEmpty(waitPakins) || waitPakins.size()!=1) {
            if (Cools.isEmpty(waitPakins) || waitPakins.size() !=1) {
                WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode());
                if (wrkMast != null || waitPakins.size()!=1) {
                if (wrkMast != null || waitPakins.size() !=1) {
                    return R.parse("600-重复组托");
                }
                return R.parse(CodeRes.NO_COMB_700);
@@ -128,8 +99,7 @@
        // 源站点状态检测
        BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getSourceStaNo(), false);
//        sourceStaNo.setLocType1(param.getLocType1());
        sourceStaNo.setLocType1((short)1);
        sourceStaNo.setLocType1(param.getLocType1());
        LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
        StartupDto dto = null;
@@ -149,7 +119,7 @@
    }
    /**
     * 全板入库
         * 全板入库
     */
    @Transactional
    public StartupDto startupFullPutStore(Integer devpNo, String barcode, LocTypeDto locTypeDto, List<WaitPakin> waitPakins) {
@@ -189,7 +159,7 @@
        LocMast locMast = locMastService.selectById(dto.getLocNo());
        // 生成工作档明细
        waitPakins.forEach(waitPakin -> {
        for (WaitPakin waitPakin: waitPakins) {
            WrkDetl wrkDetl = new WrkDetl();
            wrkDetl.sync(waitPakin);
            wrkDetl.setWrkNo(wrkMast.getWrkNo());
@@ -200,25 +170,42 @@
            if (!wrkDetlService.insert(wrkDetl)) {
                throw new CoolException("保存工作明细失败");
            }
            TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>().eq("barcode", wrkMast.getBarcode()));
            if (Cools.isEmpty(testMast)){
                //生成测试档
                testMast=new TestMast();
                testMast.setChannel(locMast.getChannel());
                testMast.setUserId(locMast.getLocNo());
                testMast.setStatus(1);
                testMast.setBarcode(wrkDetl.getMatnr());
                testMast.setLocNo(locMast.getLocNo());
                testMast.setModiTime(now);
                testMast.setAppeTime(now);
                if (!testMastService.insert(testMast)){
                    throw new CoolException(wrkDetl.getMatnr()+"生成测试档失败");
                TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>()
                        .eq("barcode", wrkDetl.getMatnr())
                        .eq("user_id",wrkDetl.getZpallet()));//pack码
                if (Cools.isEmpty(testMast)){
                    //生成测试档
                    testMast=new TestMast();
                    //入待测库位通道设为0
                    if(locMast.getChannel()==null) {
                        testMast.setChannel(0);//通道设为0
                    }else{
                        testMast.setChannel(locMast.getChannel());
                    }
                    testMast.setUserId(wrkMast.getBarcode());//托盘码
                    testMast.setStatus(1);
                    testMast.setBarcode(wrkDetl.getMatnr());
                    testMast.setLocNo(locMast.getLocNo());
                    testMast.setModiTime(now);
                    testMast.setAppeTime(now);
                    if (!testMastService.insert(testMast)){
                        throw new CoolException(wrkDetl.getMatnr()+"生成测试档失败");
                    }
                }else {
                    testMast.setBarcode(wrkDetl.getMatnr());
                    testMast.setChannel(locMast.getChannel());
                    testMast.setLocNo(locMast.getLocNo());
                    testMast.setStatus(1);
                    testMast.setUserId(wrkMast.getBarcode());//托盘码
                    testMast.setAppeTime(now);
                    if(!testMastService.update(testMast,new EntityWrapper<TestMast>().eq("barcode", wrkDetl.getMatnr()))){
                        throw new CoolException(wrkDetl.getMatnr()+"更新测试档失败");
                    }
                }
            }else {
                throw new CoolException(wrkDetl.getMatnr()+"已存在测试档");
            }
        });
        }
        // 更新入库通知档 ioStatus ===>> Y
        Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>()
                .eq("zpallet", barcode);
@@ -242,15 +229,16 @@
            if (!locMastService.updateById(locMast)){
                throw new CoolException("改变库位状态失败");
            }else{
                if (locMast.getRow1()<3){
                if (locMast.getRow1()<2){
                    //1.扫码上报
                    CombParam combParam = new CombParam();
                    combParam.setPackNo(wrkMast.getBarcode());
                    combParam.setPackNo(waitPakins.get(0).getMatnr());
                    combParam.setBarcode(wrkMast.getBarcode());
                    combParam.setLocNo(wrkMast.getLocNo());
                    combParam.setPackSts(0);
                    combParam.setStepSts(1);
                    combParam.setRequestTime(DateUtils.convert(now));
                    new PostMesDataUtils().postMesData("MES系统",mesUrl,inpath,combParam);
//                    new PostMesDataUtils().postMesData("MES系统",mesUrl,inpath,combParam);
                }
            }
        } else {