#
lsh
2024-09-05 8145b109ec0e9bb73d3930acf73e8dc18844adc2
zy-asrs-wms/src/main/java/com/zy/asrs/wms/controller/TagController.java
@@ -8,8 +8,10 @@
import com.zy.asrs.common.domain.entity.MatExcel;
import com.zy.asrs.common.domain.entity.MatPrint;
import com.zy.asrs.common.utils.*;
import com.zy.asrs.common.wms.entity.LocInPrintMat;
import com.zy.asrs.common.wms.entity.Mat;
import com.zy.asrs.common.wms.entity.Tag;
import com.zy.asrs.common.wms.service.LocInPrintMatService;
import com.zy.asrs.common.wms.service.MatService;
import com.zy.asrs.common.wms.service.TagService;
import com.zy.asrs.framework.annotations.ManagerAuth;
@@ -41,6 +43,22 @@
    private MatService matService;
    @Autowired
    private TreeUtils treeUtils;
    @Autowired
    private LocInPrintMatService locInPrintMatService;
    @RequestMapping(value = "/tag/list/pda/auth")
    @ManagerAuth
    public R pdaList(@RequestParam(defaultValue = "1")Integer curr,
                     @RequestParam(defaultValue = "10")Integer limit,
                     @RequestParam(required = false)Long parentId){
        LambdaQueryWrapper<Tag> tagLambdaQueryWrapper = new LambdaQueryWrapper<>();
        if(!Cools.isEmpty(parentId)) {
            tagLambdaQueryWrapper.eq(Tag::getParentId, parentId == null ? getOriginTag().getId() : parentId);
        }
        List<Tag> tags = tagService.list(tagLambdaQueryWrapper);
        return R.ok().add(tags);
    }
    @RequestMapping(value = "/tag/{id}/auth")
    @ManagerAuth
@@ -175,7 +193,66 @@
            print.setSpecs(mat.getSpecs());
            print.setUnit(mat.getUnit());
            print.setMemo(mat.getMemo());
            print.setMaterial(mat.getMaterial());
            print.setDecrees(mat.getDecrees());
            print.setImgNum(mat.getImgNum());
            print.setWeight(String.valueOf(mat.getWeight()));
            print.setModel(mat.getModel());
            print.setLength(String.valueOf(mat.getLength()));
            print.setWidth(mat.getWidth());
            print.setHeight(mat.getHeight());
            res.add(print);
        }
        return R.ok().add(res);
    }
    // 打印
    @RequestMapping(value = "/loc/in/mat/print/auth")
    @ManagerAuth(memo = "商品编码打印")
    public R locInMatCodePrint(@RequestParam(value = "param[]") Long[] ids) {
        if(Cools.isEmpty(ids)) {
            return R.parse(CodeRes.EMPTY);
        }
        List<MatPrint> res = new ArrayList<>();
        for (Long id : ids){
            LocInPrintMat locInPrintMat = locInPrintMatService.getById(id);
            Mat mat = matService.getOne(new LambdaQueryWrapper<Mat>().eq(Mat::getMatnr, locInPrintMat.getMatnr()));
            if (Cools.isEmpty(mat)){
                return R.error("品号:"+locInPrintMat.getMatnr()+"不存在,请先新增商品档案!!!").add("品号:"+locInPrintMat.getMatnr()+"不存在,请先新增商品档案!!!");
            }
            // 打印数据注入
            MatPrint print = new MatPrint();
            print.setMatnr(mat.getMatnr());
            print.setBarcode(mat.getBarcode());
            print.setMaktx(mat.getMaktx());
            print.setSpecs(mat.getSpecs());
            print.setUnit(mat.getUnit());
            print.setMemo(mat.getMemo());
            print.setMaterial(mat.getMaterial());
            print.setDecrees(mat.getDecrees());
            print.setImgNum(mat.getImgNum());
            print.setWeight(String.valueOf(mat.getWeight()));
            print.setModel(mat.getModel());
            print.setLength(String.valueOf(mat.getLength()));
            print.setWidth(mat.getWidth());
            print.setHeight(mat.getHeight());
//            // 打印数据注入
//            MatPrint print = new MatPrint();
//            print.setMatnr(locInPrintMat.getMatnr());
//            print.setMaktx(locInPrintMat.getMaktx());
//            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());
            locInPrintMat.setUpdateBy(getUserId());
            locInPrintMat.setStatus(2);
            locInPrintMatService.updateById(locInPrintMat);
        }
        return R.ok().add(res);
    }
@@ -199,6 +276,16 @@
                .doWrite(excels);
    }
//    // excel导入-------判断是否有重复物料
//    @PostMapping(value = "/mat/excel/import/check/auth")
//    @ManagerAuth(memo = "商品档案数据导入")
//    @Transactional
//    public R matExcelImportCheck(MultipartFile file) throws IOException {
//        MatExcelListener listener = new MatExcelListener(getUserId(), getHostId());
//        EasyExcel.read(file.getInputStream(), MatExcel.class, listener).sheet().doRead();
//        return R.ok("成功同步"+listener.getTotal()+"条商品数据");
//    }
    // excel导入
    @PostMapping(value = "/mat/excel/import/auth")
    @ManagerAuth(memo = "商品档案数据导入")