万材erp项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

330 lines
15 KiB

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('领料单列表')" />
<th:block th:include="include :: datetimepicker-css"/>
<script type="text/javascript" th:src="@{/js/axios.min.js}"></script>
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>领料单号:</label>
<input type="text" name="materialRequisitionNumber"/>
</li>
<li>
<label>订单号码:</label>
<input type="text" name="salesOrderNumber"/>
</li>
<li>
<label>制工单号:</label>
<input type="text" name="workOrderNumber"/>
</li>
<li>
<label>领料部门:</label>
<select name="deptName" th:with="type=${@dict.getType('sys_dept_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>仓库名称:</label>
<select name="stockName">
<option value="">所有</option>
<option value="-1">代码生成请选择字典属性</option>
</select>
</li>
<li>
<label>出库类型:</label>
<select name="outputClass" th:with="type=${@dict.getType('sys_out_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li class="select-time">
<label>出库日期:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginOutputDate]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endOutputDate]"/>
</li>
<li>
<label>领料否:</label>
<select name="getMaterialFlag" th:with="type=${@dict.getType('sys_whether')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="manufacture:materialRequisitionInfo:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="manufacture:materialRequisitionInfo:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger single disabled" onclick="removeSelectedOrder()" shiro:hasPermission="manufacture:materialRequisitionInfo:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="exportRequisitionOrder()" shiro:hasPermission="manufacture:materialRequisitionInfo:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped" style="white-space: nowrap">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('manufacture:materialRequisitionInfo:edit')}]];
var removeFlag = [[${@permission.hasPermi('manufacture:materialRequisitionInfo:remove')}]];
var deptNameDatas = [[${@dict.getType('sys_dept_type')}]];
var outputClassDatas = [[${@dict.getType('sys_out_type')}]];
var getMaterialFlagDatas = [[${@dict.getType('sys_whether')}]];
var prefix = ctx + "manufacture/materialRequisitionInfo";
var prefixMaterialRequisitionDetail = ctx + "manufacture/materialRequisitionDetail";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
clickToSelect: true,
modalName: "领料单",
columns: [{
checkbox: true
},
{
field: 'materialRequisitionId',
title: '领料单id',
visible: false
},
{
field: 'materialRequisitionNumber',
title: '领料单号'
},
{
field: 'salesOrderNumber',
title: '订单号码'
},
{
field: 'workOrderNumber',
title: '制工单号'
},
{
field: 'deptName',
title: '领料部门',
formatter: function(value, row, index) {
return $.table.selectDictLabel(deptNameDatas, value);
}
},
{
field: 'materialRequisitionPerson',
title: '领料人'
},
{
field: 'deptNumber',
title: '部门编号'
},
{
field: 'stockNumber',
title: '仓库编号'
},
{
field: 'stockName',
title: '仓库名称'
},
{
field: 'stockManager',
title: '仓库管理员'
},
{
field: 'outputClass',
title: '出库类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(outputClassDatas, value);
}
},
{
field: 'outputDate',
title: '出库日期'
},
{
field: 'finishProductCode',
title: '成品代码'
},
{
field: 'typeMachine',
title: '机种'
},
{
field: 'workOrderQuantity',
title: '工单数量'
},
{
field: 'remarkContent',
title: '备注内容'
},
{
field: 'getMaterialFlag',
title: '领料否',
formatter: function(value, row, index) {
return $.table.selectDictLabel(getMaterialFlagDatas, value);
}
},
{
field: 'firstAddTime',
title: '录入时间',
formatter: function (value, row, index) {
if (value == null) {
return " ";
} else {
return value;
}
}
},
{
field: 'updateInfoTime',
title: '上次修改时间',
formatter: function (value, row, index) {
if (value == null) {
return " ";
} else {
var vArr = value.split(',')
return vArr[0];
}
}
}]
// {
// title: '操作',
// align: 'center',
// formatter: function(value, row, index) {
// var actions = [];
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.materialRequisitionId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.materialRequisitionId + '\')"><i class="fa fa-remove"></i>删除</a>');
// return actions.join('');
// }
// }
};
$.table.init(options);
});
//删除
function removeSelectedOrder() {
var orderData = $("#bootstrap-table").bootstrapTable("getSelections");
if (orderData.length === 1) {
// console.log(orderData)
$.ajax({
url: prefixMaterialRequisitionDetail + '/list',
type: 'post',
data: {
materialRequisitionNumber: orderData[0].materialRequisitionNumber
},
success: function (res) {
console.log(res)
if (res.rows.length > 0) {
$.modal.confirm("该订单内含有"+ res.rows.length+ "条物料数据将一并删除,是否删除?", function () {
$.ajax({
url: prefix + '/removeSelectedOrder',
type: 'post',
data: {
orderData : JSON.stringify(orderData)
},
success: function (res) {
// console.log(res)
$("#bootstrap-table").bootstrapTable("refresh");
$.modal.msgSuccess("删除成功!")
},
error: function (res) {
$.modal.msgError(res.error())
}
})
})
} else if (res.rows.length == 0) {
$.modal.confirm("确认删除该订单吗?", function () {
$.ajax({
url: prefix + '/remove',
type: 'post',
data: {
ids : orderData[0].materialRequisitionId
},
success: function (res) {
// console.log(res)
$("#bootstrap-table").bootstrapTable("refresh");
$.modal.msgSuccess("删除成功!")
},
error: function (res) {
$.modal.msgError(res.error())
}
})
})
}
}
})
} else {
$.modal.msgWarning("请选择一条数据")
}
}
//导出
function exportRequisitionOrder() {
var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
var data = $("#bootstrap-table").bootstrapTable("getSelections")
if (rows.length !== 1) {
$.modal.alert("请选择一条记录");
return;
} else {
// rows为选中行的id
// console.log(rows);
// console.log(data);
// console.log(data[0].orderNumber)
$.modal.confirm("是否确认要导出本条领料单?", function (){
axios({
url: prefix + '/exportSelected/'+data[0].materialRequisitionId,
method: 'POST',
responseType: 'blob'
}).then(response => {
// console.log(response)
const URL = window.URL.createObjectURL(response.data)
// 创建隐藏<a>标签进行下载
const tempLink = document.createElement('a')
tempLink.style.display = 'none'
tempLink.href = URL
let time = new Date().toLocaleString()
tempLink.setAttribute('download', time + "领料单.xlsx")
if (typeof tempLink.download === 'undefined') {
tempLink.setAttribute('target', '_blank')
}
document.body.appendChild(tempLink)
tempLink.click()
document.body.removeChild(tempLink)// 移除dom元素
window.URL.revokeObjectURL(URL)//释放内存
})
});
}
}
</script>
</body>
</html>