Browse Source

转箱问题处理

yzc 1 year ago
parent
commit
49f6667a7a

+ 1 - 1
hx-sale/src/main/java/com/fjhx/sale/service/documents/impl/DocumentsPdfServiceImpl.java

@@ -83,7 +83,7 @@ public class DocumentsPdfServiceImpl extends ServiceImpl<DocumentsPdfMapper, Doc
             }
             }
             //查询报关单里的运输备注
             //查询报关单里的运输备注
             DocumentsPdf data = this.getOne(Wrappers.<DocumentsPdf>query().lambda().eq(DocumentsPdf::getDocumentId, id).eq(DocumentsPdf::getDataType, 0));
             DocumentsPdf data = this.getOne(Wrappers.<DocumentsPdf>query().lambda().eq(DocumentsPdf::getDocumentId, id).eq(DocumentsPdf::getDataType, 0));
-            String dataJson = ObjectUtil.isEmpty(data)?"":data.getContent();
+            String dataJson = ObjectUtil.isEmpty(data) ? "{}" : data.getContent();
             JSONObject jsonObject = JSONObject.parseObject(dataJson);
             JSONObject jsonObject = JSONObject.parseObject(dataJson);
             map.put("customerCode", documentsProduct.getCustomsCode());
             map.put("customerCode", documentsProduct.getCustomsCode());
             map.put("productName", StringUtils.equals(documentsProduct.getSubDescribe(), "无") ? documentsProduct.getDescribes() : documentsProduct.getSubDescribe());
             map.put("productName", StringUtils.equals(documentsProduct.getSubDescribe(), "无") ? documentsProduct.getDescribes() : documentsProduct.getSubDescribe());

+ 9 - 4
hx-sale/src/main/java/com/fjhx/sale/service/documents/impl/DocumentsServiceImpl.java

@@ -250,11 +250,16 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
             for (PackDetail p : packDetailList) {
             for (PackDetail p : packDetailList) {
                 p.setPackDetailGoodsList(packGoodMap.getOrDefault(p.getId(), null));
                 p.setPackDetailGoodsList(packGoodMap.getOrDefault(p.getId(), null));
                 p.setDocumentsProductList(docuProductMap.getOrDefault(p.getId(), null));
                 p.setDocumentsProductList(docuProductMap.getOrDefault(p.getId(), null));
+
+                sumPackQuantity = sumPackQuantity.add(p.getPackQuantity());
+                sumRoughWeight = sumRoughWeight.add(p.getRoughWeight().multiply(p.getPackQuantity()));
+                sumNetWeight = sumNetWeight.add(p.getNetWeight().multiply(p.getPackQuantity()));
+                sumBomVolume = sumBomVolume.add(p.getBomVolume().multiply(p.getPackQuantity()));
             }
             }
