拆分修改保存派工数据

master
Leon 3 years ago
parent 093659ec9d
commit 77f4c55979

@ -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);
/**
*

@ -50,4 +50,5 @@ public interface SfcDispatchMapper extends BaseMapper<SfcDispatch> {
SfcDispatchDto findSfcDispatchBySfc(@Param("site")String site, @Param("dto")SfcDispatchDto sfcDispatch);
List<SfcDispatch> findSplitSfcDispatch(@Param("site") String site, @Param("sfc") String sfc, @Param("stepId") int stepId);
}

@ -20,7 +20,6 @@ import com.baomidou.mybatisplus.annotation.IdType;
*/
@TableName("Z_SFC_DISPATCH")
public class SfcDispatch extends Model<SfcDispatch> {
private static final long serialVersionUID = 1L;

@ -599,36 +599,88 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
return flag;
}
@Override
public void saveSfcDispatch(String site, String user, String workCenter, String sfc, String shopOrder, String routerBo) {
public void saveSplitSfcDispatch(String site, String user, String category, String shopOrder, String sfc, String operation, String stepId, String splitSfc, String routerBo) {
LocalDateTime nowDate = LocalDateTime.now();
//查询工单信息
String shopOrderBo = HandleEnum.SHOP_ORDER.getHandle(site, shopOrder);
ShopOrder shopOrderModel = shopOrderService.getById(shopOrderBo);
if (shopOrderModel == null) {
throw new BaseException("工单[" + shopOrder + "]不存在");
return;
}
//查询生产批次信息
String sfcBo = HandleEnum.SFC.getHandle(site, sfc);
Sfc sfcModel = sfcService.getById(sfcBo);
//查询生产批次
String splitSfcBo = HandleEnum.SFC.getHandle(site, splitSfc);
Sfc sfcModel = sfcService.getById(splitSfcBo);
if (sfcModel == null) {
throw new BaseException("生产批次[" + sfc + "]不存在");
return;
}
//查询工艺路线
Router routerModel = routerService.getById(routerBo);
if (routerModel == null) {
throw new BaseException("工艺路线[" +StringUtils.trimHandle(routerBo)+ "]不存在");
}
//生成新拆分的批次派工数量
if ("N".equals(category) || "R".equals(category)) {
int stepIdInt = Integer.parseInt(stepId);
List<SfcDispatch> sfcDispatchList = sfcDispatchMapper.findSplitSfcDispatch(site, sfc, stepIdInt);
if (sfcDispatchList == null || sfcDispatchList.size() <= 0) {
return;
}
//查询工艺路线详细
List<RouterDTO> routerList = shopOrderReleaseService.selectShopOrderRouter(routerBo);
if (routerList == null || routerList.size() <= 0) {
throw new BaseException("工艺路线[" +StringUtils.trimHandle(routerBo)+ "]主数据不完整,请确认");
List<SfcDispatch> 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<RouterDTO> routerList = shopOrderReleaseService.selectShopOrderRouter(routerBo);
if (routerList == null || routerList.size() <= 0) {
throw new BaseException("工艺路线[" + StringUtils.trimHandle(routerBo) + "]主数据不完整,请确认");
}
shopOrderReleaseService.sfcDispatch(site, user, shopOrderModel, sfcModel, routerList);
}
}
@Override

@ -807,4 +807,10 @@
<if test="dto.handle!=null"> AND HANDLE=#{dto.handle}</if>
</select>
<select id="findSplitSfcDispatch" parameterMap="BaseResultMap">
SELECT <include refid="Base_Column_List"> </include>
FROM Z_SFC_DISPATCH
WHERE SITE = #{site} AND SFC = #{sfc} AND TO_NUMBER(STEP_ID) >= #{stepId}
</select>
</mapper>

@ -159,7 +159,7 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> 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<SplitSfcMapper, SplitSfc> 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));

Loading…
Cancel
Save