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
*/
@Override
@Transactional
public void syncLocationToPLM(LocationInformationVo data) {
// 查出最大的 rowVersion
String rowVersion = routingManagementMapper.getMaxLocationRowVersion();
@ -1384,12 +1383,12 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
.collect(Collectors.toList());
// 找出需要更新的对象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()) {
@ -1405,23 +1404,22 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
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
*/
@Override
@Transactional
public void syncLaborClassToPLM(PersonnelLevelVo data) {
// 查出最大的 rowVersion
String rowVersion = routingManagementMapper.getMaxLaborClassRowVersion();
@ -1501,7 +1499,6 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
* 同步加工中心到PLM
*/
@Override
@Transactional
public void syncWorkCenterToPLM(WorkCenterVo data) {
// 查出最大的 rowVersion
String rowVersion = routingManagementMapper.getMaxWorkCenterRowVersion();
@ -1584,7 +1581,6 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
* 同步加工中心成本到PLM
*/
@Override
@Transactional
public void syncWorkCenterCostToPLM(WorkCenterCostVo data) {
// 查出最大的 rowVersion
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}")
public void executeDeviceCollect() {
String siteCon = convertToSQLString(useSite);
// 同步库位
LocationInformationVo locationVo = new LocationInformationVo();
locationVo.setSiteCon(siteCon);
routingManagementService.syncLocationToPLM(locationVo);
// 同步人员等级
PersonnelLevelVo laborClassVo = new PersonnelLevelVo();
laborClassVo.setSiteCon(siteCon);
@ -57,6 +53,15 @@ public class PartRelatedTask {
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}")
public void syncInventoryPartToPlm() {
// 同步库存件

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

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

Loading…
Cancel
Save