no message
parent
21c8253ce3
commit
4be352634c
|
|
@ -65,7 +65,7 @@ public interface IInventoryService extends IService<Inventory> {
|
|||
|
||||
/**
|
||||
* 移动库存
|
||||
* @param tasks 移位任务
|
||||
* 容器、起点、目标库位
|
||||
*/
|
||||
void moveInventory(List<Task> tasks);
|
||||
void moveInventory(String stockCode,String startCode,String endCode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.cpte.modules.base.entity.Point;
|
||||
import org.cpte.modules.base.entity.Stock;
|
||||
import org.cpte.modules.base.mapper.PointMapper;
|
||||
import org.cpte.modules.base.mapper.StockMapper;
|
||||
import org.cpte.modules.constant.enums.CommonStatusEnum;
|
||||
import org.cpte.modules.constant.enums.InventoryStatusEnum;
|
||||
import org.cpte.modules.inventory.entity.Inventory;
|
||||
|
|
@ -14,7 +16,6 @@ import org.cpte.modules.inventory.mapper.InventoryMapper;
|
|||
import org.cpte.modules.inventory.service.IInventoryService;
|
||||
import org.cpte.modules.receive.entity.Asn;
|
||||
import org.cpte.modules.receive.entity.ReceiveRecord;
|
||||
import org.cpte.modules.shipping.entity.Task;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -35,6 +36,9 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
|
|||
@Autowired
|
||||
private PointMapper pointMapper;
|
||||
|
||||
@Autowired
|
||||
private StockMapper stockMapper;
|
||||
|
||||
@Override
|
||||
public IPage<Inventory> selectInventoryWithItemKey(Page<Inventory> page, Inventory inventory) {
|
||||
QueryWrapper<Inventory> queryWrapper = new QueryWrapper<>();
|
||||
|
|
@ -48,7 +52,7 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
|
|||
if (oConvertUtils.isNotEmpty(inventory.getStockId())) {
|
||||
queryWrapper.eq("inventory.stock_id", inventory.getStockId());
|
||||
}
|
||||
if (oConvertUtils.isNotEmpty(inventory.getStatus())){
|
||||
if (oConvertUtils.isNotEmpty(inventory.getStatus())) {
|
||||
queryWrapper.eq("inventory.status", inventory.getStatus());
|
||||
}
|
||||
|
||||
|
|
@ -116,27 +120,32 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void moveInventory(List<Task> tasks) {
|
||||
List<Inventory> updateToInventoryList = new ArrayList<>();
|
||||
List<Point> updateToPointList = new ArrayList<>();
|
||||
for (Task task : tasks) {
|
||||
Inventory inventory = this.baseMapper.selectById(task.getInventoryId());
|
||||
inventory.setPointId(task.getToPointId());
|
||||
public void moveInventory(String stockCode, String startCode, String endCode) {
|
||||
Stock stock = stockMapper.queryByStockCode(stockCode);
|
||||
if (stock == null) {
|
||||
return;
|
||||
}
|
||||
Point startPoint = pointMapper.queryByPointCode(startCode);
|
||||
if (startPoint == null) {
|
||||
return;
|
||||
}
|
||||
Point endPoint = pointMapper.queryByPointCode(endCode);
|
||||
if (endPoint == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Inventory> inventories = this.baseMapper.queryInventoryByStockId(stock.getId());
|
||||
for (Inventory inventory : inventories) {
|
||||
inventory.setPointId(endPoint.getId());
|
||||
inventory.setStatus(InventoryStatusEnum.AVAILABLE.getValue());
|
||||
updateToInventoryList.add(inventory);
|
||||
}
|
||||
List<Long> srcPointIds = tasks.stream().map(Task::getFromPointId).distinct().toList();
|
||||
List<Point> srcPoints = pointMapper.selectByIds(srcPointIds);
|
||||
for (Point point : srcPoints) {
|
||||
point.setStatus(CommonStatusEnum.FREE.getValue());
|
||||
updateToPointList.add(point);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(updateToInventoryList)) {
|
||||
this.baseMapper.updateById(updateToInventoryList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(updateToPointList)) {
|
||||
pointMapper.updateById(updateToPointList);
|
||||
if (CollectionUtils.isNotEmpty(inventories)) {
|
||||
this.baseMapper.updateById(inventories);
|
||||
}
|
||||
|
||||
startPoint.setStatus(CommonStatusEnum.FREE.getValue());
|
||||
pointMapper.updateById(startPoint);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import org.cpte.modules.agvTask.mapper.AgvTaskMapper;
|
|||
import org.cpte.modules.agvTask.service.IAgvTaskService;
|
||||
import org.cpte.modules.base.entity.Point;
|
||||
import org.cpte.modules.base.mapper.PointMapper;
|
||||
import org.cpte.modules.base.service.IPointService;
|
||||
import org.cpte.modules.constant.GeneralConstant;
|
||||
import org.cpte.modules.constant.enums.AgvStatusEnum;
|
||||
import org.cpte.modules.constant.enums.AgvVendorEnum;
|
||||
|
|
@ -18,9 +17,7 @@ import org.cpte.modules.constant.enums.BusinessTypeEnum;
|
|||
import org.cpte.modules.constant.enums.CommonStatusEnum;
|
||||
import org.cpte.modules.inventory.service.IInventoryService;
|
||||
import org.cpte.modules.receive.entity.AsnDetail;
|
||||
import org.cpte.modules.receive.entity.ReceiveRecord;
|
||||
import org.cpte.modules.receive.mapper.AsnDetailMapper;
|
||||
import org.cpte.modules.receive.service.IAsnDetailService;
|
||||
import org.cpte.modules.receive.service.IAsnService;
|
||||
import org.cpte.modules.shipping.entity.Task;
|
||||
import org.cpte.modules.shipping.mapper.TaskMapper;
|
||||
|
|
@ -37,7 +34,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
|
|
@ -242,8 +238,7 @@ public class ITesAgvServiceImpl implements ITesAgvService {
|
|||
agvTaskService.createAgvTask(null, agvTask.getCarrierCode(), agvTask.getEndCode(), endCode, null, BusinessTypeEnum.OUTBOUND.getValue(), 0, AgvVendorEnum.HIK.getValue());
|
||||
}*/
|
||||
} else if (BusinessTypeEnum.MOVE.getValue().equals(agvTask.getType())) {
|
||||
List<Task> tasks = taskMapper.queryByAgvTask(agvTask.getId());
|
||||
inventoryService.moveInventory(tasks);
|
||||
inventoryService.moveInventory(agvTask.getCarrierCode(), agvTask.getStartCode(), agvTask.getEndCode());
|
||||
}
|
||||
|
||||
agvTask.setStatus(AgvStatusEnum.COMPLETED.getValue());
|
||||
|
|
@ -304,11 +299,11 @@ public class ITesAgvServiceImpl implements ITesAgvService {
|
|||
Point point = pointMapper.queryByPointCode(agvTask.getEndCode());
|
||||
point.setStatus(CommonStatusEnum.USED.getValue());
|
||||
pointMapper.updateById(point);
|
||||
List<AsnDetail> asnDetails= asnDetailMapper.selectByMainId(agvTask.getBusinessDetailId());
|
||||
for (AsnDetail asnDetail : asnDetails){
|
||||
List<AsnDetail> asnDetails = asnDetailMapper.selectByMainId(agvTask.getBusinessDetailId());
|
||||
for (AsnDetail asnDetail : asnDetails) {
|
||||
asnDetail.setToPointId(point.getId());
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(asnDetails)){
|
||||
if (CollectionUtils.isNotEmpty(asnDetails)) {
|
||||
asnDetailMapper.updateById(asnDetails);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue