瀏覽代碼

设备子系统———库存接口代码完善

zhoudazhuang 1 年之前
父節點
當前提交
453a9e4726

+ 5 - 0
cx-equipment/cx-equipment-common/pom.xml

@@ -84,5 +84,10 @@
             <version>1.0-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.oracle</groupId>
+            <artifactId>ojdbc6</artifactId>
+            <version>11.2.0.3</version>
+        </dependency>
     </dependencies>
 </project>

+ 1 - 1
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/dao/SlaveOracleDao.java

@@ -16,6 +16,6 @@ public interface SlaveOracleDao {
      * 获取创新数据库的库存信息
      * @return
      */
-    @Select("select * from V_BC_DEPT")
+    @Select("select * from V_BC_ONHANDNUM")
     List<VInventoryVo> getAllOracleInventory();
 }

+ 2 - 2
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/SlaveSourceService.java

@@ -1,7 +1,7 @@
 package com.rongwei.bscommon.sys.service;
 
 
-//import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.rongwei.bsentity.domain.VInventoryVo;
 
 import java.util.List;
@@ -11,6 +11,6 @@ import java.util.List;
  */
 public interface SlaveSourceService {
 
-//    @DS("slave")
+    @DS("slave")
     List<VInventoryVo> getAllOracleInventory();
 }

+ 25 - 2
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquOverhaulInventoryServiceImpl.java

@@ -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);
             }
         }

+ 5 - 1
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquWarrantyProviderServiceImpl.java

@@ -27,6 +27,7 @@ import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -48,6 +49,8 @@ public class EquWarrantyProviderServiceImpl extends ServiceImpl<EquWarrantyProvi
     @Override
     public R importEquWarrantyProvider(MultipartFile file) {
         try {
+            // 查询所有工厂数据
+            List<SysOrganizationVo> factoryList = commonDao.getAllFactoryNameAndId();
             StringBuilder allStrBuilder = new StringBuilder();
             Sheet sheet = new XSSFWorkbook(file.getInputStream()).getSheetAt(0);
             int lastRowNum = sheet.getLastRowNum();
@@ -120,7 +123,8 @@ public class EquWarrantyProviderServiceImpl extends ServiceImpl<EquWarrantyProvi
                     isPrivately = sysDictDo.getValue();
                 }
                 if (StringUtils.isNotBlank(factory)){
-                    factoryId = commonDao.getIdByFactoryName(factory);
+                    List<SysOrganizationVo> resultList = factoryList.stream().filter(p -> p.getFullname().equals(factory)).collect(Collectors.toList());
+                    factoryId = resultList.get(0).getId();
                     if (StringUtil.isBlank(factoryId)){
                         stringBuilder.append("所属工厂填写有误");
                     }

+ 2 - 2
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/SlaveSourceServiceImpl.java

@@ -1,6 +1,6 @@
 package com.rongwei.bscommon.sys.service.impl;
 
-//import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.rongwei.bscommon.sys.dao.SlaveOracleDao;
 import com.rongwei.bscommon.sys.service.SlaveSourceService;
 import com.rongwei.bsentity.domain.VInventoryVo;
@@ -19,7 +19,7 @@ public class SlaveSourceServiceImpl implements SlaveSourceService {
     private SlaveOracleDao slaveOracleDao;
 
     @Override
-//    @DS("slave")
+    @DS("slave")
     public List<VInventoryVo> getAllOracleInventory() {
         return slaveOracleDao.getAllOracleInventory();
     }

+ 5 - 1
cx-equipment/cx-equipment-entity/pom.xml

@@ -23,7 +23,11 @@
                 </exclusion>
             </exclusions>
         </dependency>
-
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
+            <version>3.5.0</version>
+        </dependency>
         <dependency>
             <groupId>com.rongwei</groupId>
             <artifactId>rw-common-utils</artifactId>

+ 6 - 0
cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquLubricationTaskDetailDo.java

@@ -111,4 +111,10 @@ public class EquLubricationTaskDetailDo extends BaseDo implements Serializable {
     @TableField("DESCRIPTION")
     private String description;
 
+    /**
+     * 润滑标准编号
+     */
+    @TableField("STANDARDNUMBER")
+    private String standardnumber;
+
 }

+ 6 - 0
cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquOverhaulInventoryDo.java

@@ -142,5 +142,11 @@ public class EquOverhaulInventoryDo extends BaseDo implements Serializable {
     @TableField("REMINDERSTATUS")
     private String reminderstatus;
 
+    /**
+     * 提醒状态
+     */
+    @TableField("SOURCE")
+    private String source;
+
 
 }

+ 36 - 20
cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/VInventoryVo.java

@@ -7,24 +7,40 @@ import lombok.Data;
  */
 @Data
 public class VInventoryVo {
-
-    private String pk_dept;
-
-    private String pk_fatherorg;
-
-    private String code;
-
-    private String name;
-
-    private String shortname;
-
-    private Integer enablestate;
-
-    private String principal;
-
-    private String memo;
-
-    private String creationtime;
-
-    private String ts;
+    /**
+     * 组织机构编码
+     */
+    private String org_num;
+    /**
+     * 工厂名称
+     */
+    private String org_name;
+    /**
+     * 库存编码
+     */
+    private String item_num;
+    /**
+     * 名称
+     */
+    private String product_name;
+    /**
+     * 规格
+     */
+    private String spec;
+    /**
+     * 批号
+     */
+    private String batch_num;
+    /**
+     * 单位
+     */
+    private String unit;
+    /**
+     * 来源
+     */
+    private String cangku;
+    /**
+     * 数量
+     */
+    private Integer quantity;
 }