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 aa5a6acf..83ccdbc6 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 @@ -217,7 +217,11 @@ public class AbnormalBillController { @RequestParam List ncGroupAndNcCodes, @RequestParam List dutyCauseType, @RequestParam List dutyType){ - return R.ok(abnormalBillService.anomalyReport(abnormalBill, abnormalBillDispose,ncGroupAndNcCodes,dutyCauseType,dutyType)); + try{ + return R.ok(abnormalBillService.anomalyReport(abnormalBill, abnormalBillDispose,ncGroupAndNcCodes,dutyCauseType,dutyType)); + }catch(Exception e){ + return R.failed("质量异常提报失败,"+e.getMessage()); + } } /** @@ -227,7 +231,12 @@ public class AbnormalBillController { */ @GetMapping("/anomalyReportDevice") public R anomalyReportDevice(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose){ - return R.ok(abnormalBillService.anomalyReportDevice(abnormalBill,abnormalBillDispose)); + try{ + return R.ok(abnormalBillService.anomalyReportDevice(abnormalBill,abnormalBillDispose)); + }catch (Exception e){ + return R.failed("设备异常提报失败,"+e.getMessage()); + } + } @@ -239,12 +248,21 @@ public class AbnormalBillController { */ @GetMapping("/cancelBrowse") public R cancelBrowse(String handle, String cancelBrowse,String code,String cancelSendUserGroup){ - return R.ok( abnormalBillService.cancelBrowse(handle,cancelBrowse,code,cancelSendUserGroup)); + try{ + return R.ok( abnormalBillService.cancelBrowse(handle,cancelBrowse,code,cancelSendUserGroup)); + }catch(Exception e){ + return R.failed("取消失败,"+e.getMessage()); + } } @GetMapping("/backLog") public R backLog(AbnormalBillDto abnormalBillDto){ - return R.ok(abnormalBillService.backLog(abnormalBillDto)); + try{ + return R.ok(abnormalBillService.backLog(abnormalBillDto)); + }catch(Exception e){ + return R.failed("检索失败,"+e.getMessage()); + } + } /** @@ -254,7 +272,12 @@ public class AbnormalBillController { */ @GetMapping("/findAllByAbnormalNo") public R findAllByAbnormalNo(AbnormalBill abnormalBill){ - return R.ok(abnormalBillService.findAllByAbnormalNo(abnormalBill)); + try{ + return R.ok(abnormalBillService.findAllByAbnormalNo(abnormalBill)); + }catch (Exception e){ + return R.failed("检索失败,"+e.getMessage()); + } + } /** @@ -262,7 +285,12 @@ public class AbnormalBillController { */ @GetMapping("/findAllByAbnormalNoDevice") public R findAllByAbnormalNoDevice(AbnormalBill abnormalBill){ - return R.ok(abnormalBillService.findAllByAbnormalNoDevice(abnormalBill)); + try{ + return R.ok(abnormalBillService.findAllByAbnormalNoDevice(abnormalBill)); + }catch (Exception e){ + return R.failed("设备异常响应检索失败,"+e.getMessage()); + } + } /** @@ -272,8 +300,12 @@ public class AbnormalBillController { */ @GetMapping("/resProcessing") public R resProcessing(AbnormalBill abnormalBill){ - abnormalBillService.resProcessing(abnormalBill); - return R.ok(); + try{ + abnormalBillService.resProcessing(abnormalBill); + return R.ok(); + }catch(Exception e){ + return R.failed("响应处理失败,"+e.getMessage()); + } } /** @@ -284,8 +316,12 @@ public class AbnormalBillController { */ @GetMapping("/programConfirm") public R programConfirm(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose){ - abnormalBillService.programConfirm(abnormalBill,abnormalBillDispose); - return R.ok(); + try{ + abnormalBillService.programConfirm(abnormalBill,abnormalBillDispose); + return R.ok(); + }catch (Exception e){ + return R.failed("方案确认失败,"+e.getMessage()); + } } /** @@ -298,8 +334,12 @@ public class AbnormalBillController { public R dutyConfirm(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose, @RequestParam List dutyCauseType, @RequestParam List dutyType){ - abnormalBillService.dutyConfirm(abnormalBill,abnormalBillDispose,dutyCauseType,dutyType); - return R.ok(); + try{ + abnormalBillService.dutyConfirm(abnormalBill,abnormalBillDispose,dutyCauseType,dutyType); + return R.ok(); + }catch(Exception e){ + return R.failed("判责提交失败,"+e.getMessage()); + } } /** @@ -310,25 +350,42 @@ public class AbnormalBillController { */ @GetMapping("/anomalyShutDown") public R anomalyShutDown(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose){ - abnormalBillService.anomalyShutDown(abnormalBill,abnormalBillDispose); - return R.ok(); + try{ + abnormalBillService.anomalyShutDown(abnormalBill,abnormalBillDispose); + return R.ok(); + }catch (Exception e){ + return R.failed("闭环关闭失败,"+e.getMessage()); + } + } @GetMapping("/findResrceBySfc") public R findResrceBySfc(SfcDispatchDto sfcDispatch){ - return R.ok(sfcDispatchCommonService.findResrceBySfc(sfcDispatch)); + try{ + return R.ok(sfcDispatchCommonService.findResrceBySfc(sfcDispatch)); + }catch (Exception e){ + return R.failed("根据sfc查找设备失败,"+e.getMessage()); + } } @GetMapping("/show") public R showFile(HttpServletRequest request, HttpServletResponse response) throws Exception { - return R.ok(fileUploadedService.showFile(request,response)); + try{ + return R.ok(fileUploadedService.showFile(request,response)); + }catch (Exception e){ + return R.failed("显示图片失败,"+e.getMessage()); + } + } @PostMapping("/delete") public R delete(String ftpPath,String fileName){ - fileUploadedService.deleteFile(ftpPath,fileName); -// abnormalBillService.deleteFileInDatabase(ftpPath,fileName); - return R.ok(); + try{ + fileUploadedService.deleteFile(ftpPath,fileName); + return R.ok(); + }catch (Exception e){ + return R.failed("图片删除失败,"+e.getMessage()); + } } @GetMapping("/findUploadPictureByAbnormalBo") diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/ReportController.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/ReportController.java index 511b2638..c01e2eba 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/ReportController.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/ReportController.java @@ -52,6 +52,20 @@ public class ReportController { } } + /** + * 设备维修记录报表 + * @param map + * @return + */ + @PostMapping("/resourceRepair") + public R resourceRepair(@RequestBody(required = false)Map map){ + try{ + return R.ok(reportService.resourceRepair(map)); + }catch (Exception e){ + return R.failed(e.getMessage()); + } + } + /** * 查询质量检验任务 * diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/ReportMapper.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/ReportMapper.java index 2f4ea858..3359b7af 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/ReportMapper.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/ReportMapper.java @@ -24,6 +24,9 @@ public interface ReportMapper { List> surplusReturnTable(@Param("site")String site, @Param("locale")String locale, @Param("item")String item, @Param("itemDescription")String itemDescription); + List> resourceRepair(@Param("site")String site, @Param("locale")String locale, + @Param("param")Map map); + List> findInspectionTask(Map paramMap); } diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/ReportService.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/ReportService.java index 96876fbb..30c09128 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/ReportService.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/ReportService.java @@ -19,6 +19,8 @@ public interface ReportService { List> surplusReturnTable(String item, String itemDescription); + List> resourceRepair(Map map); + /** * 查询质量检验任务 * diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/ReportServiceImpl.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/ReportServiceImpl.java index 31d6aaa5..0ca38386 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/ReportServiceImpl.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/ReportServiceImpl.java @@ -5,14 +5,21 @@ import com.foreverwin.mesnac.anomaly.dto.PartsManufacturing; import com.foreverwin.mesnac.anomaly.mapper.ReportMapper; import com.foreverwin.mesnac.anomaly.service.ReportService; import com.foreverwin.mesnac.integration.model.IntegrationLog; +import com.foreverwin.mesnac.meapi.model.NcCode; +import com.foreverwin.mesnac.meapi.model.NwaUser; +import com.foreverwin.mesnac.meapi.service.NcCodeService; +import com.foreverwin.mesnac.meapi.service.NwaUserService; +import com.foreverwin.mesnac.meapi.util.StringUtils; import com.foreverwin.modular.core.util.CommonMethods; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * @Description TODO @@ -23,8 +30,12 @@ import java.util.Map; @Transactional(rollbackFor = Exception.class) public class ReportServiceImpl implements ReportService { + @Autowired + private NcCodeService ncCodeService; @Autowired private ReportMapper reportMapper; + @Autowired + private NwaUserService nwaUserService; /** * 接口日志表 @@ -57,6 +68,70 @@ public class ReportServiceImpl implements ReportService { return reportMapper.surplusReturnTable(site,locale,item,itemDescription); } + @Override + public List> resourceRepair(Map map) { + String locale = LocaleContextHolder.getLocale().getLanguage(); + String site = CommonMethods.getSite(); + + + + Map> ncCodeMap = new HashMap<>(); + NcCode ncCode = new NcCode(); + ncCode.setSite(site); + List ncCodeList = ncCodeService.selectList(ncCode); + if (ncCodeList != null && ncCodeList.size() > 0) { + ncCodeMap = ncCodeList.stream().collect(Collectors.groupingBy(NcCode::getNcCode)); + } + + Map> userMap = new HashMap<>(); + NwaUser nwaUser = new NwaUser(); + nwaUser.setSite(site); + List nwaUserList = nwaUserService.selectList(nwaUser); + if(nwaUserList != null && nwaUserList.size() > 0) { + userMap = nwaUserList.stream().collect(Collectors.groupingBy(NwaUser::getUserName)); + } + + + List> maps = reportMapper.resourceRepair(site, locale, map); + + + for (int i = 0; i < maps.size(); i++) { + Map temporaryMap = maps.get(i); + String ncCodes = (String)temporaryMap.get("NC_CODE_NO"); + if(StringUtils.isBlank(ncCodes)){ + maps.get(i).put("NC_CODE_DESCRIPTION", ""); + continue; + } + String []ncCodeArray = ncCodes.split(","); + String ncCodeDesc = ""; + for (int j = 0; j < ncCodeArray.length; j++) { + ncCodeDesc += ncCodeMap.get(ncCodeArray[j]).get(0).getDescription()+";"; + } + maps.get(i).put("NC_CODE_DESCRIPTION", ncCodeDesc); + } + + + for (int i = 0; i < maps.size(); i++) { + Map temporaryMap = maps.get(i); + String repairUser = (String)temporaryMap.get("REPAIR_USERS"); + if(StringUtils.isBlank(repairUser)){ + maps.get(i).put("REPAIR_USERS_DESCRIPTION", ""); + continue; + } + String []repairUserArray = repairUser.split(","); + String repairUserDescription = ""; + for (int j = 0; j < repairUserArray.length; j++) { + repairUserDescription += userMap.get(repairUserArray[j]).get(0).getFullName()+";"; + } + maps.get(i).put("REPAIR_USERS_DESCRIPTION", repairUserDescription); + } + + + + + return maps; + } + @Override public List> findInspectionTask(Map paramMap) { return reportMapper.findInspectionTask(paramMap); diff --git a/anomaly/src/main/resources/mapper/ReportMapper.xml b/anomaly/src/main/resources/mapper/ReportMapper.xml index 005a3f27..e06b5574 100644 --- a/anomaly/src/main/resources/mapper/ReportMapper.xml +++ b/anomaly/src/main/resources/mapper/ReportMapper.xml @@ -89,6 +89,56 @@ + + 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 6e0c84f9..468d8fb6 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 @@ -177,6 +177,8 @@ public interface Constants { // 余料标签 String PRINT_TYPE_EXM = "EXM"; + // 成品标签 + String PRINT_TYPE_PRODUCT = "PRODUCT"; /** * 刀具状态,Y-使用,N-报废/删除 */ diff --git a/common/src/main/java/com/foreverwin/mesnac/common/dto/LabelPrintDto.java b/common/src/main/java/com/foreverwin/mesnac/common/dto/LabelPrintDto.java index 4c084ac3..9a63900e 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/dto/LabelPrintDto.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/dto/LabelPrintDto.java @@ -29,6 +29,7 @@ public class LabelPrintDto implements Serializable { private String label; //在制品标签参数 + private String shopOrder; //工作指令 private String workOrder; //图纸版本号 @@ -44,6 +45,14 @@ public class LabelPrintDto implements Serializable { //打印张数 private Integer printNum; + public String getShopOrder() { + return shopOrder; + } + + public void setShopOrder(String shopOrder) { + this.shopOrder = shopOrder; + } + public String getSite() { return site; } diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/InspectionTaskService.java b/common/src/main/java/com/foreverwin/mesnac/common/service/InspectionTaskService.java index 2dbcb9cf..bef6dd62 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/service/InspectionTaskService.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/service/InspectionTaskService.java @@ -35,5 +35,5 @@ public interface InspectionTaskService extends IService { InspectionTask isCreateTask(String site, String category, String sfc, String operation, String stepId); - void createCompleteTask(Map paramMap); + void createNewTask(Map paramMap); } \ No newline at end of file diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/impl/InspectionTaskServiceImpl.java b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/InspectionTaskServiceImpl.java index 0bbf7397..9e041d9e 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/service/impl/InspectionTaskServiceImpl.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/InspectionTaskServiceImpl.java @@ -264,7 +264,7 @@ public class InspectionTaskServiceImpl extends ServiceImpl paramMap) { + public void createNewTask(Map paramMap) { String site = CommonMethods.getSite(); String category = (String) paramMap.get("CATEGORY"); String sfc = (String) paramMap.get("SFC"); @@ -287,8 +287,8 @@ public class InspectionTaskServiceImpl extends ServiceImpl @@ -68,6 +68,7 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl printLogList = printLogService.list(queryWrapper); if (printLogList.isEmpty()) { //打印参数 LabelPrintDto labelPrintDto = new LabelPrintDto(); labelPrintDto.setPrinter(printName); - labelPrintDto.setPrintTemplate(Constants.PRINT_TYPE_SFC); + labelPrintDto.setPrintTemplate(type); + labelPrintDto.setShopOrder(shopOrder); labelPrintDto.setItem(selectCurrent.getItem()); labelPrintDto.setItemDescription(selectCurrent.getDescription()); labelPrintDto.setSfc(prodReadyTask.getSfc()); @@ -482,16 +490,15 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl AND ZPRT.WORK_CENTER=#{entity.workCenter} AND ZPRT.RESRCE=#{entity.resrce} AND ZSD.DISPATCH_NO=#{entity.dispatchNo} - AND ZPRT.STATUS=#{entity.status} + AND ZPRT.STATUS=#{entity.status} + AND ZPL.IS_PRINT='true' AND ZPRT.STATUS='FINISH' AND ZPRT.RESULT=#{entity.result} AND ZSD.DISPATCH_STATUS=#{entity.sfcStepStatus} AND ZSD.DISPATCH_STATUS!='COMPLETE' diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/SfcDispatchController.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/SfcDispatchController.java index 30571271..b6b29593 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/SfcDispatchController.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/SfcDispatchController.java @@ -1,12 +1,16 @@ package com.foreverwin.mesnac.dispatch.controller; import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.foreverwin.mesnac.common.dto.SfcDispatchDto; import com.foreverwin.mesnac.common.enums.DispatchStatusEnum; import com.foreverwin.mesnac.common.util.StringUtil; +import com.foreverwin.mesnac.dispatch.model.SfcDispatch; import com.foreverwin.mesnac.dispatch.service.SfcDispatchService; import com.foreverwin.modular.core.exception.BusinessException; import com.foreverwin.modular.core.util.CommonMethods; +import com.foreverwin.modular.core.util.FrontPage; import com.foreverwin.modular.core.util.R; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; @@ -273,7 +277,25 @@ public class SfcDispatchController { } } - + @ResponseBody + @GetMapping("/page") + public R page(FrontPage frontPage, SfcDispatch sfcDispatch){ + IPage result; + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(sfcDispatch); + sfcDispatch.setSite(CommonMethods.getSite()); + if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) { + //TODO modify global query + queryWrapper.lambda().and(wrapper -> wrapper + .or().like(SfcDispatch::getShopOrder, frontPage.getGlobalQuery()) + .or().like(SfcDispatch::getSfc, frontPage.getGlobalQuery()) + .or().like(SfcDispatch::getDispatchNo, frontPage.getGlobalQuery()) + .or().like(SfcDispatch::getDispatchStatus, frontPage.getGlobalQuery()) + ); + } + result = sfcDispatchService.page(frontPage.getPagePlus(), queryWrapper); + return R.ok(result); + } @PostMapping("/gantt-list") public R ganttList(@RequestBody SfcDispatchDto sfcDispatchDto) { Map result = new HashMap<>(); diff --git a/equip/src/main/java/com/foreverwin/mesnac/equip/mapper/ResourceInspectTaskMapper.java b/equip/src/main/java/com/foreverwin/mesnac/equip/mapper/ResourceInspectTaskMapper.java index c20fc4e9..4144b9d0 100644 --- a/equip/src/main/java/com/foreverwin/mesnac/equip/mapper/ResourceInspectTaskMapper.java +++ b/equip/src/main/java/com/foreverwin/mesnac/equip/mapper/ResourceInspectTaskMapper.java @@ -3,6 +3,7 @@ package com.foreverwin.mesnac.equip.mapper; import com.foreverwin.mesnac.equip.dto.ResourceInspectTaskDto; import com.foreverwin.mesnac.equip.model.ResourceInspectTask; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.time.LocalDateTime; @@ -46,4 +47,7 @@ public interface ResourceInspectTaskMapper extends BaseMapper resourceColl = new ArrayList<>(); + StringBuffer resInfo = new StringBuffer("["); for (ResourceInspectResource equip: equips) { equip.setResourceInspectPlanBo(handle); equip.setCreateUser(user); equip.setCreatedDateTime(LocalDateTime.now()); String resourceNo = equip.getResourceNo(); + Integer cnt = resourceInspectTaskMapper.findResourceTaskByResrceAndCategory(site, category, resourceNo); + if (cnt > 0){ + resInfo.append(resourceNo+","); + } String resourceHandle = HandleEnum.RESOURCE.getHandle(site, resourceNo); equip.setHandle(HandleEnum.RESOURCE_INSPECT_RESOURCE.getHandle(site,handle,resourceHandle)); resourceColl.add(equip); } + if (!resInfo.equals("")){ + throw BusinessException.build("设备编号" + resInfo.append("]") + "已经维护了相同点检类型的点检计划!"); + } resourceInspectResourceService.saveBatch(resourceColl); // 保存用户组清单 List userGroups = resourceInspectPlan.getInspectPlanUserGroupList(); @@ -380,6 +389,9 @@ public class ResourceInspectPlanServiceImpl extends ServiceImpl inspectTaskList = resourceInspectTaskMapper.getInspectTaskList(resourceInspectTask); + for (ResourceInspectTask inspectTask: inspectTaskList) { + resourceInspectPlanService.autoCreateTaskByResourceInspectTask(inspectTask); + inspectTask.setModifyUser(user); + inspectTask.setModifiedDateTime(LocalDateTime.now()); + } + if (inspectTaskList.size() > 0){ + resourceInspectTaskService.updateBatchById(inspectTaskList); + } + } +} diff --git a/equip/src/main/resources/mapper/ResourceInspectTaskMapper.xml b/equip/src/main/resources/mapper/ResourceInspectTaskMapper.xml index 30a34cd2..f15de7a5 100644 --- a/equip/src/main/resources/mapper/ResourceInspectTaskMapper.xml +++ b/equip/src/main/resources/mapper/ResourceInspectTaskMapper.xml @@ -717,9 +717,24 @@ AND ZRIT.RESOURCE_INSPECT_PLAN_BO = #{resourceInspectPlanBo} - AND ZRIT.resrce = #{resrce} + AND ZRIT.RESRCE = #{resrce} + + + AND ZRIT.CATEGORY = #{category} + + + AND ZRIT.TASK_CREATE_DATE <= #{planCompleteDate} + + + AND ZRIT.TASK_CREATE_DATE >= #{planStartDate} + + + diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/UserGroupController.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/UserGroupController.java index 8383e2b1..43921e13 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/UserGroupController.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/UserGroupController.java @@ -1,18 +1,17 @@ package com.foreverwin.mesnac.meapi.controller; -import com.foreverwin.modular.core.util.CommonMethods; -import com.foreverwin.modular.core.util.R; -import com.foreverwin.modular.core.util.FrontPage; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import org.springframework.web.bind.annotation.RequestMapping; +import com.foreverwin.mesnac.meapi.model.UserGroup; +import com.foreverwin.mesnac.meapi.service.UserGroupService; +import com.foreverwin.modular.core.util.CommonMethods; +import com.foreverwin.modular.core.util.FrontPage; +import com.foreverwin.modular.core.util.R; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import com.foreverwin.mesnac.meapi.service.UserGroupService; -import com.foreverwin.mesnac.meapi.model.UserGroup; - import java.util.List; +import java.util.Map; /** * @@ -122,4 +121,27 @@ public class UserGroupController { public R removeByIds(List ids){ return R.ok(userGroupService.removeByIds(ids)); } -} \ No newline at end of file + + + @ResponseBody + @PostMapping("/findAbnormalUserGroup") + public R findAbnormalUserGroup(@RequestBody Map param){ + try{ + return R.ok(userGroupService.findAbnormalUserGroup(param)); + }catch (Exception e){ + return R.failed("找寻用户组失败"+e.getMessage()); + } + } +} + + + + + + + + + + + + diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/UserGroupMapper.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/UserGroupMapper.java index 7c14cea3..2003170d 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/UserGroupMapper.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/UserGroupMapper.java @@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; +import java.util.Map; /** *

@@ -33,4 +34,6 @@ public interface UserGroupMapper extends BaseMapper { List findUserGroupListByUser(@Param("site")String site,@Param("user")String user); + List findAbnormalUserGroup(@Param("site")String site, @Param("param")Map map); + } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/UserGroupService.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/UserGroupService.java index ba6f45a5..a8e1cced 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/UserGroupService.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/UserGroupService.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.foreverwin.modular.core.util.FrontPage; import java.util.List; +import java.util.Map; /** *

@@ -29,4 +30,6 @@ public interface UserGroupService extends IService { List getUserGroupListByUserBo(String userBo); Integer getUserGroupByUser(String userBO,String userGroupBO); + + List findAbnormalUserGroup(Map param); } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/UserGroupServiceImpl.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/UserGroupServiceImpl.java index f315056c..17382a57 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/UserGroupServiceImpl.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/UserGroupServiceImpl.java @@ -1,17 +1,19 @@ package com.foreverwin.mesnac.meapi.service.impl; -import com.foreverwin.modular.core.util.FrontPage; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.foreverwin.mesnac.meapi.model.UserGroup; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.foreverwin.mesnac.meapi.mapper.UserGroupMapper; +import com.foreverwin.mesnac.meapi.model.UserGroup; import com.foreverwin.mesnac.meapi.service.UserGroupService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; +import com.foreverwin.modular.core.util.CommonMethods; +import com.foreverwin.modular.core.util.FrontPage; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; +import java.util.Map; /** *

@@ -52,4 +54,10 @@ public class UserGroupServiceImpl extends ServiceImpl findAbnormalUserGroup(Map param) { + String site = CommonMethods.getSite(); + return userGroupMapper.findAbnormalUserGroup(site,param); + } + } \ No newline at end of file diff --git a/meapi/src/main/resources/mapper/UserGroupMapper.xml b/meapi/src/main/resources/mapper/UserGroupMapper.xml index 7beb8f56..4bd1b9e0 100644 --- a/meapi/src/main/resources/mapper/UserGroupMapper.xml +++ b/meapi/src/main/resources/mapper/UserGroupMapper.xml @@ -390,5 +390,15 @@ WHERE U.USER_ID = #{user} AND U.SITE = #{site} + diff --git a/production/src/main/java/com/foreverwin/mesnac/production/controller/SfcScrapController.java b/production/src/main/java/com/foreverwin/mesnac/production/controller/SfcScrapController.java index 907a4fda..eb582857 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/controller/SfcScrapController.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/controller/SfcScrapController.java @@ -139,7 +139,12 @@ public class SfcScrapController { */ @GetMapping("/getScrapDtoBysfc") public R getScrapDtoBysfc(String site,String sfc){ - return R.ok(anomalyService.getScrapDtoBysfc(site,sfc)); + try{ + return R.ok(anomalyService.getScrapDtoBysfc(site,sfc)); + }catch (Exception e){ + return R.failed("产品报废检索报错"+e.getMessage()); + } + } /** 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 03869e30..23dea0a8 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 @@ -220,10 +220,14 @@ public class PodTemplateServiceImpl implements PodTemplateService { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq(InspectionTask.CATEGORY, Constants.INSPECTION_TYPE_P); queryWrapper.eq(InspectionTask.SFC, sfc); - queryWrapper.ne(InspectionTask.RESULT, Constants.RSESULT_OK); + queryWrapper.orderByDesc(InspectionTask.CREATED_DATE_TIME); List list = inspectionTaskService.list(queryWrapper); if (!list.isEmpty()) { - throw new BaseException("请完成专检检验任务"); + InspectionTask inspectionTask = list.get(0); + String result = inspectionTask.getResult(); + if (!inspectionTask.getStatus().equals(Constants.INSPECTION_TASK_STATUS_COMPLETE)||StringUtil.isBlank(result)||!result.equals(Constants.RSESULT_OK)){ + throw new BaseException("请完成专检检验任务"); + } } try { sfcCrossService.startAction(site, currentRevisionRef.getHandle(), resrce, sfcServiceById.getHandle(), qty); @@ -289,7 +293,7 @@ public class PodTemplateServiceImpl implements PodTemplateService { inspectionTaskService.createTask(paramMap); } else { paramMap.put("CATEGORY", Constants.INSPECTION_TYPE_P); - inspectionTaskService.createCompleteTask(paramMap); + inspectionTaskService.createNewTask(paramMap); } //首件创建 inspectionItemDetails = inspectionItemService.selectQualityInspection(sfc, operation, stepId, Constants.INSPECTION_TYPE_S); diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SplitSfcServiceImpl.java b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SplitSfcServiceImpl.java index 77191d48..f9a4ab44 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SplitSfcServiceImpl.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SplitSfcServiceImpl.java @@ -10,7 +10,6 @@ import com.foreverwin.mesnac.common.util.StringUtil; import com.foreverwin.mesnac.meapi.dto.RouterStepDto; import com.foreverwin.mesnac.meapi.dto.SfcDto; import com.foreverwin.mesnac.meapi.model.Router; -import com.foreverwin.mesnac.meapi.model.WorkCenter; import com.foreverwin.mesnac.meapi.service.RouterService; import com.foreverwin.mesnac.meapi.service.RouterStepService; import com.foreverwin.mesnac.meapi.service.ShopOrderService; @@ -22,7 +21,6 @@ import com.foreverwin.mesnac.production.model.SplitSfc; import com.foreverwin.mesnac.production.model.StepOperation; import com.foreverwin.mesnac.production.service.SplitSfcService; import com.foreverwin.modular.core.exception.BaseException; -import com.foreverwin.modular.core.exception.BusinessException; import com.foreverwin.modular.core.meext.MEServices; import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.FrontPage; @@ -159,19 +157,8 @@ public class SplitSfcServiceImpl extends ServiceImpl i splitSfc.setCreateUser(CommonMethods.getUser()); splitSfc.setCreatedDateTime(LocalDateTime.now()); save(splitSfc); - String workCenter = null; - if (operation.contains("_")) { - workCenter = operation.split("_")[0]; - } else { - workCenter = operation; - } - String workCenterBo = HandleEnum.WORK_CENTER.getHandle(site, workCenter); - WorkCenter workCenterModel = workCenterService.getById(workCenterBo); - if (workCenterModel == null) { - throw BusinessException.build("生产车间【" +workCenter+ "】不存在"); - } Router routerBySfcBo = routerService.getRouterBySfcBo(HandleEnum.SFC.getHandle(site, sfc)); - sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),workCenter,newSfc, sfcData.getShopOrder(),routerBySfcBo.getHandle()); + sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),null,newSfc, sfcData.getShopOrder(),routerBySfcBo.getHandle()); return splitSfc; } catch (Exception e) { ExceptionUtil.throwException(e); @@ -257,23 +244,11 @@ public class SplitSfcServiceImpl extends ServiceImpl i dispositionSfcsRequest.setDispositionSelection(dispositionSelection); dispositionSfcsRequest.setProdCtx(new ProductionContext()); ncProductionService.dispositionMultipleSfcs(dispositionSfcsRequest); - String workCenter; - List routerOperationByRouterBo = routerStepService.findRouterOperationByRouterBo(site, routerBo); + List routerOperationByRouterBo = routerStepService.findRouterOperationByRouterBo(site, maxRevisionRouter.getHandle()); if (routerOperationByRouterBo.isEmpty()){ throw new BaseException("处置工艺路线没有步骤"); } - String routerOperation = routerOperationByRouterBo.get(0).getOperation(); - if (routerOperation.contains("_")) { - workCenter = routerOperation.split("_")[0]; - } else { - workCenter = routerOperation; - } - String workCenterBo = HandleEnum.WORK_CENTER.getHandle(site, workCenter); - WorkCenter workCenterModel = workCenterService.getById(workCenterBo); - if (workCenterModel == null) { - throw BusinessException.build("生产车间【" +workCenter+ "】不存在"); - } - sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),workCenter,newSfc, sfcData.getShopOrder(),maxRevisionRouter.getHandle()); + sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),null,newSfc, sfcData.getShopOrder(),maxRevisionRouter.getHandle()); } SplitSfc splitSfc=new SplitSfc(); splitSfc.setHandle(HandleEnum.SPLIT_SFC.getHandle(site,newSfc)); diff --git a/quartz/pom.xml b/quartz/pom.xml index e92893e5..b2ff0dcc 100644 --- a/quartz/pom.xml +++ b/quartz/pom.xml @@ -42,5 +42,9 @@ com.foreverwin.mesnac anomaly + + com.foreverwin.mesnac + equip + \ No newline at end of file diff --git a/quartz/src/main/java/com/foreverwin/mesnac/quartz/job/ResourceInspectTaskJob.java b/quartz/src/main/java/com/foreverwin/mesnac/quartz/job/ResourceInspectTaskJob.java new file mode 100644 index 00000000..b4fa0021 --- /dev/null +++ b/quartz/src/main/java/com/foreverwin/mesnac/quartz/job/ResourceInspectTaskJob.java @@ -0,0 +1,44 @@ +package com.foreverwin.mesnac.quartz.job; + +import com.foreverwin.mesnac.common.util.StringUtil; +import com.foreverwin.mesnac.equip.service.ResourceInspectTaskJobService; +import com.foreverwin.mesnac.equip.service.ResourceInspectTaskService; +import com.foreverwin.modular.core.exception.BaseException; +import org.quartz.DisallowConcurrentExecution; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @Description TODO + * @Author zhaojiawei + * @Since 2021-07-22 + */ +@DisallowConcurrentExecution +public class ResourceInspectTaskJob implements Job { + private static final String SITE_UPPERCASE = "SITE"; + private static final String SITE_LOWERCASE = "site"; + + @Autowired + private ResourceInspectTaskJobService resourceInspectTaskJobService; + + @Override + public void execute(JobExecutionContext context) throws JobExecutionException { + //获取站点,若站点为空则抛出异常 + String site = getSite(context); + if (StringUtil.isBlank(site)) { + throw new BaseException("equip.quartz.task.not.site", null); + } + + resourceInspectTaskJobService.resourceInspectTaskJobProcess(site); + } + + private String getSite(JobExecutionContext context) { + String site = context.getJobDetail().getJobDataMap().getString(SITE_LOWERCASE); + if (StringUtil.isBlank(site)) { + site = context.getJobDetail().getJobDataMap().getString(SITE_UPPERCASE); + } + return site; + } +}