huangfuli 3 роки тому
батько
коміт
13bc3cd5cb

+ 11 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/WeighingManagementController.java

@@ -117,6 +117,7 @@ public class WeighingManagementController {
     public WeighingManagement getQRcode(WeighingManagement weighingManagement) {
         return weighingManagementService.getQRcode(weighingManagement);
     }
+
     /**
      * 退回
      * @param weighingManagement
@@ -127,6 +128,16 @@ public class WeighingManagementController {
         return weighingManagementService.weightReturn(weighingManagement);
     }
 
+    /**
+     * 出库管理检斤退回
+     * @param weighingManagement
+     * @return
+     */
+    @PostMapping("/api/outWeightReturn")
+    public String outWeightReturn(@RequestBody WeighingManagement weighingManagement) {
+        return weighingManagementService.outWeightReturn(weighingManagement);
+    }
+
     /**
      * 换仓
      * @param weighingManagement

+ 7 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IWeighingManagementService.java

@@ -72,6 +72,13 @@ public interface IWeighingManagementService extends IService<WeighingManagement>
      */
     String weightReturn(WeighingManagement weighingManagement);
 
+    /**
+     * 出库管理检斤退回
+     * @param
+     * @return
+     */
+    String outWeightReturn(WeighingManagement weighingManagement);
+
     /**
      * 换仓
      * @param

+ 92 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WeighingManagementServiceImpl.java

@@ -65,6 +65,10 @@ public class WeighingManagementServiceImpl extends ServiceImpl<WeighingManagemen
     private ICommonStaffService staffService;
     @Autowired
     private QRCodeUtil qrCodeUtil;
+    @Autowired
+    private IStockSaleReceiptReportService stockSaleReceiptReportService;
+
+
     /**
      * 检斤管理列表
      * @param weighingManagement
@@ -630,7 +634,7 @@ public class WeighingManagementServiceImpl extends ServiceImpl<WeighingManagemen
                                 .eq("car_no",warehouseInOutInfo.getCarNo())
                                 .eq("delete_flag","0"));
                         if(tranCarInfo != null){
-                            tranCarInfo.setSubmit("1");
+                            tranCarInfo.setSubmit("2");
                             //汽运状态改为已装车
                             tranCarInfo.setStatus(StatusEnum.LOADED.getName());
                             tranCarInfo.setStatusFlag(StatusEnum.LOADED.getFlag());
@@ -652,6 +656,93 @@ public class WeighingManagementServiceImpl extends ServiceImpl<WeighingManagemen
         return "OK";
     }
 
+
+    /**
+     * 出库管理检斤退回
+     * @param
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String outWeightReturn(WeighingManagement weighingManagement) {
+        //查询检斤信息表
+        WeighingManagement weighingManagement1 = this.selectById(weighingManagement.getId());
+        //状态改为已称皮重
+        weighingManagement1.setStatus(StatusEnum.TARED.getName());
+        weighingManagement1.setStatusFlag(StatusEnum.TARED.getFlag());
+        //更新检斤信息
+        this.updateById(weighingManagement1);
+        //查询出入库表
+        WarehouseInOutInfo warehouseInOutInfo = warehouseInOutInfoService.selectById(weighingManagement1.getWarehouseInOutId());
+        if(weighingManagement1.getWarehouseInOutId() != null){
+            if(warehouseInOutInfo!= null){
+                //状态改为已暂存
+                warehouseInOutInfo.setStatusFlag(StatusEnum.TEMPORARILY_STORED.getFlag());
+                warehouseInOutInfo.setStatus(StatusEnum.TEMPORARILY_STORED.getName());
+                //更新出入库表信息
+                warehouseInOutInfoService.updateById(warehouseInOutInfo);
+                //查询仓位库存信息
+                WarehousePositionStorageInfo warehousePositionStorageInfo = warehousePositionStorageInfoService.selectOne(new EntityWrapper<WarehousePositionStorageInfo>()
+                        .eq("position_id",warehouseInOutInfo.getPositionId())
+                        .eq("delete_flag","0"));
+                if(warehousePositionStorageInfo != null){
+                    //更新仓位库存信息
+                    warehousePositionStorageInfo.setStorage(warehousePositionStorageInfo.getStorage() + weighingManagement1.getNetWeight()/1000);
+                    warehousePositionStorageInfoService.updateById(warehousePositionStorageInfo);
+                }
+            }
+        }
+        //移库出库
+        if(weighingManagement1 != null && "2".equals(weighingManagement1.getServiceManagementType()) && "移库出库".equals(weighingManagement1.getInOutType())){
+
+            if(warehouseInOutInfo.getCarId() != null ){
+                //查询派车信息表
+                TranCarInfo tranCarInfo = tranCarInfoService.selectOne(new EntityWrapper<TranCarInfo>()
+                        .eq("car_no",warehouseInOutInfo.getCarNo())
+                        .eq("delete_flag","0"));
+                if(tranCarInfo != null){
+                    tranCarInfo.setSubmit("1");
+                    //汽运状态改为已装车
+                    tranCarInfo.setStatus(StatusEnum.LOADED.getName());
+                    tranCarInfo.setStatusFlag(StatusEnum.LOADED.getFlag());
+                    //更新派车信息表
+                    tranCarInfoService.updateById(tranCarInfo);
+                }
+            }
+        }
+        //销售出库
+        else if(weighingManagement1 != null && "2".equals(weighingManagement1.getServiceManagementType()) && "销售出库".equals(weighingManagement1.getInOutType())){
+
+            if(weighingManagement1.getWarehouseInOutId() != null){
+                if(warehouseInOutInfo != null){
+                    if(warehouseInOutInfo.getCarId() != null ){
+                        //查询派车信息表
+                        TranCarInfo tranCarInfo = tranCarInfoService.selectOne(new EntityWrapper<TranCarInfo>()
+                                .eq("car_no",warehouseInOutInfo.getCarNo())
+                                .eq("delete_flag","0"));
+                        if(tranCarInfo != null){
+                            tranCarInfo.setSubmit("1");
+                            //汽运状态改为已装车
+                            tranCarInfo.setStatus(StatusEnum.LOADED.getName());
+                            tranCarInfo.setStatusFlag(StatusEnum.LOADED.getFlag());
+                            //更新派车信息表
+                            tranCarInfoService.updateById(tranCarInfo);
+                        }
+                    }
+                    //查询销售出库报表
+                    StockSaleReceiptReport stockSaleReceiptReport = stockSaleReceiptReportService.selectOne(new EntityWrapper<StockSaleReceiptReport>()
+                            .eq("warehouse_record_id",warehouseInOutInfo.getId())
+                            .eq("delete_flag","0"));
+                    if(stockSaleReceiptReport != null){
+                        stockSaleReceiptReport.setDeleteFlag("1");
+                        stockSaleReceiptReportService.updateById(stockSaleReceiptReport);
+                    }
+                }
+            }
+        }
+        return "OK";
+    }
+
     /**
      * 换仓
      * @param