From 1b9d20eaa5dea727acef0be5befca6ff1141fc26 Mon Sep 17 00:00:00 2001 From: Leon <3066758958@qq.com> Date: Mon, 20 Sep 2021 10:35:54 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E7=89=A9=E6=96=99=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=8C=E7=89=A9=E6=96=99=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=8C=89=E7=BC=96=E7=A0=81=E8=A7=84=E5=88=99=E5=A4=84=E7=90=86?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/InterfaceServiceImpl.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java index 62384765..4b61f140 100644 --- a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java +++ b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java @@ -88,24 +88,24 @@ public class InterfaceServiceImpl implements InterfaceService { throw BusinessException.build("物料状态可维护的值为:201(可下达)、202(冻结)、203(作废)、204(保留)、205(新建)"); } String statusBo = HandleEnum.STATUS.getHandle(site, status); - //物料类型(FERT(已完成)/ROH(原始)/HALB(半成品)/KMAT(可配置)/INST(安装)/VERP(包装)/FHMI(生产资源/工具)/CSTM(自定义)) - String itemType = itemSyncRequest.getITEM_TYPE(); - if (!"FERT".equals(itemType) && !"ROH".equals(itemType) && !"HALB".equals(itemType)) { - throw BusinessException.build("物料类型可维护的值为:FERT(已完成)、ROH(原始)、HALB(半成品)"); - } - //采购类型(M(制造)/P(采购)/B(制造/采购)) - String procurementType = itemSyncRequest.getPROCUREMENT_TYPE(); - if (!"M".equals(procurementType) && !"P".equals(procurementType) && !"B".equals(procurementType)) { - throw BusinessException.build("采购类型可维护的值为:M(制造)、P(采购)、B(制造/采购)"); + + /** + * Modify by Leon - 20210920 + * 物料类型-根据物料编码来判断,CAPP传过来为空(编码05开头为原始,02/03/06开头的为半成品) + */ + String itemType = null; + String procurementType = null; + if (item.startsWith("02") || item.startsWith("03") || item.startsWith("06")) { + itemType = "HALB"; + procurementType = "B"; + } else { + itemType = "ROH"; + procurementType = "P"; } //批次大小 String lotSize = itemSyncRequest.getLOT_SIZE(); lotSize = StringUtil.notBlank(lotSize) ? lotSize : "999999"; - //装配时要收集的数据 - String assyDataType = itemSyncRequest.getASSY_DATA_TYPE(); - //库存接收数据类型 - String invAssyDataType = itemSyncRequest.getINV_ASSY_DATA_TYPE(); //物料标准API ItemConfigurationServiceInterface itemServiceInterFace = MEServices.create("com.sap.me.productdefinition", "ItemConfigurationService", site); From 390677196cf554201ff607c9b74178ea3fd91faf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=98=89=E4=BC=9F?= <1724121454@qq.com> Date: Wed, 22 Sep 2021 09:37:19 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E8=BF=9B=E5=BA=A6=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../anomaly/controller/ReportController.java | 17 ++- .../mesnac/anomaly/mapper/ReportMapper.java | 7 + .../mesnac/anomaly/service/ReportService.java | 7 + .../service/impl/ReportServiceImpl.java | 37 ++++- .../main/resources/mapper/ReportMapper.xml | 127 +++++++++++++++--- 5 files changed, 171 insertions(+), 24 deletions(-) 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 7b5e76ab..61fe2894 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 @@ -116,7 +116,7 @@ public class ReportController { * @param paramMap * @return */ - @GetMapping("/findAbnormalRecord") + @PostMapping("/findAbnormalRecord") public R findAbnormalRecord(@RequestBody(required = false) Map paramMap){ try{ List> result = reportService.findAbnormalRecord(paramMap); @@ -125,4 +125,19 @@ public class ReportController { return R.failed(e.getMessage()); } } + + /** + * 工单生产进度报表 + * @param paramMap + * @return + */ + @PostMapping("/shopOrderSchedule") + public R shopOrderSchedule(@RequestBody(required = false) Map paramMap){ + try{ + List> result = reportService.shopOrderSchedule(paramMap); + return R.ok(result); + }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 efe3c1bc..e0e0d84b 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 @@ -36,4 +36,11 @@ public interface ReportMapper { List> findQualityInspectionReport(Map paramMap); List> findAbnormalRecord(Map paramMap); + + /** + * 工单生产进度报表 + * @param paramMap + * @return + */ + List> shopOrderSchedule(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 9dc5f19e..e8fd91f0 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 @@ -40,4 +40,11 @@ public interface ReportService { * @return */ List> findAbnormalRecord(Map paramMap); + + /** + * 工单生产进度报表 + * @param paramMap + * @return + */ + List> shopOrderSchedule(Map paramMap); } 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 9ecb99c3..3542f876 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 @@ -237,7 +237,42 @@ public class ReportServiceImpl implements ReportService { paramMap.put("site",site); paramMap.put("locale",LocaleContextHolder.getLocale().getLanguage()); List> findAbnormalRecord = reportMapper.findAbnormalRecord(paramMap); - return null; + + + + Map> dataFieldListMap = new HashMap<>(); + DataField dataField = new DataField(); + dataField.setSite(site); + dataField.setDataField("REASON_CATEGORY"); + //责任部门 + dataField.setDataField("RESPONSIBILITY_DEPARTMENT"); + List dataFieldList = dataFieldListMapper.findDataFieldList(dataField); + if (dataFieldList != null && dataFieldList.size() > 0) { + dataFieldListMap = dataFieldList.stream().collect(Collectors.groupingBy(DataFieldList::getDataValue)); + } + for (int i = 0; i < findAbnormalRecord.size(); i++) { + Map temporaryMap = findAbnormalRecord.get(i); + String dutyDepart = (String) temporaryMap.get("DUTY_DEPART"); + if (StringUtils.isBlank(dutyDepart)) { + findAbnormalRecord.get(i).put("DUTY_DEPART_DESCRIPTION", ""); + continue; + } + String[] dutyDepartSplit = dutyDepart.split(","); + StringBuilder dutyDepartDescription = new StringBuilder(); + for (int j = 0; j < dutyDepartSplit.length; j++) { + dutyDepartDescription.append(dataFieldListMap.get(dutyDepartSplit[j]).get(0).getDescription()).append(";"); + } + findAbnormalRecord.get(i).put("DUTY_DEPART_DESCRIPTION", dutyDepartDescription); + } + return findAbnormalRecord; + } + + @Override + public List> shopOrderSchedule(Map paramMap) { + String site = CommonMethods.getSite(); + paramMap.put("site",site); + paramMap.put("locale",LocaleContextHolder.getLocale().getLanguage()); + return reportMapper.shopOrderSchedule(paramMap); } } diff --git a/anomaly/src/main/resources/mapper/ReportMapper.xml b/anomaly/src/main/resources/mapper/ReportMapper.xml index 8a28f329..0a2e4e5e 100644 --- a/anomaly/src/main/resources/mapper/ReportMapper.xml +++ b/anomaly/src/main/resources/mapper/ReportMapper.xml @@ -307,7 +307,7 @@ LEFT JOIN RESOURCE_TYPE rt ON rt.RESOURCE_TYPE = zsd.RESOURCE_TYPE AND rt.SITE = zab.SITE LEFT JOIN WORK_CENTER wc ON wc.WORK_CENTER = SUBSTR(o.OPERATION,1,INSTR(o.OPERATION,'_')-1) AND wc.site = zab.SITE - zab."TYPE" ='Z' + zab.SITE = #{site} AND zab."TYPE" ='Z' AND wc.WORK_CENTER LIKE '%${workCenter}%' @@ -350,7 +350,7 @@ + + \ No newline at end of file From 569b922e16dafe00b3171d3d82037421f268ca19 Mon Sep 17 00:00:00 2001 From: philip <244793088@qq.com> Date: Wed, 22 Sep 2021 14:59:58 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=B7=A5=E6=97=B6=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E4=B8=89=E4=BD=8D=E5=B0=8F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mesnac/production/service/impl/PodTemplateServiceImpl.java | 1 + 1 file changed, 1 insertion(+) 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 b07adae2..42496570 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 @@ -462,6 +462,7 @@ public class PodTemplateServiceImpl implements PodTemplateService { String shopOrderBo = sfcServiceById.getShopOrderBo(); String shopOrder = StringUtil.trimHandle(shopOrderBo); ZprodordconfStruIn struIn = new ZprodordconfStruIn(); + workHour = workHour.setScale(3,RoundingMode.DOWN); //生产订单 struIn.setAufnr(shopOrder); //步骤标示 From 57c54d171e7fd938a861487b11aac60ac75abf82 Mon Sep 17 00:00:00 2001 From: Leon <3066758958@qq.com> Date: Thu, 23 Sep 2021 09:47:21 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E6=B4=BE=E5=B7=A5?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=BB=84=E4=BB=B6=E6=8F=8F=E8=BF=B0=E9=94=99?= =?UTF-8?q?=E8=AF=AF=EF=BC=8C=E5=88=B7=E6=96=B0=E5=8F=AB=E6=96=99=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E9=87=8D=E5=A4=8D=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CallItemServiceImpl.java | 49 +++++++------------ .../resources/mapper/SfcDispatchMapper.xml | 4 +- .../main/resources/mapper/NwaUserMapper.xml | 1 - 3 files changed, 22 insertions(+), 32 deletions(-) diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/CallItemServiceImpl.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/CallItemServiceImpl.java index d8737b61..428ec6a0 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/CallItemServiceImpl.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/CallItemServiceImpl.java @@ -51,8 +51,6 @@ public class CallItemServiceImpl extends ServiceImpl i @Autowired private CallItemService callItemService; @Autowired - private NwaUserService nwaUserService; - @Autowired private UserGroupMapper userGroupMapper; @Override @@ -244,58 +242,49 @@ public class CallItemServiceImpl extends ServiceImpl i @Override public void refreshCallItem(String site, String user, List callItemList) { + LocalDateTime nowDate = LocalDateTime.now(); if (callItemList == null || callItemList.size() <= 0) { return; } - List sfcDispatchList = new ArrayList<>(); for (CallItem callItem: callItemList) { SfcDispatchDto sfcDispatchDto = new SfcDispatchDto(); sfcDispatchDto.setHandle(callItem.getSfcDispatchBo()); sfcDispatchList.add(sfcDispatchDto); } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //删除原来的数据 + callItemMapper.deleteDispatchCallItem(sfcDispatchList); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ List list = callItemMapper.selectDispatchCallItem(sfcDispatchList); if (list == null || list.size() <= 0) { return; } - - //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - LocalDateTime nowDate = LocalDateTime.now(); List addList = new ArrayList<>(); - List modList = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { CallItem callItem = list.get(i); - String handle = callItem.getHandle(); BigDecimal reqQty = callItem.getRequiredQty(); if (reqQty.compareTo(BigDecimal.ZERO) == 1) { - if (StringUtil.isBlank(handle)) { - String component = StringUtil.trimHandle(callItem.getComponentBo()); - String callItemNo = callItem.getSfc() + callItem.getStepId() + component; - - callItem.setCallItemNo(callItemNo); - callItem.setHandle(HandleEnum.CALL_ITEM.getHandle(site, callItemNo)); - callItem.setCallType(Constants.CALL_TYPE_MATERIAL); - callItem.setStatus(Constants.CALL_ITEM_STATUS_NEW); - callItem.setCreateUser(user); - callItem.setCreatedDateTime(nowDate); - callItem.setModifyUser(user); - callItem.setModifiedDateTime(nowDate); - addList.add(callItem); - } else { - callItem.setRequiredQty(callItem.getIssueQty()); - callItem.setModifyUser(user); - callItem.setModifiedDateTime(nowDate); - modList.add(callItem); - } + String component = StringUtil.trimHandle(callItem.getComponentBo()); + String callItemNo = callItem.getSfc() + callItem.getStepId() + component; + + callItem.setCallItemNo(callItemNo); + callItem.setHandle(HandleEnum.CALL_ITEM.getHandle(site, callItemNo)); + callItem.setCallType(Constants.CALL_TYPE_MATERIAL); + callItem.setStatus(Constants.CALL_ITEM_STATUS_NEW); + callItem.setCreateUser(user); + callItem.setCreatedDateTime(nowDate); + callItem.setModifyUser(user); + callItem.setModifiedDateTime(nowDate); + addList.add(callItem); } } if (addList != null && addList.size() > 0) { this.saveBatch(addList); } - if (modList != null && modList.size() > 0) { - this.updateBatchById(modList); - } } @Override diff --git a/dispatch/src/main/resources/mapper/SfcDispatchMapper.xml b/dispatch/src/main/resources/mapper/SfcDispatchMapper.xml index 29f9d45e..9970404e 100644 --- a/dispatch/src/main/resources/mapper/SfcDispatchMapper.xml +++ b/dispatch/src/main/resources/mapper/SfcDispatchMapper.xml @@ -686,6 +686,7 @@ CASE WHEN CC.VALUE = '9' THEN N'是' ELSE N'否' END IS_MAJOR, CASE WHEN SD.TURN_OPERATION = 'true' THEN N'是' ELSE N'否' END TURN_OPERATION, SD.BLANKING_SIZE, MAX(BC.COMPONENT_GBO) COMPONENT_BO, WR.WORK_CENTER RESOURCE_WORK_CENTER, MAX(CP.ITEM) COMPONENT, MAX(CT.DESCRIPTION) COMPONENT_DESCRIPTION, MAX(C3.VALUE) TEXTURE, MAX(C4.VALUE) MAT_SPEC FROM Z_SFC_DISPATCH SD + INNER JOIN SFC SC ON SC.SITE = SD.SITE AND SC.SFC = SD.SFC LEFT JOIN RESRCE RS ON SD.SITE = RS.SITE AND SD.RESRCE = RS.RESRCE INNER JOIN SHOP_ORDER SO ON SO.SITE = SD.SITE AND SO.SHOP_ORDER = SD.SHOP_ORDER LEFT JOIN CUSTOM_FIELDS C1 ON C1.HANDLE = SO.HANDLE AND C1."ATTRIBUTE" = 'WORK_ORDER' @@ -695,7 +696,8 @@ LEFT JOIN CUSTOM_FIELDS CC ON CC.HANDLE = IM.HANDLE AND CC.ATTRIBUTE = 'ACCESSORY_TYPE' INNER JOIN OPERATION O ON O.SITE = SD.SITE AND O.OPERATION = SD.OPERATION AND O.CURRENT_REVISION = 'true' LEFT JOIN OPERATION_T OT ON OT.OPERATION_BO = O.HANDLE AND OT.LOCALE = 'zh' - INNER JOIN BOM_COMPONENT BC ON BC.BOM_BO = SO.BOM_BO + INNER JOIN SFC_BOM SB ON SB.SFC_BO = SC.HANDLE + INNER JOIN BOM_COMPONENT BC ON BC.BOM_BO = SB.BOM_BO LEFT JOIN ITEM CP ON CP.HANDLE = BC.COMPONENT_GBO LEFT JOIN ITEM_T CT ON CT.ITEM_BO = CP.HANDLE AND CT.LOCALE = 'zh' LEFT JOIN CUSTOM_FIELDS C3 ON C3.HANDLE = CP.HANDLE AND C3.ATTRIBUTE = 'TEXTTURE' diff --git a/meapi/src/main/resources/mapper/NwaUserMapper.xml b/meapi/src/main/resources/mapper/NwaUserMapper.xml index d5571df9..32196cd1 100644 --- a/meapi/src/main/resources/mapper/NwaUserMapper.xml +++ b/meapi/src/main/resources/mapper/NwaUserMapper.xml @@ -323,7 +323,6 @@ From e441d075afb80161f8dab30419853a266ccbd90f Mon Sep 17 00:00:00 2001 From: Leon <3066758958@qq.com> Date: Thu, 23 Sep 2021 09:53:09 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../foreverwin/mesnac/common/aspect/ExportAspect.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/foreverwin/mesnac/common/aspect/ExportAspect.java b/common/src/main/java/com/foreverwin/mesnac/common/aspect/ExportAspect.java index f9d5067f..f5fd01f0 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/aspect/ExportAspect.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/aspect/ExportAspect.java @@ -87,7 +87,14 @@ public class ExportAspect { }//for //------------------------------------------------------------------------------------------------------------------- Object result = joinPoint.proceed(args); - JSONObject resultJson = JSON.parseObject(JSON.toJSONString(result)); + JSONObject resultJson = JSON.parseObject(JSON.toJSONStringWithDateFormat(result, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteDateUseDateFormat)); + switch (exportCode) { + case "SfcDispatch": + resultJson = JSON.parseObject(JSON.toJSONString(result)); + break; + default: + break; + } if (resultJson.get("data") instanceof List) { List dataList = (List)resultJson.get("data"); exportData(exportCode, dataList, request, attributes.getResponse());