部分翻包拣货
parent
198bcba6ba
commit
bf4d837e39
|
|
@ -22,4 +22,7 @@ public class FbPick {
|
||||||
|
|
||||||
@ApiModelProperty(value = "目标托盘")
|
@ApiModelProperty(value = "目标托盘")
|
||||||
String dstStockCode;
|
String dstStockCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "实拣数量")
|
||||||
|
Double moveQty;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ public class BydAppController {
|
||||||
Long taskId = fbPick.getTaskId();//任务id
|
Long taskId = fbPick.getTaskId();//任务id
|
||||||
String orderNumber = fbPick.getDstOrderNumber();//箱号
|
String orderNumber = fbPick.getDstOrderNumber();//箱号
|
||||||
String dstStockCode = fbPick.getDstStockCode();//目标托盘
|
String dstStockCode = fbPick.getDstStockCode();//目标托盘
|
||||||
bydAppService.fbPicking(taskId, orderNumber, dstStockCode);
|
bydAppService.fbPicking(taskId, orderNumber, dstStockCode,fbPick.getMoveQty());
|
||||||
return successResponse("拣货成功", null);
|
return successResponse("拣货成功", null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return badRequest("拣货失败:" + e.getMessage());
|
return badRequest("拣货失败:" + e.getMessage());
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public interface BydAppService {
|
||||||
* @param orderNumber 箱号
|
* @param orderNumber 箱号
|
||||||
* @param dstStockCode 目标托盘
|
* @param dstStockCode 目标托盘
|
||||||
*/
|
*/
|
||||||
void fbPicking(Long taskId, String orderNumber, String dstStockCode);
|
void fbPicking(Long taskId, String orderNumber, String dstStockCode ,Double moveQty);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解绑容器
|
* 解绑容器
|
||||||
|
|
|
||||||
|
|
@ -194,15 +194,15 @@ public class BydAppServiceImpl implements BydAppService {
|
||||||
returnTaskVo.setItemName(task.getItem().getName());
|
returnTaskVo.setItemName(task.getItem().getName());
|
||||||
returnTaskVo.setSrcPointCode(task.getSrcPointCode());
|
returnTaskVo.setSrcPointCode(task.getSrcPointCode());
|
||||||
returnTaskVo.setDstPointCode(task.getDstPointCode());
|
returnTaskVo.setDstPointCode(task.getDstPointCode());
|
||||||
returnTaskVo.setPlanQty(task.getPlanQty());
|
returnTaskVo.setPlanQty(task.getPlanQty()-task.getMoveQty());
|
||||||
return returnTaskVo;
|
return returnTaskVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void fbPicking(Long taskId, String orderNumber, String dstStockCode) {
|
public void fbPicking(Long taskId, String orderNumber, String dstStockCode,Double moveQty) {
|
||||||
//验证任务
|
//验证任务
|
||||||
Task task = validateTask(taskId, orderNumber);
|
Task task = validateTask(taskId, orderNumber,moveQty);
|
||||||
|
|
||||||
//工单
|
//工单
|
||||||
Pick pick = task.getPickDetail().getPick();
|
Pick pick = task.getPickDetail().getPick();
|
||||||
|
|
@ -211,7 +211,7 @@ public class BydAppServiceImpl implements BydAppService {
|
||||||
Stock dstStock = validatedstStock(task, pick, dstStockCode);
|
Stock dstStock = validatedstStock(task, pick, dstStockCode);
|
||||||
|
|
||||||
//库存移位
|
//库存移位
|
||||||
taskService.moveInventory(task, dstStock, task.getPlanQty());
|
taskService.moveInventory(task, dstStock, moveQty);
|
||||||
|
|
||||||
//刷新出库单状态
|
//刷新出库单状态
|
||||||
pickService.refreshPickStatus(task.getPickDetail().getPick());
|
pickService.refreshPickStatus(task.getPickDetail().getPick());
|
||||||
|
|
@ -392,11 +392,14 @@ public class BydAppServiceImpl implements BydAppService {
|
||||||
* @param taskId 任务Id
|
* @param taskId 任务Id
|
||||||
* @param orderNumber 箱号
|
* @param orderNumber 箱号
|
||||||
*/
|
*/
|
||||||
private Task validateTask(Long taskId, String orderNumber) {
|
private Task validateTask(Long taskId, String orderNumber,Double moveQty) {
|
||||||
Task task = taskService.findById(taskId);
|
Task task = taskService.findById(taskId);
|
||||||
if (task == null) {
|
if (task == null) {
|
||||||
throw new BadRequestException("未找到相应任务记录!");
|
throw new BadRequestException("未找到相应任务记录!");
|
||||||
}
|
}
|
||||||
|
if(moveQty>task.getPlanQty()-task.getMoveQty()){
|
||||||
|
throw new BadRequestException("实际拣货数量不能大于待拣货数量!");
|
||||||
|
}
|
||||||
if (orderNumber.equals(task.getItemKey().getOrderNumber())) {
|
if (orderNumber.equals(task.getItemKey().getOrderNumber())) {
|
||||||
return task;
|
return task;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author huojin
|
* @author huojin
|
||||||
|
|
@ -80,10 +81,10 @@ public class Pick extends BaseEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "备料点位")
|
@ApiModelProperty(value = "备料点位")
|
||||||
private Point point;
|
private Point point;
|
||||||
|
|
||||||
@OneToOne
|
|
||||||
@JoinColumn(name = "`call_point_id`")
|
@Column(name = "`call_point_id`")
|
||||||
@ApiModelProperty(value = "叫料点位")
|
@ApiModelProperty(value = "叫料点位")
|
||||||
private Point callPoint;
|
private String callPoint;
|
||||||
|
|
||||||
@Column(name = "`is_call`")
|
@Column(name = "`is_call`")
|
||||||
@ApiModelProperty(value = "是否叫料")
|
@ApiModelProperty(value = "是否叫料")
|
||||||
|
|
|
||||||
|
|
@ -149,9 +149,13 @@ public class Task extends BaseEntity implements Serializable {
|
||||||
private String putCode;
|
private String putCode;
|
||||||
|
|
||||||
@Column(name = "inv_id")
|
@Column(name = "inv_id")
|
||||||
@ApiModelProperty(value = "库存ID")
|
@ApiModelProperty(value = "原库存ID")
|
||||||
private Long invId;
|
private Long invId;
|
||||||
|
|
||||||
|
@Column(name = "new_inv_id")
|
||||||
|
@ApiModelProperty(value = "新库存ID")
|
||||||
|
private Long newInvId;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "dept_id")
|
@JoinColumn(name = "dept_id")
|
||||||
@ApiModelProperty(value = "仓库ID")
|
@ApiModelProperty(value = "仓库ID")
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
||||||
*
|
*
|
||||||
* @param pickId 出库单ID
|
* @param pickId 出库单ID
|
||||||
*/
|
*/
|
||||||
@Query("from Task t where t.pickDetail.pick.id =:pickId and t.planQty > t.moveQty")
|
@Query("from Task t where t.pickDetail.pick.id =:pickId and t.planQty > t.moveQty and t.agvTask.id is null")
|
||||||
List<Task> findByPickNotAllTask(Long pickId);
|
List<Task> findByPickNotAllTask(Long pickId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -59,7 +59,7 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
||||||
*
|
*
|
||||||
* @param pickId 出库单ID
|
* @param pickId 出库单ID
|
||||||
*/
|
*/
|
||||||
@Query("from Task t where t.pickDetail.pick.id =:pickId and t.planQty = t.moveQty")
|
@Query("from Task t where t.pickDetail.pick.id =:pickId and t.planQty - t.moveQty>0 ")
|
||||||
List<Task> findByPickAllTask(Long pickId);
|
List<Task> findByPickAllTask(Long pickId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ public class PickDto implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 叫点位
|
* 叫点位
|
||||||
*/
|
*/
|
||||||
private Point callPoint;
|
private String callPoint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单据类型
|
* 单据类型
|
||||||
|
|
|
||||||
|
|
@ -653,7 +653,7 @@ public class KMReServiceImpl implements KMReService {
|
||||||
|
|
||||||
List<Task> taskList = taskService.findTaskByCallAgvTask(agvTask.getId());
|
List<Task> taskList = taskService.findTaskByCallAgvTask(agvTask.getId());
|
||||||
for (Task task : taskList) {
|
for (Task task : taskList) {
|
||||||
inventoryService.deleteAll(new Long[]{task.getInvId()});
|
inventoryService.deleteAll(new Long[]{task.getNewInvId()});
|
||||||
}
|
}
|
||||||
|
|
||||||
//点位占用
|
//点位占用
|
||||||
|
|
@ -663,10 +663,7 @@ public class KMReServiceImpl implements KMReService {
|
||||||
stockService.usedStock(stock, endPoint, BaseStatus.USED);
|
stockService.usedStock(stock, endPoint, BaseStatus.USED);
|
||||||
|
|
||||||
Pick pick = pickService.findByPickCode(agvTask.getLineSlotCode());
|
Pick pick = pickService.findByPickCode(agvTask.getLineSlotCode());
|
||||||
if (pick != null) {
|
pickService.refreshPickStatus(pick);
|
||||||
pick.setStatus(BizStatus.CLOSE);
|
|
||||||
pickService.update(pick);
|
|
||||||
}
|
|
||||||
|
|
||||||
//回传MES
|
//回传MES
|
||||||
pickService.returnPick(pick.getId());
|
pickService.returnPick(pick.getId());
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ public class MesServiceImpl implements MesService {
|
||||||
: null;
|
: null;
|
||||||
Item item = itemRepository.findByCode(itemCode);
|
Item item = itemRepository.findByCode(itemCode);
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
item = itemService.createItem(itemDate.getItemCode(), itemDate.getItemName(), itemDate.getItemQty(), BizStatus.XJ);
|
item = itemService.createItem(itemCode, itemDate.getItemName(), itemDate.getItemQty(), BizStatus.XJ);
|
||||||
} else {
|
} else {
|
||||||
item.setGoodType(BizStatus.XJ);
|
item.setGoodType(BizStatus.XJ);
|
||||||
item.setExtendD1(itemDate.getItemQty());
|
item.setExtendD1(itemDate.getItemQty());
|
||||||
|
|
@ -134,7 +134,7 @@ public class MesServiceImpl implements MesService {
|
||||||
if (pick == null) {
|
if (pick == null) {
|
||||||
throw new BadRequestException(gdNo + ":" + itemCode + ":" + station + "工单不存在,叫料失败!");
|
throw new BadRequestException(gdNo + ":" + itemCode + ":" + station + "工单不存在,叫料失败!");
|
||||||
}
|
}
|
||||||
if (BizStatus.OPEN.equals(pick.getStatus()) || BizStatus.ASSIGN.equals(pick.getStatus())) {
|
if (BizStatus.OPEN.equals(pick.getStatus())) {
|
||||||
throw new BadRequestException(gdNo + "工单未备料完成,叫料失败!");
|
throw new BadRequestException(gdNo + "工单未备料完成,叫料失败!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,12 +143,12 @@ public class MesServiceImpl implements MesService {
|
||||||
throw new BadRequestException(pointCode + "点位不存在或已失效!");
|
throw new BadRequestException(pointCode + "点位不存在或已失效!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pick.getIsCall()) {
|
|
||||||
throw new BadRequestException(gdNo + "工单已叫料,请勿重复叫料!");
|
|
||||||
}
|
|
||||||
|
|
||||||
pick.setIsCall(true);
|
pick.setIsCall(true);
|
||||||
pick.setCallPoint(point);
|
if (pick.getCallPoint()==null || pick.getCallPoint().length()<=0) {
|
||||||
|
pick.setCallPoint(pointCode);
|
||||||
|
}else if(!pointCode.equals(pick.getCallPoint())){
|
||||||
|
pick.setCallPoint(pick.getCallPoint()+","+pointCode);
|
||||||
|
}
|
||||||
pickRepository.save(pick);
|
pickRepository.save(pick);
|
||||||
|
|
||||||
taskService.callEmptyStock(point);
|
taskService.callEmptyStock(point);
|
||||||
|
|
@ -162,7 +162,7 @@ public class MesServiceImpl implements MesService {
|
||||||
throw new BadRequestException(gdNo + ":" + completeCode + ":" + station + "工单不存在,叫料失败!");
|
throw new BadRequestException(gdNo + ":" + completeCode + ":" + station + "工单不存在,叫料失败!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BizStatus.OPEN.equals(pick.getStatus()) || BizStatus.ASSIGN.equals(pick.getStatus())) {
|
if (BizStatus.OPEN.equals(pick.getStatus())) {
|
||||||
throw new BadRequestException(gdNo + "工单未备料完成,叫料失败!");
|
throw new BadRequestException(gdNo + "工单未备料完成,叫料失败!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,11 +171,14 @@ public class MesServiceImpl implements MesService {
|
||||||
throw new BadRequestException(pointCode + "点位不存在或已失效!");
|
throw new BadRequestException(pointCode + "点位不存在或已失效!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pick.getIsCall()) {
|
|
||||||
throw new BadRequestException(gdNo + "工单已叫料,请勿重复叫料!");
|
|
||||||
}
|
|
||||||
pick.setIsCall(true);
|
pick.setIsCall(true);
|
||||||
pick.setCallPoint(point);
|
if (pick.getCallPoint()==null || pick.getCallPoint().length()<=0) {
|
||||||
|
pick.setCallPoint(pointCode);
|
||||||
|
}else if(!pointCode.equals(pick.getCallPoint())){
|
||||||
|
pick.setCallPoint(pick.getCallPoint()+","+pointCode);
|
||||||
|
}
|
||||||
|
|
||||||
pickRepository.save(pick);
|
pickRepository.save(pick);
|
||||||
taskService.callEmptyStock(point);
|
taskService.callEmptyStock(point);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,6 @@ public class PickServiceImpl implements PickService {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void refreshPickStatus(Pick pick) {
|
public void refreshPickStatus(Pick pick) {
|
||||||
// 查询出库单的所有明细
|
// 查询出库单的所有明细
|
||||||
List<PickDetail> allocatePickDetailList = pickDetailService.findByAllPickDetail(pick.getId());
|
List<PickDetail> allocatePickDetailList = pickDetailService.findByAllPickDetail(pick.getId());
|
||||||
|
|
@ -154,7 +153,7 @@ public class PickServiceImpl implements PickService {
|
||||||
String status = pick.getStatus();
|
String status = pick.getStatus();
|
||||||
|
|
||||||
// 更新状态
|
// 更新状态
|
||||||
if (orderQty - allocatedQty > 0 && allocatedQty != 0) {
|
if (orderQty - allocatedQty > 0 && allocatedQty != 0 && pickedQty == 0) {
|
||||||
status = BizStatus.ASSIGN;
|
status = BizStatus.ASSIGN;
|
||||||
} else if (orderQty == allocatedQty && pickedQty == 0) {
|
} else if (orderQty == allocatedQty && pickedQty == 0) {
|
||||||
status = BizStatus.ALLOCATE;
|
status = BizStatus.ALLOCATE;
|
||||||
|
|
@ -180,7 +179,7 @@ public class PickServiceImpl implements PickService {
|
||||||
String itemCode = pickDetail.getPropC3() == null ? pickDetail.getItem().getCode() : pickDetail.getPropC3();
|
String itemCode = pickDetail.getPropC3() == null ? pickDetail.getItem().getCode() : pickDetail.getPropC3();
|
||||||
jsonObject.put("MaterialCode", itemCode);
|
jsonObject.put("MaterialCode", itemCode);
|
||||||
//数量
|
//数量
|
||||||
jsonObject.put("number", pickDetail.getOrderQty() == null ? 0 : pickDetail.getOrderQty().intValue());
|
jsonObject.put("number", pickDetail.getPickedQty()== null ? 0 : pickDetail.getPickedQty().intValue());
|
||||||
//taskId
|
//taskId
|
||||||
jsonObject.put("taskId", pickDetail.getPick().getTaskCode());
|
jsonObject.put("taskId", pickDetail.getPick().getTaskCode());
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
|
|
@ -191,8 +190,11 @@ public class PickServiceImpl implements PickService {
|
||||||
Pick pick = pickRepository.getById(pickId);
|
Pick pick = pickRepository.getById(pickId);
|
||||||
List<PickDetail> pickDetailList = pickDetailRepository.findByAllPickDetail(pickId);
|
List<PickDetail> pickDetailList = pickDetailRepository.findByAllPickDetail(pickId);
|
||||||
for (PickDetail pickDetail : pickDetailList) {
|
for (PickDetail pickDetail : pickDetailList) {
|
||||||
|
if(pickDetail.getPickedQty()>0){
|
||||||
sendPick(UrlApi.stock(), pickDetail);
|
sendPick(UrlApi.stock(), pickDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
refreshPickReturn(pick);
|
refreshPickReturn(pick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import com.youchain.businessdata.domain.*;
|
||||||
import com.youchain.businessdata.repository.*;
|
import com.youchain.businessdata.repository.*;
|
||||||
import com.youchain.businessdata.service.*;
|
import com.youchain.businessdata.service.*;
|
||||||
import com.youchain.exception.BadRequestException;
|
import com.youchain.exception.BadRequestException;
|
||||||
|
import com.youchain.modules.system.domain.Dept;
|
||||||
import com.youchain.service.LogService;
|
import com.youchain.service.LogService;
|
||||||
import com.youchain.utils.*;
|
import com.youchain.utils.*;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
@ -199,11 +200,13 @@ public class TaskServiceImpl implements TaskService {
|
||||||
//查询出待分配的pickDetail
|
//查询出待分配的pickDetail
|
||||||
List<PickDetail> pickDetails = pickDetailService.findByPickDetailNoAllocate(pick.getId());
|
List<PickDetail> pickDetails = pickDetailService.findByPickDetailNoAllocate(pick.getId());
|
||||||
for (PickDetail pickDetail : pickDetails) {
|
for (PickDetail pickDetail : pickDetails) {
|
||||||
msgList.add(this.allocate(pickDetail.getId(), pickDetail.getOrderQty(), endPoint));
|
synchronized (pickDetail.getId()) {
|
||||||
|
msgList.add(this.allocate(pickDetail.getId(), pickDetail.getOrderQty() - pickDetail.getAllocatedQty(), endPoint));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 更新出库单状态*/
|
/* 更新出库单状态*/
|
||||||
synchronized (pick) {
|
synchronized (pick.getId()) {
|
||||||
pickService.refreshPickStatus(pick);
|
pickService.refreshPickStatus(pick);
|
||||||
|
|
||||||
if (BizStatus.ALLOCATE.equals(pick.getStatus()) || BizStatus.ASSIGN.equals(pick.getStatus())) {
|
if (BizStatus.ALLOCATE.equals(pick.getStatus()) || BizStatus.ASSIGN.equals(pick.getStatus())) {
|
||||||
|
|
@ -258,9 +261,10 @@ public class TaskServiceImpl implements TaskService {
|
||||||
task.setTaskStatus(agvTask.getStatus());
|
task.setTaskStatus(agvTask.getStatus());
|
||||||
taskRepository.save(task);
|
taskRepository.save(task);
|
||||||
}
|
}
|
||||||
/*更新出库单状态*/
|
|
||||||
|
/*更新出库单状态*//*
|
||||||
pick.setStatus(BizStatus.PICKUP);
|
pick.setStatus(BizStatus.PICKUP);
|
||||||
pickService.update(pick);
|
pickService.update(pick);*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -302,7 +306,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void callJlTask(Pick pick) {
|
public void callJlTask(Pick pick) {
|
||||||
if (pick.getStock() == null) {
|
if (pick.getStock() == null) {
|
||||||
throw new BadRequestException(pick.getGdCode() + "请翻包拣货!");
|
throw new BadRequestException(pick.getGdCode() + "工单未翻包拣货!");
|
||||||
}
|
}
|
||||||
if (pick.getCallPoint() == null) {
|
if (pick.getCallPoint() == null) {
|
||||||
throw new BadRequestException(pick.getGdCode() + "工单没有叫料请求!");
|
throw new BadRequestException(pick.getGdCode() + "工单没有叫料请求!");
|
||||||
|
|
@ -311,12 +315,17 @@ public class TaskServiceImpl implements TaskService {
|
||||||
Point srcPoint = pick.getStock().getPoint();
|
Point srcPoint = pick.getStock().getPoint();
|
||||||
|
|
||||||
//终点
|
//终点
|
||||||
Point endPoint = pick.getCallPoint();
|
String[] points = pick.getCallPoint().split(",");
|
||||||
|
String endPointCode = points[points.length - 1];
|
||||||
|
Point endPoint = pointService.queryPoint(endPointCode, null, null, null);
|
||||||
|
|
||||||
//容器
|
//容器
|
||||||
Stock stock = pick.getStock();
|
Stock stock = pick.getStock();
|
||||||
|
|
||||||
//创建任务
|
//创建任务
|
||||||
|
if (!agvTaskService.findByEndSlotCode(endPoint.getCode(), BizStatus.CALL_PICK, "RACK_MOVE")) {
|
||||||
|
throw new BadRequestException(endPoint.getCode() + "点位有任务,请稍后再试!");
|
||||||
|
}
|
||||||
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.CALL_PICK, stock, srcPoint.getCode(), endPoint.getCode(), "RACK_MOVE");
|
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.CALL_PICK, stock, srcPoint.getCode(), endPoint.getCode(), "RACK_MOVE");
|
||||||
agvTask.setLineSlotCode(pick.getCode());
|
agvTask.setLineSlotCode(pick.getCode());
|
||||||
agvTaskService.update(agvTask);
|
agvTaskService.update(agvTask);
|
||||||
|
|
@ -367,7 +376,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
Set<String> tps = new HashSet<>();
|
Set<String> tps = new HashSet<>();
|
||||||
for (Inventory inv : inventoryList) {
|
for (Inventory inv : inventoryList) {
|
||||||
//判断托盘是否有任务
|
//判断托盘是否有任务
|
||||||
synchronized (inv) {
|
synchronized (inv.getId()) {
|
||||||
if (this.existsByStock(pick.getCode(), inv.getStockCode()) >= 1) {
|
if (this.existsByStock(pick.getCode(), inv.getStockCode()) >= 1) {
|
||||||
tps.add(inv.getStockCode());
|
tps.add(inv.getStockCode());
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -394,7 +403,8 @@ public class TaskServiceImpl implements TaskService {
|
||||||
pickDetailService.update(pickDetail);
|
pickDetailService.update(pickDetail);
|
||||||
|
|
||||||
//生成Task任务
|
//生成Task任务
|
||||||
this.createTask(item, allocateQty, inv.getItemKey(), null, BizStatus.PICK, pickDetail, inv.getId(), inv.getStock(), startPoint, endPoint, null);
|
Task task = this.createTask(item, allocateQty, inv.getItemKey(), null, BizStatus.PICK, pickDetail, inv.getId(), inv.getStock(), startPoint, endPoint, null);
|
||||||
|
System.out.println(task.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -560,6 +570,8 @@ public class TaskServiceImpl implements TaskService {
|
||||||
public void moveInventory(Task task, Stock dstStock, double moveQty) {
|
public void moveInventory(Task task, Stock dstStock, double moveQty) {
|
||||||
//将占用数量移位,原库存回库内
|
//将占用数量移位,原库存回库内
|
||||||
Inventory inventory = inventoryService.findById(task.getInvId());
|
Inventory inventory = inventoryService.findById(task.getInvId());
|
||||||
|
ItemKey itemKey = inventory.getItemKey();
|
||||||
|
Dept dept = inventory.getDept();
|
||||||
synchronized (inventory) {
|
synchronized (inventory) {
|
||||||
inventory.setQueuedQty(inventory.getQueuedQty() - moveQty);
|
inventory.setQueuedQty(inventory.getQueuedQty() - moveQty);
|
||||||
inventory.setQuantity(inventory.getQuantity() - moveQty);
|
inventory.setQuantity(inventory.getQuantity() - moveQty);
|
||||||
|
|
@ -572,14 +584,17 @@ public class TaskServiceImpl implements TaskService {
|
||||||
}
|
}
|
||||||
|
|
||||||
//生成新库存
|
//生成新库存
|
||||||
Inventory newInventory = inventoryService.createInventory(inventory.getItemKey(), dstStock.getPoint(), dstStock, inventory.getDept(), moveQty);
|
Inventory newInventory = inventoryService.createInventory(itemKey, dstStock.getPoint(), dstStock, dept, moveQty);
|
||||||
|
|
||||||
//更新Task
|
//更新Task
|
||||||
task.setInvId(newInventory.getId());
|
task.setInvId(inventory.getId());
|
||||||
task.setMoveQty(moveQty);
|
task.setNewInvId(newInventory.getId());
|
||||||
task.setTaskStatus(BizStatus.FINISH);
|
task.setMoveQty(task.getMoveQty() + moveQty);
|
||||||
task.setDstStock(dstStock);
|
task.setDstStock(dstStock);
|
||||||
task.setDstStockCode(dstStock.getCode());
|
task.setDstStockCode(dstStock.getCode());
|
||||||
|
if (task.getPlanQty() - task.getMoveQty() == 0) {
|
||||||
|
task.setTaskStatus(BizStatus.FINISH);
|
||||||
|
}
|
||||||
taskRepository.save(task);
|
taskRepository.save(task);
|
||||||
|
|
||||||
PickDetail pickDetail = task.getPickDetail();
|
PickDetail pickDetail = task.getPickDetail();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
package com.youchain.modules.quartz.task;
|
package com.youchain.modules.quartz.task;
|
||||||
|
|
||||||
import com.youchain.basicdata.domain.Point;
|
import com.youchain.basicdata.domain.Point;
|
||||||
|
import com.youchain.basicdata.domain.Stock;
|
||||||
import com.youchain.basicdata.service.PointService;
|
import com.youchain.basicdata.service.PointService;
|
||||||
|
import com.youchain.basicdata.service.StockService;
|
||||||
import com.youchain.businessdata.domain.AgvTask;
|
import com.youchain.businessdata.domain.AgvTask;
|
||||||
import com.youchain.businessdata.domain.Pick;
|
import com.youchain.businessdata.domain.Pick;
|
||||||
import com.youchain.businessdata.domain.Task;
|
import com.youchain.businessdata.domain.Task;
|
||||||
|
|
@ -28,7 +30,7 @@ import java.util.*;
|
||||||
public class pickTask {
|
public class pickTask {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public PointService pointService;
|
public StockService stockService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public PickService pickService;
|
public PickService pickService;
|
||||||
|
|
@ -77,7 +79,7 @@ public class pickTask {
|
||||||
*/
|
*/
|
||||||
public void callJlTask() {
|
public void callJlTask() {
|
||||||
/*查询拣货完成完成的出库单*/
|
/*查询拣货完成完成的出库单*/
|
||||||
List<String> statuses = Arrays.asList(BizStatus.PICK_ALL);
|
List<String> statuses = Arrays.asList(BizStatus.PICKUP,BizStatus.PICK_ALL);
|
||||||
List<Pick> pickList = pickService.findByPickStatus(statuses, true);
|
List<Pick> pickList = pickService.findByPickStatus(statuses, true);
|
||||||
if (pickList.isEmpty()) {
|
if (pickList.isEmpty()) {
|
||||||
throw new BadRequestException("无拣货完成的出库单或出库单未叫料!");
|
throw new BadRequestException("无拣货完成的出库单或出库单未叫料!");
|
||||||
|
|
@ -97,8 +99,9 @@ public class pickTask {
|
||||||
}
|
}
|
||||||
for (AgvTask agvTask : agvTaskList) {
|
for (AgvTask agvTask : agvTaskList) {
|
||||||
if (BizStatus.PICK.equals(agvTask.getType())) {
|
if (BizStatus.PICK.equals(agvTask.getType())) {
|
||||||
Point point = pointService.validatePoint(agvTask.getEndSlotCode());
|
//目标点没有托盘继续下发下一个任务
|
||||||
if(BaseStatus.FREE.equalsIgnoreCase(point.getStatus())){
|
Stock stock= stockService.findByPointCode(agvTask.getEndSlotCode());
|
||||||
|
if(stock==null){
|
||||||
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskCcJson(agvTask));
|
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskCcJson(agvTask));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,6 @@ public interface BizStatus {
|
||||||
*/
|
*/
|
||||||
String FINISH = "FINISH";
|
String FINISH = "FINISH";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务类型-原材料入库
|
* 任务类型-原材料入库
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue