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 @@