计划工序优化 1.13

zhc4dev
zhc077 2 years ago
parent d6ee9fd584
commit 0324560fc1
  1. 107
      ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessDataList.vue
  2. 147
      ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessList.vue
  3. 24
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyPlanProcessController.java
  4. 18
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcess.java
  5. 5
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/vo/ProcessDataVo.java
  6. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyPlanProcessService.java
  7. 86
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java

@ -1,10 +1,10 @@
<template> <template>
<a-card :bordered="false"> <a-card :bordered="false">
<div class="table-operator"> <!-- <div class="table-operator">-->
<a-button type="primary" icon="download" @click="handleExportXls('计划工序')">导出</a-button> <!-- <a-button type="primary" icon="download" @click="handleExportXls('计划工序')">导出</a-button>-->
<!-- <a-button type="primary" @click="handleTableSave($event)">保存</a-button>--> <!-- &lt;!&ndash; <a-button type="primary" @click="handleTableSave($event)">保存</a-button>&ndash;&gt;-->
<a-button type="primary" @click="fanHui()">返回</a-button> <!-- <a-button type="primary" @click="fanHui()">返回</a-button>-->
</div> <!-- </div>-->
<!-- table区域-begin --> <!-- table区域-begin -->
<div> <div>
@ -23,7 +23,18 @@
:dataSource="dataSource" :dataSource="dataSource"
@valueChange="handleValueChange" @valueChange="handleValueChange"
@save="handleTableSave" @save="handleTableSave"
/> >
<template v-slot:toolbarSuffix>
<a-button type="primary" icon="download" @click="handleExportXls('计划工序')">导出</a-button>
<a-button type="primary" icon="rollback" @click="fanHui()">返回</a-button>
<!-- <a-tooltip placement="top" title="获取值,忽略表单验证" :autoAdjustOverflow="true">-->
<!-- <a-button @click="handleTableGet">获取值</a-button>-->
<!-- </a-tooltip>-->
<!-- <a-tooltip placement="top" title="模拟加载1000条数据" :autoAdjustOverflow="true">-->
<!-- <a-button @click="handleTableSet">设置值</a-button>-->
<!-- </a-tooltip>-->
</template>
</j-vxe-table>
</div> </div>
</a-card> </a-card>
</template> </template>
@ -44,7 +55,7 @@ export default {
return { return {
toolbarConfig: { toolbarConfig: {
// add remove clearSelection // add remove clearSelection
btn: ['save'] btn: ['save',]
}, },
description: '生产计划工序管理页面', description: '生产计划工序管理页面',
loading: false, loading: false,
@ -65,13 +76,20 @@ export default {
dataSource: [], dataSource: [],
// columns, // columns,
columns: [ columns: [
{key: 'workOrderId', title: '工单编号', width: '180px'}, {key: 'workOrderId', title: '工单编号', width: '200px'},
{key: 'productName', title: '产品名称', width: '180px'}, // {key: 'productName', title: '', width: '120px'},
{key: 'departName', title: '车间名称', width: '180px'}, {key: 'departName', title: '车间名称', width: '120px'},
{key: 'processName', title: '工序名称', width: '180px'}, {key: 'processName', title: '工序名称', width: '120px'},
{ {
title: '工位列表', title: '工位ID',
key: 'stationId', key: 'stationId',
type: JVXETypes.hidden,
// width: '200px',
// options: [],
// placeholder: '${title}',
},{
title: '工位名称',
key: 'stationName',
type: JVXETypes.select, type: JVXETypes.select,
width: '200px', width: '200px',
options: [], options: [],
@ -92,42 +110,31 @@ export default {
options: [], options: [],
placeholder: '请选择${title}', placeholder: '请选择${title}',
}, },
// { {key: 'proProcess', type: JVXETypes.hidden, title: '前导工序ID', width: '120px'},
// title: 'JPopup',
// key: 'popup',
// type: JVXETypes.popup,
// width: '180px',
// popupCode: 'demo',
// field: 'name,sex,age',
// orgFields: 'name,sex,age',
// destFields: 'popup,popup_sex,popup_age'
// },
{ {
title: '前导工序', title: '前导工序',
key: 'proProcess', key: 'proProcessName',
type: JVXETypes.popup, type: JVXETypes.popup,
width: '180px', width: '180px',
popupCode: 'zy_process', popupCode: 'zy_process',
field: 'id,process_code,process_name,process_describe', field: 'id,process_code,process_name,process_describe',
orgFields: 'id,process_code,process_name,process_describe', // orgFields: 'id,process_code,process_name,process_describe',
destFields: 'proProcess,process_code,process_name,process_describe', // destFields: 'proProcessName,process_code,process_name,process_describe',
orgFields: 'process_name,id',
destFields: 'proProcessName,proProcess',
}, },
// { {key: 'postProcess', type: JVXETypes.hidden, title: '后导工序ID', width: '120px'},
// key: 'proProcess',
// title: '',
// dictCode: 'zy_process,process_name,id,id in(select process_id from zy_product_process where product_id="1")',
// width: '150',
// type: JVXETypes.select
// },
{ {
title: '后导工序', title: '后导工序',
key: 'postProcess', key: 'postProcessName',
type: JVXETypes.popup, type: JVXETypes.popup,
width: '180px', width: '180px',
popupCode: 'zy_process', popupCode: 'zy_process',
field: 'id,process_code,process_name,process_describe', field: 'id,process_code,process_name,process_describe',
orgFields: 'id,process_code,process_name,process_describe', // orgFields: 'id,process_code,process_name,process_describe',
destFields: 'postProcess,process_code,process_name,process_describe', // destFields: 'proProcessName,process_code,process_name,process_describe',
orgFields: 'process_name,id',
destFields: 'postProcessName,postProcess',
}, },
{key: 'inputProduct', title: '输入产品', width: '150', type: JVXETypes.input}, {key: 'inputProduct', title: '输入产品', width: '150', type: JVXETypes.input},
{key: 'semiProduct', title: '成品/半成品', width: '150', type: JVXETypes.input}, {key: 'semiProduct', title: '成品/半成品', width: '150', type: JVXETypes.input},
@ -142,7 +149,8 @@ export default {
planId: "", planId: "",
dictOptions: {}, dictOptions: {},
superFieldList: [], superFieldList: [],
stationList: [], stationId: [],
stationIdList: [],
toolsList: [], toolsList: [],
machineList: [], machineList: [],
clickTrue: true, clickTrue: true,
@ -154,23 +162,17 @@ export default {
// //
handleTableSave({$table, target}) { handleTableSave({$table, target}) {
console.log("保存开始-----") console.log("生产计划工序保存开始-----------------")
// //
$table.validate().then((errMap) => { $table.validate().then((errMap) => {
// //
if (!errMap) { if (!errMap) {
// //
let tableData = target.getTableData() let tableData = target.getTableData()
tableData.forEach(item => { // tableData.forEach(item => {
item.id = ''; // item.id = '';
}) // })
console.log('当前保存的数据是:', tableData) console.log('当前保存的数据是:', tableData)
// //
// let newData = target.getNewData()
// console.log('-- ', newData)
// //
// let deleteData = target.getDeleteData()
// console.log('-- ', deleteData)
// //
this.loading = true this.loading = true
@ -219,7 +221,8 @@ export default {
getAction(this.url.list, params).then((res) => { getAction(this.url.list, params).then((res) => {
if (res.success) { if (res.success) {
this.dataSource = res.result.records || res.result; this.dataSource = res.result.records || res.result;
this.stationList = this.dataSource[0].stationList; // this.stationId = this.dataSource[0].stationId;
this.stationIdList = this.dataSource[0].stationIdList;
} else { } else {
// this.stationIdCode = "station,station_name,id,depart_id in (select workshop_id from zy_product_plan where id='" + this.planId + "')"; // this.stationIdCode = "station,station_name,id,depart_id in (select workshop_id from zy_product_plan where id='" + this.planId + "')";
this.$message.warning(res.message) this.$message.warning(res.message)
@ -248,15 +251,9 @@ export default {
console.log("handleSelectRowChange") console.log("handleSelectRowChange")
console.log("handleSelectRowChange-event:", event) console.log("handleSelectRowChange-event:", event)
const {type, row, column, value, target, $table} = event const {type, row, column, value, target, $table} = event
console.log(JSON.stringify(this.stationList)); console.log(JSON.stringify(this.stationIdList));
// target.$refs.vxe.columns[6].dictCode = this.stationIdCode; // target.$refs.vxe.columns[6].dictCode = this.stationIdCode;
target.$refs.vxe.columns[6].options = this.stationList; target.$refs.vxe.columns[6].options = this.stationIdList;
//
// target.setValues([{
// rowKey: row.id,
// values: {machineIds: '', toolsIds: ''}
// }])
// target.$refs.vxe.columns[4].options = []
}, },
/** 当选项被改变时,联动其他组件 */ /** 当选项被改变时,联动其他组件 */
handleValueChange(event) { handleValueChange(event) {

@ -63,41 +63,41 @@
<!-- <a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{ text }}</a>--> <!-- <a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{ text }}</a>-->
<!-- </a-popover>--> <!-- </a-popover>-->
<!-- </span>--> <!-- </span>-->
<span slot="stationId_dictText" slot-scope="text, record"> <!-- <span slot="stationId_dictText" slot-scope="text, record">-->
<a-popover> <!-- <a-popover>-->
<template slot="content"> <!-- <template slot="content">-->
<p>{{ text }}</p> <!-- <p>{{ text }}</p>-->
</template> <!-- </template>-->
<a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{ text }}</a> <!-- <a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{ text }}</a>-->
</a-popover> <!-- </a-popover>-->
</span> <!-- </span>-->
<span slot="toolsIds_dictText" slot-scope="text, record"> <!-- <span slot="toolsIds_dictText" slot-scope="text, record">-->
<a-popover> <!-- <a-popover>-->
<template slot="content"> <!-- <template slot="content">-->
<p>{{ text }}</p> <!-- <p>{{ text }}</p>-->
</template> <!-- </template>-->
<a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{ text }}</a> <!-- <a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{ text }}</a>-->
</a-popover> <!-- </a-popover>-->
</span> <!-- </span>-->
<span slot="machineIds_dictText" slot-scope="text, record"> <!-- <span slot="machineIds_dictText" slot-scope="text, record">-->
<a-popover> <!-- <a-popover>-->
<template slot="content"> <!-- <template slot="content">-->
<p>{{ text }}</p> <!-- <p>{{ text }}</p>-->
</template> <!-- </template>-->
<a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{ text }}</a> <!-- <a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{ text }}</a>-->
</a-popover> <!-- </a-popover>-->
</span> <!-- </span>-->
<span slot="userIds" slot-scope="text, record"> <!-- <span slot="userIds" slot-scope="text, record">-->
<a-popover> <!-- <a-popover>-->
<template slot="content"> <!-- <template slot="content">-->
<p>{{ text }}</p> <!-- <p>{{ text }}</p>-->
</template> <!-- </template>-->
<a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{ text }}</a> <!-- <a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{ text }}</a>-->
</a-popover> <!-- </a-popover>-->
</span> <!-- </span>-->
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
@ -143,59 +143,14 @@ export default {
} }
}, },
{ {
title: '生产计划', title: '工单编号',
align: "center",
dataIndex: 'planId'
},
{
title: '工序',
align: "center",
dataIndex: 'processId_dictText',
// scopedSlots: {customRender: 'processId_dictText'}
},
{
title: '工位',
align: "center",
dataIndex: 'stationId_dictText',
scopedSlots: {customRender: 'stationId_dictText'}
},
{
title: '设备',
align: "center",
dataIndex: 'machineIds_dictText',
scopedSlots: {customRender: 'machineIds_dictText'}
},
{
title: '工具',
align: "center",
dataIndex: 'toolsIds_dictText',
scopedSlots: {customRender: 'toolsIds_dictText'}
},
// {
// title: '',
// align: "center",
// dataIndex: 'userIds_dictText',
// scopedSlots: {customRender: 'userIds_dictText'}
// },
{
title:'前导工序',
align:"center",
dataIndex: 'proProcess_dictText'
},
{
title:'后导工序',
align: "center", align: "center",
dataIndex: 'postProcess_dictText' dataIndex: 'productCode'
}, },
{ {
title:'输入产品', title: '生产计划',
align:"center",
dataIndex: 'inputProduct'
},
{
title:'成品/半成品',
align: "center", align: "center",
dataIndex: 'semiProduct' dataIndex: 'id'
}, },
{ {
title: '操作', title: '操作',
@ -207,8 +162,8 @@ export default {
} }
], ],
url: { url: {
list: "/org.jeecg.modules.productplan/zyPlanProcess/list", // list: "/org.jeecg.modules.productplan/zyPlanProcess/list",
// list: "/org.jeecg.modules.productplan/zyPlanProcess/list2", list: "/org.jeecg.modules.productplan/zyProductPlan/list",
productPlanlist: "/org.jeecg.modules.productplan/zyProductPlan/list", productPlanlist: "/org.jeecg.modules.productplan/zyProductPlan/list",
delete: "/org.jeecg.modules.productplan/zyPlanProcess/delete", delete: "/org.jeecg.modules.productplan/zyPlanProcess/delete",
deleteBatch: "/org.jeecg.modules.productplan/zyPlanProcess/deleteBatch", deleteBatch: "/org.jeecg.modules.productplan/zyPlanProcess/deleteBatch",
@ -221,32 +176,19 @@ export default {
} }
}, },
created() { created() {
this.getSuperFieldList(); // this.getSuperFieldList();
}, },
computed: { computed: {
importExcelUrl: function () { // importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; // return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
}, // },
}, },
methods: { methods: {
initDictConfig() {
},
getSuperFieldList() {
let fieldList = [];
fieldList.push({type: 'string', value: 'planId', text: '生产计划id', dictCode: ''})
fieldList.push({type: 'string', value: 'stationId', text: '工位id', dictCode: ''})
fieldList.push({type: 'string', value: 'machineIds', text: '设备id列表', dictCode: ''})
fieldList.push({type: 'string', value: 'toolsIds', text: '工具id列表', dictCode: ''})
fieldList.push({type: 'string', value: 'processIds', text: '工序id列表', dictCode: ''})
fieldList.push({type: 'string', value: 'userIds', text: '成员id列表', dictCode: ''})
this.superFieldList = fieldList
},
jumpPage1(record) { jumpPage1(record) {
this.$router.push({ this.$router.push({
path: '/productplan/ZyPlanProcessDataList', path: '/productplan/ZyPlanProcessDataList',
query: { // query: { //
'planId': record.planId, 'planId': record.id,
// 'stationName': record.stationName,
}, },
}); });
}, },
@ -272,6 +214,3 @@ export default {
} }
} }
</script> </script>
<style scoped>
@import '~@assets/less/common.less';
</style>

@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.exception.JeecgBootException;
@ -18,6 +19,8 @@ import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.productplan.entity.ZyPlanProcess; import org.jeecg.modules.productplan.entity.ZyPlanProcess;
import org.jeecg.modules.productplan.entity.vo.ProcessDataVo; import org.jeecg.modules.productplan.entity.vo.ProcessDataVo;
import org.jeecg.modules.productplan.service.IZyPlanProcessService; import org.jeecg.modules.productplan.service.IZyPlanProcessService;
import org.jeecg.modules.team.entity.Station;
import org.jeecg.modules.team.service.IStationService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
@ -44,6 +47,9 @@ public class ZyPlanProcessController extends JeecgController<ZyPlanProcess, IZyP
@Autowired @Autowired
private IZyPlanProcessService zyPlanProcessService; private IZyPlanProcessService zyPlanProcessService;
@Autowired
private IStationService iStationService;
/** /**
* 分页列表查询 * 分页列表查询
* *
@ -109,8 +115,9 @@ public class ZyPlanProcessController extends JeecgController<ZyPlanProcess, IZyP
HttpServletRequest req) { HttpServletRequest req) {
QueryWrapper<ZyPlanProcess> queryWrapper = QueryGenerator.initQueryWrapper(zyPlanProcess, req.getParameterMap()); QueryWrapper<ZyPlanProcess> queryWrapper = QueryGenerator.initQueryWrapper(zyPlanProcess, req.getParameterMap());
Page<ZyPlanProcess> page = new Page<ZyPlanProcess>(pageNo, pageSize); Page<ZyPlanProcess> page = new Page<ZyPlanProcess>(pageNo, pageSize);
List<ProcessDataVo> processDatalist = zyPlanProcessService.getProcessDatalist(zyPlanProcess); // List<ProcessDataVo> processDatalist = zyPlanProcessService.getProcessDatalist(zyPlanProcess);
PageList<ProcessDataVo> processDataVos = new PageList<>(processDatalist, processDatalist.size()); List<ZyPlanProcess> processDatalist = zyPlanProcessService.getProcessDatalist(zyPlanProcess);
// PageList<ProcessDataVo> processDataVos = new PageList<>(processDatalist, processDatalist.size());
return Result.OK(processDatalist); return Result.OK(processDatalist);
} }
@ -156,14 +163,17 @@ public class ZyPlanProcessController extends JeecgController<ZyPlanProcess, IZyP
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} }
@ApiOperation(value = "计划工序管理-批量添加工序、工位、设备", notes = "计划工序管理-批量添加工序、工位、设备") @ApiOperation(value = "计划工序管理-批量更新工序、工位、设备", notes = "计划工序管理-批量更新工序、工位、设备")
@PostMapping(value = "/addProcessBatch") @PostMapping(value = "/addProcessBatch")
public Result<?> addProcessBatch(@RequestBody List<ZyPlanProcess> zyPlanProcessList) { public Result<?> addProcessBatch(@RequestBody List<ZyPlanProcess> zyPlanProcessList) {
if (!ObjectUtils.isEmpty(zyPlanProcessList)) { if (!ObjectUtils.isEmpty(zyPlanProcessList)) {
zyPlanProcessService.remove(new LambdaQueryWrapper<ZyPlanProcess>() // zyPlanProcessService.remove(new LambdaQueryWrapper<ZyPlanProcess>()
.eq(ZyPlanProcess::getPlanId, zyPlanProcessList.get(0).getPlanId())); // .eq(ZyPlanProcess::getPlanId, zyPlanProcessList.get(0).getPlanId()));
zyPlanProcessList.forEach(e -> {
zyPlanProcessService.saveBatch(zyPlanProcessList); Station station = iStationService.getById(e.getStationId());
e.setStationName(StringUtils.isNotBlank(station.getStationName()) ? station.getStationName() : "");
});
zyPlanProcessService.saveOrUpdateBatch(zyPlanProcessList);
} }
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} }

@ -2,6 +2,7 @@ package org.jeecg.modules.productplan.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
@ -11,11 +12,14 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict; import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.modules.team.vo.StationVo;
import org.jeecgframework.poi.excel.annotation.Excel; import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Map;
/** /**
* @Description: 生产计划工序 * @Description: 生产计划工序
@ -81,6 +85,12 @@ public class ZyPlanProcess implements Serializable {
@ApiModelProperty(value = "工位id") @ApiModelProperty(value = "工位id")
@Dict(dictTable = "station", dicText = "station_name", dicCode = "id") @Dict(dictTable = "station", dicText = "station_name", dicCode = "id")
private String stationId; private String stationId;
@ApiModelProperty(value = "工序名称")
private String stationName;
@TableField(exist = false)
private List<StationVo> stationIdList;
/** /**
* 设备id列表 * 设备id列表
*/ */
@ -108,15 +118,19 @@ public class ZyPlanProcess implements Serializable {
*/ */
@Excel(name = "前导工序", width = 15) @Excel(name = "前导工序", width = 15)
@ApiModelProperty(value = "前导工序") @ApiModelProperty(value = "前导工序")
@Dict(dictTable = "zy_process", dicText = "process_name", dicCode = "id") // @Dict(dictTable = "zy_process", dicText = "process_name", dicCode = "id")
private String proProcess; private String proProcess;
private String proProcessName;
/** /**
* 后导工序 * 后导工序
*/ */
@Excel(name = "后导工序", width = 15) @Excel(name = "后导工序", width = 15)
@ApiModelProperty(value = "后导工序") @ApiModelProperty(value = "后导工序")
@Dict(dictTable = "zy_process", dicText = "process_name", dicCode = "id") // @Dict(dictTable = "zy_process", dicText = "process_name", dicCode = "id")
private String postProcess; private String postProcess;
private String postProcessName;
/** /**
* 输入产品 * 输入产品
*/ */

@ -17,7 +17,7 @@ public class ProcessDataVo implements Serializable {
private static final long serialVersionUID = 1009888L; private static final long serialVersionUID = 1009888L;
// private String id; private String id;
//工单id //工单id
private String workOrderId; private String workOrderId;
@ -35,6 +35,9 @@ public class ProcessDataVo implements Serializable {
//工位 //工位
private List<StationVo> stationList; private List<StationVo> stationList;
//工位
private List<StationVo> stationId;
private String groupName; private String groupName;
//班组成员列表 //班组成员列表

@ -15,7 +15,7 @@ import java.util.List;
*/ */
public interface IZyPlanProcessService extends IService<ZyPlanProcess> { public interface IZyPlanProcessService extends IService<ZyPlanProcess> {
List<ProcessDataVo> getProcessDatalist(ZyPlanProcess zyPlanProcess); List<ZyPlanProcess> getProcessDatalist(ZyPlanProcess zyPlanProcess);
List<ProcessDataVo> getTeamDatalist(ZyPlanProcess zyPlanProcess); List<ProcessDataVo> getTeamDatalist(ZyPlanProcess zyPlanProcess);
} }

@ -25,13 +25,17 @@ import org.jeecg.modules.team.service.IGroupxService;
import org.jeecg.modules.team.service.IStationService; import org.jeecg.modules.team.service.IStationService;
import org.jeecg.modules.team.vo.GroupxMemeberVo; import org.jeecg.modules.team.vo.GroupxMemeberVo;
import org.jeecg.modules.team.vo.StationVo; import org.jeecg.modules.team.vo.StationVo;
import org.jeecg.modules.workproduct.entity.ZyProduct;
import org.jeecg.modules.workproduct.service.IZyProductService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Optional;
/** /**
@ -63,8 +67,11 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
@Autowired @Autowired
private IGroupxService iGroupxService; private IGroupxService iGroupxService;
@Autowired
private IZyProductService iZyProductService;
public List<ProcessDataVo> getProcessDatalist(ZyPlanProcess zyPlanProcess) { public List<ZyPlanProcess> getProcessDatalist(ZyPlanProcess zyPlanProcess) {
//生产计划id //生产计划id
String planId = zyPlanProcess.getPlanId(); String planId = zyPlanProcess.getPlanId();
ZyProductPlan zyProductPlan = iZyProductPlanService.getById(planId); ZyProductPlan zyProductPlan = iZyProductPlanService.getById(planId);
@ -73,12 +80,33 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
} }
//工单id //工单id
String productCode = zyProductPlan.getProductCode(); String workOrderId = zyProductPlan.getProductCode();
String departId = zyProductPlan.getWorkshopId(); String departId = zyProductPlan.getWorkshopId();
// TODO zy_product产品表,根据工单id获取产品id, ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper<ZyProduct>().eq(ZyProduct::getWorkOrderId, workOrderId));
if (ObjectUtils.isEmpty(zyProduct)) {
throw new JeecgBootException("产品不存在!");
}
List<ProcessDataVo> result = new LinkedList<>(); List<ProcessDataVo> result = new LinkedList<>();
List<ZyPlanProcess> planProcessList = this.list(new LambdaQueryWrapper<ZyPlanProcess>().eq(ZyPlanProcess::getPlanId, planId));
//生产计划工序表没有对应工序时,说明没有制定过该产品的生产工序计划,先把该产品对应的基本工序数据插入到生产计划工序表
if (ObjectUtils.isEmpty(planProcessList)) {
List<ZyProductProcess> productProcessesList = iZyProductProcessService.list(new LambdaQueryWrapper<ZyProductProcess>().eq(ZyProductProcess::getProductId, zyProduct.getId()));
if (!ObjectUtils.isEmpty(planProcessList)) {
List<ZyPlanProcess> saveList = new LinkedList<>();
productProcessesList.forEach(o -> {
ZyPlanProcess en = new ZyPlanProcess();
en.setProcessId(o.getProcessId());
en.setPlanId(planId);
saveList.add(en);
});
this.saveBatch(saveList);
//重新查询已录入工序数据
planProcessList = this.list(new LambdaQueryWrapper<ZyPlanProcess>().eq(ZyPlanProcess::getPlanId, planId));
}
}
SysDepart depart = iSysDepartService.getById(departId); if (!ObjectUtils.isEmpty(planProcessList)) {
// SysDepart depart = iSysDepartService.getById(departId);
List<Station> stationList = iStationService.list(new LambdaQueryWrapper<Station>().eq(Station::getDepartId, departId)); List<Station> stationList = iStationService.list(new LambdaQueryWrapper<Station>().eq(Station::getDepartId, departId));
List<StationVo> stationVoList = new LinkedList<>(); List<StationVo> stationVoList = new LinkedList<>();
if (!ObjectUtils.isEmpty(stationList)) { if (!ObjectUtils.isEmpty(stationList)) {
@ -91,43 +119,23 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
stationVoList.add(stationVo); stationVoList.add(stationVo);
}); });
} }
List<ZyPlanProcess> planProcessList = this.list(new LambdaQueryWrapper<ZyPlanProcess>().eq(ZyPlanProcess::getPlanId, planId));
//TODO暂定有一条数据时,查询产品工序记录,多条时说明已定制计划工序
if (!ObjectUtils.isEmpty(planProcessList) && planProcessList.size() > 1) {
planProcessList.forEach(e -> { planProcessList.forEach(e -> {
ProcessDataVo vo = new ProcessDataVo(); // ProcessDataVo vo = new ProcessDataVo();
vo.setPlanId(planId); // vo.setId(e.getId());
vo.setProcessId(e.getProcessId()); // vo.setPlanId(planId);
vo.setProcessName(iZyProcessService.getById(e.getProcessId()).getProcessName()); // vo.setProcessId(e.getProcessId());
vo.setProductName("产品名称"); // e.setProcessName(iZyProcessService.getById(e.getProcessId()).getProcessName());
vo.setWorkOrderId(productCode); // vo.setProductName("产品名称");
vo.setDepartId(departId); // vo.setWorkOrderId(workOrderId);
vo.setDepartName(depart.getDepartName()); // vo.setDepartId(departId);
vo.setStationList(stationVoList); // vo.setDepartName(depart.getDepartName());
result.add(vo); // vo.setStationList(stationVoList);
}); // vo.setStationId(stationVoList);
} else { e.setStationIdList(stationVoList);
//根据产品id获取产品工序列表 // result.add(vo);
// List<ZyProductProcess> productProcessesList = iZyProductProcessService.list(new LambdaQueryWrapper<ZyProductProcess>().eq(ZyProductProcess::getProductId, "产品id"));
List<ZyProductProcess> productProcessesList = iZyProductProcessService.list(new LambdaQueryWrapper<ZyProductProcess>().eq(ZyProductProcess::getProductId, "1"));
if (!ObjectUtils.isEmpty(productProcessesList)) {
productProcessesList.forEach(e -> {
ProcessDataVo vo = new ProcessDataVo();
vo.setPlanId(planId);
vo.setProcessId(e.getProcessId());
vo.setProcessName(iZyProcessService.getById(e.getProcessId()).getProcessName());
vo.setProductId(e.getProductId());
vo.setProductName("产品名称");
vo.setWorkOrderId(productCode);
vo.setDepartId(departId);
vo.setDepartName(depart.getDepartName());
vo.setStationList(stationVoList);
result.add(vo);
}); });
} }
} return planProcessList;
return result;
} }
@Override @Override

Loading…
Cancel
Save