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 b354940b..42565f16 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 @@ -1,19 +1,16 @@ package com.hw.mes.controller; import java.util.List; -import java.io.IOException; import javax.servlet.http.HttpServletResponse; -import com.hw.common.security.utils.SecurityUtils; +import com.hw.common.core.domain.R; +import com.hw.common.core.utils.StringUtils; +import com.hw.common.core.utils.uuid.UUID; +import com.hw.system.api.RemoteFileService; +import com.hw.system.api.domain.SysFile; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.*; import com.hw.common.log.annotation.Log; import com.hw.common.log.enums.BusinessType; import com.hw.common.security.annotation.RequiresPermissions; @@ -23,6 +20,7 @@ import com.hw.common.core.web.controller.BaseController; import com.hw.common.core.web.domain.AjaxResult; import com.hw.common.core.utils.poi.ExcelUtil; import com.hw.common.core.web.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; /** * 附件信息Controller @@ -37,6 +35,9 @@ public class MesBaseAttachInfoController extends BaseController @Autowired private IMesBaseAttachInfoService mesBaseAttachInfoService; + @Autowired + private RemoteFileService remoteFileService; + /** * 查询附件信息列表 */ @@ -80,7 +81,6 @@ public class MesBaseAttachInfoController extends BaseController @PostMapping public AjaxResult add(@RequestBody MesBaseAttachInfo mesBaseAttachInfo) { - mesBaseAttachInfo.setCreateBy(SecurityUtils.getLoginUser().getUsername()); return toAjax(mesBaseAttachInfoService.insertMesBaseAttachInfo(mesBaseAttachInfo)); } @@ -92,7 +92,6 @@ public class MesBaseAttachInfoController extends BaseController @PutMapping public AjaxResult edit(@RequestBody MesBaseAttachInfo mesBaseAttachInfo) { - mesBaseAttachInfo.setUpdateBy(SecurityUtils.getLoginUser().getUsername()); return toAjax(mesBaseAttachInfoService.updateMesBaseAttachInfo(mesBaseAttachInfo)); } @@ -106,4 +105,40 @@ public class MesBaseAttachInfoController extends BaseController { return toAjax(mesBaseAttachInfoService.deleteMesBaseAttachInfoByAttachIds(attachIds)); } + + /** + * MES图纸文件上传 + * @param file 文件 + * @return AjaxResult + */ + @PostMapping(value = "/drawingFileUpload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + public AjaxResult drawingFileUpload(@RequestPart(value = "file") MultipartFile file, Long processId){ + if (!file.isEmpty()) + { + R fileResult = null; + try { + fileResult = remoteFileService.upload(file); + } catch (Exception e) { + return error("文件服务异常,请联系管理员"); + } + String url = fileResult.getData().getUrl(); + String name = fileResult.getData().getName(); + MesBaseAttachInfo info = new MesBaseAttachInfo(); + info.setAttachCode(UUID.fastUUID().toString()); + info.setAttachName(name); + info.setAttachType("1"); + // String fixedString = "/statics"; + // url = url.substring(url.indexOf(fixedString) + fixedString.length()); + info.setAttachPath(url); + info.setProcessId(processId); + int attachId = mesBaseAttachInfoService.insertMesBaseAttachInfo(info); + AjaxResult ajax = AjaxResult.success(); + ajax.put("imgUrl", url); + ajax.put("attachId", attachId); + ajax.put("fileName", name); + return ajax; + } + return error("上传图片异常,请联系管理员"); + } + } 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 0fe319ec..26b2bee8 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 @@ -138,4 +138,15 @@ public class MesProductPlanController extends BaseController return toAjax(mesProductPlanService.orderAddMesProductPlanList(mesProductPlanList)); } + /** + * 获取生产派工图纸List列表 + * @param planId + * @return + */ + @GetMapping(value = "/drawingList/{planId}") + public AjaxResult getDispatchDrawingList(@PathVariable("planId") Long planId) + { + return success(mesProductPlanService.getDispatchDrawingList(planId)); + } + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesBaseAttachInfo.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesBaseAttachInfo.java index 7464f56f..aa8fb652 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesBaseAttachInfo.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesBaseAttachInfo.java @@ -32,7 +32,7 @@ public class MesBaseAttachInfo extends BaseEntity { private String attachName; /** - * 附件类别 + * 附件类别:1-加工图纸;2-SOP;9-其他文件 */ @Excel(name = "附件类别") private String attachType; diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProductPlan.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProductPlan.java index 8be4e8c1..6f68e6d6 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProductPlan.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProductPlan.java @@ -32,8 +32,8 @@ public class MesProductPlan extends BaseEntity @Excel(name = "生产工单编号") private String orderCode; - /** 工单编号 */ - @Excel(name = "工单编号") + /** 计划编号 */ + @Excel(name = "计划编号") private String planCode; /** 派工单号;主要为顺序生产时,获取上一工序的派工单是否完成,每次派工生成的派工单号相同,不同次派工的派工单号不能相同 */ diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesBaseAttachInfoMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesBaseAttachInfoMapper.java index 2763d92a..f19821aa 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesBaseAttachInfoMapper.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesBaseAttachInfoMapper.java @@ -27,6 +27,7 @@ public interface MesBaseAttachInfoMapper */ public List selectMesBaseAttachInfoList(MesBaseAttachInfo mesBaseAttachInfo); + /** * 新增附件信息 * @@ -58,4 +59,12 @@ public interface MesBaseAttachInfoMapper * @return 结果 */ public int deleteMesBaseAttachInfoByAttachIds(Long[] attachIds); + + /** + * 批量查询附件信息 + * + * @param attachIds 需要查询的数据主键集合 + * @return 结果 + */ + public List selectMesBaseAttachInfoByAttachIds(Long[] attachIds); } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseAttachInfoService.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseAttachInfoService.java index dc6a3a1c..f5e36c1d 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseAttachInfoService.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseAttachInfoService.java @@ -58,4 +58,11 @@ public interface IMesBaseAttachInfoService * @return 结果 */ public int deleteMesBaseAttachInfoByAttachId(Long attachId); + + /** + * 批量查询附件信息 + * @param attachIds 需要查询的数据主键集合 + * @return 结果 + */ + public List selectMesBaseAttachInfoByAttachIds(Long[] attachIds); } 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 0942650b..799290c8 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 @@ -1,6 +1,8 @@ package com.hw.mes.service; import java.util.List; + +import com.hw.mes.domain.MesBaseAttachInfo; import com.hw.mes.domain.MesProductPlan; /** @@ -82,4 +84,12 @@ public interface IMesProductPlanService * @return 结果 */ public int orderAddMesProductPlanList(List mesProductPlanList); + + /** + * 获取生产派工图纸List列表 + * @param planId + * @return + */ + public List getDispatchDrawingList(Long planId); + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseAttachInfoServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseAttachInfoServiceImpl.java index 289c49dc..2394e047 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseAttachInfoServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseAttachInfoServiceImpl.java @@ -45,6 +45,18 @@ public class MesBaseAttachInfoServiceImpl implements IMesBaseAttachInfoService return mesBaseAttachInfoMapper.selectMesBaseAttachInfoList(mesBaseAttachInfo); } + /** + * 查询附件信息列表 + * + * @param attachIds 附件信息 + * @return 附件信息 + */ + @Override + public List selectMesBaseAttachInfoByAttachIds(Long[] attachIds) + { + return mesBaseAttachInfoMapper.selectMesBaseAttachInfoByAttachIds(attachIds); + } + /** * 新增附件信息 * @@ -56,7 +68,8 @@ public class MesBaseAttachInfoServiceImpl implements IMesBaseAttachInfoService { mesBaseAttachInfo.setCreateBy(SecurityUtils.getUsername()); mesBaseAttachInfo.setCreateTime(DateUtils.getNowDate()); - return mesBaseAttachInfoMapper.insertMesBaseAttachInfo(mesBaseAttachInfo); + mesBaseAttachInfoMapper.insertMesBaseAttachInfo(mesBaseAttachInfo); + return mesBaseAttachInfo.getAttachId().intValue(); } /** 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 bfec216e..7c0d3aa0 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 @@ -1,14 +1,20 @@ package com.hw.mes.service.impl; +import java.util.Arrays; import java.util.List; + import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.uuid.Seq; import com.hw.common.security.utils.SecurityUtils; +import com.hw.mes.domain.MesBaseAttachInfo; import com.hw.mes.domain.MesProductOrder; +import com.hw.mes.service.IMesBaseAttachInfoService; import com.hw.mes.service.IMesProductOrderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + import java.util.ArrayList; + import com.hw.common.core.utils.StringUtils; import org.springframework.transaction.annotation.Transactional; import com.hw.mes.domain.MesProductPlanDetail; @@ -23,14 +29,16 @@ import com.hw.mes.service.IMesProductPlanService; * @date 2024-02-21 */ @Service -public class MesProductPlanServiceImpl implements IMesProductPlanService -{ +public class MesProductPlanServiceImpl implements IMesProductPlanService { @Autowired private MesProductPlanMapper mesProductPlanMapper; @Autowired private IMesProductOrderService mesProductOrderService; + @Autowired + private IMesBaseAttachInfoService mesBaseAttachInfoService; + /** * 查询生产派工 * @@ -38,8 +46,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService * @return 生产派工 */ @Override - public MesProductPlan selectMesProductPlanByPlanId(Long planId) - { + public MesProductPlan selectMesProductPlanByPlanId(Long planId) { return mesProductPlanMapper.selectMesProductPlanByPlanId(planId); } @@ -50,8 +57,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService * @return 生产派工 */ @Override - public List selectMesProductPlanList(MesProductPlan mesProductPlan) - { + public List selectMesProductPlanList(MesProductPlan mesProductPlan) { return mesProductPlanMapper.selectMesProductPlanList(mesProductPlan); } @@ -63,8 +69,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService */ @Transactional @Override - public int insertMesProductPlan(MesProductPlan mesProductPlan) - { + public int insertMesProductPlan(MesProductPlan mesProductPlan) { mesProductPlan.setCreateBy(SecurityUtils.getUsername()); mesProductPlan.setCreateTime(DateUtils.getNowDate()); mesProductPlan.setPlanCode(Seq.getId(Seq.planCodeSeqType, Seq.planCodeCode)); @@ -86,8 +91,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService */ @Transactional @Override - public int updateMesProductPlan(MesProductPlan mesProductPlan) - { + public int updateMesProductPlan(MesProductPlan mesProductPlan) { mesProductPlan.setUpdateBy(SecurityUtils.getUsername()); mesProductPlan.setUpdateTime(DateUtils.getNowDate()); mesProductPlanMapper.deleteMesProductPlanDetailByPlanId(mesProductPlan.getPlanId()); @@ -103,8 +107,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService */ @Transactional @Override - public int deleteMesProductPlanByPlanIds(Long[] planIds) - { + public int deleteMesProductPlanByPlanIds(Long[] planIds) { mesProductPlanMapper.deleteMesProductPlanDetailByPlanIds(planIds); return mesProductPlanMapper.deleteMesProductPlanByPlanIds(planIds); } @@ -117,8 +120,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService */ @Transactional @Override - public int deleteMesProductPlanByPlanId(Long planId) - { + public int deleteMesProductPlanByPlanId(Long planId) { mesProductPlanMapper.deleteMesProductPlanDetailByPlanId(planId); return mesProductPlanMapper.deleteMesProductPlanByPlanId(planId); } @@ -128,20 +130,16 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService * * @param mesProductPlan 生产派工对象 */ - public void insertMesProductPlanDetail(MesProductPlan mesProductPlan) - { + public void insertMesProductPlanDetail(MesProductPlan mesProductPlan) { List mesProductPlanDetailList = mesProductPlan.getMesProductPlanDetailList(); Long planId = mesProductPlan.getPlanId(); - if (StringUtils.isNotNull(mesProductPlanDetailList)) - { + if (StringUtils.isNotNull(mesProductPlanDetailList)) { List list = new ArrayList<>(); - for (MesProductPlanDetail mesProductPlanDetail : mesProductPlanDetailList) - { + for (MesProductPlanDetail mesProductPlanDetail : mesProductPlanDetailList) { mesProductPlanDetail.setPlanId(planId); list.add(mesProductPlanDetail); } - if (list.size() > 0) - { + if (list.size() > 0) { mesProductPlanMapper.batchMesProductPlanDetail(list); } } @@ -149,6 +147,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService /** * 获取派工编号 + * * @return */ @Override @@ -158,6 +157,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService /** * 生产工单新增生产派工List + * * @param mesProductPlanList 生产派工 * @return */ @@ -169,6 +169,29 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService return 1; } + /** + * 获取生产派工图纸List列表 + * + * @param planId + * @return + */ + @Override + public List getDispatchDrawingList(Long planId) { + 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); + } catch (Exception e) { + return new ArrayList<>(); + } + } + /** * 查询生产派工列表Join product_order和base_material * @@ -176,8 +199,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService * @return 生产派工 */ @Override - public List selectMesProductPlanJoinList(MesProductPlan mesProductPlan) - { + public List selectMesProductPlanJoinList(MesProductPlan mesProductPlan) { Long stationId = SecurityUtils.getStationd(); System.out.println("stationId: " + stationId); return mesProductPlanMapper.selectMesProductPlanJoinList(mesProductPlan); diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseAttachInfoMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseAttachInfoMapper.xml index 1ee1716b..9a276dbb 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseAttachInfoMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseAttachInfoMapper.xml @@ -114,4 +114,12 @@ #{attachId} + + \ No newline at end of file diff --git a/hw-ui/src/api/mes/productplan.js b/hw-ui/src/api/mes/productplan.js index 2dbe878f..0bcc0586 100644 --- a/hw-ui/src/api/mes/productplan.js +++ b/hw-ui/src/api/mes/productplan.js @@ -68,3 +68,23 @@ export function getProductPlan(query) { params: query }) } + +export function uploadFile(data) { + return request({ + url: '/mes/baseAttachInfo/drawingFileUpload', + method: 'post', + timeout: 1000000,//超时时间需要设置的较大,否则容易上传失败 + headers: { + 'Content-Type': 'multipart/form-data'//文件上传需要设置该参数 + }, + data + }) +} + +// 获取生产派工图纸List列表 +export function getDispatchDrawingList(planId) { + return request({ + url: '/mes/productplan/drawingList/' + planId, + method: 'get' + }) +} diff --git a/hw-ui/src/views/mes/baseAttachInfo/index.vue b/hw-ui/src/views/mes/baseAttachInfo/index.vue index f4488fa1..6aced1e2 100644 --- a/hw-ui/src/views/mes/baseAttachInfo/index.vue +++ b/hw-ui/src/views/mes/baseAttachInfo/index.vue @@ -53,28 +53,28 @@ v-hasPermi="['mes:baseAttachInfo:add']" >新增 - - 修改 - - - 删除 - + + + + + + + + + + + + + + + + + + + + + + {{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }} - - - + + + + + + + + + + + + + + + + + + + :limit="limit" + :headers="headers" + :before-upload="handleBeforeUpload" + :http-request="httpRequest" + :on-exceed="handleExceed" + :file-list="fileList" + >
@@ -154,12 +161,28 @@
+ +
+ 请上传 + + + 的文件 +
+ 确 定 取 消 - 确 定 -
+ - - + + + @@ -167,17 +190,50 @@