jiazx0107@163.com
2023-07-03 37c4642530eb12d9dad13d1e9a5f37640a0230ff
优化出入库信息-条形码打印
已修改6个文件
69 ■■■■■ 文件已修改
igds-inout/src/main/java/com/ld/igds/common/bar/BarCodeUtils.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/inout/controller/InoutReportController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/inout/manager/InoutReportManager.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/resources/mapper/InoutCheckMapper.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-web/src/main/resources/static/admin/inout/in-sample.js 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-web/src/main/resources/static/admin/inout/inout-print.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/common/bar/BarCodeUtils.java
@@ -33,19 +33,19 @@
public class BarCodeUtils {
    /**
     * 默认图片宽度
     * 默认图片宽度模 70MM
     */
    private static final int DEFAULT_PICTURE_WIDTH = 300;
    private static final int DEFAULT_PICTURE_WIDTH = 260;
    /**
     * 默认图片高度
     * 默认图片高度  50MM
     */
    private static final int DEFAULT_PICTURE_HEIGHT = 200;
    private static final int DEFAULT_PICTURE_HEIGHT = 185;
    /**
     * 默认条形码宽度
     */
    private static final int DEFAULT_BAR_CODE_WIDTH = 295;
    private static final int DEFAULT_BAR_CODE_WIDTH = 250;
    /**
     * 默认条形码高度
@@ -264,6 +264,12 @@
    public static String getBarCodeImageBase64(String codeValue, String bottomStr1, String bottomStr2, String bottomStr3) {
        BufferedImage image = getBarCodeWithWords(codeValue, bottomStr1, bottomStr2, bottomStr3);
        try{
            ImageIO.write(image, "jpg", new File("D:/IGDS/TEMP/BR_CODE_T.jpg"));
        }catch(Exception e){
        }
        return GetBase64FromImage(image);
    }
@@ -285,7 +291,7 @@
    public static void main(String[] args) throws IOException {
        BufferedImage image = BarCodeUtils.getBarCodeWithWords("C_202306290005", "202306290005", "中心粮库", "2023-06-29 12:25");
        BufferedImage image = BarCodeUtils.getBarCodeWithWords("R_202306290005", "202306290005", "样品质检码", "2023-06-29 12:25");
        ImageIO.write(image, "jpg", new File("D:/IGDS/TEMP/BR_CODE_T.jpg"));
    }
}
igds-inout/src/main/java/com/ld/igds/inout/controller/InoutReportController.java
@@ -7,7 +7,6 @@
import com.ld.igds.inout.dto.InoutData;
import com.ld.igds.inout.manager.InoutReportManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
igds-inout/src/main/java/com/ld/igds/inout/manager/InoutReportManager.java
@@ -736,7 +736,7 @@
            data.setCheckTime(new Date());
        }
        String imgBase64 = BarCodeUtils.getBarCodeImageBase64(data.getId(), data.getCheckId(), "粮库扦样单条码", DateFormatUtils.format(data.getCheckTime(), "yyyy-MM-dd HH:mm"));
        String imgBase64 = BarCodeUtils.getBarCodeImageBase64(data.getId(), data.getCheckId(), "粮食样品单条码", DateFormatUtils.format(data.getCheckTime(), "yyyy-MM-dd HH:mm"));
        return imgBase64;
    }
igds-inout/src/main/resources/mapper/InoutCheckMapper.xml
@@ -38,7 +38,6 @@
            <if test="param.sampleStatus != null and param.sampleStatus != 'NONE' ">AND SAMPLE_TIME_ IS NOT NULL</if>
        </where>
        AND RECORD_STATUS_ != 'DEL'
        AND RECORD_STATUS_ != 'ERROR'
        ORDER BY REGISTER_TIME_
    </select>
@@ -99,7 +98,6 @@
            <if test="param.checkStatus != null and param.checkStatus == 'NONE' ">AND CHECK_STATUS_ = 'NONE'</if>
        </where>
        AND RECORD_STATUS_ != 'DEL'
        AND RECORD_STATUS_ != 'ERROR'
        ORDER BY REGISTER_TIME_
    </select>
igds-web/src/main/resources/static/admin/inout/in-sample.js
@@ -309,7 +309,8 @@
        btnAlign: 'c',
        btn: ['打印并保存', '仅保存', '关闭取消'],
        yes: function () {
            printSimpleStart();
            printBar(curSampleData);
            submit();
        }, btn2: function () {
            // 更新到页面
            var data = form.val("form-detail");
@@ -321,32 +322,6 @@
            layer.closeAll();
        },
        closeBtn: 0
    });
}
//执行打印
function printSimpleStart() {
    var index = layer.load();
    $.ajax({
        type: "POST",
        url: "../../basic/inout/report/bill-simple",
        dataType: "json",
        contentType: "application/json;charset=UTF-8",
        data: JSON.stringify(curSampleData),
        success: function (result) {
            layer.close(index);
            if (result.code != "0000") {
                alertError(result.msg);
            } else {
                printSimpleBill(result.data);
                submit();
            }
        },
        error: function () {
            layer.close(index);
            alertError("打印单据调用失败");
        }
    });
}
@@ -370,7 +345,7 @@
        success: function (result) {
            if (result.code != "0000") {
                layer.close(index);
                notify(result.msg, result.data);
                alertError(result.msg);
            } else {
                layer.closeAll();
                curSampleData = null;
igds-web/src/main/resources/static/admin/inout/inout-print.js
@@ -25,12 +25,17 @@
    }
};
//打印扦样单
printSimpleBill = function (imgBase64) {
//打印扦样单条形码
printBar = function (data) {
    var vcode = data.id;
    var checkId = data.checkId;
    var LODOP = getLodop();
    LODOP.PRINT_INIT("扦样单");
    LODOP.SET_PRINT_PAGESIZE(1, "40mm", "30mm", "CreateCustomPage");
    LODOP.ADD_PRINT_IMAGE(imgBase64);
    LODOP.PRINT_INIT("测试");
    LODOP.SET_PRINT_PAGESIZE(1,'70mm','50mm' ,'');
    LODOP.ADD_PRINT_BARCODE(20,20,'67mm',80,"128A",checkId);
    LODOP.SET_PRINT_STYLEA(0,"FontSize",18);
    LODOP.SET_PRINTER_INDEX("条码打印机");//指定某虚拟打印机
    LODOP.PREVIEW();
};