<!DOCTYPE HTML> <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <meta charset="utf-8"> <head th:include="include :: header"></head> <body class="white-bg"> <div class="container-div"> <!--<div class="wrapper wrapper-content animated fadeInRight ibox-content">--> <div class="row"> <div class="col-sm-12 select-info"> <!--<form id="combination-form" th:object="${shipmentDetail}">--> <div class="select-list"> <ul th:object="${shipmentDetail}"> <li style="display: none"><input type="hidden" id="zoneCode" th:value="*{zoneCode}"></li> <li style="display: none"><input type="hidden" id="shipmentDetailId" th:value="*{id}"></li> <li style="display: none"><input type="hidden" id="inventoryStatus" th:value="*{inventoryStatus}"></li> <li>出库单号:<input type="text" readonly="readonly" id="code" th:value="*{shipmentCode}"></li> <li>存货编码:<input type="text" readonly="readonly" th:value="*{materialCode}"></li> <li>物料名称:<input type="text" readonly="readonly" th:value="*{materialName}"></li> <li>剩余配盘数:<input type="text" readonly="readonly" th:value="*{qty-qtyCompleted}" id="qtyRemain"></li> <!--<li> 组盘类型: <select name="" id="type"> <option value="300">整盘出库</option> <option value="400" selected="selected">分拣出库</option> </select> </li>--> <li>配盘数:<input type="number" id="combinationQty" style="background-color: #a6d3ff"></li> <li> <a class="btn btn-success btn-sm" onclick="combination()" shiro:hasPermission="shipment:shippingCombination:combination"><i class="fa fa-edit"></i> 组盘</a> </li> </ul> </div> <!--</form>--> </div> <div class="col-sm-12 select-info"> <form id="inventory-form" th:object="${shipmentDetail}"> <div class="select-list"> <ul> <li> 货主编码:<input type="text" id="companyCode" name="companyCode" th:value="*{companyCode}" readonly="readonly"/> </li> <li> 存货编码:<input type="text" id="materialCode" name="materialCode" th:value="*{materialCode}" readonly="readonly"/> </li> <li> 库位编码:<input type="text" name="locationCode"/> </li> <li> <a id="search" class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> <!--<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="general:inventory:export"><i class="fa fa-download"></i> 导出</a>--> </li> <!--<li>--> <!--物料类型:--> <!--<select id="materialType" name="type" th:with="type=${@dict.getType('materialType')}">--> <!--<option value="">所有</option>--> <!--<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>--> <!--</select>--> <!--</li>--> <li> 项目号:<input id="project" type="text" name="project" th:value="*{project}"/> </li> <li> 库存状态: <select name="inventoryStatus" th:with="type=${@dict.getType('inventoryStatus')}"> <option value="">所有</option> <option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option> </select> </li> <li> 容器编号:<input type="text" name="containerCode"/> </li> <li class="time"> <label>入库时间: </label> <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[createdBegin]"/> <span>-</span> <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[createdEnd]"/> </li> </ul> </div> </form> </div> <div class="col-sm-12 select-info"> <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table> </div> </div> <!--</div>--> </div> <div th:include="include::footer"></div> <script th:inline="javascript"> var addFlag = [[${@permission.hasPermi('shipment:shippingCombination:combination')}]]; var prefix = ctx + "shipment/shippingCombination"; var inventoryStatus=[[${@dict.getType('inventoryStatus')}]]; $(function() { $("#bootstrap-table").bootstrapTable({ url: prefix + "/getInventory", queryParams: function (params) { return { code:$("#code").val(), companyCode: $("#companyCode").val(), materialCode: $("#materialCode").val(), inventoryStatus: $("#inventoryStatus").val(), project: $("#project").val(), zoneCode:$("#zoneCode").val() }; }, method:"post", contentType: "application/x-www-form-urlencoded", cache: false, // 是否使用缓存 showRefresh: true, // 是否显示刷新按钮 showToggle: true, // 是否显示详细视图和列表视图的切换按钮 showExport: true, // 是否支持导出文件 showColumns:true, iconSize: 'outline', // 图标大小:undefined默认的按钮尺寸 xs超小按钮sm小按钮lg大按钮 toolbar: '#toolbar', // 指定工作栏 queryParamsType:"undefined", modalName: "库存", search: false, sortable: true, //排序 sortStable: true, // sidePagination: "server", sortName: "id", //created入库时间早的展示在前 sortOrder: "asc", pagination: true, // 是否显示分页(*) pageNumber: 1, // 初始化加载第一页,默认第一页 pageList: [5,10,20], // 可供选择的每页的行数(*) pageSize: 10, // 每页的记录行数(*) columns: [ { radio: true }, { title: '操作', align: 'center', formatter: function(value, row, index) { var actions = []; var com_qty=row.qty-row.taskQty; actions.push('<a class="btn btn-success btn-xs ' + addFlag + '" href="#" onclick="combination2(\'' + row.id + '\','+ com_qty +')"><i class="fa fa-edit"></i>组盘</a> '); return actions.join(''); } }, { field : 'id', title : 'id', align: 'center', }, { field : 'locationCode', title : '库位编码' }, { field : 'containerCode', title : '容器编号' }, { field : 'sourceCode', title : '上游系统单号', visible:false }, { field : 'sourceLine', title : '上游系统行号', visible:false }, { field : 'companyCode', title : '货主编码' }, { field : 'materialCode', title : '存货编码' }, { field : 'materialOldCode', title : '存货代码' }, { field : 'materialName', title : '物料名称' }, { field : 'zoneCode', title : '物料库区' }, { field : 'qty', title : '数量' }, { field : 'status', title : '库存状态' , formatter: function(value, row, index) { return $.table.selectDictLabel(inventoryStatus, value); } }, { field : 'taskQty', title : '已预定数量' }, { field : 'receiptCode', title : '入库单编码' }, { field : 'receiptDetailId', title : '入库单明细id' }, { field : 'batch', title : '批次' }, { field : 'lot', title : '批号' }, { field : 'project', title : '项目号' }, { field : 'manufactureDate', title : '生产日期' , visible:false }, { field : 'expirationDate', title : '失效日期' , visible:false }, { field : 'costPrice', title : '成本' , visible:false }, { field : 'listPrice', title : '标价' , visible:false }, { field : 'netPrice', title : '净价' , visible:false }, { field : 'created', title : '入库时间' }, { field : 'createdBy', title : '创建用户' , visible:false }, { field : 'lastUpdated', title : '最后修改时间' }, { field : 'lastUpdatedBy', title : '更新用户' } ] // var options = { // url: prefix + "/getInventory", // queryParams: queryParams, // modalName: "库存", // search: false, // sortable: true, //排序 // sortStable: true, // pagination: true, // 是否显示分页(*) // sortName: "id", //created入库时间早的展示在前 // sortOrder: "asc", // columns: [ // { // radio: true // }, // { // title: '操作', // align: 'center', // formatter: function(value, row, index) { // var actions = []; // var com_qty=row.qty-row.taskQty; // actions.push('<a class="btn btn-success btn-xs ' + addFlag + '" href="#" onclick="combination2(\'' + row.id + '\','+ com_qty +')"><i class="fa fa-edit"></i>组盘</a> '); // return actions.join(''); // } // }, // { // field : 'id', // title : 'id', // align: 'center', // }, // { // field : 'locationId', // title : '库位id' , // visible:false // }, // { // field : 'locationCode', // title : '库位编码' // }, // { // field : 'containerCode', // title : '容器编号' // }, // { // field : 'sourceCode', // title : '上游系统单号', // visible:false // }, // { // field : 'sourceLine', // title : '上游系统行号', // visible:false // }, // { // field : 'companyCode', // title : '货主编码' // }, // { // field : 'materialCode', // title : '存货编码' // }, // { // field : 'materialName', // title : '物料名称' // }, // { // field : 'qty', // title : '数量' // }, // { // field : 'status', // title : '库存状态' , // formatter: function(value, row, index) { // return $.table.selectDictLabel(inventoryStatus, value); // } // }, // { // field : 'taskQty', // title : '已预定数量' // }, // // { // field : 'receiptCode', // title : '入库单编码' // }, // // { // // field : 'receiptId', // // title : '入库单id' , // // visible:false // // }, // { // field : 'receiptDetailId', // title : '入库单明细id' // }, // { // field : 'batch', // title : '批次' // }, // { // field : 'lot', // title : '批号' // }, // { // field : 'project', // title : '项目号' // }, // { // field : 'manufactureDate', // title : '生产日期' , // visible:false // }, // { // field : 'expirationDate', // title : '失效日期' , // visible:false // }, // { // field : 'costPrice', // title : '成本' , // visible:false // }, // { // field : 'listPrice', // title : '标价' , // visible:false // }, // { // field : 'netPrice', // title : '净价' , // visible:false // }, // { // field : 'created', // title : '入库时间' // }, // { // field : 'createdBy', // title : '创建用户' , // visible:false // }, // { // field : 'lastUpdated', // title : '最后修改时间' // }, // { // field : 'lastUpdatedBy', // title : '更新用户' // }, // { // field : 'userDef1', // title : '自定义字段1' , // visible:false // }, // { // field : 'userDef2', // title : '自定义字段2' , // visible:false // }, // { // field : 'userDef3', // title : '自定义字段3' , // visible:false // } // ] // }; // $.table.init(options); // $("#search").click(); }) }); function combination() { var data=$("#bootstrap-table").bootstrapTable('getSelections'); if (data.length != 1) { $.modal.alertWarning("请选择一条记录"); return; } // combination2(data[0].id); var qty =$("#combinationQty").val(); if(!isFloat(qty)||qty == ""){ $.modal.alertError("配盘数输入错误"); return } $.ajax({ cache : true, type : "post", url : prefix + "/Addcombination", dataType: "json", // contentType:"application/json;charset=utf-8", data:{ shipmentDetailId:$("#shipmentDetailId").val(), inventoryId:data[0].id, qty:qty, taskType:$("#type").val(), auto:false, //type:$("#type").val()=="400"?0:1 }, async : false, error : function(request) { $.modal.alertError("请求失败!"); }, success : function(data) { if(data.code=="200"){ $.modal.alertSuccess("成功"); var qtyRemain = $("#qtyRemain").val(); $("#qtyRemain").val(qtyRemain-qty); $("#search").click(); //组盘后刷新下父页面的表格 parent.$("#list-btn",window.parent.document).click(); }else{ $.modal.alertError(data.msg) } } }) } function combination2(id,com_qty) { var remain_qty=$("#qtyRemain").val(); if (com_qty>=remain_qty) { if(!isFloat(remain_qty)||remain_qty == ""){ $.modal.alertError("配盘数错误"); return } $.ajax({ cache : true, type : "post", url : prefix + "/Addcombination", dataType: "json", // contentType:"application/json;charset=utf-8", data:{ shipmentDetailId:$("#shipmentDetailId").val(), inventoryId:id, qty:remain_qty, taskType:$("#type").val(), auto:false, type:$("#materialType").val()=="400"?0:1 }, async : false, error : function(request) { $.modal.alertError("请求失败!"); }, success : function(data) { if(data.code=="200"){ $.modal.alertSuccess("成功"); var qtyRemain = $("#qtyRemain").val(); $("#qtyRemain").val(qtyRemain-remain_qty); $("#search").click(); //组盘后刷新下父页面的表格 parent.$("#list-btn",window.parent.document).click(); }else{ $.modal.alertError(data.msg) } } }) } else { if(!isFloat(com_qty)||com_qty == ""){ $.modal.alertError("配盘数错误"); return } $.ajax({ cache : true, type : "post", url : prefix + "/Addcombination", dataType: "json", // contentType:"application/json;charset=utf-8", data:{ shipmentDetailId:$("#shipmentDetailId").val(), inventoryId:id, qty:com_qty, taskType:$("#type").val(), auto:false, type:$("#materialType").val()=="400"?0:1 }, async : false, error : function(request) { $.modal.alertError("请求失败!"); }, success : function(data) { if(data.code=="200"){ $.modal.alertSuccess("成功"); var qtyRemain = $("#qtyRemain").val(); $("#qtyRemain").val(qtyRemain-com_qty); $("#search").click(); //组盘后刷新下父页面的表格 parent.$("#list-btn",window.parent.document).click(); }else{ $.modal.alertError(data.msg) } } }) } } function isFloat( str ) { for(var i=0;i<str.length;i++) { if ((str.charAt(i)<"0" || str.charAt(i)>"9") && str.charAt(i) != '.'){ return false; } } return true; } </script> </body> </html>