自动化立体仓库 - WMS系统
zjj
2023-09-20 42314319782a84d844fea853d04812fbae343b5e
#组托显示操作人
1个文件已添加
3个文件已修改
5149 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/OrderController.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/order/decimal.js 4934 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/order/order.js 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/order/order.html 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/OrderController.java
@@ -15,13 +15,18 @@
import com.zy.asrs.entity.result.OrderDetlVo;
import com.zy.asrs.service.*;
import com.zy.common.CodeRes;
import com.zy.common.config.AdminInterceptor;
import com.zy.common.model.DetlDto;
import com.zy.common.utils.BarcodeUtils;
import com.zy.common.utils.QrCode;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URLEncoder;
@@ -127,6 +132,15 @@
        if (orderLog != null) {
            return R.error("单据编号在历史档中已存在");
        }
        OrderDetl orderDetl1 = new OrderDetl();
        for (OrderDetl orderDetl : param.getOrderDetlList()) {
            if (orderDetl1.getId() == null){
                orderDetl1.sync(orderDetl);
            }
            if (orderDetl1.getOwner() != orderDetl.getOwner()){
                return R.error("同个单据中只能存在一个货主代码");
            }
        }
        Date now = new Date();
        order = new Order(
                String.valueOf(snowflakeIdWorker.nextId()),    // 编号[非空]
@@ -217,6 +231,17 @@
        if (order == null || order.getStatus() == 0) {
            return R.error("订单不存在");
        }
        OrderDetl orderDetl1 = new OrderDetl();
        for (OrderDetl orderDetl : param.getOrderDetlList()) {
            if (orderDetl1.getId() == null){
                orderDetl1.sync(orderDetl);
            }
            if (orderDetl1.getOwner() != orderDetl.getOwner()){
                return R.error("同个单据中只能存在一个货主代码");
            }
        }
        Date now = new Date();
        Long userId = getUserId();
        // 修改主档
@@ -459,6 +484,41 @@
        return R.ok(orderDetls);
    }
    @RequestMapping(value = "/order/print2/auth")
    @ManagerAuth(memo = "订单编码打印")
    public R manPakOutPrint(@RequestParam(value = "param[]") String[] param) {
        if(Cools.isEmpty(param)) {
            return R.parse(CodeRes.EMPTY);
        }
        List<OrderDetl> res = new ArrayList<>();
        for (String orderNo : param){
            res = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_no", orderNo));
        }
        return R.ok().add(res);
    }
    @RequestMapping(value = "/order/code/auth")
//    @ManagerAuth(memo = "物料编码条形码获取(type:1(条形码);2(二维码)")
    public R manPakOutCodeBarcode(@RequestParam(defaultValue = "2") Integer type
            , @RequestParam String param
            , HttpServletResponse response) throws Exception {
        AdminInterceptor.cors(response);
        if (Cools.isEmpty(param)){
            return R.parse(BaseRes.EMPTY);
        }
        BufferedImage img;
        if (type == 1) {
            img = BarcodeUtils.encode(param);
        } else {
            img = QrCode.createImg(param);
        }
        if (!ImageIO.write(img, "jpg", response.getOutputStream())) {
            throw new IOException("Could not write an image of format jpg");
        }
        response.getOutputStream().flush();
        response.getOutputStream().close();
        return R.ok();
    }
}
src/main/webapp/static/js/order/decimal.js
New file
Diff too large
src/main/webapp/static/js/order/order.js
@@ -159,7 +159,8 @@
        } else if (layEvent === 'del') {
            doDel(data.id);
        }else if (layEvent === 'btnPrint') {
            btnPrint(data.id, data.orderNo, 4);
            //btnPrint(data.id, data.orderNo, 4);
            btnPrint2(data.id, data.orderNo, 4);
        } else if (layEvent === 'complete') {
            doModify(data.id, data.orderNo, 4);
        }else if (layEvent === 'manPrint') {
@@ -602,5 +603,63 @@
    }
    function btnPrint2(orderId, orderNo, settle) {
        console.log(orderId);
        console.log(orderNo);
        console.log(settle);
        printMatCodeNos.push(orderNo)
        var templateNo = 4;
        $.ajax({
            url: baseUrl + "/order/print2/auth",
            headers: {'token': localStorage.getItem('token')},
            data: {param: printMatCodeNos},
            method: 'POST',
            async: false,
            success: function (res) {
                if (res.code === 200) {
                    layer.closeAll();
                    var json = res;
                    json.docNum = orderNo;
                    console.log("json"+json);
                    var sum = new Decimal("0");
                    for (let i = 0; i < res.data.length; i++){
                        sum = sum.plus(res.data[i].anfme);
                    }
                    json.anfmeSum = sum;
                    var barcodeUrl = baseUrl + "/order/code/auth?type=1&param=" + res.data[0].docNum;
                    console.log("barcodeUrl:"+barcodeUrl);
                    json.barcodeUrl = barcodeUrl;
                    for (let i = 0; i < json.data.length; i++) {
                        var templateDom = $("#templatePreview" + templateNo);
                        var className = templateDom.attr("class");
                        if (className === 'template-barcode') {
                            json.data[i]["barcodeUrl"] = baseUrl + "/order/code/auth?type=2&param=" + (json.data[i].docNum+";"+json.data[i].matnr+";"+json.data[i].maktx+";"+json.data[i].anfme+";"+json.data[i].locNo+";");
                        } else {
                            json.data[i]["barcodeUrl"] = baseUrl + "/order/code/auth?type=2&param=" + (json.data[i].docNum+";"+json.data[i].matnr+";"+json.data[i].maktx+";"+json.data[i].anfme+";"+json.data[i].locNo+";");
                        }
                    }
                    var tpl = templateDom.html();
                    var template = Handlebars.compile(tpl);
                    var html = template(json);
                    var box = $("#box");
                    box.html(html);
                    box.show();
                    box.print({mediaPrint: true});
                    box.hide();
                } else if (json.code === 403) {
                    top.location.href = baseUrl + "/";
                } else {
                    layer.msg(json.msg)
                }
            }
        })
    }
});
src/main/webapp/views/order/order.html
@@ -198,6 +198,7 @@
<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/order/order.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/order/decimal.js" charset="utf-8"></script>
<script type="text/template" id="docTypeTpl">
    <option value="">选择类型</option>
