@ -17,12 +17,11 @@ import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack ;
import cn.estsh.i3plus.pojo.base.util.StringUtil ;
import cn.estsh.i3plus.pojo.mes.bean.* ;
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingList ;
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingListDetail ;
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingOrderManagement ;
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingOrderManagementDetail ;
import cn.estsh.i3plus.pojo.mes.bean.edi.cd.MesCimVolvoJisRackIdDetail ;
import cn.estsh.i3plus.pojo.mes.bean.shipping.* ;
import cn.estsh.i3plus.pojo.mes.model.MesEquipVariableRwResult ;
import cn.estsh.i3plus.pojo.mes.repository.* ;
import cn.estsh.i3plus.pojo.mes.repository.edi.cd.MesCimVolvoJisRackIdDetailRepository ;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil ;
import cn.estsh.impp.framework.boot.exception.ImppBusiException ;
import cn.estsh.impp.framework.boot.util.SpringContextsUtil ;
@ -119,6 +118,10 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService
@Autowired
private MesVolvoRackRepository mesVolvoRackRDao ;
@Autowired
private MesCustSoftInfoRepository custSoftInfoRDao ;
@Autowired
private MesCimVolvoJisRackIdDetailRepository rackIdDetailRDao ;
@Override
public MesSortShippingCheckModel doShippingOrderNoQuery ( MesShippingOrderManagement shippingOrderManagement ) {
@ -155,6 +158,9 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService
@Override
public MesSortShippingCheckModel saveRackNo ( MesSortShippingCheckModel model , String organizeCode , String userInfo ) {
checkVolvoRack ( model , organizeCode ) ;
MesShippingOrderManagement orderManagement = checkMesShippingOrderManagement ( model ) ;
orderManagement . setRackNo ( model . getVolvoRackNo ( ) ) ;
shippingOrderManagementRepository . update ( orderManagement ) ;
return model ;
}
@ -245,11 +251,33 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService
//根据条码找到对应的物料号, 若物料号一致, 则修改扫描flg, 将flg改为true.
boolean scanFlg = false ;
for ( MesShippingOrderManagementDetail detail : model . getDetailList ( ) ) {
if ( detail . getPartNo ( ) . equals ( produceSn . getPartNo ( ) ) ) {
if ( detail . getPartNo ( ) . equals ( produceSn . getPartNo ( ) ) & & StringUtils . isEmpty ( detail . getPartPosition ( ) ) ) {
scanFlg = true ;
String tmpAfterBarCode = model . getLocationCode ( ) . replaceAll ( "\\p{Cc}" , "" ) ;
String tmpMidStr = tmpAfterBarCode . replace ( "[)>061B" , "" ) ;
String [ ] splitStrArray = tmpMidStr . split ( "1Y" ) ;
if ( splitStrArray . length > 0 ) {
if ( StringUtils . isEmpty ( orderManagement . getRackNo ( ) ) | | ! orderManagement . getRackNo ( ) . contains ( splitStrArray [ 0 ] ) ) {
throw new ImppBusiException ( String . format ( "料箱类型与顺序不一致,请检查数据" ) ) ;
}
}
String detailPosition = ddddd ( model , detail ) ;
String tmpPosition = tmpAfterBarCode . substring ( tmpAfterBarCode . length ( ) - 2 ) ;
StringBuilder splitPosition = new StringBuilder ( ) ;
for ( char c : tmpPosition . toCharArray ( ) ) {
if ( Character . isDigit ( c ) ) {
splitPosition . append ( c ) ;
}
}
//验证位置号
if ( ! detailPosition . contentEquals ( splitPosition ) ) {
throw new ImppBusiException ( String . format ( "零件与位置信息不符,请检查数据" ) ) ;
}
detail . setIsScanFlg ( MesCommonConstant . TRUE_INTEGER ) ;
detail . setBarcode ( produceSn . getSerialNumber ( ) ) ;
// detail.setBarcode(detail.getBarcode() + "," + model.getLocationCode());
detail . setPartPosition ( model . getLocationCode ( ) ) ;
// detail.setStatus(MesExtEnumUtil.SHIPPING_ORDER_STATUS.CREATE.getValue());
shippingOrderManagementDetailRepository . update ( detail ) ;
break ;
}
@ -269,6 +297,23 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService
return model ;
}
private String ddddd ( MesSortShippingCheckModel model , MesShippingOrderManagementDetail detail ) {
MesWorkOrder workOrder = mesWorkOrderService . getWorkOrderNoByCustSn ( model . getOrganizeCode ( ) , model . getSn ( ) ) ;
if ( workOrder = = null | | StringUtils . isEmpty ( workOrder . getWorkOrderSource ( ) ) ) {
return "" ;
}
MesCustSortInfo custSoftInfo = custSoftInfoRDao . getById ( Long . parseLong ( workOrder . getWorkOrderSource ( ) ) ) ;
if ( custSoftInfo ! = null ) {
MesCimVolvoJisRackIdDetail rackIdDetail = rackIdDetailRDao . getById ( custSoftInfo . getSourceId ( ) ) ;
if ( rackIdDetail ! = null ) {
detail . setVisualOrderNo ( workOrder . getWorkOrderNo ( ) ) ;
return rackIdDetail . getPosition ( ) ;
}
}
return "" ;
}
@Override
public MesShippingOrderManagement queryShippingOrderNoByAutoPushOrder ( String shippingGroupNo , String org ) {
//查询最近扫描完成的装车单号
@ -282,7 +327,7 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService
private MesPartShippingGroup getMesPartShippingGroup ( String org , String partShippingGroupCode ) {
if ( StringUtil . isEmpty ( org ) | | StringUtil . isEmpty ( partShippingGroupCode ) ) {
return null ;
throw new ImppBusiException ( "零件发运组信息不存在,请检查数据!" ) ;
}
MesPartShippingGroup shippingGroup = mesPartShippingGroupService . getMesPartShippingGroup ( org , partShippingGroupCode ) ;
if ( Objects . isNull ( shippingGroup ) ) {
@ -473,10 +518,10 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService
private MesProduceSn checkMesProduceSn ( MesSortShippingCheckModel model , String org ) {
//校验条码是否已经扫描
Optional < MesShippingOrderManagementDetail > optional = model . getDetailList ( ) . stream ( ) . filter ( k - > ! StringUtils . isEmpty ( k . getBarcode ( ) ) & & k . getBarcode ( ) . equals ( model . getSn ( ) ) ) . findFirst ( ) ;
if ( optional . isPresent ( ) ) {
throw new ImppBusiException ( String . format ( "【%s】此条码已经扫描过, 请检查数据! " , model . getSn ( ) ) ) ;
}
// Optional<MesShippingOrderManagementDetail> optional = model.getDetailList().stream().filter(k -> !StringUtils.isEmpty(k.getBarcode()) && k.getBarcode().equals(model.getSn())).findFirst();
// if (optional.isPresent()) {
// throw new ImppBusiException(String.format("【%s】此条码已经扫描过, 请检查数据! ", model.getSn()));
// }
DdlPackBean packBean = DdlPackBean . getDdlPackBean ( org ) ;
DdlPreparedPack . getStringEqualPack ( model . getSn ( ) , "productSn" , packBean ) ;
DdlPreparedPack . getOrderByPack ( new Object [ ] { CommonEnumUtil . ASC_OR_DESC . DESC . getValue ( ) } , new String [ ] { "createDatetime" } , packBean ) ;
@ -493,10 +538,10 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService
private void checkStatus ( MesSortShippingCheckModel model , MesProduceSn produceSn ) {
//校验产品条码状态 必须是状态为已下线条码
if ( produceSn . getSnStatus ( ) ! = MesExtEnumUtil . PRODUCE_SN_STATUS . OFFLINE . getValue ( ) & & produceSn . getSnStatus ( ) ! = MesExtEnumUtil . PRODUCE_SN_STATUS . CREATE . getValue ( ) ) {
throw new ImppBusiException ( String . format ( "【%s】此条码状态为【%s】,请选择状态为【%s】或【%s】状态的条码, 请检查数据! " , model . getSn ( ) , MesExtEnumUtil . PRODUCE_SN_STATUS . valueOfDescription ( produceSn . getSnStatus ( ) ) ,
MesExtEnumUtil . PRODUCE_SN_STATUS . OFFLINE . getDescription ( ) , MesExtEnumUtil . PRODUCE_SN_STATUS . CREATE . getDescription ( ) ) ) ;
}
// if (produceSn.getSnStatus() != MesExtEnumUtil.PRODUCE_SN_STATUS.OFFLINE.getValue() && produceSn.getSnStatus() != MesExtEnumUtil.PRODUCE_SN_STATUS.CREATE.getValue()) {
// throw new ImppBusiException(String.format("【%s】此条码状态为【%s】,请选择状态为【%s】或【%s】状态的条码, 请检查数据! ", model.getSn(), MesExtEnumUtil.PRODUCE_SN_STATUS.valueOfDescription(produceSn.getSnStatus()),
// MesExtEnumUtil.PRODUCE_SN_STATUS.OFFLINE.getDescription(),MesExtEnumUtil.PRODUCE_SN_STATUS.CREATE.getDescription()));
// }
//校验产品质量状态 必须是状态为合格条码
if ( produceSn . getQcStatus ( ) ! = MesExtEnumUtil . PRODUCE_QC_STATUS . QUALIFIED . getValue ( ) ) {
throw new ImppBusiException ( String . format ( "【%s】此条码质量状态为【%s】,请选择【%s】状态的条码, 请检查数据! " , model . getSn ( ) , MesExtEnumUtil . PRODUCE_QC_STATUS . valueOfDescription ( produceSn . getQcStatus ( ) ) ,
@ -504,8 +549,8 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService
}
}
// 判断维护的条码是否和扫描的条码一致
private void checkVolvoRack ( MesSortShippingCheckModel model , String organizeCode ) {
//校验发运单是否存在
DdlPackBean rackPackBean = DdlPackBean . getDdlPackBean ( model . getOrganizeCode ( ) ) ;
DdlPreparedPack . getStringEqualPack ( model . getVolvoRackNo ( ) , "barCode" , rackPackBean ) ;
MesVolvoRack volvoRack = mesVolvoRackRDao . getByProperty ( rackPackBean ) ;
@ -596,7 +641,8 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService
//更新应急件库位管理库存出库
mesEmergencyLocationService . doShippingStockOutOnline ( organizeCode , detail . getVisualOrderNo ( ) , userInfo , true ) ;
//条码格式(扫描目视单,扫描条码)
detail . setBarcode ( new StringJoiner ( MesPcnExtConstWords . COMMA ) . add ( detail . getVisualOrderNo ( ) ) . add ( detail . getBarcode ( ) ) . toString ( ) ) ;
// detail.setBarcode(new StringJoiner(MesPcnExtConstWords.COMMA).add(detail.getVisualOrderNo()).add(detail.getBarcode()).toString());
detail . setBarcode ( detail . getBarcode ( ) + "," + detail . getPartPosition ( ) ) ;
}
}
//客供品移库