自动化立体仓库 - WMS系统
#
LSH
2024-03-25 f6796dda5fb7e269482f0cc92a898fe7ffc203d4
src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
@@ -8,6 +8,7 @@
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.CombParam;
import com.zy.asrs.mapper.ReportQueryMapper;
import com.zy.asrs.service.*;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
@@ -52,6 +53,11 @@
    @Value("${mes.inPath}")
    private String inpath;
    @Autowired
    private PackQualifiedService packQualifiedService;
    @Autowired
    private ReportQueryMapper reportQueryMapper;
    public ReturnT<String> start(WrkMast wrkMast) {
        // 4.入库完成
@@ -154,6 +160,10 @@
                        locMast.setIoTime(now);
                        locMast.setModiTime(now);
                        locMast.setFireStatus(0);
                        //入测试库位时给库位测试状态为1待测
                        if(!Cools.isEmpty(locMast.getChannel())){
                            locMast.setPackStatus(1);//待测
                        }
                        if (locMast.getCrnNo()==1){
                            if (locMast.getLocType1()==1){
                                locMast.setPackStatus(1);
@@ -167,12 +177,23 @@
                                    .eq("barcode",wrkDetl1.getMatnr())
                                    .eq("status",4)
                            );
                            if (Cools.isEmpty(testMast)){
                                testMast = testMastService.selectOne(new EntityWrapper<TestMast>()
                                        .eq("barcode",wrkDetl1.getMatnr())
                                        .eq("status",5)
                                );
                            }
                            if (Cools.isEmpty(testMast)){
                                throw new CoolException("更改测试状态失败,查询测试档案失败");
                            }
                            testMast.setStatus(5);
                            testMast.setModiTime(new Date());
                            if (!testMastService.update(testMast,new EntityWrapper<TestMast>().eq("barcode",wrkDetl1.getMatnr()).eq("status",4))){
                                throw new CoolException("更改测试状态失败");
                            }
                        }
                        //入库标记
                        packQualifiedService.insertPackQualified(true,new Date(),wrkDetls.get(0).getMatnr());
                        //2.入库完成上报
                        CombParam combParam = new CombParam();
                        combParam.setPackNo(wrkDetls.get(0).getMatnr());
@@ -375,22 +396,29 @@
                        }else {
                            throw new CoolException("待测库位无物");
                        }
                    }else {
                        //测试库位转静置库位
                        //测试库位转静置库位和NG库位
                        if (locMast.getLocType1().equals((short)4)){
                            locMast.setPackStatus(4); //4:NG
                            //入库标记
                            packQualifiedService.insertPackQualified(true,new Date(),locDetl.getMatnr());
                            //出库标记
                            packQualifiedService.insertPackQualified(false,new Date(),locDetl.getMatnr());
                        }else {
                            locMast.setPackStatus(5); //5:静置中
                            //入库标记
                            packQualifiedService.insertPackQualified(true,new Date(),locDetl.getMatnr());
                            //出库标记
                            packQualifiedService.insertPackQualified(false,new Date(),locDetl.getMatnr());
                        }
                        sign=true;
                        if (locMast.getLocType1()==2 && sourceLoc.getLocType1()==1){
                            TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>()
                                    .eq("loc_no",sourceLoc.getLocNo())
                                    .eq("barcode",locDetl.getMatnr())
                                    .eq("status",4)
                            );
                            testMast.setStatus(5);
                            testMast.setLocNo(locMast.getLocNo());
                            testMast.setModiTime(new Date());
                            if (!testMastService.update(testMast,new EntityWrapper<TestMast>()
                                    .eq("loc_no",sourceLoc.getLocNo())
@@ -398,7 +426,7 @@
                                    .eq("status",4))){
                                throw new CoolException("更改测试状态失败");
                            }
                        }
                    }
                    if (!locMastService.updateById(locMast)) {
//                        exceptionHandle("库位移转 ===>> 修改目标库位状态失败;[workNo={0}],[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo());
@@ -407,18 +435,30 @@
                    }
                    if (locMast.getCrnNo()==1 && sign){
                        //5.静置库位入库完成上报
                        //7.测试库位转静置库位出库完成上报
                        CombParam combParam = new CombParam();
                        combParam.setPackNo(locDetl.getMatnr());
                        combParam.setLocNo(wrkMast.getLocNo());
                        combParam.setLocNo(wrkMast.getSourceLocNo());
                        combParam.setStepSts(7);
                        if (locMast.getPackStatus()==4){
                            combParam.setPackSts(2);
                        }else if (locMast.getPackStatus()==5){
                            combParam.setPackSts(1);
                        }
                        combParam.setRequestTime(DateUtils.convert(now));
                        new PostMesDataUtils().postMesData("MES系统",mesUrl,inpath,combParam);
                        //5.测试库位转静置库位入库完成上报
                        combParam.setPackNo(locDetl.getMatnr());
                        combParam.setLocNo(wrkMast.getLocNo());
                        if (locMast.getPackStatus()==4){
                            combParam.setPackSts(2);
                            combParam.setStepSts(5);
                        }else if (locMast.getPackStatus()==5){
                            combParam.setPackSts(1);
                            combParam.setStepSts(8);
                        }else {
                            combParam.setPackSts(0);
                        }
                        combParam.setStepSts(5);
                        combParam.setRequestTime(DateUtils.convert(now));
                        new PostMesDataUtils().postMesData("MES系统",mesUrl,inpath,combParam);
                    }
@@ -500,6 +540,8 @@
                            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                            return FAIL.setMsg("全板出库 ===>> 修改源库位状态失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getSourceLocNo() + "]");
                        }else{
                            //出库标记
                            packQualifiedService.insertPackQualified(false,new Date(),wrkDetls101.get(0).getMatnr());
                            //2.出库完成上报
                           CombParam combParam = new CombParam();
                            combParam.setPackNo(wrkDetls101.get(0).getMatnr());
@@ -510,8 +552,19 @@
                                combParam.setPackSts(1);//OK
                                combParam.setStepSts(7);//测试库出库完成
                            }else if(wrkMast.getStaNo()==204){//NG 出库
                                //NG出库修改测试档的状态为5.已移库
                                TestMast testMast=testMastService.selectOne(new EntityWrapper<TestMast>()
                                        .eq("user_id",wrkMast.getBarcode())
                                        .eq("barcode",wrkDetls101.get(0).getMatnr()));
                                combParam.setPackSts(2);//NG
                                combParam.setStepSts(8);//NG出库完成
                                testMast.setStatus(5);
                                if(!testMastService.update(testMast,new EntityWrapper<TestMast>()
                                        .eq("user_id",wrkMast.getBarcode())
                                        .eq("barcode",wrkDetls101.get(0).getMatnr()))){
                                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                                    return FAIL.setMsg("全板出库 ===>> 修改测试表状态为5失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getSourceLocNo() + "]");
                                }
                            }else if(wrkMast.getStaNo()==103){//目标站103出库
                                combParam.setPackSts(1);//OK
                                combParam.setStepSts(6);//静置库出库完成