@@ -251,6 +252,99 @@
</script>
<!-- 模板引擎 -->
<!-- 模板4 -->
<script type="text/template" id="templatePreview4" class="template-qrcode">
    <div style="width: 100%;border-bottom: #0C0C0C solid 2px;margin-bottom: 20px;">
        <div style="height: 60px;text-align: center;line-height: 60px;font-size: 30px;">单据</div>
<!--        <div style="height: 90px;text-align: center;line-height: 90px;">-->
<!--            <img class="template-code template-qrcode" src="{{barcodeUrl}}" width="300">-->
<!--        </div>-->
<!--        <div style="height: 50px;text-align: center;font-size: 25px;">{{docNum}}</div>-->
        <div style="height: 40px;text-align: left;line-height: 40px;font-size: 20px;">单据号码:{{docNum}}</div>
        <div style="height: 40px;text-align: left;line-height: 40px;font-size: 20px;">总数量:{{anfmeSum}}</div>
    </div>
    <table width="100%" style="border:0;border-bottom:#0C0C0C solid 2px; margin-bottom:20px;padding:0;overflow: hidden;font-size: xx-small;table-layout: fixed;">
             <tr style="height: 25px;font-size: 15px;">
                 <td align="left" scope="col" colspan="1" style="width: 150px;">
                     料号
                 </td>
                 <td align="left" scope="col" colspan="1" style="width: 80px;">
                     商品名
                 </td>
                 <td align="left" scope="col" colspan="1" style="width: 80px;">
                     数量
                 </td>
                 <td align="left" scope="col" colspan="1" style="width: 80px;">
                    完成数量
                 </td>
                 <td align="center" scope="col" colspan="1">
                    二维码
                 </td>
             </tr>
        {{#each data}}
        <tr style="height: 85px;font-size: 15px;">
            <td align="left" scope="col" colspan="1" style="width: 100px;">
                {{this.matnr}}
            </td>
            <td align="left" scope="col" colspan="1" style="width: 80px;">
                {{this.maktx}}
            </td>
            <td align="left" scope="col" colspan="1" style="width: 80px;">
                {{this.anfme}}
            </td>
            <td align="left" scope="col" colspan="1" style="width: 80px;">
                {{this.qty}}
            </td>
            <td align="center" scope="col" colspan="1" rowspan="1">
                <img class="template-code template-qrcode" src="{{this.barcodeUrl}}" width="80px">
            </td>
        </tr>
        {{/each}}
    </table>
                <!--    {{#each data}}-->
<!--    <table width="100%" style="border:0;border-bottom:#0C0C0C solid 2px; margin-bottom:20px;padding:0;overflow: hidden;font-size: xx-small;table-layout: fixed;">-->
<!--        <tr style="height: 25px;font-size: 15px;">-->
<!--            <td align="left" scope="col" colspan="1" style="width: 100px;">-->
<!--                料号:-->
<!--            </td>-->
<!--            <td>-->
<!--                {{this.matnr}}-->
<!--            </td>-->
<!--            <td align="left" scope="col" colspan="1" rowspan="4">-->
<!--                <img class="template-code template-qrcode" src="{{this.barcodeUrl}}" width="100px">-->
<!--            </td>-->
<!--        </tr>-->
<!--        <tr style="height: 25px;font-size: 15px;">-->
<!--            <td align="left" scope="col" colspan="1" style="width: 100px;">-->
<!--                商品名:-->
<!--            </td>-->
<!--            <td>-->
<!--                {{this.maktx}}-->
<!--            </td>-->
<!--        </tr>-->
<!--        <tr style="height: 25px; font-size: 15px;">-->
<!--            <td align="left" scope="col" colspan="1" style="width: 100px;">-->
<!--                拣货数量:-->
<!--            </td>-->
<!--            <td>-->
<!--                {{this.anfme}}-->
<!--            </td>-->
<!--        </tr>-->
<!--        <tr style="height: 30px; font-size: 15px;">-->
<!--            <td align="left" scope="col" colspan="1" style="width: 100px;">-->
<!--                完成数量:-->
<!--            </td>-->
<!--            <td align="left" scope="col" colspan="1">-->
<!--                {{this.qty}}-->
<!--            </td>-->
<!--        </tr>-->
<!--    </table>-->
<!--    {{/each}}-->
</script>
<script type="text/html" id="payment">
    <select id="select-primary" style="width: 100%" class="layui-border select-primary" lay-ignore >
        <option value="1"