From 9876f10b56f98aca26b6502c26bf15c5ed09406f Mon Sep 17 00:00:00 2001 From: zhc077 <565291854> Date: Wed, 8 Feb 2023 15:02:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8A=E6=8C=82=E7=AE=A1=E7=90=86-=E5=90=8A?= =?UTF-8?q?=E6=8C=82=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF-=E7=AE=A1?= =?UTF-8?q?=E9=9D=A2=E9=A1=B5=E9=9D=A2=202.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/hanger/HangerManage.vue | 439 +++++------------- .../src/views/hanger/ZyHangList.vue | 2 + .../hanger/controller/ZyHangController.java | 54 +++ .../controller/ZyHangPointController.java | 16 + .../modules/hanger/entity/ZyHangPoint.java | 11 +- .../hanger/service/IZyHangPointService.java | 6 + .../service/impl/ZyHangPointServiceImpl.java | 37 ++ 7 files changed, 252 insertions(+), 313 deletions(-) diff --git a/ant-design-vue-jeecg/src/views/hanger/HangerManage.vue b/ant-design-vue-jeecg/src/views/hanger/HangerManage.vue index e92dcd14..1194e568 100644 --- a/ant-design-vue-jeecg/src/views/hanger/HangerManage.vue +++ b/ant-design-vue-jeecg/src/views/hanger/HangerManage.vue @@ -1,32 +1,32 @@ @@ -80,195 +76,110 @@ import {JeecgListMixin} from '@/mixins/JeecgListMixin' import {getAction, postAction} from "@api/manage"; import {filterObj, pushIfNotExist, randomNumber, randomUUID} from "@/utils/util"; import {JVXETypes} from '@/components/jeecg/JVxeTable' -import Area from "@comp/_util/Area"; -import ZyPlanProcessDataDetail from '@views/productplan/ZyPlanProcessDataDetail' export default { name: 'ZyPlanProcessDataList', mixins: [JeecgListMixin, mixinDevice], - components: { - ZyPlanProcessDataDetail, - }, data() { return { toolbarConfig: { // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮 btn: ['save',] }, - description: '生产计划工序管理页面', + description: '吊挂管理页面', loading: false, dataSource: [], columns: [ { - title: '工序名称', - key: 'processName', + title: '车间', + key: 'workshopName', width: '180px', }, { - title: '工位ID', - key: 'stationId', - type: JVXETypes.hidden, - }, - { - title: '工位名称', - key: 'stationName', - type: JVXETypes.select, - width: '200px', - options: [], - placeholder: '请选择${title}', - }, - { - title: '工位序号', - key: 'stationNum', - width: '80px', - }, - { - title: '设备名称', - key: 'machineIds', - type: JVXETypes.hidden - }, - { - title: '设备名称', - key: 'machineNames', - type: JVXETypes.selectMultiple, + title: '吊挂编号', + key: 'code', width: '180px', - options: [], - placeholder: '请选择${title}', - }, - { - title: 'toodsIds', - key: 'toolsIds', - type: JVXETypes.hidden, }, { - title: '工具名称', - key: 'toolsNames', - type: JVXETypes.selectMultiple, + title: '工站编号', + key: 'point', + type: JVXETypes.input, width: '180px', - options: [], - placeholder: '请选择${title}', - }, - {key: 'proProcess', type: JVXETypes.hidden, title: '前导工序ID', width: '120px'}, - { - title: '前导工序', - 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: 'proProcessName,process_code,process_name,process_describe', - orgFields: 'process_name,id', - destFields: 'proProcessName,proProcess', - }, - {key: 'postProcess', type: JVXETypes.hidden, title: '后导工序ID', width: '120px'}, - { - title: '后导工序', - key: 'postProcessName', - type: JVXETypes.popup, - width: '180px', - popupCode: 'zy_process', - field: 'id,process_code,process_name,process_describe', - orgFields: 'process_name,id', - destFields: 'postProcessName,postProcess', + /*validateRules: [ + { + required: true, // 必填 + message: '请输入${title}' // 显示的文本 + }, + { + // pattern: /^[P][0-9]{4}$/, // 正则 + // pattern: /^[0-9a-zA-Z_]{1,}$/, + pattern: /^[P]\d[0-9]{4,}$/, // 正则 + // pattern: /^[a-z|A-Z][a-z|A-Z\d_-]{0,}$/, // 正则 + + message: '${title}必须以字母开头,可包含数字、下划线、横杠' + }, + { + unique: true, + message: '${point}不能重复' + }, + // { + // handler({cellValue, row, column}, callback, target) { + // // cellValue 当前校验的值 + // // callback(flag, message) 方法必须执行且只能执行一次 + // // flag = 是否通过了校验,不填写或者填写 null 代表不进行任何操作 + // // message = 提示的类型,默认使用配置的 message + // // target 行编辑的实例对象 + // if (cellValue === 'abc') { + // callback(false, '${title}不能是abc') // false = 未通过校验 + // } else { + // callback(true) // true = 通过验证 + // } + // }, + // message: '${title}默认提示' + // } + ]*/ }, - {key: 'inputProduct', title: '输入产品', width: '150', type: JVXETypes.input}, - {key: 'semiProduct', title: '成品/半成品', width: '150', type: JVXETypes.input}, { - title: '工人id', - key: 'userIds', + title: '工位ID', + key: 'stationId', type: JVXETypes.hidden, }, { - title: '工人名称', - key: 'userNames', - type: JVXETypes.selectMultiple, - width: '200px', + title: '工位名称', + key: 'stationName', + type: JVXETypes.select, + width: '220px', options: [], placeholder: '请选择${title}', }, - {key: 'totalMachine', title: '机器时长', width: '80', type: JVXETypes.normal}, - {key: 'totalMaunal', title: '人工时长', width: '80', type: JVXETypes.normal}, - { - title: '管理', - key: 'action', - type: JVXETypes.slot, - fixed: 'right', - minWidth: '150px', - align: 'center', - slotName: 'action', - }, + // { + // title: '管理', + // key: 'action', + // type: JVXETypes.slot, + // fixed: 'right', + // minWidth: '150px', + // align: 'center', + // slotName: 'action', + // }, ], url: { - list: "/org.jeecg.modules.productplan/zyPlanProcess/getProcessDatalist", - getPlanInfo: "/org.jeecg.modules.productplan/zyPlanProcess/getPlanInfo", - syncProductProcess: "/org.jeecg.modules.productplan/zyPlanProcess/syncProductProcess", - autoFilling: "/org.jeecg.modules.productplan/zyPlanProcess/autoFilling", - createMaterialBill: "/org.jeecg.modules.productplan/zyPlanProcess/createMaterialBill", - sendToRepository: "/org.jeecg.modules.productplan/zyPlanProcess/sendToRepository", - stationToolslist: "/stationTool/list2", - stationMachinelist: "/stationMachine/list2", - addProcessBatch: "/org.jeecg.modules.productplan/zyPlanProcess/addProcessBatch", + list: "/org.jeecg.modules.hanger/zyHang/getPointById", + syncHangRecord: "/org.jeecg.modules.productplan/zyPlanProcess/syncHangRecord", + addBatch: "/org.jeecg.modules.hanger/zyHangPoint/addBatch", }, loadRouteType: false, - planId: "", + id: "", + workshopName: "", + code: "", dictOptions: {}, - planInfo: {}, - superFieldList: [], stationIdList: [], - userIdList: [], - toolsList: [], - machineList: [], clickTrue: true, } }, created() { this.loadParameter(); - this.getPlanInfo(this.planId); }, methods: { - // 详情 - viewDetail(props) { - // alert("deatil row id:"+props.row.id); - this.$refs.zyPlanProcessDataDetail.showModal(props.row.id) - }, - - jump2MianLiao(props) { - console.log("mianLiao() ----props:", props) - this.$router.push({ - path: '/productplan/ZyPlanProcessFabricDataList', - query: { // 路由携带参数 - 'planId': props.row.planId, - 'planProcessId': props.row.processId, - }, - }); - }, - - jump2FuLiao(props) { - console.log("fuLiao() ----props:", props) - this.$router.push({ - path: '/productplan/ZyPlanProcessAccessoriesDataList', - query: { // 路由携带参数 - 'planId': props.row.planId, - 'planProcessId': props.row.processId, - }, - }); - }, - getPlanInfo(planId) { - // debugger; - getAction(this.url.getPlanInfo, {"planId": planId}).then((res) => { - if (res.success) { - this.planInfo = res.result.records || res.result; - // console.log("getPlanInfo------------:" + JSON.stringify(this.planInfo)); - } 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) - } - }).finally(() => { - this.loading = false - }) - }, - // 【整体保存】点击保存按钮时触发的事件 handleTableSave({$table, target}) { console.log("生产计划工序保存开始-----------------") @@ -281,7 +192,7 @@ export default { console.log('当前保存的数据是:', tableData) // 【模拟保存】 this.loading = true - postAction(this.url.addProcessBatch, tableData).then(res => { + postAction(this.url.addBatch, tableData).then(res => { if (res.success) { this.$message.success(`保存成功!`) } else { @@ -296,80 +207,17 @@ export default { }, fanHui() { this.$router.push({ - path: '/productplan/ZyProductPlanList', + path: '/src/views/hanger/ZyHangList', }); }, - //读取工序 - syncProductProcess() { - this.loading = true; - getAction(this.url.syncProductProcess, {"planId": this.planId}).then((res) => { - if (res.success) { - this.$message.success("操作成功"); - this.loadData(); - } else { - this.$message.warning(res.message) - } - }).finally(() => { - this.loading = false - }) - }, - - //自动排位 - /** - * 根据工序id,查询工序设备表zy_process_machine,用工序设备表数据与工位设备进行匹配(工位设备包含工序设备即是匹配成功,则自动填充工位、设备字段数据,匹配不上则不自动填充,由用户自己录入) - */ - autoFilling() { + //同步生产记录到吊挂运行记录表 + syncHangRecord() { this.loading = true; - getAction(this.url.autoFilling, {"planId": this.planId}).then((res) => { + getAction(this.url.syncHangRecord, {"code": this.code}).then((res) => { if (res.success) { this.$message.success("操作成功"); - this.loadData(); - } else { - this.$message.warning(res.message) - } - }).finally(() => { - this.loading = false - }) - }, - - //生成物料单 - /** - * 根据该生产计划的工序面料、工序辅料按类统计各种面料、辅料的用量汇总到计划面料、计划辅料表 - */ - createMaterialBill() { - this.loading = true; - getAction(this.url.createMaterialBill, {"planId": this.planId}).then((res) => { - if (res.success) { - this.$message.success("操作成功"); - this.loadData(); - } else { - this.$message.warning(res.message) - } - }).finally(() => { - this.loading = false - }) - }, - - //查看物料单 - viewMaterialBill() { - // alert("deatil this.planId:"+this.planId); - // this.$refs.zyPlanProcessDataDetail.showModal(this.planId) - this.$router.push({ - path: '/productplan/ZyPlanWuLiaoDataDetail', - query: { // 路由携带参数 - 'planId': this.planId, - }, - }); - }, - - //发送到仓库 - sendToRepository(){ - this.loading = true; - getAction(this.url.sendToRepository, {"planId": this.planId}).then((res) => { - if (res.success) { - this.$message.success("操作成功"); - this.loadData(); + // this.loadData(); } else { this.$message.warning(res.message) } @@ -382,8 +230,10 @@ export default { loadParameter() { // debugger; if (this.loadRouteType === false) { - this.planId = this.$route.query.planId; - console.log("*******传递的planId:" + this.planId) + this.id = this.$route.query.id; + this.workshopName = this.$route.query.workshopName; + this.code = this.$route.query.code; + console.log("*******传递的id:" + this.id) this.loadRouteType = true; } }, @@ -403,12 +253,16 @@ export default { if (res.success) { this.dataSource = res.result.records || res.result; this.stationIdList = this.dataSource[0].stationIdList; - this.userIdList = this.dataSource[0].userIdList; + + // alert(this.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) } }).finally(() => { + this.dataSource.forEach(item => { + item['workshopName'] = this.workshopName; + // item['stationNum'] = this.stationNum; + }) this.loading = false }) }, @@ -423,20 +277,18 @@ export default { param.field = this.getQueryField(); param.pageNo = this.ipagination.current; param.pageSize = this.ipagination.pageSize; - param.planId = this.planId; + param.id = this.id; return filterObj(param); }, // 当选择的行变化时触发的事件 handleSelectRowChange(event) { - // console.log("handleSelectRowChange") console.log("handleSelectRowChange-event:", event) const {type, row, column, value, target, $table} = event console.log("stationIdList", JSON.stringify(this.stationIdList)); - console.log("---------userIdList", JSON.stringify(this.userIdList)); - target.$refs.vxe.columns[4].options = this.stationIdList; - target.$refs.vxe.columns[17].options = this.userIdList; + target.$refs.vxe.columns[6].options = this.stationIdList; }, + /** 当选项被改变时,联动其他组件 */ handleValueChange(event) { const {type, row, column, value, target} = event @@ -445,51 +297,14 @@ export default { // console.log("row", row) // 选中工位列操作 if (column.key === 'stationName') { + // target.$refs.vxe.columns[6].options = this.stationIdList; + // debugger; let selectedStationId = event.value; - // 设置第二列的 options // console.log('选择的工位列id---------:', selectedStationId) row.stationId = selectedStationId; - // 清空后两列的数据 - target.setValues([{ - rowKey: row.id, - values: {machineIds: '', toolsIds: '', machineNames: '', toolsNames: ''} - }]) - target.$refs.vxe.columns[7].options = [] - target.$refs.vxe.columns[9].options = [] - - getAction(this.url.stationMachinelist, {"stationId": selectedStationId}).then((res) => { - if (res.success) { - this.machineList = res.result.records || res.result; - console.log("machineList", JSON.stringify(this.machineList)) - target.$refs.vxe.columns[7].options = this.machineList; - } else { - this.$message.warning(res.message) - } - }); - - getAction(this.url.stationToolslist, {"stationId": selectedStationId}).then((res) => { - if (res.success) { - this.toolsList = res.result.records || res.result; - console.log("toolsList", JSON.stringify(this.toolsList)) - target.$refs.vxe.columns[9].options = this.toolsList; - } else { - this.$message.warning(res.message) - } - }); - } - - //选中列操作 - if (column.key === 'machineNames') { - row.machineIds = event.value; - } - if (column.key === 'toolsNames') { - row.toolsIds = event.value; - } - - if (column.key === 'userNames') { - row.userIds = event.value; } } + }, }; diff --git a/ant-design-vue-jeecg/src/views/hanger/ZyHangList.vue b/ant-design-vue-jeecg/src/views/hanger/ZyHangList.vue index 7c7b7de2..c716a777 100644 --- a/ant-design-vue-jeecg/src/views/hanger/ZyHangList.vue +++ b/ant-design-vue-jeecg/src/views/hanger/ZyHangList.vue @@ -265,6 +265,8 @@ export default { path: '/src/views/hanger/HangerManage', query: { // 路由携带参数 'id': record.id, + 'code': record.code, + 'workshopName': record.workshopId_dictText, }, }); }, diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/controller/ZyHangController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/controller/ZyHangController.java index c86750ca..55394a4a 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/controller/ZyHangController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/controller/ZyHangController.java @@ -4,6 +4,7 @@ package org.jeecg.modules.hanger.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.api.R; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.zxing.BarcodeFormat; import com.google.zxing.EncodeHintType; @@ -21,7 +22,12 @@ import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.modules.hanger.entity.ZyHang; +import org.jeecg.modules.hanger.entity.ZyHangPoint; +import org.jeecg.modules.hanger.service.IZyHangPointService; import org.jeecg.modules.hanger.service.IZyHangService; +import org.jeecg.modules.team.entity.Station; +import org.jeecg.modules.team.service.IStationService; +import org.jeecg.modules.team.vo.StationVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; @@ -47,6 +53,12 @@ public class ZyHangController extends JeecgController { @Autowired private IZyHangService zyHangService; + @Autowired + private IZyHangPointService iZyHangPointService; + + @Autowired + private IStationService iStationService; + /** * 分页列表查询 * @@ -101,6 +113,48 @@ public class ZyHangController extends JeecgController { return Result.OK(pageList); } + @ApiOperation(value = "吊挂表-通过吊挂查询工站列表", notes = "吊挂表-通过吊挂查询工站列表") + @GetMapping(value = "/getPointById") + public Result getPointById(ZyHang zyHang) { + ZyHang entity = zyHangService.getById(zyHang.getId()); + Optional.ofNullable(entity).orElseThrow(() -> new JeecgBootException(zyHang.getId() + ":吊挂不存在")); + List pointList = new LinkedList<>(); + pointList = iZyHangPointService.list(new LambdaQueryWrapper().eq(ZyHangPoint::getCode, entity.getCode())); + List stationList = iStationService.list(new LambdaQueryWrapper().eq(Station::getDepartId, entity.getWorkshopId())); + 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); + }); + } + //未配置工站,未绑定工位 + if (entity.getPointnumber() > 0 && ObjectUtils.isEmpty(pointList)) { + String lastPointCode = iZyHangPointService.getLastPointCode(); + String[] dgs = lastPointCode.split("P"); + int val = new Integer(dgs[1]).intValue(); + for (int i = 0; i < entity.getPointnumber(); i++) { + int currVal = val + i; + ZyHangPoint zyHangPoint = new ZyHangPoint(); + zyHangPoint.setCode(entity.getCode()); + zyHangPoint.setPoint("P" + currVal); + zyHangPoint.setStationIdList(stationVoList); + pointList.add(zyHangPoint); + } + iZyHangPointService.saveBatch(pointList); + pointList.clear(); + pointList = iZyHangPointService.list(new LambdaQueryWrapper().eq(ZyHangPoint::getCode, entity.getCode())); + } + pointList.forEach(e -> { + e.setStationIdList(stationVoList); + }); + return Result.OK(pointList); + } + /** * 添加 * diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/controller/ZyHangPointController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/controller/ZyHangPointController.java index 26c2cb64..3394bd3b 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/controller/ZyHangPointController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/controller/ZyHangPointController.java @@ -20,6 +20,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Arrays; +import java.util.List; /** * @Description: 吊挂工位表 @@ -64,6 +65,21 @@ public class ZyHangPointController extends JeecgController syncHangRecord(ZyHangPoint zyHangPoint) { + return Result.OK(zyHangPointService.syncHangRecord(zyHangPoint)); + } + + + @ApiOperation(value = "吊挂工位表-工站、工位绑定批量添加", notes = "吊挂工位表-工站、工位绑定批量添加") + @PostMapping(value = "/addBatch") + public Result addBatch(@RequestBody List pointList) { + zyHangPointService.addBatch(pointList); + return Result.OK("添加成功!"); + } + + /** * 添加 * diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/entity/ZyHangPoint.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/entity/ZyHangPoint.java index 286059b7..1bfd738c 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/entity/ZyHangPoint.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/entity/ZyHangPoint.java @@ -2,6 +2,7 @@ package org.jeecg.modules.hanger.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,13 @@ 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; /** * @Description: 吊挂工位表 @@ -78,6 +81,12 @@ public class ZyHangPoint implements Serializable { */ @Excel(name = "工位id", width = 15) @ApiModelProperty(value = "工位id") - @Dict(dictTable = "station", dicCode = "id", dicText = "station_name") +// @Dict(dictTable = "station", dicCode = "id", dicText = "station_name") private String stationId; + + @ApiModelProperty(value = "工位名称") + private String stationName; + + @TableField(exist = false) + private List stationIdList; } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/service/IZyHangPointService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/service/IZyHangPointService.java index a080cd01..6b591a85 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/service/IZyHangPointService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/service/IZyHangPointService.java @@ -4,6 +4,8 @@ package org.jeecg.modules.hanger.service; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.hanger.entity.ZyHangPoint; +import java.util.List; + /** * @Description: 吊挂工位表 * @Author: jeecg-boot @@ -13,4 +15,8 @@ import org.jeecg.modules.hanger.entity.ZyHangPoint; public interface IZyHangPointService extends IService { String getLastPointCode(); + + void addBatch(List pointList); + + void syncHangRecord(ZyHangPoint zyHangPoint); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/service/impl/ZyHangPointServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/service/impl/ZyHangPointServiceImpl.java index 49a31a5e..10d3d79f 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/service/impl/ZyHangPointServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/service/impl/ZyHangPointServiceImpl.java @@ -3,13 +3,22 @@ package org.jeecg.modules.hanger.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; +import org.jeecg.common.exception.JeecgBootException; +import org.jeecg.modules.hanger.entity.ZyHang; import org.jeecg.modules.hanger.entity.ZyHangPoint; import org.jeecg.modules.hanger.mapper.ZyHangPointMapper; import org.jeecg.modules.hanger.service.IZyHangPointService; +import org.jeecg.modules.hanger.service.IZyHangService; +import org.jeecg.modules.team.entity.Station; +import org.jeecg.modules.team.service.IStationService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; +import java.util.LinkedList; import java.util.List; +import java.util.Optional; /** * @Description: 吊挂工位表 @@ -20,6 +29,12 @@ import java.util.List; @Service public class ZyHangPointServiceImpl extends ServiceImpl implements IZyHangPointService { + @Autowired + private IStationService iStationService; + + @Autowired + private IZyHangService iZyHangService; + @Override public String getLastPointCode() { List pointList = this.list(new LambdaQueryWrapper().orderByDesc(ZyHangPoint::getPoint)); @@ -33,4 +48,26 @@ public class ZyHangPointServiceImpl extends ServiceImpl pointList) { + Optional.ofNullable(pointList).orElse(new LinkedList<>()).forEach(e -> { + if (StringUtils.isNotBlank(e.getStationId())) { + Station station = iStationService.getById(e.getStationId()); + if (!ObjectUtils.isEmpty(station)) { + e.setStationName(station.getStationName()); + } + } else { + e.setStationName(""); + } + }); + this.saveOrUpdateBatch(pointList); + } + + @Override + public void syncHangRecord(ZyHangPoint zyHangPoint) { + ZyHang zyHang = iZyHangService.getOne(new LambdaQueryWrapper().eq(ZyHang::getCode, zyHangPoint.getCode())); + Optional.ofNullable(zyHang).orElseThrow(() -> new JeecgBootException(zyHangPoint.getCode() + "不存在")); + //TODO + } }