diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java index 3b16a333..fbf0d39c 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java @@ -6,13 +6,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.foreverwin.mesnac.anomaly.model.AbnormalBill; import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose; import com.foreverwin.mesnac.anomaly.service.AbnormalBillService; -import com.foreverwin.mesnac.meapi.controller.NcCodeController; -import com.foreverwin.mesnac.meapi.controller.WorkCenterController; import com.foreverwin.mesnac.meapi.model.DataField; import com.foreverwin.mesnac.meapi.model.NcCode; import com.foreverwin.mesnac.meapi.model.WorkCenter; import com.foreverwin.mesnac.meapi.service.DataFieldListService; import com.foreverwin.mesnac.meapi.service.NcCodeService; +import com.foreverwin.mesnac.meapi.service.WorkCenterService; import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.FrontPage; import com.foreverwin.modular.core.util.R; @@ -38,10 +37,7 @@ public class AbnormalBillController { private NcCodeService ncCodeService; @Autowired - private WorkCenterController workCenterController; - - @Autowired - private NcCodeController ncCodeController; + private WorkCenterService workCenterService; @Autowired private DataFieldListService dataFieldListService; @@ -181,14 +177,15 @@ public class AbnormalBillController { //工作中心 WorkCenter workCenter = new WorkCenter(); workCenter.setWcCategory("LEVEL4"); - R workCenterList = workCenterController.getWorkCenterList(workCenter); + workCenter.setSite(site); + List workCenterList = workCenterService.selectList(workCenter); hashMap.put("workCenter",workCenterList); //原因分类 NcCode ncCode = new NcCode(); ncCode.setSite(site); ncCode.setNcCategory("REPAIR"); - R causeType = ncCodeController.getNcCodeList(ncCode); - hashMap.put("causeType",causeType); + List ncCodeList = ncCodeService.selectList(ncCode); + hashMap.put("causeType",ncCodeList); //责任部门 DataField dataField = new DataField(); dataField.setSite(site); @@ -208,15 +205,44 @@ public class AbnormalBillController { // } /** - * 异常提报 + * 其他异常提报 * @param abnormalBill * @return */ @GetMapping("/anomalyReportOther") - public R anomalyReportOther(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose){ - return R.ok(abnormalBillService.anomalyReportOther(abnormalBill, abnormalBillDispose)); + public R anomalyReportOther(AbnormalBill abnormalBill, + AbnormalBillDispose abnormalBillDispose, + @RequestParam List dutyCauseType, + @RequestParam List dutyType){ + return R.ok(abnormalBillService.anomalyReportOther(abnormalBill, abnormalBillDispose,dutyCauseType,dutyType)); + } + + /** + * 质量异常提报 + * @param abnormalBill + * @param abnormalBillDispose + * @return + */ + @GetMapping("/anomalyReport") + public R anomalyReport(AbnormalBill abnormalBill, + AbnormalBillDispose abnormalBillDispose, + @RequestParam List ncGroupAndNcCodes, + @RequestParam List dutyCauseType, + @RequestParam List dutyType){ + return R.ok(abnormalBillService.anomalyReport(abnormalBill, abnormalBillDispose,ncGroupAndNcCodes,dutyCauseType,dutyType)); } + /** + * 设备异常提报 + * @param abnormalBill + * @return + */ + @GetMapping("/anomalyReportDevice") + public R anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose){ + return R.ok(abnormalBillService.anomalyReportDevice(abnormalBill,abnormalBillDispose)); + } + + /** * 取消原因 * @param handle diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalCauseController.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalCauseController.java index 3900a99c..a0fc3211 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalCauseController.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalCauseController.java @@ -46,6 +46,8 @@ public class AbnormalCauseController { @GetMapping("") public R getAbnormalCauseList(AbnormalCause abnormalCause){ List result; + String site = CommonMethods.getSite(); + abnormalCause.setSite(site); QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.setEntity(abnormalCause); result = abnormalCauseService.list(queryWrapper); diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalDutyController.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalDutyController.java index 1541d4c6..27cf504d 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalDutyController.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalDutyController.java @@ -46,6 +46,8 @@ public class AbnormalDutyController { @GetMapping("") public R getAbnormalDutyList(AbnormalDuty abnormalDuty){ List result; + String site = CommonMethods.getSite(); + abnormalDuty.setSite(site); QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.setEntity(abnormalDuty); result = abnormalDutyService.list(queryWrapper); diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalDutyMapper.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalDutyMapper.java index e74e22e1..6665d474 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalDutyMapper.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalDutyMapper.java @@ -1,7 +1,7 @@ package com.foreverwin.mesnac.anomaly.mapper; -import com.foreverwin.mesnac.anomaly.model.AbnormalDuty; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.foreverwin.mesnac.anomaly.model.AbnormalDuty; import org.springframework.stereotype.Repository; /** diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalBill.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalBill.java index 6f6e852f..00fe7a76 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalBill.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalBill.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonFormat; import java.io.Serializable; import java.time.LocalDateTime; diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java index 96a51eb7..5c5f1969 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java @@ -27,15 +27,26 @@ public interface AbnormalBillService extends IService { List selectList(AbnormalBill abnormalBill); - String anomalyReportOther(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose); + String anomalyReportOther(AbnormalBill abnormalBill, + AbnormalBillDispose abnormalBillDispose, + List dutyCauseType, + List dutyType); + + String anomalyReport(AbnormalBill abnormalBill, + AbnormalBillDispose abnormalBillDispose, + List ncGroupAndNcCodes, + List dutyCauseType, + List dutyType); /** * 生成异常单号、创建时间和更新时间 * @param abnormalBill * @param abnormalBillDispose */ - void generateAbnormalBill(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose); + void generateAbnormalBill(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose,List dutyCauseType,List dutyType); void cancelBrowse(String handle,String cancelBrowse); + String anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose); + } \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalDutyService.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalDutyService.java index 969d89b3..becbc7ef 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalDutyService.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalDutyService.java @@ -25,4 +25,5 @@ public interface AbnormalDutyService extends IService { IPage selectPage(FrontPage frontPage, AbnormalDuty abnormalDuty); List selectList(AbnormalDuty abnormalDuty); + } \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalNcCodeService.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalNcCodeService.java index aab4746b..2547aca7 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalNcCodeService.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalNcCodeService.java @@ -25,4 +25,5 @@ public interface AbnormalNcCodeService extends IService { IPage selectPage(FrontPage frontPage, AbnormalNcCode abnormalNcCode); List selectList(AbnormalNcCode abnormalNcCode); + } \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java index 9c1bfb51..ca57a77a 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java @@ -4,10 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.foreverwin.mesnac.anomaly.mapper.AbnormalBillMapper; -import com.foreverwin.mesnac.anomaly.model.AbnormalBill; -import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose; -import com.foreverwin.mesnac.anomaly.service.AbnormalBillDisposeService; -import com.foreverwin.mesnac.anomaly.service.AbnormalBillService; +import com.foreverwin.mesnac.anomaly.model.*; +import com.foreverwin.mesnac.anomaly.service.*; import com.foreverwin.mesnac.common.enums.HandleEnum; import com.foreverwin.mesnac.common.helper.NextNumberHelper; import com.foreverwin.mesnac.common.util.StringUtil; @@ -24,7 +22,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; -import java.util.List; +import java.util.*; + /** *

* 异常单 服务实现类 @@ -56,6 +55,15 @@ public class AbnormalBillServiceImpl extends ServiceImpl selectPage(FrontPage frontPage, AbnormalBill abnormalBill) { @@ -72,40 +80,156 @@ public class AbnormalBillServiceImpl extends ServiceImpl dutyCauseType, + List dutyType) { + this.generateAbnormalBill(abnormalBill,abnormalBillDispose,dutyCauseType,dutyType); + this.saveOrUpdate(abnormalBill); + abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose); + return abnormalBill.getAbnormalNo(); + } + + @Override + public String anomalyReport(AbnormalBill abnormalBill, + AbnormalBillDispose abnormalBillDispose, + List ncGroupAndNcCodes, + List dutyCauseType, + List dutyType) { + this.generateAbnormalBill(abnormalBill,abnormalBillDispose,dutyCauseType,dutyType); + //获取当前时间 + LocalDateTime now = LocalDateTime.now(); + //生成不良代码和不良代码组,并把它放到hashMap里面,ncCode是存放在异常单里面的ncCode + + List ncCode = new ArrayList<>(); + List ncGroup = new ArrayList<>(); + StringBuilder ncCodes = new StringBuilder(); + for(String ncGroupAndNcCode:ncGroupAndNcCodes){ + String[] split = ncGroupAndNcCode.split("/"); + ncGroup.add(split[0]); + ncCode.add(split[1]); + ncCodes.append(split[1]).append(","); + } + + ArrayList abnormalNcCodes = new ArrayList<>(); + for(int i = 0; i < ncGroup.size(); i ++){ + AbnormalNcCode abnormalNcCode = new AbnormalNcCode(); + //设置异常单BO + abnormalNcCode.setAbnormalBillBo(abnormalBill.getHandle()); + List abnormalNcCodes1 = abnormalNcCodeService.selectList(abnormalNcCode); + if(abnormalNcCodes1.size() != 0){ + QueryWrapper abnormalNcCodeQueryWrapper = new QueryWrapper<>(); + abnormalNcCodeQueryWrapper.setEntity(abnormalNcCode); + abnormalNcCodeService.remove(abnormalNcCodeQueryWrapper); + } + abnormalNcCode.setModifiedUser(CommonMethods.getUser()); + abnormalNcCode.setModifiedDateTime(now); + abnormalNcCode.setCreatedUser(CommonMethods.getUser()); + abnormalNcCode.setCreatedDateTime(now); + //设置HANDLE + abnormalNcCode.setHandle(UUID.randomUUID().toString()); + //设置站点 + abnormalNcCode.setSite(CommonMethods.getSite()); + //设置不合格代码组 + abnormalNcCode.setNcCodeGroup(ncGroup.get(i)); + abnormalNcCode.setNcCode(ncCode.get(i)); + abnormalNcCodes.add(abnormalNcCode); + } + abnormalNcCodeService.saveOrUpdateBatch(abnormalNcCodes); + abnormalBill.setNcCode(ncCodes.substring(0,ncCodes.length() - 1)); + this.saveOrUpdate(abnormalBill); + abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose); + return abnormalBill.getAbnormalNo(); + } + + + @Override + public String anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose) { + this.generateAbnormalBill(abnormalBill,abnormalBillDispose,null,null); this.saveOrUpdate(abnormalBill); abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose); return abnormalBill.getAbnormalNo(); } + @Override - public void generateAbnormalBill(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose) { + public void generateAbnormalBill(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose,List dutyCauseType,List dutyType) { + String site = CommonMethods.getSite(); + LocalDateTime currentTime = LocalDateTime.now(); + String user = CommonMethods.getUser(); if(StringUtil.isBlank(abnormalBill.getAbnormalNo())){ String abnormalNo = null; //生成异常单号 if("Q".equals(abnormalBill.getType())){//其他异常 - abnormalNo = nextNumberHelper.getNextNumber(abnormalBill.getSite(), "ABNORMAL_OTHER", 1, null).get(0); + abnormalNo = nextNumberHelper.getNextNumber(site, "ABNORMAL_OTHER", 1, null).get(0); }else if("Z".equals(abnormalBill.getType())){//质量异常 - abnormalNo = nextNumberHelper.getNextNumber(abnormalBill.getSite(), "ABNORMAL_QUALITY", 1, null).get(0); + abnormalNo = nextNumberHelper.getNextNumber(site, "ABNORMAL_QUALITY", 1, null).get(0); }else if("S".equals(abnormalBill.getType())){//设备异常 - abnormalNo = nextNumberHelper.getNextNumber(abnormalBill.getSite(), "ABNORMAL_DEVICE", 1, null).get(0); + abnormalNo = nextNumberHelper.getNextNumber(site, "ABNORMAL_DEVICE", 1, null).get(0); } abnormalBill.setAbnormalNo(abnormalNo); } - abnormalBill.setHandle(HandleEnum.Z_ABNORMAL_BILL.getHandle(abnormalBill.getSite(),abnormalBill.getAbnormalNo())); + abnormalBill.setHandle(HandleEnum.Z_ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo())); abnormalBillDispose.setAbnormalBillBo(abnormalBill.getHandle()); - abnormalBillDispose.setHandle(HandleEnum.Z_ABNORMAL_BILL_DISPOSE.getHandle(abnormalBill.getSite(),abnormalBill.getAbnormalNo())); + abnormalBillDispose.setHandle(HandleEnum.Z_ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo())); + - LocalDateTime currentTime = LocalDateTime.now(); - String user = CommonMethods.getUser(); //设置责任划分填报人和填报时间 abnormalBillDispose.setDutyUser(user); abnormalBillDispose.setDutyDateTime(currentTime); + ArrayList causeTypes = new ArrayList<>(); + //判断原因分类是否为空 + if(dutyCauseType != null && dutyCauseType.size() >= 1){ + for(String cause:dutyCauseType){ + AbnormalCause abnormalCause = new AbnormalCause(); + String uuid = UUID.randomUUID().toString(); + abnormalCause.setSite(site); + abnormalCause.setAbnormalBillBo(abnormalBill.getHandle()); + abnormalCause.setAbnormalBillDisposeBo(abnormalBillDispose.getHandle()); + List abnormalCauses = abnormalCauseService.selectList(abnormalCause); + if(abnormalCauses.size() != 0){ + QueryWrapper abnormalCauseQueryWrapper = new QueryWrapper<>(); + abnormalCauseQueryWrapper.setEntity(abnormalCause); + abnormalCauseService.remove(abnormalCauseQueryWrapper); + } + abnormalCause.setHandle(uuid); + abnormalCause.setAbnormalCauseNo(cause); + abnormalCause.setCreatedDateTime(currentTime); + abnormalCause.setCreatedUser(user); + abnormalCause.setModifiedUser(user); + abnormalCause.setModifiedDateTime(currentTime); + causeTypes.add(abnormalCause); + } + } + ArrayList dutyTypes = new ArrayList<>(); + //判断责任分类是否为空 + if(dutyType != null && dutyType.size() >= 1){ + for(String duty:dutyType){ + AbnormalDuty abnormalDuty = new AbnormalDuty(); + String uuid = UUID.randomUUID().toString(); + abnormalDuty.setSite(site); + abnormalDuty.setAbnormalBillBo(abnormalBill.getHandle()); + abnormalDuty.setAbnormalBillDisposeBo(abnormalBillDispose.getHandle()); + List abnormalDuties = abnormalDutyService.selectList(abnormalDuty); + if(abnormalDuties.size() != 0){ + QueryWrapper abnormalDutyQueryWrapper = new QueryWrapper<>(); + abnormalDutyQueryWrapper.setEntity(abnormalDuty); + abnormalDutyService.remove(abnormalDutyQueryWrapper); + } + abnormalDuty.setHandle(uuid); + abnormalDuty.setAbnormalDutyNo(duty); + abnormalDuty.setModifiedUser(user); + abnormalDuty.setModifiedDateTime(currentTime); + abnormalDuty.setCreatedDateTime(currentTime); + abnormalDuty.setCreatedUser(user); + dutyTypes.add(abnormalDuty); + } + } + //设置创建时间和更新时间 if(abnormalBillMapper.selectById(abnormalBill.getHandle()) == null){ abnormalBill.setCreatedDataTime(currentTime); @@ -119,24 +243,44 @@ public class AbnormalBillServiceImpl extends ServiceImpl 0){ + abnormalDutyService.saveOrUpdateBatch(dutyTypes); + } + if(causeTypes.size() > 0){ + abnormalCauseService.saveOrUpdateBatch(causeTypes); + } + } @Override diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalDutyServiceImpl.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalDutyServiceImpl.java index 1ed8b77b..3352485a 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalDutyServiceImpl.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalDutyServiceImpl.java @@ -43,4 +43,6 @@ public class AbnormalDutyServiceImpl extends ServiceImpl) - diff --git a/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java b/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java index cbe96177..64ff2733 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java @@ -20,6 +20,28 @@ public interface Constants { String RESOURCE_INSPECT_TASK = "RESOURCE_INSPECT_TASK"; String SITE_ADMIN = "SITE_ADMIN"; + //首件检验 + String INSPECTION_TYPE_S="S"; + //互检检验 + String INSPECTION_TYPE_H="H"; + //自检检验 + String INSPECTION_TYPE_Z="Z"; + //专检检验 + String INSPECTION_TYPE_P="P"; + //日常保养 + String INSPECTION_TYPE_EM="EM"; + //一级保养 + String INSPECTION_TYPE_OM="OM"; + //二级保养 + String INSPECTION_TYPE_SM="SM"; + //日点检 + String INSPECTION_TYPE_DM="DM"; + //周点检 + String INSPECTION_TYPE_WM="WM"; + //月点检 + String INSPECTION_TYPE_MM="MM"; + //年点检 + String INSPECTION_TYPE_YM="YM"; //叫料类型 String CALL_TYPE_MATERIAL = "MATERIAL"; diff --git a/equip/src/main/java/com/foreverwin/mesnac/equip/dto/ResourceInspectTaskDto.java b/equip/src/main/java/com/foreverwin/mesnac/equip/dto/ResourceInspectTaskDto.java new file mode 100644 index 00000000..fb34c083 --- /dev/null +++ b/equip/src/main/java/com/foreverwin/mesnac/equip/dto/ResourceInspectTaskDto.java @@ -0,0 +1,356 @@ +package com.foreverwin.mesnac.equip.dto; + +import com.foreverwin.mesnac.equip.model.ResourceInspectTaskParam; +import com.foreverwin.mesnac.equip.model.ResourceInspectTaskSpare; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 设备检验任务实体类 + *

+ * + * @author pavel.Liu + * @since 2021-06-24 + */ + +public class ResourceInspectTaskDto implements Serializable { + + /**序号**/ + private Integer itemSeq; + /**主键**/ + private String handle; + /**站点**/ + private String site; + /**任务编号**/ + private String taskNo; + /**类型(自动AUTO/手动)**/ + private String category; + /**任务描述**/ + private String description; + /**任务状态(新建/处理中/完成/关闭)**/ + private String status; + /**设备检验计划HANDLE**/ + private String resourceInspectPlanBo; + /**检验项目清单HANDLE**/ + private String inspectionItemBo; + /**设备HANDLE**/ + private String resourceBo; + /**检验结果**/ + private String result; + /**任务创建时间**/ + private LocalDateTime taskCreateDate; + /**计划开始时间**/ + private LocalDateTime planStartDate; + /**计划完成时间**/ + private LocalDateTime planCompleteDate; + /**实际开始时间**/ + private LocalDateTime actualStartDate; + /**实际完成时间**/ + private LocalDateTime actualCompleteDate; + /**执行人**/ + private String executor; + /**备注**/ + private String remark; + /**检索时间段的开始时间**/ + private LocalDateTime compareStartTime; + /**检索时间段的结束时间**/ + private LocalDateTime compareEndTime; + /**设备编号NO**/ + private String resourceNo; + /**设备描述**/ + private String resourceDescription; + /**设备类型编号NO**/ + private String resourceTypeNo; + /**设备类型描述**/ + private String resourceTypeDescription; + /**设备类型HANDLE**/ + private String resourceTypeBo; + /**计划编号NO**/ + private String planNo; + /**计划描述**/ + private String planDescription; + /**频率**/ + private String frequency; + /**周期单位**/ + private String frequencyUnit; + /**周期**/ + private String cycle; + /**当前用户**/ + private String currentUser; + /**车间**/ + private String workCenter; + /**任务检验项明细**/ + private List taskItemDetailList; + /**消耗备品**/ + private List taskSpareList; + + public List getTaskItemDetailList() { + return taskItemDetailList; + } + + public void setTaskItemDetailList(List taskItemDetailList) { + this.taskItemDetailList = taskItemDetailList; + } + + public List getTaskSpareList() { + return taskSpareList; + } + + public void setTaskSpareList(List taskSpareList) { + this.taskSpareList = taskSpareList; + } + + public ResourceInspectTaskDto() { + } + + public String getResourceNo() { + return resourceNo; + } + + public void setResourceNo(String resourceNo) { + this.resourceNo = resourceNo; + } + + public String getResourceDescription() { + return resourceDescription; + } + + public void setResourceDescription(String resourceDescription) { + this.resourceDescription = resourceDescription; + } + + public String getPlanNo() { + return planNo; + } + + public void setPlanNo(String planNo) { + this.planNo = planNo; + } + + public String getPlanDescription() { + return planDescription; + } + + public void setPlanDescription(String planDescription) { + this.planDescription = planDescription; + } + + public String getCycle() { + return cycle; + } + + public void setCycle(String cycle) { + this.cycle = cycle; + } + + public String getFrequency() { + return frequency; + } + + public void setFrequency(String frequency) { + this.frequency = frequency; + } + + public String getFrequencyUnit() { + return frequencyUnit; + } + + public void setFrequencyUnit(String frequencyUnit) { + this.frequencyUnit = frequencyUnit; + } + + public String getHandle() { + return handle; + } + + public void setHandle(String handle) { + this.handle = handle; + } + + public String getSite() { + return site; + } + + public void setSite(String site) { + this.site = site; + } + + public String getTaskNo() { + return taskNo; + } + + public void setTaskNo(String taskNo) { + this.taskNo = taskNo; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getResourceInspectPlanBo() { + return resourceInspectPlanBo; + } + + public void setResourceInspectPlanBo(String resourceInspectPlanBo) { + this.resourceInspectPlanBo = resourceInspectPlanBo; + } + + public String getInspectionItemBo() { + return inspectionItemBo; + } + + public void setInspectionItemBo(String inspectionItemBo) { + this.inspectionItemBo = inspectionItemBo; + } + + public String getResourceBo() { + return resourceBo; + } + + public void setResourceBo(String resourceBo) { + this.resourceBo = resourceBo; + } + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } + + public LocalDateTime getTaskCreateDate() { + return taskCreateDate; + } + + public void setTaskCreateDate(LocalDateTime taskCreateDate) { + this.taskCreateDate = taskCreateDate; + } + + public LocalDateTime getPlanStartDate() { + return planStartDate; + } + + public void setPlanStartDate(LocalDateTime planStartDate) { + this.planStartDate = planStartDate; + } + + public LocalDateTime getPlanCompleteDate() { + return planCompleteDate; + } + + public void setPlanCompleteDate(LocalDateTime planCompleteDate) { + this.planCompleteDate = planCompleteDate; + } + + public LocalDateTime getActualStartDate() { + return actualStartDate; + } + + public void setActualStartDate(LocalDateTime actualStartDate) { + this.actualStartDate = actualStartDate; + } + + public LocalDateTime getActualCompleteDate() { + return actualCompleteDate; + } + + public void setActualCompleteDate(LocalDateTime actualCompleteDate) { + this.actualCompleteDate = actualCompleteDate; + } + + public String getExecutor() { + return executor; + } + + public void setExecutor(String executor) { + this.executor = executor; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public LocalDateTime getCompareStartTime() { + return compareStartTime; + } + + public void setCompareStartTime(LocalDateTime compareStartTime) { + this.compareStartTime = compareStartTime; + } + + public LocalDateTime getCompareEndTime() { + return compareEndTime; + } + + public void setCompareEndTime(LocalDateTime compareEndTime) { + this.compareEndTime = compareEndTime; + } + + public String getCurrentUser() { + return currentUser; + } + + public void setCurrentUser(String currentUser) { + this.currentUser = currentUser; + } + + public String getResourceTypeNo() { + return resourceTypeNo; + } + + public void setResourceTypeNo(String resourceTypeNo) { + this.resourceTypeNo = resourceTypeNo; + } + + public String getResourceTypeDescription() { + return resourceTypeDescription; + } + + public void setResourceTypeDescription(String resourceTypeDescription) { + this.resourceTypeDescription = resourceTypeDescription; + } + + public String getResourceTypeBo() { + return resourceTypeBo; + } + + public void setResourceTypeBo(String resourceTypeBo) { + this.resourceTypeBo = resourceTypeBo; + } + + public String getWorkCenter() { + return workCenter; + } + + public void setWorkCenter(String workCenter) { + this.workCenter = workCenter; + } +} \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/NcCodeController.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/NcCodeController.java index 76049349..c93c7c9c 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/NcCodeController.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/NcCodeController.java @@ -46,6 +46,8 @@ public class NcCodeController { public R getNcCodeList(NcCode ncCode){ List result; QueryWrapper queryWrapper = new QueryWrapper<>(); + String site = CommonMethods.getSite(); + ncCode.setSite(site); queryWrapper.setEntity(ncCode); result = ncCodeService.list(queryWrapper); return R.ok(result); diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/NcGroupController.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/NcGroupController.java index 6cc7e6ba..0c2672ab 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/NcGroupController.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/NcGroupController.java @@ -46,6 +46,8 @@ public class NcGroupController { public R getNcGroupList(NcGroup ncGroup){ List result; QueryWrapper queryWrapper = new QueryWrapper<>(); + String site = CommonMethods.getSite(); + ncGroup.setSite(site); queryWrapper.setEntity(ncGroup); result = ncGroupService.list(queryWrapper); return R.ok(result); diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/SfcController.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/SfcController.java index 10421d8d..3199bd5a 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/SfcController.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/SfcController.java @@ -62,7 +62,28 @@ public class SfcController { result = sfcService.list(queryWrapper); return R.ok(result); } + /** + * 分页查询数据 + * + * @param frontPage 分页信息 + * @return + */ + @ResponseBody + @GetMapping("/pageByResrce") + public R page(FrontPage frontPage, SfcDto sfc){ + IPage result; + try { + String site = CommonMethods.getSite(); + sfc.setSite(site); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(sfc); + result = sfcService.pageByResrce(frontPage.getPagePlus(), queryWrapper); + } catch (Exception e) { + return R.failed(e.getMessage()); + } + return R.ok(result); + } /** * 分页查询数据 * diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/OperationMapper.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/OperationMapper.java index fd171b67..612d7b3e 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/OperationMapper.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/OperationMapper.java @@ -23,4 +23,6 @@ public interface OperationMapper extends BaseMapper { Operation selectOperationBySfcBo(@Param("sfcBo") String sfcBo, @Param("locale") String locale); + Operation getCurrentRevisionRef(@Param("site") String site, @Param("operation") String operation); + } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/SfcMapper.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/SfcMapper.java index 42dfb822..021b01b0 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/SfcMapper.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/SfcMapper.java @@ -1,5 +1,8 @@ package com.foreverwin.mesnac.meapi.mapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.foreverwin.mesnac.meapi.dto.SfcDto; import com.foreverwin.mesnac.meapi.model.Sfc; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -24,4 +27,8 @@ public interface SfcMapper extends BaseMapper { List getSfcListByResrceBO(String resrceBO); SfcDto findSfcData(@Param("site") String site, @Param("sfc") String sfc); + + Sfc findBySfc(@Param("sfc") Sfc sfc); + + IPage pageByResrce(Page pagePlus,@Param("ew") QueryWrapper queryWrapper,@Param("locale")String locale); } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/OperationService.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/OperationService.java index 6903de18..35342dfe 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/OperationService.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/OperationService.java @@ -26,4 +26,6 @@ public interface OperationService extends IService { IPage selectPage(Page page, QueryWrapper operation); List selectList(Operation operation); + + Operation getCurrentRevisionRef(String site, String operation); } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/SfcService.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/SfcService.java index be4a8471..c89430ad 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/SfcService.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/SfcService.java @@ -1,7 +1,10 @@ package com.foreverwin.mesnac.meapi.service; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; import com.foreverwin.mesnac.meapi.dto.SfcDto; import com.foreverwin.mesnac.meapi.model.Sfc; import com.foreverwin.modular.core.util.FrontPage; @@ -17,6 +20,7 @@ import java.util.List; * @since 2021-06-02 */ public interface SfcService extends IService { + IPage pageByResrce(Page pagePlus, QueryWrapper queryWrapper); /** * 分页查询 @@ -45,4 +49,5 @@ public interface SfcService extends IService { * @return */ SfcDto findSfcData(String site, String sfc); + } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/OperationServiceImpl.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/OperationServiceImpl.java index 0429f6e2..71b6d230 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/OperationServiceImpl.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/OperationServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.foreverwin.mesnac.meapi.mapper.OperationMapper; import com.foreverwin.mesnac.meapi.model.Operation; import com.foreverwin.mesnac.meapi.service.OperationService; +import com.foreverwin.modular.core.exception.BaseException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Service; @@ -46,5 +47,14 @@ public class OperationServiceImpl extends ServiceImpl implements SfcSe @Autowired private SfcMapper sfcMapper; + @Override + public IPage pageByResrce(Page pagePlus, QueryWrapper queryWrapper) { + return sfcMapper.pageByResrce(pagePlus, queryWrapper, LocaleContextHolder.getLocale().getLanguage()); + } + @Override public IPage selectPage(FrontPage frontPage, Sfc sfc) { QueryWrapper queryWrapper = new QueryWrapper<>(); diff --git a/meapi/src/main/resources/mapper/NcCodeMapper.xml b/meapi/src/main/resources/mapper/NcCodeMapper.xml index cc3dc449..c68db60d 100644 --- a/meapi/src/main/resources/mapper/NcCodeMapper.xml +++ b/meapi/src/main/resources/mapper/NcCodeMapper.xml @@ -183,12 +183,12 @@ AND DPMO_CATEGORY_BO=#{ew.entity.dpmoCategoryBo} - ${ew.sqlSegment} + AND ${ew.sqlSegment} - ${ew.sqlSegment} + AND ${ew.sqlSegment} diff --git a/meapi/src/main/resources/mapper/NcGroupMapper.xml b/meapi/src/main/resources/mapper/NcGroupMapper.xml index 8307268b..9ce975bc 100644 --- a/meapi/src/main/resources/mapper/NcGroupMapper.xml +++ b/meapi/src/main/resources/mapper/NcGroupMapper.xml @@ -180,12 +180,12 @@ AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime} - ${ew.sqlSegment} + AND ${ew.sqlSegment} - ${ew.sqlSegment} + AND ${ew.sqlSegment} diff --git a/meapi/src/main/resources/mapper/OperationMapper.xml b/meapi/src/main/resources/mapper/OperationMapper.xml index f2506945..83ba455f 100644 --- a/meapi/src/main/resources/mapper/OperationMapper.xml +++ b/meapi/src/main/resources/mapper/OperationMapper.xml @@ -598,11 +598,21 @@ + + diff --git a/meapi/src/main/resources/mapper/SfcMapper.xml b/meapi/src/main/resources/mapper/SfcMapper.xml index 480f8b26..6e535505 100644 --- a/meapi/src/main/resources/mapper/SfcMapper.xml +++ b/meapi/src/main/resources/mapper/SfcMapper.xml @@ -663,4 +663,12 @@ LEFT JOIN OPERATION_T OTT ON SPLIT(OTT.OPERATION_BO,2) = ZSD.PREPOSITION_OPERATION AND OTT.LOCALE = 'zh' WHERE SC.SITE = #{site} AND SC.SFC = #{sfc} + + diff --git a/production/src/main/java/com/foreverwin/mesnac/production/controller/PodTemplateController.java b/production/src/main/java/com/foreverwin/mesnac/production/controller/PodTemplateController.java index 05f1e4d6..0e34c706 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/controller/PodTemplateController.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/controller/PodTemplateController.java @@ -9,6 +9,9 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; + @Controller @RequestMapping("/sfcDataMains") public class PodTemplateController { @@ -37,4 +40,27 @@ public class PodTemplateController { public R sfcEnter(SfcDto sfcDto) { return R.ok(podTemplateService.sfcEnter(sfcDto)); } + + /** + * sfc开始 + * @param sfcDtoList + * @return + */ + @ResponseBody + @GetMapping("/sfcStart") + public R sfcStart(List sfcDtoList) { + podTemplateService.sfcStart(sfcDtoList); + return R.ok(); + } + + /** + * 生产操作员面板工作列表 + * @param sfcDto + * @return + */ + @ResponseBody + @GetMapping("/getSfcInfo") + public R getSfcInfo(SfcDto sfcDto) { + return R.ok(podTemplateService.getSfcInfo(sfcDto)); + } } diff --git a/production/src/main/java/com/foreverwin/mesnac/production/mapper/SfcCrossMapper.java b/production/src/main/java/com/foreverwin/mesnac/production/mapper/SfcCrossMapper.java index 72bc3622..09244b09 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/mapper/SfcCrossMapper.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/mapper/SfcCrossMapper.java @@ -39,8 +39,6 @@ public interface SfcCrossMapper extends BaseMapper { */ List findRouterOperationByRouterBo(@Param("site") String site, @Param("routerBo") String routerBo, @Param("locale") String locale); -// String getDoneSfcItemBo(IPage page, @Param("dataAttr") String dataAttr, -// @Param("site") String site, @Param("statusBo") String statusBo); /** @@ -60,7 +58,6 @@ public interface SfcCrossMapper extends BaseMapper { List findShopOrderListByStatus(@Param("plannedWorkCenterBo") String plannedWorkCenterBo, @Param("status") String customStatus); - //List> findSfcListBySnList(@Param("site") String site, @Param("snList") List snList); /** * 查找工艺路线的最后一道工序 @@ -93,5 +90,7 @@ public interface SfcCrossMapper extends BaseMapper { Map querySfcData(@Param("site")String site, @Param("locale")String locale, @Param("dto")SfcDto sfcDto); - List> querySfcStep(@Param("site")String site, @Param("sfc")String sfc, @Param("operation")String operation); + Map getSfcInfo(@Param("site")String site, @Param("sfc")String sfc, @Param("operation")String operation); + + Integer getSfcDispatch(@Param("site") String site, @Param("sfc") String sfc, @Param("operation") String operation, @Param("stepId") String stepId,@Param("resrce")String resrce); } diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/PodTemplateService.java b/production/src/main/java/com/foreverwin/mesnac/production/service/PodTemplateService.java index de7e633e..b2200c76 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/service/PodTemplateService.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/PodTemplateService.java @@ -3,10 +3,15 @@ package com.foreverwin.mesnac.production.service; import com.foreverwin.mesnac.meapi.dto.SfcDto; import com.foreverwin.mesnac.meapi.dto.WorkCenterDto; +import java.util.List; import java.util.Map; public interface PodTemplateService { Map resrceEnter(WorkCenterDto workCenterDto); Map sfcEnter(SfcDto workCenterDto); + + Object getSfcInfo(SfcDto sfcDto); + + void sfcStart(List sfcDto); } diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/SfcCrossService.java b/production/src/main/java/com/foreverwin/mesnac/production/service/SfcCrossService.java new file mode 100644 index 00000000..e8f33804 --- /dev/null +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/SfcCrossService.java @@ -0,0 +1,44 @@ +package com.foreverwin.mesnac.production.service; + +import java.math.BigDecimal; + +/** + * 描述: 工序开始 + * 作者: philip + * 时间: 2021-6-30 + */ +public interface SfcCrossService { + /** + * 开始 + * @param site + * @param operationRef + * @param resource + * @param sfcRef + * @param qty + * @throws Exception + */ + void startAction(String site, String operationRef, String resource, String sfcRef, BigDecimal qty) throws Exception; + + /** + * 完成 + * @param site + * @param operationRef + * @param resource + * @param sfcRef + * @param qty + * @throws Exception + */ + void completeAction(String site, String operationRef, String resource, String sfcRef, BigDecimal qty) throws Exception; + + /** + * 开始完成单个SFC + * @param site + * @param operationRef + * @param resource + * @param sfcRef + * @param qty + * @throws Exception + */ + void passAction(String site, String operationRef, String resource, String sfcRef, BigDecimal qty) throws Exception; + +} diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java index ae844a1b..e2f1567f 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java @@ -2,16 +2,19 @@ package com.foreverwin.mesnac.production.service.impl; import com.foreverwin.mesnac.common.enums.HandleEnum; import com.foreverwin.mesnac.common.service.CommonService; +import com.foreverwin.mesnac.common.util.ExceptionUtil; import com.foreverwin.mesnac.common.util.StringUtil; import com.foreverwin.mesnac.meapi.dto.SfcDto; import com.foreverwin.mesnac.meapi.dto.WorkCenterDto; import com.foreverwin.mesnac.meapi.model.Operation; import com.foreverwin.mesnac.meapi.model.Resrce; import com.foreverwin.mesnac.meapi.model.Sfc; +import com.foreverwin.mesnac.meapi.service.OperationService; import com.foreverwin.mesnac.meapi.service.ResrceService; import com.foreverwin.mesnac.meapi.service.SfcService; import com.foreverwin.mesnac.production.mapper.SfcCrossMapper; import com.foreverwin.mesnac.production.service.PodTemplateService; +import com.foreverwin.mesnac.production.service.SfcCrossService; import com.foreverwin.modular.core.exception.BaseException; import com.foreverwin.modular.core.util.CommonMethods; import org.springframework.beans.factory.annotation.Autowired; @@ -19,6 +22,8 @@ import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -35,24 +40,27 @@ public class PodTemplateServiceImpl implements PodTemplateService { private CommonService commonService; @Autowired private SfcCrossMapper sfcCrossMapper; - + @Autowired + private SfcCrossService sfcCrossService; + @Autowired + private OperationService operationService; @Override public Map resrceEnter(WorkCenterDto workCenterDto) { String site = CommonMethods.getSite(); String resrce = workCenterDto.getResrce(); String resrceBO = HandleEnum.RESOURCE.getHandle(site, resrce); Resrce model = resrceService.getById(resrceBO); - if (model==null){ - throw new BaseException("资源 "+resrce+" 不存在"); + if (model == null) { + throw new BaseException("资源 " + resrce + " 不存在"); } String workCenter = workCenterDto.getWorkCenter(); //校验 String workShopBo = commonService.getWorkShopBo(resrceBO); - if (StringUtil.isBlank(workShopBo)){ - throw new BaseException("资源 "+resrce+" 未匹配到车间"); + if (StringUtil.isBlank(workShopBo)) { + throw new BaseException("资源 " + resrce + " 未匹配到车间"); } - if (!workCenter.equals(StringUtil.trimHandle(workShopBo))){ - throw new BaseException("资源 "+resrce+" 与车间不匹配"); + if (!workCenter.equals(StringUtil.trimHandle(workShopBo))) { + throw new BaseException("资源 " + resrce + " 与车间不匹配"); } //查询在该设备存在活动中的SFC @@ -70,26 +78,36 @@ public class PodTemplateServiceImpl implements PodTemplateService { String sfc = sfcDto.getSfc(); String operation = sfcDto.getOperation(); String locale = LocaleContextHolder.getLocale().getLanguage(); + String resrce = sfcDto.getResrce(); //校验产品条码是否存在 Sfc sfcById = sfcService.getById(HandleEnum.SFC.getHandle(site, sfc)); - if (sfcById==null){ - throw new BaseException("产品条码"+sfc+"不存在"); + if (sfcById == null) { + throw new BaseException("产品条码" + sfc + "不存在"); + } + String status = StringUtil.trimHandle(sfcById.getStatusBo()); + if (!status.equals("403") && !status.equals("401") && !status.equals("402")) { + throw new BaseException("产品条码" + sfc + "不在工作中或排队中"); } //校验产品条码是否在当前工序排队 Operation operationBySfcBo = commonService.getOperationBySfcBo(sfcById.getHandle()); - if (StringUtil.notBlank(operation)&&!operationBySfcBo.getOperation().equals(operation)){ + /* if (StringUtil.notBlank(operation)&&!operationBySfcBo.getOperation().equals(operation)){ throw new BaseException("产品条码"+sfc+"在"+operationBySfcBo.getOperation()+"/"+operationBySfcBo.getDescription()+"工序"); - } + }*/ //校验SFC+工序+设备+STEP_ID是否与当前设备确认的派工单匹配 + Integer integer = sfcCrossMapper.getSfcDispatch(site, sfc, operationBySfcBo.getOperation(), operationBySfcBo.getStepId(), resrce); + if (integer < 1) { + throw new BaseException("产品条码与当前设备工序确认的派工单不匹配"); + } String substep = ""; String substepHandle = ""; //构造前台所需要的数据 - Map resultMap = sfcCrossMapper.querySfcData(site,locale,sfcDto); - if(resultMap == null){ + Map resultMap = sfcCrossMapper.querySfcData(site, locale, sfcDto); + if (resultMap == null) { throw new BaseException("根据当前资源未找到条码[" + sfc + "]的基本信息!"); } - List> substepList = sfcCrossMapper.querySfcStep(site, sfc, operation); + //List> substepList = sfcCrossMapper.querySfcStep(site, sfc, operationBySfcBo.getOperation()); + List> substepList = new ArrayList<>(); resultMap.put("SFC_STEP_LIST", substepList); String stepId = (String) resultMap.get("STEP_ID"); @@ -194,6 +212,33 @@ public class PodTemplateServiceImpl implements PodTemplateService { }*/ resultMap.put("IS_CREATE_H", isCreateH); resultMap.put("IS_CREATE_Z", isCreateZ); - return null; + return resultMap; + } + + @Override + public Object getSfcInfo(SfcDto sfcDto) { + String site = CommonMethods.getSite(); + String operation = sfcDto.getOperation(); + String sfc = sfcDto.getSfc(); + Map substepList = sfcCrossMapper.getSfcInfo(site, sfc, operation); + return substepList; + } + + @Override + public void sfcStart(List sfcDtoList) { + sfcDtoList.forEach(sfcDto -> { + String site = CommonMethods.getSite(); + String operation = sfcDto.getOperation(); + Operation currentRevisionRef = operationService.getCurrentRevisionRef(site, operation); + String resrce = sfcDto.getResrce(); + String sfc = sfcDto.getSfc(); + Sfc sfcServiceById = sfcService.getById(HandleEnum.SFC.getHandle(sfc, sfc)); + BigDecimal qty=new BigDecimal(sfcServiceById.getQty().toString()); + try { + sfcCrossService.startAction(site, currentRevisionRef.getHandle(),resrce,sfcServiceById.getHandle(),qty); + } catch (Exception e) { + ExceptionUtil.throwException(e); + } + }); } } diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SfcCrossServiceImpl.java b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SfcCrossServiceImpl.java new file mode 100644 index 00000000..5b868a2f --- /dev/null +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SfcCrossServiceImpl.java @@ -0,0 +1,64 @@ +package com.foreverwin.mesnac.production.service.impl; + + +import com.foreverwin.mesnac.production.service.SfcCrossService; +import com.foreverwin.modular.core.meext.MEServices; +import com.foreverwin.modular.core.util.CommonMethods; +import com.sap.me.plant.ResourceBOHandle; +import com.sap.me.production.*; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; + +/** + * 描述: 工序开始 + * 作者: philip + * 时间: 2021-06-30 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class SfcCrossServiceImpl implements SfcCrossService { + + @Override + public void startAction(String site, String operationRef, + String resource, String sfcRef, BigDecimal qty) throws Exception { + SfcStartServiceInterface sfcStartService = MEServices.create("com.sap.me.production", "SfcStartService", site); + StartSfcRequest paramStartSfcRequest = new StartSfcRequest(); + paramStartSfcRequest.setQty(qty); + paramStartSfcRequest.setOperationRef(operationRef); + paramStartSfcRequest.setResourceRef(new ResourceBOHandle(site, resource).getValue()); + paramStartSfcRequest.setSfcRef(sfcRef); + paramStartSfcRequest.setUserRef(CommonMethods.getUserBo()); + sfcStartService.startSfc(paramStartSfcRequest); + } + + @Override + public void completeAction(String site, String operationRef, + String resource, String sfcRef, BigDecimal qty) throws Exception { + SfcCompleteServiceInterface sfcCompleteService = MEServices.create("com.sap.me.production", "SfcCompleteService", site); + CompleteSfcRequest paramCompleteSfcRequest = new CompleteSfcRequest(); + paramCompleteSfcRequest.setOperationRef(operationRef); + paramCompleteSfcRequest.setResourceRef(new ResourceBOHandle(site, resource).getValue()); + paramCompleteSfcRequest.setSfcRef(sfcRef); + if(qty != null) { + paramCompleteSfcRequest.setQuantity(qty); + } + paramCompleteSfcRequest.setLocation(""); + sfcCompleteService.completeSfc(paramCompleteSfcRequest); + } + + @Override + public void passAction(String site, String operationRef, + String resource, String sfcRef, BigDecimal qty) throws Exception { + SfcCompleteServiceInterface sfcCompleteService = MEServices.create("com.sap.me.production", "SfcCompleteService", site); + CompleteSfcQuickRequest paramCompleteSfcRequest = new CompleteSfcQuickRequest(); + paramCompleteSfcRequest.setOperationRef(operationRef); + paramCompleteSfcRequest.setResourceRef(new ResourceBOHandle(site, resource).getValue()); + paramCompleteSfcRequest.setSfcRef(sfcRef); + if(qty != null) { + paramCompleteSfcRequest.setQuantity(qty); + } + sfcCompleteService.completeSfcQuick(paramCompleteSfcRequest); + } +} diff --git a/production/src/main/resources/mapper/SfcCrossMapper.xml b/production/src/main/resources/mapper/SfcCrossMapper.xml index 88d69a6c..d90b0ea9 100644 --- a/production/src/main/resources/mapper/SfcCrossMapper.xml +++ b/production/src/main/resources/mapper/SfcCrossMapper.xml @@ -139,8 +139,8 @@ WHERE sfc.site = #{site} and RO_CF2.VALUE TOOL ,SOD.HANDLE SFC_DISPATCH_DETAIL_BO, S.SFC,S.QTY SFC_QTY,RS.STEP_ID, SOD.DISPATCH_NO , TO_CHAR( SOD.PLANNED_START_DATE + INTERVAL '8' HOUR,'yyyy-mm-dd hh24:mi:ss')START_DATE, - TO_CHAR(SOD.PLANNED_COMPLETE_DATE + INTERVAL '8' HOUR ,'yyyy-mm-dd hh24:mi:ss')COMP_DATE, - TO_CHAR((SOD.PLANNED_COMPLETE_DATE - SOD.PLANNED_START_DATE )*24,'fm9999999990.00')||'H' ADD_DATE, + TO_CHAR(SOD.PLANNED_COMP_DATE + INTERVAL '8' HOUR ,'yyyy-mm-dd hh24:mi:ss')COMP_DATE, + TO_CHAR((SOD.PLANNED_COMP_DATE - SOD.PLANNED_START_DATE )*24,'fm9999999990.00')||'H' ADD_DATE, CASE WHEN OT.DESCRIPTION LIKE 'CH%' THEN SUBSTR(OT.DESCRIPTION, 0, 3) ELSE N'' END SLOT FROM SFC S INNER JOIN STATUS ST ON ST.HANDLE = S.STATUS_BO @@ -159,7 +159,7 @@ WHERE sfc.site = #{site} and INNER JOIN ITEM I ON I.HANDLE = S.ITEM_BO LEFT JOIN ITEM_T IT ON IT.ITEM_BO = I.HANDLE AND IT.LOCALE =#{locale} INNER JOIN ( - SELECT SD.HANDLE, SD.SFC,SD.RESRCE,SD.OPERATION,SD.STEP_ID,SD.PLANNED_COMPLETE_DATE, SD.PLANNED_START_DATE,SD.DISPATCH_NO + SELECT SD.HANDLE, SD.SFC,SD.RESRCE,SD.OPERATION,SD.STEP_ID,SD.PLANNED_COMP_DATE, SD.PLANNED_START_DATE,SD.DISPATCH_NO FROM Z_PROD_READY_TASK RB INNER JOIN Z_SFC_DISPATCH SD ON SD.HANDLE = RB.SFC_DISPATCH_BO WHERE RB.SITE =#{site} AND RB.STATUS = 'F' @@ -170,42 +170,28 @@ WHERE sfc.site = #{site} and OP.OPERATION, OT.DESCRIPTION ,OP.OPERATION||'/'||RS.STEP_ID ,RO_CF2.VALUE, S.SFC,S.QTY ,RS.STEP_ID,SOD.DISPATCH_NO , SOD.HANDLE , TO_CHAR( SOD.PLANNED_START_DATE + INTERVAL '8' HOUR,'yyyy-mm-dd hh24:mi:ss'), - TO_CHAR(SOD.PLANNED_COMPLETE_DATE + INTERVAL '8' HOUR,'yyyy-mm-dd hh24:mi:ss'), - TO_CHAR((SOD.PLANNED_COMPLETE_DATE - SOD.PLANNED_START_DATE )*24,'fm9999999990.00')||'H', + TO_CHAR(SOD.PLANNED_COMP_DATE + INTERVAL '8' HOUR,'yyyy-mm-dd hh24:mi:ss'), + TO_CHAR((SOD.PLANNED_COMP_DATE - SOD.PLANNED_START_DATE )*24,'fm9999999990.00')||'H', CASE WHEN OT.DESCRIPTION LIKE 'CH%' THEN SUBSTR(OT.DESCRIPTION, 0, 3) ELSE N'' END - + SELECT O.OPERATION,SSTEP.STEP_ID,IT.DESCRIPTION,S.SFC,S.QTY, + CASE WHEN SSTEP.QTY_IN_WORK > 0 THEN '工作中' + WHEN SSTEP.QTY_IN_QUEUE > 0 THEN '排队中' + ELSE '新建' END STEP_STATUS + FROM SFC S + LEFT JOIN ITEM_T IT ON S.ITEM_BO=IT.HANDLE AND IT.LOCALE='zh' + INNER JOIN SFC_ROUTING SRI ON S.HANDLE=SRI.SFC_BO + INNER JOIN SFC_ROUTER SR ON SRI.HANDLE=SR.SFC_ROUTING_BO AND SR.IN_USE='true' + INNER JOIN ROUTER_STEP RS ON RS.ROUTER_BO=sr.ROUTER_BO + INNER JOIN SFC_STEP SSTEP ON SSTEP.SFC_ROUTER_BO=SR.HANDLE AND RS.STEP_ID= SSTEP.STEP_ID + AND (SSTEP.QTY_IN_QUEUE > 0 OR SSTEP.QTY_IN_WORK > 0) + INNER JOIN STATUS ST ON ST.HANDLE = S.STATUS_BO + INNER JOIN OPERATION O ON O.OPERATION=SPLIT(SSTEP.OPERATION_BO,2) AND O.SITE=S.SITE AND O.CURRENT_REVISION = 'true' + AND #{operation} = O.OPERATION + WHERE S.SFC=#{sfc} AND S.SITE=#{site} + +