opt:配盘出库、配送流程测试修改优化
This commit is contained in:
@@ -9,6 +9,8 @@ public class RegionConstant {
|
||||
* 一次配盘区编码
|
||||
*/
|
||||
public static final String FIRST_MEAL = "EB1";
|
||||
public static final String EA2 = "EA2";
|
||||
public static final String EB2 = "EB2";
|
||||
|
||||
/**
|
||||
* 机加工二次配盘区,原料线边库
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.nl.wms.pm_manage.demand.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@TableName("pm_plating_allocation")
|
||||
public class PlatingAllocation {
|
||||
@TableId
|
||||
private String id;
|
||||
private String demand_id;
|
||||
private String item_id;
|
||||
private String pallet_code;
|
||||
private String outbound_id;
|
||||
private String warehouse_code;
|
||||
private BigDecimal qty;
|
||||
private Integer delivered;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.nl.wms.pm_manage.demand.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.nl.wms.pm_manage.demand.service.dao.PlatingAllocation;
|
||||
|
||||
@Mapper
|
||||
public interface PlatingAllocationMapper extends BaseMapper<PlatingAllocation> {}
|
||||
@@ -16,6 +16,7 @@ import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.basedata_manage.service.dao.Sectattr;
|
||||
import org.nl.wms.pm_manage.demand.service.dao.PmPlatingDemand;
|
||||
import org.nl.wms.pm_manage.demand.service.dao.PmPlatingDemandItem;
|
||||
import org.nl.wms.pm_manage.demand.service.dao.PlatingAllocation;
|
||||
import org.nl.wms.pm_manage.demand.service.dao.mapper.PmPlatingDemandItemMapper;
|
||||
import org.nl.wms.pm_manage.demand.service.dao.mapper.PmPlatingDemandMapper;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PlatingDemandCompleteParam;
|
||||
@@ -46,6 +47,7 @@ import java.util.stream.Collectors;
|
||||
/** 配盘预分配 -> 平库确认组盘 -> 入库 -> 配送完成领料。 */
|
||||
@Service
|
||||
public class PlatingWorkflowService {
|
||||
@Resource private org.nl.wms.pm_manage.demand.service.dao.mapper.PlatingAllocationMapper allocations;
|
||||
public static final String SOURCE_TYPE = "plating_demand";
|
||||
@Resource
|
||||
private PmPlatingDemandMapper demands;
|
||||
@@ -117,8 +119,9 @@ public class PlatingWorkflowService {
|
||||
if (locked.stream().anyMatch(p -> pallet.equals(p.getVehicle_code())))
|
||||
throw new BadRequestException("托盘已绑定点位,请使用空托盘");
|
||||
if (groups.count(new LambdaQueryWrapper<GroupPlate>().eq(GroupPlate::getStoragevehicle_code, pallet)) > 0
|
||||
|| demands.selectCount(new LambdaQueryWrapper<PmPlatingDemand>().eq(PmPlatingDemand::getPallet_code, pallet)
|
||||
.lt(PmPlatingDemand::getStatus, 2)) > 0)
|
||||
|| allocations.selectCount(new LambdaQueryWrapper<org.nl.wms.pm_manage.demand.service.dao.PlatingAllocation>()
|
||||
.eq(org.nl.wms.pm_manage.demand.service.dao.PlatingAllocation::getPallet_code, pallet)
|
||||
.eq(org.nl.wms.pm_manage.demand.service.dao.PlatingAllocation::getDelivered, 0)) > 0)
|
||||
throw new BadRequestException("托盘已有组盘或未完成需求,请使用空托盘");
|
||||
Sectattr sector = sectors().stream().filter(s -> Objects.equals(s.getSect_code(), param.getSectCode())).findFirst()
|
||||
.orElseThrow(() -> new BadRequestException("请选择已启用的平库库区"));
|
||||
@@ -126,6 +129,7 @@ public class PlatingWorkflowService {
|
||||
if (store == null || !Objects.equals(store.getStor_code(), param.getStoreCode()))
|
||||
throw new BadRequestException("仓库与库区不匹配");
|
||||
Map<String, BigDecimal> remaining = new LinkedHashMap<>();
|
||||
Set<String> ignored = new HashSet<>();
|
||||
if (param.getItems() == null) throw new BadRequestException("请填写物料数量");
|
||||
for (PlatingDemandCompleteParam.Item input : param.getItems()) {
|
||||
String code = text(input.getMaterialCode(), "物料编码不能为空");
|
||||
@@ -133,33 +137,53 @@ public class PlatingWorkflowService {
|
||||
if (qty == null || qty.signum() < 0 || qty.scale() > 8)
|
||||
throw new BadRequestException("数量必须非负且最多8位小数");
|
||||
if (remaining.putIfAbsent(code, qty) != null) throw new BadRequestException("物料重复:" + code);
|
||||
if (Boolean.TRUE.equals(input.getIgnored())) {
|
||||
if (qty.signum() != 0) throw new BadRequestException("忽略物料的本次数量必须为0");
|
||||
ignored.add(code);
|
||||
}
|
||||
}
|
||||
List<PmPlatingDemand> selected = new ArrayList<>();
|
||||
Map<String, List<PmPlatingDemandItem>> selectedItems = new LinkedHashMap<>();
|
||||
for (PmPlatingDemand demand : byPort(port, true)) {
|
||||
if (demand.getPallet_code() != null && !demand.getPallet_code().isEmpty()) continue;
|
||||
Map<String, BigDecimal> assigned = new LinkedHashMap<>();
|
||||
List<PmPlatingDemand> pending = byPort(port, true);
|
||||
Map<String, List<PmPlatingDemandItem>> byMaterial = new LinkedHashMap<>();
|
||||
for (PmPlatingDemand demand : pending) {
|
||||
List<PmPlatingDemandItem> rows = demandItems(demand.getId());
|
||||
Map<String, BigDecimal> needed = new LinkedHashMap<>();
|
||||
selectedItems.put(demand.getId(), rows);
|
||||
for (PmPlatingDemandItem item : rows) {
|
||||
if (Objects.equals(item.getIs_ignored(), 1)) continue;
|
||||
if (zero(item.getAllocated_qty()).signum() > 0)
|
||||
throw new BadRequestException("历史部分配盘需求需先核对:" + demand.getDemand_code());
|
||||
needed.merge(item.getMaterial_code(), item.getDemand_qty(), BigDecimal::add);
|
||||
byMaterial.computeIfAbsent(item.getMaterial_code(), k -> new ArrayList<>()).add(item);
|
||||
}
|
||||
if (needed.isEmpty()) continue;
|
||||
if (needed.entrySet().stream().anyMatch(e -> remaining.getOrDefault(e.getKey(), BigDecimal.ZERO).compareTo(e.getValue()) < 0))
|
||||
break;
|
||||
needed.forEach((code, qty) -> remaining.put(code, remaining.get(code).subtract(qty)));
|
||||
selected.add(demand);
|
||||
selectedItems.put(demand.getId(), rows);
|
||||
}
|
||||
if (selected.isEmpty() || remaining.values().stream().anyMatch(q -> q.signum() != 0))
|
||||
throw new BadRequestException("数量必须按需求单顺序覆盖完整需求单,同一需求单不能拆托;请核对下方需求明细");
|
||||
for (Map.Entry<String, BigDecimal> input : remaining.entrySet()) {
|
||||
List<PmPlatingDemandItem> rows = byMaterial.get(input.getKey());
|
||||
if (rows == null || rows.isEmpty()) {
|
||||
if (input.getValue().signum() > 0 || ignored.contains(input.getKey())) throw new BadRequestException("物料无有效需求:" + input.getKey());
|
||||
continue;
|
||||
}
|
||||
if (ignored.contains(input.getKey())) {
|
||||
for (PmPlatingDemandItem item : rows) { item.setIs_ignored(1); items.updateById(item); }
|
||||
continue;
|
||||
}
|
||||
BigDecimal qty = input.getValue();
|
||||
for (PmPlatingDemandItem item : rows) {
|
||||
BigDecimal take = item.getDemand_qty().subtract(zero(item.getAllocated_qty())).max(BigDecimal.ZERO).min(qty);
|
||||
if (take.signum() > 0) assigned.put(item.getId(), take);
|
||||
qty = qty.subtract(take);
|
||||
}
|
||||
if (qty.signum() > 0) assigned.merge(rows.get(rows.size() - 1).getId(), qty, BigDecimal::add);
|
||||
}
|
||||
if (assigned.isEmpty() && ignored.isEmpty()) throw new BadRequestException("请填写数量或选择忽略物料");
|
||||
for (PmPlatingDemand demand : pending) {
|
||||
if (selectedItems.get(demand.getId()).stream().anyMatch(i -> assigned.containsKey(i.getId()))) selected.add(demand);
|
||||
refreshStatus(demand);
|
||||
}
|
||||
if (assigned.isEmpty()) return "已忽略所选物料";
|
||||
vehicles.chackAndInsert(pallet);
|
||||
JSONArray table = new JSONArray();
|
||||
for (PmPlatingDemand demand : selected) {
|
||||
for (PmPlatingDemandItem item : selectedItems.get(demand.getId())) {
|
||||
if (Objects.equals(item.getIs_ignored(), 1)) continue;
|
||||
if (!assigned.containsKey(item.getId())) continue;
|
||||
MdMeMaterialbase material = materials.getByCode(item.getMaterial_code());
|
||||
if (material == null) throw new BadRequestException("物料不存在:" + item.getMaterial_code());
|
||||
JSONObject row = new JSONObject();
|
||||
@@ -167,7 +191,7 @@ public class PlatingWorkflowService {
|
||||
row.put("material_code", material.getMaterial_code());
|
||||
row.put("qty_unit_id", material.getQty_unit_id());
|
||||
row.put("qty_unit_name", material.getQty_unit_name());
|
||||
row.put("qty", item.getDemand_qty());
|
||||
row.put("qty", assigned.get(item.getId()));
|
||||
row.put("source_bill_type", SOURCE_TYPE);
|
||||
row.put("source_bill_code", demand.getDemand_code());
|
||||
row.put("source_billdtl_id", item.getId());
|
||||
@@ -194,8 +218,13 @@ public class PlatingWorkflowService {
|
||||
demand.setSource_warehouse(store.getStor_code());
|
||||
demands.updateById(demand);
|
||||
for (PmPlatingDemandItem item : selectedItems.get(demand.getId())) {
|
||||
if (!Objects.equals(item.getIs_ignored(), 1)) item.setAllocated_qty(item.getDemand_qty());
|
||||
if (!assigned.containsKey(item.getId())) continue;
|
||||
item.setAllocated_qty(zero(item.getAllocated_qty()).add(assigned.get(item.getId())));
|
||||
items.updateById(item);
|
||||
org.nl.wms.pm_manage.demand.service.dao.PlatingAllocation allocation = new org.nl.wms.pm_manage.demand.service.dao.PlatingAllocation();
|
||||
allocation.setId(IdUtil.getStringId()); allocation.setDemand_id(demand.getId()); allocation.setItem_id(item.getId());
|
||||
allocation.setPallet_code(pallet); allocation.setOutbound_id(id); allocation.setWarehouse_code(store.getStor_code());
|
||||
allocation.setQty(assigned.get(item.getId())); allocation.setDelivered(0); allocations.insert(allocation);
|
||||
}
|
||||
}
|
||||
return bills.selectById(id).getBill_code();
|
||||
@@ -206,45 +235,48 @@ public class PlatingWorkflowService {
|
||||
public void rawOutboundFinished(String billId) {
|
||||
IOStorInv bill = bills.selectById(billId);
|
||||
if (bill == null || !IOSEnum.BILL_STATUS.code("完成").equals(bill.getBill_status())) return;
|
||||
List<PmPlatingDemand> list = demands.selectList(new LambdaQueryWrapper<PmPlatingDemand>()
|
||||
.eq(PmPlatingDemand::getOutbound_id, billId).orderByAsc(PmPlatingDemand::getId).last("for update"));
|
||||
for (PmPlatingDemand demand : list) {
|
||||
for (PmPlatingDemandItem item : demandItems(demand.getId())) {
|
||||
if (Objects.equals(item.getIs_ignored(), 1) || zero(item.getOutbound_qty()).signum() > 0) continue;
|
||||
List<PlatingAllocation> list = allocations.selectList(new LambdaQueryWrapper<PlatingAllocation>()
|
||||
.eq(PlatingAllocation::getOutbound_id, billId).orderByAsc(PlatingAllocation::getId).last("for update"));
|
||||
for (PlatingAllocation allocation : list) {
|
||||
PmPlatingDemand demand = demands.selectById(allocation.getDemand_id());
|
||||
PmPlatingDemandItem item = items.selectById(allocation.getItem_id());
|
||||
if (allocation.getDelivered() == 1) continue;
|
||||
if (groups.count(new LambdaQueryWrapper<GroupPlate>().eq(GroupPlate::getExt_type, SOURCE_TYPE)
|
||||
.eq(GroupPlate::getExt_dtl_code, item.getId())) > 0) continue;
|
||||
.eq(GroupPlate::getExt_dtl_code, allocation.getId())) > 0) continue;
|
||||
MdMeMaterialbase material = materials.getByCode(item.getMaterial_code());
|
||||
groups.save(GroupPlate.builder().group_id(IdUtil.getStringId()).storagevehicle_code(demand.getPallet_code())
|
||||
.material_code(item.getMaterial_code()).qty(item.getAllocated_qty()).frozen_qty(BigDecimal.ZERO).pcsn(item.getId())
|
||||
groups.save(GroupPlate.builder().group_id(IdUtil.getStringId()).storagevehicle_code(allocation.getPallet_code())
|
||||
.material_code(item.getMaterial_code()).qty(allocation.getQty()).frozen_qty(BigDecimal.ZERO).pcsn(allocation.getId())
|
||||
.qty_unit_id(material.getQty_unit_id()).qty_unit_name(material.getQty_unit_name())
|
||||
.status(IOSEnum.GROUP_PLATE_STATUS.code("组盘")).load_port(PlatingDemandServiceImpl.parseLoadPort(demand.getLoad_port()))
|
||||
.ext_type(SOURCE_TYPE).ext_code(demand.getDemand_code()).ext_dtl_code(item.getId())
|
||||
.ext_type(SOURCE_TYPE).ext_code(demand.getDemand_code()).ext_dtl_code(allocation.getId())
|
||||
.create_time(DateUtil.now()).create_id(SecurityUtils.getCurrentUserId()).create_name(SecurityUtils.getCurrentNickName()).build());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 配送事务内写入 EAS 待回传队列,使用需求单唯一请求号和出库量实现幂等。 */
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deliveryFinished(String pallet, String port) {
|
||||
List<PlatingAllocation> palletAllocations = palletAllocations(pallet);
|
||||
Set<String> demandIds = palletAllocations.stream().map(PlatingAllocation::getDemand_id).collect(Collectors.toSet());
|
||||
List<PmPlatingDemand> list = byPort(port, true).stream()
|
||||
.filter(d -> pallet.equals(d.getPallet_code()) && d.getStatus() == 1).collect(Collectors.toList());
|
||||
if (list.isEmpty()) throw new BadRequestException("托盘没有待配送需求");
|
||||
.filter(d -> demandIds.contains(d.getId())).collect(Collectors.toList());
|
||||
if (list.isEmpty() || list.size() != demandIds.size()) throw new BadRequestException("托盘需求状态或上料口不一致");
|
||||
for (PmPlatingDemand demand : list) {
|
||||
IOStorInv bill = bills.selectById(demand.getOutbound_id());
|
||||
if (bill == null || !IOSEnum.BILL_STATUS.code("完成").equals(bill.getBill_status()))
|
||||
throw new BadRequestException("原料尚未完成出库");
|
||||
WorkOrderDao order = orders.getWorkOrder(demand.getWork_order_code());
|
||||
if (order == null) throw new BadRequestException("工单不存在");
|
||||
Map<String, WorkOrderBomDao> boms = orders.getOrderBomItem(demand.getWork_order_code()).stream()
|
||||
.collect(Collectors.toMap(WorkOrderBomDao::getId, b -> b));
|
||||
JSONArray entries = new JSONArray();
|
||||
for (PmPlatingDemandItem item : demandItems(demand.getId())) {
|
||||
if (Objects.equals(item.getIs_ignored(), 1)) continue;
|
||||
BigDecimal qty = zero(item.getAllocated_qty()).subtract(zero(item.getOutbound_qty()));
|
||||
if (qty.signum() <= 0) continue;
|
||||
for (PlatingAllocation allocation : palletAllocations) {
|
||||
if (!demand.getId().equals(allocation.getDemand_id())) continue;
|
||||
allocation = allocations.selectOne(new LambdaQueryWrapper<PlatingAllocation>().eq(PlatingAllocation::getId, allocation.getId()).last("for update"));
|
||||
if (allocation.getDelivered() == 1) continue;
|
||||
IOStorInv bill = bills.selectById(allocation.getOutbound_id());
|
||||
if (bill == null || !IOSEnum.BILL_STATUS.code("完成").equals(bill.getBill_status())) throw new BadRequestException("原料尚未完成出库");
|
||||
PmPlatingDemandItem item = items.selectById(allocation.getItem_id());
|
||||
BigDecimal qty = allocation.getQty();
|
||||
BigDecimal onPallet = groups.list(new LambdaQueryWrapper<GroupPlate>().eq(GroupPlate::getStoragevehicle_code, pallet)
|
||||
.eq(GroupPlate::getLoad_port, port).eq(GroupPlate::getExt_type, SOURCE_TYPE).eq(GroupPlate::getExt_dtl_code, item.getId()))
|
||||
.eq(GroupPlate::getLoad_port, port).eq(GroupPlate::getExt_type, SOURCE_TYPE).eq(GroupPlate::getExt_dtl_code, allocation.getId()))
|
||||
.stream().map(GroupPlate::getQty).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
if (onPallet.compareTo(qty) != 0)
|
||||
throw new BadRequestException("托盘组盘数量与需求不一致:" + item.getMaterial_code());
|
||||
@@ -255,10 +287,13 @@ public class PlatingWorkflowService {
|
||||
entry.put("srcbillid", order.getOrder_id());
|
||||
entry.put("srcbillentryid", bom.getItem_id());
|
||||
entry.put("qty", qty);
|
||||
entry.put("warehouseno", demand.getSource_warehouse());
|
||||
entry.put("warehouseno", allocation.getWarehouse_code());
|
||||
entry.put("materialno", bom.getMaterial_code());
|
||||
entries.add(entry);
|
||||
item.setOutbound_qty(zero(item.getOutbound_qty()).add(qty));
|
||||
items.updateById(item);
|
||||
allocation.setDelivered(1);
|
||||
allocations.updateById(allocation);
|
||||
}
|
||||
if (!entries.isEmpty()) {
|
||||
JSONObject data = new JSONObject();
|
||||
@@ -275,22 +310,31 @@ public class PlatingWorkflowService {
|
||||
callback.put("type", "MES");
|
||||
callback.put("data", data);
|
||||
PmStockReturn request = new PmStockReturn();
|
||||
request.setRequest_Id("PD-" + demand.getId());
|
||||
request.setRequest_Id("PD-" + IdUtil.getStringId());
|
||||
request.setRequest_type(IOSEnum.BILL_TYPE.code("生产出库"));
|
||||
request.setStatus(StockReturnStatusEnum.TODO.getCode());
|
||||
request.setCreate_time(DateUtil.now());
|
||||
request.setRequest_data(callback.toJSONString());
|
||||
returns.save(request);
|
||||
}
|
||||
if (demandItems(demand.getId()).stream().allMatch(i -> Objects.equals(i.getIs_ignored(), 1)
|
||||
|| zero(i.getOutbound_qty()).compareTo(i.getDemand_qty()) >= 0)) {
|
||||
demand.setStatus(2);
|
||||
demand.setFinish_time(DateUtil.now());
|
||||
demands.updateById(demand);
|
||||
}
|
||||
refreshStatus(demand);
|
||||
}
|
||||
}
|
||||
|
||||
public List<PlatingAllocation> palletAllocations(String pallet) {
|
||||
return allocations.selectList(new LambdaQueryWrapper<PlatingAllocation>().eq(PlatingAllocation::getPallet_code, pallet)
|
||||
.eq(PlatingAllocation::getDelivered, 0).orderByAsc(PlatingAllocation::getId));
|
||||
}
|
||||
|
||||
private void refreshStatus(PmPlatingDemand demand) {
|
||||
List<PmPlatingDemandItem> rows = demandItems(demand.getId());
|
||||
boolean finished = !rows.isEmpty() && rows.stream().allMatch(i -> zero(i.getOutbound_qty()).compareTo(
|
||||
Objects.equals(i.getIs_ignored(), 1) ? zero(i.getAllocated_qty()) : i.getDemand_qty().max(zero(i.getAllocated_qty()))) >= 0);
|
||||
demand.setStatus(finished ? 2 : rows.stream().anyMatch(i -> zero(i.getAllocated_qty()).signum() > 0 || Objects.equals(i.getIs_ignored(), 1)) ? 1 : 0);
|
||||
if (finished) demand.setFinish_time(DateUtil.now());
|
||||
demands.updateById(demand);
|
||||
}
|
||||
|
||||
public List<PmPlatingDemandItem> demandItems(String id) {
|
||||
return items.selectList(new LambdaQueryWrapper<PmPlatingDemandItem>().eq(PmPlatingDemandItem::getDemand_id, id).orderByAsc(PmPlatingDemandItem::getId));
|
||||
}
|
||||
@@ -299,17 +343,11 @@ public class PlatingWorkflowService {
|
||||
public void inboundFinished(String pallet, String structCode) {
|
||||
if (groups.count(new LambdaQueryWrapper<GroupPlate>().eq(GroupPlate::getStoragevehicle_code, pallet)
|
||||
.eq(GroupPlate::getExt_type, SOURCE_TYPE)) == 0) return;
|
||||
SchBasePoint destination = points.getOne(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getPoint_code, structCode).last("for update"));
|
||||
if (destination == null) throw new BadRequestException("配盘入库库位必须配置同编码的AGV点位:" + structCode);
|
||||
if (destination.getVehicle_code() != null && !destination.getVehicle_code().isEmpty()
|
||||
&& !pallet.equals(destination.getVehicle_code())) throw new BadRequestException("入库点位已占用");
|
||||
// 入库服务已将托盘绑定至 Structattr;点位仅清理入库前的旧绑定。
|
||||
points.update(new com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getVehicle_code, pallet).ne(SchBasePoint::getPoint_code, structCode)
|
||||
.set(SchBasePoint::getVehicle_code, null).set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("无货")));
|
||||
destination.setVehicle_code(pallet);
|
||||
destination.setPoint_status(IOSEnum.POINT_STATUS.code("有货"));
|
||||
points.updateById(destination);
|
||||
.eq(SchBasePoint::getVehicle_code, pallet)
|
||||
.set(SchBasePoint::getVehicle_code, null).set(SchBasePoint::getIos_id, null)
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("无货")));
|
||||
}
|
||||
|
||||
private BigDecimal zero(BigDecimal value) {
|
||||
|
||||
@@ -4,12 +4,14 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.constant.RegionConstant;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.sch_manage.service.core.tasks.PlatingDeliveryTask;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@@ -17,26 +19,35 @@ import java.util.List;
|
||||
@Slf4j
|
||||
@Component
|
||||
public class StructAreaDeliveryAutoTask {
|
||||
@Resource private ISchBasePointService points;
|
||||
@Resource private IMdPbGroupplateService groups;
|
||||
@Resource private PlatingDeliveryTask deliveryTask;
|
||||
@Resource
|
||||
private IStructattrService structs;
|
||||
@Resource
|
||||
private IMdPbGroupplateService groups;
|
||||
@Resource
|
||||
private PlatingDeliveryTask deliveryTask;
|
||||
|
||||
public void run() {
|
||||
for (SchBasePoint point : points.getPointList(RegionConstant.FIRST_MEAL)) {
|
||||
if (point.getVehicle_code() == null || point.getVehicle_code().isEmpty()) continue;
|
||||
for (Structattr struct : structs.list(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getIs_used, true)
|
||||
.eq(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.isNotNull(Structattr::getStoragevehicle_code).ne(Structattr::getStoragevehicle_code, "")
|
||||
.eq(Structattr::getSect_code, RegionConstant.EB2)
|
||||
.orderByAsc(Structattr::getStruct_code))) {
|
||||
List<GroupPlate> plates = groups.list(new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getStoragevehicle_code, point.getVehicle_code()));
|
||||
.eq(GroupPlate::getStoragevehicle_code, struct.getStoragevehicle_code())
|
||||
.eq(GroupPlate::getExt_type, org.nl.wms.pm_manage.demand.service.impl.PlatingWorkflowService.SOURCE_TYPE));
|
||||
if (plates.isEmpty() || plates.get(0).getLoad_port() == null) continue;
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", point.getPoint_code());
|
||||
param.put("point_code1", struct.getStruct_code());
|
||||
param.put("point_code2", plates.get(0).getLoad_port());
|
||||
param.put("vehicle_code", point.getVehicle_code()); param.put("Priority", "1");
|
||||
param.put("vehicle_code", struct.getStoragevehicle_code());
|
||||
param.put("Priority", "1");
|
||||
try {
|
||||
deliveryTask.create(param);
|
||||
} catch (org.nl.common.exception.BadRequestException ex) {
|
||||
log.debug("托盘{}暂不配送:{}", point.getVehicle_code(), ex.getMessage());
|
||||
log.debug("库位{}托盘{}暂不配送:{}", struct.getStruct_code(), struct.getStoragevehicle_code(), ex.getMessage());
|
||||
} catch (Exception ex) {
|
||||
log.error("托盘{}创建配送任务失败", point.getVehicle_code(), ex);
|
||||
log.error("库位{}托盘{}创建配送任务失败", struct.getStruct_code(), struct.getStoragevehicle_code(), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.pm_manage.demand.service.impl.PlatingWorkflowService;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.*;
|
||||
@@ -35,13 +36,18 @@ public class PlatingDeliveryTask extends Point2PointTask {
|
||||
String startCode = json.getString("point_code1");
|
||||
String endCode = json.getString("point_code2");
|
||||
String pallet = json.getString("vehicle_code");
|
||||
List<SchBasePoint> locked = points.list(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.in(SchBasePoint::getPoint_code, Arrays.asList(startCode, endCode))
|
||||
.orderByAsc(SchBasePoint::getPoint_code).last("for update"));
|
||||
SchBasePoint start = locked.stream().filter(p -> p.getPoint_code().equals(startCode)).findFirst().orElse(null);
|
||||
SchBasePoint end = locked.stream().filter(p -> p.getPoint_code().equals(endCode)).findFirst().orElse(null);
|
||||
if (start == null || end == null || startCode.equals(endCode) || !pallet.equals(start.getVehicle_code())
|
||||
|| (end.getVehicle_code() != null && !end.getVehicle_code().isEmpty())) throw new BadRequestException("配送点位不可用");
|
||||
if (startCode == null || endCode == null || pallet == null) throw new BadRequestException("配送起点、终点和托盘不能为空");
|
||||
Structattr start = structs.getOne(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getStruct_code, startCode).last("for update"));
|
||||
SchBasePoint end = points.getOne(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getPoint_code, endCode).last("for update"));
|
||||
if (start == null || !Boolean.TRUE.equals(start.getIs_used())
|
||||
|| !IOSEnum.LOCK_TYPE.code("未锁定").equals(start.getLock_type())
|
||||
|| !pallet.equals(start.getStoragevehicle_code())) throw new BadRequestException("配送起始库位不可用或托盘不匹配");
|
||||
if (end == null || startCode.equals(endCode)
|
||||
|| (end.getVehicle_code() != null && !end.getVehicle_code().isEmpty())) throw new BadRequestException("配送终点不可用");
|
||||
if (structs.count(new LambdaQueryWrapper<Structattr>().eq(Structattr::getStoragevehicle_code, pallet)) != 1)
|
||||
throw new BadRequestException("托盘绑定多个库位,请核实");
|
||||
List<SchBaseTask> active = tasks.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.notIn(SchBaseTask::getTask_status, Arrays.asList(TaskStatus.FINISHED.getCode(), TaskStatus.CANCELED.getCode()))
|
||||
.and(q -> q.eq(SchBaseTask::getVehicle_code, pallet)
|
||||
@@ -52,16 +58,12 @@ public class PlatingDeliveryTask extends Point2PointTask {
|
||||
if (plates.isEmpty() || plates.stream().anyMatch(g -> !IOSEnum.GROUP_PLATE_STATUS.code("入库").equals(g.getStatus())
|
||||
|| !PlatingWorkflowService.SOURCE_TYPE.equals(g.getExt_type()) || !endCode.equals(g.getLoad_port())))
|
||||
throw new BadRequestException("配盘物料尚未全部入库或上料口不一致");
|
||||
List<org.nl.wms.pm_manage.demand.service.dao.PmPlatingDemand> pending = workflow.byPort(endCode, true).stream()
|
||||
.filter(d -> pallet.equals(d.getPallet_code())).collect(Collectors.toList());
|
||||
List<org.nl.wms.pm_manage.demand.service.dao.PlatingAllocation> pending = workflow.palletAllocations(pallet);
|
||||
if (pending.isEmpty()) throw new BadRequestException("没有待配送的配盘需求");
|
||||
for (org.nl.wms.pm_manage.demand.service.dao.PmPlatingDemand demand : pending) {
|
||||
for (org.nl.wms.pm_manage.demand.service.dao.PmPlatingDemandItem item : workflow.demandItems(demand.getId())) {
|
||||
if (Objects.equals(item.getIs_ignored(), 1)) continue;
|
||||
java.math.BigDecimal qty = plates.stream().filter(p -> item.getId().equals(p.getExt_dtl_code()))
|
||||
for (org.nl.wms.pm_manage.demand.service.dao.PlatingAllocation allocation : pending) {
|
||||
java.math.BigDecimal qty = plates.stream().filter(p -> allocation.getId().equals(p.getExt_dtl_code()))
|
||||
.map(GroupPlate::getQty).reduce(java.math.BigDecimal.ZERO, java.math.BigDecimal::add);
|
||||
if (qty.compareTo(item.getDemand_qty()) != 0) throw new BadRequestException("需求物料尚未整托入库");
|
||||
}
|
||||
if (qty.compareTo(allocation.getQty()) != 0) throw new BadRequestException("本托配盘物料尚未全部入库");
|
||||
}
|
||||
for (GroupPlate plate : plates) {
|
||||
boolean finished = inboundDetails.selectList(new LambdaQueryWrapper<org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDtl>()
|
||||
@@ -78,6 +80,9 @@ public class PlatingDeliveryTask extends Point2PointTask {
|
||||
json.put("groupIds", plates.stream().map(GroupPlate::getGroup_id).collect(Collectors.toList()));
|
||||
String id = super.create(json);
|
||||
tasks.update(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, id).set(SchBaseTask::getIs_delete, false));
|
||||
structs.update(new LambdaUpdateWrapper<Structattr>().eq(Structattr::getStruct_id, start.getStruct_id())
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("出库锁"))
|
||||
.set(Structattr::getTask_code, tasks.getById(id).getTask_code()));
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -113,12 +118,39 @@ public class PlatingDeliveryTask extends Point2PointTask {
|
||||
List<String> ids = JSONObject.parseObject(task.getRequest_param()).getJSONArray("groupIds").toJavaList(String.class);
|
||||
if (ids.isEmpty()) throw new BadRequestException("配送任务缺少组盘数据");
|
||||
workflow.deliveryFinished(task.getVehicle_code(), task.getPoint_code2());
|
||||
super.finishTask(task);
|
||||
structs.update(new LambdaUpdateWrapper<org.nl.wms.basedata_manage.service.dao.Structattr>()
|
||||
.eq(org.nl.wms.basedata_manage.service.dao.Structattr::getStoragevehicle_code, task.getVehicle_code())
|
||||
.set(org.nl.wms.basedata_manage.service.dao.Structattr::getStoragevehicle_code, null)
|
||||
.set(org.nl.wms.basedata_manage.service.dao.Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定")));
|
||||
releaseStart(task, true);
|
||||
SchBasePoint end = points.getOne(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getPoint_code, task.getPoint_code2()).last("for update"));
|
||||
if (end == null || (end.getVehicle_code() != null && !end.getVehicle_code().isEmpty()
|
||||
&& !task.getVehicle_code().equals(end.getVehicle_code()))) throw new BadRequestException("配送终点已被其他托盘占用");
|
||||
points.update(new LambdaUpdateWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, task.getPoint_code2())
|
||||
.set(SchBasePoint::getVehicle_code, task.getVehicle_code()).set(SchBasePoint::getIos_id, null)
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有货")));
|
||||
task.setTask_status(TaskStatus.FINISHED.getCode()); task.setRemark("已完成"); tasks.updateById(task);
|
||||
groups.update(new LambdaUpdateWrapper<GroupPlate>().in(GroupPlate::getGroup_id, ids)
|
||||
.eq(GroupPlate::getStoragevehicle_code, task.getVehicle_code()).set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")));
|
||||
}
|
||||
|
||||
private void releaseStart(SchBaseTask task, boolean finished) {
|
||||
Structattr start = structs.getOne(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getStruct_code, task.getPoint_code1()).last("for update"));
|
||||
if (start == null || !task.getVehicle_code().equals(start.getStoragevehicle_code())
|
||||
|| !task.getTask_code().equals(start.getTask_code())) throw new BadRequestException("配送起始库位托盘或锁定任务已变化");
|
||||
LambdaUpdateWrapper<Structattr> update = new LambdaUpdateWrapper<Structattr>()
|
||||
.eq(Structattr::getStruct_id, start.getStruct_id())
|
||||
.set(Structattr::getTask_code, null).set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"));
|
||||
if (finished) update.set(Structattr::getStoragevehicle_code, null).set(Structattr::getStoragevehicle_qty, 0)
|
||||
.set(Structattr::getInv_id, null).set(Structattr::getInv_code, null).set(Structattr::getInv_type, null);
|
||||
structs.update(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(SchBaseTask task) {
|
||||
task = lock(task.getTask_code());
|
||||
if (TaskStatus.CANCELED.getCode().equals(task.getTask_status())) return;
|
||||
if (TaskStatus.FINISHED.getCode().equals(task.getTask_status())) throw new BadRequestException("已完成任务不能取消");
|
||||
releaseStart(task, false);
|
||||
super.cancelTask(task);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -748,8 +748,8 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
.set(IOStorInv::getConfirm_time, DateUtil.now())
|
||||
.eq(IOStorInv::getIostorinv_id, disList.get(0).getIostorinv_id())
|
||||
);
|
||||
org.nl.config.SpringContextHolder.getBean(org.nl.wms.pm_manage.demand.service.impl.PlatingWorkflowService.class)
|
||||
.inboundFinished(storagevehicleCode, structCode);
|
||||
// org.nl.config.SpringContextHolder.getBean(org.nl.wms.pm_manage.demand.service.impl.PlatingWorkflowService.class)
|
||||
// .inboundFinished(storagevehicleCode, structCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,16 +14,20 @@
|
||||
<van-cell-group v-if="materialList.length" inset>
|
||||
<div v-for="item in materialList" :key="item.materialCode" class="material-card">
|
||||
<van-cell :title="item.materialCode" :label="`${item.materialName || ''} ${item.spec || ''} (${item.unit || ''})`"/>
|
||||
<van-field v-model="item.qty" type="number" label="本次配盘数量" placeholder="请输入本托盘数量"/>
|
||||
<van-cell title="需求数量" :value="`${item.demandQty} ${item.unit || ''}`"/>
|
||||
<van-field v-model="item.qty" type="number" label="本次配盘数量" :disabled="item.ignored" placeholder="可少配或超配"/>
|
||||
<van-cell title="忽略该物料剩余需求">
|
||||
<template #right-icon><van-switch v-model="item.ignored" size="22"/></template>
|
||||
</van-cell>
|
||||
</div>
|
||||
</van-cell-group>
|
||||
<van-empty v-else description="请查询上料口下可配盘的需求物料"/>
|
||||
<van-divider>未完成需求单(按顺序配盘,同一单不拆托)</van-divider>
|
||||
<van-divider>未完成需求单(按物料顺序分配,支持拆托)</van-divider>
|
||||
<van-cell-group inset>
|
||||
<van-collapse v-model="expanded">
|
||||
<van-collapse-item v-for="demand in demands" :key="demand.id" :name="demand.id"
|
||||
:title="demand.demand_code" :value="demand.pallet_code ? '配盘中' : '待配盘'"
|
||||
:label="`工单:${demand.work_order_code}${demand.pallet_code ? ' | 托盘:' + demand.pallet_code : ''}`">
|
||||
:title="demand.demand_code" :value="demand.status === 1 ? '配盘中' : '待配盘'"
|
||||
:label="`工单:${demand.work_order_code}`">
|
||||
<div v-for="item in demand.items" :key="item.id" class="demand-item">
|
||||
{{ item.material_code }} {{ item.material_name }}:{{ item.demand_qty }} {{ item.unit }}
|
||||
<span v-if="item.is_ignored === 1">(已忽略)</span>
|
||||
@@ -31,7 +35,7 @@
|
||||
</van-collapse-item>
|
||||
</van-collapse>
|
||||
</van-cell-group>
|
||||
<p class="hint">本次数量须覆盖顺序排列的完整需求单。提交后到“平库出库”确认原料出库,再进行手工入库或 AGV 入库。</p>
|
||||
<p class="hint">需求数量为未忽略物料的原始需求合计。本次数量按剩余需求依次分配,超出部分计入最后一张包含该物料的需求单;支持少配和拆托。忽略仅免除未配部分,已配物料仍需配送。</p>
|
||||
<BottomButton text="完成配盘" :loading="submitting" @click="complete"/>
|
||||
</div>
|
||||
<van-popup v-model:show="showStores" position="bottom">
|
||||
@@ -80,11 +84,12 @@ async function query() {
|
||||
demands.value = res.data || []
|
||||
queriedPort.value = port
|
||||
const map = new Map()
|
||||
for (const demand of demands.value.filter(d => !d.pallet_code)) {
|
||||
for (const demand of demands.value) {
|
||||
for (const item of demand.items.filter(i => i.is_ignored !== 1)) {
|
||||
if (!map.has(item.material_code)) map.set(item.material_code, {
|
||||
materialCode: item.material_code, materialName: item.material_name, spec: item.spec, unit: item.unit, qty: '',
|
||||
materialCode: item.material_code, materialName: item.material_name, spec: item.spec, unit: item.unit, qty: '', demandQty: 0, ignored: false,
|
||||
})
|
||||
map.get(item.material_code).demandQty = Number((map.get(item.material_code).demandQty + Number(item.demand_qty || 0)).toFixed(8))
|
||||
}
|
||||
}
|
||||
materialList.value = [...map.values()]
|
||||
@@ -96,15 +101,15 @@ async function complete() {
|
||||
if (submitting.value || loading.value) return
|
||||
if (!store.value || !sector.value || !queriedPort.value || queriedPort.value !== loadPort.value.trim() || !palletCode.value.trim())
|
||||
return showToast('请选择仓库、库区,查询上料口并扫描托盘')
|
||||
const items = materialList.value.map(i => ({materialCode: i.materialCode, qty: i.qty || '0'}))
|
||||
if (!items.some(i => Number(i.qty) > 0) || items.some(i => !Number.isFinite(Number(i.qty)) || Number(i.qty) < 0))
|
||||
return showToast('请填写有效的本次配盘数量')
|
||||
const items = materialList.value.map(i => ({materialCode: i.materialCode, qty: i.ignored ? '0' : i.qty || '0', ignored: i.ignored}))
|
||||
if (!items.some(i => Number(i.qty) > 0 || i.ignored) || items.some(i => !Number.isFinite(Number(i.qty)) || Number(i.qty) < 0))
|
||||
return showToast('请填写有效数量或选择忽略物料')
|
||||
const payload = {storeCode: store.value.code, sectCode: sector.value.sect_code, loadPort: queriedPort.value, palletCode: palletCode.value.trim(), items}
|
||||
submitting.value = true
|
||||
try {
|
||||
await showConfirmDialog({title: '完成配盘', message: '将预分配原料库存并绑定需求单与托盘,随后需在平库出库确认,是否继续?'})
|
||||
await showConfirmDialog({title: '完成配盘', message: '按本次数量分配,超量计入最后一单。勾选忽略将免除该上料口未完成需求单中对应物料的未配需求,已配数量不受影响。确认继续?'})
|
||||
const res = await request.post('/api/pda/platingDemand/allocate', payload)
|
||||
showToast({message: `配盘成功,出库单:${res.data},请前往平库出库确认`, duration: 5000})
|
||||
showToast({message: items.some(i => Number(i.qty) > 0) ? `配盘成功,出库单:${res.data},请前往平库出库确认` : res.data, duration: 5000})
|
||||
palletCode.value = ''
|
||||
submitting.value = false
|
||||
await query()
|
||||
|
||||
21
sql/pm_plating_split_upgrade.sql
Normal file
21
sql/pm_plating_split_upgrade.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
CREATE TABLE pm_plating_allocation (
|
||||
id varchar(64) NOT NULL PRIMARY KEY,
|
||||
demand_id varchar(64) NOT NULL,
|
||||
item_id varchar(64) NOT NULL,
|
||||
pallet_code varchar(100) NOT NULL,
|
||||
outbound_id varchar(64) NOT NULL,
|
||||
warehouse_code varchar(100) NOT NULL,
|
||||
qty decimal(20,8) NOT NULL,
|
||||
delivered tinyint NOT NULL DEFAULT 0,
|
||||
KEY idx_pallet (pallet_code, delivered),
|
||||
KEY idx_bill (outbound_id),
|
||||
KEY idx_demand (demand_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='每次配盘托盘需求分配台账';
|
||||
|
||||
-- 升级前暂停配盘/配送任务;旧版每条需求物料仅对应一次分配,沿用明细ID以兼容已有组盘关联。
|
||||
INSERT INTO pm_plating_allocation (id,demand_id,item_id,pallet_code,outbound_id,warehouse_code,qty,delivered)
|
||||
SELECT i.id,d.id,i.id,d.pallet_code,d.outbound_id,d.source_warehouse,i.allocated_qty,
|
||||
CASE WHEN i.outbound_qty >= i.allocated_qty THEN 1 ELSE 0 END
|
||||
FROM pm_plating_demand d JOIN pm_plating_demand_item i ON i.demand_id=d.id
|
||||
WHERE d.outbound_id IS NOT NULL AND d.source_warehouse IS NOT NULL
|
||||
AND d.pallet_code IS NOT NULL AND i.allocated_qty > 0;
|
||||
@@ -1,8 +1,25 @@
|
||||
# 配盘流程升级
|
||||
|
||||
## 库位起点配送
|
||||
- 定时任务从已启用、未锁定且绑定托盘的 `Structattr` 查询候选起点,仅处理配盘来源组盘;不再依赖点位区域筛选。
|
||||
- 任务 `point_code1` 保存 `struct_code`(沿用任务通用字段),ACS `start_device_code` 直接发送该库位编码。终点仍为 `load_port` 点位。
|
||||
- 入库完成仅由入库服务维护库位托盘绑定,并清理旧点位绑定,不要求配置同编码点位。
|
||||
- 创建配送任务锁定源库位并写入任务号;完成时核对源库位、托盘、锁定任务,释放准确的源库位并绑定终点;取消时只解除源库位任务锁,保留托盘和组盘。
|
||||
- 部署前处理旧版已创建但未完成的点位起点配送任务,再启用新版调度;旧任务不自动转换为库位任务。
|
||||
|
||||
## 2026-10-18 拆托及忽略规则(替代下文旧版整单规则)
|
||||
- 部署前执行一次 `pm_plating_split_upgrade.sql`(依赖前一版的需求表及 outbound_qty 等字段);脚本新增每托分配台账并迁移旧版关联。新建环境同样执行该脚本,空表不会迁移数据。
|
||||
- 每种物料独立按需求单创建顺序填充 `max(需求量 - 已配量, 0)`,可少配、拆托;剩余超配量累加到最后一张包含该有效物料的未完成需求单。原始需求量保持不变,已配量允许超过需求量。
|
||||
- 页面本次数量上方展示未完成需求单中未忽略物料的原始需求总量。
|
||||
- 忽略作用于当前上料口所有未完成需求单中的对应物料,仅免除未配需求。已配部分仍需原料出库、入库、配送及EAS回传;支持仅提交忽略,不创建空出库单。
|
||||
- 每次配盘分别记录托盘、需求明细、数量、实际来源仓库及原料出库单;组盘来源明细和内部批次使用本次分配ID。需求主表托盘/出库单字段仅保留最近一次信息,不再作为处理依据。
|
||||
- 每托配送只回传该托分配数量;未忽略明细须已出库量达到 max(原始需求量, 累计已配量),忽略明细须已出库量达到累计已配量,整单才完成。
|
||||
- 验收:两单同物料需求10、20,输入5应分配5/0;再输入40应分配5/35,累计10/35;三个托盘分别配送只累计各托数量,重复回调不重复回传。
|
||||
- 验收:某物料已配5、需求10后选择忽略,不能提前完成,必须等待已配5配送完成;未配物料忽略后不生成出库或回传记录。
|
||||
|
||||
## 部署
|
||||
- 已建表环境先执行 `pm_plating_delivery_upgrade.sql`;新环境执行包含新字段的 `pm_plating_demand.sql`,不要重复执行增量脚本。
|
||||
- 入库库位必须有同编码 AGV 点位,并归属 `RegionConstant.FIRST_MEAL` 对应区域;配送终点为扫描的上料口点位。
|
||||
- 入库库位编码须为 ACS 可识别的取货位置,无需同编码 AGV 点位;配送终点为扫描的上料口点位。
|
||||
- 配盘原料库区须为启用的平库,配置出库分配策略;配盘入库库区需配置入库策略。
|
||||
- 保持现有 `StructAreaDeliveryAutoTask.run` 调度启用和 EAS 待回传队列处理任务启用。
|
||||
- 历史部分配盘/已完成需求不自动转换,投产前需核对历史托盘、库存及 EAS 回传状态。
|
||||
|
||||
Reference in New Issue
Block a user