mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
refactor(warehouse): 优化出库单处理逻辑
- 新增 processType1Receipt 方法,用于处理类型 1 的仓库收发存单 - 在该方法中清空出库单的供应商信息 - 优化了代码结构,提高了出库单处理的可读性和可维护性
This commit is contained in:
@@ -76,6 +76,8 @@ public class WarehouseReceiptService
|
||||
|
||||
processDetail(entity);
|
||||
|
||||
processType1Receipt(entity);
|
||||
|
||||
this.repository.save(entity);
|
||||
|
||||
if (request.getReceiptType().equals("2")) {
|
||||
@@ -86,6 +88,23 @@ public class WarehouseReceiptService
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库单清空供应商
|
||||
*
|
||||
* @param entity
|
||||
*/
|
||||
private void processType1Receipt(WarehouseReceiptEntity entity) {
|
||||
|
||||
if (entity.getReceiptType().equals("1")) {
|
||||
|
||||
if (CollectionUtils.isNotEmpty(entity.getDetail())) {
|
||||
|
||||
entity.getDetail()
|
||||
.forEach(item -> {item.setSupplier(null);});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理盘库单
|
||||
*
|
||||
@@ -581,7 +600,7 @@ public class WarehouseReceiptService
|
||||
gc.code as category_code,
|
||||
gc.name as category_name,
|
||||
gs.enable_low_stock_warning as enable_low_stock_warning,
|
||||
gs.low_stock_warning_number as low_stock_warning_number,
|
||||
gs.low_stock_warning_number as low_stock_warning_number,
|
||||
|
||||
<#if shelveSummary>
|
||||
ws.id as shelve_id,
|
||||
@@ -839,25 +858,24 @@ from (
|
||||
x instanceof Map
|
||||
&& ((Map) x).get("uid").equals(uid))
|
||||
.findFirst()
|
||||
.orElseGet(() -> {
|
||||
.orElseGet(
|
||||
() -> {
|
||||
HashMap<Object, Object> map = new HashMap<>();
|
||||
|
||||
HashMap<Object, Object> map = new HashMap<>();
|
||||
|
||||
|
||||
map.put("prevNumber", 0.0);
|
||||
map.put("prevAmount", 0.0);
|
||||
map.put("prevPrice", 0.0);
|
||||
map.put("currNumber", 0.0);
|
||||
map.put("currAmount", 0.0);
|
||||
map.put("currPrice", 0.0);
|
||||
map.put("type0Number", 0.0);
|
||||
map.put("type1Number", 0.0);
|
||||
map.put("type0Amount", 0.0);
|
||||
map.put("type1Amount", 0.0);
|
||||
map.put("type0Price", 0.0);
|
||||
map.put("type1Price", 0.0);
|
||||
return map;
|
||||
});
|
||||
map.put("prevNumber", 0.0);
|
||||
map.put("prevAmount", 0.0);
|
||||
map.put("prevPrice", 0.0);
|
||||
map.put("currNumber", 0.0);
|
||||
map.put("currAmount", 0.0);
|
||||
map.put("currPrice", 0.0);
|
||||
map.put("type0Number", 0.0);
|
||||
map.put("type1Number", 0.0);
|
||||
map.put("type0Amount", 0.0);
|
||||
map.put("type1Amount", 0.0);
|
||||
map.put("type0Price", 0.0);
|
||||
map.put("type1Price", 0.0);
|
||||
return map;
|
||||
});
|
||||
|
||||
Double prevType0Number = NumberUtil.parseDouble(prevMap.get("type0Number") + "", 0.0);
|
||||
Double prevType1Number = NumberUtil.parseDouble(prevMap.get("type1Number") + "", 0.0);
|
||||
|
||||
Reference in New Issue
Block a user