王晓迪
2 months ago
5 changed files with 80 additions and 655 deletions
@ -1,414 +0,0 @@ |
|||||
<!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-add-outsourcePlan" th:object="${sysMakeOrder}"> |
|
||||
<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 name="orderType" class="form-control" type="text" th:with="dictList=${@dict.getType('sys_order_type')}" th:field="*{orderType}" disabled required> |
|
||||
<option value="">请选择</option> |
|
||||
<option th:each="dict : ${dictList}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option> |
|
||||
</select> |
|
||||
</div> |
|
||||
</div> |
|
||||
<!-- <div class="container">--> |
|
||||
<div class="col-xs-11"> |
|
||||
<div class="col-sm-11 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 childTableIdList = []; |
|
||||
|
|
||||
// 字典 |
|
||||
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 subTableFormArray = []; |
|
||||
|
|
||||
$(function(){ |
|
||||
var options = { |
|
||||
url: ctx + "system/orderChild/list", |
|
||||
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); |
|
||||
}, |
|
||||
columns: [ |
|
||||
{ |
|
||||
field: 'id', |
|
||||
title: '主键id', |
|
||||
visible: false |
|
||||
}, |
|
||||
{ |
|
||||
field: 'quoteId', |
|
||||
title: '关联销售订单编号', |
|
||||
visible: false |
|
||||
}, |
|
||||
{ |
|
||||
field: 'bomId', |
|
||||
title: 'bom主键Id', |
|
||||
visible: false |
|
||||
}, |
|
||||
{ |
|
||||
field: 'materialCode', |
|
||||
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: '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: 'materialNum', |
|
||||
align: 'center', |
|
||||
title: '订单数量' |
|
||||
}, |
|
||||
{ |
|
||||
field: 'finishNum', |
|
||||
align: 'center', |
|
||||
title: '已完成数' |
|
||||
} |
|
||||
] |
|
||||
}; |
|
||||
$.table.init(options); |
|
||||
}) |
|
||||
|
|
||||
initChildTable = function(index, row, $detail) { |
|
||||
var parentRow = row; |
|
||||
var parentRowIndex = index; |
|
||||
var childTableId = 'child_table_'+index; |
|
||||
childTableIdList.push(childTableId); |
|
||||
|
|
||||
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>'); |
|
||||
// BOM展示 |
|
||||
$('#'+childTableId).bootstrapTable({ |
|
||||
url: ctx + "system/makeorderbom/list", |
|
||||
method: 'post', |
|
||||
sidePagination: "server", |
|
||||
contentType: "application/x-www-form-urlencoded", |
|
||||
queryParams : { |
|
||||
makeNo: $("#makeNo").val(), |
|
||||
salesOrderCode: $("#saleNo").val(), |
|
||||
salesOrderMaterialNo: parentRow.materialCode |
|
||||
}, |
|
||||
columns: [{ |
|
||||
field: 'id', |
|
||||
title: '主键id', |
|
||||
visible: false |
|
||||
}, |
|
||||
{ |
|
||||
field: 'level', |
|
||||
title: '阶层', |
|
||||
formatter: function(value, row, index) { |
|
||||
return $.table.selectDictLabel(levelDatas, value); |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
field: 'bomNo', |
|
||||
title: 'BOM号', |
|
||||
formatter:function (value,row,index){ |
|
||||
if (value == null || value == ''){ |
|
||||
return '/'; |
|
||||
}else{ |
|
||||
return value |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
field: 'materialNo', |
|
||||
title: '料号', |
|
||||
formatter: function (value,row,index){ |
|
||||
var curIndex = row.sortNo-1; |
|
||||
return '<input readonly class = "form-control" data-id = "materialNo_'+curIndex+'" name="pickDetails['+curIndex+'].materialNo" value="'+value+'"><input class = "hidden form-control" data-id = "makeorderBomId_'+curIndex+'" name="pickDetails['+curIndex+'].makeorderBomId" value="'+row.id+'">'; |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
field: 'photoUrl', |
|
||||
title: '图片', |
|
||||
formatter: function(value, row, index) { |
|
||||
return $.table.imageView(value); |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
field: 'materialName', |
|
||||
title: '物料名称', |
|
||||
formatter: function (value,row,index){ |
|
||||
if (value == null || value == ''){ |
|
||||
return '/'; |
|
||||
}else{ |
|
||||
return value |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
field: 'materialType', |
|
||||
title: '物料类型', |
|
||||
formatter: function(value, row, index) { |
|
||||
return $.table.selectCategoryLabel(materialTypeDatas, value); |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
field: 'describe', |
|
||||
title: '描述', |
|
||||
formatter: function (value,row,index){ |
|
||||
if (value == null || value == ''){ |
|
||||
return '/'; |
|
||||
}else{ |
|
||||
return value |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
field: 'brand', |
|
||||
title: '品牌', |
|
||||
formatter: function (value,row,index){ |
|
||||
if (value == null || value == ''){ |
|
||||
return '/'; |
|
||||
}else{ |
|
||||
return value |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
field: 'unit', |
|
||||
title: '单位', |
|
||||
formatter: function (value,row,index){ |
|
||||
if (value == null || value == ''){ |
|
||||
return '/'; |
|
||||
}else{ |
|
||||
return value |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
field: 'processMethod', |
|
||||
title: '加工方式', |
|
||||
align: 'center', |
|
||||
formatter: function(value, row, index) { |
|
||||
var label = $.table.selectDictLabel(processMethodDatas, value); |
|
||||
if (value === '2') { |
|
||||
var button = '<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.modal.open(\'委外工序\',\'' + prefix+"/showProcesses/"+row.materialNo + '\')">委外工序(' + row.processNum + ')</a>'; |
|
||||
return label + ' ' + button; |
|
||||
} else { |
|
||||
return label; |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
field: 'useNum', |
|
||||
title: '用量', |
|
||||
formatter: function (value,row,index){ |
|
||||
if (value == null || value == ''){ |
|
||||
return '/'; |
|
||||
}else{ |
|
||||
return value |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
field: 'lossRate', |
|
||||
title: '损耗率', |
|
||||
}, |
|
||||
{ |
|
||||
field: 'processNum', |
|
||||
title: '委外工序数', |
|
||||
visible: false, |
|
||||
}, |
|
||||
{ |
|
||||
field: 'materialNum', |
|
||||
title: '订单用量', |
|
||||
formatter: function (value,row,index){ |
|
||||
return parentRow.materialNum * row.useNum; |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
field: 'hasOutNum', |
|
||||
title: '已委外数量', |
|
||||
}, |
|
||||
{ |
|
||||
field: 'outsourceNum', |
|
||||
title: '本次委外数量', |
|
||||
formatter: function (value,row,index){ |
|
||||
var processMethod = row.processMethod; |
|
||||
if(processMethod === "2"){ |
|
||||
var curIndex = row.sortNo-1; |
|
||||
return '<input class = "form-control" data-id = "pickNum_'+curIndex+'" name="outsourceNum_'+curIndex+'">'; |
|
||||
} |
|
||||
return " "; |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
field: 'makeNo', |
|
||||
title: '生产订单号', |
|
||||
visible: false, |
|
||||
}, |
|
||||
{ |
|
||||
field: 'salesOrderCode', |
|
||||
title: '销售订单号', |
|
||||
visible: false, |
|
||||
}, |
|
||||
{ |
|
||||
field: 'salesOrderMaterialNo', |
|
||||
title: '销售订单料号', |
|
||||
visible: false, |
|
||||
}, |
|
||||
{ |
|
||||
field: 'sortNo', |
|
||||
title: '排序', |
|
||||
visible: false |
|
||||
}], |
|
||||
// 当所有数据被加载时触发 |
|
||||
onLoadSuccess: function(data) { |
|
||||
|
|
||||
}, |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
function queryParams(params) { |
|
||||
var curParams = { |
|
||||
// 传递参数查询参数 |
|
||||
// pageSize: params.limit, |
|
||||
// pageNum: params.offset / params.limit + 1, |
|
||||
// searchValue: params.search, |
|
||||
// orderByColumn: params.sort, |
|
||||
// isAsc: params.order |
|
||||
}; |
|
||||
// 额外传参 |
|
||||
curParams.quoteId = $("#saleNo").val(); |
|
||||
return curParams; |
|
||||
} |
|
||||
|
|
||||
$("#form-makeorder-add-outsourcePlan").validate({ |
|
||||
focusCleanup: true |
|
||||
}); |
|
||||
|
|
||||
function submitHandler() { |
|
||||
var makeNo = $("#makeNo").val(); |
|
||||
var sales = $("input[name='Salesman']").val(); |
|
||||
var outsourcePlan = { |
|
||||
associateOrderNo: makeNo, |
|
||||
outsourcePlanDetailList: [], |
|
||||
applicant: sales, |
|
||||
} |
|
||||
var hasValue = false; |
|
||||
childTableIdList.forEach(function (tableId,index){ |
|
||||
var processDatas = $("#" + tableId).bootstrapTable('getData'); |
|
||||
processDatas.forEach(function (data,i){ |
|
||||
if(data.processNum != 0 && data.processMethod === "2"){ |
|
||||
var outNum = $('#' + tableId ).find('input[name="outsourceNum_'+i+'"]').val(); |
|
||||
if(outNum === null||outNum === ""){ |
|
||||
return; |
|
||||
} |
|
||||
hasValue = true; |
|
||||
var process ={ |
|
||||
materialNo: data.materialNo, |
|
||||
materialName: data.materialName, |
|
||||
materialType: data.materialType, |
|
||||
materialPhotourl: data.photoUrl, |
|
||||
description: data.describe, |
|
||||
brand: data.brand, |
|
||||
processMethod: data.processMethod, |
|
||||
unit: data.unit, |
|
||||
} |
|
||||
process.plannedOutsourceAmount = outNum; |
|
||||
outsourcePlan.outsourcePlanDetailList.push(process); |
|
||||
} |
|
||||
}) |
|
||||
}) |
|
||||
// console.log(outsourcePlan); |
|
||||
if(hasValue){ |
|
||||
$.operate.saveJson(ctx + "system/makeorder/addOutsourcePlan", JSON.stringify(outsourcePlan)); |
|
||||
}else{ |
|
||||
$.modal.alertError("请至少添加一条有效的委外信息!"); |
|
||||
} |
|
||||
} |
|
||||
</script> |
|
||||
</body> |
|
||||
</html> |
|
@ -1,52 +0,0 @@ |
|||||
<!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('委外工序列表')" /> |
|
||||
</head> |
|
||||
<body class="gray-bg"> |
|
||||
<div class="container-div"> |
|
||||
<div class="row"> |
|
||||
<div class="col-sm-12 select-table table-striped"> |
|
||||
<table id="bootstrap-select-table"></table> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<th:block th:include="include :: footer" /> |
|
||||
<script th:inline="javascript"> |
|
||||
$(function() { |
|
||||
var options = { |
|
||||
id: "bootstrap-select-table", |
|
||||
modalName: "委外工序", |
|
||||
pagination: false, |
|
||||
showSearch: false, |
|
||||
showRefresh: false, |
|
||||
showToggle: false, |
|
||||
showColumns: false, |
|
||||
data: [[${materials}]], |
|
||||
columns: [ |
|
||||
{ |
|
||||
field: 'outsourceProcessId', |
|
||||
title: '委外工序主键', |
|
||||
visible: false |
|
||||
}, |
|
||||
{ |
|
||||
field: 'outsourceProcessNo', |
|
||||
title: '委外工序编号' |
|
||||
}, |
|
||||
{ |
|
||||
field: 'outsourceProcessName', |
|
||||
title: '委外工序名称' |
|
||||
}, |
|
||||
{ |
|
||||
field: 'remark', |
|
||||
title: '备注' |
|
||||
}, |
|
||||
] |
|
||||
}; |
|
||||
$.table.init(options); |
|
||||
}); |
|
||||
|
|
||||
</script> |
|
||||
</body> |
|
||||
</html> |
|
Loading…
Reference in new issue