wangzhuo 2 سال پیش
والد
کامیت
b52fdb537d
34فایلهای تغییر یافته به همراه2218 افزوده شده و 13 حذف شده
  1. 83 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/plugin/ForeignApiController.java
  2. 61 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/warehouseBusiness/TWarehouseOutStockController.java
  3. 125 0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpClientUtils.java
  4. 22 0
      ruoyi-plugin/src/main/java/com/ruoyi/ccb/service/ForeignHttpService.java
  5. 268 0
      ruoyi-plugin/src/main/java/com/ruoyi/ccb/service/impl/ForeignHttpServiceImpl.java
  6. 2 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java
  7. 11 0
      ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml
  8. 2 0
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TCorpsMapper.java
  9. 2 0
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TGoodsMapper.java
  10. 4 0
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TWarehouseMapper.java
  11. 5 3
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TGoodsServiceImpl.java
  12. 14 1
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TWarehouseServiceImpl.java
  13. 60 0
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/domain/TWhgenleg.java
  14. 26 0
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/mapper/TWhgenlegMapper.java
  15. 43 1
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java
  16. 41 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/CollateralGoods.java
  17. 206 1
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehouseBills.java
  18. 11 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/vo/AddCollateralGoodsVO.java
  19. 55 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/vo/CollateralGoodsVO.java
  20. 72 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/vo/SkuItem.java
  21. 166 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/vo/WarehouseVO.java
  22. 23 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/CollateralMapper.java
  23. 19 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/SkuItemMapper.java
  24. 51 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseBillsMapper.java
  25. 37 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java
  26. 2 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/BillnoSerialServiceImpl.java
  27. 313 4
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java
  28. 92 0
      ruoyi-warehouse/src/main/resources/mapper/basicData/CollateralMapper.xml
  29. 55 0
      ruoyi-warehouse/src/main/resources/mapper/basicData/SkuItemMapper.xml
  30. 9 0
      ruoyi-warehouse/src/main/resources/mapper/basicData/TCorpsMapper.xml
  31. 4 0
      ruoyi-warehouse/src/main/resources/mapper/basicData/TGoodsMapper.xml
  32. 25 2
      ruoyi-warehouse/src/main/resources/mapper/basicData/TWarehouseMapper.xml
  33. 213 0
      ruoyi-warehouse/src/main/resources/mapper/reportManagement/TWhgenlegMapper.xml
  34. 96 1
      ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

+ 83 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/plugin/ForeignApiController.java

@@ -4,7 +4,10 @@ import cn.hutool.json.JSONObject;
 import com.ruoyi.ccb.domain.QueryLowerPositionR;
 import com.ruoyi.ccb.service.ForeignHttpService;
 import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.warehouseBusiness.domain.vo.SkuItem;
+import com.ruoyi.warehouseBusiness.domain.vo.WarehouseVO;
 import lombok.AllArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -147,4 +150,84 @@ public class ForeignApiController extends BaseController {
     }
 
 
+    /**
+     * 仓单开立申请
+     */
+    @PostMapping("/receiptApply")
+    public AjaxResult receiptApply(@RequestBody WarehouseVO warehouseVO) {
+        if (warehouseVO.getPositionCode() == null)
+            return new AjaxResult(10001, "缺少positionCode");
+        if (warehouseVO.getReceiptApplyCode() == null)
+            return new AjaxResult(10001, "缺少receiptApplyCode");
+        if (warehouseVO.getSubmitter() == null)
+            return new AjaxResult(10001, "缺少submitter");
+        if (warehouseVO.getOwnerCode() == null &&
+                warehouseVO.getOwnerName() == null &&
+                warehouseVO.getOwnerIdentifier() == null)
+            return new AjaxResult(10001, "缺少货主信息");
+        for (SkuItem skuItem : warehouseVO.getSkuItems()) {
+            if (skuItem.getSpuId() == null)
+                return new AjaxResult(10001, "缺少spuId");
+            if (skuItem.getSkuId() == null)
+                return new AjaxResult(10001, "缺少skuId");
+            if (skuItem.getBillOfLading() == null)
+                return new AjaxResult(10001, "缺少billOfLading");
+            if (skuItem.getGoodsWeight() == null)
+                return new AjaxResult(10001, "缺少goodsWeight");
+            if (skuItem.getGoodsQuantity() == null)
+                return new AjaxResult(10001, "缺少goodsQuantity");
+        }
+        return foreignHttpService.receiptApply(warehouseVO);
+    }
+
+    /**
+     * 仓单开立取消
+     */
+    @PostMapping("/receiptCancel")
+    public AjaxResult receiptCancel(@RequestBody WarehouseVO warehouseVO) {
+        if (warehouseVO.getReceiptId() == null || warehouseVO.getBusinessCode() == null)
+            return new AjaxResult(10001, "缺少必要参数");
+        return foreignHttpService.receiptCancelBank(warehouseVO);
+    }
+
+    /**
+     * 仓单开立成功通知
+     */
+    @PostMapping("/receiptApplySuccess")
+    public AjaxResult receiptApplySuccess(@RequestBody WarehouseVO warehouseVO) {
+        if (warehouseVO.getPositionCode() == null)
+            return new AjaxResult(10001, "缺少positionCode");
+        if (warehouseVO.getOperateType() == null)
+            return new AjaxResult(10001, "缺少operateType");
+        if (warehouseVO.getReceiptId() == null)
+            return new AjaxResult(10001, "缺少receiptId");
+        if (warehouseVO.getReceiptApplyCode() == null)
+            return new AjaxResult(10001, "缺少receiptApplyCode");
+        if (warehouseVO.getReceiptCode() == null)
+            return new AjaxResult(10001, "缺少receiptCode");
+        return foreignHttpService.receiptApplySuccess(warehouseVO);
+    }
+
+    /**
+     * 仓单解质押申请接口
+     */
+    @PostMapping("/receiptReleasePledge")
+    public AjaxResult receiptReleasePledge(@RequestBody WarehouseVO warehouseVO) {
+        if (warehouseVO.getBusinessCode() == null)
+            return new AjaxResult(10001, "缺少businessCode");
+        if (warehouseVO.getPositionCode() == null)
+            return new AjaxResult(10001, "缺少positionCode");
+        if (warehouseVO.getOperateType() == null)
+            return new AjaxResult(10001, "缺少operateType");
+        if (warehouseVO.getReleasePledgeType() == null)
+            return new AjaxResult(10001, "缺少releasePledgeType");
+        if (warehouseVO.getSubmitter() == null)
+            return new AjaxResult(10001, "缺少submitter");
+        return foreignHttpService.receiptReleasePledge(warehouseVO);
+    }
+
+
+
+
+
 }

+ 61 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/warehouseBusiness/TWarehouseOutStockController.java

@@ -16,6 +16,8 @@ import com.ruoyi.framework.web.service.TokenService;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import com.ruoyi.warehouseBusiness.domain.dto.WarehousebillsDTO;
 import com.ruoyi.warehouseBusiness.domain.enums.WarehouseTypeEnum;
+import com.ruoyi.warehouseBusiness.domain.vo.AddCollateralGoodsVO;
+import com.ruoyi.warehouseBusiness.domain.vo.WarehouseVO;
 import com.ruoyi.warehouseBusiness.excel.OutStock;
 import com.ruoyi.warehouseBusiness.service.ITWarehouseBillsService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -445,4 +447,63 @@ public class TWarehouseOutStockController extends BaseController {
         return AjaxResult.success(itWarehouseBillsService.updateBillingDate(fId));
     }
 
+    /**
+     * 查询抵押数据
+     */
+//    @PreAuthorize("@ss.hasPermi('basicdata:fees:list')")
+    @GetMapping("/mortgageList")
+    public TableDataInfo mortgageList(TWarehouseBills warehouseBills) {
+        startPage();
+        List<TWarehouseBills> list = itWarehouseBillsService.mortgageList(warehouseBills);
+        return getDataTable(list);
+    }
+
+    /**
+     * 抵押详情
+     */
+    @GetMapping("/mortgage/{id}")
+    public TWarehouseBills mortgageDetail(@PathVariable("id") Long id) {
+        return itWarehouseBillsService.mortgageDetail(id);
+    }
+
+    /**
+     * 查询配货列表
+     */
+    @GetMapping("/distribution")
+    public AjaxResult getDistributionlList(WarehouseVO warehouseVO) {
+        return itWarehouseBillsService.getDistributionlList(warehouseVO);
+    }
+
+    /**
+     * 反馈
+     */
+    @GetMapping("/mortgage/feedback")
+    public AjaxResult mortgageFeedback( WarehouseVO warehouseVO) {
+        return itWarehouseBillsService.mortgage(warehouseVO);
+    }
+
+    /**
+     * 保存抵押货物信息
+     */
+    @PostMapping("/collateralCargoInformation")
+    public AjaxResult collateralCargoInformation(@RequestBody AddCollateralGoodsVO vo) {
+        return itWarehouseBillsService.collateralCargoInformation(vo);
+    }
+
+    /**
+     * 查询抵押货物信息
+     */
+    @GetMapping("/collateralGoods/{pid}")
+    public AjaxResult getCollateralGoodsBypid(@PathVariable("pid") String pid) {
+        return itWarehouseBillsService.getCollateralGoodsBypid(pid);
+    }
+
+    /**
+     * 保存抵押货物主单信息
+     */
+    @PostMapping("/mortgage/preservation")
+    public AjaxResult masterSuppressThePreservationOfGoods(@RequestBody TWarehouseBills warehouseBills) {
+        return itWarehouseBillsService.masterSuppressThePreservationOfGoods(warehouseBills);
+    }
+
 }

+ 125 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpClientUtils.java

@@ -0,0 +1,125 @@
+package com.ruoyi.common.utils;
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.conn.ConnectTimeoutException;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+
+import java.io.*;
+import java.net.*;
+import java.util.HashMap;
+import java.util.Map;
+
+public class HttpClientUtils {
+
+    /**
+     * 向指定 URL 发送GET方法的请求
+     *
+     * @param url   发送请求的 URL
+     * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
+     * @return 所代表远程资源的响应结果
+     */
+    public static String doGet(String url, String param) {
+        StringBuilder result = new StringBuilder();
+        BufferedReader in = null;
+        String urlNameString = url;
+        try {
+            if (param != null || param != "") {
+                urlNameString = urlNameString + "?" + param;
+            }
+            URL realUrl = new URL(urlNameString);
+            URLConnection connection = realUrl.openConnection();
+            connection.setRequestProperty("accept", "*/*");
+            connection.setRequestProperty("connection", "Keep-Alive");
+            connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+            connection.connect();
+            // 定义 BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result.append(line);
+            }
+        } catch (ConnectException e) {
+            e.printStackTrace();
+        } catch (SocketTimeoutException | ConnectTimeoutException e) {
+            e.printStackTrace();
+            //SocketTimeoutException:是Java包下抛出的异常,这定义了Socket读数据的超时时间,即从server获取响应数据须要等待的时间;当读取或者接收Socket超时会抛出SocketTimeoutException
+            System.out.println("sendGet SocketTimeoutException, url=" + url + ",param=" + param);
+        } catch (IOException e) {
+            e.printStackTrace();
+            System.out.println("sendGet IOException, url=" + url + ",param=" + param);
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.out.println("sendGet Exception, url=" + url + ",param=" + param);
+        } finally {
+            try {
+                if (in != null) {
+                    in.close();
+                }
+            } catch (Exception ex) {
+                ex.printStackTrace();
+                System.out.println("sendGet Exception, url=" + url + ",param=" + param);
+            }
+        }
+        return result.toString();
+    }
+
+
+
+    /**
+     * post请求
+     * @param path url地址
+     * @param reqHea 请求头
+     * @param Info jsonobject 参数
+     * @return
+     * @throws IOException
+     */
+    public static JSONObject doPost(String path, Map<String, String> reqHea, JSONObject Info) throws IOException{
+        HttpClient client = new DefaultHttpClient();
+        HttpPost post = new HttpPost(path);
+
+        post.setHeader("Content-Type", "application/json;charset=UTF-8");
+        post.addHeader("Authorization", "Basic YWRtaW46");
+        for (String key : reqHea.keySet()) {
+            post.addHeader(key, reqHea.get(key));
+        }
+
+        String result = "";
+
+        try {
+            StringEntity s = new StringEntity(Info.toString(), "utf-8");
+            s.setContentEncoding("application/json");
+            post.setEntity(s);
+
+            // 发送请求
+            HttpResponse httpResponse = client.execute(post);
+
+            // 获取响应输入流
+            InputStream inStream = httpResponse.getEntity().getContent();
+            BufferedReader reader = new BufferedReader(new InputStreamReader(inStream, "utf-8"));
+            StringBuilder strber = new StringBuilder();
+            String line = null;
+            while ((line = reader.readLine()) != null)
+                strber.append(line + "\n");
+            inStream.close();
+
+            result = strber.toString();
+            System.out.println(result);
+            if (httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
+                System.out.println("请求服务器成功,做相应处理");
+            } else {
+                System.out.println("请求服务端失败");
+            }
+
+        } catch (Exception e) {
+            System.out.println("请求异常");
+            throw new RuntimeException(e);
+        }
+
+        return JSONObject.parseObject(result);
+    }
+}

+ 22 - 0
ruoyi-plugin/src/main/java/com/ruoyi/ccb/service/ForeignHttpService.java

@@ -3,7 +3,9 @@ package com.ruoyi.ccb.service;
 import cn.hutool.json.JSONObject;
 import com.ruoyi.basicData.domain.TCorps;
 import com.ruoyi.ccb.domain.*;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
