zxz 3 年之前
父节点
当前提交
271afbc691

+ 3 - 3
pom.xml

@@ -184,6 +184,9 @@
             <properties>
                 <env>local</env>
             </properties>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
         </profile>
         <profile>
             <id>dev</id>
@@ -203,9 +206,6 @@
                 <env>prod</env>
             </properties>
 
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
         </profile>
     </profiles>
     <build>

+ 88 - 86
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/ImportController.java

@@ -39,92 +39,94 @@ import java.util.List;
 @RequestMapping("/import")
 public class ImportController {
 
-    private String filePath;
-
-    private List list = new ArrayList();
-
-
-    public ImportController(String filePath) {
-        this.filePath = filePath;
-
-    }
-
-    private void readExcel() throws IOException, BiffException {
-        //创建输入流
-
-        InputStream stream = new FileInputStream(filePath);
-
-        //获取Excel文件对象
-
-        Workbook rwb = Workbook.getWorkbook(stream);
-
-        //获取文件的指定工作表 默认的第一个
-
-        Sheet sheet = rwb.getSheet(0);
-
-        //行数(表头的目录不需要,从1开始)
-
-        for (int i = 0; i < sheet.getRows(); i++) {
-            //创建一个数组 用来存储每一列的值
-
-            String[] str = new String[sheet.getColumns()];
-
-            Cell cell = null;
-
-            //列数
-
-            for (int j = 0; j < sheet.getColumns(); j++) {
-                //获取第i行,第j列的值
-
-                cell = sheet.getCell(j, i);
-
-                str[j] = cell.getContents();
-
-            }
-
-            //把刚获取的列存入list
-
-            list.add(str);
-
-        }
-
-    }
-
-
-    private void outData() {
-        for (int i = 0; i < list.size(); i++) {
-            String[] str = (String[]) list.get(i);
-
-            for (int j = 0; j < str.length; j++) {
-                System.out.print(str[j] + '\t');
-
-            }
-
-            System.out.println();
-
-        }
-
-    }
-
-    @GetMapping("/readDocument")
-    public List<String> readDocument(String file) throws BiffException, IOException {
-        ImportController excel = new ImportController(file);
-
-        excel.readExcel();
-
-//        excel.outData();
-        return list;
-
-    }
-
-
-    @RequestMapping("toExcel")
-
-    public String toExcel() {
-        return "admin/Excel";
-
-    }
-
+//    private String filePath;
+//
+//    private List list = new ArrayList();
+//
+//
+//    public ImportController(String filePath) {
+//        this.filePath = filePath;
+//
+//    }
+//
+//
+//    @GetMapping("/readDocument")
+//    public List<String> readDocument(String file) throws BiffException, IOException {
+//        ImportController excel = new ImportController(file);
+//
+//        excel.readExcel();
+//
+////        excel.outData();
+//        return list;
+//
+//    }
+//
+//    private void readExcel() throws IOException, BiffException {
+//        //创建输入流
+//
+//        InputStream stream = new FileInputStream(filePath);
+//
+//        //获取Excel文件对象
+//
+//        Workbook rwb = Workbook.getWorkbook(stream);
+//
+//        //获取文件的指定工作表 默认的第一个
+//
+//        Sheet sheet = rwb.getSheet(0);
+//
+//        //行数(表头的目录不需要,从1开始)
+//
+//        for (int i = 0; i < sheet.getRows(); i++) {
+//            //创建一个数组 用来存储每一列的值
+//
+//            String[] str = new String[sheet.getColumns()];
+//
+//            Cell cell = null;
+//
+//            //列数
+//
+//            for (int j = 0; j < sheet.getColumns(); j++) {
+//                //获取第i行,第j列的值
+//
+//                cell = sheet.getCell(j, i);
+//
+//                str[j] = cell.getContents();
+//
+//            }
+//
+//            //把刚获取的列存入list
+//
+//            list.add(str);
+//
+//        }
+//
+//    }
+//
+//
+//    private void outData() {
+//        for (int i = 0; i < list.size(); i++) {
+//            String[] str = (String[]) list.get(i);
+//
+//            for (int j = 0; j < str.length; j++) {
+//                System.out.print(str[j] + '\t');
+//
+//            }
+//
+//            System.out.println();
+//
+//        }
+//
+//    }
+//
+//
+//
+//    @RequestMapping("toExcel")
+//
+//    public String toExcel() {
+//        return "admin/Excel";
+//
+//    }
+//
 
 }
 

+ 67 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehouseInOutInfoServiceImpl.java

