自动化立体仓库 - WMS系统
zyx
2024-01-05 0e46bb0cfc8b59ad5527f0b70c49f95aeac4bbbd
src/main/java/com/zy/asrs/controller/MatController.java
@@ -11,8 +11,10 @@
import com.core.common.*;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.LocOutAnfmePrintPara;
import com.zy.asrs.entity.result.KeyValueVo;
import com.zy.asrs.service.LocInPrintMatService;
import com.zy.asrs.service.LocOutPrintMatService;
import com.zy.asrs.service.MatService;
import com.zy.asrs.service.PakoutService;
import com.zy.asrs.utils.MatExcelListener;
@@ -45,6 +47,8 @@
    private PakoutService pakoutService;
    @Autowired
    private LocInPrintMatService locInPrintMatService;
    @Autowired
    private LocOutPrintMatService locOutPrintMatService;
    @RequestMapping(value = "/mat/auto/matnr/auth")
    public R autoMatnr(){
@@ -289,6 +293,8 @@
            print.setBatch(locInPrintMat.getBatch());
            print.setAnfme(locInPrintMat.getAnfme());
            print.setLocNo(locInPrintMat.getLocNo());
            print.setOwnerId(locInPrintMat.getOwnerId());
            print.setOwner(locInPrintMat.getOwner$());
            print.setId(locInPrintMat.getId());
            res.add(print);
            locInPrintMat.setUpdateTime(new Date());
@@ -299,6 +305,75 @@
        return R.ok().add(res);
    }
    // 打印
    @RequestMapping(value = "/loc/out/mat/print/auth")
    @ManagerAuth(memo = "商品编码打印")
    public R locOutMatCodePrint(@RequestParam(value = "param[]") Long[] ids) {
        if(Cools.isEmpty(ids)) {
            return R.parse(CodeRes.EMPTY);
        }
        List<MatPrint> res = new ArrayList<>();
        List<String> memoList = new ArrayList<>();
        for (Long id : ids){
            LocOutPrintMat locOutPrintMat = locOutPrintMatService.selectById(id);
            // 打印数据注入
            MatPrint print = new MatPrint();
            print.setMatnr(locOutPrintMat.getMatnr());
            print.setMaktx(locOutPrintMat.getMaktx());
            print.setBatch(locOutPrintMat.getBatch());
            print.setAnfme(locOutPrintMat.getAnfme());
            print.setOwnerId(locOutPrintMat.getOwnerId());
            print.setOwner(locOutPrintMat.getOwner$());
            print.setId(locOutPrintMat.getId());
            res.add(print);
            print.setMemo(print.getMatnr()+";"+print.getBatch()+";"+print.getOwnerId());
            if (!memoList.contains(print.getMemo())){
                memoList.add(print.getMemo());
            }
            locOutPrintMat.setUpdateTime(new Date());
            locOutPrintMat.setUpdateBy(getUserId());
            locOutPrintMat.setStatus(2);
            locOutPrintMatService.updateById(locOutPrintMat);
        }
        List<LocOutAnfmePrintPara> locOutAnfmePrintParaList = new ArrayList<>();
        for (String memo : memoList){
            LocOutAnfmePrintPara locOutAnfmePrintPara = new LocOutAnfmePrintPara();
            int signInt = 0;
            Double[] anfme = new Double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
            for (MatPrint matPrint:res){
                if (!memo.equals(matPrint.getMemo())){
                    continue;
                }
                if (signInt==0){
                    locOutAnfmePrintPara.setMatnr(matPrint.getMatnr());
                    locOutAnfmePrintPara.setBatch(matPrint.getBatch());
                    locOutAnfmePrintPara.setOwner(matPrint.getOwner());
                    locOutAnfmePrintPara.setOwnerId(matPrint.getOwnerId());
                }
                if (signInt<17){
                    anfme[signInt] = matPrint.getAnfme();
                    signInt++;
                }else {
                    locOutAnfmePrintPara.setAnfme(anfme);
                    locOutAnfmePrintParaList.add(locOutAnfmePrintPara);
                    locOutAnfmePrintPara = new LocOutAnfmePrintPara();
                    locOutAnfmePrintPara.setMatnr(matPrint.getMatnr());
                    locOutAnfmePrintPara.setBatch(matPrint.getBatch());
                    locOutAnfmePrintPara.setOwner(matPrint.getOwner());
                    locOutAnfmePrintPara.setOwnerId(matPrint.getOwnerId());
                    signInt = 0;
                    anfme = new Double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
                    anfme[signInt] = matPrint.getAnfme();
                    signInt++;
                }
            }
            locOutAnfmePrintPara.setAnfme(anfme);
            locOutAnfmePrintParaList.add(locOutAnfmePrintPara);
        }
        return R.ok().add(locOutAnfmePrintParaList);
    }
    /*************************************** 数据相关 ***********************************************/