万材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.
 
 
 
 

483 lines
22 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="salesOrderNumber"/>
</li>
<li>
<label>工单号:</label>
<input type="text" name="workOrderNumber"/>
</li>
<li>
<label>加工部门:</label>
<select name="processDept" th:with="type=${@dict.getType('sys_department_class')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>客户代码:</label>
<input type="text" name="enterpriseCode"/>
</li>
<li>
<label>成品代码:</label>
<input type="text" name="finishProductCode"/>
</li>
<li>
<label>成品名称:</label>
<input type="text" name="finishProductName"/>
</li>
<li class="select-time">
<label>开单日期:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginBillingTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endBillingTime]"/>
</li>
<li class="select-time">
<label>交期:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginDeliveryTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endDeliveryTime]"/>
</li>
<li>
<label>工单类型:</label>
<select name="workOrderClass" th:with="type=${@dict.getType('sys_workorderClass')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>结案否:</label>
<select name="closeCaseFlag" 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:workOrderInfo:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="manufacture:workOrderInfo:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="removeWorkOrder()" shiro:hasPermission="manufacture:workOrderInfo:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="exportWorkOrder()" shiro:hasPermission="manufacture:workOrderInfo:export">
<i class="fa fa-download"></i> 导出
</a>
<a class="btn btn-primary" onclick="reviewCloseCase()" shiro:hasPermission="manufacture:workOrderInfo:closeCase">
<i class="fa fa-hand-grab-o"></i> 结案
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" style="white-space: nowrap"></table>
</div>
</div>
</div>
<!--订单结案-->
<div class="modal fade" id="closeCaseModal">
<div class="modal-dialog">
<div class="modal-content message_align">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h4 class="modal-title">结案信息</h4>
</div>
<div class="modal-body" style="height: 180px">
<form id="form-closeCase-edit">
<div class="form-group" style="display: none">
<label class="col-sm-3 control-label is-required">工单id:</label>
<div class="col-sm-8">
<input id="workOrderId" name="workOrderId" class="form-control" type="text" required
readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label ">结案否:</label>
<div class="col-sm-8">
<select id="closeCaseFlag" name="closeCaseFlag" class="form-control"
th:with="type=${@dict.getType('sys_whether')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label ">结案时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input id="closeCaseTime" name="closeCaseTime" class="form-control"
placeholder="yyyy-mm-dd hh:ii:ss" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label ">结案人:</label>
<div class="col-sm-8">
<!-- <input id="auditName" name="auditName" class="form-control" type="text" th:value="${@permission.getPrincipalProperty('userName')}">-->
<input id="closeCasePerson" name="closeCasePerson" class="form-control" type="text">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" onclick="closeCaseSubmit()" class="btn btn-success" data-dismiss="modal">确定</button>
</div>
</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:workOrderInfo:edit')}]];
var removeFlag = [[${@permission.hasPermi('manufacture:workOrderInfo:remove')}]];
var processDeptDatas = [[${@dict.getType('sys_department_class')}]];
var workOrderClassDatas = [[${@dict.getType('sys_workorderClass')}]];
var closeCaseFlagDatas = [[${@dict.getType('sys_whether')}]];
var prefix = ctx + "manufacture/workOrderInfo";
$(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: 'workOrderId',
title: '制工单id',
visible: false
},
{
field: 'closeCaseFlag',
title: '结案否',
formatter: function(value, row, index) {
// return $.table.selectDictLabel(closeCaseNoDatas, value);
var actions = [];
if ($.table.selectDictLabel(closeCaseFlagDatas, value) == "<span class=''>是</span>") {
actions.push('<a class="btn btn-primary btn-xs disabled">已结案</a> ');
} else {
actions.push('<a class="btn btn-danger btn-xs disabled">未结案</a> ');
}
return actions.join('');
}
},
{
field: 'salesOrderNumber',
title: '订单号码'
},
{
field: 'workOrderNumber',
title: '工单号'
},
{
field: 'line',
title: 'Line#'
},
{
field: 'processDept',
title: '加工部门',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processDeptDatas, value);
}
},
{
field: 'enterpriseCode',
title: '客户代码'
},
{
field: 'enterpriseName',
title: '客户名称'
},
{
field: 'finishProductCode',
title: '成品代码'
},
{
field: 'finishProductName',
title: '成品名称'
},
{
field: 'specificationModel',
title: '规格型号'
},
{
field: 'typeMachine',
title: '机种'
},
{
field: 'inventoryUnit',
title: '单位'
},
{
field: 'orderQuantity',
title: '订单数量'
},
{
field: 'deliveryOrderQuantity',
title: '投单数量'
},
{
field: 'beginOrderQuantity',
title: '已开工单数'
},
{
field: 'notBeginOrderQuantity',
title: '未开工单数'
},
{
field: 'customerFactory',
title: '客户厂区'
},
{
field: 'beginDate',
title: '开工日期'
},
{
field: 'endDate',
title: '完工日期'
},
{
field: 'billingTime',
title: '开单日期'
},
{
field: 'deliveryTime',
title: '交期'
},
{
field: 'versionNumber',
title: '版本号'
},
{
field: 'salesExplain',
title: '备注说明'
},
{
field: 'workOrderClass',
title: '工单类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(workOrderClassDatas, value);
}
},
{
field: 'closeCasePerson',
title: '结案人'
},
{
field: 'closeCaseTime',
title: '结案时间'
},
{
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.workOrderId + '\')"><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.workOrderId + '\')"><i class="fa fa-remove"></i>删除</a>');
// return actions.join('');
// }
// }
};
$.table.init(options);
});
$("input[name='closeCaseTime']").datetimepicker({
format: 'yyyy-mm-dd hh:ii:ss',
autoclose: true,
minView: 0,
minuteStep: 1
});
//删除
function removeWorkOrder() {
var orderData = $("#bootstrap-table").bootstrapTable("getSelections");
if (orderData.length === 1) {
// console.log(orderData)
$.ajax({
url: ctx + 'manufacture/workOrderDetail/list',
type: 'post',
data: {
workOrderNumber: orderData[0].workOrderNumber
},
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].workOrderId
},
success: function (res) {
// console.log(res)
$("#bootstrap-table").bootstrapTable("refresh");
$.modal.msgSuccess("删除成功!")
},
error: function (res) {
$.modal.msgError(res.error())
}
})
})
}
}
})
} else {
$.modal.msgWarning("请选择一条数据")
}
}
//导出
function exportWorkOrder() {
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].workOrderId,
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)//释放内存
})
});
}
}
// 订单结案
function reviewCloseCase(){
let data = $("#bootstrap-table").bootstrapTable("getSelections");
let userName = [[${@permission.getPrincipalProperty('userName')}]];
if (data.length ===1) {
$("#workOrderId").val(data[0].workOrderId)
$("#closeCaseFlag").val(data[0].closeCaseFlag).trigger("change")
$("#closeCasePerson").val(userName)
$("#closeCaseTime").datetimepicker("setDate", new Date());
$("#closeCaseModal").modal("show");
}else {
$.modal.alert("请选择一条数据");
}
}
// 订单结案
function closeCaseSubmit(){
$.ajax({
url: prefix + "/edit",
type: "post",
resultType: "json",
data: $('#form-closeCase-edit').serialize(),
success: function (resp) {
// console.log(resp)
$("#closeCaseModal").modal("hide");
$("#bootstrap-table").bootstrapTable('refresh');
$.modal.msgSuccess("操作成功!")
},
error: function () {
$.modal.msgError("出错了!");
}
});
}
</script>
</body>
</html>