Browse Source

[update]:生产订单-部门主管确认

dev
youjianchi 5 months ago
parent
commit
ea4c69bbba
  1. 3
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java
  2. 4
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeorderDeptService.java
  3. 12
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderDeptServiceImpl.java
  4. 11
      ruoyi-admin/src/main/resources/templates/system/makeorder/bmps.html
  5. 515
      ruoyi-admin/src/main/resources/templates/system/makeorder/bmzgqr.html

3
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java

@ -72,6 +72,7 @@ public class SysMakeOrderController extends BaseController
@GetMapping("/bmzgqr/{id}") @GetMapping("/bmzgqr/{id}")
public String bmzgqr(@PathVariable("id") Long id, ModelMap mmap) public String bmzgqr(@PathVariable("id") Long id, ModelMap mmap)
{ {
mmap.put("currentUser", ShiroUtils.getSysUser());
SysMakeOrder sysMakeOrder = sysMakeOrderService.selectSysMakeOrderById(id); SysMakeOrder sysMakeOrder = sysMakeOrderService.selectSysMakeOrderById(id);
mmap.put("sysMakeOrder", sysMakeOrder); mmap.put("sysMakeOrder", sysMakeOrder);
return prefix + "/bmzgqr"; return prefix + "/bmzgqr";
@ -117,7 +118,7 @@ public class SysMakeOrderController extends BaseController
if(CollectionUtil.isEmpty(makeorderDeptList)){ if(CollectionUtil.isEmpty(makeorderDeptList)){
AjaxResult.error("部门主管确认数据不能为空!"); AjaxResult.error("部门主管确认数据不能为空!");
} }
makeorderDeptService.deptReview(makeorderDeptDto); makeorderDeptService.deptLeaderConfirm(makeorderDeptDto);
return AjaxResult.success("部门评审成功!"); return AjaxResult.success("部门评审成功!");
} }

4
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeorderDeptService.java