+import com.ruoyi.warehouseBusiness.domain.vo.WarehouseVO;
 import com.ruoyi.warehouseBusiness.request.InventoryQueryRequest;
 import com.ruoyi.warehouseBusiness.response.InventoryQueryResponse;
 import com.ruoyi.warehouseBusiness.response.InventoryQueryTwoResponse;
@@ -125,4 +127,24 @@ public interface ForeignHttpService {
      * 仓单解锁指令
      */
     int receiptCancel(String ownerName, String identifier, String numbers);
+
+    /**
+     * 仓单开立申请
+     */
+    AjaxResult receiptApply(WarehouseVO warehouseVO);
+
+    /**
+     * 仓单开立取消
+     */
+    AjaxResult receiptCancelBank(WarehouseVO warehouseVO);
+
+    /**
+     * 仓单开立成功通知
+     */
+    AjaxResult receiptApplySuccess(WarehouseVO warehouseVO);
+
+    /**
+     * 解押
+     */
+    AjaxResult receiptReleasePledge(WarehouseVO warehouseVO);
 }

+ 268 - 0
ruoyi-plugin/src/main/java/com/ruoyi/ccb/service/impl/ForeignHttpServiceImpl.java

@@ -3,20 +3,32 @@ package com.ruoyi.ccb.service.impl;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.json.JSONObject;
 import com.ruoyi.basicData.domain.TCorps;
+import com.ruoyi.basicData.mapper.TCorpsMapper;
 import com.ruoyi.basicData.mapper.TWarehouseMapper;
 import com.ruoyi.basicData.service.ITWarehouseService;
 import com.ruoyi.ccb.domain.QueryLowerPositionR;
 import com.ruoyi.ccb.service.ForeignHttpService;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.TWarehouse;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
+import com.ruoyi.reportManagement.mapper.TWhgenlegMapper;
 import com.ruoyi.reportManagement.service.ITWhgenlegService;
+import com.ruoyi.warehouseBusiness.domain.CollateralGoods;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
+import com.ruoyi.warehouseBusiness.domain.vo.CollateralGoodsVO;
+import com.ruoyi.warehouseBusiness.domain.vo.SkuItem;
+import com.ruoyi.warehouseBusiness.domain.vo.WarehouseVO;
+import com.ruoyi.warehouseBusiness.mapper.CollateralMapper;
+import com.ruoyi.warehouseBusiness.mapper.SkuItemMapper;
+import com.ruoyi.warehouseBusiness.mapper.TWarehouseBillsMapper;
 import com.ruoyi.warehouseBusiness.request.InventoryQueryRequest;
 import com.ruoyi.warehouseBusiness.response.InventoryQueryResponse;
 import com.ruoyi.warehouseBusiness.response.InventoryQueryTwoResponse;
+import com.ruoyi.warehouseBusiness.service.impl.BillnoSerialServiceImpl;
 import lombok.AllArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.*;
