diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteDeviceService.java b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteDeviceService.java new file mode 100644 index 00000000..cbdf96f3 --- /dev/null +++ b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteDeviceService.java @@ -0,0 +1,24 @@ +package com.op.system.api; + +import com.op.common.core.constant.ServiceNameConstants; +import com.op.common.core.domain.R; +import com.op.system.api.factory.RemoteDeviceFallbackFactory; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; + +/** + * 用户服务 + * + * @author OP + */ +@FeignClient(contextId = "remoteDeviceService", value = ServiceNameConstants.DEVICE_SERVICE, fallbackFactory = RemoteDeviceFallbackFactory.class) + + + +public interface RemoteDeviceService { + + @PostMapping("/deviceTask/createSpotCheckPlanTask") + public R createSpotCheckPlanTask(); +} diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/BaseBomDTO.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/BaseBomDTO.java index 82d3b720..2f4ea9c6 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/BaseBomDTO.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/BaseBomDTO.java @@ -102,6 +102,15 @@ public class BaseBomDTO extends BaseEntity { private String productGroup; private String productGroupName; private String productCode; + private String workorderCode; + + public String getWorkorderCode() { + return workorderCode; + } + + public void setWorkorderCode(String workorderCode) { + this.workorderCode = workorderCode; + } public String getProductCode() { return productCode; diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/mes/MesReportWorkDTO.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/mes/MesReportWorkDTO.java index af864d58..6f1ea864 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/domain/mes/MesReportWorkDTO.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/mes/MesReportWorkDTO.java @@ -52,7 +52,7 @@ public class MesReportWorkDTO extends BaseEntity { /** 排产数量 */ @Excel(name = "排产数量") private BigDecimal quantity; - + private BigDecimal quantitySplit; /** 本次报工数量 */ @Excel(name = "本次报工数量") private BigDecimal quantityFeedback; @@ -162,6 +162,14 @@ public class MesReportWorkDTO extends BaseEntity { private String feedbackTimeStart; private String feedbackTimeEnd; + public BigDecimal getQuantitySplit() { + return quantitySplit; + } + + public void setQuantitySplit(BigDecimal quantitySplit) { + this.quantitySplit = quantitySplit; + } + public String getFeedbackTimeStart() { return feedbackTimeStart; } diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteDeviceFallbackFactory.java b/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteDeviceFallbackFactory.java new file mode 100644 index 00000000..cdebef4b --- /dev/null +++ b/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteDeviceFallbackFactory.java @@ -0,0 +1,33 @@ +package com.op.system.api.factory; + + +import com.op.common.core.domain.R; +import com.op.system.api.RemoteDeviceService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.openfeign.FallbackFactory; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * 用户服务降级处理 + * + * @author OP + */ +@Component +public class RemoteDeviceFallbackFactory implements FallbackFactory { + private static final Logger log = LoggerFactory.getLogger(RemoteDeviceFallbackFactory.class); + + @Override + public RemoteDeviceService create(Throwable throwable) { + log.error("Device服务调用失败:{}", throwable.getMessage()); + return new RemoteDeviceService() { + @Override + public R createSpotCheckPlanTask() { + return R.fail("点检计划创建失败:" + throwable.getMessage()); + } + }; + } +} + diff --git a/op-api/op-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/op-api/op-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index a44565e7..d8e2009b 100644 --- a/op-api/op-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/op-api/op-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -5,3 +5,4 @@ com.op.system.api.factory.RemoteMesFallbackFactory com.op.system.api.factory.RemotePlanFallbackFactory com.op.system.api.factory.RemoteTechnologyFallbackFactory com.op.system.api.factory.RemoteSapFallbackFactory +com.op.system.api.factory.RemoteDeviceFallbackFactory diff --git a/op-common/op-common-core/src/main/java/com/op/common/core/constant/ServiceNameConstants.java b/op-common/op-common-core/src/main/java/com/op/common/core/constant/ServiceNameConstants.java index 12e65b7a..6fa1d7dc 100644 --- a/op-common/op-common-core/src/main/java/com/op/common/core/constant/ServiceNameConstants.java +++ b/op-common/op-common-core/src/main/java/com/op/common/core/constant/ServiceNameConstants.java @@ -43,4 +43,9 @@ public class ServiceNameConstants { * 工艺模块的serviceid */ public static final String TECH_SERVICE = "op-technology"; + + /** + * 设备模块的serviceid + */ + public static final String DEVICE_SERVICE = "op-device"; } diff --git a/op-common/op-common-core/src/main/java/com/op/common/core/utils/poi/ExcelMapUtil.java b/op-common/op-common-core/src/main/java/com/op/common/core/utils/poi/ExcelMapUtil.java index 62af9527..99391226 100644 --- a/op-common/op-common-core/src/main/java/com/op/common/core/utils/poi/ExcelMapUtil.java +++ b/op-common/op-common-core/src/main/java/com/op/common/core/utils/poi/ExcelMapUtil.java @@ -2,9 +2,11 @@ package com.op.common.core.utils.poi; import com.alibaba.fastjson2.JSONObject; import com.op.common.core.domain.ExcelCol; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import org.springframework.web.multipart.MultipartFile; @@ -53,37 +55,49 @@ public class ExcelMapUtil { //将data中的值填充到excel int rowNum = sheet.getLastRowNum()+1; - Iterator iterator = data.iterator(); - //遍历数据 - for (;iterator.hasNext();){ - Row dataRow = sheet.createRow(rowNum);//创建行 - T obj = iterator.next();//获取当前行对应的数据 - JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(obj)); - for (int i = 0 ; i < colSize ; i++ ){ - Cell dataCell = dataRow.createCell(i); - dataCell.setCellStyle(getDataFont(workbook)); - if(i>=2){ - dataCell.setCellValue(getValueNum(jsonObject.get(excelCol.get(i).getField()))); - }else{ - dataCell.setCellValue(getValue(jsonObject.get(excelCol.get(i).getField()))); - } + if(!CollectionUtils.isEmpty(data)){ + Iterator iterator = data.iterator(); + //遍历数据 + for (;iterator.hasNext();){ + Row dataRow = sheet.createRow(rowNum);//创建行 + T obj = iterator.next();//获取当前行对应的数据 + JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(obj)); + for (int i = 0 ; i < colSize ; i++ ){ + Cell dataCell = dataRow.createCell(i); + dataCell.setCellStyle(getDataFont(workbook)); + if(i>=2){ + dataCell.setCellValue(getValueNum(jsonObject.get(excelCol.get(i).getField()))); + }else{ + dataCell.setCellValue(getValue(jsonObject.get(excelCol.get(i).getField()))); + } + } + iterator.remove(); + rowNum++; } - iterator.remove(); - rowNum++; } + return workbook; } //标题样式 public static CellStyle getHeaderFont(Workbook workbook){ Font font = workbook.createFont(); - font.setFontHeightInPoints((short) 16);//字体大小 + font.setFontHeightInPoints((short) 15);//字体大小 font.setBold(true);//加粗 CellStyle cellStyle = workbook.createCellStyle(); cellStyle.setFont(font); cellStyle.setAlignment(HorizontalAlignment.CENTER_SELECTION);//设置水平居中 cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//设置垂直居中 + // 设置上边框 + cellStyle.setBorderTop(BorderStyle.THIN); + // 设置下边框 + cellStyle.setBorderBottom(BorderStyle.THIN); + // 设置左边框 + cellStyle.setBorderLeft(BorderStyle.THIN); + // 设置右边框 + cellStyle.setBorderRight(BorderStyle.THIN); + return cellStyle; } diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/DeviceTaskController.java b/op-modules/op-device/src/main/java/com/op/device/controller/DeviceTaskController.java new file mode 100644 index 00000000..33050ad0 --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/controller/DeviceTaskController.java @@ -0,0 +1,43 @@ +package com.op.device.controller; + +import com.op.common.core.domain.R; +import com.op.common.core.web.domain.AjaxResult; +import com.op.device.domain.EquOrder; +import com.op.device.domain.EquPlan; +import com.op.device.domain.EquRepairOrder; +import com.op.device.domain.EquRepairWorkOrder; +import com.op.device.service.IDevicePDAService; +import com.op.device.service.IDeviceTaskService; +import com.op.device.service.IEquRepairOrderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * DeviceTaskController + * + * @author wws + * @date 2023-10-23 + */ +@RestController +@RequestMapping("/deviceTask") +public class DeviceTaskController { + + @Autowired + private IDeviceTaskService taskService; + + /** + * 点检计划生成 + * @return + */ + @PostMapping("/createSpotCheckPlanTask") + public R createSpotCheckPlanTask() { + EquPlan equPlan = new EquPlan(); + AjaxResult result = taskService.createSpotCheckPlanTask(equPlan); + if(result.isSuccess()){ + return R.ok("点检计划生成成功"); + } + return R.fail("点检计划生成失败"); + } + + +} diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java index 4bd9de6d..1390c4d2 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java @@ -147,6 +147,15 @@ public class EquOrder extends BaseEntity { //维修单号 private String workCode; + private int days; + + public int getDays() { + return days; + } + + public void setDays(int days) { + this.days = days; + } public String getRepairCode() { return repairCode; diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquPlan.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquPlan.java index 9b94d330..5cb5a04b 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquPlan.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquPlan.java @@ -12,7 +12,7 @@ import com.op.common.core.web.domain.BaseEntity; /** * 计划对象 equ_plan - * + * * @author Open Platform * @date 2023-10-16 */ diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceTaskMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceTaskMapper.java new file mode 100644 index 00000000..b78756b2 --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceTaskMapper.java @@ -0,0 +1,24 @@ +package com.op.device.mapper; + +import com.op.common.core.domain.BaseFileData; +import com.op.device.domain.EquFile; +import com.op.device.domain.EquOrder; +import com.op.device.domain.EquPlan; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 附件Mapper接口 + * + * @author Open Platform + * @date 2023-07-10 + */ +@Mapper +public interface DeviceTaskMapper { + + List getPlans(EquPlan equPlan); + + EquOrder getNewTaskOrder(EquOrder equOrder); +} diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java index 2f4e54d2..0cb79b49 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java @@ -5,18 +5,20 @@ import java.util.List; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.device.domain.EquOrder; import com.op.device.domain.dto.PDADTO; +import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; /** * 计划工单Mapper接口 - * + * * @author wws * @date 2023-10-23 */ +@Mapper public interface EquOrderMapper { /** * 查询计划工单 - * + * * @param orderCode 计划工单主键 * @return 计划工单 */ @@ -24,7 +26,7 @@ public interface EquOrderMapper { /** * 查询计划工单列表 - * + * * @param equOrder 计划工单 * @return 计划工单集合 */ @@ -32,7 +34,7 @@ public interface EquOrderMapper { /** * 新增计划工单 - * + * * @param equOrder 计划工单 * @return 结果 */ @@ -40,7 +42,7 @@ public interface EquOrderMapper { /** * 修改计划工单 - * + * * @param equOrder 计划工单 * @return 结果 */ @@ -48,7 +50,7 @@ public interface EquOrderMapper { /** * 删除计划工单 - * + * * @param orderId 计划工单主键 * @return 结果 */ @@ -56,7 +58,7 @@ public interface EquOrderMapper { /** * 批量删除计划工单 - * + * * @param orderIds 需要删除的数据主键集合 * @return 结果 */ @@ -76,6 +78,11 @@ public interface EquOrderMapper { */ String selectCenterNameByCenterCode(String planWorkshop); + /** + * 获取今日巡检工单list + * @return + */ + List selectTodayTask(int userId); /** * 获取巡检记录 diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IDeviceTaskService.java b/op-modules/op-device/src/main/java/com/op/device/service/IDeviceTaskService.java new file mode 100644 index 00000000..69e8e9fd --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/service/IDeviceTaskService.java @@ -0,0 +1,16 @@ +package com.op.device.service; + +import com.op.common.core.domain.R; +import com.op.common.core.web.domain.AjaxResult; +import com.op.device.domain.EquPlan; + +/** + * TaskService + * + * @author wws + * @date 2023-10-23 + */ +public interface IDeviceTaskService { + + AjaxResult createSpotCheckPlanTask(EquPlan equPlan); +} diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java new file mode 100644 index 00000000..a4962019 --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java @@ -0,0 +1,69 @@ +package com.op.device.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.op.common.core.web.domain.AjaxResult; +import com.op.common.security.utils.SecurityUtils; +import com.op.device.domain.*; +import com.op.device.mapper.*; +import com.op.device.service.IDeviceTaskService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +import static com.op.common.core.web.domain.AjaxResult.error; +import static com.op.common.core.web.domain.AjaxResult.success; + +/** + * TaskService实现类 + * + * @author wws + * @date 2023-10-23 + */ +@Service +public class DeviceTaskServiceImpl implements IDeviceTaskService { + + @Autowired + private DeviceTaskMapper deviceTaskMapper; + + @Autowired + private EquOrderMapper equOrderMapper; + + /** + * 根据点检计划生成点检任务 + * **/ + @Override + @DS("#header.poolName") + public AjaxResult createSpotCheckPlanTask(EquPlan equPlan) { + /**equ_plan equ_plan_equ**/ + equPlan.setPlanType("spotInspection"); + List plans = deviceTaskMapper.getPlans(equPlan); + for(EquPlan plan:plans){ + if("day".equals(plan.getPlanLoopType())){ + EquOrder order = new EquOrder(); + order.setPlanType("spotInspection"); + EquOrder hasTask = deviceTaskMapper.getNewTaskOrder(order); + if(hasTask==null || Integer.parseInt(plan.getPlanLoop())<= hasTask.getDays()){ + //生成点检计划 + this.createSpotCheckPlan(plan); + } + } + } + + return success(); + } + + private int createSpotCheckPlan(EquPlan plan){ + /**equ_order**/ + EquOrder order = new EquOrder(); + BeanUtils.copyProperties(plan,order); + equOrderMapper.insertEquOrder(order); + /**equ_order_detail**/ + List details = new ArrayList<>(); + + return 0; + } +} diff --git a/op-modules/op-device/src/main/resources/mapper/device/DeviceTaskMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/DeviceTaskMapper.xml new file mode 100644 index 00000000..be468d21 --- /dev/null +++ b/op-modules/op-device/src/main/resources/mapper/device/DeviceTaskMapper.xml @@ -0,0 +1,33 @@ + + + + + + + diff --git a/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java b/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java index a1afab77..4a26c4cd 100644 --- a/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java +++ b/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java @@ -1,5 +1,6 @@ package com.op.job.task; +import com.op.system.api.RemoteDeviceService; import com.op.system.api.RemoteMesService; import com.op.system.api.RemotePlanService; import com.op.system.api.RemoteSapService; @@ -31,6 +32,9 @@ public class RyTask { @Autowired private RemotePlanService remotePlanService; + @Autowired + private RemoteDeviceService remoteDeviceService; + public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) { System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); } @@ -117,4 +121,10 @@ public class RyTask { logger.info("++数据库备份的数据+开始++dataBKTask+++++"); remoteMesService.dataBKTask(); } + + /**每日点检计划生成**/ + public void createSpotCheckPlanTask(){ + logger.info("++点检计划+开始++createSpotCheckPlanTask+++++"); + remoteDeviceService.createSpotCheckPlanTask(); + } } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorkConsumeController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorkConsumeController.java index d4009628..fc68b8da 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorkConsumeController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorkConsumeController.java @@ -80,6 +80,13 @@ public class MesReportWorkConsumeController extends BaseController { return toAjax(mesReportWorkConsumeService.insertMesReportWorkConsume(mesReportWorkConsume)); } + @PostMapping("/addConsumes") + public AjaxResult addConsumes(@RequestBody List mesReportWorkConsumes) { + return toAjax(mesReportWorkConsumeService.insertMesReportWorkConsumes(mesReportWorkConsumes)); + } + + + /** * 修改生产报工物料消耗 */ diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java index 3b731e6e..8dbc717d 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java @@ -105,23 +105,6 @@ public class WCSInterfaceController extends BaseController { return success(wCInterfaceService.getMesBoardEquProductionToday(boardDTO)); } - /**上位机报工**/ - @PostMapping("/reportWork") - public AjaxResult reportWork(@RequestBody MesReportWork mesReportWork) { - if(StringUtils.isBlank(mesReportWork.getFactoryCode())){ - return error("[factoryCode] is null"); - } - if(StringUtils.isBlank(mesReportWork.getReportCode())){ - return error("[reportCode] is null"); - } - - if(mesReportWork.getFactoryCode().indexOf("ds")<0){ - mesReportWork.setFactoryCode("ds_"+mesReportWork.getFactoryCode()); - } - - return success(wCInterfaceService.reportWork(mesReportWork)); - } - /************************************************************/ /****************************数据库清理************************/ /************************************************************/ diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/MesReportWork.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesReportWork.java index 0f9e9ade..f96f4b22 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/domain/MesReportWork.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesReportWork.java @@ -51,7 +51,7 @@ public class MesReportWork extends BaseEntity { /** 排产数量 */ @Excel(name = "排产数量") private BigDecimal quantity; - + private BigDecimal quantitySplit; /** 本次报工数量 */ @Excel(name = "本次报工数量") private BigDecimal quantityFeedback; @@ -161,6 +161,14 @@ public class MesReportWork extends BaseEntity { private String feedbackTimeStart; private String feedbackTimeEnd; + public BigDecimal getQuantitySplit() { + return quantitySplit; + } + + public void setQuantitySplit(BigDecimal quantitySplit) { + this.quantitySplit = quantitySplit; + } + public String getFeedbackTimeStart() { return feedbackTimeStart; } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkConsumeMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkConsumeMapper.java index befe9fda..4a8e3e98 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkConsumeMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkConsumeMapper.java @@ -5,6 +5,7 @@ import java.util.List; import com.op.mes.domain.MesReportWorkConsume; import com.op.system.api.domain.dto.BaseBomDTO; import com.op.system.api.domain.mes.BaseTeamTDTO; +import org.apache.ibatis.annotations.Param; /** * 生产报工物料消耗Mapper接口 @@ -66,4 +67,6 @@ public interface MesReportWorkConsumeMapper { List getMesListBom(BaseBomDTO dto); List getTeamList(BaseTeamTDTO dto); + + int insertMesReportWorkConsumes(@Param("list") List mesReportWorkConsumes); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/IMesReportWorkConsumeService.java b/op-modules/op-mes/src/main/java/com/op/mes/service/IMesReportWorkConsumeService.java index ba8fd9d6..adcf46e4 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/IMesReportWorkConsumeService.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/IMesReportWorkConsumeService.java @@ -72,4 +72,6 @@ public interface IMesReportWorkConsumeService { public List getMesListBom(BaseBomDTO dto); public List getTeamList(BaseTeamTDTO dto); + + int insertMesReportWorkConsumes(List mesReportWorkConsumes); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java index 6ee2091d..1ee92724 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java @@ -319,8 +319,8 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { mesReportWorkMapper.updateSyncSapStatus(work); //工单完成数量>工单数量:关闭订单 MesReportWork proResult = mesReportWorkMapper.getProdResult(work); - ProOrderWorkorder topOrder = this.getTopOrder(work.getWorkorderCode()); - if(proResult.getQuantityFeedback().compareTo(new BigDecimal(topOrder.getQuantitySplit()))>=0){ + //ProOrderWorkorder topOrder = this.getTopOrder(work.getWorkorderCode()); + if(proResult.getQuantityFeedback().compareTo(work.getQuantitySplit())>=0){ //工单完成,关闭工单 remoteSapService.sapCloseOrder(work.getWorkorderCodeSap()); work.setStatus("w3"); @@ -331,16 +331,16 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { return R.ok(); } - //根据工单子单编码获取最顶级订单的母单 - private ProOrderWorkorder getTopOrder(String workorderCode) { - //pro_order_workorder - ProOrderWorkorder topOrder = mesReportWorkMapper.getOrderByCode(workorderCode); - while (!"0".equals(topOrder.getParentOrder()) && StringUtils.isNotEmpty(topOrder.getParentOrder())) { - //pro_order_workorder - topOrder = mesReportWorkMapper.getOrderByCode(topOrder.getParentOrder()); - } - return topOrder; - } +// //根据工单子单编码获取最顶级订单的母单 +// private ProOrderWorkorder getTopOrder(String workorderCode) { +// //pro_order_workorder +// ProOrderWorkorder topOrder = mesReportWorkMapper.getOrderByCode(workorderCode); +// while (!"0".equals(topOrder.getParentOrder()) && StringUtils.isNotEmpty(topOrder.getParentOrder())) { +// //pro_order_workorder +// topOrder = mesReportWorkMapper.getOrderByCode(topOrder.getParentOrder()); +// } +// return topOrder; +// } public void dateBKFunc(String poolName,List tables){ diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkConsumeServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkConsumeServiceImpl.java index 44959025..9549454e 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkConsumeServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkConsumeServiceImpl.java @@ -75,6 +75,18 @@ public class MesReportWorkConsumeServiceImpl implements IMesReportWorkConsumeSer return mesReportWorkConsumeMapper.insertMesReportWorkConsume(mesReportWorkConsume); } + + @Override + @DS("#header.poolName") + public int insertMesReportWorkConsumes(List mesReportWorkConsumes) { + for(MesReportWorkConsume mesReportWorkConsume:mesReportWorkConsumes){ + mesReportWorkConsume.setRecordId(IdUtils.fastSimpleUUID()); + mesReportWorkConsume.setCreateTime(DateUtils.getNowDate()); + } + + return mesReportWorkConsumeMapper.insertMesReportWorkConsumes(mesReportWorkConsumes); + } + /** * 修改生产报工物料消耗 * @@ -123,5 +135,4 @@ public class MesReportWorkConsumeServiceImpl implements IMesReportWorkConsumeSer return mesReportWorkConsumeMapper.getTeamList(dto); } - } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java index 0a9a4707..586c82c8 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java @@ -63,9 +63,9 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService { public List selectMesReportWorkList(MesReportWork mesReportWork) { List dtos = mesReportWorkMapper.selectMesReportWorkList(mesReportWork); for(MesReportWork dto:dtos){ - ProOrderWorkorder topOrder = this.getTopOrder(dto.getWorkorderCode()); - dto.setQuantity(new BigDecimal(topOrder.getQuantitySplit())); - dto.setUnit(topOrder.getUnit()); +// ProOrderWorkorder topOrder = this.getTopOrder(dto.getWorkorderCode()); +// dto.setQuantity(new BigDecimal(topOrder.getQuantitySplit())); +// dto.setUnit(topOrder.getUnit()); if("1".equals(dto.getUploadStatus())){ dto.setUploadStatus("sap报工成功"); }else if("2".equals(dto.getUploadStatus())){ @@ -78,16 +78,16 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService { return dtos; } - //根据工单子单编码获取最顶级订单的母单 - private ProOrderWorkorder getTopOrder(String workorderCode) { - //pro_order_workorder - ProOrderWorkorder topOrder = mesReportWorkMapper.getOrderByCode(workorderCode); - while (!"0".equals(topOrder.getParentOrder()) && StringUtils.isNotEmpty(topOrder.getParentOrder())) { - //pro_order_workorder - topOrder = mesReportWorkMapper.getOrderByCode(topOrder.getParentOrder()); - } - return topOrder; - } +// //根据工单子单编码获取最顶级订单的母单 +// private ProOrderWorkorder getTopOrder(String workorderCode) { +// //pro_order_workorder +// ProOrderWorkorder topOrder = mesReportWorkMapper.getOrderByCode(workorderCode); +// while (!"0".equals(topOrder.getParentOrder()) && StringUtils.isNotEmpty(topOrder.getParentOrder())) { +// //pro_order_workorder +// topOrder = mesReportWorkMapper.getOrderByCode(topOrder.getParentOrder()); +// } +// return topOrder; +// } /** * 新增报工报表 @@ -370,6 +370,7 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService { @Override @DS("#header.poolName") public List getMesListWorkOrder(ProOrderWorkorderDTO proOrderWorkorderDTO) { + //母单 List dtos = mesReportWorkMapper.getMesListWorkOrder(proOrderWorkorderDTO); for(ProOrderWorkorderDTO dto:dtos){ StringBuilder prodLineName = new StringBuilder(""); @@ -387,10 +388,10 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService { } dto.setProdLineCode(prodLineName.toString()); - //把母单的排产数量搞出来 - ProOrderWorkorder topOrder = this.getTopOrder(dto.getWorkorderCode()); - dto.setQuantitySplit(topOrder.getQuantitySplit()); - dto.setUnit(topOrder.getUnit()); +// //把母单的排产数量搞出来 +// ProOrderWorkorder topOrder = this.getTopOrder(dto.getWorkorderCode()); +// dto.setQuantitySplit(topOrder.getQuantitySplit()); +// dto.setUnit(topOrder.getUnit()); } return dtos; } diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkConsumeMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkConsumeMapper.xml index 57853cf0..2d3b3e14 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkConsumeMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkConsumeMapper.xml @@ -68,8 +68,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bp.product_group_name productGroupName from base_bom_component bbc left join base_product bp on SUBSTRING(bp.product_code, 8, 12) = bbc.component + left join mes_report_work_consume wc on wc.material_code = bbc.component and wc.workorder_code = #{workorderCode} where bbc.product_code = SUBSTRING(#{productCode}, 8, 12) - and bp.del_flag = '0' + and bp.del_flag = '0' and wc.material_code is null and bbc.component like concat('%', #{component}, '%') bp.product_desc_zh like concat('%', #{componentName}, '%') and bp.product_group like concat('%', #{productGroup}, '%') @@ -125,6 +126,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{factoryCode}, + + insert into mes_report_work_consume + (record_id, workorder_code, material_code, material_name, material_spc, + quantity, unit,create_by, create_time,report_code) + VALUES + + (#{item.recordId},#{item.workorderCode},#{item.materialCode},#{item.materialName},#{item.materialSpc}, + #{item.quantity},#{item.unit},#{item.createBy},#{item.createTime},#{item.reportCode}) + + + update mes_report_work_consume diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml index 3c14d59a..dc72daf7 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml @@ -95,7 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mrw.feedback_time, mrw.record_user, mrw.status, mrw.remark, mrw.work_time, mrw.machine_code, mrw.machine_name, mrw.team_code, mrw.shift_code, mrw.create_by, mrw.create_time,mrw.upload_time,mrw.upload_status,mrw.upload_msg, - pow.order_code + pow.order_code,pow.quantity_split from mes_report_work mrw left join pro_order_workorder pow on mrw.workorder_code = pow.workorder_code @@ -211,10 +211,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and #{productDateEnd} >= CONVERT(varchar(10),mrw.feedback_time, 120) - + SELECT powb.batch_code batchCode, + powb.batch_quantity batchQuantity FROM pro_order_workorder_batch powb LEFT JOIN pro_order_workorder pow ON powb.workorder_id = pow.workorder_id