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.
1035 lines
45 KiB
1035 lines
45 KiB
<!DOCTYPE html>
|
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
|
<head>
|
|
<th:block th:include="include :: header('修改制工单')" />
|
|
<th:block th:include="include :: datetimepicker-css" />
|
|
<link th:href="@{/ajax/libs/select2/select2.css}" rel="stylesheet">
|
|
<link th:href="@{/ajax/libs/select2/select2-bootstrap.css}" rel="stylesheet">
|
|
<th:block th:include="include :: bootstrap-editable-css"/>
|
|
<style>
|
|
.other-container {
|
|
width: 90%;
|
|
height: 200px;
|
|
margin: auto;
|
|
}
|
|
.other {
|
|
margin-top: 20px;
|
|
}
|
|
h4 {
|
|
display: inline-block;
|
|
margin-right: 20px;
|
|
}
|
|
.modal-body{
|
|
height: 550px;
|
|
}
|
|
iframe{
|
|
width: 100%;
|
|
height: 500px;
|
|
frameborder: 0;
|
|
border: 0;
|
|
display: inline-block;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body class="white-bg">
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|
<form class="form-horizontal m" id="form-workOrderInfo-edit" th:object="${workOrderInfo}">
|
|
<input name="workOrderId" th:field="*{workOrderId}" type="hidden">
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">订单号码:</label>
|
|
<div class="col-sm-8">
|
|
<input name="salesOrderNumber" th:field="*{salesOrderNumber}" class="form-control" type="text" required readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">工单号:</label>
|
|
<div class="col-sm-8">
|
|
<input name="workOrderNumber" th:field="*{workOrderNumber}" class="form-control" type="text" required readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">Line#:</label>
|
|
<div class="col-sm-8">
|
|
<input name="line" th:field="*{line}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">加工部门:</label>
|
|
<div class="col-sm-8">
|
|
<select name="processDept" class="form-control m-b" th:with="type=${@dict.getType('sys_department_class')}">
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{processDept}"></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">客户代码:</label>
|
|
<div class="col-sm-8">
|
|
<input name="enterpriseCode" th:field="*{enterpriseCode}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">客户名称:</label>
|
|
<div class="col-sm-8">
|
|
<input name="enterpriseName" th:field="*{enterpriseName}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">成品代码:</label>
|
|
<div class="col-sm-8">
|
|
<input name="finishProductCode" th:field="*{finishProductCode}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">成品名称:</label>
|
|
<div class="col-sm-8">
|
|
<input name="finishProductName" th:field="*{finishProductName}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">规格型号:</label>
|
|
<div class="col-sm-8">
|
|
<input name="specificationModel" th:field="*{specificationModel}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">机种:</label>
|
|
<div class="col-sm-8">
|
|
<input name="typeMachine" th:field="*{typeMachine}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">单位:</label>
|
|
<div class="col-sm-8">
|
|
<input name="inventoryUnit" th:field="*{inventoryUnit}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">订单数量:</label>
|
|
<div class="col-sm-8">
|
|
<input name="orderQuantity" th:field="*{orderQuantity}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">投单数量:</label>
|
|
<div class="col-sm-8">
|
|
<input name="deliveryOrderQuantity" th:field="*{deliveryOrderQuantity}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">已开工单数:</label>
|
|
<div class="col-sm-8">
|
|
<input name="beginOrderQuantity" th:field="*{beginOrderQuantity}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">未开工单数:</label>
|
|
<div class="col-sm-8">
|
|
<input name="notBeginOrderQuantity" th:field="*{notBeginOrderQuantity}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">客户厂区:</label>
|
|
<div class="col-sm-8">
|
|
<input name="customerFactory" th:field="*{customerFactory}" class="form-control" type="text">
|
|
</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 name="beginDate" th:field="*{beginDate}" class="form-control" placeholder="yyyy-MM-dd" 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">
|
|
<div class="input-group date">
|
|
<input name="endDate" th:field="*{endDate}" class="form-control" placeholder="yyyy-MM-dd" 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">
|
|
<div class="input-group date">
|
|
<input name="billingTime" th:field="*{billingTime}" class="form-control" placeholder="yyyy-MM-dd" 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">
|
|
<div class="input-group date">
|
|
<input name="deliveryTime" th:field="*{deliveryTime}" class="form-control" placeholder="yyyy-MM-dd" 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 name="versionNumber" th:field="*{versionNumber}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">备注说明:</label>
|
|
<div class="col-sm-8">
|
|
<textarea name="salesExplain" th:field="*{salesExplain}" class="form-control" type="text"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">工单类型:</label>
|
|
<div class="col-sm-8">
|
|
<select name="workOrderClass" class="form-control m-b" th:with="type=${@dict.getType('sys_workorderClass')}">
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{workOrderClass}"></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<!-- <div class="form-group"> -->
|
|
<!-- <label class="col-sm-3 control-label">结案否:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <select name="closeCaseFlag" class="form-control m-b" th:with="type=${@dict.getType('sys_whether')}">-->
|
|
<!-- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{closeCaseFlag}"></option>-->
|
|
<!-- </select>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<!-- <div class="form-group"> -->
|
|
<!-- <label class="col-sm-3 control-label">结案人:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <input name="closeCasePerson" th:field="*{closeCasePerson}" class="form-control" type="text">-->
|
|
<!-- </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 name="closeCaseTime" th:value="${#dates.format(workOrderInfo.closeCaseTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">-->
|
|
<!-- <span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
</form>
|
|
</div>
|
|
|
|
<div class="modal inmodal" id="salesFinishModal"
|
|
role="dilog" aria-hidden="true">
|
|
|
|
<!-- 查询订单成品资料-->
|
|
<div class="modal-dialog" style="width: 1000px;background-color: #FFFFFF">
|
|
|
|
<div class="modal-content" style="background-color: #FFFFFF">
|
|
|
|
<div class="modal-body">
|
|
<div class="container-div">
|
|
<div class="row">
|
|
<div class="col-sm-12 search-collapse">
|
|
<form id="salesFinishFormId">
|
|
<div class="select-list">
|
|
<ul>
|
|
<li>
|
|
<label>订单号码:</label>
|
|
<input type="text" name="salesOrderNumber"/>
|
|
</li>
|
|
<li>
|
|
<label>成品代码:</label>
|
|
<input type="text" name="finishProductCode"/>
|
|
</li>
|
|
<li>
|
|
<label>成品名称:</label>
|
|
<input type="text" name="finishProductName"/>
|
|
</li>
|
|
<li>
|
|
<label>客户代码:</label>
|
|
<input type="text" name="enterpriseCode"/>
|
|
</li>
|
|
<li>
|
|
<label>客户名称:</label>
|
|
<input type="text" name="enterpriseName"/>
|
|
</li>
|
|
<li>
|
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('salesFinishFormId','salesFinishTable')"><i
|
|
class="fa fa-search"></i> 搜索</a>
|
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('salesFinishFormId','salesFinishTable')"><i
|
|
class="fa fa-refresh"></i> 重置</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="col-sm-12 select-table table-striped">
|
|
<table id="salesFinishTable" style="white-space:nowrap"></table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<a class="btn btn-warning btn-rounded" onclick="addSalesFinishToTable()">确认添加</a>
|
|
<a class="btn btn-primary btn-rounded" onclick="closeSalesFinishModal()">关闭</a>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="other-container">
|
|
<div class="other">
|
|
<br><hr>
|
|
<h4>物料信息</h4>
|
|
<a class="btn btn-primary" onclick="showBomModal()"><i class="fa fa-plus"></i> 查看BOM信息</a>
|
|
<a class="btn btn-danger" onclick="removeMaterial()" ><i class="fa fa-remove"></i> 删除材料</a>
|
|
<div class="col-sm-12 select-table table-striped">
|
|
<table id="addBomMaterialTable" style="white-space:nowrap"></table>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal inmodal" id="bomMaterialModal"
|
|
role="dilog" aria-hidden="true">
|
|
<!-- 查询BOM资料-->
|
|
<div class="modal-dialog" style="width: 1000px;background-color: #FFFFFF">
|
|
|
|
<div class="modal-content" style="background-color: #FFFFFF">
|
|
|
|
<div class="modal-body">
|
|
<div class="container-div">
|
|
<div class="row">
|
|
<div class="col-sm-12 select-table table-striped">
|
|
<table id="rawMaterialBomTable" style="white-space:nowrap"></table>
|
|
</div>
|
|
<div class="col-sm-12 select-table table-striped">
|
|
<table id="subsidiaryMaterialBomTable" style="white-space:nowrap"></table>
|
|
</div>
|
|
<div class="col-sm-12 select-table table-striped">
|
|
<table id="bcpMaterialBomTable" style="white-space:nowrap"></table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<a class="btn btn-warning btn-rounded" onclick="addBomDetailToTable()">确认添加</a>
|
|
<a class="btn btn-primary btn-rounded" onclick="closeBomDetailModal()">关闭</a>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<th:block th:include="include :: footer" />
|
|
<th:block th:include="include :: datetimepicker-js" />
|
|
<th:block th:include="include :: select2-js"/>
|
|
<th:block th:include="include :: bootstrap-table-editable-js"/>
|
|
<script th:inline="javascript">
|
|
var getData = [[${workOrderInfo}]];
|
|
// console.log(getData)
|
|
// console.log(getData.workOrderNumber)
|
|
var prefix = ctx + "manufacture/workOrderInfo";
|
|
|
|
var inventoryUnitDatas = [[${@dict.getType('sys_unit_class')}]];
|
|
var materialTypeDatas = [[${@dict.getType('bom_material_category')}]];
|
|
|
|
$("#form-workOrderInfo-edit").validate({
|
|
focusCleanup: true
|
|
});
|
|
|
|
function submitHandler() {
|
|
var getData = $("#addBomMaterialTable").bootstrapTable("getData");
|
|
if(getData.length > 0){
|
|
if ($.validate.form()) {
|
|
//确认添加选中的物料数据
|
|
confirmMaterial();
|
|
$.operate.save(prefix + "/edit", $('#form-workOrderInfo-edit').serialize());
|
|
}
|
|
} else {
|
|
$.modal.alertWarning("未选择物料,请选择!")
|
|
}
|
|
}
|
|
|
|
$("input[name='billingTime']").datetimepicker({
|
|
format: "yyyy-mm-dd hh:ii:ss",
|
|
minView: "month",
|
|
autoclose: true,
|
|
todayBtn: true
|
|
});
|
|
|
|
$("input[name='beginDate']").datetimepicker({
|
|
format: "yyyy-mm-dd",
|
|
minView: "month",
|
|
autoclose: true,
|
|
todayBtn: true
|
|
});
|
|
|
|
$("input[name='endDate']").datetimepicker({
|
|
format: "yyyy-mm-dd",
|
|
minView: "month",
|
|
autoclose: true,
|
|
todayBtn: true
|
|
});
|
|
|
|
|
|
$("input[name='deliveryTime']").datetimepicker({
|
|
format: "yyyy-mm-dd",
|
|
minView: "month",
|
|
autoclose: true,
|
|
todayBtn: true
|
|
});
|
|
|
|
$("input[name='closeCaseTime']").datetimepicker({
|
|
format: "yyyy-mm-dd",
|
|
minView: "month",
|
|
autoclose: true,
|
|
todayBtn: true
|
|
});
|
|
|
|
$("#form-workOrderInfo-edit input[name='salesOrderNumber']").focus(function () {
|
|
$(this).attr("placeholder", "");
|
|
}).blur(function () {
|
|
$(this).attr("placeholder", "双击选择订单");
|
|
});
|
|
|
|
//双击选择订单成品
|
|
$("#form-workOrderInfo-edit input[name='salesOrderNumber']").dblclick(function () {
|
|
// $.modal.msg("订单详情")
|
|
$("#salesFinishModal").modal("show");
|
|
var options = {
|
|
id: 'salesFinishTable',
|
|
url: ctx + "system/salesFinish/list",
|
|
modalName: "销售产品",
|
|
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
|
|
cardView: false, // 是否显示详细视图
|
|
detailView: false, // 是否显示父子表
|
|
smartDisplay: false, // 加了这个才显示每页显示的行数
|
|
showExport: false, // 是否显示导出按钮
|
|
clickToSelect: true,//点击行选中
|
|
queryParams: function (params) {
|
|
var curParams = {
|
|
// 传递参数查询参数
|
|
pageSize: params.limit,
|
|
pageNum: params.offset / params.limit + 1,
|
|
// enterpriseCode: data[0].enterpriseCode
|
|
};
|
|
let json = $.extend(curParams, $.common.formToJSON("salesFinishFormId"));
|
|
return json;
|
|
},
|
|
columns: [{
|
|
checkbox: true
|
|
},
|
|
{
|
|
field: 'salesFinishId',
|
|
title: '订单id',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'salesOrderCode',
|
|
title: '订单编号'
|
|
},
|
|
{
|
|
field: 'salesOrderNumber',
|
|
title: '订单号码'
|
|
},
|
|
{
|
|
field: 'enterpriseCode',
|
|
title: '客户代码'
|
|
},
|
|
{
|
|
field: 'enterpriseName',
|
|
title: '客户名称'
|
|
},
|
|
{
|
|
field: 'finishProductCode',
|
|
title: '成品代码'
|
|
},
|
|
{
|
|
field: 'finishProductName',
|
|
title: '成品名称'
|
|
},
|
|
{
|
|
field: 'specificationModel',
|
|
title: '规格型号'
|
|
},
|
|
{
|
|
field: 'typeMachine',
|
|
title: '机种'
|
|
},
|
|
{
|
|
field: 'inventoryUnit',
|
|
title: '单位'
|
|
},
|
|
{
|
|
field: 'stockUnitWeight',
|
|
title: '重量'
|
|
},
|
|
{
|
|
field: 'processPrice',
|
|
title: '单价'
|
|
},
|
|
{
|
|
field: 'productQuantity',
|
|
title: '数量'
|
|
},
|
|
{
|
|
field: 'amountMoney',
|
|
title: '金额'
|
|
},
|
|
{
|
|
field: 'deliveryTime',
|
|
title: '交期'
|
|
},
|
|
{
|
|
field: 'line',
|
|
title: 'Line#'
|
|
},
|
|
{
|
|
field: 'versionNumber',
|
|
title: '版本号'
|
|
},
|
|
{
|
|
field: 'salesExplain',
|
|
title: '说明'
|
|
}]
|
|
};
|
|
$.table.init(options);
|
|
})
|
|
|
|
//初始化添加表格
|
|
$("#addBomMaterialTable").bootstrapTable({
|
|
url: ctx + 'manufacture/workOrderDetail/list',
|
|
pagination: true,
|
|
pageNumber: 1,
|
|
pageSize: 10,
|
|
method: "post",
|
|
contentType: "application/x-www-form-urlencoded",
|
|
striped: true, // 是否显示行间隔色
|
|
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
|
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
|
|
cardView: false, // 是否显示详细视图
|
|
detailView: false, // 是否显示父子表
|
|
smartDisplay: false, // 加了这个才显示每页显示的行数
|
|
showExport: false, // 是否显示导出按钮
|
|
clickToSelect: true,
|
|
paginationDetailHAlign: ' hiddenDetailInfo',
|
|
height: 250,
|
|
uniqueId: 'materialCode',
|
|
queryParams: function (params) {
|
|
//console.log("123");
|
|
var curParams = {
|
|
// 传递参数查询参数
|
|
pageSize: params.limit,
|
|
pageNum: params.offset / params.limit + 1,
|
|
// enterpriseCode: data[0].enterpriseCode
|
|
workOrderNumber: getData.workOrderNumber
|
|
};
|
|
// console.log(data[0].enterpriseCode)
|
|
return curParams
|
|
},
|
|
columns: [{
|
|
checkbox: true
|
|
},
|
|
{
|
|
field: 'workOrderDetailId',
|
|
title: '制工材料id',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'workOrderNumber',
|
|
title: '工单号',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'materialCode',
|
|
title: '物料代码'
|
|
},
|
|
{
|
|
field: 'materialName',
|
|
title: '物料名称'
|
|
},
|
|
{
|
|
field: 'specificationModel',
|
|
title: '规格型号'
|
|
},
|
|
{
|
|
field: 'inventoryUnit',
|
|
title: '单位'
|
|
},
|
|
{
|
|
field: 'materialType',
|
|
title: '物料类别',
|
|
formatter: function(value, row, index) {
|
|
return $.table.selectDictLabel(materialTypeDatas, value);
|
|
},
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'materialConsumption',
|
|
title: '用量',
|
|
editable: {
|
|
type: 'text',
|
|
title: '用量',
|
|
emptytext: '用量',
|
|
validate: function (value) {
|
|
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'itemNumber',
|
|
title: '料号',
|
|
editable: {
|
|
type: 'text',
|
|
title: '料号',
|
|
emptytext: '料号',
|
|
validate: function (value) {
|
|
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'description',
|
|
title: '说明',
|
|
editable: {
|
|
type: 'text',
|
|
title: '说明',
|
|
emptytext: '说明',
|
|
validate: function (value) {
|
|
|
|
}
|
|
}
|
|
}]
|
|
})
|
|
|
|
//选择订单填充数据
|
|
function addSalesFinishToTable() {
|
|
var data = $("#salesFinishTable").bootstrapTable("getSelections",true);
|
|
// console.log(data)
|
|
if (data.length === 1) {
|
|
$("#form-workOrderInfo-edit input[name='salesOrderNumber']").val(data[0].salesOrderNumber);
|
|
$("#form-workOrderInfo-edit input[name='line']").val(data[0].line);
|
|
// $("#form-workOrderInfo-add select[name='processDept']").val(data[0].processDept).trigger("change");
|
|
$("#form-workOrderInfo-edit input[name='enterpriseCode']").val(data[0].enterpriseCode);
|
|
$("#form-workOrderInfo-edit input[name='enterpriseName']").val(data[0].enterpriseName);
|
|
$("#form-workOrderInfo-edit input[name='finishProductCode']").val(data[0].finishProductCode);
|
|
$("#form-workOrderInfo-edit input[name='finishProductName']").val(data[0].finishProductName);
|
|
$("#form-workOrderInfo-edit input[name='specificationModel']").val(data[0].specificationModel);
|
|
$("#form-workOrderInfo-edit input[name='typeMachine']").val(data[0].typeMachine);
|
|
$("#form-workOrderInfo-edit input[name='inventoryUnit']").val(data[0].inventoryUnit);
|
|
$("#form-workOrderInfo-edit input[name='orderQuantity']").val(data[0].productQuantity);
|
|
$("#form-workOrderInfo-edit input[name='deliveryOrderQuantity']").val(data[0].productQuantity);
|
|
$("#form-workOrderInfo-edit input[name='deliveryTime']").val(data[0].deliveryTime);
|
|
$("#form-workOrderInfo-edit input[name='versionNumber']").val(data[0].versionNumber);
|
|
$("#form-workOrderInfo-edit textarea[name='salesExplain']").val(data[0].salesExplain);
|
|
closeSalesFinishModal();
|
|
} else {
|
|
$.modal.alertError("出错了!")
|
|
}
|
|
}
|
|
|
|
//关闭订单框
|
|
function closeSalesFinishModal() {
|
|
$("#salesFinishModal").modal("hide");
|
|
}
|
|
|
|
//显示BOM信息
|
|
function showBomModal() {
|
|
if ($.validate.form()) {
|
|
$("#bomMaterialModal").modal("show");
|
|
//显示BOM原料数据
|
|
showBomRawMaterial();
|
|
//显示BOM辅料数据
|
|
showBomSubsidiaryMaterial();
|
|
//显示BOM半成品数据
|
|
showBomBcpMaterial();
|
|
} else {
|
|
$.modal.alertWarning("请填写必填项!")
|
|
}
|
|
}
|
|
|
|
//显示BOM原料数据
|
|
function showBomRawMaterial() {
|
|
var finishProductCode = $("#form-workOrderInfo-edit input[name='finishProductCode']").val();
|
|
var versionNumber = $("#form-workOrderInfo-edit input[name='versionNumber']").val();
|
|
var options = {
|
|
id: 'rawMaterialBomTable',
|
|
url: ctx + "system/bomrawmaterial/list",
|
|
modalName: "bom原料",
|
|
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
|
|
cardView: false, // 是否显示详细视图
|
|
detailView: false, // 是否显示父子表
|
|
smartDisplay: false, // 加了这个才显示每页显示的行数
|
|
showExport: false, // 是否显示导出按钮
|
|
clickToSelect: true,
|
|
queryParams: function (params) {
|
|
var curParams = {
|
|
// 传递参数查询参数
|
|
pageSize: params.limit,
|
|
pageNum: params.offset / params.limit + 1,
|
|
finishProductCode: finishProductCode,
|
|
versionNumber: versionNumber
|
|
};
|
|
// let json = $.extend(curParams, $.common.formToJSON("salesFinishFormId"));
|
|
return curParams;
|
|
},
|
|
columns: [{
|
|
checkbox: true
|
|
},
|
|
{
|
|
field: 'rawMaterialId',
|
|
title: '原料id',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'finishProductCode',
|
|
title: '成品代码',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'rawMaterialCode',
|
|
title: '原料代码'
|
|
},
|
|
{
|
|
field: 'rawMaterialName',
|
|
title: '原料名称'
|
|
},
|
|
{
|
|
field: 'specificationModel',
|
|
title: '规格型号'
|
|
},
|
|
{
|
|
field: 'inventoryUnit',
|
|
title: '单位'
|
|
},
|
|
{
|
|
field: 'rawMaterialConsumption',
|
|
title: '用量'
|
|
},
|
|
{
|
|
field: 'rawMaterialLoss',
|
|
title: '损耗%'
|
|
},
|
|
{
|
|
field: 'supplierNumber',
|
|
title: '厂商料号'
|
|
},
|
|
{
|
|
field: 'finishedProductQuantity',
|
|
title: '成品数量'
|
|
},
|
|
{
|
|
field: 'remarks',
|
|
title: '备注说明'
|
|
},
|
|
{
|
|
field: 'processingCategory',
|
|
title: '加工类别'
|
|
}]
|
|
};
|
|
$.table.init(options);
|
|
}
|
|
//显示BOM辅料数据
|
|
function showBomSubsidiaryMaterial() {
|
|
var finishProductCode = $("#form-workOrderInfo-edit input[name='finishProductCode']").val();
|
|
var versionNumber = $("#form-workOrderInfo-edit input[name='versionNumber']").val();
|
|
var options = {
|
|
id: 'subsidiaryMaterialBomTable',
|
|
url: ctx + "system/bomsubsidiarymaterial/list",
|
|
modalName: "bom辅料",
|
|
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
|
|
cardView: false, // 是否显示详细视图
|
|
detailView: false, // 是否显示父子表
|
|
smartDisplay: false, // 加了这个才显示每页显示的行数
|
|
showExport: false, // 是否显示导出按钮
|
|
clickToSelect: true,
|
|
queryParams: function (params) {
|
|
var curParams = {
|
|
// 传递参数查询参数
|
|
pageSize: params.limit,
|
|
pageNum: params.offset / params.limit + 1,
|
|
finishProductCode: finishProductCode,
|
|
versionNumber: versionNumber
|
|
};
|
|
// let json = $.extend(curParams, $.common.formToJSON("salesFinishFormId"));
|
|
return curParams;
|
|
},
|
|
columns: [{
|
|
checkbox: true
|
|
},
|
|
{
|
|
field: 'subsidiaryMaterialId',
|
|
title: 'bom辅料id',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'finishProductCode',
|
|
title: '成品代码',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'subsidiaryMaterialCode',
|
|
title: '辅料代码'
|
|
},
|
|
{
|
|
field: 'subsidiaryMaterialName',
|
|
title: '辅料名称'
|
|
},
|
|
{
|
|
field: 'specificationModel',
|
|
title: '规格型号'
|
|
},
|
|
{
|
|
field: 'inventoryUnit',
|
|
title: '单位'
|
|
},
|
|
{
|
|
field: 'subsidiaryMaterialConsumption',
|
|
title: '用量'
|
|
},
|
|
{
|
|
field: 'subsidiaryMaterialLoss',
|
|
title: '损耗%'
|
|
},
|
|
{
|
|
field: 'supplierNumber',
|
|
title: '厂商料号'
|
|
},
|
|
{
|
|
field: 'finishedProductQuantity',
|
|
title: '成品数量'
|
|
},
|
|
{
|
|
field: 'remarks',
|
|
title: '备注说明'
|
|
},
|
|
{
|
|
field: 'processingCategory',
|
|
title: '加工类别'
|
|
}]
|
|
};
|
|
$.table.init(options);
|
|
}
|
|
//显示BOM半成品数据
|
|
function showBomBcpMaterial() {
|
|
var finishProductCode = $("#form-workOrderInfo-edit input[name='finishProductCode']").val();
|
|
var versionNumber = $("#form-workOrderInfo-edit input[name='versionNumber']").val();
|
|
var options = {
|
|
id: 'bcpMaterialBomTable',
|
|
url: ctx + "system/bomBcp/list",
|
|
modalName: "bom半成品",
|
|
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
|
|
cardView: false, // 是否显示详细视图
|
|
detailView: false, // 是否显示父子表
|
|
smartDisplay: false, // 加了这个才显示每页显示的行数
|
|
showExport: false, // 是否显示导出按钮
|
|
clickToSelect: true,
|
|
queryParams: function (params) {
|
|
var curParams = {
|
|
// 传递参数查询参数
|
|
pageSize: params.limit,
|
|
pageNum: params.offset / params.limit + 1,
|
|
finishProductCode: finishProductCode,
|
|
versionNumber: versionNumber
|
|
};
|
|
// let json = $.extend(curParams, $.common.formToJSON("salesFinishFormId"));
|
|
return curParams;
|
|
},
|
|
columns: [{
|
|
checkbox: true
|
|
},
|
|
{
|
|
field: 'bomBcpId',
|
|
title: 'bom半成品id',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'finishProductCode',
|
|
title: '成品代码',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'versionNumber',
|
|
title: '版本号',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'bcpCode',
|
|
title: '半成品代码'
|
|
},
|
|
{
|
|
field: 'bcpName',
|
|
title: '半成品名称'
|
|
},
|
|
{
|
|
field: 'specificationModel',
|
|
title: '规格型号'
|
|
},
|
|
{
|
|
field: 'inventoryUnit',
|
|
title: '单位',
|
|
formatter: function(value, row, index) {
|
|
return $.table.selectDictLabel(inventoryUnitDatas, value);
|
|
}
|
|
},
|
|
{
|
|
field: 'bcpMaterialConsumption',
|
|
title: '用量'
|
|
},
|
|
{
|
|
field: 'bcpMaterialLoss',
|
|
title: '损耗%'
|
|
},
|
|
{
|
|
field: 'customerNumber',
|
|
title: '厂商料号'
|
|
},
|
|
{
|
|
field: 'finishedProductQuantity',
|
|
title: '成品数量'
|
|
},
|
|
{
|
|
field: 'remarks',
|
|
title: '备注说明'
|
|
},
|
|
{
|
|
field: 'processingCategory',
|
|
title: '加工类别'
|
|
}]
|
|
};
|
|
$.table.init(options);
|
|
}
|
|
|
|
//关闭BOM信息
|
|
function closeBomDetailModal() {
|
|
$("#bomMaterialModal").modal("hide");
|
|
}
|
|
|
|
//添加BOM材料信息
|
|
function addBomDetailToTable() {
|
|
var dataRaw = $("#rawMaterialBomTable").bootstrapTable("getSelections");
|
|
var dataSubsidiary = $("#subsidiaryMaterialBomTable").bootstrapTable("getSelections");
|
|
var dataBcp = $("#bcpMaterialBomTable").bootstrapTable("getSelections");
|
|
var count = $('#addBomMaterialTable').bootstrapTable('getData').length;
|
|
var workOrderNumber = $("input[name='workOrderNumber']").val();
|
|
for (let i = 0; i < dataRaw.length; i++) {
|
|
let material = $('#addBomMaterialTable').bootstrapTable('getRowByUniqueId', dataRaw[i].rawMaterialCode);
|
|
if (material != null) {
|
|
alert(material.materialName + "已存在,不可重复添加!");
|
|
continue;
|
|
}
|
|
$("#addBomMaterialTable").bootstrapTable('insertRow', {
|
|
index: count + i,
|
|
row: {
|
|
workOrderNumber: workOrderNumber,
|
|
materialCode: dataRaw[i].rawMaterialCode,
|
|
materialName: dataRaw[i].rawMaterialName,
|
|
specificationModel: dataRaw[i].specificationModel,
|
|
inventoryUnit: dataRaw[i].inventoryUnit,
|
|
materialType: '原料',
|
|
materialConsumption: dataRaw[i].rawMaterialConsumption,
|
|
itemNumber: dataRaw[i].supplierNumber,
|
|
description: dataRaw[i].remarks
|
|
}
|
|
});
|
|
}
|
|
for (let i = 0; i < dataSubsidiary.length; i++) {
|
|
let material = $('#addBomMaterialTable').bootstrapTable('getRowByUniqueId', dataSubsidiary[i].subsidiaryMaterialCode);
|
|
if (material != null) {
|
|
alert(material.materialName + "已存在,不可重复添加!");
|
|
continue;
|
|
}
|
|
$("#addBomMaterialTable").bootstrapTable('insertRow', {
|
|
index: count + i,
|
|
row: {
|
|
workOrderNumber: workOrderNumber,
|
|
materialCode: dataSubsidiary[i].subsidiaryMaterialCode,
|
|
materialName: dataSubsidiary[i].subsidiaryMaterialName,
|
|
specificationModel: dataSubsidiary[i].specificationModel,
|
|
inventoryUnit: dataSubsidiary[i].inventoryUnit,
|
|
materialType: '辅料',
|
|
materialConsumption: dataSubsidiary[i].subsidiaryMaterialConsumption,
|
|
itemNumber: dataSubsidiary[i].supplierNumber,
|
|
description: dataSubsidiary[i].remarks
|
|
}
|
|
});
|
|
}
|
|
for (let i = 0; i < dataBcp.length; i++) {
|
|
let material = $('#addBomMaterialTable').bootstrapTable('getRowByUniqueId', dataBcp[i].bcpCode);
|
|
if (material != null) {
|
|
alert(material.materialName + "已存在,不可重复添加!");
|
|
continue;
|
|
}
|
|
$("#addBomMaterialTable").bootstrapTable('insertRow', {
|
|
index: count + i,
|
|
row: {
|
|
workOrderNumber: workOrderNumber,
|
|
materialCode: dataBcp[i].bcpCode,
|
|
materialName: dataBcp[i].bcpName,
|
|
specificationModel: dataBcp[i].specificationModel,
|
|
inventoryUnit: dataBcp[i].inventoryUnit,
|
|
materialType: '半成品',
|
|
materialConsumption: dataBcp[i].bcpMaterialConsumption,
|
|
itemNumber: dataBcp[i].customerNumber,
|
|
description: dataBcp[i].remarks
|
|
}
|
|
});
|
|
}
|
|
$("#rawMaterialBomTable").bootstrapTable("uncheckAll");
|
|
$("#subsidiaryMaterialBomTable").bootstrapTable("uncheckAll");
|
|
$("#bcpMaterialBomTable").bootstrapTable("uncheckAll");
|
|
closeBomDetailModal();
|
|
}
|
|
|
|
//确认材料信息
|
|
function confirmMaterial() {
|
|
var data = $("#addBomMaterialTable").bootstrapTable("getData");
|
|
// console.log(data)
|
|
$.ajax({
|
|
url: ctx + 'manufacture/workOrderDetail/addEditSave',
|
|
type: "POST",
|
|
data: {
|
|
data: JSON.stringify(data)
|
|
},
|
|
dataType: "json",
|
|
success: function (resp) {
|
|
// console.log(data)
|
|
console.log(resp)
|
|
},
|
|
|
|
})
|
|
}
|
|
|
|
// 批量删除成品
|
|
function removeMaterial() {
|
|
var addBomMaterialTableData = $("#addBomMaterialTable").bootstrapTable("getSelections");
|
|
var ids = [];
|
|
var materialCodes=[];
|
|
for (let i = 0;i < addBomMaterialTableData.length;i++) {
|
|
ids.push(addBomMaterialTableData[i].workOrderDetailId)
|
|
materialCodes.push(addBomMaterialTableData[i].materialCode)
|
|
}
|
|
// console.log(ids)
|
|
if (addBomMaterialTableData.length > 0) {
|
|
$.modal.confirm("是否确认要删除选中的物料?", function (){
|
|
$.ajax({
|
|
url: ctx + "manufacture/workOrderDetail/removeMaterial",
|
|
type: "POST",
|
|
data: {
|
|
ids: JSON.stringify(ids)
|
|
},
|
|
success: function (res) {
|
|
// console.log(ids)
|
|
// console.log(res)
|
|
$.modal.msgSuccess("删除成功")
|
|
// $("#addProductTable").bootstrapTable('refreshOptions', {pageNumber: 1}); // pageNumber:1, 指定页码为第1页
|
|
// $("#addProductTable").bootstrapTable('refresh');
|
|
$("#addBomMaterialTable").bootstrapTable ('remove', { field: 'materialCode', values: materialCodes })
|
|
}
|
|
})
|
|
})
|
|
|
|
} else {
|
|
alert("请选择需要删除的数据")
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|