no message
parent
ccb171e86c
commit
634de44a0b
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.youchain.test;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
public class TestController {
|
||||||
|
JSONObject jsonObject;
|
||||||
|
JSONArray jsonArray;
|
||||||
|
@PostMapping("/interfaces/api/amr/submitMission")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> submitMission(@RequestBody JSON resources){
|
||||||
|
System.out.println("AGV接受报文:"+resources);
|
||||||
|
jsonObject=new JSONObject();
|
||||||
|
jsonArray=new JSONArray();
|
||||||
|
jsonObject.put("code","0");
|
||||||
|
jsonObject.put("message","");
|
||||||
|
jsonObject.put("data","");
|
||||||
|
jsonObject.put("success","false");
|
||||||
|
return new ResponseEntity<>(jsonObject, OK);
|
||||||
|
}
|
||||||
|
@PostMapping ("/queryPoint")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> queryPoint(@RequestBody JSONObject json){
|
||||||
|
System.out.println("光电点位状态查询 仿真测试:"+json);
|
||||||
|
jsonObject=new JSONObject();
|
||||||
|
jsonArray=new JSONArray();
|
||||||
|
jsonObject.put("status","200");
|
||||||
|
jsonObject.put("message","");
|
||||||
|
String pointType=json.getString("pointType");
|
||||||
|
JSONObject jsonObject1=new JSONObject();
|
||||||
|
if (pointType.equals("1")){
|
||||||
|
jsonObject1.put("pointCode",json.get("pointCode"));
|
||||||
|
jsonObject1.put("pointStatus","0");
|
||||||
|
}else if (pointType.equals("2")){
|
||||||
|
jsonObject1.put("pointCode",json.get("pointCode"));
|
||||||
|
jsonObject1.put("pointStatus","1");
|
||||||
|
}else if (pointType.equals("3")){
|
||||||
|
jsonObject1.put("pointCode",json.get("pointCode"));
|
||||||
|
jsonObject1.put("pointStatus","0");
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonArray.add(jsonObject1);
|
||||||
|
jsonObject.put("data",jsonArray);
|
||||||
|
return new ResponseEntity<>(jsonObject, OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping ("/lineApply")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> lineApply(@RequestBody JSONObject json){
|
||||||
|
System.out.println("输送线安全交互 仿真测试:"+json);
|
||||||
|
jsonObject=new JSONObject();
|
||||||
|
jsonArray=new JSONArray();
|
||||||
|
jsonObject.put("status","200");
|
||||||
|
jsonObject.put("message","");
|
||||||
|
JSONObject jsonObject1=new JSONObject();
|
||||||
|
jsonObject1.put("pointCode",json.get("lineCode"));
|
||||||
|
jsonObject1.put("pointStatus","1");
|
||||||
|
if (json.getString("type").equals("2")){
|
||||||
|
jsonObject1.put("pointStatus","0");
|
||||||
|
}
|
||||||
|
jsonObject1.put("stockCode","AAA11");
|
||||||
|
jsonArray.add(jsonObject1);
|
||||||
|
jsonObject.put("data",jsonArray);
|
||||||
|
return new ResponseEntity<>(jsonObject, OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -132,58 +132,6 @@ public class SmallAppController {
|
||||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "绑定成功!", ""), HttpStatus.OK);
|
return new ResponseEntity<>(ApiResult.success(OK.value(), "绑定成功!", ""), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/unBindStock")
|
|
||||||
@Log("料箱解绑-小件")
|
|
||||||
@ApiOperation("料箱解绑-小件")
|
|
||||||
@AnonymousAccess
|
|
||||||
public ResponseEntity<Object> unBindStock(@RequestBody Mo mo) {
|
|
||||||
String stockCode = mo.getStockCode();//料箱号
|
|
||||||
|
|
||||||
Stock stock = stockService.findByCode(stockCode, null);
|
|
||||||
if (stock == null) {
|
|
||||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), stockCode + "容器不存在!", ""), HttpStatus.BAD_REQUEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
//根据容器找到对应AGV任务
|
|
||||||
AgvTask agvTask = agvTaskService.findByStockCode(stockCode, BizStatus.ASN, "PICKER_MOVE");
|
|
||||||
if (agvTask != null) {
|
|
||||||
List<Task> taskList = taskService.getAgvTaskList(agvTask.getId());
|
|
||||||
for (Task task : taskList) {
|
|
||||||
AsnDetail asnDetail = task.getAsnDetail();
|
|
||||||
Long[] asnDetailIds = new Long[1];
|
|
||||||
asnDetailIds[0] = asnDetail.getId();
|
|
||||||
asnDetailService.deleteAll(asnDetailIds);
|
|
||||||
Long[] taskIds = new Long[1];
|
|
||||||
taskIds[0] = task.getId();
|
|
||||||
taskService.deleteAll(taskIds);
|
|
||||||
}
|
|
||||||
Integer[] agvTaskIds = new Integer[1];
|
|
||||||
agvTaskIds[0] = agvTask.getId();
|
|
||||||
agvTaskService.deleteAll(agvTaskIds);
|
|
||||||
}
|
|
||||||
List<Inventory> inventoryList = inventoryService.queryInventory(stock);
|
|
||||||
for (Inventory inventory : inventoryList) {
|
|
||||||
inventory.setQuantity(0d);
|
|
||||||
inventory.setQueuedQty(0d);
|
|
||||||
inventoryService.update(inventory);
|
|
||||||
if (inventory.getQuantity() <= 0) {
|
|
||||||
Long[] ids = new Long[1];
|
|
||||||
ids[0] = inventory.getId();
|
|
||||||
inventoryService.deleteAll(ids);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Point point = stock.getPoint();
|
|
||||||
if (point != null) {
|
|
||||||
point.setStatus(BaseStatus.FREE);
|
|
||||||
pointService.update(point);
|
|
||||||
}
|
|
||||||
stock.setPoint(null);
|
|
||||||
stock.setStatus(BaseStatus.FREE);
|
|
||||||
stock.setLineSlotCode(null);
|
|
||||||
stockService.update(stock);
|
|
||||||
|
|
||||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "解绑成功!", ""), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/callStock")
|
@PostMapping("/callStock")
|
||||||
@Log("满料出库-小件")
|
@Log("满料出库-小件")
|
||||||
|
|
@ -269,86 +217,4 @@ public class SmallAppController {
|
||||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "呼叫成功!", ""), HttpStatus.OK);
|
return new ResponseEntity<>(ApiResult.success(OK.value(), "呼叫成功!", ""), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/scanStock")
|
|
||||||
@Log("输送线扫码-小件")
|
|
||||||
@ApiOperation("输送线扫码-小件")
|
|
||||||
@AnonymousAccess
|
|
||||||
public ResponseEntity<Object> scanStock(@RequestBody LineScanStock lineScanStock) {
|
|
||||||
String stockCode = lineScanStock.getStockCode();//料箱号
|
|
||||||
String taskCode = lineScanStock.getTaskCode();//输送线ID
|
|
||||||
Stock stock = stockService.findByCode(stockCode, null);
|
|
||||||
if (stock == null) {
|
|
||||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), stockCode + "容器不存在!", ""), HttpStatus.BAD_REQUEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
//9;入库输送线
|
|
||||||
if (taskCode.equals("9")) {
|
|
||||||
Point endPoint = pointService.getPointByFree("小件缓存区", null);
|
|
||||||
if (endPoint == null) {
|
|
||||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), " 小件缓存区没有空闲点位!", ""), HttpStatus.BAD_REQUEST);
|
|
||||||
}
|
|
||||||
//根据料箱查询料箱入库任务状态为待执行、执行中
|
|
||||||
List<AgvTask> agvTaskList = agvTaskService.queryByAgvTask(stockCode, BizStatus.ASN,"PICKER_MOVE");
|
|
||||||
if (agvTaskList.size() <= 0) {
|
|
||||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), stockCode + "料箱识别失败,无任务!", ""), HttpStatus.BAD_REQUEST);
|
|
||||||
}
|
|
||||||
AgvTask agvTask = agvTaskList.get(0);
|
|
||||||
if (agvTask.getBeScan() == 1) {
|
|
||||||
return new ResponseEntity<>(ApiResult.success(OK.value(), stockCode + "料箱已扫描,请放入输送线!", ""), HttpStatus.OK);
|
|
||||||
}else if(agvTask.getBeScan() == 0){
|
|
||||||
endPoint.setStatus(BaseStatus.USED);
|
|
||||||
pointService.update(endPoint);
|
|
||||||
stock.setPoint(endPoint);
|
|
||||||
stockService.update(stock);
|
|
||||||
List<Task> taskList = taskService.getAgvTaskList(agvTask.getId());
|
|
||||||
for (Task task : taskList) {
|
|
||||||
task.setDstPointCode(endPoint.getCode());
|
|
||||||
task.setDstPoint(endPoint);
|
|
||||||
taskService.update(task);
|
|
||||||
}
|
|
||||||
agvTask.setBeScan(1);
|
|
||||||
agvTask.setJobId(taskCode);
|
|
||||||
agvTask.setEndSlotCode(endPoint.getCode());
|
|
||||||
agvTask.setUpdateTime(new Timestamp(new Date().getTime()));
|
|
||||||
agvTaskService.update(agvTask);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (taskCode.equals("6")) {
|
|
||||||
//6;出库缓存输送线
|
|
||||||
String lineSlotCode = stock.getLineSlotCode();//输送线线边点位
|
|
||||||
if (lineSlotCode == null || lineSlotCode.length() <= 0) {
|
|
||||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), stockCode + "料箱识别失败,无任务!", ""), HttpStatus.BAD_REQUEST);
|
|
||||||
}
|
|
||||||
Point endPoint = pointService.findByCode(lineSlotCode, null, null, null, null);
|
|
||||||
if (endPoint == null) {
|
|
||||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), lineSlotCode + "小件线边输送线点位不存在!", ""), HttpStatus.BAD_REQUEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
//滚筒出库满箱任务的起点
|
|
||||||
Point startPoint = pointService.getPoint("", BaseStatus.FREE, BaseStatus.BOX, "出库缓存滚筒输送线满箱接驳口");
|
|
||||||
if (startPoint == null) {
|
|
||||||
throw new RuntimeException("出库缓存滚筒输送线满箱接驳口点位没有维护!");
|
|
||||||
}
|
|
||||||
//生成滚筒AGV任务
|
|
||||||
AgvTask agvTask = agvTaskService.findBycontainerCode(stockCode);
|
|
||||||
if (agvTask == null) {
|
|
||||||
AgvTask newAgvTask = new AgvTask(BizStatus.PICK, stock.getCode(), startPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "ROLLER_MOVE");
|
|
||||||
newAgvTask.setBeScan(1);
|
|
||||||
newAgvTask.setJobId(taskCode);
|
|
||||||
newAgvTask.setUpdateTime(new Timestamp(new Date().getTime()));
|
|
||||||
agvTaskService.create(newAgvTask);
|
|
||||||
} else {
|
|
||||||
agvTask.setBeScan(1);
|
|
||||||
agvTask.setJobId(taskCode);
|
|
||||||
agvTask.setUpdateTime(new Timestamp(new Date().getTime()));
|
|
||||||
agvTaskService.update(agvTask);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "扫描成功!", taskCode), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,8 @@ public class AgvTask extends BaseEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "容器号")
|
@ApiModelProperty(value = "容器号")
|
||||||
private String stockCode;
|
private String stockCode;
|
||||||
|
|
||||||
@Column(name = "`stock_type_code`",nullable = false)
|
@Column(name = "`stock_type_code`")
|
||||||
@NotBlank
|
@ApiModelProperty(value = "容器类型")
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
private String stockTypeCode;
|
private String stockTypeCode;
|
||||||
|
|
||||||
@Column(name = "`start_slot_code`",nullable = false)
|
@Column(name = "`start_slot_code`",nullable = false)
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import javax.persistence.Table;
|
||||||
import org.hibernate.annotations.*;
|
import org.hibernate.annotations.*;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
|
|
@ -54,14 +55,12 @@ public class Inventory extends BaseEntity implements Serializable {
|
||||||
private String billCode;
|
private String billCode;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "`item_key_id`",nullable = false)
|
@JoinColumn(name = "`item_key_id`")
|
||||||
@NotNull
|
|
||||||
@ApiModelProperty(value = "物料属性")
|
@ApiModelProperty(value = "物料属性")
|
||||||
private ItemKey itemKey;
|
private ItemKey itemKey;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "`point_id`",nullable = false)
|
@JoinColumn(name = "`point_id`")
|
||||||
@NotNull
|
|
||||||
@ApiModelProperty(value = "点位")
|
@ApiModelProperty(value = "点位")
|
||||||
private Point point;
|
private Point point;
|
||||||
|
|
||||||
|
|
@ -71,8 +70,7 @@ public class Inventory extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "`stock_id`",nullable = false)
|
@JoinColumn(name = "`stock_id`")
|
||||||
@NotNull
|
|
||||||
@ApiModelProperty(value = "容器")
|
@ApiModelProperty(value = "容器")
|
||||||
private Stock stock;
|
private Stock stock;
|
||||||
|
|
||||||
|
|
@ -82,8 +80,7 @@ public class Inventory extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "`big_stock_id`",nullable = true)
|
@JoinColumn(name = "`big_stock_id`")
|
||||||
@NotNull
|
|
||||||
@ApiModelProperty(value = "大容器")
|
@ApiModelProperty(value = "大容器")
|
||||||
private Stock bigStock;
|
private Stock bigStock;
|
||||||
|
|
||||||
|
|
@ -129,7 +126,8 @@ public class Inventory extends BaseEntity implements Serializable {
|
||||||
@NotNull
|
@NotNull
|
||||||
@ApiModelProperty(value = "仓库")
|
@ApiModelProperty(value = "仓库")
|
||||||
private Dept dept;
|
private Dept dept;
|
||||||
|
@OneToMany
|
||||||
|
private List<Task> tasks;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ public class InventoryLog extends BaseEntity implements Serializable {
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
@Column(name = "`ref_obj`")
|
@Column(name = "`ref_obj`")
|
||||||
@ApiModelProperty(value = "引用对象")
|
@ApiModelProperty(value = "流水号")
|
||||||
private String refObj;
|
private String refObj;
|
||||||
|
|
||||||
@Column(name = "`ref_obj_id`")
|
@Column(name = "`ref_obj_id`")
|
||||||
|
|
|
||||||
|
|
@ -90,8 +90,13 @@ public class ItemKey extends BaseEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "工单号")
|
@ApiModelProperty(value = "工单号")
|
||||||
private String orderNumber;
|
private String orderNumber;
|
||||||
|
|
||||||
|
public int getIntPropC5() {
|
||||||
|
int decimalNumber = Integer.parseInt(propC5, 16);
|
||||||
|
return decimalNumber;
|
||||||
|
}
|
||||||
|
|
||||||
public void copy(ItemKey source){
|
public void copy(ItemKey source){
|
||||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,11 +146,10 @@ public class Task extends BaseEntity implements Serializable {
|
||||||
@Column(name = "`put_code`")
|
@Column(name = "`put_code`")
|
||||||
@ApiModelProperty(value = "流水号")
|
@ApiModelProperty(value = "流水号")
|
||||||
private String putCode;
|
private String putCode;
|
||||||
|
@JoinColumn(name="inv_id")
|
||||||
@Column(name = "`inv_id`")
|
|
||||||
@ApiModelProperty(value = "库存ID")
|
@ApiModelProperty(value = "库存ID")
|
||||||
private Long invId;
|
@ManyToOne
|
||||||
|
private Inventory inventory;
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "dept_id")
|
@JoinColumn(name = "dept_id")
|
||||||
@ApiModelProperty(value = "仓库ID")
|
@ApiModelProperty(value = "仓库ID")
|
||||||
|
|
@ -212,7 +211,6 @@ public class Task extends BaseEntity implements Serializable {
|
||||||
this.taskStatus = taskStatus;
|
this.taskStatus = taskStatus;
|
||||||
this.planQty = planQty;
|
this.planQty = planQty;
|
||||||
this.putCode = putCode;
|
this.putCode = putCode;
|
||||||
this.invId = invId;
|
|
||||||
this.dept = dept;
|
this.dept = dept;
|
||||||
this.agvTask = agvTask;
|
this.agvTask = agvTask;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,9 @@ public interface AgvTaskRepository extends JpaRepository<AgvTask, Integer>, JpaS
|
||||||
*/
|
*/
|
||||||
@Query(value = "select * FROM data_agv_task a where a.`status` in ('ATCALL','UP_CONTAINER') AND a.end_slot_code = ?1", nativeQuery = true)
|
@Query(value = "select * FROM data_agv_task a where a.`status` in ('ATCALL','UP_CONTAINER') AND a.end_slot_code = ?1", nativeQuery = true)
|
||||||
List<AgvTask> findEndTask(String endPoint);
|
List<AgvTask> findEndTask(String endPoint);
|
||||||
|
/** 查询重复任务*/
|
||||||
|
@Query(value = "select a FROM AgvTask a where a.status in ('ATCALL','ATWORK','OPEN') AND a.startSlotCode = ?1 and a.endSlotCode=?2")
|
||||||
|
List<AgvTask> findByRptAgvTask(String startPoint,String endPoint);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据线边分组
|
* 根据线边分组
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import java.util.Map;
|
||||||
public interface AsnDetailRepository extends JpaRepository<AsnDetail, Long>, JpaSpecificationExecutor<AsnDetail> {
|
public interface AsnDetailRepository extends JpaRepository<AsnDetail, Long>, JpaSpecificationExecutor<AsnDetail> {
|
||||||
@Query("select d from AsnDetail d where d.asn.id=?1 and d.lineNo=?2")
|
@Query("select d from AsnDetail d where d.asn.id=?1 and d.lineNo=?2")
|
||||||
List<AsnDetail> findByLineNo(Long id, Long lineNo);
|
List<AsnDetail> findByLineNo(Long id, Long lineNo);
|
||||||
@Query(value = " select i.id,sum(ad.order_qty) from data_asn_detail ad "
|
@Query(value = " select i.id itemId,sum(ad.order_qty) qty from data_asn_detail ad "
|
||||||
+" left join data_asn a on ad.asn_id=a.id "
|
+" left join data_asn a on ad.asn_id=a.id "
|
||||||
+" left join base_bill_type bt on bt.id=a.bill_type_id "
|
+" left join base_bill_type bt on bt.id=a.bill_type_id "
|
||||||
+" left join base_item i on ad.item_id=i.id "
|
+" left join base_item i on ad.item_id=i.id "
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@ import java.util.Map;
|
||||||
public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificationExecutor<Task> {
|
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)
|
@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);
|
public List<Map<String,String>> getAsnTask(Long id);
|
||||||
|
@Query(value = " select sum(move_qty) qty,GROUP_CONCAT(id) taskIds,item_key_id ikID,dst_point_id pointId from data_task where agv_task_id=?1 and task_type='ASN' and task_status='RECEIVING' group by item_key_id ",nativeQuery = true)
|
||||||
|
List<Map<String,Object>> findByAgvTask(Integer agvTaskId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据出库单明细查询未完成的Task集合
|
* 根据出库单明细查询未完成的Task集合
|
||||||
|
|
@ -52,11 +54,10 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据AGV ID查询对应Task集合
|
* 根据AGV ID查询对应Task集合
|
||||||
* @param id
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Query(value = "SELECT * FROM data_task t WHERE t.agv_task_id=?1 ", nativeQuery = true)
|
@Query(value = "SELECT t FROM Task t WHERE t.agvTask.id=?1 and t.taskStatus=?2")
|
||||||
List<Task> getAgvTaskList(Integer id);
|
List<Task> getAgvTaskList(Integer agvTaskId,String taskStatus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据 收货明细序号 进行删除数据
|
* 根据 收货明细序号 进行删除数据
|
||||||
|
|
|
||||||
|
|
@ -101,21 +101,23 @@ public class AgvTaskController {
|
||||||
@ApiOperation("AGV搬运任务回调接口")
|
@ApiOperation("AGV搬运任务回调接口")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> agvTaskCallback(@RequestBody String json){
|
public ResponseEntity<Object> agvTaskCallback(@RequestBody String json){
|
||||||
|
System.out.println("json:"+json);
|
||||||
JSONObject jsonObject = JSON.parseObject(json);
|
JSONObject jsonObject = JSON.parseObject(json);
|
||||||
String taskCode = jsonObject.getString("taskCode")==null?"":jsonObject.getString("taskCode");//任务编号
|
String taskCode = jsonObject.getString("taskCode")==null?"":jsonObject.getString("taskCode");//任务编号
|
||||||
String podCode = jsonObject.getString("podCode")==null?"":jsonObject.getString("podCode");//容器编号
|
String podCode = jsonObject.getString("podCode")==null?"":jsonObject.getString("podCode");//容器编号
|
||||||
String currentNodeCode = jsonObject.getString("currentNodeCode")==null?"":jsonObject.getString("currentNodeCode");//当前位置
|
String currentNodeCode = jsonObject.getString("currentNodeCode")==null?"":jsonObject.getString("currentNodeCode");//当前位置
|
||||||
String missionStatus = jsonObject.getString("missionStatus")==null?"":jsonObject.getString("missionStatus");//作业当前状态
|
String missionStatus = jsonObject.getString("missionStatus")==null?"":jsonObject.getString("missionStatus");//作业当前状态
|
||||||
|
agvTaskService.agvTaskCallback(taskCode,missionStatus);
|
||||||
|
return new ResponseEntity<>(ApiResult.success("",""),HttpStatus.OK);
|
||||||
//查询对应BOX
|
//查询对应BOX
|
||||||
try {
|
/*try {
|
||||||
/*AgvTaskDto dto= agvTaskService.findById(Integer.parseInt(taskCode));
|
AgvTaskDto dto= agvTaskService.findById(Integer.parseInt(taskCode));
|
||||||
AgvTask agvTask=agvTaskService.toEntity(dto);
|
AgvTask agvTask=agvTaskService.toEntity(dto);
|
||||||
agvTaskService.agvTaskCallback(agvTask,missionStatus,"");*/
|
agvTaskService.agvTaskCallback(agvTask,missionStatus,"");
|
||||||
agvTaskService.agvTaskCallback(taskCode,missionStatus);
|
|
||||||
return new ResponseEntity<>(ApiResult.success("",""),HttpStatus.OK);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(ApiResult.fail(400,e.getMessage(),""),HttpStatus.OK);
|
return new ResponseEntity<>(ApiResult.fail(400,e.getMessage(),""),HttpStatus.OK);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -228,7 +228,7 @@ public class AsnDetailController {
|
||||||
pointService.update(dstPoint);
|
pointService.update(dstPoint);
|
||||||
double srcQty=0d;
|
double srcQty=0d;
|
||||||
Inventory inv=invService.getInventory(ik,dstPoint,d.getStock(),d.getDept(),BizStatus.RECEIVING_UP);
|
Inventory inv=invService.getInventory(ik,dstPoint,d.getStock(),d.getDept(),BizStatus.RECEIVING_UP);
|
||||||
t.setInvId(inv.getId());
|
t.setInventory(inv);
|
||||||
taskService.update(t);
|
taskService.update(t);
|
||||||
srcQty=inv.getQuantity();
|
srcQty=inv.getQuantity();
|
||||||
inv.addQty(inv,d.getOrderQty());
|
inv.addQty(inv,d.getOrderQty());
|
||||||
|
|
|
||||||
|
|
@ -53,68 +53,4 @@ public class KMReSController {
|
||||||
|
|
||||||
private final StockRepository stockRepository;
|
private final StockRepository stockRepository;
|
||||||
|
|
||||||
@PostMapping("/missionStateCallback")
|
|
||||||
@Log("KMReS接口回调")
|
|
||||||
@ApiOperation("KMReS接口回调")
|
|
||||||
@AnonymousAccess
|
|
||||||
public ResponseEntity<Object> missionStateCallback(@RequestBody MissionStateCallback missionStateCallback) {
|
|
||||||
String id = missionStateCallback.getMissionCode();//作业 id
|
|
||||||
String containerCode = missionStateCallback.getContainerCode();//容器编号
|
|
||||||
String missionStatus = missionStateCallback.getMissionStatus();//作业当前状态
|
|
||||||
//小件任务
|
|
||||||
if(id.indexOf("XJ")!=-1){
|
|
||||||
if(missionStatus.equals("COMPLETED")){
|
|
||||||
|
|
||||||
}else if(missionStatus.equals("CANCELED")){
|
|
||||||
List<AgvTask> agvTaskList= agvTaskService.findByjobCode(id);
|
|
||||||
for(AgvTask agvTask:agvTaskList){
|
|
||||||
if(!agvTask.getStatus().equals(BizStatus.FINISH)){
|
|
||||||
agvTask.setStatus(BizStatus.CANCEL);
|
|
||||||
agvTask.setEndTime(new Timestamp(new Date().getTime()));
|
|
||||||
agvTaskService.update(agvTask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
AgvTask agvTask= agvTaskService.findByjobCode(id,containerCode);
|
|
||||||
agvTaskService.agvTaskCallback(agvTask,missionStatus,containerCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
}else if(id.indexOf("GT")!=-1){
|
|
||||||
//滚筒任务
|
|
||||||
if(missionStatus.equals("COMPLETED")){
|
|
||||||
List<AgvTask> agvTaskList= agvTaskService.findByjobCode(id);
|
|
||||||
for(AgvTask agvTask:agvTaskList){
|
|
||||||
//完成线边点位释放;容器清空线边点位。
|
|
||||||
Point endPoint = pointService.findByCode(agvTask.getEndSlotCode(), null, null, null, null);
|
|
||||||
endPoint.setStatus(BaseStatus.FREE);
|
|
||||||
pointService.update(endPoint);
|
|
||||||
Stock stock = stockRepository.getStockByCode(agvTask.getStockCode());
|
|
||||||
if (stock != null) {
|
|
||||||
stock.setLineSlotCode(null);
|
|
||||||
stockRepository.save(stock);
|
|
||||||
}
|
|
||||||
|
|
||||||
agvTask.setStatus(BizStatus.FINISH);
|
|
||||||
agvTask.setEndTime(new Timestamp(new Date().getTime()));
|
|
||||||
agvTaskService.update(agvTask);
|
|
||||||
}
|
|
||||||
}else if(missionStatus.equals("CANCELED")){
|
|
||||||
List<AgvTask> agvTaskList= agvTaskService.findByjobCode(id);
|
|
||||||
for(AgvTask agvTask:agvTaskList){
|
|
||||||
if(!agvTask.getStatus().equals(BizStatus.FINISH)){
|
|
||||||
agvTask.setStatus(BizStatus.CANCEL);
|
|
||||||
agvTask.setEndTime(new Timestamp(new Date().getTime()));
|
|
||||||
agvTaskService.update(agvTask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
//货架任务
|
|
||||||
AgvTaskDto agvTaskDto=agvTaskService.findById(Integer.parseInt(id));
|
|
||||||
AgvTask agvTask=agvTaskService.toEntity(agvTaskDto);//转实体
|
|
||||||
agvTaskService.agvTaskCallback(agvTask,missionStatus,containerCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -150,11 +150,8 @@ public interface AgvTaskService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务回报更新状态
|
* 任务回报更新状态
|
||||||
* @param agvTask
|
|
||||||
* @param status
|
* @param status
|
||||||
* @param containerCode
|
|
||||||
*/
|
*/
|
||||||
void agvTaskCallback(AgvTask agvTask,String status,String containerCode);
|
|
||||||
void agvTaskCallback(String taskCode,String status);
|
void agvTaskCallback(String taskCode,String status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -84,5 +84,23 @@ public interface InventoryLogService {
|
||||||
*/
|
*/
|
||||||
void download(List<InventoryLogDto> all, HttpServletResponse response) throws IOException;
|
void download(List<InventoryLogDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加库存日志
|
||||||
|
* @param logType
|
||||||
|
* @param incDec
|
||||||
|
* @param relatedBill
|
||||||
|
* @param itemKey
|
||||||
|
* @param srcPoint
|
||||||
|
* @param dstPoint
|
||||||
|
* @param srcStock
|
||||||
|
* @param dstStock
|
||||||
|
* @param srcQty
|
||||||
|
* @param occurQty
|
||||||
|
* @param refObj
|
||||||
|
* @param refObjId
|
||||||
|
* @param invId
|
||||||
|
* @param description
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
InventoryLog storeInventoryLog(String logType, int incDec, String relatedBill, ItemKey itemKey, Point srcPoint, Point dstPoint, Stock srcStock, Stock dstStock, Double srcQty, Double occurQty, String refObj, Long refObjId, Long invId,String description);
|
InventoryLog storeInventoryLog(String logType, int incDec, String relatedBill, ItemKey itemKey, Point srcPoint, Point dstPoint, Stock srcStock, Stock dstStock, Double srcQty, Double occurQty, String refObj, Long refObjId, Long invId,String description);
|
||||||
}
|
}
|
||||||
|
|
@ -19,6 +19,7 @@ import com.youchain.basicdata.domain.Point;
|
||||||
import com.youchain.basicdata.domain.Stock;
|
import com.youchain.basicdata.domain.Stock;
|
||||||
import com.youchain.businessdata.domain.Inventory;
|
import com.youchain.businessdata.domain.Inventory;
|
||||||
import com.youchain.businessdata.domain.ItemKey;
|
import com.youchain.businessdata.domain.ItemKey;
|
||||||
|
import com.youchain.businessdata.domain.Task;
|
||||||
import com.youchain.businessdata.service.dto.InvQueryCriteria;
|
import com.youchain.businessdata.service.dto.InvQueryCriteria;
|
||||||
import com.youchain.businessdata.service.dto.InventoryDto;
|
import com.youchain.businessdata.service.dto.InventoryDto;
|
||||||
import com.youchain.businessdata.service.dto.InventoryQueryCriteria;
|
import com.youchain.businessdata.service.dto.InventoryQueryCriteria;
|
||||||
|
|
@ -96,4 +97,11 @@ public interface InventoryService {
|
||||||
List<Inventory> queryInventory(Stock stock);
|
List<Inventory> queryInventory(Stock stock);
|
||||||
|
|
||||||
List<Inventory> getInvForPlan(String type,Long areaId,Long itemId,Long deptId);
|
List<Inventory> getInvForPlan(String type,Long areaId,Long itemId,Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库生成库存
|
||||||
|
* @param taskListMap 收货任务总结
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Inventory asnAddInventory(List<Map<String,Object>> taskListMap);
|
||||||
}
|
}
|
||||||
|
|
@ -127,8 +127,6 @@ public interface TaskService {
|
||||||
*/
|
*/
|
||||||
List<RPTaskList> queryTaskApp(IPTask t);
|
List<RPTaskList> queryTaskApp(IPTask t);
|
||||||
|
|
||||||
List<Task> getAgvTaskList(Integer id);
|
|
||||||
|
|
||||||
List<Task> findByPointCode(Long boxId);
|
List<Task> findByPointCode(Long boxId);
|
||||||
|
|
||||||
ApiResult readRfid(String rfid);
|
ApiResult readRfid(String rfid);
|
||||||
|
|
|
||||||
|
|
@ -164,72 +164,12 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized String sendAgvTaskImpl(AgvTask agvTasks) {
|
public synchronized String sendAgvTaskImpl(AgvTask agvTasks) {
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||||
|
|
||||||
Map<String, Object> objMap = new LinkedHashMap<>();
|
|
||||||
objMap.put("orgId", agvTasks.getId());//库存组织 ID
|
|
||||||
objMap.put("requestId", agvTasks.getId());//请求 id
|
|
||||||
objMap.put("missionCode", agvTasks.getId());//任务编号
|
|
||||||
|
|
||||||
objMap.put("missionType", agvTasks.getJobType());//货 架 ( 托 盘 ) 移动 RACK_MOVE
|
|
||||||
String viewBoardType = "";
|
|
||||||
Point point = pointService.findByCode(agvTasks.getStartSlotCode(), null, null, null, null);
|
|
||||||
//到达上视自动识别
|
|
||||||
if (point.getArea().getName().equals("前桶预装满车区") || point.getArea().getName().equals("后桶预装满车区") || point.getArea().getName().equals("前桶部装空车区") || point.getArea().getName().equals("后桶部装空车区")) {
|
|
||||||
viewBoardType = "IDENTIFY_REQUIRE";
|
|
||||||
}
|
|
||||||
objMap.put("viewBoardType", viewBoardType);//上视识别类型;需要 IDENTIFY_REQUIRE 不需要NORMAL
|
|
||||||
objMap.put("robotType", "LIFT");//机器人功能类型
|
|
||||||
JSONArray robotModels = new JSONArray();
|
|
||||||
objMap.put("robotModels", robotModels);//机器人具体型号
|
|
||||||
JSONArray robotIds = new JSONArray();
|
|
||||||
objMap.put("robotIds", robotIds);//机器人编号
|
|
||||||
String priority="1";
|
|
||||||
if (point.getArea().getName().equals("前桶预装满车区") || point.getArea().getName().equals("后桶预装满车区") ) {
|
|
||||||
priority = "2";
|
|
||||||
}
|
|
||||||
objMap.put("priority", priority);//数值越小,优先级越高,默认是 1
|
|
||||||
objMap.put("containerModelCode", "");//容器模型编码
|
|
||||||
objMap.put("containerCode", agvTasks.getStockCode() == null ? "" : agvTasks.getStockCode());//容器编号
|
|
||||||
objMap.put("templateCode", "");//作业流程模板编号
|
|
||||||
objMap.put("lockRobotAfterFinish", false);//是否需要流程结束后机器人保持任务锁定状态
|
|
||||||
objMap.put("unlockRobotId", "");//解锁当前小车的在上个任务的锁定状态
|
|
||||||
objMap.put("unlockMissionCode", "");//当前小车的上一个任务
|
|
||||||
objMap.put("idleNode", "");//作业流程完成后,指定机器人停放区域/点
|
|
||||||
JSONArray missionDataArray = new JSONArray();
|
|
||||||
JSONObject missionDataObj = new JSONObject(new LinkedHashMap<>());
|
|
||||||
Map<String, Object> missionDataMap = new LinkedHashMap<>();
|
|
||||||
missionDataMap.put("sequence", 1);//序号
|
|
||||||
missionDataMap.put("position", agvTasks.getStartSlotCode());//起始点
|
|
||||||
missionDataMap.put("type", "NODE_POINT");//作业位置类型:点位:NODE_POINT
|
|
||||||
missionDataMap.put("putDown", false);//作业点位是否需要放下货架
|
|
||||||
missionDataMap.put("passStrategy", "AUTO");//当前任务点结束后放行策略
|
|
||||||
missionDataMap.put("waitingMillis", "0");//自动触发离开当前任务节点的时间,默认单位:毫秒
|
|
||||||
missionDataObj.putAll(missionDataMap);
|
|
||||||
missionDataArray.add(missionDataObj);
|
|
||||||
|
|
||||||
JSONObject missionDataObj2 = new JSONObject(new LinkedHashMap<>());
|
|
||||||
Map<String, Object> missionDataMap2 = new LinkedHashMap<>();
|
|
||||||
missionDataMap2.put("sequence", 2);//序号
|
|
||||||
missionDataMap2.put("position", agvTasks.getEndSlotCode());//目标点
|
|
||||||
missionDataMap2.put("type", "NODE_POINT");//作业位置类型:点位:NODE_POINT
|
|
||||||
missionDataMap2.put("putDown", true);//作业点位是否需要放下货架
|
|
||||||
missionDataMap2.put("passStrategy", "AUTO");//当前任务点结束后放行策略
|
|
||||||
missionDataMap2.put("waitingMillis", "0");//自动触发离开当前任务节点的时间,默认单位:毫秒
|
|
||||||
missionDataObj2.putAll(missionDataMap2);
|
|
||||||
missionDataArray.add(missionDataObj2);
|
|
||||||
|
|
||||||
|
|
||||||
objMap.put("missionData", missionDataArray);
|
|
||||||
jsonObject.putAll(objMap);
|
|
||||||
System.out.println(jsonObject.toString());
|
|
||||||
String resultJson = HttpPostUtil.sendPostReq(UrlApi.submitMission, jsonObject.toString());//返回ResponseJson*/
|
String resultJson = HttpPostUtil.sendPostReq(UrlApi.submitMission, jsonObject.toString());//返回ResponseJson*/
|
||||||
JSONObject resulObject = JSON.parseObject(resultJson);
|
JSONObject resulObject = JSON.parseObject(resultJson);
|
||||||
String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
||||||
if (code.equals("0")) {
|
if (code.equals("0")) {
|
||||||
agvTasks.setJobForce(agvTasks.getId().toString());//任务组
|
|
||||||
agvTasks.setJobForceAsc((1));
|
|
||||||
agvTasks.setStatus(BizStatus.ATCALL);
|
agvTasks.setStatus(BizStatus.ATCALL);
|
||||||
agvTasks.setJobMessage(resultJson);
|
agvTasks.setJobMessage(resultJson);
|
||||||
agvTasks.setReqMessage(jsonObject.toString());
|
agvTasks.setReqMessage(jsonObject.toString());
|
||||||
|
|
@ -497,519 +437,13 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
return agvTaskMapper.toEntity(agvTaskDto);
|
return agvTaskMapper.toEntity(agvTaskDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void agvTaskCallback(AgvTask agvTask, String status, String containerCode) {
|
|
||||||
String agv_on_off = "OFF";
|
|
||||||
agv_on_off = dictService.getDictDescription("agv_on_off") == null ? "OFF" : dictService.getDictDescription("agv_on_off").getDescription();
|
|
||||||
String code = "0";
|
|
||||||
if (status.equals("ARRIVED")) {
|
|
||||||
|
|
||||||
} else if (status.equals("PICKER_RECEIVE")) {
|
|
||||||
//小件:AGV把料箱放到料箱车上扣减库存;点位释放
|
|
||||||
|
|
||||||
Point startPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null);
|
|
||||||
String srcAreaName = startPoint.getArea().getName();
|
|
||||||
if (srcAreaName.equals(AreaNameDic.XJHCQ)) {
|
|
||||||
Stock stock = stockRepository.getStockByCode(containerCode);
|
|
||||||
if (stock == null) {
|
|
||||||
throw new RuntimeException(containerCode + "容器不存在! 请维护");
|
|
||||||
}
|
|
||||||
List<Task> taskList = taskRepository.getAgvTaskList(agvTask.getId());
|
|
||||||
//扣除库存
|
|
||||||
for (Task task : taskList) {
|
|
||||||
try {
|
|
||||||
taskService.pickConfirm(task.getId(), task.getPlanQty());
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//点位释放
|
|
||||||
startPoint.setStatus(BaseStatus.FREE);
|
|
||||||
pointService.update(startPoint);
|
|
||||||
stock.setPoint(null);
|
|
||||||
stockRepository.save(stock);
|
|
||||||
agvTask.setStatus(BizStatus.FINISH);
|
|
||||||
agvTask.setEndTime(new Timestamp(new Date().getTime()));
|
|
||||||
this.update(agvTask);
|
|
||||||
} else if (srcAreaName.equals("出库缓存输送线空箱接驳口")) {
|
|
||||||
agvTask.setStatus(BizStatus.FINISH);
|
|
||||||
agvTask.setEndTime(new Timestamp(new Date().getTime()));
|
|
||||||
this.update(agvTask);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else if (status.equals("PICKER_SEND")) {
|
|
||||||
//小件:AGV把料箱放到立库架子上生成库存
|
|
||||||
|
|
||||||
List<Task> taskList = taskRepository.getAgvTaskList(agvTask.getId());
|
|
||||||
Point endPoint = pointService.findByCode(agvTask.getEndSlotCode(), null, null, null, null);
|
|
||||||
String endAreaName = endPoint.getArea().getName();
|
|
||||||
if (endAreaName.equals(AreaNameDic.XJHCQ)) {
|
|
||||||
Stock stock = stockRepository.getStockByCode(containerCode);
|
|
||||||
if (stock == null) {
|
|
||||||
throw new RuntimeException(containerCode + "容器不存在! 请维护");
|
|
||||||
}
|
|
||||||
for (Task task : taskList) {
|
|
||||||
AsnDetail ad = task.getAsnDetail();
|
|
||||||
ad.setReceivedQty(ad.getOrderQty());
|
|
||||||
ad.setStatus(BizStatus.RECEIVED);
|
|
||||||
ad.setStock(stock);
|
|
||||||
asnDetailRepository.save(ad);
|
|
||||||
task.setTaskStatus(BizStatus.FINISH);
|
|
||||||
task.setMoveQty(task.getPlanQty());
|
|
||||||
task.setSrcStock(stock);
|
|
||||||
if (stock != null) {
|
|
||||||
task.setSrcStockCode(stock.getCode());
|
|
||||||
task.setDstStockCode(stock.getCode());
|
|
||||||
List<Inventory> inventoryList = inventoryService.queryInventory(stock);
|
|
||||||
for (Inventory inventory : inventoryList) {
|
|
||||||
inventory.setQuantity(0d);
|
|
||||||
inventory.setQueuedQty(0d);
|
|
||||||
inventoryService.update(inventory);
|
|
||||||
if (inventory.getQuantity() <= 0) {
|
|
||||||
Long[] ids = new Long[1];
|
|
||||||
ids[0] = inventory.getId();
|
|
||||||
inventoryService.deleteAll(ids);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
task.setDstStock(stock);
|
|
||||||
taskService.update(task);
|
|
||||||
|
|
||||||
|
|
||||||
//生成库存
|
|
||||||
Inventory inventory = inventoryService.getInventory(task.getItemKey(), task.getDstPoint(), stock, task.getDept(), BizStatus.RECEIVING_UP);
|
|
||||||
double srcQty = inventory.getQuantity();
|
|
||||||
inventory.addQty(inventory, task.getPlanQty());
|
|
||||||
inventoryService.update(inventory);
|
|
||||||
stock.setStatus(BaseStatus.USED);
|
|
||||||
stock.setPoint(inventory.getPoint());
|
|
||||||
stockRepository.save(stock);
|
|
||||||
inventoryLogService.storeInventoryLog(BizStatus.RECEIVING_UP, BizStatus.ADD, null, task.getItemKey(), task.getSrcPoint(), task.getDstPoint(),
|
|
||||||
task.getSrcStock(), task.getSrcStock(), srcQty, task.getPlanQty(), BizStatus.ASN, ad.getId(), inventory.getId(), ad.getRemark());
|
|
||||||
}
|
|
||||||
agvTask.setStatus(BizStatus.FINISH);
|
|
||||||
agvTask.setEndTime(new Timestamp(new Date().getTime()));
|
|
||||||
this.update(agvTask);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else if (status.equals("UP_CONTAINER")) {
|
|
||||||
Point startPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null);
|
|
||||||
String srcAreaName = startPoint.getArea().getName();
|
|
||||||
//顶升释放起点位置状态及容器绑定的起点位置
|
|
||||||
startPoint.setStatus(BaseStatus.FREE);
|
|
||||||
if (srcAreaName.equals("轴承座机械臂工位")) {//顶升时空车返回,清空物料数据
|
|
||||||
startPoint.setItemCode(null);
|
|
||||||
}
|
|
||||||
pointService.update(startPoint);
|
|
||||||
|
|
||||||
if (srcAreaName.equals("前桶预装满车区") || srcAreaName.equals("后桶预装满车区") || srcAreaName.equals("前桶部装空车区") || srcAreaName.equals("后桶部装空车区") || srcAreaName.equals("轴承座翻包区") || srcAreaName.equals("轴承座满车库") || srcAreaName.equals("轴承座机械臂工位")) {
|
|
||||||
BoxServiceImpl bsi = SpringContextHolder.getBean(BoxServiceImpl.class);
|
|
||||||
Box box = bsi.getBoxByPointCode(startPoint.getCode());
|
|
||||||
if (box != null) {
|
|
||||||
box.setLampStatus("0");
|
|
||||||
bsi.update(box);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
agvTask.setStockCode(containerCode);
|
|
||||||
agvTask.setStatus(BizStatus.UP_CONTAINER);
|
|
||||||
this.update(agvTask);
|
|
||||||
|
|
||||||
} else if (status.equals("COMPLETED")) {//完成
|
|
||||||
//任务完成;根据AGV任务的目标点位走对应流程
|
|
||||||
Point endPoint = pointService.findByCode(agvTask.getEndSlotCode(), null, null, null, null);
|
|
||||||
String endAreaName = endPoint.getArea().getName();
|
|
||||||
if (endPoint != null) {
|
|
||||||
Stock stock = stockRepository.getStockByCode(containerCode);
|
|
||||||
if (stock == null) {
|
|
||||||
throw new RuntimeException(containerCode + "容器不存在! 请维护");
|
|
||||||
}
|
|
||||||
List<Task> taskList = taskRepository.getAgvTaskList(agvTask.getId());
|
|
||||||
if (endAreaName.equals(AreaNameDic.QTYK) || endAreaName.equals(AreaNameDic.HTYK) || endAreaName.equals(AreaNameDic.QTBZM) || endAreaName.equals(AreaNameDic.HTBZM)) {
|
|
||||||
//目标点位容器都由人为拉走,调用容器出场,按钮盒自动灭灯
|
|
||||||
String jsonObject = this.containerOut(containerCode);
|
|
||||||
if (agv_on_off.equals("ON")) {
|
|
||||||
String resultJson = HttpPostUtil.sendPostReq(UrlApi.containerOut, jsonObject.toString());
|
|
||||||
JSONObject resulObject = JSON.parseObject(resultJson);
|
|
||||||
code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
|
||||||
}
|
|
||||||
if (code.equals("0")) {
|
|
||||||
stock.setPoint(null);
|
|
||||||
stock.setStatus(BaseStatus.FREE);
|
|
||||||
stockRepository.save(stock);
|
|
||||||
}
|
|
||||||
//按钮盒点位释放
|
|
||||||
endPoint.setStatus(BaseStatus.FREE);
|
|
||||||
pointService.update(endPoint);
|
|
||||||
}
|
|
||||||
//处理实际逻辑
|
|
||||||
if (endAreaName.equals(AreaNameDic.QTYK) || endAreaName.equals(AreaNameDic.HTYK)) {
|
|
||||||
for (Task task : taskList) {
|
|
||||||
task.setTaskStatus(BizStatus.ATWORK);
|
|
||||||
taskService.update(task);
|
|
||||||
}
|
|
||||||
} else if (endAreaName.equals(AreaNameDic.QHTBZK) || endAreaName.equals(AreaNameDic.QHTK) || endAreaName.equals(AreaNameDic.ZCFB) || endAreaName.equals(AreaNameDic.ZCK)) {
|
|
||||||
stock.setPoint(endPoint);
|
|
||||||
stock.setStatus(BaseStatus.FREE);
|
|
||||||
stockRepository.save(stock);
|
|
||||||
endPoint.setStatus(BaseStatus.USED);
|
|
||||||
pointService.update(endPoint);
|
|
||||||
} else if (endAreaName.equals(AreaNameDic.QTBZM) || endAreaName.equals(AreaNameDic.HTBZM) || endAreaName.equals(AreaNameDic.ZCJXB)) {
|
|
||||||
String itemCode = null;
|
|
||||||
//扣除库存
|
|
||||||
for (Task task : taskList) {
|
|
||||||
try {
|
|
||||||
taskService.pickConfirm(task.getId(), task.getPlanQty());
|
|
||||||
itemCode = task.getItemKey().getItem().getCode();
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//轴承座机械臂点位容器位置不变,空满切换
|
|
||||||
if (endAreaName.equals(AreaNameDic.ZCJXB)) {
|
|
||||||
stock.setPoint(endPoint);
|
|
||||||
stockRepository.save(stock);
|
|
||||||
endPoint.setItemCode(itemCode);
|
|
||||||
endPoint.setStatus(BaseStatus.USED);
|
|
||||||
pointService.update(endPoint);
|
|
||||||
}
|
|
||||||
} else if (endAreaName.equals(AreaNameDic.QHTL) || endAreaName.equals(AreaNameDic.ZCM)) {
|
|
||||||
//增加库存
|
|
||||||
if (endAreaName.equals(AreaNameDic.QHTL) || endAreaName.equals(AreaNameDic.ZCM)) {
|
|
||||||
for (Task task : taskList) {
|
|
||||||
AsnDetail ad = task.getAsnDetail();
|
|
||||||
ad.setReceivedQty(ad.getOrderQty());
|
|
||||||
ad.setStatus(BizStatus.RECEIVED);
|
|
||||||
ad.setStock(stock);
|
|
||||||
asnDetailRepository.save(ad);
|
|
||||||
task.setTaskStatus(BizStatus.FINISH);
|
|
||||||
task.setMoveQty(task.getPlanQty());
|
|
||||||
task.setSrcStock(stock);
|
|
||||||
if (stock != null) {
|
|
||||||
task.setSrcStockCode(stock.getCode());
|
|
||||||
task.setDstStockCode(stock.getCode());
|
|
||||||
List<Inventory> inventoryList = inventoryService.queryInventory(stock);
|
|
||||||
for (Inventory inventory : inventoryList) {
|
|
||||||
inventory.setQuantity(0d);
|
|
||||||
inventory.setQueuedQty(0d);
|
|
||||||
inventoryService.update(inventory);
|
|
||||||
if (inventory.getQuantity() <= 0) {
|
|
||||||
Long[] ids = new Long[1];
|
|
||||||
ids[0] = inventory.getId();
|
|
||||||
inventoryService.deleteAll(ids);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
task.setDstStock(stock);
|
|
||||||
taskService.update(task);
|
|
||||||
|
|
||||||
|
|
||||||
//生成库存
|
|
||||||
Inventory inventory = inventoryService.getInventory(task.getItemKey(), task.getDstPoint(), stock, task.getDept(), BizStatus.RECEIVING_UP);
|
|
||||||
double srcQty = inventory.getQuantity();
|
|
||||||
inventory.addQty(inventory, task.getPlanQty());
|
|
||||||
inventoryService.update(inventory);
|
|
||||||
stock.setStatus(BaseStatus.USED);
|
|
||||||
stock.setPoint(inventory.getPoint());
|
|
||||||
stockRepository.save(stock);
|
|
||||||
inventoryLogService.storeInventoryLog(BizStatus.RECEIVING_UP, BizStatus.ADD, null, task.getItemKey(), task.getSrcPoint(), task.getDstPoint(),
|
|
||||||
task.getSrcStock(), task.getSrcStock(), srcQty, task.getPlanQty(), BizStatus.ASN, ad.getId(), inventory.getId(), ad.getRemark());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// if (endPoint != null) {
|
|
||||||
// if (endPoint.getType().equals(BaseStatus.BOX)||endAreaName.equals(AreaNameDic.ZCFB)) {
|
|
||||||
// //容器到达前桶后桶预装空车区,自动解绑容器
|
|
||||||
// if (endAreaName.equals(AreaNameDic.QTYK) ||endAreaName.equals(AreaNameDic.HTYK)) {
|
|
||||||
// //容器出场
|
|
||||||
// String jsonObject = this.containerOut(containerCode);
|
|
||||||
// if(agv_on_off.equals("ON")) {
|
|
||||||
// String resultJson = HttpPostUtil.sendPostReq(UrlApi.containerOut, jsonObject.toString());
|
|
||||||
// JSONObject resulObject = JSON.parseObject(resultJson);
|
|
||||||
// code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
|
||||||
// }
|
|
||||||
// if (code.equals("0")) {
|
|
||||||
// Stock stock = stockRepository.getStockByCode(containerCode);
|
|
||||||
// stock.setPoint(null);
|
|
||||||
// stock.setStatus(BaseStatus.FREE);
|
|
||||||
// stockRepository.save(stock);
|
|
||||||
// }
|
|
||||||
// //按钮盒点位释放
|
|
||||||
// endPoint.setStatus(BaseStatus.FREE);
|
|
||||||
// pointService.update(endPoint);
|
|
||||||
//
|
|
||||||
// List<Task> taskList = taskRepository.getAgvTaskList(agvTask.getId());
|
|
||||||
// for (Task task : taskList) {
|
|
||||||
// task.setTaskStatus(BizStatus.ATWORK);
|
|
||||||
// taskService.update(task);
|
|
||||||
// }
|
|
||||||
// } else if (endAreaName.equals(AreaNameDic.QTBZM) || endAreaName.equals(AreaNameDic.HTBZM)) {
|
|
||||||
// //到达部装满车区,扣减库存,自动解绑容器
|
|
||||||
// String jsonObject = this.containerOut(containerCode);
|
|
||||||
// if(agv_on_off.equals("ON")) {
|
|
||||||
// String resultJson = HttpPostUtil.sendPostReq(UrlApi.containerOut, jsonObject.toString());
|
|
||||||
// JSONObject resulObject = JSON.parseObject(resultJson);
|
|
||||||
// code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
|
||||||
// }
|
|
||||||
// if (code.equals("0")) {
|
|
||||||
// Stock stock = stockRepository.getStockByCode(containerCode);
|
|
||||||
// stock.setPoint(null);
|
|
||||||
// stock.setStatus(BaseStatus.FREE);
|
|
||||||
// if(endAreaName.equals(AreaNameDic.ZCJXB)){
|
|
||||||
// stock.setPoint(endPoint);
|
|
||||||
// }
|
|
||||||
// stockRepository.save(stock);
|
|
||||||
// }
|
|
||||||
// //点位释放
|
|
||||||
// if(!endAreaName.equals(AreaNameDic.ZCJXB)) {
|
|
||||||
// endPoint.setStatus(BaseStatus.FREE);
|
|
||||||
// }
|
|
||||||
// pointService.update(endPoint);
|
|
||||||
// List<Task> taskList = taskRepository.getAgvTaskList(agvTask.getId());
|
|
||||||
// for (Task task : taskList) {
|
|
||||||
// try {
|
|
||||||
// taskService.pickConfirm(task.getId(), task.getPlanQty());
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// throw new RuntimeException(e.getMessage());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// } else {
|
|
||||||
// //存储点位,生成库存调用
|
|
||||||
// if (endAreaName.equals(AreaNameDic.QHTL)||endAreaName.equals(AreaNameDic.ZCM)) {
|
|
||||||
// Stock stock = stockRepository.getStockByCode(containerCode);
|
|
||||||
// List<Task> taskList = taskRepository.getAgvTaskList(agvTask.getId());
|
|
||||||
// for (Task task : taskList) {
|
|
||||||
// AsnDetail ad = task.getAsnDetail();
|
|
||||||
// ad.setReceivedQty(ad.getOrderQty());
|
|
||||||
// ad.setStatus(BizStatus.RECEIVED);
|
|
||||||
// ad.setStock(stock);
|
|
||||||
// asnDetailRepository.save(ad);
|
|
||||||
// task.setTaskStatus(BizStatus.FINISH);
|
|
||||||
// task.setMoveQty(task.getPlanQty());
|
|
||||||
// task.setSrcStock(stock);
|
|
||||||
// if(stock!=null){
|
|
||||||
// task.setSrcStockCode(stock.getCode());
|
|
||||||
// task.setDstStockCode(stock.getCode());
|
|
||||||
// }
|
|
||||||
// task.setDstStock(stock);
|
|
||||||
// taskService.update(task);
|
|
||||||
// //生成库存
|
|
||||||
// Inventory inventory = inventoryService.getInventory(task.getItemKey(), task.getDstPoint(), task.getSrcStock(), task.getDept(), BizStatus.RECEIVING_UP);
|
|
||||||
// double srcQty=inventory.getQuantity();
|
|
||||||
// inventory.addQty(inventory, task.getPlanQty());
|
|
||||||
// inventoryService.update(inventory);
|
|
||||||
// stock.setStatus(BaseStatus.USED);
|
|
||||||
// stock.setPoint(inventory.getPoint());
|
|
||||||
// stockRepository.save(stock);
|
|
||||||
// inventoryLogService.storeInventoryLog(BizStatus.RECEIVING_UP,BizStatus.ADD,null,task.getItemKey(),task.getSrcPoint(),task.getDstPoint(),
|
|
||||||
// task.getSrcStock(),task.getSrcStock(),srcQty,task.getPlanQty(), BizStatus.ASN,ad.getId(),inventory.getId(),ad.getRemark());
|
|
||||||
// }
|
|
||||||
// }else if(endAreaName.equals(AreaNameDic.QHTBZK)||endAreaName.equals(AreaNameDic.QHTK)){
|
|
||||||
// Stock stock = stockRepository.getStockByCode(containerCode);
|
|
||||||
// stock.setPoint(endPoint);
|
|
||||||
// stock.setStatus(BaseStatus.FREE);
|
|
||||||
// stockRepository.save(stock);
|
|
||||||
// }else if (endAreaName.equals(AreaNameDic.QTBZM) || endAreaName.equals(AreaNameDic.HTBZM)||endAreaName.equals(AreaNameDic.ZCJXB)) {
|
|
||||||
// //到达部装满车区,扣减库存,自动解绑容器
|
|
||||||
// String jsonObject = this.containerOut(containerCode);
|
|
||||||
// if(agv_on_off.equals("ON")) {
|
|
||||||
// String resultJson = HttpPostUtil.sendPostReq(UrlApi.containerOut, jsonObject.toString());
|
|
||||||
// JSONObject resulObject = JSON.parseObject(resultJson);
|
|
||||||
// code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
|
||||||
// }
|
|
||||||
// if (code.equals("0")) {
|
|
||||||
// Stock stock = stockRepository.getStockByCode(containerCode);
|
|
||||||
// stock.setPoint(null);
|
|
||||||
// stock.setStatus(BaseStatus.FREE);
|
|
||||||
// stockRepository.save(stock);
|
|
||||||
// }
|
|
||||||
// //点位释放
|
|
||||||
// endPoint.setStatus(BaseStatus.FREE);
|
|
||||||
// pointService.update(endPoint);
|
|
||||||
// List<Task> taskList = taskRepository.getAgvTaskList(agvTask.getId());
|
|
||||||
// for (Task task : taskList) {
|
|
||||||
// try {
|
|
||||||
// taskService.pickConfirm(task.getId(), task.getPlanQty());
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// throw new RuntimeException(e.getMessage());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//任务完成
|
|
||||||
agvTask.setStatus(BizStatus.FINISH);
|
|
||||||
agvTask.setStockCode(containerCode);
|
|
||||||
agvTask.setEndTime(new Timestamp(new Date().getTime()));
|
|
||||||
this.update(agvTask);
|
|
||||||
if (endAreaName.equals(AreaNameDic.QTYK) || endAreaName.equals(AreaNameDic.HTYK) || endAreaName.equals(AreaNameDic.QTBZM) || endAreaName.equals(AreaNameDic.HTBZM)) {
|
|
||||||
BoxServiceImpl bsi = SpringContextHolder.getBean(BoxServiceImpl.class);
|
|
||||||
Box box = bsi.getBoxByPointCode(agvTask.getEndSlotCode());
|
|
||||||
if (box != null) {
|
|
||||||
box.setLampStatus("0");
|
|
||||||
bsi.update(box);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (status.equals("CANCELED")) {
|
|
||||||
//任务取消完成
|
|
||||||
Point endPoint = pointService.findByCode(agvTask.getEndSlotCode(), null, null, null, null);
|
|
||||||
if (endPoint != null) {
|
|
||||||
String endAreaName = endPoint.getArea().getName();
|
|
||||||
if (endPoint.getType().equals(BaseStatus.BOX)) {
|
|
||||||
//呼叫空车时异常,容器不出场,按钮盒点位释放
|
|
||||||
if (endPoint.getArea().getName().equals(AreaNameDic.QTYK) || endPoint.getArea().getName().equals(AreaNameDic.HTYK) || endPoint.getArea().getName().equals(AreaNameDic.ZCK)) {
|
|
||||||
|
|
||||||
//按钮盒点位释放
|
|
||||||
endPoint.setStatus(BaseStatus.FREE);
|
|
||||||
pointService.update(endPoint);
|
|
||||||
|
|
||||||
//查询容器状态
|
|
||||||
String jsonObject = this.containerQuery(containerCode);
|
|
||||||
String resultJson = HttpPostUtil.sendPostReq(UrlApi.containerQuery, jsonObject.toString());
|
|
||||||
JSONObject resulObject = JSON.parseObject(resultJson);
|
|
||||||
System.out.println("查询容状态:" + resulObject);
|
|
||||||
code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
|
||||||
if (code.equals("0")) {
|
|
||||||
String data1 = resulObject.getString("data") == null ? "" : resulObject.getString("data");
|
|
||||||
JSONArray jsonArray = JSON.parseArray(data1);
|
|
||||||
JSONObject dataObject = JSON.parseObject(jsonArray.get(0).toString());
|
|
||||||
String isCarry = dataObject.getString("isCarry") == null ? "" : dataObject.getString("isCarry");
|
|
||||||
if (isCarry.equals("0")) {
|
|
||||||
System.out.println(agvTask.getId() + "任务的容器未移动!");
|
|
||||||
} else {
|
|
||||||
//空车点位释放
|
|
||||||
Point startPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null);
|
|
||||||
startPoint.setStatus(BaseStatus.FREE);
|
|
||||||
pointService.update(startPoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else if (endPoint.getArea().getName().equals(AreaNameDic.QTBZM) || endPoint.getArea().getName().equals(AreaNameDic.HTBZM) || endPoint.getArea().getName().equals(AreaNameDic.ZCJXB)) {
|
|
||||||
|
|
||||||
//呼叫满车车时异常,容器不出场,按钮盒点位释放
|
|
||||||
|
|
||||||
//按钮盒点位释放
|
|
||||||
endPoint.setStatus(BaseStatus.FREE);
|
|
||||||
pointService.update(endPoint);
|
|
||||||
|
|
||||||
//查询容器状态
|
|
||||||
String jsonObject = this.containerQuery(containerCode);
|
|
||||||
String resultJson = HttpPostUtil.sendPostReq(UrlApi.containerQuery, jsonObject.toString());
|
|
||||||
JSONObject resulObject = JSON.parseObject(resultJson);
|
|
||||||
System.out.println("查询容状态:" + resulObject);
|
|
||||||
code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
|
||||||
if (code.equals("0")) {
|
|
||||||
String data1 = resulObject.getString("data") == null ? "" : resulObject.getString("data");
|
|
||||||
JSONArray jsonArray = JSON.parseArray(data1);
|
|
||||||
JSONObject dataObject = JSON.parseObject(jsonArray.get(0).toString());
|
|
||||||
String isCarry = dataObject.getString("isCarry") == null ? "" : dataObject.getString("isCarry");
|
|
||||||
if (isCarry.equals("0")) {
|
|
||||||
//任务取消库存咱用数还原
|
|
||||||
Stock stock = stockRepository.getStockByCode(containerCode);
|
|
||||||
if (stock != null) {
|
|
||||||
List<Inventory> inventoryList = inventoryService.queryInventory(stock);
|
|
||||||
for (Inventory inventory : inventoryList) {
|
|
||||||
inventory.setQueuedQty(0d);
|
|
||||||
inventoryService.update(inventory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println(agvTask.getId() + "任务的容器未移动,不扣减库信息!");
|
|
||||||
} else {
|
|
||||||
//缓存点位释放
|
|
||||||
Point startPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null);
|
|
||||||
startPoint.setStatus(BaseStatus.FREE);
|
|
||||||
pointService.update(startPoint);
|
|
||||||
|
|
||||||
List<Task> taskList = taskRepository.getAgvTaskList(agvTask.getId());
|
|
||||||
for (Task task : taskList) {
|
|
||||||
try {
|
|
||||||
taskService.pickConfirm(task.getId(), task.getPlanQty());
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
//回冷却区取消任务,不生成库存 入库任务取消即可
|
|
||||||
if (endPoint.getArea().getName().equals(AreaNameDic.QHTL) || endPoint.getArea().getName().equals(AreaNameDic.ZCM)) {
|
|
||||||
Stock stock = stockRepository.getStockByCode(containerCode);
|
|
||||||
List<Task> taskList = taskRepository.getAgvTaskList(agvTask.getId());
|
|
||||||
for (Task task : taskList) {
|
|
||||||
AsnDetail ad = task.getAsnDetail();
|
|
||||||
ad.setStatus(BizStatus.CANCEL);
|
|
||||||
ad.setStock(stock);
|
|
||||||
asnDetailRepository.save(ad);
|
|
||||||
task.setTaskStatus(BizStatus.CANCEL);
|
|
||||||
task.setSrcStock(stock);
|
|
||||||
if (stock != null) {
|
|
||||||
task.setSrcStockCode(stock.getCode());
|
|
||||||
task.setDstStockCode(stock.getCode());
|
|
||||||
}
|
|
||||||
task.setDstStock(stock);
|
|
||||||
taskService.update(task);
|
|
||||||
}
|
|
||||||
//未入库成功将点位释放
|
|
||||||
endPoint.setStatus(BaseStatus.FREE);
|
|
||||||
pointService.update(endPoint);
|
|
||||||
// 前后桶预装满车区按钮盒点位释放
|
|
||||||
Point startPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null);
|
|
||||||
startPoint.setStatus(BaseStatus.FREE);
|
|
||||||
pointService.update(startPoint);
|
|
||||||
} else if (endPoint.getArea().getName().equals(AreaNameDic.QHTBZK) || endPoint.getArea().getName().equals(AreaNameDic.QHTK) || endPoint.getArea().getName().equals(AreaNameDic.ZCK)) {
|
|
||||||
//回空车取消任务,不做出场
|
|
||||||
endPoint.setStatus(BaseStatus.FREE);
|
|
||||||
pointService.update(endPoint);
|
|
||||||
// 前后桶部装空车区按钮盒点位释放
|
|
||||||
Point startPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null);
|
|
||||||
startPoint.setStatus(BaseStatus.FREE);
|
|
||||||
pointService.update(startPoint);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
agvTask.setStatus(BizStatus.CANCEL);
|
|
||||||
agvTask.setStockCode(containerCode);
|
|
||||||
agvTask.setEndTime(new Timestamp(new Date().getTime()));
|
|
||||||
this.update(agvTask);
|
|
||||||
if (endAreaName.equals(AreaNameDic.QTYK) || endAreaName.equals(AreaNameDic.HTYK) || endAreaName.equals(AreaNameDic.QTBZM) || endAreaName.equals(AreaNameDic.HTBZM)) {
|
|
||||||
BoxServiceImpl bsi = SpringContextHolder.getBean(BoxServiceImpl.class);
|
|
||||||
Box box = bsi.getBoxByPointCode(agvTask.getEndSlotCode());
|
|
||||||
if (box != null) {
|
|
||||||
box.setLampStatus("0");
|
|
||||||
bsi.update(box);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void agvTaskCallback(String taskCode, String status) {
|
public void agvTaskCallback(String taskCode, String status) {
|
||||||
// agvTask搬运任务
|
// agvTask搬运任务
|
||||||
AgvTask agvTask=agvTaskRepository.getById(Integer.valueOf(taskCode));
|
AgvTask agvTask=agvTaskRepository.getById(Integer.valueOf(taskCode));
|
||||||
// task库存任务
|
// task库存任务
|
||||||
List<Task> tasks=taskRepository.getAgvTaskList(agvTask.getId());
|
// List<Task> tasks=taskRepository.getAgvTaskList(agvTask.getId(),BizStatus.ASN);
|
||||||
|
List<Map<String,Object>> taskMapList=taskRepository.findByAgvTask(agvTask.getId());
|
||||||
Point startPoint=null;
|
Point startPoint=null;
|
||||||
Point endPoint=null;
|
Point endPoint=null;
|
||||||
if (status.equals("1")){
|
if (status.equals("1")){
|
||||||
|
|
@ -1029,6 +463,11 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
pointRepository.save(endPoint);
|
pointRepository.save(endPoint);
|
||||||
agvTask.setStatus(BizStatus.FINISH);
|
agvTask.setStatus(BizStatus.FINISH);
|
||||||
agvTask.setEndTime(new Timestamp((new Date()).getTime()));
|
agvTask.setEndTime(new Timestamp((new Date()).getTime()));
|
||||||
|
|
||||||
|
if (taskMapList.size()>0){
|
||||||
|
// 生成库存
|
||||||
|
Inventory inventory = inventoryService.asnAddInventory(taskMapList);
|
||||||
|
}
|
||||||
} else if (status.equals("4")) {
|
} else if (status.equals("4")) {
|
||||||
// 取消任务
|
// 取消任务
|
||||||
}
|
}
|
||||||
|
|
@ -1134,14 +573,32 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AgvTask addAgvTask(String type, String stockTypeCode, String startSlotCode, String endSlotCode, String status, String jobType) {
|
public AgvTask addAgvTask(String type, String stockTypeCode, String startSlotCode, String endSlotCode, String status, String jobType) {
|
||||||
AgvTask agvTask= new AgvTask();
|
AgvTask agvTask = new AgvTask();
|
||||||
|
List<AgvTask> agvTaskList=agvTaskRepository.findByRptAgvTask(startSlotCode,endSlotCode);
|
||||||
|
if (agvTaskList.size()>0){
|
||||||
|
return agvTaskList.get(0);
|
||||||
|
}
|
||||||
agvTask.setType(type);
|
agvTask.setType(type);
|
||||||
agvTask.setStockTypeCode(stockTypeCode);
|
agvTask.setStockTypeCode(stockTypeCode);
|
||||||
agvTask.setStartSlotCode(startSlotCode);
|
agvTask.setStartSlotCode(startSlotCode);
|
||||||
agvTask.setEndSlotCode(endSlotCode);
|
agvTask.setEndSlotCode(endSlotCode);
|
||||||
agvTask.setStatus(status);
|
agvTask.setStatus(status);
|
||||||
agvTask.setJobType(jobType);
|
agvTask.setJobType(jobType);
|
||||||
return agvTaskRepository.save(agvTask);
|
AgvTask agv=agvTaskRepository.save(agvTask);
|
||||||
|
// 生成任务占用库位
|
||||||
|
Point startPoint=pointRepository.findByCode(startSlotCode);
|
||||||
|
Point endPoint=pointRepository.findByCode(endSlotCode);
|
||||||
|
if (startPoint.getType().equals("STORAGE")){
|
||||||
|
startPoint.setStatus(BaseStatus.USED);
|
||||||
|
pointRepository.save(startPoint);
|
||||||
|
}
|
||||||
|
if (startPoint.getType().equals("STORAGE")){
|
||||||
|
endPoint.setStatus(BaseStatus.USED);
|
||||||
|
endPoint.setStorageType(startPoint.getStorageType());
|
||||||
|
pointRepository.save(endPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
return agv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -1156,11 +613,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
return endPoint.getCode()+":被任务占用";
|
return endPoint.getCode()+":被任务占用";
|
||||||
}
|
}
|
||||||
AgvTask agvTask = addAgvTask(BizStatus.AGV_F, startPoint.getStorageType(), startPoint.getCode(),endPoint.getCode() , BizStatus.OPEN, BizStatus.ASN);
|
AgvTask agvTask = addAgvTask(BizStatus.AGV_F, startPoint.getStorageType(), startPoint.getCode(),endPoint.getCode() , BizStatus.OPEN, BizStatus.ASN);
|
||||||
startPoint.setStatus(BaseStatus.USED);
|
|
||||||
pointRepository.save(startPoint);
|
|
||||||
endPoint.setStatus(BaseStatus.USED);
|
|
||||||
endPoint.setStorageType(startPoint.getStorageType());
|
|
||||||
pointRepository.save(endPoint);
|
|
||||||
}else {
|
}else {
|
||||||
return pointEndCode+":目标点错误";
|
return pointEndCode+":目标点错误";
|
||||||
}
|
}
|
||||||
|
|
@ -1187,6 +639,14 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
Map<String,Object> objectMap=taskSumQty.get(0);
|
Map<String,Object> objectMap=taskSumQty.get(0);
|
||||||
Long itemId=Long.valueOf(objectMap.get("itemId")+"");
|
Long itemId=Long.valueOf(objectMap.get("itemId")+"");
|
||||||
Double taskQty=Double.valueOf(objectMap.get("taskQty")+"");
|
Double taskQty=Double.valueOf(objectMap.get("taskQty")+"");
|
||||||
|
for (int i = 0; i < asnDetailSumQty.size(); i++) {
|
||||||
|
Map<String,Object> sumQty=asnDetailSumQty.get(i);
|
||||||
|
if (Long.valueOf(sumQty.get("itemId")+"")==itemId){
|
||||||
|
if (taskQty>Double.valueOf(sumQty.get("qty")+"")){
|
||||||
|
return ApiResult.success(500, "任务异常:RFID读取到的物料数量大于入库单中的数量", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Item item=itemService.findByItemId(itemId);
|
Item item=itemService.findByItemId(itemId);
|
||||||
if (taskQty>=item.getExtendD1()){
|
if (taskQty>=item.getExtendD1()){
|
||||||
//入库
|
//入库
|
||||||
|
|
|
||||||
|
|
@ -270,7 +270,7 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
||||||
if (asnDetail.getOrderQty()<=asnDetail.getReceivedQty()){
|
if (asnDetail.getOrderQty()<=asnDetail.getReceivedQty()){
|
||||||
asnDetail.setStatus(BizStatus.RECEIVED);
|
asnDetail.setStatus(BizStatus.RECEIVED);
|
||||||
List<AsnDetail> asnDetailList=asnDetailRepository.findByAsnId(asnDetail.getAsn().getId(),BizStatus.RECEIVING);
|
List<AsnDetail> asnDetailList=asnDetailRepository.findByAsnId(asnDetail.getAsn().getId(),BizStatus.RECEIVING);
|
||||||
if (asnDetailList.size()<1){
|
if (asnDetailList.size()<2){
|
||||||
Asn asn=asnDetail.getAsn();
|
Asn asn=asnDetail.getAsn();
|
||||||
asn.setStatus(BizStatus.RECEIVED);
|
asn.setStatus(BizStatus.RECEIVED);
|
||||||
asnRepository.save(asn);
|
asnRepository.save(asn);
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,11 @@ import com.sun.jna.platform.win32.WinDef;
|
||||||
import com.youchain.basicdata.domain.Item;
|
import com.youchain.basicdata.domain.Item;
|
||||||
import com.youchain.basicdata.domain.Point;
|
import com.youchain.basicdata.domain.Point;
|
||||||
import com.youchain.basicdata.domain.Stock;
|
import com.youchain.basicdata.domain.Stock;
|
||||||
import com.youchain.businessdata.domain.CountDetail;
|
import com.youchain.basicdata.repository.PointRepository;
|
||||||
import com.youchain.businessdata.domain.Inventory;
|
import com.youchain.businessdata.domain.*;
|
||||||
import com.youchain.businessdata.domain.InventoryLog;
|
import com.youchain.businessdata.repository.ItemKeyRepository;
|
||||||
import com.youchain.businessdata.domain.ItemKey;
|
import com.youchain.businessdata.repository.TaskRepository;
|
||||||
|
import com.youchain.businessdata.service.InventoryLogService;
|
||||||
import com.youchain.businessdata.service.dto.*;
|
import com.youchain.businessdata.service.dto.*;
|
||||||
import com.youchain.modules.system.domain.Dept;
|
import com.youchain.modules.system.domain.Dept;
|
||||||
import com.youchain.utils.*;
|
import com.youchain.utils.*;
|
||||||
|
|
@ -58,8 +59,12 @@ import java.util.LinkedHashMap;
|
||||||
public class InventoryServiceImpl implements InventoryService {
|
public class InventoryServiceImpl implements InventoryService {
|
||||||
|
|
||||||
private final InventoryRepository inventoryRepository;
|
private final InventoryRepository inventoryRepository;
|
||||||
|
private final InventoryLogService inventoryLogService;
|
||||||
private final InventoryMapper inventoryMapper;
|
private final InventoryMapper inventoryMapper;
|
||||||
private final EntityManager entityManager;
|
private final EntityManager entityManager;
|
||||||
|
private final ItemKeyRepository itemKeyRepository;
|
||||||
|
private final TaskRepository taskRepository;
|
||||||
|
private final PointRepository pointRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryAll(InventoryQueryCriteria criteria, Pageable pageable) {
|
public Map<String, Object> queryAll(InventoryQueryCriteria criteria, Pageable pageable) {
|
||||||
|
|
@ -206,6 +211,39 @@ public class InventoryServiceImpl implements InventoryService {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public Inventory asnAddInventory(List<Map<String,Object>> taskListMap) {
|
||||||
|
for (int i = 0; i < taskListMap.size(); i++) {
|
||||||
|
Map<String,Object> taskMap=taskListMap.get(i);
|
||||||
|
Double qty=Double.valueOf( taskMap.get("qty")+"");
|
||||||
|
String taskIds=taskMap.get("taskIds")+"";
|
||||||
|
Long ikID=Long.valueOf(taskMap.get("ikID")+"");
|
||||||
|
Long pointId=Long.valueOf(taskMap.get("pointId")+"");
|
||||||
|
Inventory inventory =new Inventory();
|
||||||
|
inventory.setQuantity(qty);
|
||||||
|
ItemKey itemKey=itemKeyRepository.getById(ikID);
|
||||||
|
inventory.setItemKey(itemKey);
|
||||||
|
Point point=pointRepository.getById(pointId);
|
||||||
|
inventory.setPoint(point);
|
||||||
|
inventory.setDept(UserUtils.getDept());
|
||||||
|
inventory.setStatus(BizStatus.OPEN);
|
||||||
|
inventoryRepository.save(inventory);
|
||||||
|
//添加库存日志
|
||||||
|
inventoryLogService.storeInventoryLog(BizStatus.RECEIVING_UP,BizStatus.ADD,itemKey.getPropC3(),itemKey,null,inventory.getPoint(),null,null,0d,inventory.getQuantity(), itemKey.getPropC6(),null,inventory.getId(),"");
|
||||||
|
|
||||||
|
String[] arrTaskIds=taskIds.split(",");
|
||||||
|
for (int j = 0; j < arrTaskIds.length; j++) {
|
||||||
|
Long taskId=Long.valueOf(arrTaskIds[j]+"");
|
||||||
|
Task task =taskRepository.getById(taskId);
|
||||||
|
task.setTaskStatus(BizStatus.RECEIVED);
|
||||||
|
task.setInventory(inventory);
|
||||||
|
taskRepository.save(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Object[]> queryItemStock(){
|
public List<Object[]> queryItemStock(){
|
||||||
String hql = "select inv.itemKey.item.code,max(inv.itemKey.item.name),count(inv.id) " +
|
String hql = "select inv.itemKey.item.code,max(inv.itemKey.item.name),count(inv.id) " +
|
||||||
" from Inventory inv where 1=1 and inv.quantity>0 group by inv.itemKey.item.code order by inv.itemKey.item.code";
|
" from Inventory inv where 1=1 and inv.quantity>0 group by inv.itemKey.item.code order by inv.itemKey.item.code";
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,6 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
task.setInvStatus(inv.getStatus());
|
task.setInvStatus(inv.getStatus());
|
||||||
task.setTaskStatus(BizStatus.OPEN);
|
task.setTaskStatus(BizStatus.OPEN);
|
||||||
task.setPlanQty(allocateQty);
|
task.setPlanQty(allocateQty);
|
||||||
task.setInvId(inv.getId());
|
|
||||||
task.setDept(dept);
|
task.setDept(dept);
|
||||||
task.setAgvTask(agvTask);
|
task.setAgvTask(agvTask);
|
||||||
taskRepository.save(task);
|
taskRepository.save(task);
|
||||||
|
|
@ -269,7 +268,6 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
task.setInvStatus(inv.getStatus());
|
task.setInvStatus(inv.getStatus());
|
||||||
task.setTaskStatus(BizStatus.OPEN);
|
task.setTaskStatus(BizStatus.OPEN);
|
||||||
task.setPlanQty(inv.getQuantity());
|
task.setPlanQty(inv.getQuantity());
|
||||||
task.setInvId(inv.getId());
|
|
||||||
task.setDept(dept);
|
task.setDept(dept);
|
||||||
task.setAgvTask(agvTask);
|
task.setAgvTask(agvTask);
|
||||||
task.setTaskType(BizStatus.PICK);
|
task.setTaskType(BizStatus.PICK);
|
||||||
|
|
@ -335,7 +333,6 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
task.setInvStatus(inv.getStatus());
|
task.setInvStatus(inv.getStatus());
|
||||||
task.setTaskStatus(BizStatus.OPEN);
|
task.setTaskStatus(BizStatus.OPEN);
|
||||||
task.setPlanQty(inv.getQuantity());
|
task.setPlanQty(inv.getQuantity());
|
||||||
task.setInvId(inv.getId());
|
|
||||||
task.setDept(dept);
|
task.setDept(dept);
|
||||||
task.setAgvTask(agvTask);
|
task.setAgvTask(agvTask);
|
||||||
task.setTaskType(BizStatus.PICK);
|
task.setTaskType(BizStatus.PICK);
|
||||||
|
|
@ -353,7 +350,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
List<Task> Tasks = taskRepository.getPickNotAllTask(id);
|
List<Task> Tasks = taskRepository.getPickNotAllTask(id);
|
||||||
for (Task task : Tasks) {
|
for (Task task : Tasks) {
|
||||||
//根据Taskz找到对应的库存
|
//根据Taskz找到对应的库存
|
||||||
Inventory inv = inventoryRepository.findById(task.getInvId()).get();
|
Inventory inv = inventoryRepository.findById(task.getInventory().getId()).get();
|
||||||
inv.setQueuedQty(inv.getQueuedQty() - pd.getAllocatedQty());
|
inv.setQueuedQty(inv.getQueuedQty() - pd.getAllocatedQty());
|
||||||
inventoryRepository.save(inv);
|
inventoryRepository.save(inv);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
|
|
||||||
import java.security.PrivateKey;
|
import java.security.PrivateKey;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -172,7 +173,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
task.setMoveQty(pickedQuantity);
|
task.setMoveQty(pickedQuantity);
|
||||||
task.setTaskStatus(BizStatus.FINISH);
|
task.setTaskStatus(BizStatus.FINISH);
|
||||||
taskRepository.save(task);
|
taskRepository.save(task);
|
||||||
Inventory inv = inventoryRepository.findById(task.getInvId()).get();
|
Inventory inv = inventoryRepository.findById(task.getInventory().getId()).get();
|
||||||
if (inv != null) {
|
if (inv != null) {
|
||||||
ItemKey itemKey = inv.getItemKey();
|
ItemKey itemKey = inv.getItemKey();
|
||||||
Item item = itemKey.getItem();
|
Item item = itemKey.getItem();
|
||||||
|
|
@ -216,7 +217,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
TaskDto taskDto = findById(taskId);
|
TaskDto taskDto = findById(taskId);
|
||||||
Task task = taskMapper.toEntity(taskDto);//Dto转实体
|
Task task = taskMapper.toEntity(taskDto);//Dto转实体
|
||||||
PickDetail pickDetail = task.getPickDetail();
|
PickDetail pickDetail = task.getPickDetail();
|
||||||
Inventory inv = inventoryRepository.findById(task.getInvId()).get();
|
Inventory inv = inventoryRepository.findById(task.getInventory().getId()).get();
|
||||||
if (inv != null) {
|
if (inv != null) {
|
||||||
//退回库存
|
//退回库存
|
||||||
double srcQty=inv.getQueuedQty();
|
double srcQty=inv.getQueuedQty();
|
||||||
|
|
@ -267,11 +268,6 @@ public class TaskServiceImpl implements TaskService {
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Task> getAgvTaskList(Integer id) {
|
|
||||||
return taskRepository.getAgvTaskList(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Task> findByPointCode(Long pointId) {
|
public List<Task> findByPointCode(Long pointId) {
|
||||||
String hql=" from Task t where t.dstPoint.id="+pointId+" and t.moveQty=0 ";
|
String hql=" from Task t where t.dstPoint.id="+pointId+" and t.moveQty=0 ";
|
||||||
|
|
@ -281,6 +277,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public ApiResult readRfid(String rfid) {
|
public ApiResult readRfid(String rfid) {
|
||||||
String[] rfids=rfid.split("\\|");
|
String[] rfids=rfid.split("\\|");
|
||||||
String itemCode=rfids[0]+"";
|
String itemCode=rfids[0]+"";
|
||||||
|
|
@ -288,19 +285,24 @@ public class TaskServiceImpl implements TaskService {
|
||||||
String propC2=rfids[2]+"";
|
String propC2=rfids[2]+"";
|
||||||
String propC3=rfids[3]+"";
|
String propC3=rfids[3]+"";
|
||||||
String propC4=rfids[4]+"";
|
String propC4=rfids[4]+"";
|
||||||
String propC5=rfids[5]+"";
|
String propC5=rfids[5]+"";//16进制
|
||||||
StringBuffer propC6=new StringBuffer();
|
StringBuffer propC6=new StringBuffer();
|
||||||
for (int i = 6; i < rfids.length; i++) {
|
for (int i = 6; i < rfids.length; i++) {
|
||||||
if (propC6.length()<1){
|
int decimalNumber = Integer.parseInt(rfids[i], 16);
|
||||||
propC6.append(rfids[i]);
|
int decimalMin = Integer.parseInt("0001", 16);
|
||||||
|
int decimalMax = Integer.parseInt("EA60", 16);
|
||||||
|
if (decimalNumber>=decimalMin&&decimalNumber<=decimalMax){
|
||||||
|
if (propC6.length()<1){
|
||||||
|
propC6.append(rfids[i]);
|
||||||
|
}else {
|
||||||
|
propC6.append(",");
|
||||||
|
propC6.append(rfids[i]);
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
propC6.append(",");
|
System.out.println("无效RFID:"+rfids[i]);
|
||||||
propC6.append(rfids[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rfids.length-6!=Integer.valueOf(propC5)){
|
|
||||||
return ApiResult.result(500, "流水号数量和供货数量不一致", "");
|
|
||||||
}
|
|
||||||
Item item=itemRepository.findByCode(itemCode);
|
Item item=itemRepository.findByCode(itemCode);
|
||||||
if (item==null){
|
if (item==null){
|
||||||
return ApiResult.result(500, "没有物料", "");
|
return ApiResult.result(500, "没有物料", "");
|
||||||
|
|
@ -318,14 +320,20 @@ public class TaskServiceImpl implements TaskService {
|
||||||
};
|
};
|
||||||
|
|
||||||
ItemKey itemKey=itemKeyService.getItemKey(item, propC1, propC2,propC3,propC4,propC5,propC6.toString());
|
ItemKey itemKey=itemKeyService.getItemKey(item, propC1, propC2,propC3,propC4,propC5,propC6.toString());
|
||||||
for (int i = 6; i < rfids.length; i++) {
|
//获取流水号
|
||||||
|
String[] lsh=itemKey.getPropC6().split(",");
|
||||||
|
if (lsh.length!=itemKey.getIntPropC5()){
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return ApiResult.result(500, "流水号数量和供货数量不一致", "");
|
||||||
|
}
|
||||||
|
for (int i = 0; i < lsh.length; i++) {
|
||||||
Task task=new Task();
|
Task task=new Task();
|
||||||
task.setItemKey(itemKey);
|
task.setItemKey(itemKey);
|
||||||
task.setPlanQty(1d);
|
task.setPlanQty(1d);
|
||||||
task.setDept(UserUtils.getDept());
|
task.setDept(UserUtils.getDept());
|
||||||
task.setTaskStatus(BizStatus.RECEIVING);
|
task.setTaskStatus(BizStatus.RECEIVING);
|
||||||
task.setBeSkip(1);
|
task.setBeSkip(1);
|
||||||
task.setPutCode(rfids[i]);
|
task.setPutCode(lsh[i]);
|
||||||
task.setBillCode(propC3);
|
task.setBillCode(propC3);
|
||||||
task.setTaskType(BizStatus.ASN);
|
task.setTaskType(BizStatus.ASN);
|
||||||
Point startPoint=pointRepository.findByTypeAndArea(BaseStatus.PLATFORM,item.getGoodType());
|
Point startPoint=pointRepository.findByTypeAndArea(BaseStatus.PLATFORM,item.getGoodType());
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ public class UrlApi {
|
||||||
/**
|
/**
|
||||||
* 料箱任务下发
|
* 料箱任务下发
|
||||||
*/
|
*/
|
||||||
public static String submitMission = "http://10.177.202.230:10870/interfaces/api/amr/submitMission";
|
public static String submitMission = "http://localhost:8000/interfaces/api/amr/submitMission";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 容器入场
|
* 容器入场
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue