@ -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 s fcBo = HandleEnum . SFC . getHandle ( site , s fc) ;
Sfc sfcModel = sfcService . getById ( s fcBo) ;
//查询生产批次
String s plitS fcBo = HandleEnum . SFC . getHandle ( site , s plitS fc) ;
Sfc sfcModel = sfcService . getById ( s plitS fcBo) ;
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