@@ -388,6 +388,35 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         warehouseInOutDetail.setId(IdGenerator.generateUUID());
                         warehouseInOutDetailService.insert(warehouseInOutDetail);
                     }
+                    //更新库存量
+                    if (warehouseBaseInfo != null) {
+                        //  查询库位
+                        WarehousePositionInfo warehousePositionInfo = warehousePositionInfoService.selectById(warehouseInOutInfo.getPositionId());
+                        if (warehousePositionInfo != null) {
+                            // 查询货物库存量
+                            WarehousePositionStorageInfo warehousePositionStorageInfo = warehousePositionStorageInfoService.selectOne(new EntityWrapper<WarehousePositionStorageInfo>()
+                                    .eq("position_id", warehouseInOutInfo.getPositionId())
+                                    .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey())
+                                    .eq("delete_flag", "0"));
+                            // 判断是否有货
+                            if (warehousePositionStorageInfo != null) {
+                                // 更新库存量
+                                warehousePositionStorageInfo.setStorage(warehousePositionStorageInfo.getStorage() + warehouseInOutInfo.getNetWeight());
+                                warehousePositionStorageInfoService.updateById(warehousePositionStorageInfo);
+                            }
+                            // 没有货
+                            else {
+                                WarehousePositionStorageInfo warehousePositionStorageInfo1 = new WarehousePositionStorageInfo();
+                                warehousePositionStorageInfo1.setId(IdGenerator.generateUUID());
+                                warehousePositionStorageInfo1.setPositionId(warehouseInOutInfo.getPositionId());
+                                warehousePositionStorageInfo1.setBinNumber(warehouseInOutInfo.getBinNumber());
+                                warehousePositionStorageInfo1.setGoodsNameKey(warehouseInOutInfo.getGoodsNameKey());
+                                warehousePositionStorageInfo1.setGoodsName(warehouseInOutInfo.getGoodsName());
+                                warehousePositionStorageInfo1.setStorage(warehouseInOutInfo.getNetWeight());
+                                warehousePositionStorageInfoService.insert(warehousePositionStorageInfo1);
+                            }
+                        }
+                    }
                     // 采购入库统计
                     PurchaseReceiptReport purchaseReceiptReport = new PurchaseReceiptReport();
                     purchaseReceiptReport.setId(IdGenerator.generateUUID());
@@ -507,6 +536,44 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         warehouseInOutDetail.setId(IdGenerator.generateUUID());
                         warehouseInOutDetailService.insert(warehouseInOutDetail);
                     }
+                    //更新库存量
+                    //判断是否有货
+                    if (warehouseBaseInfo != null) {
+                        //  查询库位
+                        WarehousePositionInfo warehousePositionInfo = warehousePositionInfoService.selectById(warehouseInOutInfo.getPositionId());
+                        if (warehousePositionInfo != null) {
+                            // 查询货物库存量
+                            WarehousePositionStorageInfo warehousePositionStorageInfo = warehousePositionStorageInfoService.selectOne(new EntityWrapper<WarehousePositionStorageInfo>()
+                                    .eq("position_id", warehouseInOutInfo.getPositionId())
+                                    .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey())
+                                    .eq("delete_flag", "0"));
+                            // 判断是否有货
+                            if (warehousePositionStorageInfo != null) {
+                                if (warehouseInOutInfo.getNetWeight() <= warehousePositionStorageInfo.getStorage()) {
+                                    // 更新库存量
+                                    warehousePositionStorageInfo.setStorage(warehousePositionStorageInfo.getStorage() - warehouseInOutInfo.getNetWeight());
+                                    warehousePositionStorageInfoService.updateById(warehousePositionStorageInfo);
+                                }
+                                //出库量大于库存量
+                                else {
+                                    throw new YException(YExceptionEnum.INVENTORY_NO_ERROR);
+                                }
+                            }
+                            // 没有储存量
+                            else {
+                                throw new YException(YExceptionEnum.POSITIONSTORAGE_NO_ERROR);
+                            }
+                        }
+                        //库位不存在
+                        else {
+                            throw new YException(YExceptionEnum.POSITION_NO_ERROR);
+                        }
+                    }
+                    //仓库不存在
+                    else {
+                        throw new YException(YExceptionEnum.WAREHOUSE_NO_ERROR);
+                    }
+
                     // 销售出库统计
                     SalesDeliveryReport salesDeliveryReport = new SalesDeliveryReport();
                     salesDeliveryReport.setId(IdGenerator.generateUUID());