no message
parent
1f2cc6c64c
commit
7adee5771f
|
|
@ -5,6 +5,9 @@ import net.lab1024.sa.admin.module.business.wms.inventory.inventory.domain.form.
|
|||
import net.lab1024.sa.admin.module.business.wms.inventory.inventory.domain.vo.InventoryVO;
|
||||
import net.lab1024.sa.base.common.domain.PageResult;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface InventoryQueryService {
|
||||
|
||||
/**
|
||||
|
|
@ -13,8 +16,15 @@ public interface InventoryQueryService {
|
|||
PageResult<InventoryVO> queryPage(InventoryQueryForm queryForm);
|
||||
|
||||
/**
|
||||
* @param ItemKeyId 物料
|
||||
* @param ItemKeyId 物料属性
|
||||
* @return InventoryEntity
|
||||
*/
|
||||
InventoryEntity queryInventoryByItemKeyId(Long ItemKeyId);
|
||||
|
||||
/**
|
||||
* @param itemIds 物料
|
||||
* @return InventoryEntity
|
||||
*/
|
||||
List<InventoryEntity> queryInventoryByItemIds(List<Long> itemIds);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package net.lab1024.sa.admin.module.business.wms.inventory.inventory.service.imp
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.Maps;
|
||||
import jakarta.annotation.Resource;
|
||||
import net.lab1024.sa.admin.module.business.wms.base.item.domain.entity.ItemEntity;
|
||||
import net.lab1024.sa.admin.module.business.wms.base.item.service.ItemQueryService;
|
||||
|
|
@ -19,10 +20,13 @@ import net.lab1024.sa.admin.module.business.wms.inventory.itemKey.domain.entity.
|
|||
import net.lab1024.sa.admin.module.business.wms.inventory.itemKey.service.ItemKeyQueryService;
|
||||
import net.lab1024.sa.base.common.domain.PageResult;
|
||||
import net.lab1024.sa.base.common.util.SmartPageUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class InventoryQueryServiceImpl implements InventoryQueryService {
|
||||
|
|
@ -90,7 +94,7 @@ public class InventoryQueryServiceImpl implements InventoryQueryService {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param ItemKeyId 物料
|
||||
* @param ItemKeyId 物料属性
|
||||
* @return InventoryEntity
|
||||
*/
|
||||
public InventoryEntity queryInventoryByItemKeyId(Long ItemKeyId) {
|
||||
|
|
@ -98,4 +102,22 @@ public class InventoryQueryServiceImpl implements InventoryQueryService {
|
|||
queryWrapper.eq(InventoryEntity::getItemKeyId, ItemKeyId);
|
||||
return inventoryManager.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemIds 物料
|
||||
* @return List<InventoryEntity>
|
||||
*/
|
||||
public List<InventoryEntity> queryInventoryByItemIds(List<Long> itemIds) {
|
||||
if (CollectionUtils.isEmpty(itemIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<ItemKeyEntity> itemKeys = itemKeyQueryService.queryItemKeys(itemIds);
|
||||
if (CollectionUtils.isEmpty(itemKeys)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<Long> itemKeyIds = itemKeys.stream().map(ItemKeyEntity::getItemKeyId).toList();
|
||||
LambdaQueryWrapper<InventoryEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(InventoryEntity::getItemKeyId, itemKeyIds).apply("quantity - queued_quantity > 0");;
|
||||
return inventoryManager.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,4 +33,13 @@ public interface ItemKeyQueryService {
|
|||
* @return ItemKeyEntity
|
||||
*/
|
||||
ItemKeyEntity queryItemKey(String orderNumber, Long itemId, String propC1);
|
||||
|
||||
/**
|
||||
* 根据物料ID查询物料属性信息
|
||||
*
|
||||
* @param itemIds 物料
|
||||
* @return List<ItemKeyEntity>
|
||||
*/
|
||||
List<ItemKeyEntity> queryItemKeys(List<Long> itemIds);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,4 +70,14 @@ public class ItemKeyQueryServiceImpl implements ItemKeyQueryService {
|
|||
}
|
||||
return itemKeys.get(0);
|
||||
}
|
||||
|
||||
public List<ItemKeyEntity> queryItemKeys(List<Long> itemIds) {
|
||||
if (CollectionUtils.isEmpty(itemIds)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
itemIds = itemIds.stream().filter(Objects::nonNull).distinct().toList();
|
||||
LambdaQueryWrapper<ItemKeyEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(ItemKeyEntity::getItemId, itemIds);
|
||||
return itemKeyManager.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.form.BatchReceiveForm;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.form.BatchReturnForm;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.service.ReceiveService;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.asn.domain.form.BatchReceiveForm;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.asn.domain.form.BatchReturnForm;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import net.lab1024.sa.base.module.support.operatelog.annotation.OperateLog;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
package net.lab1024.sa.admin.module.business.wms.receive.asn.domain.form;
|
||||
package net.lab1024.sa.admin.module.business.wms.receive.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package net.lab1024.sa.admin.module.business.wms.receive.asn.domain.form;
|
||||
package net.lab1024.sa.admin.module.business.wms.receive.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package net.lab1024.sa.admin.module.business.wms.receive.service;
|
||||
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.asn.domain.form.BatchReceiveForm;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.asn.domain.form.BatchReturnForm;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.form.BatchReceiveForm;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.form.BatchReturnForm;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
|
||||
public interface ReceiveService {
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ import net.lab1024.sa.admin.module.business.wms.inventory.inventory.service.Inve
|
|||
import net.lab1024.sa.admin.module.business.wms.inventory.itemKey.domain.entity.ItemKeyEntity;
|
||||
import net.lab1024.sa.admin.module.business.wms.inventory.itemKey.service.ItemKeyService;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.asn.domain.entity.AsnEntity;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.asn.domain.form.BatchReceiveForm;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.asn.domain.form.BatchReturnForm;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.asn.manager.AsnManager;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.asnDetail.domain.entity.AsnDetailEntity;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.asnDetail.manager.AsnDetailManager;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.asnDetail.service.AsnDetailQueryService;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.asnDetail.service.AsnDetailService;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.form.BatchReceiveForm;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.form.BatchReturnForm;
|
||||
import net.lab1024.sa.admin.module.business.wms.receive.service.ReceiveService;
|
||||
import net.lab1024.sa.admin.module.business.wms.task.constant.TaskStatusEnum;
|
||||
import net.lab1024.sa.admin.module.business.wms.task.constant.TaskTypeEnum;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
package net.lab1024.sa.admin.module.business.wms.shipping.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import net.lab1024.sa.admin.module.business.wms.shipping.form.AllocationForm;
|
||||
import net.lab1024.sa.admin.module.business.wms.shipping.service.ShippingService;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import net.lab1024.sa.base.module.support.operatelog.annotation.OperateLog;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@Tag(name = "发货")
|
||||
public class ShippingController {
|
||||
|
||||
@Resource
|
||||
private ShippingService shippingService;
|
||||
|
||||
@Operation(summary = "分配明细 @author 霍锦")
|
||||
@PostMapping("/shipping/allocationPickDetail")
|
||||
@SaCheckPermission("shipping:allocationPickDetail")
|
||||
@OperateLog
|
||||
public ResponseDTO<String> allocationPickDetail(@RequestBody AllocationForm allocationForm) {
|
||||
return shippingService.allocationPickDetail(allocationForm);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package net.lab1024.sa.admin.module.business.wms.shipping.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AllocationForm {
|
||||
|
||||
@Schema(description = "出库单", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "出库单 不能为空")
|
||||
private Long pickId;
|
||||
|
||||
@Schema(description = "出库明细", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "出库明细 不能为空")
|
||||
private List<Long> pickDetailIds;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package net.lab1024.sa.admin.module.business.wms.shipping.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BatchReturnForm {
|
||||
@Schema(description = "入库单", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "入库单 不能为空")
|
||||
private Long asnId;
|
||||
|
||||
@Schema(description = "收货明细", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "收货明细 不能为空")
|
||||
private List<Long> taskIds;
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package net.lab1024.sa.admin.module.business.wms.shipping.pick.domain.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import net.lab1024.sa.base.common.domain.PageParam;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
|
@ -15,5 +16,13 @@ import lombok.EqualsAndHashCode;
|
|||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class PickQueryForm extends PageParam {
|
||||
@Schema(description = "客户订单号")
|
||||
private String customerNumber;
|
||||
|
||||
@Schema(description = "状态")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "单据类型")
|
||||
private String orderType;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||
import net.lab1024.sa.base.common.domain.PageParam;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
/**
|
||||
* 出库明细 分页查询表单
|
||||
|
|
@ -20,6 +21,7 @@ public class PickDetailQueryForm extends PageParam {
|
|||
@Schema(description = "出库单")
|
||||
private Long pickId;
|
||||
|
||||
@Schema(description = "物料")
|
||||
private Long itemId;
|
||||
@Schema(description = "关键字")
|
||||
@Length(max = 200, message = "关键字最多200字符")
|
||||
private String keywords;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,4 +35,10 @@ public interface PickDetailService {
|
|||
* 单个删除
|
||||
*/
|
||||
ResponseDTO<String> delete(Long pickDetailId);
|
||||
|
||||
/**
|
||||
* 刷新出库单
|
||||
* @param pickId 出库单ID
|
||||
*/
|
||||
void refreshPick(Long pickId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package net.lab1024.sa.admin.module.business.wms.shipping.service;
|
||||
|
||||
import net.lab1024.sa.admin.module.business.wms.shipping.form.AllocationForm;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
|
||||
public interface ShippingService {
|
||||
|
||||
/**
|
||||
* 分配明细
|
||||
* @return String
|
||||
*/
|
||||
ResponseDTO<String> allocationPickDetail(AllocationForm allocationForm);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,182 @@
|
|||
package net.lab1024.sa.admin.module.business.wms.shipping.service.impl;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.lab1024.sa.admin.module.business.wms.base.item.domain.entity.ItemEntity;
|
||||
import net.lab1024.sa.admin.module.business.wms.base.item.manager.ItemManager;
|
||||
import net.lab1024.sa.admin.module.business.wms.base.item.service.ItemQueryService;
|
||||
import net.lab1024.sa.admin.module.business.wms.base.location.domain.entity.LocationEntity;
|
||||
import net.lab1024.sa.admin.module.business.wms.base.location.manager.LocationManager;
|
||||
import net.lab1024.sa.admin.module.business.wms.base.stock.domain.entity.StockEntity;
|
||||
import net.lab1024.sa.admin.module.business.wms.base.stock.manager.StockManager;
|
||||
import net.lab1024.sa.admin.module.business.wms.inventory.inventory.domain.entity.InventoryEntity;
|
||||
import net.lab1024.sa.admin.module.business.wms.inventory.inventory.manager.InventoryManager;
|
||||
import net.lab1024.sa.admin.module.business.wms.inventory.inventory.service.InventoryQueryService;
|
||||
import net.lab1024.sa.admin.module.business.wms.shipping.form.AllocationForm;
|
||||
import net.lab1024.sa.admin.module.business.wms.shipping.pick.domain.entity.PickEntity;
|
||||
import net.lab1024.sa.admin.module.business.wms.shipping.pick.manager.PickManager;
|
||||
import net.lab1024.sa.admin.module.business.wms.shipping.pickDetail.domain.entity.PickDetailEntity;
|
||||
import net.lab1024.sa.admin.module.business.wms.shipping.pickDetail.manager.PickDetailManager;
|
||||
import net.lab1024.sa.admin.module.business.wms.shipping.pickDetail.service.PickDetailService;
|
||||
import net.lab1024.sa.admin.module.business.wms.shipping.service.ShippingService;
|
||||
import net.lab1024.sa.admin.module.business.wms.task.constant.TaskStatusEnum;
|
||||
import net.lab1024.sa.admin.module.business.wms.task.constant.TaskTypeEnum;
|
||||
import net.lab1024.sa.admin.module.business.wms.task.domain.entity.TaskEntity;
|
||||
import net.lab1024.sa.admin.module.business.wms.task.manager.TaskManager;
|
||||
import net.lab1024.sa.admin.module.business.wms.task.service.TaskService;
|
||||
import net.lab1024.sa.admin.util.JoinerResult;
|
||||
import net.lab1024.sa.admin.util.ResponseDTOUtil;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import net.lab1024.sa.base.common.util.SmartBigDecimalUtil;
|
||||
import net.lab1024.sa.base.module.support.datatracer.service.DataTracerService;
|
||||
import net.lab1024.sa.base.module.support.serialnumber.constant.SerialNumberIdEnum;
|
||||
import net.lab1024.sa.base.module.support.serialnumber.service.SerialNumberService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ShippingServiceImpl implements ShippingService {
|
||||
|
||||
@Resource
|
||||
private LocationManager locationManager;
|
||||
|
||||
@Resource
|
||||
private StockManager stockManager;
|
||||
|
||||
@Resource
|
||||
private PickManager pickManager;
|
||||
|
||||
@Resource
|
||||
private PickDetailManager pickDetailManager;
|
||||
|
||||
@Resource
|
||||
private TaskManager taskManager;
|
||||
|
||||
@Resource
|
||||
private InventoryManager inventoryManager;
|
||||
|
||||
@Resource
|
||||
private ItemQueryService itemQueryService;
|
||||
|
||||
@Resource
|
||||
private InventoryQueryService inventoryQueryService;
|
||||
|
||||
@Resource
|
||||
private PickDetailService pickDetailService;
|
||||
|
||||
@Resource
|
||||
private TaskService taskService;
|
||||
|
||||
@Resource
|
||||
private SerialNumberService serialNumberService;
|
||||
|
||||
@Resource
|
||||
private DataTracerService dataTracerService;
|
||||
|
||||
|
||||
/**
|
||||
* 分配明细
|
||||
*
|
||||
* @param allocationForm 分配明细参数
|
||||
* @return resultMsg
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseDTO<String> allocationPickDetail(AllocationForm allocationForm) {
|
||||
Long startTime = System.currentTimeMillis();
|
||||
|
||||
//消息提示
|
||||
JoinerResult resultMsg = JoinerResult.createJoiner();
|
||||
|
||||
//出库单
|
||||
PickEntity pick = pickManager.getById(allocationForm.getPickId());
|
||||
|
||||
//出库单明细
|
||||
List<PickDetailEntity> pickDetails = pickDetailManager.listByIds(allocationForm.getPickDetailIds());
|
||||
|
||||
//查询物料
|
||||
List<Long> itemIds = pickDetails.stream().map(PickDetailEntity::getItemId).toList();
|
||||
Map<Long, ItemEntity> itemMap = itemQueryService.queryByItemIdsToMap(itemIds);
|
||||
|
||||
//查询库存
|
||||
List<InventoryEntity> inventoryList = inventoryQueryService.queryInventoryByItemIds(itemIds);
|
||||
if (inventoryList.isEmpty()) {
|
||||
List<String> codes = itemMap.values().stream().map(ItemEntity::getItemCode).toList();
|
||||
resultMsg.getErrorMsg().add(codes + "物料库存不足,请先补充库存!");
|
||||
return ResponseDTOUtil.buildResponseDTO(resultMsg);
|
||||
}
|
||||
|
||||
List<InventoryEntity> updateToInventory = new ArrayList<>();
|
||||
List<PickDetailEntity> updateToPickDetail = new ArrayList<>();
|
||||
List<TaskEntity> createToTask = new ArrayList<>();
|
||||
|
||||
for (PickDetailEntity pickDetail : pickDetails) {
|
||||
//物料
|
||||
ItemEntity item = itemMap.get(pickDetail.getItemId());
|
||||
|
||||
BigDecimal unQty = SmartBigDecimalUtil.subtract(pickDetail.getOrderQuantity(), pickDetail.getAllocatedQuantity(), 2);
|
||||
if (unQty.compareTo(BigDecimal.ZERO) == 0) {
|
||||
resultMsg.getErrorMsg().add(item.getItemCode() + "物料已分配,请勿重复操作!");
|
||||
continue;
|
||||
}
|
||||
//分配数量
|
||||
BigDecimal allocateQty = BigDecimal.ZERO;
|
||||
|
||||
//库存
|
||||
for (InventoryEntity inventory : inventoryList) {
|
||||
//库存可用数量
|
||||
allocateQty = SmartBigDecimalUtil.subtract(inventory.getQuantity(), inventory.getQueuedQuantity(), 2);
|
||||
if (allocateQty.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
continue;
|
||||
}
|
||||
if (unQty.compareTo(allocateQty) < 0) {
|
||||
allocateQty = unQty;
|
||||
}
|
||||
//更新库存占用数量
|
||||
inventory.setQueuedQuantity(SmartBigDecimalUtil.add(inventory.getQueuedQuantity(), allocateQty, 2));
|
||||
updateToInventory.add(inventory);
|
||||
//更新明细分配数量
|
||||
pickDetail.setAllocatedQuantity(SmartBigDecimalUtil.add(pickDetail.getAllocatedQuantity(), allocateQty, 2));
|
||||
updateToPickDetail.add(pickDetail);
|
||||
//容器
|
||||
StockEntity stock = stockManager.queryStock(inventory.getStockId());
|
||||
//库位
|
||||
LocationEntity location = locationManager.queryLocation(inventory.getLocationId());
|
||||
//生成分配任务
|
||||
TaskEntity task = taskService.createTask(serialNumberService.generate(SerialNumberIdEnum.TASK), TaskStatusEnum.CREATED.getValue(), TaskTypeEnum.PICK.getValue(), pickDetail.getOrderQuantity(), inventory.getItemKeyId(), null, pickDetail.getPickDetailId(), stock, null, location, null, null, null);
|
||||
createToTask.add(task);
|
||||
unQty = SmartBigDecimalUtil.subtract(unQty, allocateQty, 2);
|
||||
}
|
||||
if (unQty.compareTo(BigDecimal.ZERO) > 0) {
|
||||
resultMsg.getErrorMsg().add(item.getItemCode() + "物料库存不足,无法完成分配!");
|
||||
} else {
|
||||
resultMsg.getSussMsg().add(item.getItemCode() + "物料分配成功");
|
||||
}
|
||||
}
|
||||
|
||||
//批量操作
|
||||
if (CollectionUtils.isNotEmpty(updateToInventory)) {
|
||||
inventoryManager.updateBatchById(updateToInventory);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(updateToPickDetail)) {
|
||||
pickDetailManager.updateBatchById(updateToPickDetail);
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(createToTask)) {
|
||||
taskManager.saveBatch(createToTask);
|
||||
}
|
||||
|
||||
//刷新出库单
|
||||
pickDetailService.refreshPick(pick.getPickId());
|
||||
|
||||
Long endTime = System.currentTimeMillis();
|
||||
log.info("分配明细耗时:{}ms", endTime - startTime);
|
||||
return ResponseDTOUtil.buildResponseDTO(resultMsg);
|
||||
}
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
<where>
|
||||
<!--客户订单号-->
|
||||
<if test="queryForm.customerNumber != null and queryForm.customerNumber != ''">
|
||||
AND INSTR(t_asn.customer_number,#{queryForm.customerNumber})
|
||||
AND t_asn.customer_number LIKE CONCAT(#{queryForm.customerNumber},'%')
|
||||
</if>
|
||||
<!--单据类型-->
|
||||
<if test="queryForm.orderType != null and queryForm.orderType != ''">
|
||||
|
|
|
|||
|
|
@ -15,47 +15,23 @@
|
|||
<!-- 分页查询 -->
|
||||
<select id="queryPage"
|
||||
resultType="net.lab1024.sa.admin.module.business.wms.receive.asnDetail.domain.vo.AsnDetailVO">
|
||||
<choose>
|
||||
<when test="queryForm.keywords != null and queryForm.keywords != ''">
|
||||
SELECT
|
||||
<include refid="base_columns"/>
|
||||
FROM t_asn_detail
|
||||
JOIN t_item ON t_asn_detail.item_id = t_item.item_id
|
||||
<where>
|
||||
t_item.item_code LIKE CONCAT(#{queryForm.keywords}, '%')
|
||||
<if test="queryForm.asnId != null">
|
||||
AND t_asn_detail.asn_id = #{queryForm.asnId}
|
||||
</if>
|
||||
</where>
|
||||
UNION ALL
|
||||
SELECT
|
||||
<include refid="base_columns"/>
|
||||
FROM t_asn_detail
|
||||
JOIN t_item ON t_asn_detail.item_id = t_item.item_id
|
||||
<where>
|
||||
t_item.item_name LIKE CONCAT(#{queryForm.keywords}, '%')
|
||||
<if test="queryForm.asnId != null">
|
||||
AND t_asn_detail.asn_id = #{queryForm.asnId}
|
||||
</if>
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM t_item
|
||||
WHERE t_item.item_id = t_asn_detail.item_id
|
||||
AND t_item.item_code LIKE CONCAT(#{queryForm.keywords}, '%')
|
||||
)
|
||||
</where>
|
||||
</when>
|
||||
<otherwise>
|
||||
SELECT
|
||||
<include refid="base_columns"/>
|
||||
FROM t_asn_detail
|
||||
<where>
|
||||
<if test="queryForm.asnId != null">
|
||||
t_asn_detail.asn_id = #{queryForm.asnId}
|
||||
</if>
|
||||
</where>
|
||||
</otherwise>
|
||||
</choose>
|
||||
SELECT
|
||||
<include refid="base_columns"/>
|
||||
FROM t_asn_detail
|
||||
<if test="queryForm.keywords != null and queryForm.keywords != ''">
|
||||
LEFT JOIN t_item ON t_asn_detail.item_id = t_item.item_id
|
||||
</if>
|
||||
<where>
|
||||
<if test="queryForm.asnId != null">
|
||||
AND t_asn_detail.asn_id = #{queryForm.asnId}
|
||||
</if>
|
||||
<if test="queryForm.keywords != null and queryForm.keywords != ''">
|
||||
AND (
|
||||
t_item.item_code LIKE CONCAT(#{queryForm.keywords}, '%')
|
||||
OR t_item.item_name LIKE CONCAT(#{queryForm.keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,21 @@
|
|||
SELECT
|
||||
<include refid="base_columns"/>
|
||||
FROM t_pick
|
||||
<where>
|
||||
<!--客户订单号-->
|
||||
<if test="queryForm.customerNumber != null and queryForm.customerNumber != ''">
|
||||
AND t_pick.customer_number LIKE CONCAT(#{queryForm.customerNumber},'%')
|
||||
</if>
|
||||
<!--单据类型-->
|
||||
<if test="queryForm.orderType != null and queryForm.orderType != ''">
|
||||
AND t_pick.order_type=#{queryForm.orderType}
|
||||
</if>
|
||||
<!--状态-->
|
||||
<if test="queryForm.status != null and queryForm.status != ''">
|
||||
AND t_pick.status=#{queryForm.status}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY t_pick.pick_id DESC
|
||||
</select>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,20 @@
|
|||
SELECT
|
||||
<include refid="base_columns"/>
|
||||
FROM t_pick_detail
|
||||
<if test="queryForm.keywords != null and queryForm.keywords != ''">
|
||||
LEFT JOIN t_item ON t_pick_detail.item_id = t_item.item_id
|
||||
</if>
|
||||
<where>
|
||||
<if test="queryForm.pickId != null">
|
||||
AND t_pick_detail.pick_id = #{queryForm.pickId}
|
||||
</if>
|
||||
<if test="queryForm.keywords != null and queryForm.keywords != ''">
|
||||
AND (
|
||||
t_item.item_code LIKE CONCAT(#{queryForm.keywords}, '%')
|
||||
OR t_item.item_name LIKE CONCAT(#{queryForm.keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,21 +32,40 @@
|
|||
SELECT
|
||||
<include refid="base_columns"/>
|
||||
FROM t_task
|
||||
<!--入库单-->
|
||||
<if test="queryForm.asnId != null ">
|
||||
LEFT JOIN t_asn_detail on t_asn_detail.asn_detail_id = t_task.asn_detail_id
|
||||
LEFT JOIN t_item on t_item.item_id = t_asn_detail.item_id
|
||||
</if>
|
||||
<!--出库单-->
|
||||
<if test="queryForm.pickId != null ">
|
||||
LEFT JOIN t_pick_detail on t_pick_detail.pick_detail_id = t_task.pick_detail_id
|
||||
LEFT JOIN t_item on t_item.item_id = t_pick_detail.item_id
|
||||
</if>
|
||||
<where>
|
||||
<!--入库单-->
|
||||
<if test="queryForm.asnId != null ">
|
||||
AND t_task.asn_detail_id in (select asn_detail_id from t_asn_detail where asn_id = #{queryForm.asnId})
|
||||
AND t_asn_detail.asn_id= #{queryForm.asnId}
|
||||
</if>
|
||||
|
||||
<!--出库单-->
|
||||
<if test="queryForm.pickId != null ">
|
||||
AND t_task.pick_detail_id in (select pick_detail_id from t_pick_detail where pick_id =#{queryForm.pickId})
|
||||
AND t_pick_detail.pick_id= #{queryForm.pickId}
|
||||
</if>
|
||||
|
||||
<!--任务类型-->
|
||||
<if test="queryForm.taskType != null and queryForm.taskType != ''">
|
||||
AND t_task.task_type = #{queryForm.taskType}
|
||||
</if>
|
||||
|
||||
<!--关键字-->
|
||||
<if test="queryForm.asnId != null and queryForm.keywords !=null and queryForm.keywords!= ''">
|
||||
AND (t_item.item_code LIKE CONCAT(#{queryForm.keywords}, '%')
|
||||
OR t_item.item_name LIKE CONCAT(#{queryForm.keywords}, '%')
|
||||
OR t_task.dst_location_code LIKE CONCAT(#{queryForm.keywords}, '%')
|
||||
OR t_task.dst_stock_code LIKE CONCAT(#{queryForm.keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue