diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesPrepareDetailController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesPrepareDetailController.java index 5d5c634e..2382a30d 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesPrepareDetailController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesPrepareDetailController.java @@ -33,6 +33,17 @@ public class MesPrepareDetailController extends BaseController { @Autowired private IMesPrepareDetailService mesPrepareDetailService; + /** + * 通过备料工单code打印备料单 + * @return + */ + @RequiresPermissions("mes:prepareDetail:export") + @Log(title = "mes备料打印", businessType = BusinessType.EXPORT) + @GetMapping("/printPrepareByCode/{workorderCode}") + public AjaxResult printPrepareByCode(@PathVariable("workorderCode") String workorderCode) { + return mesPrepareDetailService.printPrepareByCode(workorderCode); + } + /** * 查询mes备料单明细列表 */ diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/PrintPrepareVo.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/PrintPrepareVo.java new file mode 100644 index 00000000..0c2733e4 --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/PrintPrepareVo.java @@ -0,0 +1,32 @@ +package com.op.mes.domain.vo; + +import com.op.mes.domain.MesPrepare; +import com.op.mes.domain.MesPrepareDetail; + +import java.util.Date; +import java.util.List; + +// 打印备料单返回实体 +public class PrintPrepareVo { + private MesPrepare mesPrepare; + private List mesPrepareDetailList; + + public PrintPrepareVo() { + } + + public MesPrepare getMesPrepare() { + return mesPrepare; + } + + public void setMesPrepare(MesPrepare mesPrepare) { + this.mesPrepare = mesPrepare; + } + + public List getMesPrepareDetailList() { + return mesPrepareDetailList; + } + + public void setMesPrepareDetailList(List mesPrepareDetailList) { + this.mesPrepareDetailList = mesPrepareDetailList; + } +} diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesPrepareDetailMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesPrepareDetailMapper.java index 94088b91..dcf271f2 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesPrepareDetailMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesPrepareDetailMapper.java @@ -2,6 +2,7 @@ package com.op.mes.mapper; import java.util.List; +import com.baomidou.dynamic.datasource.annotation.DS; import com.op.mes.domain.MesPrepareDetail; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -63,4 +64,11 @@ public interface MesPrepareDetailMapper { public int deleteMesPrepareDetailByRecordIds(String[] recordIds); public void insertMesPrepareDetails(@Param("list") List details); + + /** + * 通过主领料单id查询领料详情list + * @param prepareId + * @return + */ + List selectPrintPrepareDetailList(String prepareId); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesPrepareMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesPrepareMapper.java index 3d7e2795..dd11c6ce 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesPrepareMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesPrepareMapper.java @@ -2,6 +2,7 @@ package com.op.mes.mapper; import java.util.List; +import com.baomidou.dynamic.datasource.annotation.DS; import com.op.mes.domain.MesPrepare; import org.apache.ibatis.annotations.Mapper; @@ -62,4 +63,11 @@ public interface MesPrepareMapper { public int deleteMesPrepareByPrepareIds(String[] prepareIds); public List getParentWorkOrderT1(MesPrepare qo); + + /** + * 通过工单code查询主领料信息 + * @param workorderCode + * @return + */ + MesPrepare selectMesPrepareByCode(String workorderCode); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/IMesPrepareDetailService.java b/op-modules/op-mes/src/main/java/com/op/mes/service/IMesPrepareDetailService.java index 75b0c857..4e0dae19 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/IMesPrepareDetailService.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/IMesPrepareDetailService.java @@ -1,6 +1,8 @@ package com.op.mes.service; import java.util.List; + +import com.op.common.core.web.domain.AjaxResult; import com.op.mes.domain.MesPrepareDetail; /** @@ -57,4 +59,10 @@ public interface IMesPrepareDetailService { * @return 结果 */ public int deleteMesPrepareDetailByRecordId(String recordId); + + /** + * 通过备料工单code打印备料单 + * @return + */ + AjaxResult printPrepareByCode(String workorderCode); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesPrepareDetailServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesPrepareDetailServiceImpl.java index bda7f3fc..fe9e9250 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesPrepareDetailServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesPrepareDetailServiceImpl.java @@ -1,7 +1,13 @@ package com.op.mes.service.impl; import java.util.List; + +import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.utils.DateUtils; +import com.op.common.core.web.domain.AjaxResult; +import com.op.mes.domain.MesPrepare; +import com.op.mes.domain.vo.PrintPrepareVo; +import com.op.mes.mapper.MesPrepareMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.op.mes.mapper.MesPrepareDetailMapper; @@ -18,6 +24,8 @@ import com.op.mes.service.IMesPrepareDetailService; public class MesPrepareDetailServiceImpl implements IMesPrepareDetailService { @Autowired private MesPrepareDetailMapper mesPrepareDetailMapper; + @Autowired + private MesPrepareMapper mesPrepareMapper; /** * 查询mes备料单明细 @@ -86,4 +94,19 @@ public class MesPrepareDetailServiceImpl implements IMesPrepareDetailService { public int deleteMesPrepareDetailByRecordId(String recordId) { return mesPrepareDetailMapper.deleteMesPrepareDetailByRecordId(recordId); } + + /** + * 通过备料工单code打印备料单 + * @return + */ + @Override + @DS("#header.poolName") + public AjaxResult printPrepareByCode(String workorderCode) { + MesPrepare mesPrepare = mesPrepareMapper.selectMesPrepareByCode(workorderCode); + List mesPrepareDetailList = mesPrepareDetailMapper.selectPrintPrepareDetailList(mesPrepare.getPrepareId()); + PrintPrepareVo printPrepareVo = new PrintPrepareVo(); + printPrepareVo.setMesPrepare(mesPrepare); + printPrepareVo.setMesPrepareDetailList(mesPrepareDetailList); + return AjaxResult.success(printPrepareVo); + } } diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesPrepareDetailMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesPrepareDetailMapper.xml index 4aa93c7a..61756be1 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesPrepareDetailMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesPrepareDetailMapper.xml @@ -8,8 +8,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - + + @@ -26,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -61,6 +62,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where record_id = #{recordId} + + insert into mes_prepare_detail diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesPrepareMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesPrepareMapper.xml index d103763c..85b01bd1 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesPrepareMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesPrepareMapper.xml @@ -110,7 +110,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and CONVERT(varchar(100), product_date, 23) = #{dayStr} - + + + insert into mes_prepare prepare_id,