Browse Source

2025-05-08

同步人员等级接口改为同步人员等级和成本
master
fengyuan_yang 8 months ago
parent
commit
0fee7e6f6f
  1. 36
      src/main/java/com/spring/modules/part/service/impl/RoutingManagementServiceImpl.java
  2. 13
      src/main/java/com/spring/modules/part/task/PartRelatedTask.java
  3. 7
      src/main/resources/application-dev.yml

36
src/main/java/com/spring/modules/part/service/impl/RoutingManagementServiceImpl.java

@ -1341,7 +1341,6 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
* 同步库位到PLM * 同步库位到PLM
*/ */
@Override @Override
@Transactional
public void syncLocationToPLM(LocationInformationVo data) { public void syncLocationToPLM(LocationInformationVo data) {
// 查出最大的 rowVersion // 查出最大的 rowVersion
String rowVersion = routingManagementMapper.getMaxLocationRowVersion(); String rowVersion = routingManagementMapper.getMaxLocationRowVersion();
@ -1384,12 +1383,12 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
.collect(Collectors.toList()); .collect(Collectors.toList());
// 找出需要更新的对象ifsRowVersion不同 // 找出需要更新的对象ifsRowVersion不同
Set<String> commonKeys = new HashSet<>(mapListAll.keySet());
commonKeys.retainAll(mapList1.keySet());
List<LocationInformationEntity> toUpdate = commonKeys.stream()
.filter(key -> !mapListAll.get(key).getIfsRowVersion().equals(mapList1.get(key).getIfsRowVersion()))
.map(key -> mapListAll.get(key)) // 选择listAll中的版本进行更新
.collect(Collectors.toList());
// Set<String> commonKeys = new HashSet<>(mapListAll.keySet());
// commonKeys.retainAll(mapList1.keySet());
// List<LocationInformationEntity> toUpdate = commonKeys.stream()
// .filter(key -> !mapListAll.get(key).getIfsRowVersion().equals(mapList1.get(key).getIfsRowVersion()))
// .map(key -> mapListAll.get(key)) // 选择listAll中的版本进行更新
// .collect(Collectors.toList());
// // 删除 // // 删除
// if (!toDelete.isEmpty()) { // if (!toDelete.isEmpty()) {
@ -1405,23 +1404,22 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
routingManagementMapper.syncSaveLocation(subList); routingManagementMapper.syncSaveLocation(subList);
} }
} }
// 修改
if (!toUpdate.isEmpty()) {
// 分批修改
int batchSize = 100; // 假设每批100条记录
for (int i = 0; i < toUpdate.size(); i += batchSize) {
int end = Math.min(i + batchSize, toUpdate.size());
List<LocationInformationEntity> subList = toUpdate.subList(i, end);
routingManagementMapper.syncUpdateLocation(subList);
}
}
// // 修改
// if (!toUpdate.isEmpty()) {
// // 分批修改
// int batchSize = 100; // 假设每批100条记录
// for (int i = 0; i < toUpdate.size(); i += batchSize) {
// int end = Math.min(i + batchSize, toUpdate.size());
// List<LocationInformationEntity> subList = toUpdate.subList(i, end);
// routingManagementMapper.syncUpdateLocation(subList);
// }
// }
} }
/** /**
* 同步人员等级到PLM * 同步人员等级到PLM
*/ */
@Override @Override
@Transactional
public void syncLaborClassToPLM(PersonnelLevelVo data) { public void syncLaborClassToPLM(PersonnelLevelVo data) {
// 查出最大的 rowVersion // 查出最大的 rowVersion
String rowVersion = routingManagementMapper.getMaxLaborClassRowVersion(); String rowVersion = routingManagementMapper.getMaxLaborClassRowVersion();
@ -1501,7 +1499,6 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
* 同步加工中心到PLM * 同步加工中心到PLM
*/ */
@Override @Override
@Transactional
public void syncWorkCenterToPLM(WorkCenterVo data) { public void syncWorkCenterToPLM(WorkCenterVo data) {
// 查出最大的 rowVersion // 查出最大的 rowVersion
String rowVersion = routingManagementMapper.getMaxWorkCenterRowVersion(); String rowVersion = routingManagementMapper.getMaxWorkCenterRowVersion();
@ -1584,7 +1581,6 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
* 同步加工中心成本到PLM * 同步加工中心成本到PLM
*/ */
@Override @Override
@Transactional
public void syncWorkCenterCostToPLM(WorkCenterCostVo data) { public void syncWorkCenterCostToPLM(WorkCenterCostVo data) {
// 查出最大的 rowVersion // 查出最大的 rowVersion
String rowVersion = routingManagementMapper.getMaxWorkCenterCostRowVersion(); String rowVersion = routingManagementMapper.getMaxWorkCenterCostRowVersion();

13
src/main/java/com/spring/modules/part/task/PartRelatedTask.java

@ -39,10 +39,6 @@ public class PartRelatedTask {
@Scheduled(cron = "${task.data.syncDataToPLM}") @Scheduled(cron = "${task.data.syncDataToPLM}")
public void executeDeviceCollect() { public void executeDeviceCollect() {
String siteCon = convertToSQLString(useSite); String siteCon = convertToSQLString(useSite);
// 同步库位
LocationInformationVo locationVo = new LocationInformationVo();
locationVo.setSiteCon(siteCon);
routingManagementService.syncLocationToPLM(locationVo);
// 同步人员等级 // 同步人员等级
PersonnelLevelVo laborClassVo = new PersonnelLevelVo(); PersonnelLevelVo laborClassVo = new PersonnelLevelVo();
laborClassVo.setSiteCon(siteCon); laborClassVo.setSiteCon(siteCon);
@ -57,6 +53,15 @@ public class PartRelatedTask {
routingManagementService.syncWorkCenterCostToPLM(workCenterCostVo); routingManagementService.syncWorkCenterCostToPLM(workCenterCostVo);
} }
@Scheduled(cron = "${task.data.syncLocationToPLM}")
public void executeDeviceCollect2() {
String siteCon = convertToSQLString(useSite);
// 同步库位
LocationInformationVo locationVo = new LocationInformationVo();
locationVo.setSiteCon(siteCon);
routingManagementService.syncLocationToPLM(locationVo);
}
@Scheduled(cron = "${task.data.syncInventoryPartToPlm}") @Scheduled(cron = "${task.data.syncInventoryPartToPlm}")
public void syncInventoryPartToPlm() { public void syncInventoryPartToPlm() {
// 同步库存件 // 同步库存件

7
src/main/resources/application-dev.yml

@ -73,11 +73,11 @@ ifs-control:
# OA接口路径 # OA接口路径
oa-api: oa-api:
api-url: 'http://192.168.1.55:8068'
api-url: 'http://192.168.1.83:8068'
# OA接口控制 (false 禁止调用;true 开启调用) # OA接口控制 (false 禁止调用;true 开启调用)
oa-control: oa-control:
control-flag: true
control-flag: false
#是否启用域控登录 #是否启用域控登录
ldap-control: ldap-control:
@ -98,9 +98,8 @@ ccl-sms:
task: task:
data: data:
initGather: 0/10 * * * * ? # 每分钟执行 initGather: 0/10 * * * * ? # 每分钟执行
# initGather: * * * 31 2 ? # 每分钟执行
# syncDataToPLM: 0 0/30 * * * ? # 每30分钟执行
syncDataToPLM: 0 0 0 29 2 ? # 每4年执行 syncDataToPLM: 0 0 0 29 2 ? # 每4年执行
syncLocationToPLM: 0 0 0 29 2 ? # 每4年执行
sync_part_catalog_to_plm: 0 0 0 29 2 ? # 每1分钟执行 sync_part_catalog_to_plm: 0 0 0 29 2 ? # 每1分钟执行
syncInventoryPartToPlm: 0 0 0 29 2 ? # 每4年执行 syncInventoryPartToPlm: 0 0 0 29 2 ? # 每4年执行
flag: false flag: false

Loading…
Cancel
Save