Browse Source
生产管理 生产订单 修改工程审核页面,添加审批意见和审批备注表单元素; 修改表格定义,去除编辑bom按钮,修改提交函数,序列化表单信息提交后台; 修改生产订单列表页面表格,新增编辑生产bom按钮及其权限定义; 新增编辑生产bom页面; 修改生产订单实体类,新增工程审核状态和工程审核备注字段; 新增跳转编辑生产bom页面controller接口和编辑保存生产bom接口; 修改部门领导确认service方法,工程部门领导确认后状态改为待编辑生产bom; 修改工程审核service方法,根据页面审核意见不同设置生产状态为待编辑bom和待采购审核; 新增编辑生产bom保存service方法; 修改生产订单mapper相应方法,新增字段;dev
8 changed files with 679 additions and 338 deletions
@ -0,0 +1,505 @@ |
|||||
|
<!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" /> |
||||
|
</head> |
||||
|
<body class="white-bg"> |
||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
||||
|
<form class="form-horizontal m" id="form-makeorder-edit" th:object="${sysMakeOrder}"> |
||||
|
<input name="id" th:field="*{id}" type="hidden"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">生产订单号:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input readonly id="makeNo" name="makeNo" th:field="*{makeNo}" 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 readonly id="saleNo" name="saleNo" th:field="*{saleNo}" 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 readonly name="Salesman" th:field="*{Salesman}" class="form-control" type="text"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label is-required">订单类型:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<select disabled name="orderType" class="form-control" type="text" th:with="dictList=${@dict.getType('sys_order_type')}" required th:field="*{orderType}"> |
||||
|
<option value="">请选择</option> |
||||
|
<option th:each="dict : ${dictList}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option> |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">审批备注:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<textarea name="comment" class="form-control" th:text="*{comment}" readonly></textarea> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-xs-11" style="margin-left: 50px;"> |
||||
|
<div class="form-group-sm"> |
||||
|
<div class="col-sm-12 select-table table-striped"> |
||||
|
<table id="bootstrap-sub-table-1"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</form> |
||||
|
</div> |
||||
|
<th:block th:include="include :: footer" /> |
||||
|
<th:block th:include="include :: datetimepicker-js" /> |
||||
|
<script th:inline="javascript"> |
||||
|
var prefix = ctx + "system/makeorder"; |
||||
|
|
||||
|
var curUser = [[${currentUser}]]; |
||||
|
// var curUsrDeptNumber = curUser.dept.deptNumber; |
||||
|
|
||||
|
// 字典 |
||||
|
var processMethodDatas = [[${@dict.getType('processMethod')}]]; |
||||
|
var sysUnitClassDatas = [[${@dict.getType('sys_unit_class')}]]; |
||||
|
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; |
||||
|
var levelDatas = [[${@dict.getType('bomLevel')}]]; |
||||
|
var processMethodDatas = [[${@dict.getType('processMethod')}]]; |
||||
|
var makeNo = [[${sysMakeOrder.makeNo}]]; |
||||
|
var makeOrderBom = {}; |
||||
|
|
||||
|
// var subTableFormArray = []; |
||||
|
|
||||
|
$(function(){ |
||||
|
sessionStorage.clear(); |
||||
|
var options = { |
||||
|
url: ctx + "system/makeorderbom/selectedList", |
||||
|
id: 'bootstrap-sub-table-1', |
||||
|
showSearch: false, |
||||
|
showRefresh: false, |
||||
|
showToggle: false, |
||||
|
showColumns: false, |
||||
|
uniqueId: "id", |
||||
|
pagination: false, // 设置不分页 |
||||
|
sidePagination: "client", |
||||
|
queryParams: queryParams, |
||||
|
detailView: true, |
||||
|
onExpandRow : function(index, row, $detail) { |
||||
|
initChildTable(index, row, $detail); |
||||
|
}, |
||||
|
/*onCollapseRow: function(index, row){ |
||||
|
var childTableFormId = 'child_table_form_'+index; |
||||
|
var formData = $('#'+childTableFormId).serialize(); |
||||
|
var formObj = $.common.formDataToObj(formData); |
||||
|
subTableFormArray.push(formObj); |
||||
|
},*/ |
||||
|
columns: [ |
||||
|
{ |
||||
|
field: 'id', |
||||
|
title: '主键id', |
||||
|
visible: false |
||||
|
}, |
||||
|
{ |
||||
|
field: 'quoteId', |
||||
|
title: '关联销售订单编号', |
||||
|
visible: false |
||||
|
}, |
||||
|
{ |
||||
|
field: 'bomId', |
||||
|
title: 'bom主键Id', |
||||
|
visible: false |
||||
|
}, |
||||
|
{ |
||||
|
field: 'materialNo', |
||||
|
align: 'center', |
||||
|
title: '料号' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'materialName', |
||||
|
align: 'center', |
||||
|
title: '物料名称', |
||||
|
}, |
||||
|
{ |
||||
|
field: 'materialType', |
||||
|
align: 'center', |
||||
|
title: '物料类型', |
||||
|
formatter: function(value, row, index) { |
||||
|
return $.table.selectCategoryLabel(materialTypeDatas, value); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'unit', |
||||
|
align: 'center', |
||||
|
title: '单位', |
||||
|
formatter: function(value, row, index) { |
||||
|
return $.table.selectDictLabel(sysUnitClassDatas, value); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'brand', |
||||
|
align: 'center', |
||||
|
title: '品牌' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'materialModel', |
||||
|
align: 'center', |
||||
|
title: '型号' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'describe', |
||||
|
align: 'center', |
||||
|
title: '描述' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'processMethod', |
||||
|
align: 'center', |
||||
|
title: '加工方式', |
||||
|
formatter: function(value, row, index) { |
||||
|
return $.table.selectDictLabel(processMethodDatas, value); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'deliveryTime', |
||||
|
align: 'center', |
||||
|
title: '客户期望交付时间' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'orderNum', |
||||
|
align: 'center', |
||||
|
title: '订单数量' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'useStatus', |
||||
|
align: 'center', |
||||
|
title: '使用状态', |
||||
|
visible: false |
||||
|
}, |
||||
|
{ |
||||
|
field: 'auditStatus', |
||||
|
align: 'center', |
||||
|
title: '审核状态', |
||||
|
visible: false |
||||
|
}, |
||||
|
{ |
||||
|
title: '操作', |
||||
|
align: 'center', |
||||
|
formatter: function(value, row, index) { |
||||
|
var actions = []; |
||||
|
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="editMakeOrderBom(\'' + index + '\',\'' +row.materialNo + '\')">编辑生产bom</a> '); |
||||
|
return actions.join(''); |
||||
|
} |
||||
|
}, |
||||
|
] |
||||
|
}; |
||||
|
$.table.init(options); |
||||
|
}) |
||||
|
|
||||
|
initChildTable = function(index, row, $detail) { |
||||
|
var parentRow = row; |
||||
|
var parentRowIndex = index; |
||||
|
var childTableId = 'child_table_'+index; |
||||
|
var childFormTableId = 'child_form_table_'+index; |
||||
|
var childTableFormId = 'child_table_form_'+index; |
||||
|
// $detail.html('<form id="'+childTableFormId+'"><table id="'+childTableId+'"></table><table id="'+childFormTableId+'"></table></form>'); |
||||
|
$detail.html('<table id="'+childTableId+'"></table><table id="'+childFormTableId+'"></table>'); |
||||
|
// BOM展示 |
||||
|
$('#'+childTableId).bootstrapTable({ |
||||
|
url: ctx + "system/makeorderbom/list", |
||||
|
method: 'post', |
||||
|
sidePagination: "server", |
||||
|
contentType: "application/x-www-form-urlencoded", |
||||
|
queryParams : { |
||||
|
salesOrderMaterialNo: parentRow.materialNo, |
||||
|
makeNo: makeNo, |
||||
|
}, |
||||
|
columns: [{ |
||||
|
field: 'id', |
||||
|
title: '主键id', |
||||
|
visible: false |
||||
|
}, |
||||
|
{ |
||||
|
field: 'level', |
||||
|
title: '阶层', |
||||
|
align: 'center', |
||||
|
formatter: function(value, row, index) { |
||||
|
return $.table.selectDictLabel(levelDatas, value); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'bomNo', |
||||
|
align: 'center', |
||||
|
title: 'BOM号', |
||||
|
formatter:function (value,row,index){ |
||||
|
if (value == null || value == ''){ |
||||
|
return '/'; |
||||
|
}else{ |
||||
|
return value |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'materialNo', |
||||
|
align: 'center', |
||||
|
title: '料号', |
||||
|
formatter: function (value,row,index){ |
||||
|
if (value == null || value == ''){ |
||||
|
return '/'; |
||||
|
}else{ |
||||
|
return value |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'photoUrl', |
||||
|
align: 'center', |
||||
|
title: '图片', |
||||
|
formatter: function(value, row, index) { |
||||
|
return $.table.imageView(value); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'materialName', |
||||
|
align: 'center', |
||||
|
title: '物料名称', |
||||
|
formatter: function (value,row,index){ |
||||
|
if (value == null || value == ''){ |
||||
|
return '/'; |
||||
|
}else{ |
||||
|
return value |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'materialType', |
||||
|
align: 'center', |
||||
|
title: '物料类型', |
||||
|
formatter: function(value, row, index) { |
||||
|
return $.table.selectCategoryLabel(materialTypeDatas, value); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'materialModel', |
||||
|
align: 'center', |
||||
|
title: '型号' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'describe', |
||||
|
align: 'center', |
||||
|
title: '描述', |
||||
|
formatter: function (value,row,index){ |
||||
|
if (value == null || value == ''){ |
||||
|
return '/'; |
||||
|
}else{ |
||||
|
return value |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'brand', |
||||
|
align: 'center', |
||||
|
title: '品牌', |
||||
|
formatter: function (value,row,index){ |
||||
|
if (value == null || value == ''){ |
||||
|
return '/'; |
||||
|
}else{ |
||||
|
return value |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'unit', |
||||
|
align: 'center', |
||||
|
title: '单位', |
||||
|
formatter: function (value,row,index){ |
||||
|
if (value == null || value == ''){ |
||||
|
return '/'; |
||||
|
}else{ |
||||
|
return value |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
field: 'processMethod', |
||||
|
align: 'center', |
||||
|
title: '加工方式', |
||||
|
formatter: function(value, row, index) { |
||||
|
return $.table.selectDictLabel(processMethodDatas, value); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'useNum', |
||||
|
align: 'center', |
||||
|
title: '用量', |
||||
|
formatter: function (value,row,index){ |
||||
|
if (value == null || value == ''){ |
||||
|
return '/'; |
||||
|
}else{ |
||||
|
return value |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'lossRate', |
||||
|
align: 'center', |
||||
|
title: '损耗率', |
||||
|
formatter: function (value, row, index) { |
||||
|
if (value == null || value == ''){ |
||||
|
return "0.00%"; |
||||
|
} |
||||
|
value = parseFloat(value).toFixed(2); |
||||
|
return value + "%"; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'materialNum', |
||||
|
align: 'center', |
||||
|
title: '订单用量', |
||||
|
formatter: function (value,row,index){ |
||||
|
return parentRow.orderNum * row.useNum; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'parentId', |
||||
|
title: '父级id', |
||||
|
visible: false, |
||||
|
}, |
||||
|
{ |
||||
|
field: 'sortNo', |
||||
|
title: '排序', |
||||
|
visible: false |
||||
|
}], |
||||
|
// 当所有数据被加载时触发 |
||||
|
onLoadSuccess: function(data) { |
||||
|
var key = "all_level_" + childTableId; |
||||
|
var rowData = sessionStorage.getItem(key); |
||||
|
if(rowData){ |
||||
|
var tableData = JSON.parse(rowData); |
||||
|
$("#"+childTableId).bootstrapTable('load',tableData); |
||||
|
} |
||||
|
}, |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
function queryParams(params) { |
||||
|
var curParams = { |
||||
|
|
||||
|
}; |
||||
|
// 额外传参 |
||||
|
curParams.makeNo = $("#makeNo").val(); |
||||
|
curParams.level = 0; |
||||
|
return curParams; |
||||
|
} |
||||
|
|
||||
|
$("#form-makeorder-edit").validate({ |
||||
|
focusCleanup: true |
||||
|
}); |
||||
|
|
||||
|
function submitHandler() { |
||||
|
// debugger |
||||
|
// var data = $("#form-makeorder-edit").serializeArray(); |
||||
|
var saleNo = $("#saleNo").val(); |
||||
|
var makeNo = $("#makeNo").val(); |
||||
|
let makeOrderBomList = []; |
||||
|
var keyPre = 'all_level_child_table_'; |
||||
|
const length = sessionStorage.length; |
||||
|
|
||||
|
for (let i = 0; i < length; i++) { |
||||
|
const key = sessionStorage.key(i); |
||||
|
if (key.startsWith(keyPre)) { |
||||
|
var rows = sessionStorage.getItem(key); |
||||
|
var rowData = JSON.parse(rows); |
||||
|
rowData.forEach(function (value){ |
||||
|
makeOrderBomList.push(value); |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
var sysMakeOrder = { |
||||
|
makeNo: makeNo, |
||||
|
saleNo: saleNo, |
||||
|
sysMakeorderBomList: makeOrderBomList, |
||||
|
} |
||||
|
$.operate.saveJson(prefix + "/editBom", JSON.stringify(sysMakeOrder)); |
||||
|
} |
||||
|
|
||||
|
function editMakeOrderBom(curIndex,materialNo){ |
||||
|
var url = ctx + "system/makeorderbom/editMakeorderBom?materialNo=" + materialNo+"&curIndex="+curIndex+"&makeNo="+makeNo; |
||||
|
var options = { |
||||
|
title: '编辑生产bom', |
||||
|
url: url, |
||||
|
callBack: handleMakeOrderBomData |
||||
|
}; |
||||
|
$.modal.openOptions(options); |
||||
|
} |
||||
|
|
||||
|
function handleMakeOrderBomData(index, layero){ |
||||
|
var iframeWin = window[layero.find('iframe')[0]['name']]; |
||||
|
iframeWin.$('#materialNo').removeAttr("disabled"); |
||||
|
var materialNo = iframeWin.$('#materialNo').val(); |
||||
|
var curIndex = iframeWin.$('#curIndex').val(); |
||||
|
var saleNo = $("#saleNo").val(); |
||||
|
var makeNo = $("#makeNo").val(); |
||||
|
var tableData = iframeWin.$('#bootstrap-sub-table-1').bootstrapTable('getData'); |
||||
|
|
||||
|
if (tableData.length===0){ |
||||
|
$.modal.alertWarning("请至少添加一条bom信息再保存!"); |
||||
|
return; |
||||
|
} |
||||
|
var bomData = []; |
||||
|
var oneLevelKey = "one_level_child_table_"+curIndex; |
||||
|
var allLevelKey = "all_level_child_table_"+curIndex; |
||||
|
var formData = []; |
||||
|
for(var i=0;i<tableData.length;i++){ |
||||
|
tableData[i].salesOrderMaterialNo = materialNo; |
||||
|
tableData[i].makeNo = makeNo; |
||||
|
tableData[i].salesOrderCode = saleNo; |
||||
|
if(tableData[i].useNum == null || tableData[i].useNum == ''){ |
||||
|
$.modal.alertWarning("子表数据用量不能为空!"); |
||||
|
return; |
||||
|
} |
||||
|
formData.push(tableData[i].materialNo); |
||||
|
} |
||||
|
materialNos = JSON.stringify(formData); |
||||
|
// 创建一个 bomData 对象,用于快速查找 |
||||
|
var bomData = {}; |
||||
|
for (var i = 0; i < formData.length; i++) { |
||||
|
bomData[formData[i]] = tableData[i]; |
||||
|
} |
||||
|
//根据修改页面返回的一阶bom,后台查找所有阶bom,如果bom表中没有,说明该物料未被添加为bom |
||||
|
//则返回一个只有料号数据的一阶bom空对象,页面做对比将后端返回数组中的一阶bom替换成修改页面返回的一阶bom |
||||
|
$.ajax({ |
||||
|
url: ctx + "erp/bom/makeOrderAllList", |
||||
|
cache: false, |
||||
|
data: materialNos, |
||||
|
contentType: "application/json", |
||||
|
processData: false, |
||||
|
type: 'POST', |
||||
|
success: function (result) { |
||||
|
|
||||
|
var rowData = result.rows; |
||||
|
|
||||
|
// 遍历 result 数组,替换匹配的料号 |
||||
|
for (var j = 0; j < rowData.length; j++) { |
||||
|
rowData[j].salesOrderMaterialNo = materialNo; |
||||
|
rowData[j].makeNo = makeNo; |
||||
|
rowData[j].salesOrderCode = saleNo; |
||||
|
|
||||
|
//替换一阶物料 |
||||
|
if (bomData[rowData[j].materialNo] && rowData[j].level == '1') { |
||||
|
rowData[j] = bomData[rowData[j].materialNo]; |
||||
|
} |
||||
|
} |
||||
|
$("#child_table_"+curIndex).bootstrapTable('load',result.rows); |
||||
|
sessionStorage.setItem(allLevelKey,JSON.stringify(result.rows)); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
sessionStorage.setItem(oneLevelKey,JSON.stringify(tableData)); |
||||
|
layer.close(index); |
||||
|
} |
||||
|
|
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
Loading…
Reference in new issue