From 77f4c55979e5d412be385342a4b543847f2f42e9 Mon Sep 17 00:00:00 2001 From: Leon <3066758958@qq.com> Date: Thu, 26 Aug 2021 18:32:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=86=E5=88=86=E4=BF=AE=E6=94=B9=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E6=B4=BE=E5=B7=A5=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/SfcDispatchCommonService.java | 11 ++- .../dispatch/mapper/SfcDispatchMapper.java | 1 + .../mesnac/dispatch/model/SfcDispatch.java | 1 - .../service/impl/SfcDispatchServiceImpl.java | 84 +++++++++++++++---- .../resources/mapper/SfcDispatchMapper.xml | 6 ++ .../service/impl/SplitSfcServiceImpl.java | 4 +- 6 files changed, 84 insertions(+), 23 deletions(-) diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/SfcDispatchCommonService.java b/common/src/main/java/com/foreverwin/mesnac/common/service/SfcDispatchCommonService.java index 7ced1e8e..da3078b0 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/service/SfcDispatchCommonService.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/service/SfcDispatchCommonService.java @@ -12,16 +12,19 @@ import com.foreverwin.mesnac.common.dto.SfcDispatchDto; public interface SfcDispatchCommonService { /** - * 报废保存派工数据 + * 拆分派工数据创建 * * @param site * @param user - * @param workCenter - * @param sfc + * @param category N|正常拆分; R|返工拆分 * @param shopOrder + * @param sfc + * @param operation 当前工序 + * @param stepId + * @param splitSfc * @param routerBo */ - void saveSfcDispatch(String site, String user, String workCenter,String sfc, String shopOrder, String routerBo); + void saveSplitSfcDispatch(String site, String user, String category, String shopOrder, String sfc, String operation, String stepId, String splitSfc, String routerBo); /** * 修改派工单状态 diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/SfcDispatchMapper.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/SfcDispatchMapper.java index fe88aa95..7fded5a0 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/SfcDispatchMapper.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/SfcDispatchMapper.java @@ -50,4 +50,5 @@ public interface SfcDispatchMapper extends BaseMapper { SfcDispatchDto findSfcDispatchBySfc(@Param("site")String site, @Param("dto")SfcDispatchDto sfcDispatch); + List findSplitSfcDispatch(@Param("site") String site, @Param("sfc") String sfc, @Param("stepId") int stepId); } \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/model/SfcDispatch.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/model/SfcDispatch.java index 8db2d18c..5d7ae3aa 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/model/SfcDispatch.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/model/SfcDispatch.java @@ -20,7 +20,6 @@ import com.baomidou.mybatisplus.annotation.IdType; */ @TableName("Z_SFC_DISPATCH") - public class SfcDispatch extends Model { private static final long serialVersionUID = 1L; diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java index c2066bb3..3f657297 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java @@ -599,36 +599,88 @@ public class SfcDispatchServiceImpl extends ServiceImpl sfcDispatchList = sfcDispatchMapper.findSplitSfcDispatch(site, sfc, stepIdInt); + if (sfcDispatchList == null || sfcDispatchList.size() <= 0) { + return; + } - //查询工艺路线详细 - List routerList = shopOrderReleaseService.selectShopOrderRouter(routerBo); - if (routerList == null || routerList.size() <= 0) { - throw new BaseException("工艺路线[" +StringUtils.trimHandle(routerBo)+ "]主数据不完整,请确认"); + List newSfcDispatchList = new ArrayList<>(); + for (SfcDispatch sfcDispatch : sfcDispatchList) { + String _stepId = sfcDispatch.getStepId(); + + String dispatchNo = splitSfc + "-" + _stepId; + SfcDispatch sfcDispatchModel = new SfcDispatch(); + sfcDispatchModel.setHandle(HandleEnum.SFC_DISPATCH.getHandle(site, dispatchNo)); + sfcDispatchModel.setSite(site); + sfcDispatchModel.setShopOrder(shopOrder); + sfcDispatchModel.setSfc(splitSfc); + sfcDispatchModel.setDispatchSeq(sfcDispatch.getDispatchSeq() + ""); + sfcDispatchModel.setDispatchNo(dispatchNo); + sfcDispatchModel.setDispatchStatus(Constants.STATUS_NEW); + sfcDispatchModel.setIsLock(Constants.STATUS_N); + sfcDispatchModel.setRouterBo(sfcDispatch.getRouterBo()); + sfcDispatchModel.setStepId(_stepId); + sfcDispatchModel.setOperation(sfcDispatch.getOperation()); + sfcDispatchModel.setResourceType(sfcDispatch.getResourceType()); + sfcDispatchModel.setWorkCenter(sfcDispatch.getWorkCenter()); + sfcDispatchModel.setDispatchQty(sfcModel.getQty()); + sfcDispatchModel.setProdHours(sfcDispatch.getProdHours()); + sfcDispatchModel.setTurnOperation("false"); + sfcDispatchModel.setSoReleasedDate(nowDate); + sfcDispatchModel.setIsDispatch(Constants.BOOL_FALSE); + sfcDispatchModel.setIsImport(Constants.BOOL_FALSE); + sfcDispatchModel.setIsFirstOperation(sfcDispatch.getIsFirstOperation()); + sfcDispatchModel.setCreateUser(user); + sfcDispatchModel.setCreatedDateTime(nowDate); + sfcDispatchModel.setModifyUser(user); + sfcDispatchModel.setModifiedDateTime(nowDate); + sfcDispatchModel.setOther1("false"); + newSfcDispatchList.add(sfcDispatchModel); + } + + if (newSfcDispatchList != null && newSfcDispatchList.size() > 0) { + this.saveBatch(newSfcDispatchList); + } } + //返工工艺路线保存派工数据 + if ("R".equals(category)) { + Router routerModel = routerService.getById(routerBo); + if (routerModel == null) { + throw new BaseException("工艺路线[" + StringUtils.trimHandle(routerBo) + "]不存在"); + } - shopOrderReleaseService.sfcDispatch(site, user, shopOrderModel, sfcModel, routerList); + //查询工艺路线详细 + List routerList = shopOrderReleaseService.selectShopOrderRouter(routerBo); + if (routerList == null || routerList.size() <= 0) { + throw new BaseException("工艺路线[" + StringUtils.trimHandle(routerBo) + "]主数据不完整,请确认"); + } + + + shopOrderReleaseService.sfcDispatch(site, user, shopOrderModel, sfcModel, routerList); + } } @Override diff --git a/dispatch/src/main/resources/mapper/SfcDispatchMapper.xml b/dispatch/src/main/resources/mapper/SfcDispatchMapper.xml index a3f83381..46014c8a 100644 --- a/dispatch/src/main/resources/mapper/SfcDispatchMapper.xml +++ b/dispatch/src/main/resources/mapper/SfcDispatchMapper.xml @@ -807,4 +807,10 @@ AND HANDLE=#{dto.handle} + + 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 1b26a1fb..b052b6ce 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 @@ -159,7 +159,7 @@ public class SplitSfcServiceImpl extends ServiceImpl i splitSfc.setCreatedDateTime(LocalDateTime.now()); save(splitSfc); Router routerBySfcBo = routerService.getRouterBySfcBo(HandleEnum.SFC.getHandle(site, sfc)); - sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),null,newSfc, sfcData.getShopOrder(),routerBySfcBo.getHandle()); + sfcDispatchCommonService.saveSplitSfcDispatch(site, CommonMethods.getUser(), "N", sfcData.getShopOrder(), sfc, operation, sfcDto.getStepId(),newSfc, routerBySfcBo.getHandle()); return splitSfc; } catch (Exception e) { ExceptionUtil.throwException(e); @@ -256,7 +256,7 @@ public class SplitSfcServiceImpl extends ServiceImpl i if (routerOperationByRouterBo.isEmpty()){ throw new BaseException("处置工艺路线没有步骤"); } - sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),null,newSfc, sfcData.getShopOrder(),maxRevisionRouter.getHandle()); + sfcDispatchCommonService.saveSplitSfcDispatch(site, CommonMethods.getUser(),"R", sfcData.getShopOrder(), sfc, operation, sfcDispatchBySfc.getStepId(),newSfc, maxRevisionRouter.getHandle()); } SplitSfc splitSfc=new SplitSfc(); splitSfc.setHandle(HandleEnum.SPLIT_SFC.getHandle(site,newSfc));