-            sumPackQuantity = packDetailList.stream().map(PackDetail::getPackQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
-            sumRoughWeight = packDetailList.stream().map(PackDetail::getRoughWeight).reduce(BigDecimal.ZERO, BigDecimal::add);
-            sumNetWeight = packDetailList.stream().map(PackDetail::getNetWeight).reduce(BigDecimal.ZERO, BigDecimal::add);
-            sumBomVolume = packDetailList.stream().map(PackDetail::getBomVolume).reduce(BigDecimal.ZERO, BigDecimal::add);
+//            sumPackQuantity = packDetailList.stream().map(PackDetail::getPackQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
+//            sumRoughWeight = packDetailList.stream().map(PackDetail::getRoughWeight).reduce(BigDecimal.ZERO, BigDecimal::add);
+//            sumNetWeight = packDetailList.stream().map(PackDetail::getNetWeight).reduce(BigDecimal.ZERO, BigDecimal::add);
+//            sumBomVolume = packDetailList.stream().map(PackDetail::getBomVolume).reduce(BigDecimal.ZERO, BigDecimal::add);
 
 
             //查询收费项目
             //查询收费项目
             String packDetailId = Arrays.asList(packShipment.getPackDetailIds().split(",")).get(0);
             String packDetailId = Arrays.asList(packShipment.getPackDetailIds().split(",")).get(0);

+ 18 - 7
hx-sale/src/main/java/com/fjhx/sale/service/pack/impl/PackShipmentServiceImpl.java

@@ -17,14 +17,15 @@ import com.fjhx.sale.mapper.pack.PackShipmentMapper;
 import com.fjhx.sale.service.documents.DocumentsService;
 import com.fjhx.sale.service.documents.DocumentsService;
 import com.fjhx.sale.service.pack.PackDetailGoodsService;
 import com.fjhx.sale.service.pack.PackDetailGoodsService;
 import com.fjhx.sale.service.pack.PackDetailProductService;
 import com.fjhx.sale.service.pack.PackDetailProductService;
+import com.fjhx.sale.service.pack.PackDetailService;
 import com.fjhx.sale.service.pack.PackShipmentService;
 import com.fjhx.sale.service.pack.PackShipmentService;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.math.BigDecimal;
 import java.util.*;
 import java.util.*;
-import java.util.stream.Collectors;
 
 
 
 
 /**
 /**
@@ -46,6 +47,9 @@ public class PackShipmentServiceImpl extends ServiceImpl<PackShipmentMapper, Pac
     @Autowired
     @Autowired
     private DocumentsService documentsService;
     private DocumentsService documentsService;
 
 
+    @Autowired
+    private PackDetailService packDetailService;
+
     @Override
     @Override
     public Page<PackShipmentVo> getPage(PackShipmentSelectDto dto) {
     public Page<PackShipmentVo> getPage(PackShipmentSelectDto dto) {
         IWrapper<PackShipment> wrapper = getWrapper();
         IWrapper<PackShipment> wrapper = getWrapper();
@@ -108,20 +112,27 @@ public class PackShipmentServiceImpl extends ServiceImpl<PackShipmentMapper, Pac
         //获取到包装明细单ID列表
         //获取到包装明细单ID列表
         List<String> ids = Arrays.asList(packDetailIds.split(","));
         List<String> ids = Arrays.asList(packDetailIds.split(","));
         for(String id : ids){
         for(String id : ids){
-            List<PackDetailGoods> goodsList = packDetailGoodsService.list(Wrappers.<PackDetailGoods>query().lambda().eq(PackDetailGoods::getPackDetailId,id));
+            PackDetail packDetail = packDetailService.getById(id);
+            List<PackDetailGoods> goodsList = packDetailGoodsService.list(Wrappers.<PackDetailGoods>query().lambda().eq(PackDetailGoods::getPackDetailId, id));
             if(CollectionUtils.isNotEmpty(goodsList)){
             if(CollectionUtils.isNotEmpty(goodsList)){
                 //添加货物
                 //添加货物
                 for(PackDetailGoods p : goodsList){
                 for(PackDetailGoods p : goodsList){
                     Map<String,Object> map = new HashMap<>();
                     Map<String,Object> map = new HashMap<>();
                     map.put("businessId",p.getId());
                     map.put("businessId",p.getId());
-                    map.put("price",0);
-                    map.put("quantity",p.getQuantity());
-                    map.put("subDescription",p.getRemark());
+                    map.put("price", 0);
+                    map.put("quantity", p.getQuantity().multiply(packDetail.getPackQuantity()));
+                    map.put("subDescription", p.getRemark());
                     map.put("type","20");
                     map.put("type","20");
                     list.add(map);
                     list.add(map);
                 }
                 }
-            }else{
-                List<Map<String,Object>> productList = baseMapper.productDetailList(Arrays.asList(id));
+            }else {
+                List<Map<String, Object>> productList = baseMapper.productDetailList(Arrays.asList(id));
+                if (ObjectUtil.isNotEmpty(productList)) {
+                    for (Map<String, Object> p : productList) {
+                        String quantity = p.get("quantity").toString();
+                        p.put("quantity", new BigDecimal(quantity).multiply(packDetail.getPackQuantity()));
+                    }
+                }
                 list.addAll(productList);
                 list.addAll(productList);
             }
             }
         }
         }

+ 8 - 8
hx-sale/src/main/resources/mapper/pack/PackShipmentMapper.xml

@@ -24,14 +24,14 @@
     </select>
     </select>
     <select id="productDetailList" resultType="java.util.Map">
     <select id="productDetailList" resultType="java.util.Map">
         SELECT
         SELECT
-            pack_detail_id AS packDetailId,
-            dg.id AS businessId,
-            json_unquote( pi.standard_json -> '$.englishName' ) remark,
-            dg.product_name AS subDescription,
-            json_unquote ( pi.standard_json -> '$.customsCode' ) AS customsCode,
-            dg.quantity,
-            cp.price AS price,
-            20 AS type
+        pack_detail_id AS packDetailId,
+        dg.id AS businessId,
+        cp.product_name remark,
+        dg.product_name AS subDescription,
+        json_unquote ( pi.standard_json -> '$.customsCode' ) AS customsCode,
+        dg.quantity,
+        cp.price AS price,
+        20 AS type
         FROM
         FROM
         pack_detail_product dg
         pack_detail_product dg
         LEFT JOIN bytesailing_item.product_info pi ON dg.product_id = pi.id
         LEFT JOIN bytesailing_item.product_info pi ON dg.product_id = pi.id