zwl
2025-09-03 469d41fe09ceec3dc5259d01a4060aac1448e09f
zy-asrs-wms/src/main/java/com/zy/asrs/wms/controller/TagController.java
@@ -5,8 +5,10 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zy.asrs.common.domain.CodeRes;
import com.zy.asrs.common.domain.entity.LocInPrintMatExcel;
import com.zy.asrs.common.domain.entity.MatExcel;
import com.zy.asrs.common.domain.entity.MatPrint;
import com.zy.asrs.common.domain.entity.OutLocOrderExcel;
import com.zy.asrs.common.utils.*;
import com.zy.asrs.common.wms.entity.LocInPrintMat;
import com.zy.asrs.common.wms.entity.Mat;
@@ -221,23 +223,28 @@
            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());
            int count=1;
            if(!Cools.isEmpty(locInPrintMat.getAnfme())){
                count=locInPrintMat.getAnfme().intValue();
            }
            for(int i=1;i<=count;i++){
                // 打印数据注入
                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());
                print.setMaterial(mat.getMaterial());
                print.setDecrees(locInPrintMat.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());
@@ -247,8 +254,10 @@
//            print.setLocNo(locInPrintMat.getLocNo());
//            print.setOwnerId(locInPrintMat.getOwnerId());
//            print.setOwner(locInPrintMat.getOwner$());
            print.setId(locInPrintMat.getId());
            res.add(print);
                print.setId(locInPrintMat.getId());
                res.add(print);
            }
            locInPrintMat.setUpdateTime(new Date());
            locInPrintMat.setUpdateBy(getUserId());
            locInPrintMat.setStatus(2);
@@ -296,4 +305,57 @@
        return R.ok("成功同步"+listener.getTotal()+"条商品数据");
    }
    /**
     * excel导入模板下载
     */
    @RequestMapping(value = "/out/loc/box/excel/import/mould")
    public void outLocBoxExcelImportMould(HttpServletResponse response) throws IOException {
        List<LocInPrintMatExcel> excels = new ArrayList<>();
        response.setContentType("application/vnd.ms-excel");
        response.setCharacterEncoding("utf-8");
        String fileName = URLEncoder.encode("导入待打印物料模板", "UTF-8");
        response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
        EasyExcel.write(response.getOutputStream(), LocInPrintMatExcel.class)
                .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
                .sheet("待打印物料模板")
                .doWrite(excels);
    }
    // excel导入
    @PostMapping(value = "/out/loc/box/excel/import/auth")
    @ManagerAuth(memo = "导入待打印物料模板")
    @Transactional
    public R outLocBoxExcelImport(MultipartFile file) throws IOException {
        LocInPrintMatExcelListener listener = new LocInPrintMatExcelListener(getUserId(), getHostId());
        EasyExcel.read(file.getInputStream(), LocInPrintMatExcel.class, listener).sheet().doRead();
        return R.ok("成功导入"+listener.getTotal()[0]+"种待打印物料信息,共生成"+listener.getTotal()[1]+"条待打印条码!");
    }
    /**
     * excel导入模板下载
     */
    @RequestMapping(value = "/out/loc/box/excel/import/out/mould")
    public void outLocBoxExcelImportOutMould(HttpServletResponse response) throws IOException {
        List<OutLocOrderExcel> excels = new ArrayList<>();
        response.setContentType("application/vnd.ms-excel");
        response.setCharacterEncoding("utf-8");
        String fileName = URLEncoder.encode("导入订单信息出库模板", "UTF-8");
        response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
        EasyExcel.write(response.getOutputStream(), OutLocOrderExcel.class)
                .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
                .sheet("出库模板")
                .doWrite(excels);
    }
    // excel导入
    @PostMapping(value = "/out/loc/box/excel/import/out/auth")
    @ManagerAuth(memo = "导入订单信息出库")
    @Transactional
    public R outLocBoxExcelImportOut(MultipartFile file) throws IOException {
        OutLocOrderExcelListener listener = new OutLocOrderExcelListener(getUserId(), getHostId());
        EasyExcel.read(file.getInputStream(), OutLocOrderExcel.class, listener).sheet().doRead();
        return R.ok("成功导入"+listener.getTotal()[0]+"条订单明细!");
    }
}