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 10471452..8884e705 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 @@ -116,8 +116,8 @@ public class CallItemController { * @return */ @ResponseBody - @PostMapping("/findCallItemInfoList") - public R findCallItemInfoList(@RequestBody CallItem callItem){ + @PostMapping("/findCallItemListPda") + public R findCallItemListPda(@RequestBody CallItem callItem){ List result; try { callItem.setSite(CommonMethods.getSite()); @@ -127,7 +127,7 @@ public class CallItemController { if (callItem.getStartToDate_S() != null) { callItem.setStartToDate(DateUtil.parse(callItem.getStartToDate_S())); } - result = callItemService.findCallItemInfoList(callItem); + result = callItemService.findCallItemListPda(callItem); } 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 c7b19d4c..671da5b1 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 @@ -34,7 +34,7 @@ public interface CallItemMapper extends BaseMapper { List findCallItemDetailList(CallItem callItem); - List findCallItemInfoList(CallItem callItem); + List findCallItemListPda(@Param("site") String site,@Param("local") String local,@Param("user") String user,@Param("callItem")CallItem callItem); List findCallItemDetailListByDispatchBo(@Param("site") String site, @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 f9180589..cb8a3921 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 @@ -64,7 +64,7 @@ public interface CallItemService extends IService { * @param callItem * @return */ - List findCallItemInfoList(CallItem callItem); + List findCallItemListPda(CallItem callItem); /** 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 3727f4f2..ae10765a 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 @@ -5,7 +5,11 @@ import com.foreverwin.mesnac.common.dto.SfcDispatchDto; import com.foreverwin.mesnac.common.enums.HandleEnum; import com.foreverwin.mesnac.common.util.StringUtil; import com.foreverwin.mesnac.dispatch.dto.IssueItemDto; +import com.foreverwin.mesnac.meapi.model.NwaUser; +import com.foreverwin.mesnac.meapi.service.NwaUserService; +import com.foreverwin.mesnac.meapi.service.UserGroupService; import com.foreverwin.modular.core.exception.BusinessException; +import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.FrontPage; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -13,6 +17,7 @@ import com.foreverwin.mesnac.dispatch.model.CallItem; import com.foreverwin.mesnac.dispatch.mapper.CallItemMapper; import com.foreverwin.mesnac.dispatch.service.CallItemService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; @@ -41,6 +46,8 @@ public class CallItemServiceImpl extends ServiceImpl i private CallItemMapper callItemMapper; @Autowired private CallItemService callItemService; + @Autowired + private NwaUserService nwaUserService; @Override public void sfcDispatchCallItem(String site, String user, List sfcDispatchList) { @@ -138,8 +145,16 @@ public class CallItemServiceImpl extends ServiceImpl i } @Override - public List findCallItemInfoList(CallItem callItem) { - return callItemMapper.findCallItemInfoList(callItem); + public List findCallItemListPda(CallItem callItem) { + String site = CommonMethods.getSite(); + String user = CommonMethods.getUser(); + NwaUser byId = nwaUserService.getById(HandleEnum.USER.getHandle(site, user)); + String language = LocaleContextHolder.getLocale().getLanguage(); + List nwaUsers = nwaUserService.checkUserGroup(site, "CJ_ZR,ADMINISTRATORS"); + if (nwaUsers.contains(byId)){ + return callItemMapper.findCallItemListPda(site,language,user,callItem); + } + return callItemMapper.findCallItemListPda(site,language,null,callItem); } @Override diff --git a/dispatch/src/main/resources/mapper/CallItemMapper.xml b/dispatch/src/main/resources/mapper/CallItemMapper.xml index 8d486a7c..38f4021e 100644 --- a/dispatch/src/main/resources/mapper/CallItemMapper.xml +++ b/dispatch/src/main/resources/mapper/CallItemMapper.xml @@ -978,41 +978,60 @@ ORDER BY VIP.WORK_ORDER, VIP.ITEM - + SELECT MML.*,ZSD.PLANNED_START_DATE FROM + ( + SELECT ZCI.SITE, CF.VALUE WORK_ORDER, WC.WORK_CENTER, WCT.DESCRIPTION WORK_CENTER_DESCRIPTION, + ZCI.SHOP_ORDER , + IM.ITEM, IT.DESCRIPTION ITEM_DESCRIPTION, + CP.ITEM COMPONENT, ITT.DESCRIPTION COMPONENT_DESCRIPTION, + ZSD.BLANKING_SIZE, + ZCI.RESRCE, ZCI.CALL_TYPE, + /*MIN(SO.PLANNED_START_DATE) ,*/ + SUM(ZCI.REQUIRED_QTY) REQUIRED_QTY + FROM Z_CALL_ITEM ZCI + INNER JOIN Z_SFC_DISPATCH ZSD ON ZSD.HANDLE = ZCI.SFC_DISPATCH_BO + INNER JOIN SHOP_ORDER SO ON SO.SITE = ZCI.SITE AND SO.SHOP_ORDER = ZCI.SHOP_ORDER LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = SO.HANDLE AND CF."ATTRIBUTE" = 'WORK_ORDER' - INNER JOIN BOM_COMPONENT BC ON CI.COMPONENT_BO = BC.COMPONENT_GBO - LEFT JOIN BOM B ON BC.BOM_BO = B.HANDLE - INNER JOIN Z_SFC_DISPATCH SD ON CI.SFC_DISPATCH_BO = SD.HANDLE - LEFT JOIN WORK_CENTER WC ON WC.WORK_CENTER = SD.WORK_CENTER - LEFT JOIN WORK_CENTER_T WCT ON WC.HANDLE = WCT.WORK_CENTER_BO - LEFT JOIN ITEM I ON CI.COMPONENT_BO = I.HANDLE - LEFT JOIN ITEM_T IT ON I.HANDLE = IT.ITEM_BO - WHERE CI.SITE = #{site} AND WCT.LOCALE = 'zh' - - AND SD.WORK_CENTER = #{workCenter} + INNER JOIN WORK_CENTER WC ON WC.HANDLE = SO.PLANNED_WORK_CENTER_BO + INNER JOIN WORK_CENTER_T WCT ON WCT.WORK_CENTER_BO = WC.HANDLE + INNER JOIN ITEM IM ON IM.HANDLE = SO.ITEM_BO + INNER JOIN ITEM_T IT ON IT.ITEM_BO = IM.HANDLE AND IT.LOCALE = #{local} + INNER JOIN ITEM CP ON CP.HANDLE = ZCI.COMPONENT_BO + INNER JOIN ITEM_T ITT ON ITT.ITEM_BO = CP.HANDLE AND ITT.LOCALE = #{local} + WHERE ZCI.SITE = #{site} + GROUP BY ZCI.SITE, CF.VALUE, WC.WORK_CENTER, IM.ITEM, ZSD.BLANKING_SIZE, CP.ITEM, ZCI.RESRCE, ZCI.CALL_TYPE,ZCI.SHOP_ORDER , + WCT.DESCRIPTION ,IT.DESCRIPTION , ITT.DESCRIPTION + ORDER BY CF.VALUE ,ZCI.RESRCE, IM.ITEM ) MML + INNER JOIN + ( SELECT ZSD.BLANKING_SIZE ,ZSD.RESRCE ,ZSD.WORK_CENTER ,ZSD.SHOP_ORDER , + MIN(ZSD.PLANNED_START_DATE) PLANNED_START_DATE + FROM WIP.Z_SFC_DISPATCH ZSD + WHERE ZSD.SITE = #{site} + AND ZSD.EMPLOYEE LIKE #{user} + GROUP BY ZSD.WORK_CENTER ,ZSD.BLANKING_SIZE ,ZSD.SHOP_ORDER ,ZSD.RESRCE + ) ZSD + ON ZSD.SHOP_ORDER = MML.SHOP_ORDER AND ZSD.BLANKING_SIZE = MML.BLANKING_SIZE + AND ZSD.RESRCE = MML.RESRCE AND ZSD.WORK_CENTER = MML.WORK_CENTER + + AND MML.WORK_CENTER = #{callItem.workCenter} - - AND CI.RESRCE = #{resrce} + + AND MML.RESRCE = #{callItem.resrce} - - AND I.ITEM = #{component} + + AND MML.COMPONENT = #{callItem.component} - - AND CI.STATUS = #{status} + + AND MML.STATUS = #{callItem.status} - - AND SD.PLANNED_START_DATE >= #{startFromDate} + + AND ZSD.PLANNED_START_DATE >= #{callItem.startFromDate} - - AND SD.PLANNED_START_DATE <= #{startToDate} + + AND ZSD.PLANNED_START_DATE <= #{callItem.startToDate} - ORDER BY CF.VALUE ,CI.RESRCE, I.ITEM + ORDER BY MML.SHOP_ORDER,MML.WORK_CENTER,MML.ITEM,MML.COMPONENT,MML.BLANKING_SIZE,ZSD.PLANNED_START_DATE