@@ -39,6 +51,22 @@ public class ForeignHttpServiceImpl implements ForeignHttpService {
     @Autowired
     private TWarehouseMapper tWarehouseMapper;
 
+    @Autowired
+    private TWarehouseBillsMapper tWarehouseBillsMapper;
+
+    @Autowired
+    private BillnoSerialServiceImpl billnoSerialServiceImpl;
+
+    @Autowired
+    private TCorpsMapper tCorpsMapper;
+
+    @Autowired
+    private SkuItemMapper skuItemMapper;
+
+    @Autowired
+    private TWhgenlegMapper tWhgenlegMapper;
+
+
     @Override
     public QueryLowerPositionR queryLowerPositionV1(String position) {
         List<Map<String, Object>> mapList = new ArrayList<>();
@@ -447,4 +475,244 @@ public class ForeignHttpServiceImpl implements ForeignHttpService {
     public int receiptCancel(String ownerName, String identifier, String numbers) {
         return itWarehouseService.receiptCancel(ownerName, identifier, numbers);
     }
+
+    @Override
+    @Transactional
+    public AjaxResult receiptApply(WarehouseVO warehouseVO) {
+
+        AjaxResult ajaxResult = null;
+
+        TCorps tCorps = new TCorps();
+        tCorps.setCreditNum(warehouseVO.getOwnerIdentifier());
+//        tCorps.setfNo(warehouseVO.getOwnerCode());
+        if (warehouseVO.getOwnerCode() != null && !"".equals(warehouseVO.getOwnerCode())) {
+            tCorps.setfId(Long.valueOf(warehouseVO.getOwnerCode()));
+        }
+        tCorps.setfName(warehouseVO.getOwnerName());
+        TCorps tCorp = tCorpsMapper.getOne(tCorps);
+        if (tCorp == null) {
+            return new AjaxResult(10001, "没有该用户信息");
+        }
+        // 查询货物是否充足
+        for (SkuItem skuItem : warehouseVO.getSkuItems()) {
+            // 库存总数量
+            BigDecimal sum = new BigDecimal("0");
+            // 库存总重量
+            BigDecimal sums = new BigDecimal("0");
+            TWhgenleg tWhgenleg = new TWhgenleg();
+            // 提单号
+            tWhgenleg.setfMblno(skuItem.getBillOfLading());
+            // 仓库id
+//            TWarehouse tWarehouse = new TWarehouse();
+//            tWarehouse.setfNo(warehouseVO.getPositionCode());
+//            tWarehouse = tWarehouseMapper.getOne(tWarehouse);
+//            tWhgenleg.setfWarehouseid(tWarehouse.getfId());
+
+            tWhgenleg.setfWarehouseid(Long.valueOf(warehouseVO.getPositionCode()));
+
+
+            // 客户编号
+            tWhgenleg.setCustomerId(tCorp.getfId().toString());
+            List<Map<String, Object>> mapList = tWhgenlegMapper.selectInventoryMapListV2(tWhgenleg);
+            for (Map<String, Object> stringObjectMap : mapList) {
+                if (skuItem.getSkuId().equals(stringObjectMap.get("sku")) && skuItem.getSpuId().equals(stringObjectMap.get("spu"))) {
+                    // 总数
+                    Object fQtyd = stringObjectMap.get("fQtyD");
+                    sum = sum.add(new BigDecimal(fQtyd.toString()));
+                    // 重量 毛重
+                    Object fGrossweightd = stringObjectMap.get("fGrossweightD");
+                    sums = sums.add(new BigDecimal(fGrossweightd.toString()));
+                }
+            }
+
+            BigDecimal goodsQuantityBig = new BigDecimal(skuItem.getGoodsQuantity().toString());
+            BigDecimal goodsWeightBig = new BigDecimal(skuItem.getGoodsWeight().toString());
+            if (goodsQuantityBig.compareTo(sum) == 1 || goodsWeightBig.compareTo(sums) == 1) {
+                Map<String, Object> ret = new HashMap<>();
+                ret.put("result", false);
+                ajaxResult = new AjaxResult(10001, "货物不足", ret);
+            }
+        }
+
+        // 查询仓库编号
+//        TWarehouse tWarehouse = tWarehouseMapper.getWarehouseByFNo(warehouseVO.getPositionCode());
+
+
+        TWarehouseBills warb = new TWarehouseBills();
+        // 仓库id
+//        warb.setfWarehouseid(tWarehouse.getfId());
+        warb.setfWarehouseid(Long.valueOf(warehouseVO.getPositionCode()));
+        // 货物数量
+        warb.setfQty(0L);
+        // 货物重量(净重)
+        warb.setfNetweight(new BigDecimal("0"));
+        if (!warehouseVO.getSkuItems().isEmpty()) {
+            for (SkuItem skuItem : warehouseVO.getSkuItems()) {
+                warb.setfQty(warb.getfQty() + skuItem.getGoodsQuantity());
+                warb.setfNetweight(warb.getfNetweight().add(new BigDecimal(skuItem.getGoodsWeight().toString())));
+            }
+        }
+        // 抵押数据
+//        warb.setfBillstatus(3L);
+        warb.setBusinessCode(warehouseVO.getBusinessCode());
+        warb.setSerialNumber(warehouseVO.getSerialNumber());
+        warb.setReceiptApplyCode(warehouseVO.getReceiptApplyCode());
+
+        // 提交人
+        warb.setCreateBy(warehouseVO.getSubmitter());
+        // 单据类型
+        warb.setfBilltype("DY");
+        // 入库状态
+        if (ajaxResult == null) {
+            warb.setfBillstatus(1L);
+        } else {
+            warb.setfBillstatus(6L);
+        }
+        // 业务编号
+        String billNo = billnoSerialServiceImpl.getBillNo("DY", new Date());
+        warb.setfBillno(billNo);
+        // 客户信息
+        warb.setfCorpid(tCorp.getfId());
+        warb.setfDeptid(1L);
+        warb.setfBsdeptid(1L);
+        warb.setCreateTime(new Date());
+
+
+        // 保存数据
+        Integer i = tWarehouseBillsMapper.insertTWarehousebills(warb);
+
+        // 货物信息
+        for (SkuItem skuItem : warehouseVO.getSkuItems()) {
+            skuItem.setPid(warb.getfId());
+
+            // 保存数据
+            skuItemMapper.insertInto(skuItem);
+        }
+
+        if (ajaxResult == null) {
+            Map<String, Object> ret = new HashMap<>();
+            ret.put("receiptId", warb.getfId());
+            ret.put("result", true);
+            ajaxResult = new AjaxResult(0, "OK", ret);
+        }
+        return ajaxResult;
+    }
+
+    @Autowired
+    private TWarehouseBillsMapper warehouseBillsMapper;
+
+    @Override
+    @Transactional
+    public AjaxResult receiptCancelBank(WarehouseVO warehouseVO) {
+
+        /**
+         * 解押
+         */
+        TWarehouseBills tWarehouseBills = warehouseBillsMapper.mortgageDetail(Long.valueOf(warehouseVO.getReceiptId()));
+        List<SkuItem> skuItemList = skuItemMapper.getByPid(tWarehouseBills.getfId());
+
+        for (SkuItem skuItem : skuItemList) {
+            // 解锁货物
+            for (CollateralGoodsVO collateralGoodsVO : collateralMapper.selectByPid(skuItem.getId().toString())) {
+
+                // 解锁货物
+                TWhgenleg tWhgenleg = new TWhgenleg();
+                tWhgenleg.setfCorpid(tWarehouseBills.getfCorpid());
+                tWhgenleg.setfWarehouseid(tWarehouseBills.getfWarehouseid());
+                tWhgenleg.setfTrademodeid(1L);
+                tWhgenleg.setWarehouseInformation(collateralGoodsVO.getFWarehouseInformation());
+                tWhgenleg.setfMblno(skuItem.getBillOfLading());
+                tWhgenleg.setLockStatus(1);
+                List<Map<String, Object>> maps = tWhgenlegMapper.selectInventoryList(tWhgenleg);
+                for (Map<String, Object> map : maps) {
+                    tWhgenlegMapper.unlock(map.get("fId").toString());
+                }
+            }
+            collateralMapper.updateTypeByPid(skuItem.getId(), "1");
+        }
+
+        Integer i = tWarehouseBillsMapper.updateBillstatusOfWarehouseById(warehouseVO);
+        if (i > 0) {
+            return new AjaxResult(0, "OK");
+        }
+        return new AjaxResult(500, "更新失败");
+    }
+
+    @Autowired
+    private CollateralMapper collateralMapper;
+
+    @Override
+    @Transactional
+    public AjaxResult receiptApplySuccess(WarehouseVO warehouseVO) {
+        if ("10".equals(warehouseVO.getOperateType())) {
+            // 成功
+            tWarehouseBillsMapper.receiptApplySuccess(warehouseVO);
+//            TWarehouseBills tWarehouseBills = tWarehouseBillsMapper.mortgageDetail(Long.valueOf(warehouseVO.getReceiptId()));
+            List<SkuItem> skuitemList = skuItemMapper.getByPid(Long.valueOf(warehouseVO.getReceiptId()));
+
+            for (SkuItem skuItem : skuitemList) {
+
+//                for (CollateralGoodsVO collateralGoodsVO : collateralMapper.selectByPid(skuItem.getId().toString())) {
+//
+//                    // 锁定货物
+//                    TWhgenleg tWhgenleg = new TWhgenleg();
+//                    tWhgenleg.setfCorpid(tWarehouseBills.getfCorpid());
+//                    tWhgenleg.setfWarehouseid(tWarehouseBills.getfWarehouseid());
+//                    tWhgenleg.setfTrademodeid(1L);
+//                    tWhgenleg.setWarehouseInformation(collateralGoodsVO.getFWarehouseInformation());
+//                    tWhgenleg.setfMblno(skuItem.getBillOfLading());
+//                    List<Map<String, Object>> maps = tWhgenlegMapper.selectInventoryList(tWhgenleg);
+//                    for (Map<String, Object> map : maps) {
+//                        tWhgenlegMapper.lockTheGoods(map.get("fId").toString());
+//                    }
+//                }
+                collateralMapper.updateTypeByPid(skuItem.getId(), "2");
+            }
+
+
+            return new AjaxResult(0, "OK");
+        } else if ("20".equals(warehouseVO.getOperateType())) {
+            // 失败
+            tWarehouseBillsMapper.receiptApplySuccessFail(warehouseVO);
+            return new AjaxResult(0, "OK");
+        } else {
+            return new AjaxResult(10001, "未知operateType");
+        }
+    }
+
+    @Override
+    @Transactional
+    public AjaxResult receiptReleasePledge(WarehouseVO warehouseVO) {
+        // 1 全部解押 2 部分解压
+        if ("1".equals(warehouseVO.getReleasePledgeType())) {
+            TWarehouseBills tWarehouseBills = tWarehouseBillsMapper.getByReceiptCode(warehouseVO.getBusinessCode());
+            List<SkuItem> skuItemList = skuItemMapper.getByPid(tWarehouseBills.getfId());
+
+            for (SkuItem skuItem : skuItemList) {
+                // 解锁货物
+                for (CollateralGoodsVO collateralGoodsVO : collateralMapper.selectByPid(skuItem.getId().toString())) {
+
+                    // 解锁货物
+                    TWhgenleg tWhgenleg = new TWhgenleg();
+                    tWhgenleg.setfCorpid(tWarehouseBills.getfCorpid());
+                    tWhgenleg.setfWarehouseid(tWarehouseBills.getfWarehouseid());
+                    tWhgenleg.setfTrademodeid(1L);
+                    tWhgenleg.setWarehouseInformation(collateralGoodsVO.getFWarehouseInformation());
+                    tWhgenleg.setfMblno(skuItem.getBillOfLading());
+                    tWhgenleg.setLockStatus(1);
+                    List<Map<String, Object>> maps = tWhgenlegMapper.selectInventoryList(tWhgenleg);
+                    for (Map<String, Object> map : maps) {
+                        tWhgenlegMapper.unlock(map.get("fId").toString());
+                    }
+                }
+                collateralMapper.updateTypeByPid(skuItem.getId(), "1");
+            }
+
+            tWarehouseBillsMapper.unstake(tWarehouseBills.getfId());
+            return new AjaxResult(0, "OK");
+        }
+
+        return new AjaxResult(10003, "10003");
+    }
+
 }

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java

@@ -115,4 +115,6 @@ public interface SysDictDataMapper {
     String getDictLabelMultipleChoice(String dictType, String dictValue);
 
     String selectDictLabels(@Param("dictType")String dictType, @Param("dictValues")String dictValues);
+
+    SysDictData getOne(SysDictData sysDictData);
 }

+ 11 - 0
ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml

@@ -103,6 +103,17 @@
         where dict_type = #{dictType}
           and find_in_set(dict_value, #{dictValues})
     </select>
+    <select id="getOne" parameterType="SysDictData" resultMap="SysDictDataResult">
+        <include refid="selectDictDataVo"/>
+        <where>
+            <if test="dictType != null and dictType != ''">
+                AND dict_type = #{dictType}
+            </if>
+            <if test="dictValue != null and dictValue != ''">
+                AND dict_value = #{dictValue}
+            </if>
+        </where>
+    </select>
 
     <delete id="deleteDictDataById" parameterType="Long">
         delete

+ 2 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TCorpsMapper.java

@@ -206,4 +206,6 @@ public interface TCorpsMapper extends BaseMapper<TCorps> {
      */
     public TCorps verification(@Param("FName") String FName,@Param("identifier") String identifier);
 
+    TCorps getOne(TCorps tCorps);
+
 }

+ 2 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TGoodsMapper.java

@@ -1,5 +1,6 @@
 package com.ruoyi.basicData.mapper;
 
+import com.ruoyi.basicData.domain.TCorps;
 import com.ruoyi.basicData.domain.TGoods;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -95,4 +96,5 @@ public interface TGoodsMapper {
 
     public TGoods getGoodsByName(String fName);
 
+    TGoods getById(String id);
 }

+ 4 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TWarehouseMapper.java

@@ -314,5 +314,9 @@ public interface TWarehouseMapper {
      * @return
      */
     List<TWarehouse> getByFIdList(@Param("warehouseIdList") List<String> warehouseIdList);
+
+    TWarehouse getOne(TWarehouse tWarehouse);
+
+    TWarehouse getWarehouseByFNo(String positionCode);
 }
 

+ 5 - 3
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TGoodsServiceImpl.java

@@ -96,9 +96,11 @@ public class TGoodsServiceImpl implements ITGoodsService {
         }
         TWhgenleg tWhgenleg = new TWhgenleg();
         tWhgenleg.setfGoodsid(tGoods.getfId());
-        TWhgenleg selectTWhgenleg =tWhgenlegMapper.selectTWhgenleg(tWhgenleg);
-        if (ObjectUtils.isNotNull(selectTWhgenleg) && selectTWhgenleg.getfQtyblc() != 0){
-            return AjaxResult.error("该商品存在未出库库存,禁止修改");
+        List<TWhgenleg> selectTWhgenlegList =tWhgenlegMapper.selectTWhgenlegV2(tWhgenleg);
+        for (TWhgenleg selectTWhgenleg : selectTWhgenlegList) {
+            if (ObjectUtils.isNotNull(selectTWhgenleg) && selectTWhgenleg.getfQtyblc() != 0){
+                return AjaxResult.error("该商品存在未出库库存,禁止修改");
+            }
         }
         if (ObjectUtils.isNull(tGoods.getStockWarning())){
             tGoods.setStockWarning(new BigDecimal(0));

+ 14 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TWarehouseServiceImpl.java

@@ -42,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -550,8 +551,20 @@ public class TWarehouseServiceImpl implements ITWarehouseService {
         if ("null".equals(warehouseCode)) {
             warehouseCode = null;
         }
-        return tWarehouseMapper.queryGoodsAccountDetailByPageV1(warehouseCode, ownerName, ownerCode, ownerSocialIdentifier, goodsName, specifications,
+
+        List<Map<String, Object>> maps = tWarehouseMapper.queryGoodsAccountDetailByPageV1(warehouseCode, ownerName, ownerCode, ownerSocialIdentifier, goodsName, specifications,
                 producing, materialQuality, level, receiptDoc, billOfLading, areaName, areaCode, slotName, slotCode, pageNo, pageSize);
+
+        for (Map<String, Object> map : maps) {
+            if (map.get("storesTime") != null) {
+                Date storesTime = (Date) map.get("storesTime");
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                String datef = sdf.format(storesTime);
+                map.put("storesTime", datef);
+            }
+        }
+
+        return maps;
     }
 
     /**

+ 60 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/domain/TWhgenleg.java

@@ -279,10 +279,70 @@ public class TWhgenleg extends BaseEntity {
     private String timeEndBsdate;
 
     /**
+     * 仓库编号
+     */
+    private String warehouseNo;
+
+    /**
+     * 客户Id
+     */
+    private String customerId;
+
+
+    /**
+     * 库区 / 库位
+     */
+    private String warehouseInformation;
+
+    private String sku;
+    private String spu;
+
+
+    /**
      *核注清单
      */
     private String checklists;
 
+    public String getWarehouseInformation() {
+        return warehouseInformation;
+    }
+
+    public void setWarehouseInformation(String warehouseInformation) {
+        this.warehouseInformation = warehouseInformation;
+    }
+
+    public String getSku() {
+        return sku;
+    }
+
+    public void setSku(String sku) {
+        this.sku = sku;
+    }
+
+    public String getSpu() {
+        return spu;
+    }
+
+    public void setSpu(String spu) {
+        this.spu = spu;
+    }
+
+    public String getCustomerId() {
+        return customerId;
+    }
+
+    public void setCustomerId(String customerId) {
+        this.customerId = customerId;
+    }
+
+    public String getWarehouseNo() {
+        return warehouseNo;
+    }
+
+    public void setWarehouseNo(String warehouseNo) {
+        this.warehouseNo = warehouseNo;
+    }
+
     public String getChecklists() {
         return checklists;
     }

+ 26 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/mapper/TWhgenlegMapper.java

@@ -1,11 +1,14 @@
 package com.ruoyi.reportManagement.mapper;
 
 
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
 import com.ruoyi.reportManagement.domain.vo.WhgenlegVO;
 import com.ruoyi.reportManagement.excel.Whgenleg;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import com.ruoyi.warehouseBusiness.domain.vo.CalculateStorageFeesInfoVO;
+import com.ruoyi.warehouseBusiness.domain.vo.SkuItem;
+import com.ruoyi.warehouseBusiness.domain.vo.WarehouseVO;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -78,6 +81,8 @@ public interface TWhgenlegMapper {
      */
     public TWhgenleg selectTWhgenleg(TWhgenleg tWhgenleg);
 
+    public List<TWhgenleg> selectTWhgenlegV2(TWhgenleg tWhgenleg);
+
 
     /**
      * 修改库存总账表
@@ -124,6 +129,8 @@ public interface TWhgenlegMapper {
      */
     public List<Map<String, Object>> selectInventoryMapList(TWhgenleg tWhgenleg);
 
+    public List<Map<String, Object>> selectInventoryMapListV2(TWhgenleg tWhgenleg);
+
     /**
      * App查询库存总账列表
      *
@@ -312,4 +319,23 @@ public interface TWhgenlegMapper {
      * @return
      */
     List<Map<String, Object>> selectStockListCk(@Param("fMblno") String fMblno, @Param("corpId") Long corpId);
+
+    /**
+     * 抵押查找货物
+     * @param warehouseVO
+     * @return
+     */
+    List<Map<String, Object>> getDistributionlList(WarehouseVO warehouseVO);
+
+    /**
+     * 锁定货物
+     * @param fId
+     */
+    void lockTheGoods(String fId);
+
+    /**
+     * 解锁货物
+     * @param fId
+     */
+    void unlock(String fId);
 }

+ 43 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java

@@ -26,6 +26,8 @@ import com.ruoyi.system.domain.SysConfig;
 import com.ruoyi.system.mapper.SysConfigMapper;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import com.ruoyi.warehouseBusiness.domain.enums.WarehouseTypeEnum;
+import com.ruoyi.warehouseBusiness.domain.vo.CollateralGoodsVO;
+import com.ruoyi.warehouseBusiness.mapper.CollateralMapper;
 import com.ruoyi.warehouseBusiness.mapper.TWarehouseBillsMapper;
 import com.ruoyi.warehouseBusiness.mapper.TWarehousebillsitemsMapper;
 import org.springframework.beans.BeanUtils;
@@ -390,6 +392,9 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
         return tWhgenlegMapper.selectTWhgenlegList(tWhgenleg);
     }
 
+    @Autowired
+    private CollateralMapper collateralMapper;
+
     /**
      * 出库、调拨、货转查询库存总账列表
      *
@@ -407,7 +412,44 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
                 tWhgenleg.setfLocation(0L);
             }
         }
-        return tWhgenlegMapper.selectInventoryList(tWhgenleg);
+        List<Map<String, Object>> maps = tWhgenlegMapper.selectInventoryList(tWhgenleg);
+
+//        ****************************************山能抵押数据过滤********************************************************
+//        List<Map<String, Object>> hashMaps = new ArrayList<>();
+//        // 查询抵押的物品
+//        for (Map<String, Object> map : maps) {
+//            CollateralGoodsVO  datum = collateralMapper.getListByWarehouseIdAndSpuAndSkuAndClientId(map.get("fWarehouseId").toString(),
+//                                                                         map.get("fCorpIds").toString(),
+//                                                                         map.get("spu").toString(),
+//                                                                         map.get("sku").toString(),
+//                                                                         map.get("fWarehouseids").toString()
+//                    );
+//
+//            if (datum != null) {
+//                // 数量
+//                Integer sum = Integer.parseInt(map.get("fQtyblc").toString());
+//                BigDecimal bigDecimal2 = new BigDecimal(datum.getFQtyD());
+//                BigDecimal bigDecimal3 = new BigDecimal(sum.toString());
+//                int i = bigDecimal2.subtract(bigDecimal3).intValue();
+//                if (i <= 0) {
+//                    continue;
+//                }
+//                map.put("fQtyblc", sum);
+//
+//                // 重量
+//                BigDecimal bigDecimal = new BigDecimal(map.get("fGrossweightblc").toString());
+//                BigDecimal bigDecimal1 = new BigDecimal(datum.getFGrossweightD());
+//                BigDecimal multiply = bigDecimal1.multiply(new BigDecimal("1000"));
+//                double subtract = bigDecimal.subtract(multiply).doubleValue();
+//                map.put("fGrossweightblc", subtract);
+//                hashMaps.add(map);
+//            } else {
+//                hashMaps.add(map);
+//            }
+//        }
+//        return hashMaps;
+//        *************************************************************************************************************
+        return maps;
     }
 
     /**

+ 41 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/CollateralGoods.java

@@ -0,0 +1,41 @@
+package com.ruoyi.warehouseBusiness.domain;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.Map;
+
+@Data
+public class CollateralGoods {
+
+    private Long id;
+
+    private String spuId;
+    private String skuId;
+    private String billOfLading;
+    private BigDecimal goodsWeight;
+    private Integer goodsQuantity;
+    private String quantityUnit;
+    private String weightUnit;
+    private String warehouseCode;
+    private String warehouseName;
+    private String areaName;
+    private String areaCode;
+    private String slotName;
+    private String slotCode;
+    private String preInOutReceiptId;
+    private Map<String, String> spuProperties;
+    private Date productDate;
+    private Date arrivalTime;
+    private String remark;
+    private String pid;
+    private String names;
+
+
+
+    private String fWarehouseInformation;
+    private Integer fQtyD;
+    private BigDecimal fGrossweightD;
+    private String fMblno;
+}

+ 206 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehouseBills.java

@@ -9,6 +9,7 @@ import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.shipping.domain.TVoyage;
 import com.ruoyi.shipping.domain.TWarehousebillsCntr;
 import com.ruoyi.shipping.domain.TWarehousebillsCntritems;
+import com.ruoyi.warehouseBusiness.domain.vo.SkuItem;
 import org.springframework.format.annotation.DateTimeFormat;
 
 import java.math.BigDecimal;
@@ -282,13 +283,14 @@ public class TWarehouseBills extends BaseEntity {
     private Long fBankcorpid;
 
     /**
-     * 单据类型(数据字典)SJRK(入库) SJCK(实际出库) CKDB(调拨) HQZY(货权转移) HWTG(货物通关)
+     * 单据类型(数据字典)SJRK(入库) SJCK(实际出库) CKDB(调拨) HQZY(货权转移) HWTG(货物通关) DY(抵押)
      */
     @Excel(name = "单据类型(数据字典)SJRK", readConverterExp = "入=库")
     private String fBilltype;
 
     /**
      * 状态(数据字典),N 入(出)库中,T入(出)库完成,状态为完成不能删除,状态变化,用邮件、微信通知客户。
+     * 2023-11-16新增抵押 Y3     抵押不走原字典, 1 抵押申请 2 抵押取消 3 抵押成功 4 抵押失败 5 已提交配货 6 申请失败 7 解押成功
      */
     @Excel(name = "状态(数据字典),N 入", readConverterExp = "出=")
     private Long fBillstatus;
@@ -737,6 +739,16 @@ public class TWarehouseBills extends BaseEntity {
     //核注清单
     private String checklists;
 
+    private List<SkuItem> skuItemList;
+
+    public List<SkuItem> getSkuItemList() {
+        return skuItemList;
+    }
+
+    public void setSkuItemList(List<SkuItem> skuItemList) {
+        this.skuItemList = skuItemList;
+    }
+
     public String getChecklists() {
         return checklists;
     }
@@ -1323,6 +1335,199 @@ public class TWarehouseBills extends BaseEntity {
     private Date facilityTime;
 
 
+    /**
+     * 产业平台业务编号
+     */
+    private String businessCode;
+    /**
+     * 数仓平台对应编号
+     */
+    private String serialNumber;
+    /**
+     * 产业平台仓单申请号
+     */
+    private String receiptApplyCode;
+
+
+
+    private String storageName;
+    private String storageContractCode;
+
+
+    private String storageContractStart;
+    private String storageContractEnd;
+
+
+    private String storageRate;
+    private String storagePayTime;
+    private String insuranceCode;
+    private String insuranceAmount;
+
+
+    private String insuranceStartTime;
+    private String insuranceEndTime;
+
+
+    private String insurer;
+    private String inventory;
+    private String operator;
+    private String auditor;
+    private Integer operationType;
+
+    private String receiptCode;
+
+    public String getReceiptCode() {
+        return receiptCode;
+    }
+
+    public void setReceiptCode(String receiptCode) {
+        this.receiptCode = receiptCode;
+    }
+
+    public String getBusinessCode() {
+        return businessCode;
+    }
+
+    public void setBusinessCode(String businessCode) {
+        this.businessCode = businessCode;
+    }
+
+    public String getSerialNumber() {
+        return serialNumber;
+    }
+
+    public void setSerialNumber(String serialNumber) {
+        this.serialNumber = serialNumber;
+    }
+
+    public String getReceiptApplyCode() {
+        return receiptApplyCode;
+    }
+
+    public void setReceiptApplyCode(String receiptApplyCode) {
+        this.receiptApplyCode = receiptApplyCode;
+    }
+
+    public String getStorageName() {
+        return storageName;
+    }
+
+    public void setStorageName(String storageName) {
+        this.storageName = storageName;
+    }
+
+    public String getStorageContractCode() {
+        return storageContractCode;
+    }
+
+    public void setStorageContractCode(String storageContractCode) {
+        this.storageContractCode = storageContractCode;
+    }
+
+    public String getStorageContractStart() {
+        return storageContractStart;
+    }
+
+    public void setStorageContractStart(String storageContractStart) {
+        this.storageContractStart = storageContractStart;
+    }
+
+    public String getStorageContractEnd() {
+        return storageContractEnd;
+    }
+
+    public void setStorageContractEnd(String storageContractEnd) {
+        this.storageContractEnd = storageContractEnd;
+    }
+
+    public String getStorageRate() {
+        return storageRate;
+    }
+
+    public void setStorageRate(String storageRate) {
+        this.storageRate = storageRate;
+    }
+
+    public String getStoragePayTime() {
+        return storagePayTime;
+    }
+
+    public void setStoragePayTime(String storagePayTime) {
+        this.storagePayTime = storagePayTime;
+    }
+
+    public String getInsuranceCode() {
+        return insuranceCode;
+    }
+
+    public void setInsuranceCode(String insuranceCode) {
+        this.insuranceCode = insuranceCode;
+    }
+
+    public String getInsuranceAmount() {
+        return insuranceAmount;
+    }
+
+    public void setInsuranceAmount(String insuranceAmount) {
+        this.insuranceAmount = insuranceAmount;
+    }
+
+    public String getInsuranceStartTime() {
+        return insuranceStartTime;
+    }
+
+    public void setInsuranceStartTime(String insuranceStartTime) {
+        this.insuranceStartTime = insuranceStartTime;
+    }
+
+    public String getInsuranceEndTime() {
+        return insuranceEndTime;
+    }
+
+    public void setInsuranceEndTime(String insuranceEndTime) {
+        this.insuranceEndTime = insuranceEndTime;
+    }
+
+    public String getInsurer() {
+        return insurer;
+    }
+
+    public void setInsurer(String insurer) {
+        this.insurer = insurer;
+    }
+
+    public String getInventory() {
+        return inventory;
+    }
+
+    public void setInventory(String inventory) {
+        this.inventory = inventory;
+    }
+
+    public String getOperator() {
+        return operator;
+    }
+
+    public void setOperator(String operator) {
+        this.operator = operator;
+    }
+
+    public String getAuditor() {
+        return auditor;
+    }
+
+    public void setAuditor(String auditor) {
+        this.auditor = auditor;
+    }
+
+    public Integer getOperationType() {
+        return operationType;
+    }
+
+    public void setOperationType(Integer operationType) {
+        this.operationType = operationType;
+    }
+
     public Long getfLoadportid() {
         return fLoadportid;
     }

+ 11 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/vo/AddCollateralGoodsVO.java

@@ -0,0 +1,11 @@
+package com.ruoyi.warehouseBusiness.domain.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class AddCollateralGoodsVO {
+    private String pid;
+    private List<CollateralGoodsVO> list;
+}

+ 55 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/vo/CollateralGoodsVO.java

@@ -0,0 +1,55 @@
+package com.ruoyi.warehouseBusiness.domain.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.Map;
+
+@Data
+public class CollateralGoodsVO {
+
+    @JsonProperty("id")
+    private Long id;
+
+    @JsonProperty("type")
+    private Integer type;
+
+    @JsonProperty("fQtyD")
+    private String fQtyD;
+    @JsonProperty("fGrossweightD")
+    private String fGrossweightD;
+    @JsonProperty("fCorpid")
+    private String fCorpid;
+    @JsonProperty("sku")
+    private String sku;
+    @JsonProperty("spu")
+    private String spu;
+    @JsonProperty("fWarehouseNo")
+    private String fWarehouseNo;
+    @JsonProperty("fMblno")
+    private String fMblno;
+    @JsonProperty("fWarehouseInformation")
+    private String fWarehouseInformation;
+    @JsonProperty("fWarehouseLocationid")
+    private String fWarehouseLocationid;
+    @JsonProperty("parentId")
+    private String parentId;
+    @JsonProperty("fOriginalbillno")
+    private String fOriginalbillno;
+    @JsonProperty("fOriginalbilldate")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private String fOriginalbilldate;
+    @JsonProperty("remark")
+    private String remark;
+    @JsonProperty("goodsId")
+    private String goodsId;
+    @JsonProperty("pid")
+    private String pid;
+
+    // 入库单号
+    @JsonProperty("fBillno")
+    private String fBillno;
+}

+ 72 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/vo/SkuItem.java

@@ -0,0 +1,72 @@
+package com.ruoyi.warehouseBusiness.domain.vo;
+
+import lombok.Data;
+
+import java.util.Objects;
+
+@Data
+public class SkuItem {
+
+    /**
+     * id
+     */
+    private Long id;
+
+    /**
+     * wmsSpuId
+     */
+    private String spuId;
+
+    /**
+     * wmsSkuId
+     */
+    private String skuId;
+
+    /**
+     * 提单号
+     */
+    private String billOfLading;
+
+    /**
+     * 重量
+     */
+    private Double goodsWeight;
+
+    /**
+     * 数量
+     */
+    private Integer goodsQuantity;
+
+
+    /**
+     * wms sku名称
+     */
+    private String skuName;
+
+    /**
+     * 重量单位
+     */
+    private String weightUnit;
+
+    /**
+     * 仓库编码
+     */
+    private String warehouseCode;
+
+    /**
+     * 仓库名称
+     */
+    private String warehouseName;
+
+    /**
+     * pid
+     */
+    private Long pid;
+
+    /**
+     * 入库单号
+     */
+    private String enterCode;
+
+
+}

+ 166 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/vo/WarehouseVO.java

@@ -0,0 +1,166 @@
+package com.ruoyi.warehouseBusiness.domain.vo;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import java.util.List;
+import java.util.Objects;
+
+@Data
+public class WarehouseVO {
+    @JsonProperty("fId")
+    private String fId;
+
+    /**
+     * wms仓单开立申请ID
+     */
+    @JsonProperty("receiptId")
+    private String receiptId;
+
+    /**
+     * 产业平台业务编号
+     */
+    @JsonProperty("businessCode")
+    private String businessCode;
+    /**
+     * 数仓平台对应编号
+     */
+    @JsonProperty("serialNumber")
+    private String serialNumber;
+    /**
+     * 仓库编码
+     */
+    @JsonProperty("positionCode")
+    private String positionCode;
+    /**
+     * 产业平台仓单申请号
+     */
+    @JsonProperty("receiptApplyCode")
+    private String receiptApplyCode;
+    /**
+     * 货主编码
+     */
+    @JsonProperty("ownerCode")
+    private String ownerCode;
+    /**
+     * 货主名称
+     */
+    @JsonProperty("ownerName")
+    private String ownerName;
+    /**
+     * 货主统一信用代码
+     */
+    @JsonProperty("ownerIdentifier")
+    private String ownerIdentifier;
+    /**
+     * 货物信息集合
+     */
+    @JsonProperty("skuItems")
+    private List<SkuItem> skuItems;
+    /**
+     * 提交人
+     */
+    @JsonProperty("submitter")
+    private String submitter;
+
+
+    /**
+     * 配货结果
+     */
+    @JsonProperty("operationType")
+    private String operationType;
+
+
+    /**
+     * 操作类型
+     */
+    @JsonProperty("operateType")
+    private String operateType;
+
+    /**
+     * 产业平台仓单编号
+     */
+    @JsonProperty("receiptCode")
+    private String receiptCode;
+
+    /**
+     * 客户id
+     */
+    @JsonProperty("fCorpid")
+    private String fCorpid;
+
+
+    /**
+     * 解质押类型 1-全部解质押 2-部分解质押
+     */
+    @JsonProperty("releasePledgeType")
+    private String releasePledgeType;
+
+    /**
+     * wms解质押id 撤销时提供
+     */
+    @JsonProperty("receiptReleasePledgeId")
+    private String receiptReleasePledgeId;
+
+    /**
+     * 备注
+     */
+    @JsonProperty("remark")
+    private String remark;
+
+
+    /******************************** 查询用 *******************************/
+
+    /**
+     * wmsSpuId
+     */
+    @JsonProperty("spuId")
+    private String spuId;
+
+    /**
+     * wmsSkuId
+     */
+    @JsonProperty("skuId")
+    private String skuId;
+
+    /**
+     * 提单号
+     */
+    @JsonProperty("billOfLading")
+    private String billOfLading;
+
+    /**
+     * 重量
+     */
+    @JsonProperty("goodsWeight")
+    private Double goodsWeight;
+
+    /**
+     * 数量
+     */
+    @JsonProperty("goodsQuantity")
+    private Integer goodsQuantity;
+
+    /**
+     * 货主id
+     */
+    @JsonProperty("ownerId")
+    private Long ownerId;
+
+    /**
+     * 仓库
+     */
+    @JsonProperty("warehouseId")
+    private Long warehouseId;
+
+
+    /******************************** 保存数据用 *******************************/
+
+    /**
+     * 状态(数据字典),N 入(出)库中,T入(出)库完成,状态为完成不能删除,状态变化,用邮件、微信通知客户。
+     * 2023-11-16新增抵押 Y3     抵押不走原字典, 1 抵押申请 2 抵押取消 3 抵押成功 4 抵押失败 5已提交配货 6 申请失败
+     */
+    private String fBillstatus;
+
+}
+

+ 23 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/CollateralMapper.java

@@ -0,0 +1,23 @@
+package com.ruoyi.warehouseBusiness.mapper;
+
+import com.ruoyi.warehouseBusiness.domain.CollateralGoods;
+import com.ruoyi.warehouseBusiness.domain.vo.CollateralGoodsVO;
+import com.ruoyi.warehouseBusiness.domain.vo.SkuItem;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface CollateralMapper {
+
+    void insetInto(CollateralGoodsVO data);
+
+    List<CollateralGoodsVO> selectByPid(String pid);
+
+    void deleteByPid(String pid);
+
+    void updateTypeByPid(@Param("pid") Long pid, @Param("type") String type);
+
+    CollateralGoodsVO getListByWarehouseIdAndSpuAndSkuAndClientId(@Param("fWarehouseId") String fWarehouseId, @Param("fCorpIds") String fCorpIds, @Param("spu") String spu, @Param("sku") String sku, @Param("fWarehouseids") String fWarehouseids);
+}

+ 19 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/SkuItemMapper.java

@@ -0,0 +1,19 @@
+package com.ruoyi.warehouseBusiness.mapper;
+
+import com.ruoyi.warehouseBusiness.domain.vo.SkuItem;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface SkuItemMapper {
+
+    Integer insertInto(SkuItem skuItem);
+
+    /**
+     * 根据pin查询数据
+     * @param id
+     * @return
+     */
+    List<SkuItem> getByPid(Long id);
+}

+ 51 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseBillsMapper.java

@@ -13,6 +13,7 @@ import com.ruoyi.warehouseBusiness.domain.TWareHouseExcelItems;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import com.ruoyi.warehouseBusiness.domain.dto.WarehousebillsDTO;
 import com.ruoyi.warehouseBusiness.domain.vo.WarehouseBillsVO;
+import com.ruoyi.warehouseBusiness.domain.vo.WarehouseVO;
 import com.ruoyi.warehouseBusiness.excel.CorpAnalysis;
 import com.ruoyi.warehouseBusiness.excel.OtherFinanceExcel;
 import com.ruoyi.warehouseBusiness.excel.StorageDetail;
@@ -352,4 +353,54 @@ public interface TWarehouseBillsMapper extends BaseMapper<TWarehouseBills> {
      * @return
      */
     TWarehouseBills selectBYOriginalBillNo(@Param("originalBillNo")String originalBillNo);
+
+    /**
+     * 根据id修改状态
+     * @param warehouseVO
+     * @return
+     */
+
+//                <if test="businessCode != null and businessCode != ''">and business_code = #{businessCode}</if>
+    Integer updateBillstatusOfWarehouseById(WarehouseVO warehouseVO);
+
+    /**
+     * 抵押列表
+     * @param warehouseBills
+     * @return
+     */
+    List<TWarehouseBills> mortgageList(TWarehouseBills warehouseBills);
+
+    /**
+     * 抵押详情
+     * @param id
+     * @return
+     */
+    TWarehouseBills mortgageDetail(Long id);
+
+    /**
+     * 仓单开立成功
+     */
+    void receiptApplySuccess(WarehouseVO warehouseVO);
+
+    /**
+     * 仓库开立失败
+     */
+    void receiptApplySuccessFail(WarehouseVO warehouseVO);
+
+    /**
+     * 抵押保存
+     */
+    void foreclosurePreservation(TWarehouseBills warehouseBills);
+
+    /**
+     * 修改配货结果
+     */
+    void updateOperationTypeByFid(WarehouseVO warehouseVO);
+
+    TWarehouseBills getByReceiptCode(String receiptCode);
+
+    /**
+     * 解押
+     */
+    void unstake(Long aLong);
 }

+ 37 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java

@@ -1,5 +1,6 @@
 package com.ruoyi.warehouseBusiness.service;
 
+import com.ruoyi.basicData.domain.TFees;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.reportManagement.domain.TWareHouseItemsExcel;
@@ -11,6 +12,9 @@ import com.ruoyi.warehouseBusiness.domain.TWareHouseExcelItems;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import com.ruoyi.warehouseBusiness.domain.TWarehousebillsitems;
 import com.ruoyi.warehouseBusiness.domain.dto.WarehousebillsDTO;
+import com.ruoyi.warehouseBusiness.domain.vo.AddCollateralGoodsVO;
+import com.ruoyi.warehouseBusiness.domain.vo.CollateralGoodsVO;
+import com.ruoyi.warehouseBusiness.domain.vo.WarehouseVO;
 import com.ruoyi.warehouseBusiness.excel.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -932,4 +936,37 @@ public interface ITWarehouseBillsService {
     TWarehouseBills selectBYOriginalBillNo(String originalBillNo);
 
     String updateBillingDate(Long fId);
+
+    /**
+     * 查询抵押数据
+     * @param warehouseBills
+     * @return
+     */
+    List<TWarehouseBills> mortgageList(TWarehouseBills warehouseBills);
+
+    /**
+     * 抵押详情
+     */
+    TWarehouseBills mortgageDetail(Long id);
+
+    /**
+     * 查询配货列表
+     */
+    AjaxResult getDistributionlList(WarehouseVO warehouseVO);
+
+    /**
+     * 反馈
+     */
+    AjaxResult mortgage(WarehouseVO warehouseVO);
+
+    AjaxResult collateralCargoInformation(AddCollateralGoodsVO vo);
+
+    AjaxResult getCollateralGoodsBypid(String pid);
+
+    /**
+     * 保存
+     * @param warehouseBills
+     * @return
+     */
+    AjaxResult masterSuppressThePreservationOfGoods(TWarehouseBills warehouseBills);
 }

+ 2 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/BillnoSerialServiceImpl.java

@@ -120,6 +120,8 @@ public class BillnoSerialServiceImpl implements IBillnoSerialService {
             billNo = "INV" + billNo;
         }else if ("CDZZ".equals(billType)) {
             billNo = "ZZ" + billNo;
+        } else if ("DY".equals(billType)) {
+            billNo = "DY" + billNo;
         } else {
             billNo = billType + billNo;
         }

+ 313 - 4
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -3,6 +3,7 @@ package com.ruoyi.warehouseBusiness.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -31,6 +32,7 @@ import com.ruoyi.common.utils.*;
 import com.ruoyi.common.utils.ip.AddressUtils;
 import com.ruoyi.common.utils.poi.DrawExcel;
 import com.ruoyi.common.utils.poi.ExcelUtils;
+import com.ruoyi.common.utils.sign.Md5Utils;
 import com.ruoyi.finance.domain.TFeeDo;
 import com.ruoyi.finance.mapper.TFeeDoMapper;
 import com.ruoyi.quotation.domain.TSeaprice;
@@ -60,10 +62,7 @@ import com.ruoyi.warehouseBusiness.domain.dto.WarehousebillsDTO;
 import com.ruoyi.warehouseBusiness.domain.enums.FeesTypeEnum;
 import com.ruoyi.warehouseBusiness.domain.enums.WarehouseActIdEnum;
 import com.ruoyi.warehouseBusiness.domain.enums.WarehouseTypeEnum;
-import com.ruoyi.warehouseBusiness.domain.vo.AppWarehouseInfoVO;
-import com.ruoyi.warehouseBusiness.domain.vo.CalculateStorageFeesInfoVO;
-import com.ruoyi.warehouseBusiness.domain.vo.StorageFeeCalculationResultVO;
-import com.ruoyi.warehouseBusiness.domain.vo.WarehouseBillsVO;
+import com.ruoyi.warehouseBusiness.domain.vo.*;
 import com.ruoyi.warehouseBusiness.excel.*;
 import com.ruoyi.warehouseBusiness.mapper.*;
 import com.ruoyi.warehouseBusiness.service.ITWarehouseBillsService;
@@ -84,6 +83,7 @@ import org.springframework.http.*;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
+import org.springframework.util.DigestUtils;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
@@ -94,9 +94,11 @@ import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.math.RoundingMode;
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.security.KeyFactory;
 import java.security.PrivateKey;
 import java.security.spec.PKCS8EncodedKeySpec;
+import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -10332,6 +10334,313 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         return "操作成功";
     }
 
+    @Autowired
+    private TWarehouseBillsMapper warehouseBillsMapper;
+
+    @Autowired
+    private SkuItemMapper skuItemMapper;
+
+    @Override
+    public List<TWarehouseBills> mortgageList(TWarehouseBills warehouseBills) {
+
+        return warehouseBillsMapper.mortgageList(warehouseBills);
+    }
+
+    @Override
+    public TWarehouseBills mortgageDetail(Long id) {
+        TWarehouseBills tWarehouseBills = warehouseBillsMapper.mortgageDetail(id);
+        List<SkuItem> skuItemList = skuItemMapper.getByPid(tWarehouseBills.getfId());
+        tWarehouseBills.setSkuItemList(skuItemList);
+        return tWarehouseBills;
+    }
+
+    @Override
+    public AjaxResult getDistributionlList(WarehouseVO warehouseVO) {
+
+        TWhgenleg tWhgenleg = new TWhgenleg();
+        // 提单号
+        tWhgenleg.setfMblno(warehouseVO.getBillOfLading());
+        // 仓库编号
+//        tWhgenleg.setWarehouseNo(warehouseVO.getPositionCode());
+        // 客户编号
+        tWhgenleg.setCustomerId(warehouseVO.getOwnerId().toString());
+        tWhgenleg.setSku(warehouseVO.getSkuId());
+        tWhgenleg.setSpu(warehouseVO.getSpuId());
+        List<Map<String, Object>> mapList = tWhgenlegMapper.selectInventoryMapListV2(tWhgenleg);
+
+        for (Map<String, Object> map : mapList) {
+            String fGrossweightD = map.get("fGrossweightD").toString();
+            BigDecimal big = new BigDecimal(fGrossweightD);
+            double v = big.divide(new BigDecimal("1000"), 2, RoundingMode.HALF_UP).doubleValue();
+            map.put("fGrossweightD", v);
+        }
+
+
+        return AjaxResult.success(mapList);
+    }
+
+    @Override
+    @Transactional
+    public AjaxResult mortgage(WarehouseVO warehouseVO) {
+        TWarehouseBills a = mortgageDetail(Long.valueOf(warehouseVO.getFId()));
+//        a.setOperationType(Integer.valueOf(warehouseVO.getOperationType()));
+        a.setOperationType(10);
+
+        Map<String, Object> reqBody = new HashMap<>();
+
+        // 仓库
+        TWarehouse warehouseMaser = new TWarehouse();
+        warehouseMaser.setfId(Long.valueOf(a.getfWarehouseid()));
+        warehouseMaser = tWarehouseMapper.getOne(warehouseMaser);
+
+        // 仓储公司
+//        TWarehouse warehouseFirm = new TWarehouse();
+//        warehouseFirm.setfId(warehouseMaser.getParentId());
+//        warehouseFirm = tWarehouseMapper.getOne(warehouseFirm);
+
+        // 客户信息
+        TCorps tCorps = new TCorps();
+        tCorps.setfId(Long.valueOf(a.getfCorpid()));
+        tCorps = tCorpsMapper.getOne(tCorps);
+
+        reqBody.put("businessCode", a.getBusinessCode());
+        reqBody.put("serialNumber", a.getSerialNumber());
+//        reqBody.put("positionCode", warehouseMaser.getfNo());
+        reqBody.put("positionCode", warehouseMaser.getfId());
+//        reqBody.put("operationType", a.getOperationType());
+        reqBody.put("receiptId", a.getfId());
+//        reqBody.put("ownerCode", tCorps.getfNo());
+        reqBody.put("ownerName", tCorps.getfName());
+        reqBody.put("ownerIdentifier", tCorps.getUscc());
+
+        // 客户地址
+        reqBody.put("ownerAddress", tCorps.getfAddr());
+
+        reqBody.put("remark", a.getRemark());
+        reqBody.put("storageName", a.getStorageName());
+        reqBody.put("storageContractCode", a.getStorageContractCode());
+        reqBody.put("storageContractStart", a.getStorageContractStart());
+        reqBody.put("storageContractEnd", a.getStorageContractEnd());
+//        reqBody.put("warehouseCode", warehouseMaser.getfNo());
+        reqBody.put("warehouseCode", warehouseMaser.getfId());
+        reqBody.put("warehouseName", warehouseMaser.getfName());
+        reqBody.put("storageRate", a.getStorageRate());
+        reqBody.put("storagePayTime", a.getStoragePayTime());
+        reqBody.put("insuranceCode", a.getInsuranceCode());
+        reqBody.put("insuranceAmount", a.getInsuranceAmount());
+        reqBody.put("insuranceStartTime", a.getInsuranceStartTime());
+        reqBody.put("insuranceEndTime", a.getInsuranceEndTime());
+        reqBody.put("insurer", a.getInsurer());
+        reqBody.put("inventory", a.getInventory());
+        reqBody.put("operator", a.getOperator());
+        reqBody.put("auditor", a.getAuditor());
+
+        reqBody.put("operationType", "10");
+
+        List<SkuItem> skuItemList = a.getSkuItemList();
+
+
+        List<Map<String, Object>> goodsMap = new ArrayList<>();
+        for (SkuItem skuItem : skuItemList) {
+            List<CollateralGoodsVO> collateralGoodsList = collateralMapper.selectByPid(skuItem.getId().toString());
+            for (CollateralGoodsVO vo : collateralGoodsList) {
+
+
+                // 锁定货物
+                TWhgenleg tWhgenleg = new TWhgenleg();
+                tWhgenleg.setfCorpid(a.getfCorpid());
+                tWhgenleg.setfWarehouseid(a.getfWarehouseid());
+                tWhgenleg.setfTrademodeid(1L);
+                tWhgenleg.setWarehouseInformation(vo.getFWarehouseInformation());
+                tWhgenleg.setfMblno(skuItem.getBillOfLading());
+                List<Map<String, Object>> maps = tWhgenlegMapper.selectInventoryList(tWhgenleg);
+                for (Map<String, Object> map : maps) {
+                    tWhgenlegMapper.lockTheGoods(map.get("fId").toString());
+                }
+
+
+                Map<String, Object> goodsMaps = new HashMap<>();
+
+                // 库区
+                TWarehouse warehouse2 = new TWarehouse();
+                warehouse2.setfId(Long.valueOf(vo.getParentId()));
+                warehouse2 = tWarehouseMapper.getOne(warehouse2);
+                // 库位
+                TWarehouse warehouse3 = new TWarehouse();
+                warehouse3.setfId(Long.valueOf(vo.getFWarehouseLocationid()));
+                warehouse3 = tWarehouseMapper.getOne(warehouse3);
+
+                // 仓库
+                TWarehouse warehouse = new TWarehouse();
+                warehouse.setfId(warehouse2.getParentId());
+                warehouse = tWarehouseMapper.getOne(warehouse);
+                DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
+                Date date = null;
+                try {
+                    date = df.parse(vo.getFOriginalbilldate());
+                } catch (ParseException e) {
+                    e.printStackTrace();
+                }
+
+                TGoods goods = tGoodsMapper.getById(vo.getGoodsId());
+                Map<String, String> map = new HashMap<>();
+                map.put("name", goods.getfName());
+                map.put("spec", goods.getfPackagespecs());
+                map.put("producer", "无");
+                map.put("brand", "无");
+                map.put("level", "无");
+
+                SysDictData sysDictData = new SysDictData();
+                sysDictData.setDictType("data_goods_category");
+                sysDictData.setDictValue(vo.getSpu());
+
+                goodsMaps.put("spuId", vo.getSpu());
+                goodsMaps.put("skuId", vo.getSku());
+                goodsMaps.put("skuName", goods.getfName());
+                goodsMaps.put("billOfLading", vo.getFMblno());
+                goodsMaps.put("goodsWeight", Double.parseDouble(vo.getFGrossweightD()));
+                goodsMaps.put("goodsQuantity", Integer.parseInt(vo.getFQtyD()));
+                goodsMaps.put("quantityUnit", "个");
+                goodsMaps.put("weightUnit", "吨");
+                goodsMaps.put("warehouseCode", warehouse.getfId());
+                goodsMaps.put("warehouseName", warehouse.getfName());
+                // 仓库地址
+                goodsMaps.put("warehouseAddress", warehouse.getfAddr());
+                goodsMaps.put("areaName", warehouse2.getfName());
+                goodsMaps.put("areaCode", warehouse2.getfNo());
+                goodsMaps.put("slotName", warehouse3.getfName());
+                goodsMaps.put("slotCode", warehouse3.getfNo());
+                goodsMaps.put("preInOutReceiptId", vo.getFOriginalbillno());
+                goodsMaps.put("spuProperties", map);
+                goodsMaps.put("productDate", vo.getFOriginalbilldate());
+                goodsMaps.put("arrivalTime", vo.getFOriginalbilldate());
+                goodsMaps.put("remark", vo.getRemark());
+
+                // 入库单号
+                goodsMaps.put("enterCode", vo.getFBillno());
+
+                goodsMap.add(goodsMaps);
+            }
+        }
+
+//        List<Map<String, Object>> goodsMapTwo = new ArrayList<>();
+//        for (int i = 0; i < goodsMap.size(); i++) {
+//            if (i == 0) {
+//                goodsMapTwo.add(goodsMap.get(i));
+//                continue;
+//            }
+//
+//            boolean isRepeat = false;
+//            for (Map<String, Object> z : goodsMapTwo) {
+//                Map<String, Object> x = goodsMap.get(i);
+//                if (x.get("spuId").toString().equals(z.get("spuId").toString()) &&
+//                        x.get("skuId").toString().equals(z.get("skuId").toString()) &&
+//                        x.get("billOfLading").toString().equals(z.get("billOfLading").toString())) {
+//                    isRepeat = true;
+//
+//                    // 数量
+//                    BigDecimal bigDecimal = new BigDecimal(x.get("goodsQuantity").toString());
+//                    BigDecimal bigDecimal2 = new BigDecimal(z.get("goodsQuantity").toString());
+//                    z.put("goodsQuantity", bigDecimal.add(bigDecimal2).intValue());
+//
+//                    // 重量
+//                    BigDecimal goodsWeight = new BigDecimal(x.get("goodsWeight").toString());
+//                    BigDecimal goodsWeight2 = new BigDecimal(z.get("goodsWeight").toString());
+//                    z.put("goodsQuantity", goodsWeight.add(goodsWeight2).doubleValue());
+//
+//                    // 入库单号
+//                    String enterCode = z.get("enterCode").toString();
+//                    String enterCode1 = x.get("enterCode").toString();
+//                    z.put("enterCode", enterCode + "," + enterCode1);
+//                }
+//            }
+//
+//            if (isRepeat) {
+//                goodsMapTwo.add(goodsMap.get(i));
+//            }
+//        }
+
+        reqBody.put("skuItems", goodsMap);
+//        reqBody.put("skuItems", goodsMapTwo);
+
+        // 公钥
+        String appKey = "D0fJZ22Gn4BTE7qd";
+        // 请求地址
+        String url = "https://sdpftz-console-test.pub.jdtiot.com/open/wms/receiptDistributeGoodsResult";
+
+        String appSecret = "Qrgx3tn2tGqdIkvwIK0rcdckdYDG3caF";
+
+        String timestamp = String.valueOf(new Date().getTime());
+        String signPlainText = "appKey=" + appKey + "&timestamp=" + timestamp + "&uri=/open/wms/receiptDistributeGoodsResult&appSecret=" + appSecret;
+        Map<String, String> map = new HashMap<>();
+        map.put("appKey", appKey);
+        map.put("timestamp", timestamp);
+        map.put("uri", "/open/wms/receiptDistributeGoodsResult");
+        // 加密
+        String md5Upper = DigestUtils.md5DigestAsHex(signPlainText.getBytes(StandardCharsets.UTF_8));
+        md5Upper = md5Upper.toUpperCase();
+        map.put("sign", md5Upper);
+
+        String str = JsonUtil.toJson(reqBody);
+        JSONObject jsonObject = null;
+        // 发送请求
+        try {
+            System.out.println("=====================发送请求=======================");
+            System.out.println("发送时间:" + new Date());
+            System.out.println("请求url:" + url);
+            System.out.println("sign明文:" + signPlainText);
+            System.out.println("请求头:" + map);
+            System.out.println("请求体:" + str);
+            jsonObject = HttpClientUtils.doPost(url, map, JSONObject.parseObject(str));
+            System.out.println("=====================发送完成=======================");
+        } catch (IOException e) {
+            System.out.println("发送请求失败");
+            throw new RuntimeException(e);
+        }
+        if (jsonObject == null) {
+            return new AjaxResult(400, "没有收到返回值");
+        }
+        System.out.println("msg:" + jsonObject.get("msg"));
+        if (!"OK".equals(jsonObject.get("msg"))) {
+            return new AjaxResult(400, "请求失败");
+        }
+
+        warehouseVO.setFBillstatus("5");
+        warehouseBillsMapper.updateOperationTypeByFid(warehouseVO);
+
+
+        return new AjaxResult(200, "完成");
+    }
+
+    @Autowired
+    private CollateralMapper collateralMapper;
+
+    @Override
+    @Transactional
+    public AjaxResult collateralCargoInformation(AddCollateralGoodsVO vo) {
+        collateralMapper.deleteByPid(vo.getPid());
+        List<CollateralGoodsVO> voList = vo.getList();
+        for (CollateralGoodsVO collateralGoodsVO : voList) {
+            collateralMapper.insetInto(collateralGoodsVO);
+        }
+
+        return new AjaxResult(200, "保存成功");
+    }
+
+    @Override
+    public AjaxResult getCollateralGoodsBypid(String pid) {
+        List<CollateralGoodsVO> collateralGoodsList = collateralMapper.selectByPid(pid);
+//        new ArrayList<>()
+
+        return new AjaxResult(200, "查询成功", collateralGoodsList);
+    }
+
+    @Override
+    public AjaxResult masterSuppressThePreservationOfGoods(TWarehouseBills warehouseBills) {
+        warehouseBillsMapper.foreclosurePreservation(warehouseBills);
+        return new AjaxResult(200, "保存成功");
+    }
+
     /**
      * RSA 签名
      *

+ 92 - 0
ruoyi-warehouse/src/main/resources/mapper/basicData/CollateralMapper.xml

@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.warehouseBusiness.mapper.CollateralMapper">
+
+    <resultMap type="CollateralGoodsVO" id="CollateralGoodsResult">
+        <result property="id"    column="id"    />
+        <result property="fWarehouseNo"    column="f_warehouse_no"    />
+        <result property="goodsId"    column="goods_id"    />
+        <result property="fWarehouseLocationid"    column="f_warehouse_locationid"    />
+        <result property="fCorpid"    column="f_corpid"    />
+        <result property="fGrossweightD"    column="f_grossweight_d"    />
+        <result property="fMblno"    column="f_mblno"    />
+        <result property="parentId"    column="parent_id"    />
+        <result property="fOriginalbilldate"    column="f_originalbilldate"    />
+        <result property="fQtyD"    column="f_qty_d"    />
+        <result property="spu"    column="spu"    />
+        <result property="fOriginalbillno"    column="f_originalbillno"    />
+        <result property="sku"    column="sku"    />
+        <result property="fWarehouseInformation"    column="f_warehouse_information"    />
+        <result property="type"    column="type"    />
+        <result property="remark"    column="remark"    />
+        <result property="pid"    column="pid"    />
+        <result property="fBillno"    column="f_billno"    />
+    </resultMap>
+
+    <insert id="insetInto">
+        insert into collateral_goods
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="fWarehouseNo != null">f_warehouse_no,</if>
+            <if test="goodsId != null">goods_id,</if>
+            <if test="fWarehouseLocationid != null">f_warehouse_locationid,</if>
+            <if test="fCorpid != null">f_corpid,</if>
+            <if test="fGrossweightD != null">f_grossweight_d,</if>
+            <if test="fMblno != null">f_mblno,</if>
+            <if test="parentId != null">parent_id,</if>
+            <if test="fOriginalbilldate != null">f_originalbilldate,</if>
+            <if test="fQtyD != null">f_qty_d,</if>
+            <if test="spu != null">spu,</if>
+            <if test="fOriginalbillno != null">f_originalbillno,</if>
+            <if test="sku != null">sku,</if>
+            <if test="fWarehouseInformation != null">f_warehouse_information,</if>
+            <if test="type != null">type,</if>
+            <if test="remark != null">remark,</if>
+            <if test="pid != null">pid,</if>
+            <if test="fBillno != null">f_billno,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="fWarehouseNo != null">#{fWarehouseNo},</if>
+            <if test="goodsId != null">#{goodsId},</if>
+            <if test="fWarehouseLocationid != null">#{fWarehouseLocationid},</if>
+            <if test="fCorpid != null">#{fCorpid},</if>
+            <if test="fGrossweightD != null">#{fGrossweightD},</if>
+            <if test="fMblno != null">#{fMblno},</if>
+            <if test="parentId != null">#{parentId},</if>
+            <if test="fOriginalbilldate != null">#{fOriginalbilldate},</if>
+            <if test="fQtyD != null">#{fQtyD},</if>
+            <if test="spu != null">#{spu},</if>
+            <if test="fOriginalbillno != null">#{fOriginalbillno},</if>
+            <if test="sku != null">#{sku},</if>
+            <if test="fWarehouseInformation != null">#{fWarehouseInformation},</if>
+            <if test="type != null">#{type},</if>
+            <if test="remark != null">#{remark},</if>
+            <if test="pid != null">#{pid},</if>
+            <if test="fBillno != null">#{fBillno},</if>
+        </trim>
+    </insert>
+    <update id="updateTypeByPid">
+        update collateral_goods set type = #{type} where pid = #{pid}
+    </update>
+    <delete id="deleteByPid">
+        delete from collateral_goods where pid = #{pid}
+    </delete>
+    <select id="selectByPid" resultMap="CollateralGoodsResult">
+        select * from collateral_goods where pid = #{pid}
+    </select>
+    <select id="getListByWarehouseIdAndSpuAndSkuAndClientId"
+            resultType="com.ruoyi.warehouseBusiness.domain.vo.CollateralGoodsVO">
+        select cg.f_grossweight_d fGrossweightD, cg.f_qty_d fQtyD, cg.f_warehouse_information fWarehouseInformation
+        from t_warehousebills tw
+                 inner join skuitem s on tw.f_id = s.pid
+                 inner join collateral_goods cg on s.id = cg.pid
+        where tw.f_billtype = 'DY'
+          and tw.f_corpid = #{fCorpIds}
+          and tw.f_warehouseid = #{fWarehouseId}
+          and cg.spu = #{spu}
+          and cg.sku = #{sku}
+          and cg.type = 2
+          and cg.f_warehouse_information = #{fWarehouseids}
+    </select>
+</mapper>

+ 55 - 0
ruoyi-warehouse/src/main/resources/mapper/basicData/SkuItemMapper.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.warehouseBusiness.mapper.SkuItemMapper">
+
+    <resultMap type="SkuItem" id="SkuItemResult">
+        <result property="id"    column="id"    />
+        <result property="spuId"    column="spu_id"    />
+        <result property="skuId"    column="sku_id"    />
+        <result property="billOfLading"    column="bill_of_lading"    />
+        <result property="goodsWeight"    column="goods_weight"    />
+        <result property="goodsQuantity"    column="goods_quantity"    />
+        <result property="skuName"    column="sku_name"    />
+        <result property="weightUnit"    column="weight_unit"    />
+        <result property="warehouseCode"    column="warehouse_code"    />
+        <result property="warehouseName"    column="warehouse_name"    />
+        <result property="pid"    column="pid"    />
+        <result property="enterCode"    column="enter_code"    />
+    </resultMap>
+    <insert id="insertInto">
+        insert into skuitem
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="spuId != null">spu_id,</if>
+            <if test="skuId != null">sku_id,</if>
+            <if test="billOfLading != null">bill_of_lading,</if>
+            <if test="goodsWeight != null">goods_weight,</if>
+            <if test="goodsQuantity != null">goods_quantity,</if>
+            <if test="skuName != null">sku_name,</if>
+            <if test="weightUnit != null">weight_unit,</if>
+            <if test="warehouseCode != null">warehouse_code,</if>
+            <if test="warehouseName != null">warehouse_name,</if>
+            <if test="pid != null">pid,</if>
+            <if test="enterCode != null">enter_code,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="spuId != null">#{spuId},</if>
+            <if test="skuId != null">#{skuId},</if>
+            <if test="billOfLading != null">#{billOfLading},</if>
+            <if test="goodsWeight != null">#{goodsWeight},</if>
+            <if test="goodsQuantity != null">#{goodsQuantity},</if>
+            <if test="skuName != null">#{skuName},</if>
+            <if test="weightUnit != null">#{weightUnit},</if>
+            <if test="warehouseCode != null">#{warehouseCode},</if>
+            <if test="warehouseName != null">#{warehouseName},</if>
+            <if test="pid != null">#{pid},</if>
+            <if test="enterCode != null">#{enterCode},</if>
+        </trim>
+    </insert>
+    <select id="getByPid" resultMap="SkuItemResult">
+        select * from skuitem where pid = #{id}
+    </select>
+
+
+</mapper>

+ 9 - 0
ruoyi-warehouse/src/main/resources/mapper/basicData/TCorpsMapper.xml

@@ -548,4 +548,13 @@
         and uscc = #{identifier}
         limit 1
     </select>
+    <select id="getOne" parameterType="TCorps" resultMap="TCorpsResult">
+        <include refid="selectTCorpsVo"/>
+        where del_flag = '0'
+        <if test="fId != null and fId != ''">and f_id = #{fId}</if>
+        <if test="creditNum != null and creditNum != ''">and uscc = #{creditNum}</if>
+        <if test="fName != null and fName != ''">and f_name = #{fName}</if>
+        <if test="fNo != null and fNo != ''">and f_no = #{fNo}</if>
+        limit 1
+    </select>
 </mapper>

+ 4 - 0
ruoyi-warehouse/src/main/resources/mapper/basicData/TGoodsMapper.xml

@@ -201,5 +201,9 @@
         <include refid="selectTGoodsVo"/>
         where f_name = #{fName} limit 1
     </select>
+    <select id="getById" parameterType="String" resultMap="TGoodsResult">
+        <include refid="selectTGoodsVo"/>
+        where f_id = #{id}
+    </select>
 
 </mapper>

+ 25 - 2
ruoyi-warehouse/src/main/resources/mapper/basicData/TWarehouseMapper.xml

@@ -397,9 +397,13 @@
             TG.f_packagespecs AS specifications,
             '' AS producing,
             TWG.f_marks AS materialQuality,
-            '' AS LEVEL,
+            '' AS level,
             SUM(TWG.f_qtyD) AS totalQuantity,
             SUM(TWG.f_qtyblc) AS availableQuantity,
+
+            TG.f_no AS goodsCode,
+            TG.f_typeid AS goodsType,
+
             '袋' AS quantityUnit,
             IFNULL( ROUND( SUM(TWG.f_netweightD) / 1000, 2 ), 0 ) AS totalNetWeight,
             IFNULL( ROUND( SUM(TWG.f_netweightblc) / 1000, 2 ), 0 ) AS availableWeight,
@@ -440,10 +444,14 @@
             TC.f_name AS ownerName,
             TC.uscc AS ownerSocialIdentifier,
             TG.f_name AS goodsName,
+
+            TG.f_no AS goodsCode,
+            TG.f_typeid AS goodsType,
+
             TG.f_packagespecs AS specifications,
             '' AS producing,
             TWG.f_marks AS materialQuality,
-            '' AS LEVEL,
+            '' AS level,
             TWG.f_qtyD AS totalQuantity,
             TWG.f_qtyblc AS availableQuantity,
             '袋' AS quantityUnit,
@@ -988,4 +996,19 @@
 
         </where>
     </select>
+    <select id="getOne" resultType="TWarehouse" resultMap="TWarehouseResult">
+        <include refid="selectTWarehouseVo"/>
+        <where>
+            <if test="fNo != null and fNo != ''">and f_no = #{fNo}</if>
+            <if test="fId != null and fId != ''">and f_id = #{fId}</if>
+            <if test="parentId != null and parentId != ''">and parent_id = #{parentId}</if>
+
+        </where>
+    </select>
+    <select id="getWarehouseByFNo" parameterType="String" resultMap="TWarehouseResult">
+        <include refid="selectTWarehouseVo"/>
+        <where>
+            f_no = #{fNo} and del_flag = '0' limit 1
+        </where>
+    </select>
 </mapper>

+ 213 - 0
ruoyi-warehouse/src/main/resources/mapper/reportManagement/TWhgenlegMapper.xml

@@ -164,6 +164,25 @@
         </where>
     </select>
 
+
+    <select id="selectTWhgenlegV2" parameterType="TWhgenleg" resultMap="TWhgenlegResult">
+        <include refid="selectTWhgenlegVo"/>
+        <where>
+            del_flag = '0'
+            <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null ">and f_shipper = #{fShipper}</if>
+            <if test="fMblno != null ">and f_mblno = #{fMblno}</if>
+            <if test="fCntrno != null ">and f_cntrno = #{fCntrno}</if>
+            <if test="fBusinessType != null ">and f_business_type = #{fBusinessType}</if>
+            <if test="fMarks != null ">and f_marks = #{fMarks}</if>
+            <if test="fBsdate != null ">and f_bsdate = date_format(#{fBsdate},'%Y-%m-%d')</if>
+            <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
+            <if test="fWarehouseLocationid != null ">and f_warehouse_locationid = #{fWarehouseLocationid}</if>
+            <if test="fGoodsid != null ">and f_goodsid = #{fGoodsid}</if>
+            <if test="fTrademodeid != null ">and f_trademodeid = #{fTrademodeid}</if>
+        </where>
+    </select>
+
 <!--
     <select id="selectTWhgenleg" parameterType="TWhgenleg" resultMap="TWhgenlegResult">
         <include refid="selectTWhgenlegVo"/>
@@ -728,6 +747,9 @@
             leg.f_localcntrno AS fLocalcntrno,
             dict.dict_label AS fBusinessTypes,
             leg.f_marks AS fMarks,
+            goods.f_no AS sku,
+            goods.f_typeid AS spu,
+            leg.f_warehouseid AS fWarehouseId,
             DATE_FORMAT( leg.create_time, '%Y-%m-%d' ) AS createTime,
             DATE_FORMAT( leg.f_originalbilldate, '%Y-%m-%d' ) AS fOriginalbilldate,
             leg.f_cntrno AS fCntrno
@@ -751,6 +773,8 @@
             AND leg.f_grossweightblc &gt; 0
             AND leg.f_netweightblc &gt; 0
             <if test="fOriginalbillno != null  and fOriginalbillno != ''">and leg.f_originalbillno = #{fOriginalbillno}</if>
+            <if test="lockStatus == null or lockStatus == ''">and leg.lock_status != 1</if>
+            <if test="warehouseInformation != null  and warehouseInformation != ''">and ware.f_warehouse_information = #{warehouseInformation}</if>
             <if test="fPreqty != null ">and leg.f_preqty = #{fPreqty}</if>
             <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
             <if test="fShipper != null and fShipper != ''">and leg.f_shipper like concat('%', #{fShipper}, '%')</if>
@@ -904,6 +928,113 @@
         order by leg.f_bsdate desc
     </select>
 
+    <select id="selectInventoryMapListV2" parameterType="TWhgenleg" resultType="Map">
+        select
+        DISTINCT
+
+        # 总数
+        SUM(leg.f_qtyD) AS fQtyD,
+        # 毛重
+        SUM(leg.f_grossweightD) AS fGrossweightD,
+        # 客户id
+        corp.f_id as fCorpid,
+        # 商品
+        goods.f_no AS sku,
+        goods.f_typeid AS spu,
+        goods.f_id as goodsId,
+        # 仓库编号
+        ware.f_no as fWarehouseNo,
+        # 提单号
+        leg.f_mblno as fMblno,
+
+        # 库位
+        ware.f_warehouse_information as fWarehouseInformation,
+
+        leg.f_originalbillno as fOriginalbillno,
+
+        # 库位id
+        leg.f_warehouse_locationid as fWarehouseLocationid,
+        # 库区id
+        ware.parent_id as parentId,
+
+        # 原始入库业务单号
+        leg.f_originalbillno as fBillno,
+
+        # 入库日期
+        DATE_FORMAT( leg.f_originalbilldate, '%Y-%m-%d' ) AS fOriginalbilldate
+
+        FROM
+        t_whgenleg leg
+        left join sys_user u on leg.create_by = u.user_name
+        left join sys_user u1 on leg.create_by = u1.user_name
+        left join sys_dept d on u.dept_id = d.dept_id
+        LEFT JOIN t_corps corp ON corp.f_id = leg.f_corpid
+        LEFT JOIN t_customer_contact tc ON tc.f_pid = corp.f_id
+        LEFT JOIN t_goods goods ON goods.f_id = leg.f_goodsid
+        <if test="isCntrno != 2 ">LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouse_locationid</if>
+        <if test="isCntrno == 2 ">LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouseid</if>
+        LEFT JOIN sys_dict_data dict ON dict.dict_value = leg.f_business_type
+        LEFT JOIN t_warehouse_area area ON area.f_id = leg.f_warehouse_locationid
+        LEFT JOIN sys_dict_data dict1 ON dict1.dict_value = leg.f_trademodeid
+        <where>
+            dict.status = '0'
+            AND dict1.status = '0'
+            AND leg.f_qtyD != 0
+            <if test="isMblno != null and isMblno == 0 ">
+                AND leg.f_qtyblc != 0
+                AND leg.f_grossweightblc != 0
+                AND leg.f_netweightblc != 0
+            </if>
+            AND dict.dict_type = 'storage_type'
+            AND dict1.dict_type = 'data_trademodes'
+            <if test="sku != null and sku != ''">and goods.f_no = #{sku}</if>
+            <if test="spu != null and spu != ''">and goods.f_typeid = #{spu}</if>
+            <if test="warehouseNo != null and warehouseNo != ''">and ware.f_no = #{warehouseNo}</if>
+            <if test="customerId != null and customerId != ''">and corp.f_id = #{customerId}</if>
+            <if test="fOriginalbillno != null  and fOriginalbillno != ''">and leg.f_originalbillno = #{fOriginalbillno}</if>
+            <if test="fTel != null  and fTel != ''">and tc.f_tel = #{fTel}</if>
+            <if test="fPreqty != null ">and leg.f_preqty = #{fPreqty}</if>
+            <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null and fShipper != ''">and leg.f_shipper like concat('%', #{fShipper}, '%')</if>
+            <if test="fMblno != null ">and leg.f_mblno LIKE  concat('%', #{fMblno}, '%') </if>
+            <if test='orgStorageDate != null and orgStorageDate[0] != null and orgStorageDate[0]!= ""'>and leg.f_originalbilldate &gt;= #{orgStorageDate[0]}</if>
+            <if test='orgStorageDate != null and orgStorageDate[1] != null and orgStorageDate[1]!= ""'>and leg.f_originalbilldate &lt;= #{orgStorageDate[1]}</if>
+            <if test="fPregrossweight != null ">and leg.f_pregrossweight = #{fPregrossweight}</if>
+            <if test="fPrenetweight != null ">and leg.f_prenetweight = #{fPrenetweight}</if>
+            <if test="fQtyd != null ">and leg.f_qtyD = #{fQtyd}</if>
+            <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
+            <if test="fGoodsid != null ">and leg.f_goodsid = #{fGoodsid}</if>
+            <if test="fVolumnd != null ">and leg.f_volumnD = #{fVolumnd}</if>
+            <if test="fGrossweightd != null ">and leg.f_grossweightD = #{fGrossweightd}</if>
+            <if test="fNetweightd != null ">and leg.f_netweightD = #{fNetweightd}</if>
+            <if test="fVolumnc != null ">and leg.f_volumnC = #{fVolumnc}</if>
+            <if test="fQtyc != null ">and leg.f_qtyC = #{fQtyc}</if>
+            <if test="fOriginalbilldate != null ">and leg.f_originalbilldate = #{fOriginalbilldate}</if>
+            <if test="fMarks != null  and fMarks != ''">and leg.f_marks LIKE  concat('%', #{fMarks}, '%')</if>
+            <if test="fQtyblc != null ">and leg.f_qtyblc = #{fQtyblc}</if>
+            <if test="fGrossweightc != null ">and leg.f_grossweightC = #{fGrossweightc}</if>
+            <if test="fNetweightc != null ">and leg.f_netweightC = #{fNetweightc}</if>
+            <if test="fGrossweightblc != null ">and leg.f_grossweightblc = #{fGrossweightblc}</if>
+            <if test="fNetweightblc != null ">and leg.f_netweightblc = #{fNetweightblc}</if>
+            <if test="fStatus != null  and fStatus != ''">and leg.f_status = #{fStatus}</if>
+            <if test="fWarehouseid != null ">and leg.f_warehouseid = #{fWarehouseid} </if>
+            <if test="fLocation != null and fLocation ==1 ">and leg.f_warehouse_locationid = #{fWarehouseLocationid}</if>
+            <if test="checklists != null and checklists !='' ">and leg.checklists = #{checklists}</if>
+            <if test="fCntrno != null  and fCntrno != ''">and leg.f_cntrno  LIKE  concat('%', #{fCntrno}, '%')</if>
+            <if test="fLocalcntrno != null  and fLocalcntrno != ''">and leg.f_localcntrno  LIKE  concat('%', #{fLocalcntrno}, '%')</if>
+            <if test="fLocation != null  and fLocation ==0 ">and ware.ancestors  LIKE  concat('%', #{fWarehouseLocationid}, '%')</if>
+            <if test="isCntrno == null">
+                GROUP BY leg.f_corpid, leg.f_originalbillno, leg.f_originalbilldate, leg.f_warehouse_locationid, leg.f_goodsid, leg.f_trademodeid,leg.f_marks
+            </if>
+            <if test="isCntrno == 1 ">
+                GROUP BY leg.f_corpid, leg.f_originalbillno, leg.f_originalbilldate, leg.f_warehouse_locationid, leg.f_goodsid, leg.f_trademodeid,leg.f_cntrno,leg.f_marks
+            </if>
+            <if test="isCntrno == 2 ">GROUP BY leg.f_corpid, leg.f_mblno, leg.f_goodsid, leg.f_warehouseid,leg.f_marks</if>
+        </where>
+        ${params.dataScope}
+        order by leg.f_bsdate desc
+    </select>
+
     <select id="selectAppInventoryMapList" parameterType="TWhgenleg" resultType="Map">
         select
         DISTINCT
@@ -1637,6 +1768,76 @@
             <if test="fMblno != null and fMblno != ''"> AND t1.f_mblno = #{fMblno}</if>
         </where>
     </select>
+    <select id="getDistributionlList" parameterType="WarehouseVO" resultType="Map">
+        select
+        DISTINCT
+        leg.f_id AS fId,
+        leg.f_corpid AS fCorpIds,
+        leg.f_bsdate AS fBsdate,
+        corp.f_name AS fCorpid,
+        leg.f_shipper AS fShipper,
+        ware.f_warehouse_information AS fWarehouseids,
+        area.f_name AS fWarehouseLocationids,
+        leg.f_originalbillno AS fOriginalbillno,
+        leg.f_warehouse_locationid AS fWarehouseLocationid,
+        dict1.dict_label AS fTrademodeid,
+        goods.f_name AS fGoodsids,
+        leg.f_trademodeid AS fTrademodeids,
+        goods.f_packagespecs AS fPackagespecs,
+        leg.f_goodsid AS fGoodsid,
+        leg.f_volumnD AS fVolumnD,
+        leg.f_qtyD AS fQtyD,
+        leg.f_mblno AS fMblno,
+        leg.f_grossweightD AS fGrossweightD,
+        leg.f_netweightD AS fNetweightD,
+        leg.f_volumnC AS fVolumnC,
+        leg.f_volumnblc AS fVolumnblc,
+        leg.f_qtyC AS fQtyC,
+        leg.f_business_type AS fBusinessType,
+        leg.f_grossweightC AS fGrossweightC,
+        leg.f_netweightC AS fNetweightC,
+        leg.f_qtyblc AS fQtyblc,
+        leg.f_billingway AS fBillingway,
+        leg.f_chargedate AS fChargedate,
+        leg.f_grossweightblc AS fGrossweightblc,
+        leg.f_netweightblc AS fNetweightblc,
+        leg.f_localcntrno AS fLocalcntrno,
+        dict.dict_label AS fBusinessTypes,
+        leg.f_marks AS fMarks,
+        DATE_FORMAT( leg.create_time, '%Y-%m-%d' ) AS createTime,
+        DATE_FORMAT( leg.f_originalbilldate, '%Y-%m-%d' ) AS fOriginalbilldate,
+        leg.f_cntrno AS fCntrno
+        FROM
+        t_whgenleg leg
+        left join sys_user u on leg.create_by = u.user_name
+        left join sys_dept d on u.dept_id = d.dept_id
+        LEFT JOIN t_corps corp ON corp.f_id = leg.f_corpid
+        LEFT JOIN t_goods goods ON goods.f_id = leg.f_goodsid
+        LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouse_locationid
+        LEFT JOIN sys_dict_data dict ON dict.dict_value = leg.f_business_type
+        LEFT JOIN t_warehouse_area area ON area.f_id = leg.f_warehouse_locationid
+        LEFT JOIN sys_dict_data dict1 ON dict1.dict_value = leg.f_trademodeid
+        <where>
+            dict.status = '0'
+            AND dict1.status = '0'
+            AND dict.dict_type = 'storage_type'
+            AND dict1.dict_type = 'data_trademodes'
+            AND leg.f_qtyD != 0
+            AND leg.f_qtyblc &gt; 0
+            AND leg.f_grossweightblc &gt; 0
+            AND leg.f_netweightblc &gt; 0
+
+            # 仓库id
+            <if test="fWarehouseid != null ">and leg.f_warehouseid = #{fWarehouseid}</if>
+            # 货物信息
+            <if test="spuId != null ">and goods.spu = #{spuId}</if>
+            <if test="skuId != null ">and goods.sku = #{skuId}</if>
+            # 货主
+            <if test="ownerId != null ">and leg.f_corpid = #{ownerId}</if>
+            # 提单号
+            <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
+        </where>
+    </select>
     <update id="changeBelongTo" parameterType="TWhgenleg">
         update t_whgenleg
         <trim prefix="SET" suffixOverrides=",">
@@ -1649,4 +1850,16 @@
         </trim>
         where f_mblno = #{fOriginalbillno}
     </update>
+    <update id="lockTheGoods">
+        update t_whgenleg
+        set lock_status = 1,
+            lock_time = now()
+            where f_id = #{fId}
+    </update>
+    <update id="unlock">
+        update t_whgenleg
+        set lock_status = 0,
+            unlock_time = now()
+            where f_id = #{fId}
+    </update>
 </mapper>

+ 96 - 1
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -139,6 +139,26 @@
         <result property="documentSummary" column="document_summary"    />
         <result property="financialBillType" column="financial_bill_type"   />
         <result property="checklists" column="checklists"   />
+        <result property="businessCode" column="business_code"   />
+        <result property="serialNumber" column="serial_number"   />
+        <result property="receiptApplyCode" column="receipt_apply_code"   />
+
+        <result property="storageName" column="storage_name"   />
+        <result property="storageContractCode" column="storage_contract_code"   />
+        <result property="storageContractStart" column="storage_contract_start"   />
+        <result property="storageContractEnd" column="storage_contract_end"   />
+        <result property="storageRate" column="storage_rate"   />
+        <result property="storagePayTime" column="storage_pay_time"   />
+        <result property="insuranceCode" column="insurance_code"   />
+        <result property="insuranceAmount" column="insurance_amount"   />
+        <result property="insuranceStartTime" column="insurance_start_time"   />
+        <result property="insuranceEndTime" column="insurance_end_time"   />
+        <result property="insurer" column="insurer"   />
+        <result property="inventory" column="inventory"   />
+        <result property="operator" column="operator"   />
+        <result property="auditor" column="auditor"   />
+        <result property="operationType" column="operation_type"   />
+        <result property="receiptCode" column="receipt_code"   />
     </resultMap>
 
     <resultMap type="WarehouseBillsVO" id="WarehousebillsVOResult">
@@ -164,7 +184,10 @@
         f_ifsampling, send_sample_date, f_ifweight_recovery, weight_recovery_date, warehouse_status, f_times ,f_date_changed, f_chargetype,f_weigh_weight,
         f_predict_branch,f_grade,f_delivery_details,f_salesman_id,f_itemstatus,f_updete_status, f_submit_update, f_delete_status,f_remarks_fees,f_cargo_planning,
         f_arrival_status,f_dismount_status,f_serviceitems_new,f_receivable,f_recycle,f_due,f_pay,f_carego_status, f_ship_two, f_voy_two, pick_up_person, pick_up_time, facility_person, facility_time,is_pledge,
-        document_summary,financial_bill_type,checklists from t_warehousebills
+        document_summary,financial_bill_type,checklists, business_code, serial_number, receipt_apply_code, operation_type,
+               storage_name, storage_contract_code, storage_contract_start, storage_contract_end, storage_rate, storage_pay_time,
+               insurance_code, insurance_amount, insurance_start_time, insurance_end_time, insurer, inventory, operator,
+               auditor, receipt_code from t_warehousebills
     </sql>
 
     <select id="selectTWarehousebillsList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
@@ -1151,6 +1174,9 @@
     <insert id="insertTWarehousebills" parameterType="TWarehousebills" useGeneratedKeys="true" keyProperty="fId">
         insert into t_warehousebills
         <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="businessCode != null">business_code,</if>
+            <if test="serialNumber != null">serial_number,</if>
+            <if test="receiptApplyCode != null">receipt_apply_code,</if>
             <if test="fBillno != null">f_billno,</if>
             <if test="fCustomsdeclartion != null">f_customsdeclartion,</if>
             <if test="fOriginalbillno != null">f_originalbillno,</if>
@@ -1286,6 +1312,9 @@
             <if test="checklists != null and checklists != ''">checklists,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="businessCode != null">#{businessCode},</if>
+            <if test="serialNumber != null">#{serialNumber},</if>
+            <if test="receiptApplyCode != null">#{receiptApplyCode},</if>
             <if test="fBillno != null">#{fBillno},</if>
             <if test="fCustomsdeclartion != null">#{fCustomsdeclartion},</if>
             <if test="fOriginalbillno != null">#{fOriginalbillno},</if>
@@ -3468,6 +3497,55 @@
             #{fId}
         </foreach>
     </update>
+    <update id="updateBillstatusOfWarehouseById">
+        UPDATE t_warehousebills
+        SET f_billstatus=2
+        where
+                <if test="receiptId != null and receiptId != ''">f_id = #{receiptId}</if>
+    </update>
+    <update id="receiptApplySuccess">
+        UPDATE t_warehousebills
+        SET f_billstatus=3, receipt_code = #{receiptCode}
+        WHERE f_id = #{receiptId}
+    </update>
+    <update id="receiptApplySuccessFail">
+        UPDATE t_warehousebills
+        SET f_billstatus=4, receipt_code = #{receiptCode}
+        WHERE f_id = #{receiptId}
+    </update>
+    <update id="foreclosurePreservation">
+        update t_warehousebills
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="storageName != null">storage_name = #{storageName},</if>
+            <if test="storageContractCode != null">storage_contract_code = #{storageContractCode},</if>
+            <if test="storageContractStart != null">storage_contract_start = #{storageContractStart},</if>
+            <if test="storageContractEnd != null">storage_contract_end = #{storageContractEnd},</if>
+            <if test="storageRate != null">storage_rate = #{storageRate},</if>
+            <if test="storagePayTime != null">storage_pay_time = #{storagePayTime},</if>
+            <if test="insuranceCode != null">insurance_code = #{insuranceCode},</if>
+            <if test="insuranceAmount != null">insurance_amount = #{insuranceAmount},</if>
+            <if test="insuranceStartTime != null">insurance_start_time = #{insuranceStartTime},</if>
+            <if test="insuranceEndTime != null">insurance_end_time = #{insuranceEndTime},</if>
+            <if test="insurer != null">insurer = #{insurer},</if>
+            <if test="inventory != null">inventory = #{inventory},</if>
+            <if test="operator != null">operator = #{operator},</if>
+            <if test="auditor != null">auditor = #{auditor},</if>
+            <if test="operationType != null">operation_type = #{operationType},</if>
+            <if test="operationType != null">operation_type = #{operationType},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where f_id = #{fId}
+    </update>
+    <update id="updateOperationTypeByFid">
+        update t_warehousebills
+        set operation_type = #{operationType}, f_billstatus = #{fBillstatus}
+        where f_id = #{fId}
+    </update>
+    <update id="unstake">
+        update t_warehousebills
+        set f_billstatus = 7
+        where f_id = #{fId}
+    </update>
 
     <!--凯和单航次配船-->
     <select id="singleVoyageByShip" parameterType="TWarehousebills" resultType="com.ruoyi.shipping.excel.SingleVoyageByShipExcel">
@@ -3687,4 +3765,21 @@
            del_flag = '0'
           and f_billno = #{originalBillNo}
     </select>
+    <select id="mortgageList" parameterType="TWarehouseBills" resultMap="TWarehousebillsResult" >
+        <include refid="selectTWarehousebillsVo"></include>
+        <where>
+            and del_flag = '0'
+            and f_billtype = 'DY'
+            <if test="receiptApplyCode != null and receiptApplyCode != ''">and receipt_apply_code like concat('%', #{receiptApplyCode}, '%')</if>
+        </where>
+        order by create_time desc
+    </select>
+    <select id="mortgageDetail" resultMap="TWarehousebillsResult">
+        <include refid="selectTWarehousebillsVo"></include>
+        where f_id = #{id}
+    </select>
+    <select id="getByReceiptCode" resultMap="TWarehousebillsResult">
+        <include refid="selectTWarehousebillsVo"></include>
+        where receipt_code = #{receiptCode}
+    </select>
 </mapper>