@ -87,9 +87,9 @@ public interface ISysMakeorderDeptService
/** /**
* 部门主管确认 * 部门主管确认
* @param makeorderDeptList * @param makeorderDeptDto
*/ */
void deptLeaderConfirm(List<SysMakeorderDept> makeorderDeptList); void deptLeaderConfirm(SysMakeorderDeptDto makeorderDeptDto);
/** /**
* 根据生产订单号料号生成预审数据 * 根据生产订单号料号生成预审数据

12
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderDeptServiceImpl.java

@ -5,6 +5,7 @@ import java.util.List;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysMakeOrder; import com.ruoyi.system.domain.SysMakeOrder;
import com.ruoyi.system.dto.SysMakeorderDeptDto; import com.ruoyi.system.dto.SysMakeorderDeptDto;
import com.ruoyi.system.service.ISysMakeOrderService; import com.ruoyi.system.service.ISysMakeOrderService;
@ -173,9 +174,9 @@ public class SysMakeorderDeptServiceImpl implements ISysMakeorderDeptService
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void deptLeaderConfirm(List<SysMakeorderDept> makeorderDeptList) { public void deptLeaderConfirm(SysMakeorderDeptDto makeorderDeptDto) {
SysMakeorderDept makeorderDept = makeorderDeptList.get(0); String makeNo = makeorderDeptDto.getMakeNo();
String makeNo = makeorderDept.getMakeNo(); List<SysMakeorderDept> makeorderDeptList = makeorderDeptDto.getOrderDepts();
String deptNumber = ShiroUtils.getSysUser().getDept().getDeptNumber(); String deptNumber = ShiroUtils.getSysUser().getDept().getDeptNumber();
// 工程部门领导确认完,生产状态更新为待工程审核 // 工程部门领导确认完,生产状态更新为待工程审核
if("END".equals(deptNumber)){ if("END".equals(deptNumber)){
@ -186,7 +187,10 @@ public class SysMakeorderDeptServiceImpl implements ISysMakeorderDeptService
makeOrderService.updateByMakeNo(makeOrder); makeOrderService.updateByMakeNo(makeOrder);
} }
makeorderDeptList.forEach(dept->{ makeorderDeptList.forEach(dept->{
sysMakeorderDeptMapper.updateSysMakeorderDept(dept); String deptLeaderConfirmStatus = dept.getDeptLeaderConfirmStatus();
if(StringUtils.isNotBlank(deptLeaderConfirmStatus)){
sysMakeorderDeptMapper.updateSysMakeorderDept(dept);
}
}); });
} }

11
ruoyi-admin/src/main/resources/templates/system/makeorder/bmps.html

@ -11,25 +11,25 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">生产订单号:</label> <label class="col-sm-3 control-label">生产订单号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="makeNo" th:field="*{makeNo}" class="form-control" type="text"> <input readonly name="makeNo" th:field="*{makeNo}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">关联销售订单号:</label> <label class="col-sm-3 control-label">关联销售订单号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="saleNo" name="saleNo" th:field="*{saleNo}" class="form-control" type="text"> <input readonly id="saleNo" name="saleNo" th:field="*{saleNo}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">业务员:</label> <label class="col-sm-3 control-label">业务员:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="Salesman" th:field="*{Salesman}" class="form-control" type="text"> <input readonly name="Salesman" th:field="*{Salesman}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">订单类型:</label> <label class="col-sm-3 control-label is-required">订单类型:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="salesOrderType" class="form-control" type="text" th:with="dictList=${@dict.getType('sys_order_type')}" required> <select disabled name="salesOrderType" class="form-control" type="text" th:with="dictList=${@dict.getType('sys_order_type')}" required>
<option value="">请选择</option> <option value="">请选择</option>
<option th:each="dict : ${dictList}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option> <option th:each="dict : ${dictList}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
</select> </select>
@ -380,7 +380,7 @@
value = subTableFormArray[parentRowIndex].deptName?subTableFormArray[parentRowIndex].deptName:value; value = subTableFormArray[parentRowIndex].deptName?subTableFormArray[parentRowIndex].deptName:value;
}*/ }*/
var curIndex = parentRowIndex*5+index; var curIndex = parentRowIndex*5+index;
return '<input class = "form-control" data-id = "deptName_'+curIndex+'" name="orderDepts['+curIndex+'].deptName" value="'+row.deptName+'"><input class = "form-control hidden" data-id = "deptNumber_'+curIndex+'" name="orderDepts['+curIndex+'].deptNumber" value="'+value+'">'; return '<input readonly class = "form-control" data-id = "deptName_'+curIndex+'" name="orderDepts['+curIndex+'].deptName" value="'+row.deptName+'"><input class = "form-control hidden" data-id = "deptNumber_'+curIndex+'" name="orderDepts['+curIndex+'].deptNumber" value="'+value+'">';
} }
}, },
{ {
@ -488,7 +488,6 @@
function submitHandler() { function submitHandler() {
debugger debugger
var data = $("#form-makeorder-edit").serializeArray(); var data = $("#form-makeorder-edit").serializeArray();
alert(JSON.stringify(data));
// saveModal 保存不关闭 // saveModal 保存不关闭
$.operate.save(prefix + "/deptReview", data); $.operate.save(prefix + "/deptReview", data);
// var data = $('#bootstrap-sub-table-1').bootstrapTable('getData'); // var data = $('#bootstrap-sub-table-1').bootstrapTable('getData');

515
ruoyi-admin/src/main/resources/templates/system/makeorder/bmzgqr.html

@ -0,0 +1,515 @@
<!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 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="salesOrderType" class="form-control" type="text" th:with="dictList=${@dict.getType('sys_order_type')}" required>
<option value="">请选择</option>
<option th:each="dict : ${dictList}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
</select>
</div>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-sub-table-1"></table>
</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 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);
},
/*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: '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: '订单数量'
}
]
};
$.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 + "erp/bom/allLevelList",
method: 'post',
sidePagination: "server",
contentType: "application/x-www-form-urlencoded",
queryParams : {
parentId: parentRow.bomId
},
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){
if (value == null || value == ''){
return '/';
}else{
return value
}
}
},
{
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: '加工方式',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
field: 'useNum',
title: '用量',
formatter: function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value
}
}
},
{
field: 'lossRate',
title: '损耗率',
formatter: function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value + "%";
}
}
},
{
field: 'materialNum',
title: '订单用量',
formatter: function (value,row,index){
return parentRow.materialNum * row.useNum;
}
},
{
field: 'parentId',
title: '父级id',
visible: false,
},
{
field: 'sortNo',
title: '排序',
visible: false
}],
// 当所有数据被加载时触发
onLoadSuccess: function(data) {
},
});
// 预审部门展示
$('#'+childFormTableId).bootstrapTable({
url: ctx + "system/makeorderdept/list",
method: 'post',
sidePagination: "server",
contentType: "application/x-www-form-urlencoded",
queryParams : {
makeNo: $("#makeNo").val(),
materialNo: parentRow.materialCode
},
columns: [
{
field : 'id',
title : '生产订单部门ID',
formatter: function (value, row, index) {
var curIndex = parentRowIndex*5+index;
return '<input readonly class = "form-control" data-id = "id_'+curIndex+'" name="orderDepts['+curIndex+'].id" value="'+value+'"></input>';
}
},
{
field : 'makeNo',
title : '生产订单号',
visible: false,
formatter: function (value, row, index) {
var curIndex = parentRowIndex*5+index;
return '<input class = "form-control" data-id = "id_'+curIndex+'" name="orderDepts['+curIndex+'].makeNo" value="'+value+'">';
}
},
{
field : 'materialNo',
title : '料号',
visible: false,
formatter: function (value, row, index) {
var curIndex = parentRowIndex*5+index;
return '<input class = "form-control" data-id = "id_'+curIndex+'" name="orderDepts['+curIndex+'].materialNo" value="'+value+'">';
}
},
{
field : 'deptName',
title : '部门名称',
visible: false
},
{
field : 'planFinishDays',
title : '计划完成天数',
visible: false
},
{
field : 'actualFinishStartTime',
title : '实际完成开始时间',
visible: false
},
{
field : 'actualFinishEndTime',
title : '实际完成结束时间',
visible: false
},
{
field : 'deptNumber',
title : '部门',
formatter: function (value, row, index) {
/*if(subTableFormArray[parentRowIndex]){
value = subTableFormArray[parentRowIndex].deptName?subTableFormArray[parentRowIndex].deptName:value;
}*/
var curIndex = parentRowIndex*5+index;
return '<input readonly class = "form-control" data-id = "deptName_'+curIndex+'" name="orderDepts['+curIndex+'].deptName" value="'+row.deptName+'"><input class = "form-control hidden" data-id = "deptNumber_'+curIndex+'" name="orderDepts['+curIndex+'].deptNumber" value="'+value+'">';
}
},
{
field: 'planFinishDate',
title: '计划完成时间',
formatter: function(value, row, index) {
var curIndex = parentRowIndex*5+index;
var endDateName = 'planFinishEndDate_'+parentRowIndex;
var startDateName = 'planFinishStartDate_'+parentRowIndex;
var html;
// 业务部门
if(row.deptNumber=='GMD'){
html = '<div class="input-daterange input-group">' +
'<input disabled type="text" class="form-control" data-id="'+startDateName+'" name ="orderDepts['+curIndex+'].planFinishStartDate" placeholder="开始时间" value="'+row.planFinishStartDate+'"/>\n' +
'<span class="input-group-addon">-</span>\n' +
'<input disabled type="text" class="form-control" data-id="'+endDateName+'" name="orderDepts['+curIndex+'].planFinishEndDate" placeholder="结束时间" value="'+row.planFinishEndDate+'"/></div>'
}else{
html = '<input disabled class = "form-control" data-id = "planFinishDays_'+curIndex+'" name="orderDepts['+curIndex+'].planFinishDays" value="'+row.planFinishDays+'">';
}
return html;
}
},
{
field : 'deptLeaderConfirmStatus',
title : '部门主管确认',
formatter: function(value, row, index) {
var curIndex = parentRowIndex*5+index;
var disabledFlag = row.deptNumber == curUsrDeptNumber;
var html = '<select '+(disabledFlag?'':"disabled")+' class="form-control" name="orderDepts['+curIndex+'].deptLeaderConfirmStatus">' +
'<option value="0" '+(value=='0'?'selected':"")+'>待确认</option>' +
'<option value="1" '+(value=='1'?'selected':"")+'>已确认</option>' +
'</select>';
return html;
}
},
{
field: 'actualFinishTime',
title: '实际完成时间',
formatter: function(value, row, index) {
if (row.actualFinishStartTime == null || row.actualFinishStartTime == ''){
return '';
}else if(row.actualFinishStartTime){
return row.actualFinishStartTime
}else if(row.actualFinishStartTime && row.actualFinishEndTime){
return row.actualFinishStartTime + '-' + row.actualFinishEndTime
}
}
}
],
// 当所有数据被加载时触发
onLoadSuccess: function(data) {
for (let i = 0; i < data.rows.length; i++) {
var curIndex = parentRowIndex*5+i;
var startDateIndex = 'planFinishStartDate_'+i;
var endDateIndex = 'planFinishEndDate_'+i;
$('[data-id="'+startDateIndex+'"]').datetimepicker({
format: 'yyyy-mm-dd',
minView: "month",
todayBtn: true,
autoclose: true,
}).on('changeDate', function(event) {
event.preventDefault();
event.stopPropagation();
var startTime = event.date;
$('[data-id="'+endDateIndex+'"]').datetimepicker('setStartDate', startTime);
});
$('[data-id="'+endDateIndex+'"]').datetimepicker({
format: 'yyyy-mm-dd',
minView: "month",
todayBtn: true,
autoclose: true,
}).on('changeDate', function(event) {
event.preventDefault();
event.stopPropagation();
var endTime = event.date;
$('[data-id="'+startDateIndex+'"]').datetimepicker('setEndDate', endTime);
});
}
},
});
};
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-edit").validate({
focusCleanup: true
});
function submitHandler() {
debugger
var data = $("#form-makeorder-edit").serializeArray();
alert(JSON.stringify(data));
// saveModal 保存不关闭
$.operate.save(prefix + "/deptLeaderConfirm", data);
// var data = $('#bootstrap-sub-table-1').bootstrapTable('getData');
// var count = data.length;
// var allFormData;
// for (let i = 0; i < count; i++) {
// var childTableFormId = 'child_table_form_'+i;
// if($("#"+childTableFormId).length>0){
// if(i==0){
// allFormData = $("#"+childTableFormId).serialize();
// }else{
// allFormData = allFormData +'&'+ $("#"+childTableFormId).serialize();
// }
// }
// }
// $.operate.save(prefix + "/deptReview", allFormData);
}
</script>
</body>
</html>
Loading…
Cancel
Save