From 7980402005dd2a518381a54f32e35e707d3f4b01 Mon Sep 17 00:00:00 2001 From: zpl Date: Thu, 12 Aug 2021 11:29:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E5=8F=AB=E6=96=99=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CallItemController.java | 12 ++++---- .../dispatch/mapper/CallItemMapper.java | 2 +- .../dispatch/service/CallItemService.java | 4 +-- .../service/impl/CallItemServiceImpl.java | 29 +++++++++++++++++-- .../main/resources/mapper/CallItemMapper.xml | 13 ++++----- 5 files changed, 41 insertions(+), 19 deletions(-) diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/CallItemController.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/CallItemController.java index 61b47712..10471452 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/CallItemController.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/CallItemController.java @@ -162,11 +162,15 @@ public class CallItemController { try { String site = CommonMethods.getSite(); String user = CommonMethods.getUser(); - callItemService.callOrConfirmItemPda(site, user, callItemList.get(0).getCallStatus() ,callItemList); + String status = callItemList.get(0).getStatus(); + callItemService.callOrConfirmItemPda(site, user, status ,callItemList); + if (status.equals("802")){ + return R.ok("叫料成功"); + } + return R.ok("确认到料成功"); } catch (Exception e) { return R.failed(e.getMessage()); } - return R.ok("叫料成功"); } @@ -230,9 +234,7 @@ public class CallItemController { @PostMapping("/refreshCallItemPda") public R refreshCallItemPda(@RequestBody List callItemList) { try { - String site = CommonMethods.getSite(); - String user = CommonMethods.getUser(); - callItemService.refreshCallItemPda(site, user, callItemList); + callItemService.refreshCallItemPda(callItemList); } catch (Exception e) { return R.failed(e.getMessage()); } diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/CallItemMapper.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/CallItemMapper.java index cb1c7abf..c7b19d4c 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/CallItemMapper.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/CallItemMapper.java @@ -49,7 +49,7 @@ public interface CallItemMapper extends BaseMapper { */ void updateCallItemStatusByHandle(@Param("status") String status, @Param("user") String user, @Param("dateTime") LocalDateTime dateTime, @Param("list") List list); - void findRefreshCallItemPda(@Param("list") List list); + List findRefreshCallItemPda(@Param("list") List list); void updateCallItemStatusByCallItemNo(@Param("status") String status, @Param("user") String user, @Param("dateTime") LocalDateTime dateTime, @Param("list") List list); diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/CallItemService.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/CallItemService.java index 00bd8193..f9180589 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/CallItemService.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/CallItemService.java @@ -114,11 +114,9 @@ public interface CallItemService extends IService { /** * 刷新叫料明细PDA - * @param site - * @param user * @param callItemList */ - void refreshCallItemPda(String site, String user, List callItemList); + void refreshCallItemPda(List callItemList); /** * 刷新需求时间 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 2850dd56..3727f4f2 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 @@ -39,6 +39,8 @@ public class CallItemServiceImpl extends ServiceImpl i @Autowired private CallItemMapper callItemMapper; + @Autowired + private CallItemService callItemService; @Override public void sfcDispatchCallItem(String site, String user, List sfcDispatchList) { @@ -271,8 +273,31 @@ public class CallItemServiceImpl extends ServiceImpl i } @Override - public void refreshCallItemPda(String site, String user, List callItemList) { - + public void refreshCallItemPda(List callItemList) { + List callItems = new ArrayList<>(); + List list = new ArrayList<>(); + for (CallItem callItem:callItemList) { + String handle = callItem.getHandle(); + list.add(handle); + CallItem call = new CallItem(); + call.setHandle(handle); + callItems.add(call); + } + List itemList = callItemMapper.findRefreshCallItemPda(list); + + Boolean bl = false; + for (int i = 0; i < callItemList.size(); i++) { + BigDecimal oldQty = callItemList.get(i).getRequiredQty(); + BigDecimal newQty = itemList.get(i).getRequiredQty(); + if (oldQty.compareTo(newQty) == -1){ + callItems.get(i).setStatus(Constants.CALL_ITEM_STATUS_NEW); + callItems.get(i).setRequiredQty(newQty); + bl = true; + } + } + if (bl){ + callItemService.updateBatchById(callItems); + } } @Override diff --git a/dispatch/src/main/resources/mapper/CallItemMapper.xml b/dispatch/src/main/resources/mapper/CallItemMapper.xml index 0132e1fb..8d486a7c 100644 --- a/dispatch/src/main/resources/mapper/CallItemMapper.xml +++ b/dispatch/src/main/resources/mapper/CallItemMapper.xml @@ -834,7 +834,7 @@ - UPDATE Z_CALL_ITEM SET CALL_STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime} + UPDATE Z_CALL_ITEM SET STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime} WHERE HANDLE IN #{item} @@ -979,7 +979,7 @@