Merge branch 'dev-ty1.2' into dev
This commit is contained in:
+2
@@ -33,4 +33,6 @@ public class WarehousePO implements Serializable {
|
||||
@Excel(name = "仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
@Excel(name = "是否启用: 1-否 2-是")
|
||||
private Integer isEnable;
|
||||
}
|
||||
|
||||
+4
-1
@@ -596,7 +596,10 @@ public class BillingStatementApplicationService {
|
||||
BeanUtils.copyProperties(billingStatementDO,billingStatementPO);
|
||||
billingStatementPO.setBillingTotalAmount(billingStatementDO.getBillingAmount());
|
||||
billingStatementPO.setDataSources(2);
|
||||
billingStatementPO.setBillingFlow(OrderSequence.getOrderCode("JFLS"));
|
||||
// 若传入了计费流水号,则直接使用;否则自动生成
|
||||
if (StringUtils.isEmpty(billingStatementPO.getBillingFlow())) {
|
||||
billingStatementPO.setBillingFlow(OrderSequence.getOrderCode("JFLS"));
|
||||
}
|
||||
billingStatementPO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
billingStatementPO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
billingStatementPO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
|
||||
@@ -89,6 +89,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="billingRulesDO.serviceItemsCode != null and billingRulesDO.serviceItemsCode != ''">
|
||||
and service_items_code = #{billingRulesDO.serviceItemsCode}
|
||||
</if>
|
||||
<if test="billingRulesDO.serviceItemsName != null and billingRulesDO.serviceItemsName != ''">
|
||||
and service_items_name like concat('%',#{billingRulesDO.serviceItemsName},'%')
|
||||
</if>
|
||||
<if test="billingRulesDO.firstSubjectCode != null and billingRulesDO.firstSubjectCode != ''">
|
||||
and first_subject_code = #{billingRulesDO.firstSubjectCode}
|
||||
</if>
|
||||
<if test="billingRulesDO.firstSubjectName != null and billingRulesDO.firstSubjectName != ''">
|
||||
and first_subject_name like concat('%',#{billingRulesDO.firstSubjectName},'%')
|
||||
</if>
|
||||
<if test="billingRulesDO.secondSubjectCode != null and billingRulesDO.secondSubjectCode != ''">
|
||||
and second_subject_code = #{billingRulesDO.secondSubjectCode}
|
||||
</if>
|
||||
<if test="billingRulesDO.secondSubjectName != null and billingRulesDO.secondSubjectName != ''">
|
||||
and second_subject_name like concat('%',#{billingRulesDO.secondSubjectName},'%')
|
||||
</if>
|
||||
<if test="billingRulesDO.billingRulesState != null">
|
||||
and billing_rules_state = #{billingRulesDO.billingRulesState}
|
||||
</if>
|
||||
|
||||
+13
-10
@@ -129,16 +129,6 @@ public class StatementStatisticsService {
|
||||
}
|
||||
List<ImmediateInventoryPO> immediateInventoryPOS = materialInventoryDomainService.queryImmediateInventoryList(immediateInventoryDO);
|
||||
|
||||
// 库存数量合计:与列表同筛选条件、不分页统计全部库存数量,回填到每行
|
||||
if (!CollectionUtils.isEmpty(immediateInventoryPOS)) {
|
||||
BigDecimal totalInventoryQuantity = materialInventoryDomainService.sumImmediateInventoryQuantity(immediateInventoryDO);
|
||||
if (totalInventoryQuantity == null) {
|
||||
totalInventoryQuantity = BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal finalTotal = totalInventoryQuantity;
|
||||
immediateInventoryPOS.forEach(po -> po.setTotalInventoryQuantity(finalTotal));
|
||||
}
|
||||
|
||||
// 性能优化:批量获取批次属性,避免N+1查询问题
|
||||
// 1. 收集所有唯一的materialBaseInfoId
|
||||
Set<Long> materialBaseInfoIdSet = immediateInventoryPOS.stream()
|
||||
@@ -173,6 +163,19 @@ public class StatementStatisticsService {
|
||||
return immediateInventoryPOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取库存数量合计
|
||||
* @param immediateInventoryDO 查询参数
|
||||
* @return 库存数量合计
|
||||
*/
|
||||
public BigDecimal sumImmediateInventoryQuantity(ImmediateInventoryDO immediateInventoryDO) {
|
||||
BigDecimal totalInventoryQuantity = materialInventoryDomainService.sumImmediateInventoryQuantity(immediateInventoryDO);
|
||||
if (totalInventoryQuantity == null) {
|
||||
totalInventoryQuantity = BigDecimal.ZERO;
|
||||
}
|
||||
return totalInventoryQuantity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 为物料库存设置更多属性(从库存表中获取值)
|
||||
* @param materialInventoryPOList 物料库存列表
|
||||
|
||||
+88
-13
@@ -1,15 +1,21 @@
|
||||
package com.mhd.wms.domain.inventoryAdjustmentRecord.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.aliyun.oss.ServiceException;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mhd.common.core.constant.SnowFlakeConstants;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.domain.po.WarehousePO;
|
||||
import com.mhd.common.core.utils.OrderSequence;
|
||||
import com.mhd.common.core.utils.uuid.IdGenerator;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.OmsServiceFeign;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.domain.*;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.inventoryAdjustmentRecord.repository.facade.IInventoryAdjustmentRecordService;
|
||||
@@ -56,6 +62,8 @@ public class InventoryAdjustmentRecordDomainService {
|
||||
private IdGenerator idGenerator;
|
||||
@Autowired
|
||||
private OmsServiceFeign omsServiceFeign;
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
|
||||
|
||||
@@ -106,6 +114,15 @@ public class InventoryAdjustmentRecordDomainService {
|
||||
*/
|
||||
@Transactional
|
||||
public Boolean inventoryAdjust(InventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) {
|
||||
// 根据仓库ID获取仓库信息,用于后续库存调整的仓库判断
|
||||
AjaxResult warehouseInfoByWarehouseId = systemServiceFeign.getWarehouseInfoByWarehouseId(inventoryAdjustmentRecordDO.getWarehouseId());
|
||||
if (warehouseInfoByWarehouseId == null) {
|
||||
throw new ServiceException("仓库不存在");
|
||||
} else if (!warehouseInfoByWarehouseId.get("code").equals(200)) {
|
||||
throw new ServiceException("网络错误请重试 --- " + warehouseInfoByWarehouseId.get("msg"));
|
||||
}
|
||||
// 获取仓库信息
|
||||
WarehousePO warehousePO = JSON.parseObject(JSONObject.toJSONString(warehouseInfoByWarehouseId.get("data")), WarehousePO.class);
|
||||
InventoryAdjustmentRecordDO inventoryAdjustmentRecord = new InventoryAdjustmentRecordDO();
|
||||
inventoryAdjustmentRecord.setAdjustAction("库存调整");
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
@@ -115,6 +132,17 @@ public class InventoryAdjustmentRecordDomainService {
|
||||
inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
|
||||
inventoryAdjustmentRecord.setCreateByName(loginUser.getUsername());
|
||||
inventoryAdjustmentRecord.setCreateTime(new Date());
|
||||
if (inventoryAdjustmentRecordDO.getAdjustType() == null) {
|
||||
throw new ServiceException("调整类型不能为空");
|
||||
}
|
||||
if (inventoryAdjustmentRecordDO.getAdjustType() == 1
|
||||
&& inventoryAdjustmentRecordDO.getMaterialInventoryId() == null) {
|
||||
throw new ServiceException("请选择要调整的库存");
|
||||
}
|
||||
if (inventoryAdjustmentRecordDO.getAdjustQuantity() == null
|
||||
|| inventoryAdjustmentRecordDO.getAdjustQuantity().compareTo(BigDecimal.ZERO) == 0) {
|
||||
throw new ServiceException("调整数量不能为空且不能为0");
|
||||
}
|
||||
MaterialInventory materialInventory = null;
|
||||
//根据调整类型判断,数量调整只调整当前库存记录数量,状态调整减少当前原物料状态库存数量和可用数量,增加到现状态库存数量和可用数量
|
||||
if (inventoryAdjustmentRecordDO.getAdjustType() != null && inventoryAdjustmentRecordDO.getAdjustType() == 1) {
|
||||
@@ -180,8 +208,8 @@ public class InventoryAdjustmentRecordDomainService {
|
||||
.eq(MaterialInventory::getStorageSectionId,inventoryAdjustmentRecordDO.getStorageSectionId())
|
||||
.eq(MaterialInventory::getStorageLocationId,inventoryAdjustmentRecordDO.getStorageLocationId())
|
||||
.eq(MaterialInventory::getMaterialStatusCode,inventoryAdjustmentRecordDO.getAdjustBeforeStatusCode())
|
||||
.eq(MaterialInventory::getBatchNumber,inventoryAdjustmentRecordDO.getBatchNumber())
|
||||
.eq(MaterialInventory::getContainerId,inventoryAdjustmentRecordDO.getContainerId())
|
||||
.eq(StringUtils.isNotBlank(inventoryAdjustmentRecordDO.getBatchNumber()),MaterialInventory::getBatchNumber,inventoryAdjustmentRecordDO.getBatchNumber())
|
||||
.eq(inventoryAdjustmentRecordDO.getContainerId() != null, MaterialInventory::getContainerId, inventoryAdjustmentRecordDO.getContainerId())
|
||||
.eq(BaseVOEntity::getDelFlag, 1));
|
||||
if (ObjectUtil.isNotNull(materialInventory)) {
|
||||
BeanUtils.copyProperties(materialInventory, inventoryAdjustmentRecord);
|
||||
@@ -218,6 +246,8 @@ public class InventoryAdjustmentRecordDomainService {
|
||||
inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventory.getGrossWeight());
|
||||
inventoryAdjustmentRecord.setAdjustedVolume(materialInventory.getVolume());
|
||||
inventoryAdjustmentRecord.setAdjustedArea(materialInventory.getArea());
|
||||
// ===== 新增:原状态库存扣减后立即落库,避免依赖末尾统一更新 =====
|
||||
materialInventoryService.updateById(materialInventory);
|
||||
} else {
|
||||
throw new ServiceException("根据原物料状态查询不到物料库存信息!");
|
||||
}
|
||||
@@ -228,8 +258,8 @@ public class InventoryAdjustmentRecordDomainService {
|
||||
.eq(MaterialInventory::getStorageSectionId,inventoryAdjustmentRecordDO.getStorageSectionId())
|
||||
.eq(MaterialInventory::getStorageLocationId,inventoryAdjustmentRecordDO.getStorageLocationId())
|
||||
.eq(MaterialInventory::getMaterialStatusCode,inventoryAdjustmentRecordDO.getAdjustAfterStatusCode())
|
||||
.eq(MaterialInventory::getBatchNumber,inventoryAdjustmentRecordDO.getBatchNumber())
|
||||
.eq(MaterialInventory::getContainerId,inventoryAdjustmentRecordDO.getContainerId())
|
||||
.eq(StringUtils.isNotBlank(inventoryAdjustmentRecordDO.getBatchNumber()),MaterialInventory::getBatchNumber,inventoryAdjustmentRecordDO.getBatchNumber())
|
||||
.eq(inventoryAdjustmentRecordDO.getContainerId() != null,MaterialInventory::getContainerId,inventoryAdjustmentRecordDO.getContainerId())
|
||||
.eq(BaseVOEntity::getDelFlag, 1));
|
||||
if (ObjectUtil.isNotNull(materialInventory1)) {
|
||||
materialInventory1.setInventoryQuantity(materialInventory1.getInventoryQuantity().add(inventoryAdjustmentRecordDO.getAdjustQuantity()));
|
||||
@@ -245,21 +275,49 @@ public class InventoryAdjustmentRecordDomainService {
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusCode(inventoryAdjustmentRecordDO.getAdjustAfterStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusName(inventoryAdjustmentRecordDO.getAdjustAfterStatusName());
|
||||
}
|
||||
// ===== 新增:adjustType 合法性兜底,避免异常类型导致 materialInventory 为 null 静默走完流程 =====
|
||||
if (ObjectUtil.isNull(materialInventory)) {
|
||||
throw new ServiceException("不支持的调整类型:" + inventoryAdjustmentRecordDO.getAdjustType());
|
||||
}
|
||||
//生成库存调整追溯记录
|
||||
if (ObjectUtil.isNotNull(materialInventory)){
|
||||
genInventoryStandingDetail(materialInventory, inventoryAdjustmentRecordDO.getAdjustQuantity());
|
||||
}
|
||||
|
||||
|
||||
materialInventoryService.updateById(materialInventory);
|
||||
// ===== 修复:末尾更新加 null 保护 =====
|
||||
if (ObjectUtil.isNotNull(materialInventory)) {
|
||||
materialInventoryService.updateById(materialInventory);
|
||||
}
|
||||
Boolean insert = inventoryAdjustmentRecordService.insert(inventoryAdjustmentRecord);
|
||||
//推送oms库存调整记录
|
||||
pushOms(materialInventory, inventoryAdjustmentRecordDO);
|
||||
try{
|
||||
// 当仓库启用 oms 才进行推送
|
||||
if (warehousePO.getIsEnable() == 1) {
|
||||
Boolean pushSuccess = pushOms(materialInventory, inventoryAdjustmentRecordDO);
|
||||
if (!pushSuccess) {
|
||||
throw new ServiceException("库存调整推送OMS失败,请稍后重试");
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("推送OMS库存调整记录异常,materialBaseInfoId={}, adjustDirection={}",
|
||||
inventoryAdjustmentRecordDO.getMaterialBaseInfoId(),
|
||||
inventoryAdjustmentRecordDO.getAdjustDirection());
|
||||
throw new ServiceException("库存调整推送OMS失败,请稍后重试");
|
||||
}
|
||||
System.out.println("库存调整时间结束 ----" + System.currentTimeMillis());
|
||||
return insert;
|
||||
}
|
||||
|
||||
|
||||
private void pushOms(MaterialInventory materialInventory,InventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) {
|
||||
/**
|
||||
* 推送库存调整信息至OMS系统
|
||||
* <p>
|
||||
* 根据调整方向(1=增加库存,2=减少库存)分别构造入库调整单或出库调整单,
|
||||
* 并通过Feign接口推送至OMS系统,同时推送对应的物料明细信息。
|
||||
*
|
||||
* @param materialInventory 调整涉及的物料库存信息,包含仓库、库区、库位、货主等上下文数据
|
||||
* @param inventoryAdjustmentRecordDO 库存调整记录,包含调整方向、调整数量、物料编码等数据
|
||||
*/
|
||||
private Boolean pushOms(MaterialInventory materialInventory,InventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
MaterialBaseInfo materialBaseInfo = materialBaseInfoService.getById(materialInventory.getMaterialBaseInfoId());
|
||||
@@ -327,8 +385,16 @@ public class InventoryAdjustmentRecordDomainService {
|
||||
inMaterialDetail.setStorageLocationCode(materialInventory.getStorageLocationCode());
|
||||
inMaterialDetail.setStorageLocationName(materialInventory.getStorageLocationName());
|
||||
inMaterialDetail.setSingleGrossWeight(materialBaseInfo.getWeightLimit());
|
||||
omsServiceFeign.pushInOrder(stockInOrder);
|
||||
omsServiceFeign.pushInOrderDetail(inMaterialDetail);
|
||||
AjaxResult inOrderResult = omsServiceFeign.pushInOrder(stockInOrder);
|
||||
AjaxResult inOrderDetailResult = omsServiceFeign.pushInOrderDetail(inMaterialDetail);
|
||||
if (inOrderResult == null || inOrderDetailResult == null
|
||||
|| !"200".equals(String.valueOf(inOrderResult.get("code")))
|
||||
|| !"200".equals(String.valueOf(inOrderDetailResult.get("code")))
|
||||
) {
|
||||
log.error("推送OMS入库调整单失败,pushInOrder={}, pushInOrderDetail={}",
|
||||
inOrderResult, inOrderDetailResult);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
StockOutOrderTZPD stockOutOrder = new StockOutOrderTZPD();
|
||||
stockOutOrder.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
@@ -391,9 +457,18 @@ public class InventoryAdjustmentRecordDomainService {
|
||||
outMaterialDetail.setStorageLocationCode(materialInventory.getStorageLocationCode());
|
||||
outMaterialDetail.setStorageLocationName(materialInventory.getStorageLocationName());
|
||||
outMaterialDetail.setSingleGrossWeight(materialBaseInfo.getWeightLimit());
|
||||
omsServiceFeign.pushOutOrder(stockOutOrder);
|
||||
omsServiceFeign.pushOutOrderDetail(outMaterialDetail);
|
||||
AjaxResult inOrderResult = omsServiceFeign.pushOutOrder(stockOutOrder);
|
||||
AjaxResult inOrderDetailResult = omsServiceFeign.pushOutOrderDetail(outMaterialDetail);
|
||||
if (inOrderResult == null || inOrderDetailResult == null
|
||||
|| !"200".equals(String.valueOf(inOrderResult.get("code")))
|
||||
|| !"200".equals(String.valueOf(inOrderDetailResult.get("code")))
|
||||
) {
|
||||
log.error("推送OMS入库调整单失败,pushInOrder={}, pushInOrderDetail={}",
|
||||
inOrderResult, inOrderDetailResult);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
@@ -38,6 +38,8 @@ public interface MaterialInventoryMapper extends BaseMapper<MaterialInventory>
|
||||
public List<MaterialInventoryPO> queryListByHz(MaterialInventoryDO materialInventoryDO);
|
||||
//查物料库存列表-货主+物料(同一物料在不同货主下各一行)
|
||||
public List<MaterialInventoryPO> queryListByHzWl(MaterialInventoryDO materialInventoryDO);
|
||||
//查物料库存列表-按货主+物料+仓库(库存查询第三个页签,update_time 取合并后最大值)
|
||||
public List<MaterialInventoryPO> queryListByHzWlUnit(MaterialInventoryDO materialInventoryDO);
|
||||
|
||||
/**
|
||||
* @description 批量增加库存
|
||||
|
||||
+7
-5
@@ -77,17 +77,19 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
String queryRule = materialInventoryDO.getQueryRule();
|
||||
if ("hz".equals(queryRule)) {
|
||||
return materialInventoryMapper.queryListByHz(materialInventoryDO);
|
||||
} else if ("hzwl".equals(queryRule)) {
|
||||
} else if ("hzwl".equals(queryRule)) { // 货主查询
|
||||
return materialInventoryMapper.queryListByHzWl(materialInventoryDO);
|
||||
} else if ("wl".equals(queryRule)) {
|
||||
} else if ("wl".equals(queryRule)) { // 物料查询
|
||||
return materialInventoryMapper.queryListByWl(materialInventoryDO);
|
||||
} else if ("kw".equals(queryRule)) {
|
||||
return materialInventoryMapper.queryListByKw(materialInventoryDO);
|
||||
} else if ("wlkw".equals(queryRule)) {
|
||||
} else if ("wlkw".equals(queryRule)) { // 物料/库位查询
|
||||
return materialInventoryMapper.queryListByWlKw(materialInventoryDO);
|
||||
} else if ("wlExpiry".equals(queryRule)) {
|
||||
} else if ("wlExpiry".equals(queryRule)) { // 物料/过期日期查询
|
||||
return materialInventoryMapper.queryListByWlExpiry(materialInventoryDO);
|
||||
} else if ("all".equals(queryRule)) {
|
||||
} else if("hzwlunit".equals(queryRule)){ // 货主/物料查询
|
||||
return materialInventoryMapper.queryListByHzWlUnit(materialInventoryDO);
|
||||
}else if ("all".equals(queryRule)) { // 全部查询
|
||||
return materialInventoryMapper.queryList(materialInventoryDO);
|
||||
} else {
|
||||
//不传返回全部
|
||||
|
||||
-4
@@ -50,10 +50,6 @@ public class ImmediateInventoryPO {
|
||||
@Excel(name = "库存数量")
|
||||
private BigDecimal inventoryQuantity;
|
||||
|
||||
@ApiModelProperty("库存数量合计(当前查询条件下所有库存数量之和)")
|
||||
@Excel(name = "库存数量合计")
|
||||
private BigDecimal totalInventoryQuantity;
|
||||
|
||||
@ApiModelProperty("可用数量 ")
|
||||
@Excel(name = "可用数量 ")
|
||||
private BigDecimal allocationQuantity;
|
||||
|
||||
+19
-2
@@ -23,6 +23,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -48,13 +50,14 @@ public class StatementStatisticsApi {
|
||||
*/
|
||||
@ApiOperation("查询即时库存列表")
|
||||
@GetMapping("/queryImmediateInventoryList")
|
||||
public TableDataInfo queryImmediateInventoryList(ImmediateInventoryDTO immediateInventoryDTO)
|
||||
public HashMap<String, Object> queryImmediateInventoryList(ImmediateInventoryDTO immediateInventoryDTO)
|
||||
{
|
||||
//转换实体
|
||||
ImmediateInventoryDO immediateInventoryDO = immediateInventoryAssembler.toDO(immediateInventoryDTO);
|
||||
startPage();
|
||||
List<ImmediateInventoryPO> list = statementStatisticsService.queryImmediateInventoryList(immediateInventoryDO);
|
||||
return getDataTable(list);
|
||||
BigDecimal bigDecimal = statementStatisticsService.sumImmediateInventoryQuantity(immediateInventoryDO);
|
||||
return getDataTableWarehouse(list,bigDecimal);
|
||||
}
|
||||
/**
|
||||
* 分页查询入库日报表列表
|
||||
@@ -129,4 +132,18 @@ public class StatementStatisticsApi {
|
||||
rspData.setTotal(new PageInfo(list).getTotal());
|
||||
return rspData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应请求分页、仓库数量 数据
|
||||
*/
|
||||
protected HashMap<String, Object> getDataTableWarehouse(List<?> list,BigDecimal bigDecimal)
|
||||
{
|
||||
HashMap<String, Object> stringObjectHashMap = new HashMap<>();
|
||||
stringObjectHashMap.put("data",list);
|
||||
stringObjectHashMap.put("total",new PageInfo(list).getTotal());
|
||||
stringObjectHashMap.put("code",HttpStatus.SUCCESS);
|
||||
stringObjectHashMap.put("msg","查询成功");
|
||||
stringObjectHashMap.put("totalInventoryQuantity",bigDecimal);
|
||||
return stringObjectHashMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,6 +528,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
loc.storage_location_id, loc.storage_location_code, loc.storage_location_name order by sort_order, a.update_time desc
|
||||
</select>
|
||||
|
||||
<!-- ============ 按货主+物料+仓库+单位 汇总(库存查询第三个页签) ============ -->
|
||||
<!-- SELECT 列:需求字段,全部聚合;包装单位优先库存表,回退物料基础信息表 -->
|
||||
<sql id="selectMaterialInventoryPoByHzWlUnit">
|
||||
a.shipper_id, a.shipper_code, a.shipper_name,
|
||||
b.material_base_info_id, b.material_code, b.material_name, b.SPECIFICATION_MODEL,
|
||||
a.warehouse_id, a.warehouse_code, a.warehouse_name,
|
||||
a.organization_id, a.organization_name, a.top_organization_id,
|
||||
MAX(b.material_type) AS material_type,
|
||||
MAX(b.material_type_name) AS material_type_name,
|
||||
MAX(b.bar_code) AS bar_code,
|
||||
MAX(nvl(a.unit_name, b.unit_name)) AS unit_name,
|
||||
MAX(b.pack_id) AS pack_id,
|
||||
MAX(b.pack_code) AS pack_code,
|
||||
MAX(b.pack_name) AS pack_name,
|
||||
MAX(a.unit) AS unit,
|
||||
IFNULL(SUM(a.freeze_quantity), 0) AS freeze_quantity,
|
||||
IFNULL(SUM(a.inventory_quantity), 0) AS inventory_quantity,
|
||||
IFNULL(SUM(a.allocation_quantity), 0) AS allocation_quantity,
|
||||
IFNULL(SUM(a.area), 0) AS area,
|
||||
IFNULL(SUM(a.NET_WEIGHT), 0) AS NET_WEIGHT,
|
||||
IFNULL(SUM(a.GROSS_WEIGHT), 0) AS GROSS_WEIGHT,
|
||||
IFNULL(SUM(a.VOLUME), 0) AS VOLUME,
|
||||
MIN(a.create_time) AS create_time, -- 新增:首次入库时间
|
||||
MAX(a.update_time) AS update_time,
|
||||
CASE WHEN IFNULL(SUM(a.inventory_quantity), 0) = 0 THEN 1 ELSE 0 END AS sort_order
|
||||
</sql>
|
||||
|
||||
<select id="queryListByHzWlUnit"
|
||||
parameterType="com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO"
|
||||
resultMap="MaterialInventoryResult">
|
||||
select
|
||||
<include refid="selectMaterialInventoryPoByHzWlUnit"/>
|
||||
from material_inventory a
|
||||
left join material_base_info b on a.material_base_info_id = b.material_base_info_id
|
||||
<where>
|
||||
a.del_flag = 1
|
||||
<include refid="selectMaterialInventoryPo1"/>
|
||||
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
|
||||
<if test="excludeZeroInventoryQuantity != null and excludeZeroInventoryQuantity == true">
|
||||
and IFNULL(a.inventory_quantity, 0) > 0
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY a.shipper_id, a.shipper_code, a.shipper_name,
|
||||
b.material_base_info_id, b.material_code, b.material_name, b.SPECIFICATION_MODEL,
|
||||
a.warehouse_id, a.warehouse_code, a.warehouse_name,
|
||||
a.organization_id, a.organization_name, a.top_organization_id
|
||||
ORDER BY sort_order, MAX(a.update_time) DESC
|
||||
</select>
|
||||
|
||||
<select id="queryListByHz" parameterType="com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO" resultMap="MaterialInventoryResult">
|
||||
select
|
||||
<include refid="selectMaterialInventoryPo"/>
|
||||
@@ -1054,7 +1103,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="materialName" column="material_name" />
|
||||
<result property="barCode" column="bar_code" />
|
||||
<result property="specificationModel" column="specification_model" />
|
||||
<result property="totalInventoryQuantity" column="total_inventory_quantity" />
|
||||
<result property="warehouseName" column="warehouse_name" />
|
||||
<result property="inventoryQuantity" column="inventory_quantity" />
|
||||
<result property="allocationQuantity" column="allocation_quantity" />
|
||||
|
||||
Reference in New Issue
Block a user