PDA收货数量问题
This commit is contained in:
+9
-26
@@ -381,7 +381,7 @@ public class StockReceiptOrderApplicationService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 扁平化明细:将第一条子项变为主行,两条子项收货数量累加到主行 ALREADY_RECEIPT_QUANTITY,主行展示第一条子项的批次属性(收货时修改的值)
|
||||
* 扁平化明细:主行保留自身 receiptQuantity,alreadyReceiptQuantity 汇总主行+所有子项;保留父子结构,子项作为 children 展示
|
||||
* @param receiptMaterialDetailPOList 物料明细列表(树形,level 1 父级含 children)
|
||||
*/
|
||||
private void flattenMaterialDetailList(List<ReceiptMaterialDetailPO> receiptMaterialDetailPOList) {
|
||||
@@ -393,43 +393,23 @@ public class StockReceiptOrderApplicationService {
|
||||
if (CollectionUtils.isEmpty(children)) {
|
||||
continue;
|
||||
}
|
||||
// 第一条子项变为主行:用第一条子项的数据(含批次属性)覆盖主行展示
|
||||
ReceiptMaterialDetailPO firstChild = children.get(0);
|
||||
if (!CollectionUtils.isEmpty(firstChild.getMaterialMoreDetailList())) {
|
||||
parent.setMaterialMoreDetailList(firstChild.getMaterialMoreDetailList());
|
||||
}
|
||||
parent.setBatchRefNo(firstChild.getBatchRefNo());
|
||||
parent.setSheetRefNo(firstChild.getSheetRefNo());
|
||||
parent.setBoxPalletNo(firstChild.getBoxPalletNo());
|
||||
parent.setProductionDate(firstChild.getProductionDate());
|
||||
parent.setExpiryDate(firstChild.getExpiryDate());
|
||||
parent.setInventoryDate(firstChild.getInventoryDate());
|
||||
parent.setExtAttr1(firstChild.getExtAttr1());
|
||||
parent.setExtAttr2(firstChild.getExtAttr2());
|
||||
parent.setExtAttr3(firstChild.getExtAttr3());
|
||||
parent.setExtAttr4(firstChild.getExtAttr4());
|
||||
// 两条子项收货数量累加到主行(净重、毛重、体积、面积不累加,保持主行原值)
|
||||
BigDecimal receiptQuantitySum = parent.getReceiptQuantity() != null ? parent.getReceiptQuantity() : BigDecimal.ZERO;
|
||||
// 主行 alreadyReceiptQuantity = 主行 receiptQuantity + 所有子项 receiptQuantity
|
||||
BigDecimal alreadyReceiptQuantitySum = parent.getReceiptQuantity() != null ? parent.getReceiptQuantity() : BigDecimal.ZERO;
|
||||
Integer maxReceiptStatus = parent.getReceiptStatus();
|
||||
for (ReceiptMaterialDetailPO child : children) {
|
||||
if (child.getReceiptQuantity() != null) {
|
||||
receiptQuantitySum = receiptQuantitySum.add(child.getReceiptQuantity());
|
||||
alreadyReceiptQuantitySum = alreadyReceiptQuantitySum.add(child.getReceiptQuantity());
|
||||
}
|
||||
if (child.getReceiptStatus() != null && (maxReceiptStatus == null || child.getReceiptStatus() > maxReceiptStatus)) {
|
||||
maxReceiptStatus = child.getReceiptStatus();
|
||||
}
|
||||
// 子项不需要展示计划数量字段
|
||||
child.setQuantity(null);
|
||||
}
|
||||
parent.setReceiptQuantity(receiptQuantitySum);
|
||||
// 主行 ALREADY_RECEIPT_QUANTITY:DB 已存汇总时用其值,否则用子项合计
|
||||
if (parent.getAlreadyReceiptQuantity() == null || parent.getAlreadyReceiptQuantity().compareTo(receiptQuantitySum) < 0) {
|
||||
parent.setAlreadyReceiptQuantity(receiptQuantitySum);
|
||||
}
|
||||
parent.setAlreadyReceiptQuantity(alreadyReceiptQuantitySum);
|
||||
if (maxReceiptStatus != null) {
|
||||
parent.setReceiptStatus(maxReceiptStatus);
|
||||
}
|
||||
// 保留子项,子项展示其自己填写的值(收货数量、批次属性、净重毛重体积面积等)
|
||||
// 保留父子结构,子项在 parent.children 中,前端按树形展示
|
||||
}
|
||||
}
|
||||
|
||||
@@ -926,6 +906,9 @@ public class StockReceiptOrderApplicationService {
|
||||
// 物料条码为空时取物料维护的条码信息第一行的 barCode
|
||||
Map<Long, String> materialBarCodeMap = buildMaterialBarCodeMap(materialBaseInfoIdSet);
|
||||
fillBarCodeFromMaterialBarCodeRecursively(materialDetailList, materialBarCodeMap);
|
||||
// PDA 端与 PC 端一致:主行收货数量取第一条子项,已收货数量汇总所有子项
|
||||
flattenMaterialDetailList(materialDetailList);
|
||||
clearChildQuantityRecursively(materialDetailList);
|
||||
}
|
||||
return stockReceiptOrderPO;
|
||||
}
|
||||
|
||||
+17
-3
@@ -5,6 +5,10 @@ import com.mhd.common.core.web.controller.BaseController;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.core.web.page.TableDataInfoApi;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO;
|
||||
import com.mhd.system.api.domain.cache.SystemServiceCacheUtil;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.application.service.stockOutOrder.StockOutOrderApplicationService;
|
||||
import com.mhd.wms.domain.stockOutOrder.repository.po.StockOutOrderPO;
|
||||
import com.mhd.wms.domain.stockOutOrder.repository.todo.StockOutOrderDO;
|
||||
@@ -33,15 +37,25 @@ public class StockOutOrderAppApi extends BaseController {
|
||||
private StockOutOrderAssembler stockOutOrderAssembler;
|
||||
|
||||
/**
|
||||
* 分页查询出库单列表
|
||||
* 分页查询出库单列表(PDA复核查询)
|
||||
* 查询条件:warehouse_id(用户关联仓库)、check_operators_by(当前用户)、check_status<3 等
|
||||
*/
|
||||
@ApiOperation("查询出库单列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfoApi list(StockOutOrderDTO stockOutOrderDTO) {
|
||||
//转换实体
|
||||
StockOutOrderDO stockOutOrderDO = stockOutOrderAssembler.toDO(stockOutOrderDTO);
|
||||
startPage();
|
||||
stockOutOrderDO.setCheckOperatorsBy(SecurityUtils.getLoginUser().getUserPo().getUserId());
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
stockOutOrderDO.setCheckOperatorsBy(userPo.getUserId());
|
||||
stockOutOrderDO.setOrganizationId(userPo.getOrganizationId());
|
||||
stockOutOrderDO.setTopOrganizationId(userPo.getTopOrganizationId());
|
||||
stockOutOrderDO.setLtCheckStatus(3);
|
||||
stockOutOrderDO.setDelFlag(1);
|
||||
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
if (associationWarehouseCacheDO != null) {
|
||||
stockOutOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||
}
|
||||
List<StockOutOrderPO> list = stockOutOrderApplicationService.queryList(stockOutOrderDO);
|
||||
return getDataTableApi(list);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user