no message
parent
acfcc06b2b
commit
d5a326394d
|
|
@ -210,6 +210,4 @@ public class StockController {
|
|||
String stockMsg = stockService.stockMsg(mes);
|
||||
return new ResponseEntity<>(stockMsg, HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,9 +137,6 @@ public interface StockService {
|
|||
*/
|
||||
String stockMsg(String msg);
|
||||
|
||||
/**
|
||||
* 容器上架
|
||||
*/
|
||||
void stockShangJia();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,8 +236,5 @@ public class StockServiceImpl implements StockService {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stockShangJia() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,8 +52,7 @@ public class AgvTask extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "")
|
||||
private String stockTypeCode;
|
||||
|
||||
@Column(name = "`start_slot_code`",nullable = false)
|
||||
@NotBlank
|
||||
@Column(name = "`start_slot_code`")
|
||||
@ApiModelProperty(value = "起点位置")
|
||||
private String startSlotCode;
|
||||
|
||||
|
|
@ -65,8 +64,7 @@ public class AgvTask extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "设备编号")
|
||||
private String slotCode;
|
||||
|
||||
@Column(name = "`status`",nullable = false)
|
||||
@NotBlank
|
||||
@Column(name = "`status`")
|
||||
@ApiModelProperty(value = "任务状态")
|
||||
private String status;
|
||||
|
||||
|
|
@ -78,12 +76,8 @@ public class AgvTask extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "")
|
||||
private String jobId;
|
||||
|
||||
@Column(name = "`job_type`",nullable = false)
|
||||
@NotBlank
|
||||
@Column(name = "`job_type`")
|
||||
@ApiModelProperty(value = "工作类型")
|
||||
/**
|
||||
* 01:料箱
|
||||
*/
|
||||
private String jobType="01";
|
||||
|
||||
@Column(name = "`job_priority`")
|
||||
|
|
|
|||
|
|
@ -50,13 +50,4 @@ public interface InventoryRepository extends JpaRepository<Inventory, Long>, Jpa
|
|||
"and (:deptId is null or inv.dept.id = :deptId)")
|
||||
List<Inventory> findByInventory(Long itemKeyId, Long pointId, Long stockId, Long deptId);
|
||||
|
||||
/**
|
||||
* 查询待上架的容器库存
|
||||
*
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
@Query(value = " from Inventory inv where inv.quantity > 0 and inv.status =:status and inv.stock.id>0 ")
|
||||
List<Inventory> queryInventoryForShangJia(String status);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@ import java.util.Map;
|
|||
* @date 2023-08-16
|
||||
**/
|
||||
public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificationExecutor<Task> {
|
||||
@Query(value = "SELECT u.id FROM data_task u WHERE u.asn_detail_id=?1", nativeQuery = true)
|
||||
public List<Map<String,String>> getAsnTask(Long id);
|
||||
|
||||
/**
|
||||
* 根据出库单明细查询未完成的Task集合
|
||||
|
|
@ -80,4 +78,7 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
|||
*/
|
||||
@Query(value = "SELECT * FROM `data_task` dt where dt.bill_code = :billCode", nativeQuery = true)
|
||||
List<Task> queryByBillCode(@Param("billCode")String billCode);
|
||||
|
||||
@Query(value =" from Task t where t.taskStatus=:status and t.moveQty=0 ")
|
||||
List<Task> queryByPutAwayTask(String status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,8 +183,13 @@ public class AsnDetailController {
|
|||
@ApiOperation("删除asn_detail")
|
||||
@PreAuthorize("@el.check('super:man')")
|
||||
public ResponseEntity<Object> deleteAsnDetail(@RequestBody Long[] ids) {
|
||||
asnDetailService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
try {
|
||||
asnDetailService.deleteAll(ids);
|
||||
return new ResponseEntity<>(ApiResult.success("删除成功",null),HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(ApiResult.fail(HttpStatus.BAD_REQUEST.value(), e.getMessage(),null),HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/putawayInvApp")
|
||||
|
|
|
|||
|
|
@ -170,16 +170,4 @@ public class InventoryController {
|
|||
return ApiResult.result(200, "", qs);
|
||||
}
|
||||
|
||||
@GetMapping("/queryStockShangJia")
|
||||
@Log("待上架容器")
|
||||
@ApiOperation("待上架容器")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> queryStockShangJia(String status) {
|
||||
try {
|
||||
return new ResponseEntity<>(inventoryService.queryInventoryForShangJia(status), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(ApiResult.fail(HttpStatus.BAD_REQUEST.value(), e.getMessage(), null), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.youchain.basicdata.service.dto.PointQueryCriteria;
|
|||
import com.youchain.businessdata.domain.Task;
|
||||
import com.youchain.businessdata.service.TaskService;
|
||||
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.utils.BaseStatus;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.catalina.util.StandardSessionIdGenerator;
|
||||
|
|
@ -112,4 +113,25 @@ public class TaskController {
|
|||
taskService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/queryByPutAwayTask")
|
||||
@ApiOperation("查询待上架的任务")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> queryByPutAwayTask(String status){
|
||||
return new ResponseEntity<>(taskService.queryByPutAwayTask(status),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/stockShangJia")
|
||||
@Log("容器上架")
|
||||
@ApiOperation("容器上架")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> stockShangJia(@RequestBody Long taskId) {
|
||||
try {
|
||||
taskService.stockShangJia(taskId);
|
||||
return new ResponseEntity<>(ApiResult.success("上架成功",null),HttpStatus.OK);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(ApiResult.fail(HttpStatus.BAD_REQUEST.value(),e.getMessage(),null),HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -145,6 +145,4 @@ public interface InventoryService {
|
|||
|
||||
Inventory getInventory(ItemKey itemKey, Point point, Stock stock, Dept dept, String type,Area area);
|
||||
|
||||
List<Inventory> queryInventoryForShangJia(String status);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,8 +136,18 @@ public interface TaskService {
|
|||
|
||||
List<Task> getAgvTaskList(Long id);
|
||||
|
||||
List<Task> findbyPointCode(Long boxId);
|
||||
|
||||
List<Task> queryTask(Long asnDetailId,Long pickDetailId,Long ikId,Long pickId,Long srcPointId);
|
||||
|
||||
/**
|
||||
* 查询待上架的任务
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
List<Task> queryByPutAwayTask(String status);
|
||||
|
||||
/**
|
||||
* 容器上架
|
||||
*/
|
||||
void stockShangJia(Long taskId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import com.youchain.businessdata.domain.AgvTask;
|
|||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import com.youchain.businessdata.domain.Inventory;
|
||||
import com.youchain.businessdata.domain.Task;
|
||||
import com.youchain.businessdata.repository.InventoryRepository;
|
||||
import com.youchain.businessdata.repository.TaskRepository;
|
||||
import com.youchain.businessdata.service.AsnDetailService;
|
||||
import com.youchain.businessdata.service.TaskService;
|
||||
|
|
@ -58,6 +59,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
private final StockRepository stockRepository;
|
||||
private final TaskRepository taskRepository;
|
||||
private final AgvTaskMapper agvTaskMapper;
|
||||
private final InventoryRepository inventoryRepository;
|
||||
private final PointService pointService;
|
||||
private final TaskService taskService;
|
||||
private final AsnDetailService asnDetailService;
|
||||
|
|
@ -204,10 +206,14 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
if (BizStatus.ASN.equals(agvTask.getType())) {
|
||||
//容器回存储区,新增库存、更新点位状态
|
||||
for (Task task : taskList) {
|
||||
task.setTaskStatus(BizStatus.FINISH);
|
||||
task.setMoveQty(task.getPlanQty());
|
||||
task.setTaskStatus(BizStatus.PUTAWAYED);
|
||||
taskService.update(task);
|
||||
//更新库存
|
||||
Optional<Inventory> optionalInventory = inventoryRepository.findById(task.getInvId());
|
||||
optionalInventory.ifPresent(inv -> {
|
||||
inv.setStatus("已入库");
|
||||
inventoryRepository.save(inv);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import com.youchain.basicdata.domain.Point;
|
|||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.repository.PointRepository;
|
||||
import com.youchain.basicdata.repository.StockRepository;
|
||||
import com.youchain.basicdata.service.StockService;
|
||||
import com.youchain.businessdata.domain.*;
|
||||
import com.youchain.businessdata.inputJson.Zhengli;
|
||||
import com.youchain.businessdata.repository.TaskRepository;
|
||||
|
|
@ -43,12 +42,9 @@ import org.springframework.data.domain.Pageable;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @author hjl
|
||||
|
|
@ -118,7 +114,8 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
@Override
|
||||
public void deleteAll(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
AsnDetail asnDetail = asnDetailRepository.getById(id);
|
||||
AsnDetail asnDetail = asnDetailRepository.findById(id).get();
|
||||
|
||||
if (asnDetail.getStatus().equals("OPEN")) {
|
||||
//修改容器状态
|
||||
//删除关联表的数据 入库单明细(data_asn_detail)
|
||||
|
|
@ -130,8 +127,9 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
AsnDto byId = asnService.findById(asnDetail.getAsn().getId());
|
||||
byId.setOrderQuantity(byId.getOrderQuantity() - orderQty);
|
||||
asnService.update(asnMapper.toEntity(byId));
|
||||
asnDetailRepository.deleteById(id);
|
||||
}
|
||||
asnDetailRepository.deleteById(id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -230,34 +228,39 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
public void zhengli(Zhengli zhengli) {
|
||||
AsnDetail asnDetail = asnDetailRepository.findById(zhengli.getId()).get();
|
||||
Item item = asnDetail.getItem();
|
||||
Stock stock = zhengli.getStock();
|
||||
Point point = zhengli.getPoint();
|
||||
Stock srcStock = zhengli.getStock();
|
||||
Point dstPoint = zhengli.getPoint();
|
||||
Area area = zhengli.getArea();
|
||||
if (item.getIsInspection()) {
|
||||
throw new BadRequestException("该商品需要质检,请先完成质检!");
|
||||
}
|
||||
if(stock==null){
|
||||
if(srcStock ==null){
|
||||
throw new BadRequestException("整理的容器不能为空!");
|
||||
}
|
||||
|
||||
List<Point> srcPoints = pointRepository.getPointList("SHZC");
|
||||
if(srcPoints.isEmpty()){
|
||||
throw new BadRequestException("没有可用上架点位!");
|
||||
}
|
||||
|
||||
//生成Itemkey
|
||||
ItemKey itemKey = itemKeyService.getItemKey(item, asnDetail.getPropC1(), asnDetail.getPropC3(), asnDetail.getPropC4(), asnDetail.getPropC5(), asnDetail.getPropC6(), asnDetail.getPropD1());
|
||||
|
||||
//生成库存记录
|
||||
Inventory inventory = inventoryService.getInventory(itemKey, point, stock, item.getDept(), BizStatus.ASN,area);
|
||||
Inventory inventory = inventoryService.getInventory(itemKey, dstPoint, srcStock, item.getDept(), BizStatus.ASN,area);
|
||||
inventory.setStatus("待入库");
|
||||
inventory.setQuantity(inventory.getQuantity() + zhengli.getZlQty());
|
||||
inventoryService.update(inventory);
|
||||
|
||||
|
||||
|
||||
//生成入库记录
|
||||
Task task = taskService.storeTask(asnDetail, null, zhengli.getArea(), itemKey, null, point, zhengli.getZlQty());
|
||||
task.setSrcStockCode(stock.getCode());
|
||||
task.setSrcStock(stock);
|
||||
Task task = taskService.storeTask(asnDetail, null, zhengli.getArea(), itemKey, srcPoints.get(0), dstPoint, zhengli.getZlQty());
|
||||
task.setSrcStockCode(srcStock.getCode());
|
||||
task.setSrcStock(srcStock);
|
||||
task.setInvId(inventory.getId());
|
||||
taskRepository.save(task);
|
||||
|
||||
|
||||
|
||||
//是序列号的商品,生成序列号记录
|
||||
if (item.getIsSerial()) {
|
||||
XppRecord xppRecord = new XppRecord();
|
||||
|
|
@ -268,19 +271,17 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
}
|
||||
|
||||
//回写收货数量
|
||||
asnDetail.setStock(zhengli.getStock());
|
||||
asnDetail.setPoint(zhengli.getPoint());
|
||||
asnDetail.setReceivedQty(asnDetail.getReceivedQty() + zhengli.getZlQty());
|
||||
asnDetailRepository.save(asnDetail);
|
||||
|
||||
//容器绑定
|
||||
stock.setStatus(BaseStatus.USED);
|
||||
stock.setDept(item.getDept());
|
||||
stockRepository.save(stock);
|
||||
srcStock.setStatus(BaseStatus.USED);
|
||||
srcStock.setDept(item.getDept());
|
||||
stockRepository.save(srcStock);
|
||||
|
||||
if (point != null) {
|
||||
point.setStatus(BaseStatus.USED);
|
||||
pointRepository.save(point);
|
||||
if (dstPoint != null) {
|
||||
dstPoint.setStatus(BaseStatus.USED);
|
||||
pointRepository.save(dstPoint);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -416,9 +416,4 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
}
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Inventory> queryInventoryForShangJia(String status) {
|
||||
return inventoryRepository.queryInventoryForShangJia(status);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,13 +20,16 @@ import com.youchain.basicdata.domain.Area;
|
|||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.repository.PointRepository;
|
||||
import com.youchain.basicdata.repository.StockRepository;
|
||||
import com.youchain.businessdata.repository.AgvTaskRepository;
|
||||
import com.youchain.businessdata.returnJson.RPTaskList;
|
||||
import com.youchain.businessdata.domain.*;
|
||||
import com.youchain.businessdata.inputJson.IPTask;
|
||||
import com.youchain.businessdata.repository.InventoryRepository;
|
||||
import com.youchain.businessdata.repository.PickDetailRepository;
|
||||
import com.youchain.businessdata.service.InventoryLogService;
|
||||
import com.youchain.exception.BadRequestException;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -61,6 +64,8 @@ import javax.servlet.http.HttpServletResponse;
|
|||
public class TaskServiceImpl implements TaskService {
|
||||
|
||||
private final TaskRepository taskRepository;
|
||||
private final AgvTaskRepository agvTaskRepository;
|
||||
private final PointRepository pointRepository;
|
||||
private final TaskMapper taskMapper;
|
||||
private final InventoryRepository inventoryRepository;
|
||||
private final PickDetailRepository pickDetailRepository;
|
||||
|
|
@ -307,14 +312,6 @@ public class TaskServiceImpl implements TaskService {
|
|||
return taskRepository.getAgvTaskList(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Task> findbyPointCode(Long pointId) {
|
||||
String hql=" from Task t where t.dstPoint.id="+pointId+" and t.moveQty=0 ";
|
||||
Query query=entityMapper.createQuery(hql);
|
||||
List<Task> taskList=query.getResultList();
|
||||
return taskList;
|
||||
}
|
||||
|
||||
public List<Object[]> queryAreaMonth(String type) {
|
||||
List<Object[]> taskList=null;
|
||||
String hql = "";
|
||||
|
|
@ -369,4 +366,30 @@ public class TaskServiceImpl implements TaskService {
|
|||
List<Task> taskList=query.getResultList();
|
||||
return taskList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Task> queryByPutAwayTask(String status) {
|
||||
return taskRepository.queryByPutAwayTask(status);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void stockShangJia(Long taskId) {
|
||||
Task task=taskRepository.findById(taskId).get();
|
||||
if(task.getPlanQty()==task.getMoveQty()){
|
||||
throw new BadRequestException(task.getSrcStock().getCode()+"已上架!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//生成AGV任务
|
||||
AgvTask agvTask=new AgvTask(BizStatus.ASN,task.getSrcStock().getCode(),task.getSrcPoint().getCode(),task.getDstPoint().getCode(),BizStatus.ATCALL,"");
|
||||
agvTaskRepository.save(agvTask);
|
||||
|
||||
task.setMoveQty(task.getPlanQty());
|
||||
task.setTaskStatus(BizStatus.PUTAWAY);
|
||||
task.setAgvTask(agvTask);
|
||||
taskRepository.save(task);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,9 +48,15 @@ public class BizStatus {
|
|||
*/
|
||||
public static String RECEIVED = "RECEIVED";
|
||||
/**
|
||||
* 入库状态-上架完成
|
||||
* 入库状态-上架中
|
||||
*/
|
||||
public static String PUTAWAY = "PUTAWAY";
|
||||
|
||||
/**
|
||||
* 入库状态-上架完成
|
||||
*/
|
||||
public static String PUTAWAYED = "PUTAWAYED";
|
||||
|
||||
/**
|
||||
* 出入库状态-已取消||任务状态-已取消
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue