@ -10,6 +10,7 @@ import com.spring.common.utils.DateUtils;
import com.spring.common.utils.PageUtils ;
import com.spring.ifs.api.IfsServer ;
import com.spring.ifs.bean.BaseSearchBean ;
import com.spring.ifs.bean.RoutingServiceBean ;
import com.spring.ifs.data.PartCatalog ;
import com.spring.modules.base.entity.PersonnelLevel ;
import com.spring.modules.base.utils.DataUtils ;
@ -69,6 +70,9 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
@Autowired
private SysUserDao sysUserDao ;
@Autowired
private RoutingServiceBean routingServiceBean ;
@Value ( "${ifs-control.ifs-username}" )
private String ifsUsername ;
@ -119,6 +123,18 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
return new RoutingIfsTool ( entity ) ;
}
/ * *
* 获取ifsServer
* /
private Server getIfsServer ( String username ) {
SysUserEntity ifsUser = sysUserDao . selectOne ( new QueryWrapper < SysUserEntity > ( ) . eq ( "username" , username ) ) ;
if ( ifsUser = = null | | ! org . apache . commons . lang3 . StringUtils . isNotBlank ( ifsUser . getIfsUsername ( ) ) | | ! org . apache . commons . lang3 . StringUtils . isNotBlank ( ifsUser . getIfsPassword ( ) ) ) {
throw new RuntimeException ( "获取用户的IFS账号密码为空值!" ) ;
}
Server srv = ifsServer . getIfsServer ( ifsUser . getUsername ( ) , ifsUser . getPassword ( ) ) ;
return srv ;
}
/ * *
* routing列表查询
* @param data
@ -139,17 +155,15 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
public void routingManagementSave ( RoutingAllFieldEntity data ) {
/ / 修改主表内容
routingManagementMapper . updateRoutingHeader ( data ) ;
if ( dataUrl ) {
RoutingHeaderEntity RoutingHeader = routingManagementMapper . selectOne ( new QueryWrapper < RoutingHeaderEntity > ( ) . eq ( "site" , data . getSite ( ) ) . eq ( "part_no" , data . getPartNo ( ) ) . eq ( "routing_revision" , data . getRoutingRevision ( ) ) . eq ( "routing_type" , data . getRoutingType ( ) ) ) ;
/ / 判断是否为正式的routingHeader
if ( "Y" . equals ( RoutingHeader . getOfficialFlag ( ) ) ) {
/ / 同步ifs
Server srv = getIfsServer ( data . getUpdateBy ( ) ) ;
RoutingIfsHeader routingIfsHeader = new RoutingIfsHeader ( data ) ;
String updateRoutingHeaderURL = apiUrl + "/routing/ifs/modifyRoutingHeaderToIfs" ;
ResponseData updateRoutingHeaderResponse = HttpClientUtil . doPostByRawWithPLM ( updateRoutingHeaderURL , routingIfsHeader ) ;
if ( ! "200" . equals ( updateRoutingHeaderResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingHeader修改异常:" + updateRoutingHeaderResponse . getMsg ( ) ) ;
Map < String , String > updateRoutingHeaderResponse = routingServiceBean . modifyRoutingHeader ( srv , routingIfsHeader ) ;
if ( ! "200" . equals ( updateRoutingHeaderResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingHeader修改异常:" + updateRoutingHeaderResponse . get ( "resultMsg" ) ) ;
}
}
}
@ -164,17 +178,15 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
public void routingManagementEdit ( RoutingAllFieldEntity data ) {
/ / 修改主表
routingManagementMapper . updateRoutingHeader ( data ) ;
if ( dataUrl ) {
RoutingHeaderEntity RoutingHeader = routingManagementMapper . selectOne ( new QueryWrapper < RoutingHeaderEntity > ( ) . eq ( "site" , data . getSite ( ) ) . eq ( "part_no" , data . getPartNo ( ) ) . eq ( "routing_revision" , data . getRoutingRevision ( ) ) . eq ( "routing_type" , data . getRoutingType ( ) ) ) ;
/ / 判断是否为正式的routingHeader
if ( "Y" . equals ( RoutingHeader . getOfficialFlag ( ) ) ) {
/ / 同步ifs
Server srv = getIfsServer ( data . getUpdateBy ( ) ) ;
RoutingIfsHeader routingIfsHeader = new RoutingIfsHeader ( data ) ;
String updateRoutingHeaderURL = apiUrl + "/routing/ifs/modifyRoutingHeaderToIfs" ;
ResponseData updateRoutingHeaderResponse = HttpClientUtil . doPostByRawWithPLM ( updateRoutingHeaderURL , routingIfsHeader ) ;
if ( ! "200" . equals ( updateRoutingHeaderResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingHeader修改异常:" + updateRoutingHeaderResponse . getMsg ( ) ) ;
Map < String , String > updateRoutingHeaderResponse = routingServiceBean . modifyRoutingHeader ( srv , routingIfsHeader ) ;
if ( ! "200" . equals ( updateRoutingHeaderResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingHeader修改异常:" + updateRoutingHeaderResponse . get ( "resultMsg" ) ) ;
}
}
}
@ -233,11 +245,9 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
HashMap < String , Object > map = new HashMap < > ( ) ;
/ / 查询明细
List < RoutingDetailEntity > detailList = routingManagementMapper . queryRoutingDetail ( data ) ;
/ / 查询子明细
RoutingDetailEntity detailEntity = new RoutingDetailEntity ( ) ;
BeanUtils . copyProperties ( data , detailEntity ) ;
/ / 如果传值有替代编码 , 则查指定的替代
if ( ( StringUtils . isNotBlank ( data . getAlternativeNo ( ) ) ) ) {
detailEntity . setAlternativeNo ( data . getAlternativeNo ( ) ) ;
@ -258,9 +268,7 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
}
}
}
List < RoutingComponentVo > componentList = routingManagementMapper . queryRoutingComponent ( detailEntity ) ;
/ / 返回值
map . put ( "detailList" , detailList ) ;
map . put ( "componentList" , componentList ) ;
@ -324,16 +332,14 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
if ( routingDetailList . isEmpty ( ) ) {
throw new RuntimeException ( "替代不存在或已被删除!" ) ;
}
if ( dataUrl ) {
/ / 判断是否为正式替代
if ( "Y" . equals ( routingDetailList . get ( 0 ) . getOfficialFlag ( ) ) ) {
/ / ifs修改bomDetail
Server srv = getIfsServer ( data . getUpdateBy ( ) ) ;
RoutingIfsAlternative routingIfsDetail = getIfsRoutingDetail ( data ) ;
String updateRoutingDetailURL = apiUrl + "/routing/ifs/modifyRoutingAlternativeToIfs" ;
ResponseData updateRoutingDetailResponse = HttpClientUtil . doPostByRawWithPLM ( updateRoutingDetailURL , routingIfsDetail ) ;
if ( ! "200" . equals ( updateRoutingDetailResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingAlternative修改异常:" + updateRoutingDetailResponse . getMsg ( ) ) ;
Map < String , String > updateRoutingDetailResponse = routingServiceBean . modifyRoutingAlternative ( srv , routingIfsDetail ) ;
if ( ! "200" . equals ( updateRoutingDetailResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingAlternative修改异常:" + updateRoutingDetailResponse . get ( "resultMsg" ) ) ;
}
}
}
@ -364,21 +370,18 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
@Transactional
public Map < String , Object > routingDetailDelete ( RoutingDetailEntity data ) {
HashMap < String , Object > map = new HashMap < > ( ) ;
if ( dataUrl ) {
/ / 判断该替代是否为正式替代
List < RoutingDetailEntity > routingDetailList = routingManagementMapper . checkRoutingDetailOnlyOne ( data ) ;
if ( "Y" . equals ( routingDetailList . get ( 0 ) . getOfficialFlag ( ) ) ) {
/ / ifs删除bomDetail
Server srv = getIfsServer ( data . getUpdateBy ( ) ) ;
RoutingIfsAlternative routingIfsDetail = getIfsRoutingDetail ( routingDetailList . get ( 0 ) ) ;
String deleteRoutingDetailURL = apiUrl + "/routing/ifs/removeRoutingAlternativeToIfs" ;
ResponseData deleteRoutingDetailResponse = HttpClientUtil . doPostByRawWithPLM ( deleteRoutingDetailURL , routingIfsDetail ) ;
if ( ! "200" . equals ( deleteRoutingDetailResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingAlternative删除异常:" + deleteRoutingDetailResponse . getMsg ( ) ) ;
Map < String , String > deleteRoutingDetailResponse = routingServiceBean . removeRoutingAlternative ( srv , routingIfsDetail ) ;
if ( ! "200" . equals ( deleteRoutingDetailResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingAlternative删除异常:" + deleteRoutingDetailResponse . get ( "resultMsg" ) ) ;
}
}
}
/ / 删除替代
routingManagementMapper . routingDetailDelete ( data ) ;
/ / 删除该替代的子明细
@ -448,28 +451,24 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
} else if ( "Buildable" . equals ( checkList . get ( 0 ) . getStatus ( ) ) ) {
data . setStatus ( "Obsolete" ) ;
}
if ( dataUrl ) {
/ / 判断是否为正式替代
if ( "Y" . equals ( checkList . get ( 0 ) . getOfficialFlag ( ) ) ) {
/ / 同步ifs
Server srv = getIfsServer ( data . getUpdateBy ( ) ) ;
RoutingIfsAlternative routingIfsDetail = getIfsRoutingDetail ( checkList . get ( 0 ) ) ;
if ( "Buildable" . equals ( data . getStatus ( ) ) ) { / / 状态修改为buildable
String buildRoutingDetailURL = apiUrl + "/routing/ifs/buildRoutingAlternativeToIfs" ;
ResponseData buildRoutingDetailResponse = HttpClientUtil . doPostByRawWithPLM ( buildRoutingDetailURL , routingIfsDetail ) ;
if ( ! "200" . equals ( buildRoutingDetailResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingAlternative Build异常:" + buildRoutingDetailResponse . getMsg ( ) ) ;
Map < String , String > buildRoutingDetailResponse = routingServiceBean . buildRoutingAlternative ( srv , routingIfsDetail ) ;
if ( ! "200" . equals ( buildRoutingDetailResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingAlternative Build异常:" + buildRoutingDetailResponse . get ( "resultMsg" ) ) ;
}
} else if ( "Obsolete" . equals ( data . getStatus ( ) ) ) { / / 状态修改为Obsolete
String retireRoutingDetailURL = apiUrl + "/routing/ifs/retireRoutingAlternativeToIfs" ;
ResponseData retireRoutingDetailResponse = HttpClientUtil . doPostByRawWithPLM ( retireRoutingDetailURL , routingIfsDetail ) ;
if ( ! "200" . equals ( retireRoutingDetailResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingAlternative Retire异常:" + retireRoutingDetailResponse . getMsg ( ) ) ;
Map < String , String > retireRoutingDetailResponse = routingServiceBean . retireRoutingAlternative ( srv , routingIfsDetail ) ;
if ( ! "200" . equals ( retireRoutingDetailResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingAlternative Retire异常:" + retireRoutingDetailResponse . get ( "resultMsg" ) ) ;
}
}
}
}
/ / 修改替代状态
routingManagementMapper . updateAlternativeStatus ( data ) ;
/ / 查询替代列表
@ -561,7 +560,6 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
}
/ / 新增
routingManagementMapper . routingToolSave ( data ) ;
if ( dataUrl ) {
/ / 判断是否为正式替代
RoutingDetailEntity routingDetailEntity = new RoutingDetailEntity ( ) ;
@ -569,6 +567,7 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
List < RoutingDetailEntity > checkList = routingManagementMapper . checkRoutingDetailOnlyOne ( routingDetailEntity ) ;
if ( "Y" . equals ( checkList . get ( 0 ) . getOfficialFlag ( ) ) ) {
/ / 查工序的rowKey rowVersion
Server srv = getIfsServer ( data . getCreateBy ( ) ) ;
RoutingComponentEntity componentEntity = routingManagementMapper . getRoutingComponentRowKeyAndVersion ( data . getOperationId ( ) ) ;
LinkedList < RoutingIfsTool > routingIfsTools = new LinkedList < > ( ) ;
RoutingIfsTool routingIfsTool = new RoutingIfsTool ( data ) ;
@ -576,12 +575,11 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
routingIfsTool . setIfsRowId ( componentEntity . getIfsRowId ( ) ) ;
routingIfsTool . setIfsRowVersion ( componentEntity . getIfsRowVersion ( ) ) ;
routingIfsTools . add ( routingIfsTool ) ;
String saveRoutingToolURL = apiUrl + "/routing/ifs/syncRoutingIfsToolsToIfs" ;
ResponseData saveRoutingToolResponse = HttpClientUtil . doPostByRawWithPLM ( saveRoutingToolURL , routingIfsTools ) ;
if ( ! "200" . equals ( saveRoutingToolResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingTool 新增异常:" + saveRoutingToolResponse . getMsg ( ) ) ;
Map < String , String > saveRoutingToolResponse = routingServiceBean . syncRoutingTools ( srv , routingIfsTools ) ;
if ( ! "200" . equals ( saveRoutingToolResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingTool 新增异常:" + saveRoutingToolResponse . get ( "resultMsg" ) ) ;
}
String s = String . valueOf ( saveRoutingToolResponse . getObj ( ) ) ;
String s = String . valueOf ( saveRoutingToolResponse . get ( "obj" ) ) ;
List < RoutingIfsTool > routingTool = JSON . parseArray ( s , RoutingIfsTool . class ) ;
if ( ! routingTool . isEmpty ( ) ) {
for ( RoutingIfsTool ifsTool : routingTool ) { / / 修改ifs关键字
@ -658,14 +656,14 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
BeanUtils . copyProperties ( data , routingDetailEntity ) ;
List < RoutingDetailEntity > checkList = routingManagementMapper . checkRoutingDetailOnlyOne ( routingDetailEntity ) ;
if ( "Y" . equals ( checkList . get ( 0 ) . getOfficialFlag ( ) ) ) {
Server srv = getIfsServer ( data . getUpdateBy ( ) ) ;
RoutingIfsTool routingIfsTool = routingManagementMapper . getRoutingToolToIfs ( data ) ;
String updateRoutingToolURL = apiUrl + "/routing/ifs/modifyRoutingIfsToolToIfs" ;
ResponseData updateRoutingToolResponse = HttpClientUtil . doPostByRawWithPLM ( updateRoutingToolURL , routingIfsTool ) ;
if ( ! "200" . equals ( updateRoutingToolResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingTool修改异常:" + updateRoutingToolResponse . getMsg ( ) ) ;
Map < String , String > updateRoutingToolResponse = routingServiceBean . modifyRoutingTool ( srv , routingIfsTool ) ;
if ( ! "200" . equals ( updateRoutingToolResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingTool修改异常:" + updateRoutingToolResponse . get ( "resultMsg" ) ) ;
}
/ / 更新 ifs_row_id ifs_row_version
String s = String . valueOf ( updateRoutingToolResponse . getObj ( ) ) ;
String s = String . valueOf ( updateRoutingToolResponse . get ( "obj" ) ) ;
RoutingIfsTool routingTool = JSON . parseObject ( s , RoutingIfsTool . class ) ;
if ( routingTool ! = null ) {
data . setIfsRowId ( routingTool . getIfsRowId ( ) ) ;
@ -719,13 +717,12 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
routingIfsTools . add ( routingIfsTool ) ;
routingManagementMapper . deleteRoutingTool ( inData ) ;
}
if ( dataUrl ) {
if ( "Y" . equals ( checkList . get ( 0 ) . getOfficialFlag ( ) ) ) {
String deleteRoutingToolURL = apiUrl + "/routing/ifs/removeRoutingIfsToolsToIfs" ;
ResponseData deleteRoutingToolResponse = HttpClientUtil . doPostByRawWithPLM ( deleteRoutingToolURL , routingIfsTools ) ;
if ( ! "200" . equals ( deleteRoutingToolResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingTool删除异常:" + deleteRoutingToolResponse . getMsg ( ) ) ;
Server srv = getIfsServer ( data . getUpdateBy ( ) ) ;
Map < String , String > deleteRoutingToolResponse = routingServiceBean . removeRoutingTools ( srv , routingIfsTools ) ;
if ( ! "200" . equals ( deleteRoutingToolResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingTool删除异常:" + deleteRoutingToolResponse . get ( "resultMsg" ) ) ;
}
}
}
@ -768,11 +765,11 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
/ / 判断上版本的header是否为正式
if ( "Y" . equals ( list . get ( 0 ) . getOfficialFlag ( ) ) ) {
/ / 调用RoutingHeader修改接口
Server srv = getIfsServer ( data . getCreateBy ( ) ) ;
RoutingIfsHeader routingIfsHeader = getIfsRoutingHeader ( list . get ( 0 ) ) ;
String updateRoutingHeaderURL = apiUrl + "/routing/ifs/modifyRoutingHeaderToIfs" ;
ResponseData updateRoutingHeaderResponse = HttpClientUtil . doPostByRawWithPLM ( updateRoutingHeaderURL , routingIfsHeader ) ;
if ( ! "200" . equals ( updateRoutingHeaderResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingHeader修改异常:" + updateRoutingHeaderResponse . getMsg ( ) ) ;
Map < String , String > updateRoutingHeaderResponse = routingServiceBean . modifyRoutingHeader ( srv , routingIfsHeader ) ;
if ( ! "200" . equals ( updateRoutingHeaderResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingHeader修改异常:" + updateRoutingHeaderResponse . get ( "resultMsg" ) ) ;
}
}
}
@ -839,16 +836,15 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
/ / 判断替代是否为正式
List < RoutingDetailEntity > routingDetailList = routingManagementMapper . queryRoutingDetailOfficialFlag ( data ) ;
if ( "Y" . equals ( routingDetailList . get ( 0 ) . getOfficialFlag ( ) ) ) {
/ / 同步ifs
Server srv = getIfsServer ( data . getCreateBy ( ) ) ;
LinkedList < RoutingIfsItem > routingIfsItems = new LinkedList < > ( ) ;
RoutingIfsItem routingIfsItem = getIfsRoutingComponent ( data ) ;
routingIfsItems . add ( routingIfsItem ) ;
String addRoutingComponentURL = apiUrl + "/routing/ifs/syncRoutingIfsItemsToIfs" ;
ResponseData addRoutingComponentResponse = HttpClientUtil . doPostByRawWithPLM ( addRoutingComponentURL , routingIfsItems ) ;
if ( ! "200" . equals ( addRoutingComponentResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingItem新增异常:" + addRoutingComponentResponse . getMsg ( ) ) ;
Map < String , String > addRoutingComponentResponse = routingServiceBean . syncRoutingItems ( srv , routingIfsItems ) ;
if ( ! "200" . equals ( addRoutingComponentResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingItem新增异常:" + addRoutingComponentResponse . get ( "resultMsg" ) ) ;
}
String s = String . valueOf ( addRoutingComponentResponse . getObj ( ) ) ;
String s = String . valueOf ( addRoutingComponentResponse . get ( "obj" ) ) ;
List < RoutingIfsItem > ifsItems = JSON . parseArray ( s , RoutingIfsItem . class ) ;
if ( ! ifsItems . isEmpty ( ) ) {
data . setIfsRowId ( ifsItems . get ( 0 ) . getIfsRowId ( ) ) ;
@ -885,15 +881,14 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
/ / 判断替代是否为正式
List < RoutingDetailEntity > routingDetailList = routingManagementMapper . queryRoutingDetailOfficialFlag ( data ) ;
if ( ! routingDetailList . isEmpty ( ) & & "Y" . equals ( routingDetailList . get ( 0 ) . getOfficialFlag ( ) ) ) {
/ / 同步ifs
Server srv = getIfsServer ( data . getUpdateBy ( ) ) ;
RoutingIfsItem routingIfsItem = routingManagementMapper . getRoutingComponentToIfs ( data ) ;
String updateRoutingComponentURL = apiUrl + "/routing/ifs/modifyRoutingIfsItemToIfs" ;
ResponseData updateRoutingComponentResponse = HttpClientUtil . doPostByRawWithPLM ( updateRoutingComponentURL , routingIfsItem ) ;
if ( ! "200" . equals ( updateRoutingComponentResponse . getCode ( ) ) ) {
throw new RuntimeException ( "ifs RoutingItem修改异常:" + updateRoutingComponentResponse . getMsg ( ) ) ;
Map < String , String > updateRoutingComponentResponse = routingServiceBean . modifyRoutingItem ( srv , routingIfsItem ) ;
if ( ! "200" . equals ( updateRoutingComponentResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "ifs RoutingItem修改异常:" + updateRoutingComponentResponse . get ( "resultMsg" ) ) ;
}
/ / 更新 ifs_row_id ifs_row_version
String s = String . valueOf ( updateRoutingComponentResponse . getObj ( ) ) ;
String s = String . valueOf ( updateRoutingComponentResponse . get ( "obj" ) ) ;
RoutingIfsItem ifsItems = JSON . parseObject ( s , RoutingIfsItem . class ) ;
if ( ifsItems ! = null ) {
data . setIfsRowId ( ifsItems . getIfsRowId ( ) ) ;
@ -940,10 +935,10 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
}
if ( dataUrl ) {
if ( "Y" . equals ( routingDetailList . get ( 0 ) . getOfficialFlag ( ) ) ) {
String deleteRoutingComponentURL = apiUrl + "/routing/ifs/removeRoutingIfsItemsToIfs" ;
ResponseData deleteRoutingComponentResponse = HttpClientUtil . doPostByRawWithPLM ( deleteRoutingComponentURL , routingIfsItems ) ;
if ( ! "200" . equals ( deleteRoutingComponentResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingItem删除异常:" + deleteRoutingComponentResponse . getMsg ( ) ) ;
Server srv = getIfsServer ( data . getUpdateBy ( ) ) ;
Map < String , String > deleteRoutingComponentResponse = routingServiceBean . removeRoutingItems ( srv , routingIfsItems ) ;
if ( ! "200" . equals ( deleteRoutingComponentResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingItem删除异常:" + deleteRoutingComponentResponse . get ( "resultMsg" ) ) ;
}
}
}
@ -1226,12 +1221,11 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
if ( ! "Y" . equals ( partInformationEntity . getStatus ( ) ) ) {
throw new RuntimeException ( "非正式物料!" ) ;
}
routingManagementMapper . updateRoutingHeaderOfficialFlag ( data ) ;
routingManagementMapper . updateRoutingDetailOfficialFlag ( data ) ;
if ( dataUrl ) {
/ / 判断是否已同步RoutingHeader
Server srv = getIfsServer ( data . getUpdateBy ( ) ) ;
RoutingHeaderEntity bomHeader = routingManagementMapper . selectOne ( new QueryWrapper < RoutingHeaderEntity > ( ) . eq ( "site" , data . getSite ( ) ) . eq ( "part_no" , data . getPartNo ( ) ) . eq ( "routing_revision" , data . getRoutingRevision ( ) ) . eq ( "routing_type" , data . getRoutingType ( ) ) ) ;
RoutingIfsHeader routingIfsHeader = new RoutingIfsHeader ( ) ;
routingIfsHeader . setContract ( data . getSite ( ) ) ;
@ -1241,48 +1235,42 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
routingIfsHeader . setPhaseInDate ( DateUtils . format ( bomHeader . getPhaseInDate ( ) ) ) ;
routingIfsHeader . setPhaseOutDate ( DateUtils . format ( bomHeader . getPhaseOutDate ( ) ) ) ;
routingIfsHeader . setNoteText ( bomHeader . getNoteText ( ) ) ;
String getRoutingHeaderURL = apiUrl + "/routing/ifs/getRoutingHeader" ;
ResponseData getRoutingHeaderResponse = HttpClientUtil . doPostByRawWithPLM ( getRoutingHeaderURL , routingIfsHeader ) ;
if ( ! "200" . equals ( getRoutingHeaderResponse . getCode ( ) ) ) { / / 未同步
String addRoutingHeaderURL = apiUrl + "/routing/ifs/syncRoutingHeaderToIfs" ;
ResponseData addRoutingHeaderResponse = HttpClientUtil . doPostByRawWithPLM ( addRoutingHeaderURL , routingIfsHeader ) ;
if ( ! "200" . equals ( addRoutingHeaderResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingHeader新增异常:" + addRoutingHeaderResponse . getMsg ( ) ) ;
Map < String , String > getRoutingHeaderResponse = routingServiceBean . getRoutingHeader ( srv , routingIfsHeader ) ;
if ( ! "200" . equals ( getRoutingHeaderResponse . get ( "resultCode" ) ) ) { / / 未同步
Map < String , String > addRoutingHeaderResponse = routingServiceBean . syncRoutingHeader ( srv , routingIfsHeader ) ;
if ( ! "200" . equals ( addRoutingHeaderResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingHeader新增异常:" + addRoutingHeaderResponse . get ( "resultMsg" ) ) ;
}
} else { / / 修改
String updateRoutingHeaderURL = apiUrl + "/routing/ifs/modifyRoutingHeaderToIfs" ;
ResponseData updateRoutingHeaderResponse = HttpClientUtil . doPostByRawWithPLM ( updateRoutingHeaderURL , routingIfsHeader ) ;
if ( ! "200" . equals ( updateRoutingHeaderResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingHeader修改异常:" + updateRoutingHeaderResponse . getMsg ( ) ) ;
Map < String , String > updateRoutingHeaderResponse = routingServiceBean . modifyRoutingHeader ( srv , routingIfsHeader ) ;
if ( ! "200" . equals ( updateRoutingHeaderResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingHeader修改异常:" + updateRoutingHeaderResponse . get ( "resultMsg" ) ) ;
}
}
/ / 判断是否已同步RoutingDetail
RoutingIfsAlternative routingIfsAlternative = getIfsRoutingDetail ( data ) ;
String getRoutingDetailURL = apiUrl + "/routing/ifs/getRoutingAlternative" ;
ResponseData getRoutingDetailResponse = HttpClientUtil . doPostByRawWithPLM ( getRoutingDetailURL , routingIfsAlternative ) ;
if ( ! "200" . equals ( getRoutingDetailResponse . getCode ( ) ) ) { / / 未同步
String addRoutingDetailURL = apiUrl + "/routing/ifs/syncRoutingAlternativeToIfs" ;
ResponseData addRoutingDetailResponse = HttpClientUtil . doPostByRawWithPLM ( addRoutingDetailURL , routingIfsAlternative ) ;
if ( ! "200" . equals ( addRoutingDetailResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingAlternative新增异常:" + addRoutingDetailResponse . getMsg ( ) ) ;
Map < String , String > getRoutingDetailResponse = routingServiceBean . getRoutingAlternative ( srv , routingIfsAlternative ) ;
if ( ! "200" . equals ( getRoutingDetailResponse . get ( "resultCode" ) ) ) { / / 未同步
Map < String , String > addRoutingDetailResponse = routingServiceBean . syncRoutingAlternative ( srv , routingIfsAlternative ) ;
if ( ! "200" . equals ( addRoutingDetailResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingAlternative新增异常:" + addRoutingDetailResponse . get ( "resultMsg" ) ) ;
}
} else { / / 修改
String updateRoutingDetailURL = apiUrl + "/routing/ifs/modifyRoutingAlternativeToIfs" ;
ResponseData updateRoutingDetailResponse = HttpClientUtil . doPostByRawWithPLM ( updateRoutingDetailURL , routingIfsAlternative ) ;
if ( ! "200" . equals ( updateRoutingDetailResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingAlternative修改异常:" + updateRoutingDetailResponse . getMsg ( ) ) ;
Map < String , String > updateRoutingDetailResponse = routingServiceBean . modifyRoutingAlternative ( srv , routingIfsAlternative ) ;
if ( ! "200" . equals ( updateRoutingDetailResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingAlternative修改异常:" + updateRoutingDetailResponse . get ( "resultMsg" ) ) ;
}
}
/ / 同步RoutingComponent
List < RoutingIfsItem > componentList = routingManagementMapper . getRoutingComponent ( data ) ;
if ( ! componentList . isEmpty ( ) ) {
String addRoutingComponentURL = apiUrl + "/routing/ifs/syncRoutingIfsItemsToIfs" ;
ResponseData addRoutingComponentResponse = HttpClientUtil . doPostByRawWithPLM ( addRoutingComponentURL , componentList ) ;
if ( ! "200" . equals ( addRoutingComponentResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingItem新增异常:" + addRoutingComponentResponse . getMsg ( ) ) ;
Map < String , String > addRoutingComponentResponse = routingServiceBean . syncRoutingItems ( srv , componentList ) ;
if ( ! "200" . equals ( addRoutingComponentResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingItem新增异常:" + addRoutingComponentResponse . get ( "resultMsg" ) ) ;
}
String s = String . valueOf ( addRoutingComponentResponse . getObj ( ) ) ;
String s = String . valueOf ( addRoutingComponentResponse . get ( "obj" ) ) ;
List < RoutingIfsItem > ifsItems = JSON . parseArray ( s , RoutingIfsItem . class ) ;
if ( ! ifsItems . isEmpty ( ) ) {
for ( RoutingIfsItem ifsItem : ifsItems ) { / / 修改ifs关键字
@ -1294,14 +1282,13 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
}
/ / 同步RoutingTool
List < RoutingToolEntity > routingTools = routingManagementMapper . getRoutingToolByAlternative ( data ) ;
List < RoutingIfs Tool > routingTools = routingManagementMapper . getRoutingToolByAlternative ( data ) ;
if ( ! routingTools . isEmpty ( ) ) {
String addRoutingToolURL = apiUrl + "/routing/ifs/syncRoutingIfsToolsToIfs" ;
ResponseData addRoutingToolResponse = HttpClientUtil . doPostByRawWithPLM ( addRoutingToolURL , routingTools ) ;
if ( ! "200" . equals ( addRoutingToolResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingTool新增异常:" + addRoutingToolResponse . getMsg ( ) ) ;
Map < String , String > addRoutingToolResponse = routingServiceBean . syncRoutingTools ( srv , routingTools ) ;
if ( ! "200" . equals ( addRoutingToolResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingTool新增异常:" + addRoutingToolResponse . get ( "resultMsg" ) ) ;
}
String RoutingToolObj = String . valueOf ( addRoutingToolResponse . getObj ( ) ) ;
String RoutingToolObj = String . valueOf ( addRoutingToolResponse . get ( "obj" ) ) ;
List < RoutingIfsTool > ifsTools = JSON . parseArray ( RoutingToolObj , RoutingIfsTool . class ) ;
if ( ! ifsTools . isEmpty ( ) ) {
for ( RoutingIfsTool ifsTool : ifsTools ) { / / 修改ifs关键字
@ -1315,12 +1302,11 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
/ / 同步WorkGuideline
List < RoutingIfsGuideLine > routingGuidelines = routingManagementMapper . getGuideLineByAlternative ( data ) ;
if ( ! routingGuidelines . isEmpty ( ) ) {
String addRoutingGuidelineURL = apiUrl + "/routing/ifs/syncRoutingIfsGuideLinesToIfs" ;
ResponseData addRoutingGuidelineResponse = HttpClientUtil . doPostByRawWithPLM ( addRoutingGuidelineURL , routingGuidelines ) ;
if ( ! "200" . equals ( addRoutingGuidelineResponse . getCode ( ) ) ) {
throw new RuntimeException ( "IFS RoutingGuideline新增异常:" + addRoutingGuidelineResponse . getMsg ( ) ) ;
Map < String , String > addRoutingGuidelineResponse = routingServiceBean . syncRoutingGuideLines ( srv , routingGuidelines ) ;
if ( ! "200" . equals ( addRoutingGuidelineResponse . get ( "resultCode" ) ) ) {
throw new RuntimeException ( "IFS RoutingGuideline新增异常:" + addRoutingGuidelineResponse . get ( "resultMsg" ) ) ;
}
String RoutingGuidelineObj = String . valueOf ( addRoutingGuidelineResponse . getObj ( ) ) ;
String RoutingGuidelineObj = String . valueOf ( addRoutingGuidelineResponse . get ( "obj" ) ) ;
List < RoutingIfsGuideLine > ifsGuidelines = JSON . parseArray ( RoutingGuidelineObj , RoutingIfsGuideLine . class ) ;
if ( ! ifsGuidelines . isEmpty ( ) ) {
for ( RoutingIfsGuideLine ifsGuideline : ifsGuidelines ) { / / 修改ifs关键字
@ -1358,16 +1344,7 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
String rowVersion = routingManagementMapper . getMaxLocationRowVersion ( ) ;
data . setIfsRowVersion ( rowVersion ) ;
/ / 调用接口获得IFS数据
/ / String getIfsLocationsURL = apiUrl + "/base/ifs/getIfsLocations" ;
/ / ResponseData getIfsLocationsResponse = HttpClientUtil . doPostByRawWithPLM ( getIfsLocationsURL , data ) ;
/ / if ( ! "200" . equals ( getIfsLocationsResponse . getCode ( ) ) ) {
/ / throw new RuntimeException ( "同步库位信息异常:" + getIfsLocationsResponse . getMsg ( ) ) ;
/ / }
/ / String LocationsObj = String . valueOf ( getIfsLocationsResponse . getObj ( ) ) ;
/ / List < LocationInformationEntity > ifsLocations = JSON . parseArray ( LocationsObj , LocationInformationEntity . class ) ;
/ / 获取连接
/ / 获取连接
Server srv = ifsServer . getIfsServer ( ifsUsername , ifsPassword ) ;
PartInformationEntity baseSearchData = new PartInformationEntity ( ) ;
baseSearchData . setSiteCon ( data . getSiteCon ( ) ) ;
@ -1379,7 +1356,6 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
throw new RuntimeException ( e . getMessage ( ) ) ;
}
/ / 查询PLM数据
String [ ] arr = data . getSiteCon ( ) . replace ( "(" , "" ) . replace ( ")" , "" ) . replace ( "'" , "" ) . split ( "," ) ;
List < LocationInformationEntity > plmLocations = routingManagementMapper . getPLMLocations ( arr ) ;
@ -1448,15 +1424,7 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
String rowVersion = routingManagementMapper . getMaxLaborClassRowVersion ( ) ;
data . setIfsRowVersion ( rowVersion ) ;
/ / 调用接口获得IFS数据
/ / String getIfsLaborClasssURL = apiUrl + "/base/ifs/getIfsLaborClasss" ;
/ / ResponseData getIfsLaborClasssResponse = HttpClientUtil . doPostByRawWithPLM ( getIfsLaborClasssURL , data ) ;
/ / if ( ! "200" . equals ( getIfsLaborClasssResponse . getCode ( ) ) ) {
/ / throw new RuntimeException ( "同步人员等级信息异常:" + getIfsLaborClasssResponse . getMsg ( ) ) ;
/ / }
/ / String LaborClasssObj = String . valueOf ( getIfsLaborClasssResponse . getObj ( ) ) ;
/ / List < PersonnelLevel > ifsLaborClass = JSON . parseArray ( LaborClasssObj , PersonnelLevel . class ) ;
/ / 获取连接
/ / 获取连接
Server srv = ifsServer . getIfsServer ( ifsUsername , ifsPassword ) ;
PartInformationEntity baseSearchData = new PartInformationEntity ( ) ;
baseSearchData . setSiteCon ( data . getSiteCon ( ) ) ;
@ -1468,7 +1436,6 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
throw new RuntimeException ( e . getMessage ( ) ) ;
}
/ / 查询PLM数据
String [ ] arr = data . getSiteCon ( ) . replace ( "(" , "" ) . replace ( ")" , "" ) . replace ( "'" , "" ) . split ( "," ) ;
List < PersonnelLevel > plmLaborClasss = routingManagementMapper . getPLMLaborClasss ( arr ) ;
@ -1537,15 +1504,7 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
String rowVersion = routingManagementMapper . getMaxWorkCenterRowVersion ( ) ;
data . setIfsRowVersion ( rowVersion ) ;
/ / 调用接口获得IFS数据
/ / String getIfsWorkCentersURL = apiUrl + "/base/ifs/getIfsWorkCenterNos" ;
/ / ResponseData getIfsWorkCentersResponse = HttpClientUtil . doPostByRawWithPLM ( getIfsWorkCentersURL , data ) ;
/ / if ( ! "200" . equals ( getIfsWorkCentersResponse . getCode ( ) ) ) {
/ / throw new RuntimeException ( "同步加工中心信息异常:" + getIfsWorkCentersResponse . getMsg ( ) ) ;
/ / }
/ / String workCentersObj = String . valueOf ( getIfsWorkCentersResponse . getObj ( ) ) ;
/ / List < WorkCenter > ifsWorkCenters = JSON . parseArray ( workCentersObj , WorkCenter . class ) ;
/ / 获取连接
/ / 获取连接
Server srv = ifsServer . getIfsServer ( ifsUsername , ifsPassword ) ;
PartInformationEntity baseSearchData = new PartInformationEntity ( ) ;
baseSearchData . setSiteCon ( data . getSiteCon ( ) ) ;