|
@@ -3,20 +3,27 @@ package com.rongwei.bscommon.sys.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.rongwei.bscommon.sys.dao.CommonDao;
|
|
|
import com.rongwei.bscommon.sys.dao.EquOverhaulInventoryMapperDao;
|
|
|
import com.rongwei.bscommon.sys.service.EquOverhaulInventoryService;
|
|
|
import com.rongwei.bscommon.sys.service.SlaveSourceService;
|
|
|
+import com.rongwei.bscommon.sys.utils.CommonUtils;
|
|
|
+import com.rongwei.bscommon.sys.utils.StringUtil;
|
|
|
import com.rongwei.bsentity.domain.EquOverhaulInventoryDo;
|
|
|
import com.rongwei.bsentity.domain.VInventoryVo;
|
|
|
import com.rongwei.rwadmincommon.system.domain.SysOrganizationDo;
|
|
|
+import com.rongwei.rwadmincommon.system.vo.SysOrganizationVo;
|
|
|
+import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
|
import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -40,6 +47,9 @@ public class EquOverhaulInventoryServiceImpl extends ServiceImpl<EquOverhaulInve
|
|
|
@Autowired
|
|
|
private SlaveSourceService slaveSourceService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CommonDao commonDao;
|
|
|
+
|
|
|
@Override
|
|
|
public void updateInventoryReminderStatus() {
|
|
|
equOverhaulInventoryMapperDao.updateInventoryReminderStatus();
|
|
@@ -51,14 +61,27 @@ public class EquOverhaulInventoryServiceImpl extends ServiceImpl<EquOverhaulInve
|
|
|
List<EquOverhaulInventoryDo> equOverhaulInventoryDos = new ArrayList<>();
|
|
|
// 获取创新所有库存
|
|
|
List<VInventoryVo> allOracleInventory = slaveSourceService.getAllOracleInventory();
|
|
|
+ // 查询所有工厂数据
|
|
|
+ List<SysOrganizationVo> factoryList = commonDao.getAllFactoryNameAndId();
|
|
|
// 查询库存表已有数据列表
|
|
|
List<EquOverhaulInventoryDo> queryInventoryDos = equOverhaulInventoryService.list(new LambdaQueryWrapper<EquOverhaulInventoryDo>().eq(EquOverhaulInventoryDo::getDeleted, 0));
|
|
|
for (VInventoryVo inventoryVo : allOracleInventory) {
|
|
|
EquOverhaulInventoryDo equOverhaulInventoryDo = new EquOverhaulInventoryDo();
|
|
|
- if (queryInventoryDos.stream().noneMatch(a->a.getAccessorycode().equals(inventoryVo.getCode()))){
|
|
|
+ if (queryInventoryDos.stream().noneMatch(a->a.getAccessorycode().equals(inventoryVo.getItem_num()))){
|
|
|
String uuid = SecurityUtil.getUUID();
|
|
|
equOverhaulInventoryDo.setId(uuid);
|
|
|
- equOverhaulInventoryDo.setAccessorycode(inventoryVo.getCode());
|
|
|
+ equOverhaulInventoryDo.setAccessory(inventoryVo.getProduct_name());
|
|
|
+ equOverhaulInventoryDo.setBelongfactory(inventoryVo.getOrg_name());
|
|
|
+ equOverhaulInventoryDo.setAccessorycode(inventoryVo.getItem_num());
|
|
|
+ equOverhaulInventoryDo.setSpecifications(inventoryVo.getSpec());
|
|
|
+ equOverhaulInventoryDo.setUnit(inventoryVo.getUnit());
|
|
|
+ equOverhaulInventoryDo.setSource(inventoryVo.getCangku());
|
|
|
+ equOverhaulInventoryDo.setBatch(inventoryVo.getBatch_num());
|
|
|
+ List<SysOrganizationVo> resultList = factoryList.stream().filter(p -> p.getFullname().equals(inventoryVo.getOrg_name())).collect(Collectors.toList());
|
|
|
+ equOverhaulInventoryDo.setTenantid(resultList.get(0).getId());
|
|
|
+ if (inventoryVo.getQuantity()!= null){
|
|
|
+ equOverhaulInventoryDo.setInventorynumber(BigDecimal.valueOf(inventoryVo.getQuantity()));
|
|
|
+ }
|
|
|
equOverhaulInventoryDos.add(equOverhaulInventoryDo);
|
|
|
}
|
|
|
}
|