diff --git a/ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessDataList.vue b/ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessDataList.vue index f0141f6d..56c45bc0 100644 --- a/ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessDataList.vue +++ b/ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessDataList.vue @@ -1,10 +1,10 @@ @@ -44,7 +55,7 @@ export default { return { toolbarConfig: { // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮 - btn: ['save'] + btn: ['save',] }, description: '生产计划工序管理页面', loading: false, @@ -65,13 +76,20 @@ export default { dataSource: [], // columns, columns: [ - {key: 'workOrderId', title: '工单编号', width: '180px'}, - {key: 'productName', title: '产品名称', width: '180px'}, - {key: 'departName', title: '车间名称', width: '180px'}, - {key: 'processName', title: '工序名称', width: '180px'}, + {key: 'workOrderId', title: '工单编号', width: '200px'}, + // {key: 'productName', title: '产品名称', width: '120px'}, + {key: 'departName', title: '车间名称', width: '120px'}, + {key: 'processName', title: '工序名称', width: '120px'}, { - title: '工位列表', + title: '工位ID', key: 'stationId', + type: JVXETypes.hidden, + // width: '200px', + // options: [], + // placeholder: '请选择${title}', + },{ + title: '工位名称', + key: 'stationName', type: JVXETypes.select, width: '200px', options: [], @@ -92,42 +110,31 @@ export default { options: [], placeholder: '请选择${title}', }, - // { - // 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' - // }, + {key: 'proProcess', type: JVXETypes.hidden, title: '前导工序ID', width: '120px'}, { title: '前导工序', - key: 'proProcess', + key: 'proProcessName', type: JVXETypes.popup, width: '180px', popupCode: 'zy_process', field: 'id,process_code,process_name,process_describe', - orgFields: 'id,process_code,process_name,process_describe', - destFields: 'proProcess,process_code,process_name,process_describe', + // orgFields: 'id,process_code,process_name,process_describe', + // destFields: 'proProcessName,process_code,process_name,process_describe', + orgFields: 'process_name,id', + destFields: 'proProcessName,proProcess', }, - // { - // 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 - // }, + {key: 'postProcess', type: JVXETypes.hidden, title: '后导工序ID', width: '120px'}, { title: '后导工序', - key: 'postProcess', + key: 'postProcessName', type: JVXETypes.popup, width: '180px', popupCode: 'zy_process', field: 'id,process_code,process_name,process_describe', - orgFields: 'id,process_code,process_name,process_describe', - destFields: 'postProcess,process_code,process_name,process_describe', + // orgFields: 'id,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: 'semiProduct', title: '成品/半成品', width: '150', type: JVXETypes.input}, @@ -142,7 +149,8 @@ export default { planId: "", dictOptions: {}, superFieldList: [], - stationList: [], + stationId: [], + stationIdList: [], toolsList: [], machineList: [], clickTrue: true, @@ -154,23 +162,17 @@ export default { // 【整体保存】点击保存按钮时触发的事件 handleTableSave({$table, target}) { - console.log("保存开始-----") + console.log("生产计划工序保存开始-----------------") // 校验整个表格 $table.validate().then((errMap) => { // 校验通过 if (!errMap) { // 获取所有数据 let tableData = target.getTableData() - tableData.forEach(item => { - item.id = ''; - }) + // tableData.forEach(item => { + // item.id = ''; + // }) console.log('当前保存的数据是:', tableData) - // // 获取新增的数据 - // let newData = target.getNewData() - // console.log('-- 新增的数据:', newData) - // // 获取删除的数据 - // let deleteData = target.getDeleteData() - // console.log('-- 删除的数据:', deleteData) // 【模拟保存】 this.loading = true @@ -219,7 +221,8 @@ export default { getAction(this.url.list, params).then((res) => { if (res.success) { 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 { // 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) @@ -248,15 +251,9 @@ export default { console.log("handleSelectRowChange") console.log("handleSelectRowChange-event:", 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].options = this.stationList; - // 清空后两列的数据 - // target.setValues([{ - // rowKey: row.id, - // values: {machineIds: '', toolsIds: ''} - // }]) - // target.$refs.vxe.columns[4].options = [] + target.$refs.vxe.columns[6].options = this.stationIdList; }, /** 当选项被改变时,联动其他组件 */ handleValueChange(event) { diff --git a/ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessList.vue b/ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessList.vue index fd3b237b..fc351c8c 100644 --- a/ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessList.vue +++ b/ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessList.vue @@ -63,41 +63,41 @@ - - - - {{ text }} - - + + + + + + + + - - - - {{ text }} - - + + + + + + + + - - - - {{ text }} - - + + + + + + + + - - - - {{ text }} - - + + + + + + + + @@ -143,59 +143,14 @@ export default { } }, { - 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: '设备', + title: '工单编号', align: "center", - dataIndex: 'machineIds_dictText', - scopedSlots: {customRender: 'machineIds_dictText'} + dataIndex: 'productCode' }, { - title: '工具', + 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", - dataIndex: 'postProcess_dictText' - }, - { - title:'输入产品', - align:"center", - dataIndex: 'inputProduct' - }, - { - title:'成品/半成品', - align:"center", - dataIndex: 'semiProduct' + dataIndex: 'id' }, { title: '操作', @@ -207,8 +162,8 @@ export default { } ], url: { - list: "/org.jeecg.modules.productplan/zyPlanProcess/list", - // list: "/org.jeecg.modules.productplan/zyPlanProcess/list2", + // list: "/org.jeecg.modules.productplan/zyPlanProcess/list", + list: "/org.jeecg.modules.productplan/zyProductPlan/list", productPlanlist: "/org.jeecg.modules.productplan/zyProductPlan/list", delete: "/org.jeecg.modules.productplan/zyPlanProcess/delete", deleteBatch: "/org.jeecg.modules.productplan/zyPlanProcess/deleteBatch", @@ -221,32 +176,19 @@ export default { } }, created() { - this.getSuperFieldList(); + // this.getSuperFieldList(); }, computed: { - importExcelUrl: function () { - return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; - }, + // importExcelUrl: function () { + // return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; + // }, }, 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) { this.$router.push({ path: '/productplan/ZyPlanProcessDataList', query: { // 路由携带参数 - 'planId': record.planId, - // 'stationName': record.stationName, + 'planId': record.id, }, }); }, @@ -271,7 +213,4 @@ export default { // }, } } - - \ No newline at end of file + \ No newline at end of file diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyPlanProcessController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyPlanProcessController.java index ec6c7b07..3a3a8d48 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyPlanProcessController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyPlanProcessController.java @@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; 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.vo.ProcessDataVo; 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.factory.annotation.Autowired; import org.springframework.util.ObjectUtils; @@ -44,6 +47,9 @@ public class ZyPlanProcessController extends JeecgController queryWrapper = QueryGenerator.initQueryWrapper(zyPlanProcess, req.getParameterMap()); Page page = new Page(pageNo, pageSize); - List processDatalist = zyPlanProcessService.getProcessDatalist(zyPlanProcess); - PageList processDataVos = new PageList<>(processDatalist, processDatalist.size()); +// List processDatalist = zyPlanProcessService.getProcessDatalist(zyPlanProcess); + List processDatalist = zyPlanProcessService.getProcessDatalist(zyPlanProcess); +// PageList processDataVos = new PageList<>(processDatalist, processDatalist.size()); return Result.OK(processDatalist); } @@ -156,14 +163,17 @@ public class ZyPlanProcessController extends JeecgController addProcessBatch(@RequestBody List zyPlanProcessList) { if (!ObjectUtils.isEmpty(zyPlanProcessList)) { - zyPlanProcessService.remove(new LambdaQueryWrapper() - .eq(ZyPlanProcess::getPlanId, zyPlanProcessList.get(0).getPlanId())); - - zyPlanProcessService.saveBatch(zyPlanProcessList); +// zyPlanProcessService.remove(new LambdaQueryWrapper() +// .eq(ZyPlanProcess::getPlanId, zyPlanProcessList.get(0).getPlanId())); + zyPlanProcessList.forEach(e -> { + Station station = iStationService.getById(e.getStationId()); + e.setStationName(StringUtils.isNotBlank(station.getStationName()) ? station.getStationName() : ""); + }); + zyPlanProcessService.saveOrUpdateBatch(zyPlanProcessList); } return Result.OK("添加成功!"); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcess.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcess.java index a9f03775..ffd14d16 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcess.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcess.java @@ -2,6 +2,7 @@ package org.jeecg.modules.productplan.entity; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; @@ -11,11 +12,14 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import org.jeecg.common.aspect.annotation.Dict; +import org.jeecg.modules.team.vo.StationVo; import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.util.Date; +import java.util.List; +import java.util.Map; /** * @Description: 生产计划工序 @@ -81,6 +85,12 @@ public class ZyPlanProcess implements Serializable { @ApiModelProperty(value = "工位id") @Dict(dictTable = "station", dicText = "station_name", dicCode = "id") private String stationId; + + @ApiModelProperty(value = "工序名称") + private String stationName; + + @TableField(exist = false) + private List stationIdList; /** * 设备id列表 */ @@ -108,15 +118,19 @@ public class ZyPlanProcess implements Serializable { */ @Excel(name = "前导工序", width = 15) @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 proProcessName; /** * 后导工序 */ @Excel(name = "后导工序", width = 15) @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 postProcessName; /** * 输入产品 */ diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/vo/ProcessDataVo.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/vo/ProcessDataVo.java index 92401616..f478e1ec 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/vo/ProcessDataVo.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/vo/ProcessDataVo.java @@ -17,7 +17,7 @@ public class ProcessDataVo implements Serializable { private static final long serialVersionUID = 1009888L; - // private String id; + private String id; //工单id private String workOrderId; @@ -35,6 +35,9 @@ public class ProcessDataVo implements Serializable { //工位 private List stationList; + //工位 + private List stationId; + private String groupName; //班组成员列表 diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyPlanProcessService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyPlanProcessService.java index 7a20f520..bf2bdbbf 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyPlanProcessService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyPlanProcessService.java @@ -15,7 +15,7 @@ import java.util.List; */ public interface IZyPlanProcessService extends IService { - List getProcessDatalist(ZyPlanProcess zyPlanProcess); + List getProcessDatalist(ZyPlanProcess zyPlanProcess); List getTeamDatalist(ZyPlanProcess zyPlanProcess); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java index 17305470..c9c82979 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java @@ -25,13 +25,17 @@ import org.jeecg.modules.team.service.IGroupxService; import org.jeecg.modules.team.service.IStationService; import org.jeecg.modules.team.vo.GroupxMemeberVo; 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.stereotype.Service; import org.springframework.util.ObjectUtils; +import java.util.ArrayList; import java.util.LinkedList; import java.util.List; - +import java.util.Optional; /** @@ -63,8 +67,11 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl getProcessDatalist(ZyPlanProcess zyPlanProcess) { + public List getProcessDatalist(ZyPlanProcess zyPlanProcess) { //生产计划id String planId = zyPlanProcess.getPlanId(); ZyProductPlan zyProductPlan = iZyProductPlanService.getById(planId); @@ -73,61 +80,62 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl().eq(ZyProduct::getWorkOrderId, workOrderId)); + if (ObjectUtils.isEmpty(zyProduct)) { + throw new JeecgBootException("产品不存在!"); + } List result = new LinkedList<>(); - - SysDepart depart = iSysDepartService.getById(departId); - List stationList = iStationService.list(new LambdaQueryWrapper().eq(Station::getDepartId, departId)); - List stationVoList = new LinkedList<>(); - if (!ObjectUtils.isEmpty(stationList)) { - stationList.forEach(en -> { - StationVo stationVo = new StationVo(); - stationVo.setId(en.getId()); - stationVo.setValue(en.getId()); - stationVo.setText(en.getStationName()); - stationVo.setTitle(en.getStationName()); - stationVoList.add(stationVo); - }); + List planProcessList = this.list(new LambdaQueryWrapper().eq(ZyPlanProcess::getPlanId, planId)); + //生产计划工序表没有对应工序时,说明没有制定过该产品的生产工序计划,先把该产品对应的基本工序数据插入到生产计划工序表 + if (ObjectUtils.isEmpty(planProcessList)) { + List productProcessesList = iZyProductProcessService.list(new LambdaQueryWrapper().eq(ZyProductProcess::getProductId, zyProduct.getId())); + if (!ObjectUtils.isEmpty(planProcessList)) { + List 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().eq(ZyPlanProcess::getPlanId, planId)); + } } - List planProcessList = this.list(new LambdaQueryWrapper().eq(ZyPlanProcess::getPlanId, planId)); - //TODO暂定有一条数据时,查询产品工序记录,多条时说明已定制计划工序 - if (!ObjectUtils.isEmpty(planProcessList) && planProcessList.size() > 1) { - planProcessList.forEach(e -> { - ProcessDataVo vo = new ProcessDataVo(); - vo.setPlanId(planId); - vo.setProcessId(e.getProcessId()); - vo.setProcessName(iZyProcessService.getById(e.getProcessId()).getProcessName()); - vo.setProductName("产品名称"); - vo.setWorkOrderId(productCode); - vo.setDepartId(departId); - vo.setDepartName(depart.getDepartName()); - vo.setStationList(stationVoList); - result.add(vo); - }); - } else { - //根据产品id获取产品工序列表 -// List productProcessesList = iZyProductProcessService.list(new LambdaQueryWrapper().eq(ZyProductProcess::getProductId, "产品id")); - List productProcessesList = iZyProductProcessService.list(new LambdaQueryWrapper().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); + if (!ObjectUtils.isEmpty(planProcessList)) { +// SysDepart depart = iSysDepartService.getById(departId); + List stationList = iStationService.list(new LambdaQueryWrapper().eq(Station::getDepartId, departId)); + List stationVoList = new LinkedList<>(); + if (!ObjectUtils.isEmpty(stationList)) { + stationList.forEach(en -> { + StationVo stationVo = new StationVo(); + stationVo.setId(en.getId()); + stationVo.setValue(en.getId()); + stationVo.setText(en.getStationName()); + stationVo.setTitle(en.getStationName()); + stationVoList.add(stationVo); }); } + planProcessList.forEach(e -> { +// ProcessDataVo vo = new ProcessDataVo(); +// vo.setId(e.getId()); +// vo.setPlanId(planId); +// vo.setProcessId(e.getProcessId()); +// e.setProcessName(iZyProcessService.getById(e.getProcessId()).getProcessName()); +// vo.setProductName("产品名称"); +// vo.setWorkOrderId(workOrderId); +// vo.setDepartId(departId); +// vo.setDepartName(depart.getDepartName()); +// vo.setStationList(stationVoList); +// vo.setStationId(stationVoList); + e.setStationIdList(stationVoList); +// result.add(vo); + }); } - return result; + return planProcessList; } @Override