feat(wms): 增加根据实际库区查询钢卷分布的接口及相关字段
This commit is contained in:
@@ -158,5 +158,17 @@ public class WmsMaterialCoilController extends BaseController {
|
|||||||
List<WmsMaterialCoilVo> distribution = iWmsMaterialCoilService.getDistributionByItemType(itemType, itemId);
|
List<WmsMaterialCoilVo> distribution = iWmsMaterialCoilService.getDistributionByItemType(itemType, itemId);
|
||||||
return R.ok(distribution);
|
return R.ok(distribution);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询不同类型的钢卷在不同库区的分布情况
|
||||||
|
* 按物品类型和物品ID分组,统计每个库区的钢卷数量和重量
|
||||||
|
*/
|
||||||
|
@GetMapping("/distributionByActualItemType")
|
||||||
|
public R<List<WmsMaterialCoilVo>> getDistributionByActualItemType(
|
||||||
|
@RequestParam(required = false) String itemType,
|
||||||
|
@RequestParam(required = false) Long itemId) {
|
||||||
|
List<WmsMaterialCoilVo> distribution = iWmsMaterialCoilService.getDistributionByActualItemType(itemType, itemId);
|
||||||
|
return R.ok(distribution);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -288,5 +288,11 @@ public class WmsMaterialCoilVo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Long productBomId;
|
private Long productBomId;
|
||||||
|
|
||||||
|
private String specification; // 规格
|
||||||
|
private String material; // 材质
|
||||||
|
private String surfaceTreatmentDesc; // 表面处理
|
||||||
|
private String zincLayer; // 锌层
|
||||||
|
private String manufacturer; // 厂家
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,5 +43,7 @@ public interface WmsMaterialCoilMapper extends BaseMapperPlus<WmsMaterialCoilMap
|
|||||||
List<WmsMaterialCoilVo> selectVoListWithDynamicJoin(@Param("ew")QueryWrapper<WmsMaterialCoil> lqw);
|
List<WmsMaterialCoilVo> selectVoListWithDynamicJoin(@Param("ew")QueryWrapper<WmsMaterialCoil> lqw);
|
||||||
|
|
||||||
List<Map<String, Object>> getDistributionByActualWarehouse(@Param("itemType") String itemType, @Param("itemId") Long itemId);
|
List<Map<String, Object>> getDistributionByActualWarehouse(@Param("itemType") String itemType, @Param("itemId") Long itemId);
|
||||||
|
|
||||||
|
List<Map<String, Object>> getDistributionByActualItemType(@Param("itemType")String itemType,@Param("itemId") Long itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,5 +86,7 @@ public interface IWmsMaterialCoilService {
|
|||||||
List<WmsMaterialCoilVo> getDistributionByItemType(String itemType, Long itemId);
|
List<WmsMaterialCoilVo> getDistributionByItemType(String itemType, Long itemId);
|
||||||
|
|
||||||
List<WmsMaterialCoilVo> getDistributionByActualWarehouse(String itemType, Long itemId);
|
List<WmsMaterialCoilVo> getDistributionByActualWarehouse(String itemType, Long itemId);
|
||||||
|
|
||||||
|
List<WmsMaterialCoilVo> getDistributionByActualItemType(String itemType, Long itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,14 +39,8 @@ import com.klp.domain.vo.WmsActualWarehouseVo;
|
|||||||
import com.klp.domain.vo.WmsProductVo;
|
import com.klp.domain.vo.WmsProductVo;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1472,6 +1466,9 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
List<Map<String, Object>> mapList = baseMapper.getDistributionByActualWarehouse(itemType, itemId);
|
List<Map<String, Object>> mapList = baseMapper.getDistributionByActualWarehouse(itemType, itemId);
|
||||||
return convertMapListToVoListActual(mapList);
|
return convertMapListToVoListActual(mapList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private List<WmsMaterialCoilVo> convertMapListToVoListActual(List<Map<String, Object>> mapList) {
|
private List<WmsMaterialCoilVo> convertMapListToVoListActual(List<Map<String, Object>> mapList) {
|
||||||
List<WmsMaterialCoilVo> voList = new ArrayList<>();
|
List<WmsMaterialCoilVo> voList = new ArrayList<>();
|
||||||
for (Map<String, Object> map : mapList) {
|
for (Map<String, Object> map : mapList) {
|
||||||
@@ -1483,6 +1480,13 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
vo.setCoilCount(map.get("coil_count") != null ? Long.valueOf(map.get("coil_count").toString()) : 0L);
|
vo.setCoilCount(map.get("coil_count") != null ? Long.valueOf(map.get("coil_count").toString()) : 0L);
|
||||||
vo.setTotalGrossWeight(map.get("total_gross_weight") != null ? new BigDecimal(map.get("total_gross_weight").toString()) : BigDecimal.ZERO);
|
vo.setTotalGrossWeight(map.get("total_gross_weight") != null ? new BigDecimal(map.get("total_gross_weight").toString()) : BigDecimal.ZERO);
|
||||||
vo.setTotalNetWeight(map.get("total_net_weight") != null ? new BigDecimal(map.get("total_net_weight").toString()) : BigDecimal.ZERO);
|
vo.setTotalNetWeight(map.get("total_net_weight") != null ? new BigDecimal(map.get("total_net_weight").toString()) : BigDecimal.ZERO);
|
||||||
|
vo.setItemName(map.get("itemName") != null ? map.get("itemName").toString() : null);
|
||||||
|
vo.setItemCode(map.get("itemCode") != null ? map.get("itemCode").toString() : null);
|
||||||
|
vo.setSpecification(map.get("specification") != null ? map.get("specification").toString() : null);
|
||||||
|
vo.setMaterial(map.get("material") != null ? map.get("material").toString() : null);
|
||||||
|
vo.setSurfaceTreatmentDesc(map.get("surfaceTreatmentDesc") != null ? map.get("surfaceTreatmentDesc").toString() : null);
|
||||||
|
vo.setZincLayer(map.get("zincLayer") != null ? map.get("zincLayer").toString() : null);
|
||||||
|
vo.setManufacturer(map.get("manufacturer") != null ? map.get("manufacturer").toString() : null);
|
||||||
voList.add(vo);
|
voList.add(vo);
|
||||||
}
|
}
|
||||||
return voList;
|
return voList;
|
||||||
@@ -1515,9 +1519,22 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
vo.setCoilCount(map.get("coil_count") != null ? Long.valueOf(map.get("coil_count").toString()) : 0L);
|
vo.setCoilCount(map.get("coil_count") != null ? Long.valueOf(map.get("coil_count").toString()) : 0L);
|
||||||
vo.setTotalGrossWeight(map.get("total_gross_weight") != null ? new BigDecimal(map.get("total_gross_weight").toString()) : BigDecimal.ZERO);
|
vo.setTotalGrossWeight(map.get("total_gross_weight") != null ? new BigDecimal(map.get("total_gross_weight").toString()) : BigDecimal.ZERO);
|
||||||
vo.setTotalNetWeight(map.get("total_net_weight") != null ? new BigDecimal(map.get("total_net_weight").toString()) : BigDecimal.ZERO);
|
vo.setTotalNetWeight(map.get("total_net_weight") != null ? new BigDecimal(map.get("total_net_weight").toString()) : BigDecimal.ZERO);
|
||||||
|
vo.setItemName(map.get("itemName") != null ? map.get("itemName").toString() : null);
|
||||||
|
vo.setItemCode(map.get("itemCode") != null ? map.get("itemCode").toString() : null);
|
||||||
|
vo.setSpecification(map.get("specification") != null ? map.get("specification").toString() : null);
|
||||||
|
vo.setMaterial(map.get("material") != null ? map.get("material").toString() : null);
|
||||||
|
vo.setSurfaceTreatmentDesc(map.get("surfaceTreatmentDesc") != null ? map.get("surfaceTreatmentDesc").toString() : null);
|
||||||
|
vo.setZincLayer(map.get("zincLayer") != null ? map.get("zincLayer").toString() : null);
|
||||||
|
vo.setManufacturer(map.get("manufacturer") != null ? map.get("manufacturer").toString() : null);
|
||||||
voList.add(vo);
|
voList.add(vo);
|
||||||
}
|
}
|
||||||
return voList;
|
return voList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<WmsMaterialCoilVo> getDistributionByActualItemType(String itemType, Long itemId) {
|
||||||
|
List<Map<String, Object>> mapList = baseMapper.getDistributionByActualItemType(itemType, itemId);
|
||||||
|
return convertMapListToVoListActual(mapList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
WHEN mc.item_type = 'raw_material' THEN rm.raw_material_code
|
WHEN mc.item_type = 'raw_material' THEN rm.raw_material_code
|
||||||
WHEN mc.item_type = 'product' THEN p.product_code
|
WHEN mc.item_type = 'product' THEN p.product_code
|
||||||
ELSE NULL
|
ELSE NULL
|
||||||
END as itemCode
|
END as itemCode,
|
||||||
|
CASE
|
||||||
|
WHEN mc.item_type = 'raw_material' THEN rm.specification
|
||||||
|
WHEN mc.item_type = 'product' THEN p.specification
|
||||||
|
ELSE NULL
|
||||||
|
END as specification,
|
||||||
|
CASE
|
||||||
|
WHEN mc.item_type = 'raw_material' THEN rm.material
|
||||||
|
WHEN mc.item_type = 'product' THEN p.material
|
||||||
|
ELSE NULL
|
||||||
|
END as material,
|
||||||
|
CASE
|
||||||
|
WHEN mc.item_type = 'raw_material' THEN rm.surface_treatment_desc
|
||||||
|
WHEN mc.item_type = 'product' THEN p.surface_treatment_desc
|
||||||
|
ELSE NULL
|
||||||
|
END as surfaceTreatmentDesc,
|
||||||
|
CASE
|
||||||
|
WHEN mc.item_type = 'raw_material' THEN rm.zinc_layer
|
||||||
|
WHEN mc.item_type = 'product' THEN p.zinc_layer
|
||||||
|
ELSE NULL
|
||||||
|
END as zincLayer,
|
||||||
|
CASE
|
||||||
|
WHEN mc.item_type = 'raw_material' THEN rm.manufacturer
|
||||||
|
WHEN mc.item_type = 'product' THEN p.manufacturer
|
||||||
|
ELSE NULL
|
||||||
|
END as manufacturer
|
||||||
FROM wms_material_coil mc
|
FROM wms_material_coil mc
|
||||||
LEFT JOIN wms_warehouse w ON mc.warehouse_id = w.warehouse_id
|
LEFT JOIN wms_warehouse w ON mc.warehouse_id = w.warehouse_id
|
||||||
LEFT JOIN wms_raw_material rm ON mc.item_type = 'raw_material' AND mc.item_id = rm.raw_material_id
|
LEFT JOIN wms_raw_material rm ON mc.item_type = 'raw_material' AND mc.item_id = rm.raw_material_id
|
||||||
@@ -165,7 +190,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="itemId != null">
|
<if test="itemId != null">
|
||||||
AND mc.item_id = #{itemId}
|
AND mc.item_id = #{itemId}
|
||||||
</if>
|
</if>
|
||||||
GROUP BY mc.item_type, mc.item_id, w.warehouse_id, w.warehouse_name
|
GROUP BY mc.item_type, mc.item_id, w.warehouse_id, w.warehouse_name, itemName, itemCode, specification, material,
|
||||||
|
surfaceTreatmentDesc, zincLayer, manufacturer
|
||||||
ORDER BY mc.item_type, mc.item_id, w.warehouse_id
|
ORDER BY mc.item_type, mc.item_id, w.warehouse_id
|
||||||
</select>
|
</select>
|
||||||
<select id="selectVoListWithDynamicJoin" resultType="com.klp.domain.vo.WmsMaterialCoilVo">
|
<select id="selectVoListWithDynamicJoin" resultType="com.klp.domain.vo.WmsMaterialCoilVo">
|
||||||
@@ -230,6 +256,69 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
GROUP BY w.actual_warehouse_id, w.actual_warehouse_name
|
GROUP BY w.actual_warehouse_id, w.actual_warehouse_name
|
||||||
ORDER BY w.actual_warehouse_id
|
ORDER BY w.actual_warehouse_id
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getDistributionByActualItemType" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
mc.item_type,
|
||||||
|
mc.item_id,
|
||||||
|
w.actual_warehouse_id,
|
||||||
|
w.actual_warehouse_name,
|
||||||
|
COUNT(mc.coil_id) as coil_count,
|
||||||
|
COALESCE(SUM(mc.gross_weight), 0) as total_gross_weight,
|
||||||
|
COALESCE(SUM(mc.net_weight), 0) as total_net_weight,
|
||||||
|
CASE
|
||||||
|
WHEN mc.item_type = 'raw_material' THEN rm.raw_material_name
|
||||||
|
WHEN mc.item_type = 'product' THEN p.product_name
|
||||||
|
ELSE NULL
|
||||||
|
END as itemName,
|
||||||
|
CASE
|
||||||
|
WHEN mc.item_type = 'raw_material' THEN rm.raw_material_code
|
||||||
|
WHEN mc.item_type = 'product' THEN p.product_code
|
||||||
|
ELSE NULL
|
||||||
|
END as itemCode,
|
||||||
|
CASE
|
||||||
|
WHEN mc.item_type = 'raw_material' THEN rm.specification
|
||||||
|
WHEN mc.item_type = 'product' THEN p.specification
|
||||||
|
ELSE NULL
|
||||||
|
END as specification,
|
||||||
|
CASE
|
||||||
|
WHEN mc.item_type = 'raw_material' THEN rm.material
|
||||||
|
WHEN mc.item_type = 'product' THEN p.material
|
||||||
|
ELSE NULL
|
||||||
|
END as material,
|
||||||
|
CASE
|
||||||
|
WHEN mc.item_type = 'raw_material' THEN rm.surface_treatment_desc
|
||||||
|
WHEN mc.item_type = 'product' THEN p.surface_treatment_desc
|
||||||
|
ELSE NULL
|
||||||
|
END as surfaceTreatmentDesc,
|
||||||
|
CASE
|
||||||
|
WHEN mc.item_type = 'raw_material' THEN rm.zinc_layer
|
||||||
|
WHEN mc.item_type = 'product' THEN p.zinc_layer
|
||||||
|
ELSE NULL
|
||||||
|
END as zincLayer,
|
||||||
|
CASE
|
||||||
|
WHEN mc.item_type = 'raw_material' THEN rm.manufacturer
|
||||||
|
WHEN mc.item_type = 'product' THEN p.manufacturer
|
||||||
|
ELSE NULL
|
||||||
|
END as manufacturer
|
||||||
|
FROM wms_material_coil mc
|
||||||
|
LEFT JOIN wms_actual_warehouse w ON mc.actual_warehouse_id = w.actual_warehouse_id
|
||||||
|
LEFT JOIN wms_raw_material rm ON mc.item_type = 'raw_material' AND mc.item_id = rm.raw_material_id
|
||||||
|
LEFT JOIN wms_product p ON mc.item_type = 'product' AND mc.item_id = p.product_id
|
||||||
|
WHERE mc.data_type = 1
|
||||||
|
AND mc.del_flag = '0'
|
||||||
|
AND (w.del_flag = '0' OR w.del_flag IS NULL)
|
||||||
|
and (mc.material_type='成品' or mc.material_type='原料')
|
||||||
|
and mc.status!=1
|
||||||
|
<if test="itemType != null and itemType != ''">
|
||||||
|
AND mc.item_type = #{itemType}
|
||||||
|
</if>
|
||||||
|
<if test="itemId != null">
|
||||||
|
AND mc.item_id = #{itemId}
|
||||||
|
</if>
|
||||||
|
GROUP BY mc.item_type, mc.item_id, w.actual_warehouse_id, w.actual_warehouse_name, itemName, itemCode, specification,
|
||||||
|
material,surfaceTreatmentDesc, zincLayer, manufacturer
|
||||||
|
ORDER BY mc.item_type, mc.item_id, w.actual_warehouse_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user