wxw
2025-05-12 c7c2f7aa20427204944ba80a2704232b2f281582
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style type="text/css">
            @page{
                size: auto;
                margin: 0 10px 0 10px;
            }
            body{
                font-family: SimSun;
                font-size: 12px;
            }
            .trHeight50{
                height: 50px;
            }
            .trHeight30{
                height: 30px;
            }
            .thBorder{
                border-left: 1px solid;
                border-top: 1px solid;
                border-bottom: 1px solid;
            }
            .thBorder2{
                border-left: 1px solid;
                border-top: 1px solid;
                border-bottom: 1px solid;
                border-right: 1px solid;
            }
            .tdPadding{
                padding: 2px;
            }
        </style>
    </head>
    <body>
        <div id="divPrint" style="width: 800px;">
            <div>
                <img id="imgBar" />
            </div>
            <div style="font-size: 21px;font-weight: 800;text-align: center;">
                入库单
            </div>
            <table width="100%" style="">
                <tr class="trHeight50">
                    <td width="35%">
                        订单号:<span id="billCode"></span>
                    </td>
                    <td width="40%">
                        备注:<span id="remark"></span>
                    </td>
                    <td width="25%">
                        创建人:<span id="createUser"></span>
                    </td>
                </tr>
                <tr>
                    <td>
                        批次号:<span id="batchCode"></span>
                    </td>
                    <td></td>
                    <td>
                        创建时间:<span id="createTime"></span>
                    </td>
                </tr>
            </table>
            <table id="tbData" width="100%" cellspacing="0" style="margin-top: 20px;">
                <thead>
                    <tr class="trHeight30">
                        <th class="thBorder">物品编号</th>
                        <th class="thBorder">物品名称</th>
                        <th class="thBorder">物品规格</th>
                        <th class="thBorder">生产日期</th>
                        <th class="thBorder">物品状态</th>
                        <th class="thBorder">物品单位</th>
                        <th class="thBorder">计划数量</th>
                        <th class="thBorder">已下发数量</th>
                        <th class="thBorder2">完成数量</th>
                    </tr>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>
        <script src="../../../layuiadmin/layui/layui.js"></script>
        <script src="../../../js/public.js"></script>
        <script src="../../../js/jquery-3.5.1.min.js"></script>
        <script src="../../../js/jquery.cookie.js"></script>
        <script src="../../../js/jquery.print.js"></script>
        <script>
            layui.config({
                base: '../../../layuiadmin/' //静态资源所在路径
            }).extend({
                index: 'lib/index' //主入口模块
            }).use(['index', 'table', 'laypage', 'layer'], function() {
                var table = layui.table,
                    form = layui.form,
                    laypage = layui.laypage,
                    layer = layui.layer;
                //
                var code = getQueryString("id");
                getPrintData();
                //
                function getPrintData(){
                    var param = {
                        Id: code
                    };
                    sendData(IP + "/Import/GetImportBillPrintData", param, 'post', function(res) {
                        if (res.code == 1) { //成功
                            setData(res.data);
                            print();
                        } else { //不成功
                            layer.msg('获取图片失败!', {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function() {});
                        }
                    });
                    
                }
                function setData(data){
                    var list = data.dataList;
                    $("#imgBar").attr("src", data.code);
                    $("#billCode").html(list[0].ImportBillCode);
                    $("#remark").html(list[0].ImportRemark);
                    $("#createUser").html(list[0].CreateUserName);
                    $("#batchCode").html(list[0].ImportLotNo);
                    $("#createTime").html(formatDate(list[0].ImportDate));
                    //
                    var html;
                    for(var i = 0; i < data.dataList.length; i++){
                        html += "<tr>";
                        html += "<td class ='tdPadding'>" + list[i].GoodsCode + "</td>";
                        html += "<td class ='tdPadding'>" + list[i].GoodsName + "</td>";
                        html += "<td class ='tdPadding'>" + list[i].GoodsStandard + "</td>";
                        html += "<td class ='tdPadding'>" + formatDate(list[i].ImportProductionDate) + "</td>";
                        html += "<td class ='tdPadding'>" + list[i].ImportGoodsStatus + "</td>";
                        html += "<td class ='tdPadding'>" + list[i].GoodsUnit + "</td>";
                        html += "<td class ='tdPadding'>" + list[i].ImportQuantity + "</td>";
                        html += "<td class ='tdPadding'>" + list[i].ImportFactQuantity + "</td>";
                        html += "<td class ='tdPadding'>" + list[i].ImportCompleteQuantity + "</td>";
                        html += "</tr>";
                    }
                    $("#tbData tbody").html(html);
                }
                function print(){
                    $("#divPrint").print();
                    //closeThis();
                }
                //获取浏览器参数
                function getQueryString(name) {
                    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
                    var r = window.location.search.substr(1).match(reg);
                    if (r != null) return unescape(r[2]);
                    return null;
                }
                //
                function closeThis(){
                    if (navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Chrome") != -1) {
                        window.location.href = "about:blank";
                        window.close();
                    }
                    else{
                        window.opener = null;
                        window.open("", "_self");
                        window.close();
                    }
                }
            });
        </script>
    </body>
</html>