From bc04ddac1ae6eee50efa5c91d77edec3659d3003 Mon Sep 17 00:00:00 2001 From: yinq Date: Sun, 7 Apr 2024 15:27:30 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E6=B4=BE=E5=B7=A5SOP=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hw/common/core/constant/MesConstants.java | 9 ++ .../MesBaseAttachInfoController.java | 12 +- .../controller/MesProductPlanController.java | 14 +- .../mes/service/IMesProductPlanService.java | 6 +- .../impl/MesProductPlanServiceImpl.java | 35 +++-- .../mapper/mes/MesProductPlanMapper.xml | 1 + hw-ui/src/api/mes/productplan.js | 8 ++ hw-ui/src/views/mes/productOrder/index.vue | 7 +- .../views/mes/productplan/editProductPlan.vue | 128 +++++++++++++++++- 9 files changed, 195 insertions(+), 25 deletions(-) diff --git a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java index 35122054..37245de3 100644 --- a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java +++ b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java @@ -66,4 +66,13 @@ public class MesConstants { public static final String MES_PRODUCT_PLAN_STATUS_STARTED = "2";//已开始 public static final String MES_PRODUCT_PLAN_STATUS_FINISH = "3";//已完成 + /** 附件类别;1-加工图纸 */ + public static final String MES_ATTACH_TYPE_DRAWING = "1"; + + /** 附件类别;2-SOP */ + public static final String MES_ATTACH_TYPE_SOP = "2"; + + /** 附件类别;9-其他文件 */ + public static final String MES_ATTACH_TYPE_OTHER = "9"; + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseAttachInfoController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseAttachInfoController.java index 42565f16..a0d2daf0 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseAttachInfoController.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseAttachInfoController.java @@ -107,12 +107,14 @@ public class MesBaseAttachInfoController extends BaseController } /** - * MES图纸文件上传 - * @param file 文件 - * @return AjaxResult + * MES附件上传 + * @param file 附件 + * @param processId 工序 + * @param attachType 附件类型 + * @return */ @PostMapping(value = "/drawingFileUpload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) - public AjaxResult drawingFileUpload(@RequestPart(value = "file") MultipartFile file, Long processId){ + public AjaxResult drawingFileUpload(@RequestPart(value = "file") MultipartFile file, Long processId, String attachType){ if (!file.isEmpty()) { R fileResult = null; @@ -126,7 +128,7 @@ public class MesBaseAttachInfoController extends BaseController MesBaseAttachInfo info = new MesBaseAttachInfo(); info.setAttachCode(UUID.fastUUID().toString()); info.setAttachName(name); - info.setAttachType("1"); + info.setAttachType(attachType); // String fixedString = "/statics"; // url = url.substring(url.indexOf(fixedString) + fixedString.length()); info.setAttachPath(url); diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesProductPlanController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesProductPlanController.java index 8c25af9d..713207da 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesProductPlanController.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesProductPlanController.java @@ -4,6 +4,7 @@ import java.util.List; import java.io.IOException; import javax.servlet.http.HttpServletResponse; +import com.hw.common.core.constant.MesConstants; import com.hw.mes.domain.MesProductOrder; import com.hw.mes.service.IMesProductOrderService; import org.springframework.beans.factory.annotation.Autowired; @@ -147,7 +148,18 @@ public class MesProductPlanController extends BaseController @GetMapping(value = "/drawingList/{planId}") public AjaxResult getDispatchDrawingList(@PathVariable("planId") Long planId) { - return success(mesProductPlanService.getDispatchDrawingList(planId)); + return success(mesProductPlanService.getDispatchAttachList(planId, MesConstants.MES_ATTACH_TYPE_DRAWING)); + } + + /** + * 获取生产派工SOP附件List列表 + * @param planId + * @return + */ + @GetMapping(value = "/SOPAttachList/{planId}") + public AjaxResult getDispatchSOPAttachList(@PathVariable("planId") Long planId) + { + return success(mesProductPlanService.getDispatchAttachList(planId, MesConstants.MES_ATTACH_TYPE_SOP)); } /** diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesProductPlanService.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesProductPlanService.java index c46bd458..90278fb6 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesProductPlanService.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesProductPlanService.java @@ -86,12 +86,14 @@ public interface IMesProductPlanService */ public int orderAddMesProductPlanList(List mesProductPlanList); + /** - * 获取生产派工图纸List列表 + * 获取生产派工附件List列表 * @param planId + * @param attachType * @return */ - public List getDispatchDrawingList(Long planId); + public List getDispatchAttachList(Long planId, String attachType); /** * 工单撤回 diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductPlanServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductPlanServiceImpl.java index 4e9f8a71..e334762d 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductPlanServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductPlanServiceImpl.java @@ -180,23 +180,36 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService { } /** - * 获取生产派工图纸List列表 - * + * 获取生产派工附件List列表 * @param planId + * @param attachType * @return */ @Override - public List getDispatchDrawingList(Long planId) { + public List getDispatchAttachList(Long planId, String attachType) { MesProductPlan mesProductPlan = mesProductPlanMapper.selectMesProductPlanByPlanId(planId); - if (StringUtils.isEmpty(mesProductPlan.getAttachId())) { - return new ArrayList<>(); - } try { - Long[] attachIds = Arrays.stream(mesProductPlan.getAttachId().split(",")) - .map(String::trim) - .map(Long::parseLong) - .toArray(Long[]::new); - return mesBaseAttachInfoService.selectMesBaseAttachInfoByAttachIds(attachIds); + if (attachType.equals(MesConstants.MES_ATTACH_TYPE_DRAWING)){ + if (StringUtils.isEmpty(mesProductPlan.getAttachId())) { + return new ArrayList<>(); + } + Long[] attachIds = Arrays.stream(mesProductPlan.getAttachId().split(",")) + .map(String::trim) + .map(Long::parseLong) + .toArray(Long[]::new); + return mesBaseAttachInfoService.selectMesBaseAttachInfoByAttachIds(attachIds); + } else if (attachType.equals(MesConstants.MES_ATTACH_TYPE_SOP)) { + if (StringUtils.isEmpty(mesProductPlan.getSopId())) { + return new ArrayList<>(); + } + Long[] sopIds = Arrays.stream(mesProductPlan.getSopId().split(",")) + .map(String::trim) + .map(Long::parseLong) + .toArray(Long[]::new); + return mesBaseAttachInfoService.selectMesBaseAttachInfoByAttachIds(sopIds); + } else { + return new ArrayList<>(); + } } catch (Exception e) { return new ArrayList<>(); } diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanMapper.xml index 8fc1a18c..8ed62a32 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanMapper.xml @@ -159,6 +159,7 @@ a.real_begin_time, a.real_end_time, a.attach_id, + a.sop_id, a.plan_status, a.is_flag, a.remark, diff --git a/hw-ui/src/api/mes/productplan.js b/hw-ui/src/api/mes/productplan.js index 0bcc0586..2529d424 100644 --- a/hw-ui/src/api/mes/productplan.js +++ b/hw-ui/src/api/mes/productplan.js @@ -88,3 +88,11 @@ export function getDispatchDrawingList(planId) { method: 'get' }) } + +// 获取生产派工SOP附件List列表 +export function getDispatchSOPAttachList(planId) { + return request({ + url: '/mes/productplan/SOPAttachList/' + planId, + method: 'get' + }) +} diff --git a/hw-ui/src/views/mes/productOrder/index.vue b/hw-ui/src/views/mes/productOrder/index.vue index 39228ca5..0dffd2ec 100644 --- a/hw-ui/src/views/mes/productOrder/index.vue +++ b/hw-ui/src/views/mes/productOrder/index.vue @@ -448,6 +448,7 @@ import addSaleOrder from '@//views/mes/productOrder/addSaleOrder.vue'; import {getMaterialVisionList} from "@//api/mes/materialBom"; import {findRouteList} from "@//api/mes/baseRoute"; import addBom from '@//views/mes/materialBom/addBom.vue'; +import router from "@//router"; export default { name: "ProductOrder", @@ -600,6 +601,9 @@ export default { }; }, created() { + if (this.$route.query.queryParams != null){ + this.queryParams = { ...this.$route.query.queryParams } + } this.getList(); findRouteList().then(response => { this.routeList = response.data; @@ -816,7 +820,8 @@ export default { handleDispatch(row) { const productOrderId = row.productOrderId || this.ids[0]; const orderCode = row.orderCode; - const params = {pageNum: this.queryParams.pageNum}; + const params = {queryParams: this.queryParams}; + this.$tab.closeOpenPage(router.currentRoute); this.$tab.openPage("工单[" + orderCode + "]生产派工", '/mes/product-plan/index/' + productOrderId, params); }, diff --git a/hw-ui/src/views/mes/productplan/editProductPlan.vue b/hw-ui/src/views/mes/productplan/editProductPlan.vue index d039b50e..583a257c 100644 --- a/hw-ui/src/views/mes/productplan/editProductPlan.vue +++ b/hw-ui/src/views/mes/productplan/editProductPlan.vue @@ -92,7 +92,7 @@ - + @@ -174,6 +181,68 @@ + + + +
+ + {{ file.name }} + + + + + + + + + + + +
+
+ + +
+ 请上传 + + + 的文件 +
+ 确 定 + 取 消 +
+
+ { + let attachList = res.data; + attachList.forEach(e => { + let previewFile = {}; + previewFile.url = e.attachPath; + previewFile.name = e.attachName; + this.fileList.push(previewFile); + this.uploadList.push(e.attachId); + }) + }) + } + this.addProductPlanObject = row; + this.sopViewModel = true; + }, + /** 生产计划添加按钮操作 */ handleAddMesProductPlan() { let dispatchCode = ""; @@ -449,7 +540,7 @@ export default { this.$modal.msgError("工艺路线未维护工位信息!"); } let lastProcessId = null; - res.data.forEach(e => { + res.data.forEach((e, index) => { let obj = {}; obj.dispatchCode = dispatchCode; obj.processId = e.processId; @@ -471,8 +562,10 @@ export default { obj.materialBomId = this.form.materialBomId; obj.productOrderId = this.form.productOrderId; // 上一工序ID - if (lastProcessId == null || lastProcessId === obj.processId) { + if (lastProcessId == null) { obj.lastProcessId = 0; + } else if(lastProcessId === obj.processId){ + obj.lastProcessId = this.mesProductPlanList[index - 1].lastProcessId; } else { obj.lastProcessId = lastProcessId; } @@ -519,6 +612,30 @@ export default { this.addProductPlanObject = null; this.blueprintModel = false; }, + + //添加SOP附件提交 + sopFileUploadSubmit() { + // 新添加列标识 false=新添加,true=历史行 + if (this.addProductPlanObject.oldRowFlag) { + updateProductplan({ + planId: this.addProductPlanObject.planId, + sopId: this.uploadList.join(","), + }).then(res => { + this.$modal.msgSuccess("上传SOP附件成功!"); + } + ) + } else { + for (let i = 0; i < this.mesProductPlanList.length; i++) { + if (this.mesProductPlanList[i].index === this.addProductPlanObject.index) { + this.mesProductPlanList[i].sopId = this.uploadList.join(","); + } + } + } + this.uploadList = []; + this.addProductPlanObject = null; + this.sopViewModel = false; + }, + //图片上传 httpRequest(file) { // 文件信息 @@ -526,6 +643,7 @@ export default { const formData = new FormData(); formData.append("file", fileData); formData.append("processId", this.addProductPlanObject.processId); + formData.append("attachType", "1"); uploadFile(formData).then( (res) => { // 存储附件信息主键