no message
parent
ee5596c7c3
commit
b4ad892629
|
|
@ -75,6 +75,8 @@ public @interface Query {
|
||||||
,NOT_NULL
|
,NOT_NULL
|
||||||
// 为空
|
// 为空
|
||||||
,IS_NULL
|
,IS_NULL
|
||||||
|
// 全部数据 or 1=1
|
||||||
|
,FIND_ALL
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,30 @@ public class TestController {
|
||||||
jsonObject.put("success","false");
|
jsonObject.put("success","false");
|
||||||
return new ResponseEntity<>(jsonObject, OK);
|
return new ResponseEntity<>(jsonObject, OK);
|
||||||
}
|
}
|
||||||
|
@PostMapping("/interfaces/api/amr/containerOut")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> containerOut(@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("/interfaces/api/amr/containerIn")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> containerIn(@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")
|
@PostMapping ("/queryPoint")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> queryPoint(@RequestBody JSONObject json){
|
public ResponseEntity<Object> queryPoint(@RequestBody JSONObject json){
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,9 @@ public class QueryHelp {
|
||||||
list.add(cb.between(getExpression(attributeName, join, root).as((Class<? extends Comparable>) between.get(0).getClass()),
|
list.add(cb.between(getExpression(attributeName, join, root).as((Class<? extends Comparable>) between.get(0).getClass()),
|
||||||
(Comparable) between.get(0), (Comparable) between.get(1)));
|
(Comparable) between.get(0), (Comparable) between.get(1)));
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case FIND_ALL:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.rest;
|
package com.youchain.rest;
|
||||||
|
|
||||||
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.utils.SecurityUtils;
|
import com.youchain.utils.SecurityUtils;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
@ -61,7 +62,7 @@ public class LogController {
|
||||||
}
|
}
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@ApiOperation("日志查询")
|
@ApiOperation("日志查询")
|
||||||
@PreAuthorize("@el.check()")
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> queryLog(LogQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryLog(LogQueryCriteria criteria, Pageable pageable){
|
||||||
criteria.setLogType("INFO");
|
criteria.setLogType("INFO");
|
||||||
return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK);
|
return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK);
|
||||||
|
|
@ -77,7 +78,7 @@ public class LogController {
|
||||||
|
|
||||||
@GetMapping(value = "/error")
|
@GetMapping(value = "/error")
|
||||||
@ApiOperation("错误日志查询")
|
@ApiOperation("错误日志查询")
|
||||||
@PreAuthorize("@el.check()")
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> queryErrorLog(LogQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryErrorLog(LogQueryCriteria criteria, Pageable pageable){
|
||||||
criteria.setLogType("ERROR");
|
criteria.setLogType("ERROR");
|
||||||
return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK);
|
return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK);
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,17 @@ import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.annotation.Log;
|
import com.youchain.annotation.Log;
|
||||||
import com.youchain.appupdate.inputJson.*;
|
import com.youchain.appupdate.inputJson.*;
|
||||||
import com.youchain.appupdate.service.ContainerService;
|
import com.youchain.appupdate.service.ContainerService;
|
||||||
import com.youchain.basicdata.domain.Box;
|
import com.youchain.basicdata.domain.*;
|
||||||
import com.youchain.basicdata.domain.Item;
|
import com.youchain.basicdata.repository.*;
|
||||||
import com.youchain.basicdata.domain.Point;
|
|
||||||
import com.youchain.basicdata.domain.Stock;
|
|
||||||
import com.youchain.basicdata.repository.ZcjxbRepository;
|
|
||||||
import com.youchain.basicdata.service.ItemService;
|
import com.youchain.basicdata.service.ItemService;
|
||||||
import com.youchain.basicdata.service.PointService;
|
import com.youchain.basicdata.service.PointService;
|
||||||
import com.youchain.basicdata.service.StockService;
|
import com.youchain.basicdata.service.StockService;
|
||||||
import com.youchain.basicdata.service.dto.ItemDto;
|
import com.youchain.basicdata.service.dto.ItemDto;
|
||||||
import com.youchain.basicdata.service.dto.ItemQueryCriteria;
|
import com.youchain.basicdata.service.dto.ItemQueryCriteria;
|
||||||
import com.youchain.businessdata.domain.*;
|
import com.youchain.businessdata.domain.*;
|
||||||
|
import com.youchain.businessdata.repository.AgvTaskRepository;
|
||||||
|
import com.youchain.businessdata.repository.InventoryRepository;
|
||||||
|
import com.youchain.businessdata.repository.TaskRepository;
|
||||||
import com.youchain.businessdata.service.*;
|
import com.youchain.businessdata.service.*;
|
||||||
import com.youchain.exception.handler.ApiResult;
|
import com.youchain.exception.handler.ApiResult;
|
||||||
import com.youchain.modules.system.service.DictService;
|
import com.youchain.modules.system.service.DictService;
|
||||||
|
|
@ -28,6 +28,7 @@ import com.youchain.modules.system.service.dto.DictQueryCriteria;
|
||||||
import com.youchain.utils.AreaNameDic;
|
import com.youchain.utils.AreaNameDic;
|
||||||
import com.youchain.utils.BaseStatus;
|
import com.youchain.utils.BaseStatus;
|
||||||
import com.youchain.utils.BizStatus;
|
import com.youchain.utils.BizStatus;
|
||||||
|
import com.youchain.utils.UserUtils;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
@ -35,20 +36,24 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.access.method.P;
|
import org.springframework.security.access.method.P;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||||
import static org.springframework.http.HttpStatus.OK;
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Api(tags = "app场景管理")
|
@Api(tags = "app接口管理")
|
||||||
@RequestMapping("/api/appScene")
|
@RequestMapping("/api/appScene")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class SceneAppController {
|
public class SceneAppController {
|
||||||
|
|
@ -56,19 +61,456 @@ public class SceneAppController {
|
||||||
private final ItemService itemService;
|
private final ItemService itemService;
|
||||||
|
|
||||||
private final PointService pointService;
|
private final PointService pointService;
|
||||||
|
private final TaskRepository taskRepository;
|
||||||
|
private final BillTypeRepository billTypeRepository;
|
||||||
|
private final PointRepository pointRepository;
|
||||||
private final StockService stockService;
|
private final StockService stockService;
|
||||||
|
private final StockTypeRepository stockTypeRepository;
|
||||||
|
private final BoxRepository boxRepository;
|
||||||
|
|
||||||
private final DictService dictService;
|
private final DictService dictService;
|
||||||
private final AsnDetailService asnDetailService;
|
private final AsnDetailService asnDetailService;
|
||||||
private final PickDetailService pickDetailService;
|
private final PickDetailService pickDetailService;
|
||||||
private final ItemKeyService itemKeyService;
|
private final ItemKeyService itemKeyService;
|
||||||
private final AgvTaskService agvTaskService;
|
private final AgvTaskService agvTaskService;
|
||||||
|
private final AgvTaskRepository agvTaskRepository;
|
||||||
private final TaskService taskService;
|
private final TaskService taskService;
|
||||||
private final InventoryService inventoryService;
|
private final InventoryService inventoryService;
|
||||||
|
private final ItemRepository itemRepository;
|
||||||
|
private final InventoryRepository inventoryRepository;
|
||||||
//容器出场和入场
|
//容器出场和入场
|
||||||
private final ContainerService containerService;
|
private final ContainerService containerService;
|
||||||
private final ZcjxbRepository zcjxbRepository;
|
private final ZcjxbRepository zcjxbRepository;
|
||||||
|
@PostMapping("/pointStockBack")
|
||||||
|
@Log("App接口》 容器出入场")
|
||||||
|
@ApiOperation("容器出入场")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> pointStockBack(@RequestBody JSONObject jsonObject) {
|
||||||
|
System.out.println("容器入场:"+jsonObject);
|
||||||
|
String type = jsonObject.getString("type");
|
||||||
|
String storageType = jsonObject.getString("code");
|
||||||
|
String pointCode = jsonObject.getString("pointCode");
|
||||||
|
Point point=pointRepository.findByCode(pointCode);
|
||||||
|
if (type.equals("asn")) {
|
||||||
|
agvTaskService.pointStockRk(storageType, point.getId());
|
||||||
|
}else if (type.equals("pick")){
|
||||||
|
agvTaskService.pointStockCk(storageType, point.getId());
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(ApiResult.success(OK.value(), "操作成功", ""), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
@PostMapping("/asn/rkReadRFID")
|
||||||
|
@Log("app接口》成品/料箱 人工入库-读取RFID")
|
||||||
|
@ApiOperation("成品/料箱 人工入库-读取RFID")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> rkReadRFID(@RequestBody String data) {
|
||||||
|
JSONObject jsonObject=JSONObject.parseObject(data);
|
||||||
|
String rfid=jsonObject.getString("rfid");
|
||||||
|
String type=jsonObject.getString("type");
|
||||||
|
String pointType=jsonObject.getString("pointType");
|
||||||
|
ApiResult apiResult;
|
||||||
|
if (type.equals("ASN")){
|
||||||
|
apiResult = taskService.devanRfidAsn(rfid,pointType);
|
||||||
|
}else {
|
||||||
|
apiResult = taskService.devanRfidPT(rfid);
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/asn/rqRkSub")
|
||||||
|
@Log("app接口》半成品/料箱 AGV入库-容器入库")
|
||||||
|
@ApiOperation("半成品/料箱 AGV入库-容器入库")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> rqRkSub(@RequestBody String data) {
|
||||||
|
JSONObject jsonObject=JSONObject.parseObject(data);
|
||||||
|
Long taskId=jsonObject.getLong("id");
|
||||||
|
Box box=boxRepository.getById(taskId);
|
||||||
|
String stockType = BizStatus.getBillToStock(box.getLampStatus());
|
||||||
|
ApiResult apiResult;
|
||||||
|
apiResult = agvTaskService.pointStockRk(stockType,box.getPoint().getId());
|
||||||
|
Point pointEndCode=pointRepository.findByTypeAndArea(BaseStatus.PLATFORM,"TAGM");
|
||||||
|
if (apiResult.getStatus()==200){
|
||||||
|
apiResult = agvTaskService.addAgvTask(box.getPoint().getId(),pointEndCode.getCode());
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
@PostMapping("/asn/RkSub")
|
||||||
|
@Log("app接口》成品/料箱 人工入库-确定收货")
|
||||||
|
@ApiOperation("成品/料箱 人工入库-确定收货")
|
||||||
|
@AnonymousAccess
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public ResponseEntity<Object> rkSub(@RequestBody JSONObject request) {
|
||||||
|
String rfid=request.getString("rfid");
|
||||||
|
int agvFlag=request.getIntValue("agvFlag");
|
||||||
|
Point point= pointRepository.findByCode(request.getString("pointCode"));
|
||||||
|
// 人工入库 直接生成库存
|
||||||
|
ApiResult apiResult = taskService.manualReceiving(rfid,point,agvFlag);
|
||||||
|
if (point.getType().equals(BaseStatus.BOX)){
|
||||||
|
if (apiResult.getStatus()==200){
|
||||||
|
// AGV入库 生成搬运任务(目标库区,单据任务类型)
|
||||||
|
apiResult = agvTaskService.addAgvAsn(point.getArea().getCode(),apiResult.getData().toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
@PostMapping("/asn/sjTaskList")
|
||||||
|
@Log("app接口》人工入库-料箱上架 查询待上架Task任务")
|
||||||
|
@ApiOperation("人工入库-料箱上架 查询待上架Task任务")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> sjTaskList(@RequestBody(required=false) String request) {
|
||||||
|
List<Map<String, Object>> taskList;
|
||||||
|
if (request==null) {
|
||||||
|
taskList = taskRepository.findBySjTask();
|
||||||
|
}else {
|
||||||
|
JSONObject requestJson=JSONObject.parseObject(request);
|
||||||
|
String rfid=requestJson.getString("rfid");
|
||||||
|
taskList = taskRepository.findBySjTask(rfid);
|
||||||
|
// 人工入库 直接生成库存
|
||||||
|
if (taskList==null||taskList.size()<1){
|
||||||
|
ApiResult apiResult = ApiResult.fail(500,"为查询到数据",taskList);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ApiResult apiResult = ApiResult.fail(200,"查询成功",taskList);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
@PostMapping("/asn/rqRkList")
|
||||||
|
@Log("app接口》半成品/料箱 AGV入库-人工入场点位配置")
|
||||||
|
@ApiOperation("半成品/料箱 AGV入库-人工入场点位配置")
|
||||||
|
public ResponseEntity<Object> rqRkList() {
|
||||||
|
JSONArray jsonArray=new JSONArray();
|
||||||
|
List<Box> boxList=boxRepository.getByEnabled(true);
|
||||||
|
for (int i = 0; i < boxList.size(); i++) {
|
||||||
|
JSONObject jsonObject=new JSONObject();
|
||||||
|
Box box=boxList.get(i);
|
||||||
|
BillType billType=billTypeRepository.findByCode(box.getLampStatus());
|
||||||
|
if (billType!=null){
|
||||||
|
jsonObject.put("stockTypeName", billType.getName());
|
||||||
|
}
|
||||||
|
jsonObject.put("pointName", box.getPoint().getName());
|
||||||
|
jsonObject.put("boxCode", box.getCode());
|
||||||
|
if (box.getPoint().getStorageType()==null||box.getPoint().getStorageType().length()<1){
|
||||||
|
jsonObject.put("status", "");
|
||||||
|
}else {
|
||||||
|
jsonObject.put("status", "占用");
|
||||||
|
}
|
||||||
|
jsonObject.put("id", box.getId());
|
||||||
|
jsonArray.add(jsonObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
ApiResult apiResult=ApiResult.fail(200,"查询成功",jsonArray);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
@PostMapping("/asn/sjSub")
|
||||||
|
@Log("app接口》AGV入库-料箱上架")
|
||||||
|
@ApiOperation("AGV入库-料箱上架")
|
||||||
|
@AnonymousAccess
|
||||||
|
@Transactional
|
||||||
|
public ResponseEntity<Object> sjSub(@RequestBody JSONObject request) {
|
||||||
|
Long taskId=request.getLong("id");
|
||||||
|
String pointCode=request.getString("endPointCode");
|
||||||
|
Point point=pointRepository.findByCode(pointCode);
|
||||||
|
ApiResult apiResult = taskService.butSTputaway(taskId,point.getId());
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
@PostMapping("/asn/bcpRgRkSub")
|
||||||
|
@Log("半成品 人工入库-确定收货")
|
||||||
|
@ApiOperation("半成品 人工入库-确定收货")
|
||||||
|
@AnonymousAccess
|
||||||
|
@Transactional
|
||||||
|
public ResponseEntity<Object> bcpRgRkSub(@RequestBody JSONObject request) {
|
||||||
|
Point point= pointRepository.findByCode(request.getString("pointCode"));
|
||||||
|
int agvFlag=request.getIntValue("agvFlag");
|
||||||
|
JSONArray tableList=request.getJSONArray("tableList");
|
||||||
|
int apiCode=200;
|
||||||
|
JSONArray apiData=new JSONArray();
|
||||||
|
for (int i = 0; i < tableList.size(); i++) {
|
||||||
|
JSONObject tableSize=tableList.getJSONObject(i);
|
||||||
|
String rfid=tableSize.getString("rfid");
|
||||||
|
String id=tableSize.getString("id");
|
||||||
|
ApiResult apiResult = taskService.manualReceiving(rfid,point,agvFlag);
|
||||||
|
JSONObject data=new JSONObject();
|
||||||
|
data.put("id", id);
|
||||||
|
apiResult.setData(data);
|
||||||
|
if (apiResult.getStatus()!=200){
|
||||||
|
apiCode=500;
|
||||||
|
}
|
||||||
|
apiData.add(apiResult);
|
||||||
|
}
|
||||||
|
String msg="解析完成-操作成功";
|
||||||
|
if (apiCode!=200){
|
||||||
|
msg="解析完成-操作失败";
|
||||||
|
//回滚
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
}
|
||||||
|
ApiResult apiResult=ApiResult.fail(apiCode,msg,apiData);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
@PostMapping("/asn/bcpRgRkTjPoint")
|
||||||
|
@Log("半成品人工入库-推荐库位")
|
||||||
|
@ApiOperation("半成品人工入库-推荐库位")
|
||||||
|
@AnonymousAccess
|
||||||
|
@Transactional
|
||||||
|
public ResponseEntity<Object> bcpRgRkTjPoint(@RequestBody String type) {
|
||||||
|
System.out.println(type);
|
||||||
|
ApiResult apiResult;
|
||||||
|
if (type.equals(BizStatus.BCP)) {
|
||||||
|
List<Point> pointEndList = pointRepository.findByAreaCode(BizStatus.BCP);
|
||||||
|
if (pointEndList.size() < 1) {
|
||||||
|
apiResult = ApiResult.fail(200, "没有推荐库位", "");
|
||||||
|
} else {
|
||||||
|
JSONObject data = new JSONObject();
|
||||||
|
data.put("pointCode", pointEndList.get(0).getCode());
|
||||||
|
apiResult = ApiResult.fail(200, "操作成功", data);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
apiResult=ApiResult.fail(500,"参数错误",null);
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
@PostMapping("/pick/rfJhTaskList")
|
||||||
|
@Log("app接口》人工拣货 查询已分配Task任务")
|
||||||
|
@ApiOperation("人工拣货 查询已分配Task任务")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> rfJhTaskList(@RequestBody(required=false) String request) {
|
||||||
|
List<Map<String, Object>> taskList;
|
||||||
|
if (request==null) {
|
||||||
|
taskList = taskRepository.findByRgJhTask(null);
|
||||||
|
}else {
|
||||||
|
JSONObject requestJson=JSONObject.parseObject(request);
|
||||||
|
String rfid=requestJson.getString("rfid");
|
||||||
|
taskList = taskRepository.findByRgJhTask(rfid);
|
||||||
|
// 人工入库 直接生成库存
|
||||||
|
if (taskList==null||taskList.size()<1){
|
||||||
|
ApiResult apiResult = ApiResult.fail(500,"未查询到数据",taskList);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ApiResult apiResult = ApiResult.fail(200,"查询成功",taskList);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
@PostMapping("/pick/lxJhTaskList")
|
||||||
|
@Log("app接口》料箱拣货 查询料箱拣货Task任务")
|
||||||
|
@ApiOperation("人工拣货 查询已分配Task任务")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> lxJhTaskList(@RequestBody(required=false) String request) {
|
||||||
|
List<Map<String, Object>> taskList;
|
||||||
|
if (request==null) {
|
||||||
|
taskList = taskRepository.findByLxJhTask(null);
|
||||||
|
}else {
|
||||||
|
JSONObject requestJson=JSONObject.parseObject(request);
|
||||||
|
String rfid=requestJson.getString("rfid");
|
||||||
|
taskList = taskRepository.findByLxJhTask(rfid);
|
||||||
|
if (taskList==null||taskList.size()<1){
|
||||||
|
ApiResult apiResult = ApiResult.fail(500,"未查询到数据",taskList);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ApiResult apiResult = ApiResult.fail(200,"查询成功",taskList);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
@PostMapping("/pick/rfJhSub")
|
||||||
|
@Log("app接口》人工拣货-拣货确认")
|
||||||
|
@ApiOperation("人工拣货-拣货确认")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> rfJhSub(@RequestBody(required=false) JSONObject request) {
|
||||||
|
JSONArray jsonArray=request.getJSONArray("ids");
|
||||||
|
Long[] taskId = new Long[jsonArray.size()];
|
||||||
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
|
taskId[i]=jsonArray.getLong(i);
|
||||||
|
}
|
||||||
|
ApiResult apiResult=taskService.picking(taskId);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
@PostMapping("/inv/thInvList")
|
||||||
|
@Log("app接口》库存查询")
|
||||||
|
@ApiOperation("拣货-库存查询")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> thInvList(@RequestBody(required=false) JSONObject request) {
|
||||||
|
String msg="";
|
||||||
|
List<Inventory> inventoryList;
|
||||||
|
if (request==null) {
|
||||||
|
inventoryList = inventoryRepository.findAll();
|
||||||
|
msg="全部库存";
|
||||||
|
}else {
|
||||||
|
String type=request.getString("type");
|
||||||
|
String rfid=request.getString("rfid");
|
||||||
|
String param=request.getString("param");
|
||||||
|
if (type.equals("query")){
|
||||||
|
inventoryList=inventoryRepository.findByParam(param);
|
||||||
|
msg="查询成功";
|
||||||
|
}else {
|
||||||
|
inventoryList = inventoryRepository.findByItemKeyC7(rfid);
|
||||||
|
// 人工入库 直接生成库存
|
||||||
|
if (inventoryList == null || inventoryList.size() < 1) {
|
||||||
|
ApiResult apiResult = ApiResult.fail(500, "未查询到数据", inventoryList);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
Inventory inventory = inventoryList.get(0);
|
||||||
|
if (type.equals("startInv")) {
|
||||||
|
if (inventory.getQueuedQty() < 1 || inventory.getPoint().getStatus().equals(BaseStatus.USED)) {
|
||||||
|
ApiResult apiResult = ApiResult.fail(500, "库存未被占用或搬运任务未完成", null);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
msg = "被替换库存";
|
||||||
|
} else if (type.equals("endInv")) {
|
||||||
|
if (inventory.getQueuedQty() > 0 || inventory.getPoint().getStatus().equals(BaseStatus.USED)) {
|
||||||
|
ApiResult apiResult = ApiResult.fail(500, "库存已被占用或搬运任务未完成", null);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
msg = "替换库存";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ApiResult apiResult=ApiResult.fail(200,msg,inventoryList);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
@PostMapping("/inv/ctInv")
|
||||||
|
@Log("app接口》拆托")
|
||||||
|
@ApiOperation("拣货-拆托")
|
||||||
|
@AnonymousAccess
|
||||||
|
@Transactional
|
||||||
|
public ResponseEntity<Object> ctInv(@RequestBody(required=false) JSONObject request) {
|
||||||
|
JSONArray invIds=request.getJSONArray("invIds");//invIds
|
||||||
|
String rfid1=request.getString("rfid1");//
|
||||||
|
String rfid2=request.getString("rfid2");//
|
||||||
|
Point point = null;
|
||||||
|
for (int i = 0; i < invIds.size(); i++) {
|
||||||
|
long invId=invIds.getLong(i);
|
||||||
|
Inventory startInventory=inventoryRepository.getById(invId);
|
||||||
|
if (point==null){
|
||||||
|
point=startInventory.getPoint();
|
||||||
|
}
|
||||||
|
inventoryRepository.delete(startInventory);
|
||||||
|
}
|
||||||
|
// 解析RFID信息
|
||||||
|
Inventory inventory1 = getApiResult(rfid1);
|
||||||
|
inventory1.setPoint(point);
|
||||||
|
inventoryRepository.save(inventory1);
|
||||||
|
Inventory inventory2 = getApiResult(rfid2);
|
||||||
|
ApiResult apiResult=ApiResult.fail(200,"操作成功",null);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
private Inventory getApiResult(String rfid1) {
|
||||||
|
String[] rfids=rfid1.split("\\|");
|
||||||
|
String itemCode= rfids[0]+"";
|
||||||
|
Item item=itemRepository.findByCode(itemCode);
|
||||||
|
String propC1= rfids[1]+"";
|
||||||
|
String propC2= rfids[2]+"";
|
||||||
|
String propC3= rfids[3]+"";// 系统单号
|
||||||
|
|
||||||
|
String propC4= rfids[4]+"";
|
||||||
|
String propC5= rfids[5]+"";//16进制 供货数量
|
||||||
|
StringBuffer propC6 = new StringBuffer();//流水号
|
||||||
|
StringBuffer propC7 = new StringBuffer();//成品物料码
|
||||||
|
int xs = 0;//成品收货-箱数
|
||||||
|
int xs_d = 0;//成品收货-单箱数量
|
||||||
|
Double xs_start_d = 0d;//成品收货-起始箱码
|
||||||
|
Double xs_end_d=0d;//成品收货-终止箱码
|
||||||
|
String propC6Title=null;//成品收货-成品码抬头
|
||||||
|
Long propC6_start_d = 0l;//成品收货-成品码起始码
|
||||||
|
Long propC6_end_d=0l;//成品收货-成品码终止码
|
||||||
|
// 更新当前点位 存储容器状态
|
||||||
|
String storageType=item.getGoodType();
|
||||||
|
if (item.getGoodType().equals(BizStatus.CP)) {
|
||||||
|
propC6Title= rfids[7].substring(0, 6);
|
||||||
|
propC6_start_d=Long.valueOf(rfids[7].substring(6, rfids[7].length()-1));//起始成品码
|
||||||
|
propC6_end_d=Long.valueOf(rfids[8].substring(6, rfids[8].length()-1));//终止成品码
|
||||||
|
propC6.append(propC6Title+propC6_start_d+"-"+propC6Title+propC6_end_d);
|
||||||
|
xs = Integer.parseInt(rfids[9], 16);//箱数
|
||||||
|
xs_start_d = Double.valueOf(rfids[10]);//料箱起始码
|
||||||
|
xs_end_d = Double.valueOf(rfids[11]);//料箱终止码
|
||||||
|
xs_d = Integer.parseInt(propC5, 16) / xs;//单箱数量
|
||||||
|
|
||||||
|
//成品容器类型 入库
|
||||||
|
storageType=BizStatus.CTP_STO;
|
||||||
|
} else {
|
||||||
|
for (int i = 6; i < rfids.length; i++) {
|
||||||
|
int decimalNumber = Integer.parseInt(rfids[i], 16);
|
||||||
|
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 {
|
||||||
|
System.out.println("无效RFID:" + rfids[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//半成品 入库
|
||||||
|
storageType=BizStatus.TP_STO;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemKey itemKeyRfid1 = itemKeyService.getItemKey(item, propC1, propC2, propC3, propC4, propC5, propC6.toString(), rfid1);
|
||||||
|
int qty = Integer.parseInt(propC5, 16);//单箱数量
|
||||||
|
Inventory inventoryRfid1 = inventoryService.getInventory(Double.valueOf(qty), itemKeyRfid1.getId(), null,BizStatus.RECEIVING_UP);
|
||||||
|
return inventoryRfid1;
|
||||||
|
}
|
||||||
|
@PostMapping("/sto/getStockType")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> getStockType() {
|
||||||
|
List<StockType> stockTypeList=stockTypeRepository.findAll();
|
||||||
|
ApiResult apiResult = ApiResult.fail(200,"加载完成",stockTypeList);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/pick/thInvSub")
|
||||||
|
@Log("app接口》拣货-确认替换分配库存")
|
||||||
|
@ApiOperation("拣货-确认替换分配库存")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> thInvSub(@RequestBody(required=false) JSONArray request) {
|
||||||
|
Long startId=null;
|
||||||
|
Long endId=null;
|
||||||
|
for (int i = 0; i < request.size(); i++) {
|
||||||
|
String type=request.getJSONObject(i).getString("type");
|
||||||
|
if (type.equals("startInv")){
|
||||||
|
startId=request.getJSONObject(i).getLong("id");
|
||||||
|
}else {
|
||||||
|
endId=request.getJSONObject(i).getLong("id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<Task> task=taskRepository.findByInv(startId);
|
||||||
|
ApiResult apiResult;
|
||||||
|
/** 取消分配库存 */
|
||||||
|
apiResult = pickDetailService.cancelAllocate(task.get(0).getPickDetail().getId(),task.get(0).getInventory().getQuantity());
|
||||||
|
if (apiResult.getStatus()!=200){
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
/** 重新分配 */
|
||||||
|
Inventory inventory=inventoryRepository.getById(endId);
|
||||||
|
Point point=pointRepository.findByCode(task.get(0).getPickDetail().getPropC5());
|
||||||
|
List<Inventory> inventoryList= Arrays.asList(inventory);
|
||||||
|
int agvFlag=0;
|
||||||
|
if (task.get(0).getPickDetail().getPropC4().equals("AGV_PT")){
|
||||||
|
agvFlag=1;
|
||||||
|
}
|
||||||
|
apiResult = pickDetailService.allocate(task.get(0).getPickDetail(), UserUtils.getDept(), inventory.getQuantity(),agvFlag,point,inventoryList);
|
||||||
|
if (apiResult==null){
|
||||||
|
apiResult=ApiResult.fail(200,"替换成功",null);
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
@PostMapping("/pick/lxJhSub")
|
||||||
|
@Log("app接口》出库-料箱拣货")
|
||||||
|
@ApiOperation("出库-料箱拣货")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> lxJhSub(@RequestBody(required=false) JSONObject request) {
|
||||||
|
JSONArray taskIds=request.getJSONArray("ids");
|
||||||
|
/** AGV料箱出库生成AgvTask*/
|
||||||
|
ApiResult apiResult = taskService.rmCkPickUp(taskIds);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/zCBindingItem")
|
@PostMapping("/zCBindingItem")
|
||||||
@Log("轴承座机械臂换邦物料")
|
@Log("轴承座机械臂换邦物料")
|
||||||
|
|
@ -257,7 +699,6 @@ public class SceneAppController {
|
||||||
|
|
||||||
@PostMapping("/pointCallStock")
|
@PostMapping("/pointCallStock")
|
||||||
@Log("容器搬运")
|
@Log("容器搬运")
|
||||||
@ApiOperation("容器搬运")
|
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> pointCallStock(@RequestBody JSONObject jsonObject) {
|
public ResponseEntity<Object> pointCallStock(@RequestBody JSONObject jsonObject) {
|
||||||
System.out.println("容器搬运"+jsonObject);
|
System.out.println("容器搬运"+jsonObject);
|
||||||
|
|
@ -322,67 +763,6 @@ public class SceneAppController {
|
||||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK);
|
return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/pointStockBack")
|
|
||||||
@Log("容器入场")
|
|
||||||
@ApiOperation("容器入场")
|
|
||||||
@AnonymousAccess
|
|
||||||
public ResponseEntity<Object> pointStockBack(@RequestBody JSONObject jsonObject) {
|
|
||||||
System.out.println("容器入场:"+jsonObject);
|
|
||||||
String storageType = jsonObject.getString("storageType");
|
|
||||||
JSONArray ids=jsonObject.getJSONArray("ids");
|
|
||||||
for (int i = 0; i < ids.size(); i++) {
|
|
||||||
Long id = ids.getLong(i);
|
|
||||||
agvTaskService.pointStockRk(storageType,id);
|
|
||||||
|
|
||||||
}
|
|
||||||
/*String pointCode = pointCallStock.getPointCode();
|
|
||||||
String agvScene = pointCallStock.getAgvScene();
|
|
||||||
String srcAreaName = null;
|
|
||||||
String endAreaName = null;
|
|
||||||
if (agvScene.equals(BizStatus.ZC)) {
|
|
||||||
srcAreaName = AreaNameDic.ZCJXB;
|
|
||||||
endAreaName = AreaNameDic.ZCK;
|
|
||||||
|
|
||||||
}
|
|
||||||
Point srcPoint = pointService.getPoint(pointCode, null, null, srcAreaName);
|
|
||||||
if (srcPoint == null) {
|
|
||||||
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), pointCode + "点位不存在!", ""), HttpStatus.BAD_REQUEST);
|
|
||||||
}
|
|
||||||
Stock st = stockService.findByPointCode(srcPoint.getCode());
|
|
||||||
String stockCode = null;
|
|
||||||
if (st != null) {
|
|
||||||
stockCode = st.getCode();
|
|
||||||
} else {
|
|
||||||
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), srcPoint.getCode() + "对应点位无容器!", ""), HttpStatus.BAD_REQUEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
//查找空车区是否点位
|
|
||||||
|
|
||||||
Point endPoint = pointService.getPointByFree(endAreaName, null);
|
|
||||||
if (endPoint == null) {
|
|
||||||
throw new RuntimeException("空车区没有空闲点位!");
|
|
||||||
}
|
|
||||||
//生成搬运任务
|
|
||||||
AgvTask agvTask = new AgvTask(BizStatus.EMPTY_IN, stockCode, srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "RACK_MOVE");
|
|
||||||
agvTaskService.create(agvTask);
|
|
||||||
String code = "0";
|
|
||||||
String message = null;
|
|
||||||
String agv_on_off = "OFF";
|
|
||||||
agv_on_off = dictService.getDictDescription("agv_on_off") == null ? "OFF" : dictService.getDictDescription("agv_on_off").getDescription();
|
|
||||||
if (agv_on_off.equals("ON")) {
|
|
||||||
String resultJson = agvTaskService.sendAgvTaskImpl(agvTask);//发送任务
|
|
||||||
JSONObject resulObject = JSON.parseObject(resultJson);
|
|
||||||
code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
|
||||||
message = resulObject.getString("message") == null ? "" : resulObject.getString("message");
|
|
||||||
}
|
|
||||||
if (code.equals("0")) {
|
|
||||||
endPoint.setStatus(BaseStatus.USED);
|
|
||||||
pointService.update(endPoint);
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException(message);
|
|
||||||
}*/
|
|
||||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean stockOutIn(String stockCode, String pointCode) {//容器出场再入场
|
public Boolean stockOutIn(String stockCode, String pointCode) {//容器出场再入场
|
||||||
Stock stock = stockService.findByCode(stockCode, null);
|
Stock stock = stockService.findByCode(stockCode, null);
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ public class Box extends BaseEntity implements Serializable {
|
||||||
private String iP;
|
private String iP;
|
||||||
|
|
||||||
@Column(name = "`lamp_status`")
|
@Column(name = "`lamp_status`")
|
||||||
@ApiModelProperty(value = "指示灯状态")
|
@ApiModelProperty(value = "单据类型")
|
||||||
private String lampStatus;
|
private String lampStatus;
|
||||||
|
|
||||||
@Column(name = "`lamp_code`")
|
@Column(name = "`lamp_code`")
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,9 @@ public class StockType extends BaseEntity implements Serializable {
|
||||||
@Column(name = "`code`")
|
@Column(name = "`code`")
|
||||||
@ApiModelProperty(value = "代码")
|
@ApiModelProperty(value = "代码")
|
||||||
private String code;
|
private String code;
|
||||||
|
@Column(name = "`mode`")
|
||||||
|
@ApiModelProperty(value = "容器模型")
|
||||||
|
private String mode;
|
||||||
|
|
||||||
@Column(name = "`enabled`",nullable = false)
|
@Column(name = "`enabled`",nullable = false)
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|
|
||||||
|
|
@ -30,4 +30,6 @@ import java.util.List;
|
||||||
public interface BillTypeRepository extends JpaRepository<BillType, Long>, JpaSpecificationExecutor<BillType> {
|
public interface BillTypeRepository extends JpaRepository<BillType, Long>, JpaSpecificationExecutor<BillType> {
|
||||||
@Query(value = "SELECT b FROM BillType b WHERE b.sourceName = ?1 ")
|
@Query(value = "SELECT b FROM BillType b WHERE b.sourceName = ?1 ")
|
||||||
List<BillType> findBySourceName(String sourceName);
|
List<BillType> findBySourceName(String sourceName);
|
||||||
|
@Query(value = "SELECT b FROM BillType b WHERE b.code = ?1 ")
|
||||||
|
BillType findByCode(String code);
|
||||||
}
|
}
|
||||||
|
|
@ -43,6 +43,8 @@ public interface BoxRepository extends JpaRepository<Box, Long>, JpaSpecificatio
|
||||||
|
|
||||||
@Query(value = "SELECT * FROM base_box", nativeQuery = true)
|
@Query(value = "SELECT * FROM base_box", nativeQuery = true)
|
||||||
List<Box> getBoxAllData();
|
List<Box> getBoxAllData();
|
||||||
|
@Query(value = "SELECT b FROM Box b where b.enabled=?1 and b.lampStatus in ('RM_RK','SM_RK') and b.lampCode='AGV_ASN'", nativeQuery = false)
|
||||||
|
List<Box> getByEnabled(boolean enabled);
|
||||||
@Query(value = "SELECT b FROM Box b where b.code=?1 and b.enabled=true ")
|
@Query(value = "SELECT b FROM Box b where b.code=?1 and b.enabled=true ")
|
||||||
List<Box> findByCodeAndItem(String code);
|
List<Box> findByCodeAndItem(String code);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,19 @@ import java.util.Map;
|
||||||
* @date 2023-07-26
|
* @date 2023-07-26
|
||||||
**/
|
**/
|
||||||
public interface PointRepository extends JpaRepository<Point, Long>, JpaSpecificationExecutor<Point> {
|
public interface PointRepository extends JpaRepository<Point, Long>, JpaSpecificationExecutor<Point> {
|
||||||
@Query(value = "SELECT p FROM Point p WHERE (?1 is null or ?1 = p.area.code) and p.type='STORAGE' and p.enabled=true and (p.storageType is null or length(p.storageType)=0) ", nativeQuery = false)
|
@Query(value = "SELECT p FROM Point p WHERE (?1 = 'null' or ?1 = p.area.code or p.area.code='TAGM') and (?2 = 'null' or ?2 = p.type or 'PLATFORM' = p.type) " +
|
||||||
List<Point> getKyPointList(String areaCode);
|
"and p.enabled=true and (p.storageType is null or length(p.storageType)=0) ", nativeQuery = false)
|
||||||
|
List<Point> getKyPointList(String areaCode,String asnType);
|
||||||
|
@Query(value = "SELECT p FROM Point p WHERE (?1 = 'null' or ?1 = p.area.code) and (?2 = 'null' or ?2 = p.type) " +
|
||||||
|
"and p.enabled=true and (p.storageType is null or length(p.storageType)=0) ", nativeQuery = false)
|
||||||
|
List<Point> getTjPointList(String billTypeCode, String pointType);
|
||||||
|
/** 查询料箱载具所在的位置*/
|
||||||
|
@Query(value = "SELECT p FROM Point p WHERE (?1 = 'null' or ?1 = p.area.code or p.area.code='TAGM') and (?2 = 'null' or ?2 = p.type) " +
|
||||||
|
"and p.enabled=true and (p.storageType is null or length(p.storageType)=0 or p.code=?3)", nativeQuery = false)
|
||||||
|
List<Point> getLxzPointList(String areaCode, String asnType,String inCode);
|
||||||
|
|
||||||
/** 分配 库位*/
|
/** 分配 库位*/
|
||||||
@Query(value = "SELECT p FROM Point p WHERE p.area.code=?1 and p.enabled=true and p.storageType is not null")
|
@Query(value = "SELECT p FROM Point p WHERE p.area.code=?1 and p.status='USED' and p.enabled=true and (p.storageType is null or length(p.storageType)=0) order by p.heat asc ")
|
||||||
List<Point> findByAreaCode(String areaCode);
|
List<Point> findByAreaCode(String areaCode);
|
||||||
/**成品区- 占用库位*/
|
/**成品区- 占用库位*/
|
||||||
@Query(value = "SELECT p FROM Point p WHERE p.area.code=?1 and p.enabled=true and p.storageType is null " +
|
@Query(value = "SELECT p FROM Point p WHERE p.area.code=?1 and p.enabled=true and p.storageType is null " +
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,10 @@
|
||||||
package com.youchain.basicdata.repository;
|
package com.youchain.basicdata.repository;
|
||||||
|
|
||||||
import com.youchain.basicdata.domain.StockType;
|
import com.youchain.basicdata.domain.StockType;
|
||||||
|
import jdk.nashorn.internal.objects.AccessorPropertyDescriptor;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
|
|
@ -25,4 +27,6 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
* @date 2023-07-28
|
* @date 2023-07-28
|
||||||
**/
|
**/
|
||||||
public interface StockTypeRepository extends JpaRepository<StockType, Long>, JpaSpecificationExecutor<StockType> {
|
public interface StockTypeRepository extends JpaRepository<StockType, Long>, JpaSpecificationExecutor<StockType> {
|
||||||
|
@Query(value = "SELECT b FROM StockType b WHERE b.code = ?1 ")
|
||||||
|
StockType findByCode(String code);
|
||||||
}
|
}
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.basicdata.rest;
|
package com.youchain.basicdata.rest;
|
||||||
|
|
||||||
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.annotation.Log;
|
import com.youchain.annotation.Log;
|
||||||
import com.youchain.basicdata.domain.AgvScene;
|
import com.youchain.basicdata.domain.AgvScene;
|
||||||
import com.youchain.basicdata.service.AgvSceneService;
|
import com.youchain.basicdata.service.AgvSceneService;
|
||||||
|
|
@ -63,7 +64,7 @@ public class AgvSceneController {
|
||||||
@GetMapping("/agvSceneAll")
|
@GetMapping("/agvSceneAll")
|
||||||
@Log("查询agv_scene全部数据")
|
@Log("查询agv_scene全部数据")
|
||||||
@ApiOperation("查询agv_scene全部数据")
|
@ApiOperation("查询agv_scene全部数据")
|
||||||
@PreAuthorize("@el.check('agvScene:list')")
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> queryAgvSceneAll(AgvSceneQueryCriteria criteria){
|
public ResponseEntity<Object> queryAgvSceneAll(AgvSceneQueryCriteria criteria){
|
||||||
return new ResponseEntity<>(agvSceneService.queryAll(criteria),HttpStatus.OK);
|
return new ResponseEntity<>(agvSceneService.queryAll(criteria),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import com.youchain.exception.handler.ApiError;
|
||||||
import com.youchain.exception.handler.ApiResult;
|
import com.youchain.exception.handler.ApiResult;
|
||||||
import com.youchain.modules.system.domain.Dept;
|
import com.youchain.modules.system.domain.Dept;
|
||||||
import com.youchain.utils.BaseStatus;
|
import com.youchain.utils.BaseStatus;
|
||||||
|
import com.youchain.utils.BizStatus;
|
||||||
import com.youchain.utils.FileUtil;
|
import com.youchain.utils.FileUtil;
|
||||||
import com.youchain.utils.UserUtils;
|
import com.youchain.utils.UserUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -177,14 +178,23 @@ public class PointController {
|
||||||
@GetMapping(value = "/queryPointList")
|
@GetMapping(value = "/queryPointList")
|
||||||
@Log("下拉查询点位")
|
@Log("下拉查询点位")
|
||||||
@ApiOperation("下拉查询点位")
|
@ApiOperation("下拉查询点位")
|
||||||
@PreAuthorize("@el.check('point:queryPointList')")
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> queryPointList(PointQueryCriteria criteria) {
|
public ResponseEntity<Object> queryPointList(PointQueryCriteria criteria) {
|
||||||
return new ResponseEntity<>(pointService.queryAll(criteria), HttpStatus.OK);
|
return new ResponseEntity<>(pointService.queryAll(criteria), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@PostMapping(value = "/getPointList")
|
@PostMapping(value = "/getPointList")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> getPointList(@RequestBody(required=false) String billCode) {
|
public ResponseEntity<Object> getPointList(@RequestBody(required=false) String data) {
|
||||||
List<Point> pointList=pointRepository.getKyPointList(billCode);
|
// String billCode=json.
|
||||||
|
JSONObject jsonObject=JSONObject.parseObject(data);
|
||||||
|
String areaCode=jsonObject.getString("areaCode");
|
||||||
|
String asnType=jsonObject.getString("asnType");
|
||||||
|
List<Point> pointList;
|
||||||
|
if (areaCode==null&&asnType==null){
|
||||||
|
pointList = pointRepository.findAll();
|
||||||
|
}else {
|
||||||
|
pointList = pointRepository.getKyPointList(areaCode, asnType);
|
||||||
|
}
|
||||||
return new ResponseEntity<>(pointList, HttpStatus.OK);
|
return new ResponseEntity<>(pointList, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.basicdata.rest;
|
package com.youchain.basicdata.rest;
|
||||||
|
|
||||||
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.annotation.Log;
|
import com.youchain.annotation.Log;
|
||||||
import com.youchain.basicdata.domain.TableConfig;
|
import com.youchain.basicdata.domain.TableConfig;
|
||||||
import com.youchain.basicdata.service.TableConfigService;
|
import com.youchain.basicdata.service.TableConfigService;
|
||||||
|
|
@ -66,7 +67,7 @@ public class TableConfigController {
|
||||||
@GetMapping("/All")
|
@GetMapping("/All")
|
||||||
@Log("查询tableconfig")
|
@Log("查询tableconfig")
|
||||||
@ApiOperation("查询tableconfig")
|
@ApiOperation("查询tableconfig")
|
||||||
@PreAuthorize("@el.check('tableConfig:list')")
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> queryTableConfigOne(TableConfigQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTableConfigOne(TableConfigQueryCriteria criteria, Pageable pageable){
|
||||||
criteria.setCreateBy(SecurityUtils.getCurrentUsername());
|
criteria.setCreateBy(SecurityUtils.getCurrentUsername());
|
||||||
List<TableConfigDto> tableConfigDtos= tableConfigService.queryAll(criteria);
|
List<TableConfigDto> tableConfigDtos= tableConfigService.queryAll(criteria);
|
||||||
|
|
@ -76,7 +77,7 @@ public class TableConfigController {
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增tableconfig")
|
@Log("新增tableconfig")
|
||||||
@ApiOperation("新增tableconfig")
|
@ApiOperation("新增tableconfig")
|
||||||
@PreAuthorize("@el.check('tableConfig:add')")
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> createTableConfig(@Validated @RequestBody TableConfig resources){
|
public ResponseEntity<Object> createTableConfig(@Validated @RequestBody TableConfig resources){
|
||||||
resources.setCreateBy(SecurityUtils.getCurrentUsername());
|
resources.setCreateBy(SecurityUtils.getCurrentUsername());
|
||||||
return new ResponseEntity<>(tableConfigService.create(resources),HttpStatus.CREATED);
|
return new ResponseEntity<>(tableConfigService.create(resources),HttpStatus.CREATED);
|
||||||
|
|
|
||||||
|
|
@ -159,4 +159,7 @@ public interface PointService {
|
||||||
Point getPointByFreeQH(String areaName,String goodType);
|
Point getPointByFreeQH(String areaName,String goodType);
|
||||||
|
|
||||||
ApiResult importPoint(MultipartFile multipartFile);
|
ApiResult importPoint(MultipartFile multipartFile);
|
||||||
|
|
||||||
|
/** 入库分配库位*/
|
||||||
|
Point asnOccupy(String areaCode);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@ public class StockTypeDto implements Serializable {
|
||||||
|
|
||||||
/** 代码 */
|
/** 代码 */
|
||||||
private String code;
|
private String code;
|
||||||
|
/** 容器模型*/
|
||||||
|
private String mode;
|
||||||
|
|
||||||
/** 长 */
|
/** 长 */
|
||||||
private Double length;
|
private Double length;
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ public class PointServiceImpl implements PointService {
|
||||||
map.put("状态", point.getStatus());
|
map.put("状态", point.getStatus());
|
||||||
map.put("当前容器", point.getStorageType());
|
map.put("当前容器", point.getStorageType());
|
||||||
map.put("深浅位", point.getHeat());
|
map.put("深浅位", point.getHeat());
|
||||||
map.put("深浅位组", point.getBeatCode());
|
map.put("区域", point.getBeatCode());
|
||||||
map.put("是否启用", point.getEnabled());
|
map.put("是否启用", point.getEnabled());
|
||||||
list.add(map);
|
list.add(map);
|
||||||
}
|
}
|
||||||
|
|
@ -375,7 +375,7 @@ public class PointServiceImpl implements PointService {
|
||||||
String status=(map.get("状态")+"").equals("null")||(map.get("状态")+"").length()<1? null : (map.get("状态")+"");
|
String status=(map.get("状态")+"").equals("null")||(map.get("状态")+"").length()<1? null : (map.get("状态")+"");
|
||||||
String storageType=(map.get("当前容器")+"").equals("null")||(map.get("当前容器")+"").length()<1? null : (map.get("当前容器")+"");
|
String storageType=(map.get("当前容器")+"").equals("null")||(map.get("当前容器")+"").length()<1? null : (map.get("当前容器")+"");
|
||||||
String heat=(map.get("深浅位")+"").equals("null")||(map.get("深浅位")+"").length()<1? null : (map.get("深浅位")+"");
|
String heat=(map.get("深浅位")+"").equals("null")||(map.get("深浅位")+"").length()<1? null : (map.get("深浅位")+"");
|
||||||
String beatCode=(map.get("双深位组")+"").equals("null")||(map.get("双深位组")+"").length()<1? null : (map.get("双深位组")+"");
|
String beatCode=(map.get("区域")+"").equals("null")||(map.get("区域")+"").length()<1? null : (map.get("区域")+"");
|
||||||
String enabled=(map.get("是否启用")+"").equals("null")||(map.get("是否启用")+"").length()<1? null : (map.get("是否启用")+"");
|
String enabled=(map.get("是否启用")+"").equals("null")||(map.get("是否启用")+"").length()<1? null : (map.get("是否启用")+"");
|
||||||
String del=(map.get("删除")+"").equals("null")||(map.get("删除")+"").length()<1? null : (map.get("删除")+"");
|
String del=(map.get("删除")+"").equals("null")||(map.get("删除")+"").length()<1? null : (map.get("删除")+"");
|
||||||
if (code!=null){
|
if (code!=null){
|
||||||
|
|
@ -409,6 +409,13 @@ public class PointServiceImpl implements PointService {
|
||||||
return ApiResult.fail(200,"导入"+a+"行,新增"+b+"行,修改"+c+"行"+";异常信息"+msgError.toString(),null);
|
return ApiResult.fail(200,"导入"+a+"行,新增"+b+"行,修改"+c+"行"+";异常信息"+msgError.toString(),null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Point asnOccupy(String areaCode) {
|
||||||
|
List<Point> pointList = pointRepository.findByAreaCode(areaCode);
|
||||||
|
if (pointList.size()>0) return pointList.get(0);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Object[]> queryPointKmd() {
|
public List<Object[]> queryPointKmd() {
|
||||||
List<Object[]> pointList = null;
|
List<Object[]> pointList = null;
|
||||||
String hql = "select p.area.name,p.status,count(p.status) from Point p where p.area.name in " +
|
String hql = "select p.area.name,p.status,count(p.status) from Point p where p.area.name in " +
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@ public class AgvTask extends BaseEntity implements Serializable {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@Column(name = "`stock_code`",nullable = true)
|
@Column(name = "`stock_code`",nullable = true)
|
||||||
@NotBlank
|
|
||||||
@ApiModelProperty(value = "容器号")
|
@ApiModelProperty(value = "容器号")
|
||||||
private String stockCode;
|
private String stockCode;
|
||||||
|
|
||||||
|
|
@ -51,8 +50,7 @@ public class AgvTask extends BaseEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "容器类型")
|
@ApiModelProperty(value = "容器类型")
|
||||||
private String stockTypeCode;
|
private String stockTypeCode;
|
||||||
|
|
||||||
@Column(name = "`start_slot_code`",nullable = false)
|
@Column(name = "`start_slot_code`",nullable = true)
|
||||||
@NotBlank
|
|
||||||
@ApiModelProperty(value = "起点位置")
|
@ApiModelProperty(value = "起点位置")
|
||||||
private String startSlotCode;
|
private String startSlotCode;
|
||||||
|
|
||||||
|
|
@ -64,8 +62,7 @@ public class AgvTask extends BaseEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
private String slotCode;
|
private String slotCode;
|
||||||
|
|
||||||
@Column(name = "`status`",nullable = false)
|
@Column(name = "`status`",nullable = true)
|
||||||
@NotBlank
|
|
||||||
@ApiModelProperty(value = "任务状态")
|
@ApiModelProperty(value = "任务状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
|
@ -77,13 +74,10 @@ public class AgvTask extends BaseEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
private String jobId;
|
private String jobId;
|
||||||
|
|
||||||
@Column(name = "`job_type`",nullable = false)
|
@Column(name = "`job_type`",nullable = true)
|
||||||
@NotBlank
|
@NotBlank
|
||||||
@ApiModelProperty(value = "工作类型")
|
@ApiModelProperty(value = "工作类型")
|
||||||
/**
|
private String jobType;
|
||||||
* 01:料箱
|
|
||||||
*/
|
|
||||||
private String jobType="01";
|
|
||||||
|
|
||||||
@Column(name = "`job_priority`")
|
@Column(name = "`job_priority`")
|
||||||
@ApiModelProperty(value = "优先级")
|
@ApiModelProperty(value = "优先级")
|
||||||
|
|
@ -122,11 +116,11 @@ public class AgvTask extends BaseEntity implements Serializable {
|
||||||
private Timestamp jobMessageTime;
|
private Timestamp jobMessageTime;
|
||||||
|
|
||||||
@Column(name = "`start_time`")
|
@Column(name = "`start_time`")
|
||||||
@ApiModelProperty(value = "取料时间")
|
@ApiModelProperty(value = "开始时间")
|
||||||
private Timestamp startTime;
|
private Timestamp startTime;
|
||||||
|
|
||||||
@Column(name = "`end_time`")
|
@Column(name = "`end_time`")
|
||||||
@ApiModelProperty(value = "放料时间")
|
@ApiModelProperty(value = "完成时间")
|
||||||
private Timestamp endTime;
|
private Timestamp endTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ public class ItemKey extends BaseEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "流水号")
|
@ApiModelProperty(value = "流水号")
|
||||||
private String propC6;
|
private String propC6;
|
||||||
@Column(name = "`prop_c7`")
|
@Column(name = "`prop_c7`")
|
||||||
@ApiModelProperty(value = "成品物料码")
|
@ApiModelProperty(value = "RFID码")
|
||||||
private String propC7;
|
private String propC7;
|
||||||
|
|
||||||
@Column(name = "`prop_d1`")
|
@Column(name = "`prop_d1`")
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ public class Task extends BaseEntity implements Serializable {
|
||||||
private String dstPointCode;
|
private String dstPointCode;
|
||||||
|
|
||||||
@Column(name = "`inv_status`")
|
@Column(name = "`inv_status`")
|
||||||
@ApiModelProperty(value = "库存状态")
|
@ApiModelProperty(value = "是否生成库存")
|
||||||
private String invStatus;
|
private String invStatus;
|
||||||
|
|
||||||
@Column(name = "`task_status`")
|
@Column(name = "`task_status`")
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,14 @@ public interface AsnDetailRepository extends JpaRepository<AsnDetail, Long>, Jpa
|
||||||
+" where a.`status`=?1 and bt.`code`=?2 "
|
+" where a.`status`=?1 and bt.`code`=?2 "
|
||||||
+" group by i.id ",nativeQuery = true)
|
+" group by i.id ",nativeQuery = true)
|
||||||
List<Map<String,Object>> findByAsn(String asnStatus, String billTypeCode);
|
List<Map<String,Object>> findByAsn(String asnStatus, String billTypeCode);
|
||||||
|
/***/
|
||||||
@Query("select d from AsnDetail d where d.asn.relatedBill1=?1 and d.item.code=?2 and d.orderQty>d.receivedQty")
|
@Query("select d from AsnDetail d where d.asn.relatedBill1=?1 and d.item.code=?2 and d.orderQty>d.receivedQty")
|
||||||
List<AsnDetail> findByAsnAndItem(String relatedBill1, String itemCode);
|
List<AsnDetail> findByAsnAndItem(String relatedBill1, String itemCode);
|
||||||
@Query("select d from AsnDetail d where d.asn.id=?1 and d.asn.status=?2")
|
@Query("select d from AsnDetail d where d.asn.id=?1 and d.asn.status=?2")
|
||||||
List<AsnDetail> findByAsnId(Long asnId,String asnStatus);
|
List<AsnDetail> findByAsnId(Long asnId,String asnStatus);
|
||||||
|
/** 查询收获中的明细*/
|
||||||
|
@Query("select d from AsnDetail d where d.asn.status in ('ACTIVE','RECEIVING') and d.asn.billType.code=?2")
|
||||||
|
List<AsnDetail> findByAsnBillType(String billTypeCode);
|
||||||
@Query(value = "select d.* from data_asn_detail d where d.asn_id=?1 having sum(d.order_qty)<=sum(d.received_qty)",nativeQuery = true)
|
@Query(value = "select d.* from data_asn_detail d where d.asn_id=?1 having sum(d.order_qty)<=sum(d.received_qty)",nativeQuery = true)
|
||||||
List<AsnDetail> findByAsnId(Long asnId);
|
List<AsnDetail> findByAsnId(Long asnId);
|
||||||
}
|
}
|
||||||
|
|
@ -38,4 +38,12 @@ public interface InventoryRepository extends JpaRepository<Inventory, Long>, Jpa
|
||||||
List<Inventory> queryInventory(long itemId);
|
List<Inventory> queryInventory(long itemId);
|
||||||
@Query(value = "SELECT i FROM Inventory i WHERE i.itemKey.id=?1", nativeQuery = false)
|
@Query(value = "SELECT i FROM Inventory i WHERE i.itemKey.id=?1", nativeQuery = false)
|
||||||
Inventory findByItemKey(Long itemKeyId);
|
Inventory findByItemKey(Long itemKeyId);
|
||||||
|
@Query(value = "SELECT i FROM Inventory i WHERE i.itemKey.propC7=?1", nativeQuery = false)
|
||||||
|
List<Inventory> findByItemKeyC7(String rfid);
|
||||||
|
@Query(value = "SELECT i FROM Inventory i WHERE (i.itemKey.propC7 like ?1 or i.itemKey.item.code like ?1 or " +
|
||||||
|
"i.point.code like ?1 or i.itemKey.propC1 like ?1 or i.itemKey.propC6 like ?1)", nativeQuery = false)
|
||||||
|
List<Inventory> findByParam(String param);
|
||||||
|
|
||||||
|
@Query(value = "SELECT i FROM Inventory i WHERE i.id=?1", nativeQuery = false)
|
||||||
|
Inventory findByInvId(Long l);
|
||||||
}
|
}
|
||||||
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.repository;
|
package com.youchain.businessdata.repository;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.youchain.businessdata.domain.AgvTask;
|
||||||
import com.youchain.businessdata.domain.AsnDetail;
|
import com.youchain.businessdata.domain.AsnDetail;
|
||||||
import com.youchain.businessdata.domain.Task;
|
import com.youchain.businessdata.domain.Task;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
@ -39,8 +41,13 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
||||||
* @param agvFlag 是否AGV任务
|
* @param agvFlag 是否AGV任务
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Query(value = " select sum(move_qty) qty,GROUP_CONCAT(id) taskIds,item_key_id ikID,dst_point_id pointId from data_task where if((?1 !='' or ?1 is not null),agv_task_id=?1,1=1) and task_type=?2 and be_skip=?3 and task_status='RECEIVING' group by item_key_id ",nativeQuery = true)
|
@Query(value = " select sum(plan_qty)-sum(move_qty) qty,GROUP_CONCAT(id) taskIds,item_key_id ikID,dst_point_id pointId from data_task where if((?1 !='' or ?1 is not null),agv_task_id=?1,1=1) " +
|
||||||
List<Map<String,Object>> findByAgvTask(Integer agvTaskId,String type,Long agvFlag);
|
"and if((?4 !='' or ?4 is not null),item_key_id=?4,1=1)" +
|
||||||
|
"and task_type=?2 and be_skip=?3 and task_status in ('RECEIVING','PUTAWAY') group by item_key_id ",nativeQuery = true)
|
||||||
|
List<Map<String,Object>> findByAgvTask(Integer agvTaskId,String type,Long agvFlag,Long itemKeyId);
|
||||||
|
/**taskStatus(RECEIVING-收货中)*/
|
||||||
|
@Query(value = "SELECT t from Task t where t.agvTask.id=?1 and t.taskStatus=?2")
|
||||||
|
List<Task> findByAgvTask(Integer agvTaskId,String taskStatus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据出库单明细查询未完成的Task集合
|
* 根据出库单明细查询未完成的Task集合
|
||||||
|
|
@ -66,7 +73,7 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
||||||
@Query(value = "SELECT t FROM Task t WHERE t.agvTask.id=?1 and t.taskStatus=?2")
|
@Query(value = "SELECT t FROM Task t WHERE t.agvTask.id=?1 and t.taskStatus=?2")
|
||||||
List<Task> getAgvTaskList(Integer agvTaskId,String taskStatus);
|
List<Task> getAgvTaskList(Integer agvTaskId,String taskStatus);
|
||||||
@Query(value = "SELECT t FROM Task t WHERE t.agvTask.id=?1")
|
@Query(value = "SELECT t FROM Task t WHERE t.agvTask.id=?1")
|
||||||
List<Task> getAgvTaskList(Integer agvTaskId);
|
List<Task> findByAgvTask(Integer agvTaskId);
|
||||||
/**
|
/**
|
||||||
* 根据 收货明细序号 进行删除数据
|
* 根据 收货明细序号 进行删除数据
|
||||||
*/
|
*/
|
||||||
|
|
@ -91,16 +98,59 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
||||||
List<Task> queryInQHALLData(String time);
|
List<Task> queryInQHALLData(String time);
|
||||||
@Query(value = "select t from Task t where t.itemKey.id =?1 and t.taskStatus=?2")
|
@Query(value = "select t from Task t where t.itemKey.id =?1 and t.taskStatus=?2")
|
||||||
List<Task> findByItemKey(Long id,String taskStatus);
|
List<Task> findByItemKey(Long id,String taskStatus);
|
||||||
|
@Query(value = "select t from Task t where t.inventory.id =?1 and t.taskStatus in ('ALLOCATE') and t.pickDetail is not null")
|
||||||
@Query(value = " select i.id 'itemId',SUM(t.plan_qty) 'taskQty' from data_task t "
|
List<Task> findByInv(Long invId);
|
||||||
+" left join data_item_key ik on t.item_key_id=ik.id "
|
@Query(value = " select i.id 'itemId',SUM(t.plan_qty) 'taskQty' from data_task t "
|
||||||
+" left join base_item i on i.id=ik.item_id "
|
+" left join data_item_key ik on t.item_key_id=ik.id "
|
||||||
+" where t.task_status=?1 and t.be_skip=?2 "
|
+" left join base_item i on i.id=ik.item_id "
|
||||||
+" and i.good_type=?3 "
|
+" where t.task_status=?1 and t.be_skip=?2 "
|
||||||
+" group by i.id ",nativeQuery = true)
|
+" and t.task_type=?3 "
|
||||||
List<Map<String,Object>> findBySumPlanQty(String taskStatus,int beSkip,String goodType);
|
+" group by i.id ",nativeQuery = true)
|
||||||
|
List<Map<String,Object>> findBySumPlanQty(String taskStatus,int beSkip,String taskType);
|
||||||
@Query(value = "select t from Task t where t.taskStatus =?1 and t.beSkip=?2 and t.taskType=?3")
|
@Query(value = "select t from Task t where t.taskStatus =?1 and t.beSkip=?2 and t.taskType=?3")
|
||||||
List<Task> findByItemType(String taskStatus, int beSkip, String goodType);
|
List<Task> findByItemType(String taskStatus, int beSkip, String taskType);
|
||||||
|
|
||||||
Task findByPickDetailAndItem(Long id, String sku);
|
Task findByPickDetailAndItem(Long id, String sku);
|
||||||
|
|
||||||
|
@Query(value = "select t from Task t where t.taskStatus='RECEIVING'",nativeQuery = false)
|
||||||
|
List<Task> findByStartPoint();
|
||||||
|
@Query(value = "select t from Task t where t.taskStatus =?1 and t.beSkip=?2 and t.taskType=?3 group by t.itemKey.id")
|
||||||
|
List<Task> findByGroupItemKey(String taskStatus, int beSkip, String taskType);
|
||||||
|
@Query(value = " select agv.`status` 'agvStatus',t.agv_task_id 'agvId',t.id,p.`code` 'pointCode',sum(t.plan_qty) 'quantity',ik.prop_c1 'pch',ik.prop_c6 'lsh' from data_task t "
|
||||||
|
+" left join data_item_key ik on ik.id=t.item_key_id "
|
||||||
|
+" left join base_point p on t.dst_point_id=p.id "
|
||||||
|
+" left join data_agv_task agv on t.agv_task_id=agv.id "
|
||||||
|
+" where t.task_status='PUTAWAY' "
|
||||||
|
+" group by t.item_key_id ",nativeQuery = true)
|
||||||
|
List<Map<String,Object>> findBySjTask();
|
||||||
|
@Query(value = " select t.id,p.related_bill1 'relatedBill1',sp.`code` 'startPointCode',ep.`code` 'endPointCode',t.plan_qty 'quantity',ik.prop_c1 'pch',ik.prop_c6 'lsh' from data_task t "
|
||||||
|
+" left join data_item_key ik on ik.id=t.item_key_id "
|
||||||
|
+" left join data_pick_detail pd on pd.id=t.pick_detail_id "
|
||||||
|
+" left join data_pick p on p.id=pd.pick_id "
|
||||||
|
+" left join base_point ep on t.dst_point_id=ep.id "
|
||||||
|
+" left join base_point sp on t.src_point_id=sp.id "
|
||||||
|
+" left join data_agv_task agv on t.agv_task_id=agv.id "
|
||||||
|
+" where t.task_status='ALLOCATE' and t.be_skip=0 " +
|
||||||
|
" and (?1 is null or ?1=ik.prop_c7)"
|
||||||
|
+" group by t.item_key_id ",nativeQuery = true)
|
||||||
|
List<Map<String,Object>> findByRgJhTask(String rfid);
|
||||||
|
@Query(value = " select t.item 'sku',agv.`status` 'agvStatus',t.agv_task_id 'agvId',t.id,p.`code` 'pointCode',sum(t.plan_qty) 'quantity',ik.prop_c1 'pch',ik.prop_c6 'lsh' from data_task t "
|
||||||
|
+" left join data_item_key ik on ik.id=t.item_key_id "
|
||||||
|
+" left join data_item i on i.id=ik.item_id "
|
||||||
|
+" left join base_point p on t.dst_point_id=p.id "
|
||||||
|
+" left join data_agv_task agv on t.agv_task_id=agv.id "
|
||||||
|
+" where t.task_status='PUTAWAY' and ik.prop_c7=?1"
|
||||||
|
+" group by t.item_key_id ",nativeQuery = true)
|
||||||
|
List<Map<String,Object>> findBySjTask(String propC7);
|
||||||
|
@Query(value = " select t.id,p.related_bill1 'relatedBill1',sp.`code` 'startPointCode',ep.`code` 'endPointCode',t.plan_qty 'quantity',ik.prop_c1 'pch',ik.prop_c6 'lsh' from data_task t "
|
||||||
|
+" left join data_item_key ik on ik.id=t.item_key_id "
|
||||||
|
+" left join data_pick_detail pd on pd.id=t.pick_detail_id "
|
||||||
|
+" left join data_pick p on p.id=pd.pick_id "
|
||||||
|
+" left join base_point ep on t.dst_point_id=ep.id "
|
||||||
|
+" left join base_point sp on t.src_point_id=sp.id "
|
||||||
|
+" left join data_agv_task agv on t.agv_task_id=agv.id "
|
||||||
|
+" where t.task_status='ALLOCATE' and t.be_skip=1 and t.agv_task_id is null " +
|
||||||
|
" and (?1 is null or ?1=ik.prop_c7)"
|
||||||
|
+" group by t.item_key_id ",nativeQuery = true)
|
||||||
|
List<Map<String, Object>> findByLxJhTask(Object o);
|
||||||
}
|
}
|
||||||
|
|
@ -20,6 +20,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import com.youchain.annotation.AnonymousAccess;
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.annotation.Log;
|
import com.youchain.annotation.Log;
|
||||||
import com.youchain.businessdata.domain.AgvTask;
|
import com.youchain.businessdata.domain.AgvTask;
|
||||||
|
import com.youchain.businessdata.repository.AgvTaskRepository;
|
||||||
import com.youchain.businessdata.service.AgvTaskService;
|
import com.youchain.businessdata.service.AgvTaskService;
|
||||||
import com.youchain.businessdata.service.dto.AgvTaskDto;
|
import com.youchain.businessdata.service.dto.AgvTaskDto;
|
||||||
import com.youchain.businessdata.service.dto.AgvTaskQueryCriteria;
|
import com.youchain.businessdata.service.dto.AgvTaskQueryCriteria;
|
||||||
|
|
@ -49,6 +50,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
public class AgvTaskController {
|
public class AgvTaskController {
|
||||||
|
|
||||||
private final AgvTaskService agvTaskService;
|
private final AgvTaskService agvTaskService;
|
||||||
|
private final AgvTaskRepository agvTaskRepository;
|
||||||
|
|
||||||
@Log("导出数据")
|
@Log("导出数据")
|
||||||
@ApiOperation("导出数据")
|
@ApiOperation("导出数据")
|
||||||
|
|
@ -103,10 +105,13 @@ public class AgvTaskController {
|
||||||
public ResponseEntity<Object> agvTaskCallback(@RequestBody String json){
|
public ResponseEntity<Object> agvTaskCallback(@RequestBody String json){
|
||||||
System.out.println("json:"+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("missionCode")==null?"":jsonObject.getString("missionCode");//任务编号
|
||||||
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");//作业当前状态
|
||||||
|
if (missionStatus.equals("UP_CONTAINER")) missionStatus="2";
|
||||||
|
if (missionStatus.equals("FORK_DOWN")) missionStatus="3";
|
||||||
|
if (missionStatus.equals("CANCELED")) missionStatus="4";
|
||||||
agvTaskService.agvTaskCallback(taskCode,missionStatus);
|
agvTaskService.agvTaskCallback(taskCode,missionStatus);
|
||||||
return new ResponseEntity<>(ApiResult.success("",""),HttpStatus.OK);
|
return new ResponseEntity<>(ApiResult.success("",""),HttpStatus.OK);
|
||||||
//查询对应BOX
|
//查询对应BOX
|
||||||
|
|
@ -185,4 +190,14 @@ public class AgvTaskController {
|
||||||
agvTaskService.getConveyorState(conveyorId);
|
agvTaskService.getConveyorState(conveyorId);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
@PostMapping("/sendAgvTask")
|
||||||
|
@Log("AgvTask-发送")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> sendAgvTask(@RequestBody Integer id){
|
||||||
|
// System.out.println("AgvTask:"+id);
|
||||||
|
AgvTask agvTask=agvTaskRepository.getById(id);
|
||||||
|
agvTaskService.sendAgvTaskImpl(agvTask);
|
||||||
|
ApiResult apiResult=ApiResult.fail(200,"操作成功",null);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -90,7 +90,7 @@ public class AsnController {
|
||||||
}
|
}
|
||||||
@PostMapping("/getAsnList")
|
@PostMapping("/getAsnList")
|
||||||
@Log("加载入库单下拉框")
|
@Log("加载入库单下拉框")
|
||||||
@PreAuthorize("@el.check('asn:del')")
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> getAsnList() {
|
public ResponseEntity<Object> getAsnList() {
|
||||||
return new ResponseEntity<>(asnService.getAsnList(),HttpStatus.OK);
|
return new ResponseEntity<>(asnService.getAsnList(),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ public class PickController {
|
||||||
}
|
}
|
||||||
@PostMapping("/getPickList")
|
@PostMapping("/getPickList")
|
||||||
@Log("加载出库单下拉框")
|
@Log("加载出库单下拉框")
|
||||||
@PreAuthorize("@el.check('asn:del')")
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> getPickList() {
|
public ResponseEntity<Object> getPickList() {
|
||||||
return new ResponseEntity<>(pickRepository.getPickList(),HttpStatus.OK);
|
return new ResponseEntity<>(pickRepository.getPickList(),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -124,8 +124,7 @@ public class PickDetailController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/allocate")
|
@PostMapping("/allocate")
|
||||||
@Log("分配")
|
@Log("出库-分配明细")
|
||||||
@ApiOperation("分配")
|
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public synchronized ResponseEntity<Object> allocate(@RequestBody Long[] ids) throws Exception {
|
public synchronized ResponseEntity<Object> allocate(@RequestBody Long[] ids) throws Exception {
|
||||||
List<Long> pickDetailIds = Arrays.asList(ids);
|
List<Long> pickDetailIds = Arrays.asList(ids);
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.rest;
|
package com.youchain.businessdata.rest;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.youchain.annotation.AnonymousAccess;
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.annotation.Log;
|
import com.youchain.annotation.Log;
|
||||||
|
|
@ -27,6 +28,7 @@ import com.youchain.businessdata.domain.Task;
|
||||||
import com.youchain.businessdata.repository.InventoryRepository;
|
import com.youchain.businessdata.repository.InventoryRepository;
|
||||||
import com.youchain.businessdata.repository.PickDetailRepository;
|
import com.youchain.businessdata.repository.PickDetailRepository;
|
||||||
import com.youchain.businessdata.repository.TaskRepository;
|
import com.youchain.businessdata.repository.TaskRepository;
|
||||||
|
import com.youchain.businessdata.service.AgvTaskService;
|
||||||
import com.youchain.businessdata.service.InventoryService;
|
import com.youchain.businessdata.service.InventoryService;
|
||||||
import com.youchain.businessdata.service.PickDetailService;
|
import com.youchain.businessdata.service.PickDetailService;
|
||||||
import com.youchain.businessdata.service.TaskService;
|
import com.youchain.businessdata.service.TaskService;
|
||||||
|
|
@ -43,6 +45,7 @@ import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
|
|
@ -51,6 +54,8 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
* @author houjianlan
|
* @author houjianlan
|
||||||
|
|
@ -70,6 +75,7 @@ public class TaskController {
|
||||||
private final PickDetailService pickDetailService;
|
private final PickDetailService pickDetailService;
|
||||||
private final InventoryRepository inventoryRepository;
|
private final InventoryRepository inventoryRepository;
|
||||||
private final PointRepository pointRepository;
|
private final PointRepository pointRepository;
|
||||||
|
private final AgvTaskService agvTaskService;
|
||||||
|
|
||||||
@Log("导出数据")
|
@Log("导出数据")
|
||||||
@ApiOperation("导出数据")
|
@ApiOperation("导出数据")
|
||||||
|
|
@ -88,11 +94,26 @@ public class TaskController {
|
||||||
}
|
}
|
||||||
@PostMapping("/manualReceiving")
|
@PostMapping("/manualReceiving")
|
||||||
@Log("人工入库")
|
@Log("人工入库")
|
||||||
@ApiOperation("人工入库")
|
@ApiOperation("人工入库,AGV成品入库")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> manualReceiving(@RequestBody JSONObject request){
|
@Transactional(rollbackFor = Exception.class)
|
||||||
ApiResult apiResult = taskService.manualReceiving(request);
|
public synchronized ResponseEntity<Object> manualReceiving(@RequestBody JSONObject request){
|
||||||
return new ResponseEntity<>(ApiResult.success(apiResult.getMessage(),apiResult.getData()), HttpStatus.valueOf(apiResult.getStatus()));
|
String rfid=request.getString("RFID");
|
||||||
|
int agvFlag=request.getIntValue("agvFlag");
|
||||||
|
Point point= pointRepository.getById(request.getLong("pointId"));
|
||||||
|
// 人工入库 直接生成库存
|
||||||
|
ApiResult apiResult = taskService.manualReceiving(rfid,point,agvFlag);
|
||||||
|
if (point.getType().equals(BaseStatus.BOX)){
|
||||||
|
if (apiResult.getStatus()==200){
|
||||||
|
// AGV入库 生成搬运任务(目标库区,单据任务类型)
|
||||||
|
apiResult = agvTaskService.addAgvAsn(point.getArea().getCode(),apiResult.getData().toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (apiResult.getStatus()!=200&&apiResult.getStatus()!=201){
|
||||||
|
//回滚
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
}
|
}
|
||||||
@PostMapping("/devanRfid")
|
@PostMapping("/devanRfid")
|
||||||
@ApiOperation("人工出库,人工入库-解析RFID关联的库存信息")
|
@ApiOperation("人工出库,人工入库-解析RFID关联的库存信息")
|
||||||
|
|
@ -103,7 +124,7 @@ public class TaskController {
|
||||||
String type=jsonObject.getString("type");
|
String type=jsonObject.getString("type");
|
||||||
ApiResult apiResult;
|
ApiResult apiResult;
|
||||||
if (type.equals("ASN")){
|
if (type.equals("ASN")){
|
||||||
apiResult = taskService.devanRfidAsn(rfid);
|
apiResult = taskService.devanRfidAsn(rfid,BaseStatus.STORAGE);
|
||||||
}else {
|
}else {
|
||||||
apiResult = taskService.devanRfidPT(rfid);
|
apiResult = taskService.devanRfidPT(rfid);
|
||||||
}
|
}
|
||||||
|
|
@ -145,7 +166,11 @@ public class TaskController {
|
||||||
/** 重新分配 */
|
/** 重新分配 */
|
||||||
Point point=pointRepository.findByCode(pickDetail.getPropC5());
|
Point point=pointRepository.findByCode(pickDetail.getPropC5());
|
||||||
List<Inventory> inventoryList= Arrays.asList(inventory);
|
List<Inventory> inventoryList= Arrays.asList(inventory);
|
||||||
apiResult = pickDetailService.allocate(pickDetail, UserUtils.getDept(), inventory.getQuantity(),0,point,inventoryList);
|
int agvFlag=0;
|
||||||
|
if (pickDetail.getPropC4().equals("AGV_PT")){
|
||||||
|
agvFlag=1;
|
||||||
|
}
|
||||||
|
apiResult = pickDetailService.allocate(pickDetail, UserUtils.getDept(), inventory.getQuantity(),agvFlag,point,inventoryList);
|
||||||
if (apiResult!=null){
|
if (apiResult!=null){
|
||||||
return apiResult;
|
return apiResult;
|
||||||
}
|
}
|
||||||
|
|
@ -159,6 +184,28 @@ public class TaskController {
|
||||||
public ResponseEntity<Object> queryAsnTask(TaskQueryCriteria criteria){
|
public ResponseEntity<Object> queryAsnTask(TaskQueryCriteria criteria){
|
||||||
return new ResponseEntity<>(taskService.queryAll(criteria),HttpStatus.OK);
|
return new ResponseEntity<>(taskService.queryAll(criteria),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
@PostMapping(value = "/butSTputaway")
|
||||||
|
@Log("料箱上架")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> butSTputaway(@RequestBody String request){
|
||||||
|
System.out.println("butSTputaway:"+request);
|
||||||
|
JSONObject requestJson=JSONObject.parseObject(request);
|
||||||
|
Long taskId=requestJson.getLong("taskId");
|
||||||
|
Long pointId=requestJson.getLong("pointId");
|
||||||
|
taskService.butSTputaway(taskId,pointId);
|
||||||
|
ApiResult apiResult = ApiResult.fail(200, "操作成工", null);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
@PostMapping(value = "/rmCkPickUp")
|
||||||
|
@Log("AGV料箱出库-料箱拣货生成Task任务")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> rmCkPickUp(@RequestBody String request){
|
||||||
|
System.out.println("rmCkPickUp:"+request);
|
||||||
|
JSONArray taskIds=JSONArray.parseArray(request);
|
||||||
|
/** AGV料箱出库生成AgvTask*/
|
||||||
|
ApiResult apiResult = taskService.rmCkPickUp(taskIds);
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/queryPickTask")
|
@GetMapping("/queryPickTask")
|
||||||
@Log("拣货确认-拣货记录")
|
@Log("拣货确认-拣货记录")
|
||||||
|
|
@ -194,12 +241,47 @@ public class TaskController {
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@PostMapping("/readRfid")
|
@PostMapping("/readRfid")
|
||||||
@Log("入库-读取RFID码生成ItemKey和Task任务")
|
@Log("半成品/料箱 AGV入库-读取RFID码生成ItemKey和Task任务")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
|
@Transactional
|
||||||
public ResponseEntity<Object> readRfid(@RequestBody JSONObject body) {
|
public ResponseEntity<Object> readRfid(@RequestBody JSONObject body) {
|
||||||
String rfid=body.getString("rfid");
|
String rfid=body.getString("rfid");
|
||||||
String type=body.getString("type");
|
int agvFlag=body.getIntValue("agvFlag");
|
||||||
ApiResult apiResult = taskService.readRfid(rfid,type);
|
Point pointStartCode=pointRepository.findByTypeAndArea(BaseStatus.PLATFORM,"TAGM");
|
||||||
|
// 收货生成Task
|
||||||
|
ApiResult apiResult = taskService.manualReceiving(rfid,pointStartCode,agvFlag);
|
||||||
|
if (apiResult.getStatus()!=200){
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
synchronized (BaseStatus.Lock.rfid_SJ) {
|
||||||
|
/** 半成品/料箱 AGV入库*/
|
||||||
|
String billCode=apiResult.getData().toString();
|
||||||
|
String areaCode="";
|
||||||
|
if (billCode.equals(BizStatus.RM_RK)){
|
||||||
|
areaCode=BizStatus.LX;
|
||||||
|
}else if (billCode.equals(BizStatus.SM_RK)){
|
||||||
|
areaCode=BizStatus.BCP;
|
||||||
|
}
|
||||||
|
apiResult = agvTaskService.addAgvAsn(areaCode, billCode);
|
||||||
|
}
|
||||||
|
if (apiResult.getStatus()!=201&&apiResult.getStatus()!=200){
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
|
}
|
||||||
|
@PostMapping("/STAgvReceiving")
|
||||||
|
@Log("容器入场-搬运容器到RFID门")
|
||||||
|
@AnonymousAccess
|
||||||
|
@Transactional
|
||||||
|
public ResponseEntity<Object> STAgvReceiving(@RequestBody JSONObject jsonObject) {
|
||||||
|
System.out.println("容器入场:"+jsonObject);
|
||||||
|
String storageType = jsonObject.getString("storageType");
|
||||||
|
JSONArray ids=jsonObject.getJSONArray("ids");
|
||||||
|
ApiResult apiResult = agvTaskService.pointStockRk(storageType,ids.getLong(0));
|
||||||
|
Point pointEndCode=pointRepository.findByTypeAndArea(BaseStatus.PLATFORM,"TAGM");
|
||||||
|
if (apiResult.getStatus()==200){
|
||||||
|
apiResult = agvTaskService.addAgvTask(ids.getLong(0),pointEndCode.getCode());
|
||||||
|
}
|
||||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,15 @@ public interface AgvTaskService {
|
||||||
* @param storageType 容器类型
|
* @param storageType 容器类型
|
||||||
* @param id 入场库位
|
* @param id 入场库位
|
||||||
*/
|
*/
|
||||||
void pointStockRk(String storageType, Long id);
|
ApiResult pointStockRk(String storageType, Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 容器出场
|
||||||
|
* @param storageType
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ApiResult pointStockCk(String storageType, Long id);
|
||||||
|
|
||||||
AgvTask addAgvTask(String type,String stockTypeCode,String startSlotCode,String endSlotCode,String status,String jobType);
|
AgvTask addAgvTask(String type,String stockTypeCode,String startSlotCode,String endSlotCode,String status,String jobType);
|
||||||
|
|
||||||
|
|
@ -219,10 +227,12 @@ public interface AgvTaskService {
|
||||||
* @param id
|
* @param id
|
||||||
* @param pointEndCode
|
* @param pointEndCode
|
||||||
*/
|
*/
|
||||||
String addAgvTask(Long id, String pointEndCode);
|
ApiResult addAgvTask(Long id, String pointEndCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成入库AGV搬运任务
|
* 生成入库AGV搬运任务
|
||||||
*/
|
*/
|
||||||
ApiResult addAgvAsn();
|
ApiResult addAgvAsn(String areaCode,String billType);
|
||||||
|
|
||||||
|
ApiResult addAgvAsnTage();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,7 @@ public interface InventoryService {
|
||||||
*/
|
*/
|
||||||
Inventory asnAddInventory(List<Map<String,Object>> taskListMap);
|
Inventory asnAddInventory(List<Map<String,Object>> taskListMap);
|
||||||
|
|
||||||
|
/** 添加*/
|
||||||
@Transactional
|
@Transactional
|
||||||
Inventory getInventory(Double qty, Long ikID, Long pointId, String logType);
|
Inventory getInventory(Double qty, Long ikID, Long pointId, String logType);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ public interface PickDetailService {
|
||||||
void download(List<PickDetailDto> all, HttpServletResponse response) throws IOException;
|
void download(List<PickDetailDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 出库-明细分配
|
* 出库-分配明细
|
||||||
*/
|
*/
|
||||||
ApiResult allocate(Long[] ids);
|
ApiResult allocate(Long[] ids);
|
||||||
ApiResult allocate(PickDetail pickDetail, Dept dept, Double quantity, Integer agvFlag, Point endPoint, List<Inventory> inventoryList);
|
ApiResult allocate(PickDetail pickDetail, Dept dept, Double quantity, Integer agvFlag, Point endPoint, List<Inventory> inventoryList);
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.service;
|
package com.youchain.businessdata.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.youchain.basicdata.domain.Point;
|
import com.youchain.basicdata.domain.Point;
|
||||||
import com.youchain.businessdata.ReturnJson.RPTaskList;
|
import com.youchain.businessdata.ReturnJson.RPTaskList;
|
||||||
|
|
@ -131,16 +132,12 @@ public interface TaskService {
|
||||||
|
|
||||||
List<Task> findByPointCode(Long boxId);
|
List<Task> findByPointCode(Long boxId);
|
||||||
|
|
||||||
/**
|
/** 读取RFID,生成Task任务
|
||||||
* 读取RFID生成Task任务
|
* agvFlag 是否agv入库
|
||||||
* @param rfid
|
* */
|
||||||
* @param type
|
ApiResult manualReceiving(String rfid,Point point,int agvFlag);
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
ApiResult readRfid(String rfid,String type);
|
|
||||||
|
|
||||||
ApiResult manualReceiving(JSONObject request);
|
ApiResult getAsnTask(Point endPoint, Task task);
|
||||||
ApiResult getAsnTask(Point point, Task task);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拣货
|
* 拣货
|
||||||
|
|
@ -149,8 +146,13 @@ public interface TaskService {
|
||||||
*/
|
*/
|
||||||
ApiResult picking(Long[] ids);
|
ApiResult picking(Long[] ids);
|
||||||
|
|
||||||
ApiResult devanRfidAsn(String rfid);
|
ApiResult devanRfidAsn(String rfid,String pointType);
|
||||||
|
|
||||||
/** 人工出库-解析RFID关联的库存信息*/
|
/** 人工出库-解析RFID关联的库存信息*/
|
||||||
ApiResult devanRfidPT(String rfid);
|
ApiResult devanRfidPT(String rfid);
|
||||||
|
|
||||||
|
/** 料箱上架*/
|
||||||
|
ApiResult butSTputaway(Long taskId, Long pointId);
|
||||||
|
/** AGV料箱出库生成AgvTask*/
|
||||||
|
ApiResult rmCkPickUp(JSONArray taskIds);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,10 @@ public class AsnDetailQueryCriteria{
|
||||||
private String po;
|
private String po;
|
||||||
|
|
||||||
/** 等于 */
|
/** 等于 */
|
||||||
@Query(type = Query.Type.EQUAL)
|
@Query(propName="status",type = Query.Type.EQUAL)
|
||||||
private String status;
|
private String status;
|
||||||
|
@Query(propName="status",type = Query.Type.EQUAL)
|
||||||
|
private String statusList;
|
||||||
@Query(type = Query.Type.BETWEEN)
|
@Query(type = Query.Type.BETWEEN)
|
||||||
private List<Timestamp> createTime;
|
private List<Timestamp> createTime;
|
||||||
}
|
}
|
||||||
|
|
@ -16,6 +16,8 @@
|
||||||
package com.youchain.businessdata.service.dto;
|
package com.youchain.businessdata.service.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.youchain.annotation.Query;
|
import com.youchain.annotation.Query;
|
||||||
|
|
||||||
|
|
@ -26,4 +28,12 @@ import com.youchain.annotation.Query;
|
||||||
**/
|
**/
|
||||||
@Data
|
@Data
|
||||||
public class AsnQueryCriteria{
|
public class AsnQueryCriteria{
|
||||||
|
@Query(type = Query.Type.EQUAL)
|
||||||
|
private String relatedBill1;
|
||||||
|
@Query(type = Query.Type.EQUAL)
|
||||||
|
private String relatedBill2;
|
||||||
|
@Query(type = Query.Type.EQUAL)
|
||||||
|
private String status;
|
||||||
|
@Query(type = Query.Type.BETWEEN)
|
||||||
|
private List<Timestamp> createTime;
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +19,10 @@ import com.youchain.basicdata.domain.Point;
|
||||||
import com.youchain.basicdata.domain.Stock;
|
import com.youchain.basicdata.domain.Stock;
|
||||||
import com.youchain.businessdata.domain.ItemKey;
|
import com.youchain.businessdata.domain.ItemKey;
|
||||||
import com.youchain.modules.system.domain.Dept;
|
import com.youchain.modules.system.domain.Dept;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
@ -115,4 +118,12 @@ public class InventoryLogDto implements Serializable {
|
||||||
|
|
||||||
/** 目标数量 */
|
/** 目标数量 */
|
||||||
private Double dstQty;
|
private Double dstQty;
|
||||||
|
private String itemCode;
|
||||||
|
private String itemName;
|
||||||
|
private String propC1;
|
||||||
|
private String propC2;
|
||||||
|
private String propC3;
|
||||||
|
private String propC4;
|
||||||
|
private String propC5;
|
||||||
|
private String propC6;
|
||||||
}
|
}
|
||||||
|
|
@ -36,6 +36,8 @@ public class PickDetailQueryCriteria{
|
||||||
/** 模糊 */
|
/** 模糊 */
|
||||||
@Query(joinName = "item", propName="name",type = Query.Type.INNER_LIKE)
|
@Query(joinName = "item", propName="name",type = Query.Type.INNER_LIKE)
|
||||||
private String itemName;
|
private String itemName;
|
||||||
|
@Query(joinName = "pick", propName="relatedBill1",type = Query.Type.EQUAL)
|
||||||
|
private String relatedBill1;
|
||||||
|
|
||||||
/** 模糊 */
|
/** 模糊 */
|
||||||
@Query(type = Query.Type.INNER_LIKE)
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
|
|
@ -44,7 +46,10 @@ public class PickDetailQueryCriteria{
|
||||||
/** 等于 */
|
/** 等于 */
|
||||||
@Query(type = Query.Type.EQUAL)
|
@Query(type = Query.Type.EQUAL)
|
||||||
private String status;
|
private String status;
|
||||||
|
@Query( propName="status",type = Query.Type.IN)
|
||||||
|
private List<String> statusList;
|
||||||
@Query(type = Query.Type.BETWEEN)
|
@Query(type = Query.Type.BETWEEN)
|
||||||
private List<Timestamp> createTime;
|
private List<Timestamp> createTime;
|
||||||
|
/* @Query( propName="status",type = Query.Type.IN)
|
||||||
|
private List<String> queryAll;*/
|
||||||
}
|
}
|
||||||
|
|
@ -32,4 +32,10 @@ public class PickQueryCriteria{
|
||||||
/** BETWEEN */
|
/** BETWEEN */
|
||||||
@Query(type = Query.Type.BETWEEN)
|
@Query(type = Query.Type.BETWEEN)
|
||||||
private List<Long> erTime;
|
private List<Long> erTime;
|
||||||
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
|
private String relatedBill1;
|
||||||
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
|
private String relatedBill2;
|
||||||
|
@Query(type = Query.Type.EQUAL)
|
||||||
|
private String status;
|
||||||
}
|
}
|
||||||
|
|
@ -60,9 +60,11 @@ public class TaskQueryCriteria{
|
||||||
/** 精确 */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private String taskStatus;
|
private String taskStatus;
|
||||||
|
@Query(propName="taskStatus",type = Query.Type.IN)
|
||||||
|
private List<String> statusList;
|
||||||
|
|
||||||
@Query
|
@Query(type = Query.Type.IN)
|
||||||
private String taskType;
|
private List<String> taskType;
|
||||||
|
|
||||||
/** BETWEEN */
|
/** BETWEEN */
|
||||||
@Query(type = Query.Type.BETWEEN)
|
@Query(type = Query.Type.BETWEEN)
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,8 @@ import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.youchain.Netty.NettyUtils;
|
import com.youchain.Netty.NettyUtils;
|
||||||
import com.youchain.basicdata.domain.Box;
|
import com.youchain.basicdata.domain.*;
|
||||||
import com.youchain.basicdata.domain.Item;
|
import com.youchain.basicdata.repository.*;
|
||||||
import com.youchain.basicdata.domain.Point;
|
|
||||||
import com.youchain.basicdata.domain.Stock;
|
|
||||||
import com.youchain.basicdata.repository.BoxRepository;
|
|
||||||
import com.youchain.basicdata.repository.PointRepository;
|
|
||||||
import com.youchain.basicdata.repository.StockRepository;
|
|
||||||
import com.youchain.basicdata.service.BoxService;
|
import com.youchain.basicdata.service.BoxService;
|
||||||
import com.youchain.basicdata.service.ItemService;
|
import com.youchain.basicdata.service.ItemService;
|
||||||
import com.youchain.basicdata.service.PointService;
|
import com.youchain.basicdata.service.PointService;
|
||||||
|
|
@ -73,17 +68,10 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
private final AgvTaskRepository agvTaskRepository;
|
private final AgvTaskRepository agvTaskRepository;
|
||||||
private final AgvTaskMapper agvTaskMapper;
|
private final AgvTaskMapper agvTaskMapper;
|
||||||
private final TaskRepository taskRepository;
|
private final TaskRepository taskRepository;
|
||||||
private final AsnDetailService asnDetailService;
|
|
||||||
private final InventoryService inventoryService;
|
private final InventoryService inventoryService;
|
||||||
private final AsnService asnService;
|
|
||||||
private final ItemService itemService;
|
|
||||||
private final InventoryLogService inventoryLogService;
|
|
||||||
private final TaskService taskService;
|
|
||||||
private final PointService pointService;
|
|
||||||
private final PointRepository pointRepository;
|
private final PointRepository pointRepository;
|
||||||
|
private final StockTypeRepository stockTypeRepository;
|
||||||
private final AsnDetailRepository asnDetailRepository;
|
private final AsnDetailRepository asnDetailRepository;
|
||||||
private final StockRepository stockRepository;
|
|
||||||
private final DictService dictService;
|
|
||||||
private final EntityManager entityMapper;
|
private final EntityManager entityMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -159,6 +147,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 南瑞-AGV接口
|
||||||
* @param agvTask
|
* @param agvTask
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -192,7 +181,11 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
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")) {
|
||||||
agvTask.setStatus(BizStatus.ATCALL);
|
if (agvTask.getType().equals(BizStatus.AGV_R)||agvTask.getType().equals(BizStatus.AGV_C)){
|
||||||
|
agvTask.setStatus(BizStatus.FINISH);
|
||||||
|
}else {
|
||||||
|
agvTask.setStatus(BizStatus.ATCALL);
|
||||||
|
}
|
||||||
agvTask.setJobMessage(resultJson);
|
agvTask.setJobMessage(resultJson);
|
||||||
agvTask.setReqMessage(jsonObject.toString());
|
agvTask.setReqMessage(jsonObject.toString());
|
||||||
agvTask.setStartTime(new Timestamp(new Date().getTime()));
|
agvTask.setStartTime(new Timestamp(new Date().getTime()));
|
||||||
|
|
@ -460,6 +453,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
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));
|
||||||
|
|
@ -469,30 +463,55 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
Point endPoint=null;
|
Point endPoint=null;
|
||||||
if (status.equals("1")){
|
if (status.equals("1")){
|
||||||
// 开始执行
|
// 开始执行
|
||||||
agvTask.setStatus(BizStatus.ATWORK);
|
// agvTask.setStatus(BizStatus.ATWORK);
|
||||||
}else if (status.equals("2")){
|
}else if (status.equals("2")){
|
||||||
// 取料完成
|
// 取料完成
|
||||||
startPoint=pointRepository.findByCode(agvTask.getStartSlotCode());
|
startPoint=pointRepository.findByCode(agvTask.getStartSlotCode());
|
||||||
startPoint.setStatus(BaseStatus.FREE);
|
if (startPoint!=null) {
|
||||||
startPoint.setStorageType(null);
|
startPoint.setStatus(BaseStatus.FREE);
|
||||||
pointRepository.save(startPoint);
|
startPoint.setStorageType(null);
|
||||||
agvTask.setStartTime(new Timestamp((new Date()).getTime()));
|
pointRepository.save(startPoint);
|
||||||
|
agvTask.setStartTime(new Timestamp((new Date()).getTime()));
|
||||||
|
}else {
|
||||||
|
List<Task> taskList = taskRepository.findByAgvTask(agvTask.getId(), BizStatus.ALLOCATE);
|
||||||
|
for (int i = 0; i < taskList.size(); i++) {
|
||||||
|
Task task = taskList.get(i);
|
||||||
|
if (task.getTaskType().equals(BizStatus.RM_CK)) {
|
||||||
|
/** 入库为料箱出库 出库所有的清空搬运任务关联的所有Point*/
|
||||||
|
Point point = task.getSrcPoint();
|
||||||
|
point.setStatus(BaseStatus.FREE);
|
||||||
|
point.setStorageType(null);
|
||||||
|
pointRepository.save(point);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (status.equals("3")) {
|
} else if (status.equals("3")) {
|
||||||
// 放料完成
|
|
||||||
endPoint=pointRepository.findByCode(agvTask.getEndSlotCode());
|
|
||||||
endPoint.setStatus(BaseStatus.FREE);
|
|
||||||
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 (agvTask.getJobType().equals(BizStatus.ASN)) {
|
// 放料完成
|
||||||
List<Map<String,Object>> taskMapList=taskRepository.findByAgvTask(agvTask.getId(),"ASN",1l);
|
endPoint=pointRepository.findByCode(agvTask.getEndSlotCode());
|
||||||
if (taskMapList.size()>0) {
|
if (endPoint!=null) {
|
||||||
/** 入库任务回调 生成库存 */
|
endPoint.setStatus(BaseStatus.FREE);
|
||||||
Inventory inventory = inventoryService.asnAddInventory(taskMapList);
|
endPoint.setStorageType(agvTask.getStockTypeCode());
|
||||||
|
pointRepository.save(endPoint);
|
||||||
|
if (agvTask.getJobType().equals(BizStatus.ASN)) {
|
||||||
|
List<Task> taskList = taskRepository.findByAgvTask(agvTask.getId(), BizStatus.RECEIVING);
|
||||||
|
if (taskList.size() > 0) {
|
||||||
|
if (taskList.get(0).getTaskType().equals(BizStatus.RM_RK)) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
List<Map<String, Object>> taskMapList = taskRepository.findByAgvTask(agvTask.getId()
|
||||||
|
, taskList.get(0).getTaskType(), 1l,null);
|
||||||
|
if (taskMapList.size() > 0) {
|
||||||
|
/** 入库任务回调 生成库存 */
|
||||||
|
Inventory inventory = inventoryService.asnAddInventory(taskMapList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (agvTask.getJobType().equals(BizStatus.PICK)) {
|
if (agvTask.getJobType().equals(BizStatus.PICK)) {
|
||||||
List<Task> taskList=taskRepository.getAgvTaskList(agvTask.getId());
|
List<Task> taskList=taskRepository.findByAgvTask(agvTask.getId());
|
||||||
/** 出库任务回调 生成删除库存*/
|
/** 出库任务回调 生成删除库存*/
|
||||||
inventoryService.pickDelInventory(taskList);
|
inventoryService.pickDelInventory(taskList);
|
||||||
}
|
}
|
||||||
|
|
@ -593,13 +612,35 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void pointStockRk(String storageType, Long id) {
|
public ApiResult pointStockRk(String storageType, Long id) {
|
||||||
Point point=pointRepository.getById(id);
|
Point point=pointRepository.getById(id);
|
||||||
System.out.println("调用容器入场接口");
|
System.out.println("调用容器入场接口");
|
||||||
|
// AgvTask agvTask = addAgvTask(BizStatus.AGV, stockType, task.getSrcPoint().getCode(),task.getDstPoint().getCode() , BizStatus.OPEN, BizStatus.ASN);
|
||||||
|
|
||||||
|
AgvTask agvTask=addAgvTask(BizStatus.AGV_R,storageType,null,point.getCode(),BizStatus.OPEN,BizStatus.ASN);
|
||||||
|
JSONObject resultJson = JSONObject.parseObject(sendAgvTaskImpl(agvTask));
|
||||||
|
if (!resultJson.getString("code").equals("0")){
|
||||||
|
return ApiResult.fail(500, "容器入场失败", resultJson);
|
||||||
|
}
|
||||||
point.setStorageType(storageType);
|
point.setStorageType(storageType);
|
||||||
pointRepository.save(point);
|
pointRepository.save(point);
|
||||||
|
return ApiResult.fail(200, "操作成功", null);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public ApiResult pointStockCk(String storageType, Long id) {
|
||||||
|
Point point=pointRepository.getById(id);
|
||||||
|
System.out.println("调用容器入场接口");
|
||||||
|
// AgvTask agvTask = addAgvTask(BizStatus.AGV, stockType, task.getSrcPoint().getCode(),task.getDstPoint().getCode() , BizStatus.OPEN, BizStatus.ASN);
|
||||||
|
|
||||||
|
AgvTask agvTask=addAgvTask(BizStatus.AGV_C,storageType,null,point.getCode(),BizStatus.OPEN,BizStatus.ASN);
|
||||||
|
JSONObject resultJson = JSONObject.parseObject(sendAgvTaskImpl(agvTask));
|
||||||
|
if (!resultJson.getString("code").equals("0")){
|
||||||
|
return ApiResult.fail(500, "容器入场失败", resultJson);
|
||||||
|
}
|
||||||
|
point.setStorageType(storageType);
|
||||||
|
pointRepository.save(point);
|
||||||
|
return ApiResult.fail(200, "操作成功", null);
|
||||||
|
}
|
||||||
@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();
|
||||||
|
|
@ -617,97 +658,111 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
// 生成任务占用库位
|
// 生成任务占用库位
|
||||||
Point startPoint=pointRepository.findByCode(startSlotCode);
|
Point startPoint=pointRepository.findByCode(startSlotCode);
|
||||||
Point endPoint=pointRepository.findByCode(endSlotCode);
|
Point endPoint=pointRepository.findByCode(endSlotCode);
|
||||||
if (startPoint.getType().equals("STORAGE")){
|
if (!type.equals(BizStatus.AGV_R)&&!type.equals(BizStatus.AGV_C)) {
|
||||||
startPoint.setStatus(BaseStatus.USED);
|
if (startPoint!=null&&startPoint.getType().equals("STORAGE")) {
|
||||||
pointRepository.save(startPoint);
|
startPoint.setStatus(BaseStatus.USED);
|
||||||
|
pointRepository.save(startPoint);
|
||||||
|
}
|
||||||
|
if (endPoint!=null&&endPoint.getType().equals("STORAGE")) {
|
||||||
|
endPoint.setStatus(BaseStatus.USED);
|
||||||
|
pointRepository.save(endPoint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (startPoint.getType().equals("STORAGE")){
|
|
||||||
endPoint.setStatus(BaseStatus.USED);
|
|
||||||
endPoint.setStorageType(startPoint.getStorageType());
|
|
||||||
pointRepository.save(endPoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
return agv;
|
return agv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String addAgvTask(Long id, String pointEndCode) {
|
public ApiResult addAgvTask(Long id, String pointEndCode) {
|
||||||
Point startPoint=pointRepository.getById(id);
|
Point startPoint=pointRepository.getById(id);
|
||||||
Point endPoint=pointRepository.findByCode(pointEndCode);
|
Point endPoint=pointRepository.findByCode(pointEndCode);
|
||||||
if (endPoint!=null){
|
if (endPoint!=null){
|
||||||
if (!startPoint.getStatus().equals(BaseStatus.FREE)){
|
if (!startPoint.getStatus().equals(BaseStatus.FREE)){
|
||||||
return startPoint.getCode()+":被任务占用";
|
return ApiResult.fail(500,startPoint.getCode()+":被任务占用",null);
|
||||||
}
|
}
|
||||||
if (!endPoint.getStatus().equals(BaseStatus.FREE)){
|
if (!endPoint.getStatus().equals(BaseStatus.FREE)){
|
||||||
return endPoint.getCode()+":被任务占用";
|
return ApiResult.fail(500,endPoint.getCode()+":被任务占用",null);
|
||||||
}
|
}
|
||||||
AgvTask agvTask = addAgvTask(BizStatus.AGV, startPoint.getStorageType(), startPoint.getCode(),endPoint.getCode() , BizStatus.OPEN, BizStatus.ASN);
|
AgvTask agvTask = addAgvTask(BizStatus.AGV, startPoint.getStorageType(), startPoint.getCode(),endPoint.getCode() , BizStatus.OPEN, BizStatus.ASN);
|
||||||
}else {
|
}else {
|
||||||
return pointEndCode+":目标点错误";
|
return ApiResult.fail(500,pointEndCode+":目标点错误",null);
|
||||||
}
|
}
|
||||||
return null;
|
return ApiResult.fail(200,"操作成功",null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public ApiResult addAgvAsn() {
|
public ApiResult addAgvAsn(String areaCode,String billType) {
|
||||||
String goodType="BCP";
|
List<Task> taskItemKeyList=taskRepository.findByGroupItemKey(BizStatus.RECEIVING,1,billType);
|
||||||
//半成品入库
|
for (int i = 0; i < taskItemKeyList.size(); i++) {
|
||||||
List<Map<String,Object>> asnDetailSumQty=asnDetailRepository.findByAsn(BizStatus.RECEIVING,"SM_RK");
|
Task taskItemKey=taskItemKeyList.get(i);
|
||||||
List<Map<String,Object>> taskSumQty=taskRepository.findBySumPlanQty(BizStatus.RECEIVING,1,goodType);
|
// 搬运 起点
|
||||||
if (taskSumQty.size()>1){
|
String startPointCode=taskItemKey.getSrcPoint().getCode();
|
||||||
//异常
|
// 搬运 终点
|
||||||
List<Task> taskList=taskRepository.findByItemType(BizStatus.RECEIVING,1,goodType);
|
String endPointCode = taskItemKey.getDstPoint().getCode();
|
||||||
for (int i = 0; i < taskList.size(); i++) {
|
String stockTypeCode="";
|
||||||
Task task=taskList.get(i);
|
// 搬运容器类型类型
|
||||||
task.setTaskStatus(BizStatus.UNUSUAL);
|
if (taskItemKey.getTaskType().equals(BizStatus.FC_RK)){
|
||||||
taskRepository.save(task);
|
stockTypeCode=BizStatus.CTP_STO;
|
||||||
}
|
if (taskItemKeyList.size()==1){
|
||||||
return ApiResult.success(500, "任务异常:单次任务中有多个物料", "");
|
|
||||||
} else if (taskSumQty.size()==1) {
|
}else {
|
||||||
//半成品入库
|
return ApiResult.fail(201,"已读取到成品入库RFID票数:"+taskItemKeyList.size(),null);
|
||||||
Map<String,Object> objectMap=taskSumQty.get(0);
|
}
|
||||||
Long itemId=Long.valueOf(objectMap.get("itemId")+"");
|
}else if(taskItemKey.getTaskType().equals(BizStatus.RM_RK)){
|
||||||
Double taskQty=Double.valueOf(objectMap.get("taskQty")+"");
|
stockTypeCode=BizStatus.LX_STO;
|
||||||
for (int i = 0; i < asnDetailSumQty.size(); i++) {
|
if (taskItemKeyList.size()==3){
|
||||||
Map<String,Object> sumQty=asnDetailSumQty.get(i);
|
endPointCode=taskItemKey.getDstPoint().getBeatCode();
|
||||||
if (Long.valueOf(sumQty.get("itemId")+"")==itemId){
|
}else {
|
||||||
if (taskQty>Double.valueOf(sumQty.get("qty")+"")){
|
return ApiResult.fail(201,"已读取到料箱入库RFID票数:"+taskItemKeyList.size(),null);
|
||||||
return ApiResult.success(500, "任务异常:RFID读取到的物料数量大于入库单中的数量", "");
|
}
|
||||||
}
|
}else if(taskItemKey.getTaskType().equals(BizStatus.SM_RK)){
|
||||||
|
stockTypeCode=BizStatus.TP_STO;
|
||||||
|
if (taskItemKeyList.size()==1){
|
||||||
|
|
||||||
|
}else {
|
||||||
|
return ApiResult.fail(201,"已读取到半成品入库RFID票数:"+taskItemKeyList.size(),null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Item item=itemService.findByItemId(itemId);
|
String stockType=stockTypeRepository.findByCode(stockTypeCode).getMode();
|
||||||
if (taskQty>=item.getExtendD1()){
|
// 生成AgvTask搬运任务
|
||||||
//入库
|
AgvTask agvTask = addAgvTask(BizStatus.AGV, stockType, startPointCode,endPointCode , BizStatus.OPEN, BizStatus.ASN);
|
||||||
//查询入库库位
|
// 入库的Task任务
|
||||||
List<Point> pointList = pointRepository.findByAreaCode(goodType);
|
List<Task> taskList=taskRepository.findByItemKey(taskItemKey.getItemKey().getId(), taskItemKey.getTaskStatus());
|
||||||
if (pointList.size()>0){
|
for (int j = 0; j < taskList.size(); j++) {
|
||||||
Point point=pointList.get(0);
|
Task task=taskList.get(j);
|
||||||
List<Task> taskList=taskRepository.findByItemType(BizStatus.RECEIVING,1,goodType);
|
task.setAgvTask(agvTask);
|
||||||
for (int i = 0; i < taskList.size(); i++) {
|
task.setTaskStatus(BizStatus.PUTAWAY);
|
||||||
Task task=taskList.get(i);
|
taskRepository.save(task);
|
||||||
//更新Task任务
|
|
||||||
ApiResult success = taskService.getAsnTask(point, task);
|
|
||||||
if (success != null) return success;
|
|
||||||
AgvTask agvTask = addAgvTask(BizStatus.AGV, task.getSrcPoint().getStorageType(), task.getSrcPoint().getCode(),task.getDstPoint().getCode() , BizStatus.OPEN, BizStatus.ASN);
|
|
||||||
task.setAgvTask(agvTask);
|
|
||||||
taskRepository.save(task);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
return ApiResult.success(500, "任务异常:存储库存不足", "");
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
//数量不够
|
|
||||||
return ApiResult.success(201, "检测到数量不足一托!!", "");
|
|
||||||
}
|
}
|
||||||
}else {
|
|
||||||
//未查询半成品入库到数据
|
|
||||||
return ApiResult.success(202, "未检测到数据", "");
|
|
||||||
}
|
}
|
||||||
|
return ApiResult.success(200, "操作成功", null);
|
||||||
|
}
|
||||||
|
//料想入库
|
||||||
|
public ApiResult addAgvAsnLx(String areaCode,String billType) {
|
||||||
|
// 收货明细
|
||||||
|
List<AsnDetail> asnDetailList=asnDetailRepository.findByAsnBillType(billType);
|
||||||
|
// 查询待收货的 Task
|
||||||
|
List<Task> taskList=taskRepository.findByItemType(BizStatus.RECEIVING, 1, billType);
|
||||||
|
for (int i = 0; i < taskList.size(); i++) {
|
||||||
|
Task task=taskList.get(i);
|
||||||
|
task.setMoveQty(task.getPlanQty());
|
||||||
|
for (int j = 0; j < asnDetailList.size(); j++) {
|
||||||
|
AsnDetail asnDetail=asnDetailList.get(i);
|
||||||
|
//匹配 收货明细
|
||||||
|
if (task.getItemKey().getItem().getId()==asnDetail.getItem().getId()&&asnDetail.getOrderQty()>asnDetail.getReceivedQty()){
|
||||||
|
asnDetail.setReceivedQty(asnDetail.getReceivedQty()+task.getMoveQty());
|
||||||
|
}else {
|
||||||
|
return ApiResult.success(500, "无匹配收货单", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return ApiResult.success(200, "操作成功", "");
|
return ApiResult.success(200, "操作成功", "");
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public ApiResult addAgvAsnTage() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void sendStockRk(String storageType, String pointCode) {
|
public void sendStockRk(String storageType, String pointCode) {
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,16 @@ public class AsnServiceImpl implements AsnService {
|
||||||
int floorNum = (int) Math.floor(result);// 整托数
|
int floorNum = (int) Math.floor(result);// 整托数
|
||||||
// 成品入库 分配库位
|
// 成品入库 分配库位
|
||||||
List<Point> points=new ArrayList<>();
|
List<Point> points=new ArrayList<>();
|
||||||
List<Point> pointList=pointRepository.findByAreaCodeCp(item.getGoodType(),BaseStatus.FREE);
|
String billType=asnDetail.getAsn().getBillType().getCode();
|
||||||
|
String areaCode="";
|
||||||
|
if (billType.equals(BizStatus.SM_RK)){
|
||||||
|
areaCode=BizStatus.BCP;
|
||||||
|
} else if (billType.equals(BizStatus.RM_RK)) {
|
||||||
|
areaCode=BizStatus.LX;
|
||||||
|
}else {
|
||||||
|
areaCode=BizStatus.CP;
|
||||||
|
}
|
||||||
|
List<Point> pointList=pointRepository.findByAreaCodeCp(areaCode,BaseStatus.FREE);
|
||||||
for (int j = 0; j < pointList.size(); j++) {
|
for (int j = 0; j < pointList.size(); j++) {
|
||||||
if (points.size()>=floorNum){
|
if (points.size()>=floorNum){
|
||||||
// 整托数 分配完成
|
// 整托数 分配完成
|
||||||
|
|
@ -196,6 +205,8 @@ public class AsnServiceImpl implements AsnService {
|
||||||
}
|
}
|
||||||
sb.append("】剩余整托数"+(floorNum-points.size())+",未占用库位的余托数量"+orderQty % zzsQty+";");
|
sb.append("】剩余整托数"+(floorNum-points.size())+",未占用库位的余托数量"+orderQty % zzsQty+";");
|
||||||
datas.add(sb.toString());
|
datas.add(sb.toString());
|
||||||
|
asnDetail.setStatus(BizStatus.ACTIVE);
|
||||||
|
asnDetailRepository.save(asnDetail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//修改状态
|
//修改状态
|
||||||
|
|
@ -256,6 +267,8 @@ public class AsnServiceImpl implements AsnService {
|
||||||
}
|
}
|
||||||
sb.append("】");
|
sb.append("】");
|
||||||
datas.add(sb.toString());
|
datas.add(sb.toString());
|
||||||
|
asnDetail.setStatus(BizStatus.OPEN);
|
||||||
|
asnDetailRepository.save(asnDetail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//修改状态
|
//修改状态
|
||||||
|
|
|
||||||
|
|
@ -221,6 +221,7 @@ public class InventoryServiceImpl implements InventoryService {
|
||||||
Long taskId=Long.valueOf(arrTaskIds[j]+"");
|
Long taskId=Long.valueOf(arrTaskIds[j]+"");
|
||||||
Task task =taskRepository.getById(taskId);
|
Task task =taskRepository.getById(taskId);
|
||||||
task.setTaskStatus(BizStatus.RECEIVED);
|
task.setTaskStatus(BizStatus.RECEIVED);
|
||||||
|
task.setMoveQty(task.getPlanQty());
|
||||||
task.setInventory(inventory);
|
task.setInventory(inventory);
|
||||||
taskRepository.save(task);
|
taskRepository.save(task);
|
||||||
}
|
}
|
||||||
|
|
@ -259,8 +260,8 @@ public class InventoryServiceImpl implements InventoryService {
|
||||||
taskRepository.save(task);
|
taskRepository.save(task);
|
||||||
/** 刷新出库单明细表*/
|
/** 刷新出库单明细表*/
|
||||||
PickDetail pickDetail=task.getPickDetail();
|
PickDetail pickDetail=task.getPickDetail();
|
||||||
pickDetail.setPickedQty(task.getMoveQty());
|
pickDetail.setPickedQty(pickDetail.getPickedQty()+task.getMoveQty());
|
||||||
if (pickDetail.getAllocatedQty()>=pickDetail.getPickedQty()){
|
if (pickDetail.getAllocatedQty()<=pickDetail.getPickedQty()){
|
||||||
pickDetail.setStatus(BizStatus.PICK_ALL);
|
pickDetail.setStatus(BizStatus.PICK_ALL);
|
||||||
}
|
}
|
||||||
pickDetailRepository.save(pickDetail);
|
pickDetailRepository.save(pickDetail);
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
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.repository.ItemRepository;
|
||||||
|
import com.youchain.businessdata.domain.Asn;
|
||||||
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.domain.Task;
|
||||||
|
|
@ -55,6 +57,7 @@ public class ItemKeyServiceImpl implements ItemKeyService {
|
||||||
|
|
||||||
private final ItemKeyRepository itemKeyRepository;
|
private final ItemKeyRepository itemKeyRepository;
|
||||||
private final InventoryRepository inventoryRepository;
|
private final InventoryRepository inventoryRepository;
|
||||||
|
private final ItemRepository itemRepository;
|
||||||
private final InventoryService inventoryService;
|
private final InventoryService inventoryService;
|
||||||
private final ItemKeyMapper itemKeyMapper;
|
private final ItemKeyMapper itemKeyMapper;
|
||||||
private final EntityManager entityManager;
|
private final EntityManager entityManager;
|
||||||
|
|
@ -255,7 +258,29 @@ public class ItemKeyServiceImpl implements ItemKeyService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResult devanning(JSONObject req) {
|
public ApiResult devanning(JSONObject req) {
|
||||||
|
/*JSONArray invIds=req.getJSONArray("invIds");//invIds
|
||||||
|
String rfid1=req.getString("rfid1");//
|
||||||
|
String rfid2=req.getString("rfid2");//
|
||||||
|
Point point = null;
|
||||||
|
for (int i = 0; i < invIds.size(); i++) {
|
||||||
|
Long invId=invIds.getLong(i);
|
||||||
|
Inventory startInventory=inventoryRepository.getById(invId);
|
||||||
|
if (point==null){
|
||||||
|
point=startInventory.getPoint();
|
||||||
|
}
|
||||||
|
*//*if (inventory.getQueuedQty()>0){
|
||||||
|
return ApiResult.fail(200,inventory.getId()+"被占用",null);
|
||||||
|
}*//*
|
||||||
|
inventoryRepository.delete(startInventory);
|
||||||
|
}
|
||||||
|
// 解析RFID信息
|
||||||
|
String[] rfids=rfid1.split("\\|");
|
||||||
|
Inventory inventory1 = getApiResult(rfid1, rfids);
|
||||||
|
inventory1.setPoint(point);
|
||||||
|
inventoryRepository.save(inventory1);
|
||||||
|
Inventory inventory2 = getApiResult(rfid2, rfids);*/
|
||||||
JSONArray invIds=req.getJSONArray("invIds");//invIds
|
JSONArray invIds=req.getJSONArray("invIds");//invIds
|
||||||
|
|
||||||
String text1PropC6=req.getString("text1PropC6");
|
String text1PropC6=req.getString("text1PropC6");
|
||||||
String text2PropC6=req.getString("text2PropC6");
|
String text2PropC6=req.getString("text2PropC6");
|
||||||
for (int i = 0; i < invIds.size(); i++) {
|
for (int i = 0; i < invIds.size(); i++) {
|
||||||
|
|
|
||||||
|
|
@ -167,6 +167,9 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
//获取目标点位
|
//获取目标点位
|
||||||
apiResult = getAllocate(pickDetail, item, dept, quantity,1);
|
apiResult = getAllocate(pickDetail, item, dept, quantity,1);
|
||||||
}
|
}
|
||||||
|
Pick pick=pickDetail.getPick();
|
||||||
|
pick.setStatus(BizStatus.ALLOCATE);
|
||||||
|
pickRepository.save(pick);
|
||||||
if (apiResult != null) return apiResult;
|
if (apiResult != null) return apiResult;
|
||||||
}
|
}
|
||||||
return ApiResult.fail(200,"操作成功",null);
|
return ApiResult.fail(200,"操作成功",null);
|
||||||
|
|
@ -210,8 +213,8 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
inventoryRepository.save(inv);
|
inventoryRepository.save(inv);
|
||||||
unQty = unQty-allocateQty;
|
unQty = unQty-allocateQty;
|
||||||
//占用点位
|
//占用点位
|
||||||
startPoint.setStatus(BaseStatus.USED);
|
/*startPoint.setStatus(BaseStatus.USED);
|
||||||
pointRepository.save(startPoint);
|
pointRepository.save(startPoint);*/
|
||||||
//更新出库单
|
//更新出库单
|
||||||
pickDetail.setAllocatedQty(pickDetail.getAllocatedQty() + allocateQty);
|
pickDetail.setAllocatedQty(pickDetail.getAllocatedQty() + allocateQty);
|
||||||
pickDetail.setStatus(BizStatus.ALLOCATE);
|
pickDetail.setStatus(BizStatus.ALLOCATE);
|
||||||
|
|
@ -224,21 +227,24 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
task.setBillCode(pickDetail.getPick().getRelatedBill1());
|
task.setBillCode(pickDetail.getPick().getRelatedBill1());
|
||||||
task.setSrcPoint(startPoint);
|
task.setSrcPoint(startPoint);
|
||||||
task.setDstPoint(endPoint);
|
task.setDstPoint(endPoint);
|
||||||
task.setTaskType(BizStatus.PICK);
|
task.setTaskType(pickDetail.getPick().getBillType().getCode());
|
||||||
task.setTaskStatus(BizStatus.ALLOCATE);
|
task.setTaskStatus(BizStatus.ALLOCATE);
|
||||||
task.setBeSkip(agvFlag);//是否AGV出库
|
task.setBeSkip(agvFlag);//是否AGV出库
|
||||||
task.setPlanQty(allocateQty);
|
task.setPlanQty(allocateQty);
|
||||||
task.setDept(dept);
|
task.setDept(dept);
|
||||||
task.setInventory(inv);
|
task.setInventory(inv);
|
||||||
taskRepository.save(task);
|
|
||||||
if (agvFlag ==1) {
|
if (agvFlag ==1) {
|
||||||
/** 是否AGV任务*/
|
/** 是否AGV任务*/
|
||||||
//生成AGV任务
|
if (task.getTaskType().equals(BizStatus.RM_CK)){
|
||||||
AgvTask agvTask = agvTaskService.addAgvTask(BizStatus.AGV, startPoint.getStorageType(), startPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, BizStatus.PICK);
|
// 如果是料箱出库,先不生成搬运任务
|
||||||
//更新Task任务 写入关联AGV
|
}else {
|
||||||
task.setAgvTask(agvTask);
|
//生成AGV任务
|
||||||
taskRepository.save(task);
|
AgvTask agvTask = agvTaskService.addAgvTask(BizStatus.AGV, startPoint.getStorageType(), startPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, BizStatus.PICK);
|
||||||
|
//更新Task任务 写入关联AGV
|
||||||
|
task.setAgvTask(agvTask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
taskRepository.save(task);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -423,6 +429,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
for (int i = 0; i < ids.length; i++) {
|
for (int i = 0; i < ids.length; i++) {
|
||||||
PickDetail pickDetail=pickDetailRepository.getById(ids[i]);
|
PickDetail pickDetail=pickDetailRepository.getById(ids[i]);
|
||||||
apiResult = cancelAllocate(pickDetail.getId(), pickDetail.getAllocatedQty());
|
apiResult = cancelAllocate(pickDetail.getId(), pickDetail.getAllocatedQty());
|
||||||
|
|
||||||
}
|
}
|
||||||
return apiResult;
|
return apiResult;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,9 +137,7 @@ public class PickServiceImpl implements PickService {
|
||||||
PickDetail pickDetail=pickDetailList.get(i);
|
PickDetail pickDetail=pickDetailList.get(i);
|
||||||
Long[] pfIds={ pickDetail.getId() };
|
Long[] pfIds={ pickDetail.getId() };
|
||||||
ApiResult apiResult = pickDetailService.allocate(pfIds);
|
ApiResult apiResult = pickDetailService.allocate(pfIds);
|
||||||
if (apiResult.getStatus()==201){
|
apiResults.add(apiResult);
|
||||||
apiResults.add(apiResult);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pick.setStatus(BizStatus.ALLOCATE);
|
pick.setStatus(BizStatus.ALLOCATE);
|
||||||
pickRepository.save(pick);
|
pickRepository.save(pick);
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.service.impl;
|
package com.youchain.businessdata.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.youchain.basicdata.domain.Item;
|
import com.youchain.basicdata.domain.Item;
|
||||||
import com.youchain.basicdata.domain.Point;
|
import com.youchain.basicdata.domain.Point;
|
||||||
|
|
@ -24,13 +24,12 @@ import com.youchain.basicdata.domain.Stock;
|
||||||
import com.youchain.basicdata.repository.ItemRepository;
|
import com.youchain.basicdata.repository.ItemRepository;
|
||||||
import com.youchain.basicdata.repository.PointRepository;
|
import com.youchain.basicdata.repository.PointRepository;
|
||||||
import com.youchain.basicdata.repository.StockRepository;
|
import com.youchain.basicdata.repository.StockRepository;
|
||||||
import com.youchain.basicdata.service.dto.StockSmallDto;
|
import com.youchain.basicdata.repository.StockTypeRepository;
|
||||||
import com.youchain.businessdata.ReturnJson.RPTaskList;
|
import com.youchain.businessdata.ReturnJson.RPTaskList;
|
||||||
import com.youchain.businessdata.domain.*;
|
import com.youchain.businessdata.domain.*;
|
||||||
import com.youchain.businessdata.inputJson.IPTask;
|
import com.youchain.businessdata.inputJson.IPTask;
|
||||||
import com.youchain.businessdata.repository.*;
|
import com.youchain.businessdata.repository.*;
|
||||||
import com.youchain.businessdata.service.*;
|
import com.youchain.businessdata.service.*;
|
||||||
import com.youchain.businessdata.service.dto.InventoryDto;
|
|
||||||
import com.youchain.exception.handler.ApiResult;
|
import com.youchain.exception.handler.ApiResult;
|
||||||
import com.youchain.modules.system.domain.Dept;
|
import com.youchain.modules.system.domain.Dept;
|
||||||
import com.youchain.utils.*;
|
import com.youchain.utils.*;
|
||||||
|
|
@ -39,7 +38,6 @@ import com.youchain.businessdata.service.dto.TaskDto;
|
||||||
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
||||||
import com.youchain.businessdata.service.mapstruct.TaskMapper;
|
import com.youchain.businessdata.service.mapstruct.TaskMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.checkerframework.checker.units.qual.A;
|
|
||||||
import org.hibernate.SQLQuery;
|
import org.hibernate.SQLQuery;
|
||||||
import org.hibernate.transform.AliasToEntityMapResultTransformer;
|
import org.hibernate.transform.AliasToEntityMapResultTransformer;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -48,7 +46,6 @@ 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 org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
|
|
||||||
import java.security.PrivateKey;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
|
@ -72,8 +69,10 @@ public class TaskServiceImpl implements TaskService {
|
||||||
private final AsnRepository asnRepository;
|
private final AsnRepository asnRepository;
|
||||||
private final InventoryRepository inventoryRepository;
|
private final InventoryRepository inventoryRepository;
|
||||||
private final InventoryService inventoryService;
|
private final InventoryService inventoryService;
|
||||||
|
private final AgvTaskService agvTaskService;
|
||||||
private final PickDetailRepository pickDetailRepository;
|
private final PickDetailRepository pickDetailRepository;
|
||||||
private final AsnDetailRepository asnDetailRepository;
|
private final AsnDetailRepository asnDetailRepository;
|
||||||
|
private final StockTypeRepository stockTypeRepository;
|
||||||
private final AsnDetailService asnDetailService;
|
private final AsnDetailService asnDetailService;
|
||||||
private final InventoryLogService inventoryLogService;
|
private final InventoryLogService inventoryLogService;
|
||||||
private final EntityManager entityMapper;
|
private final EntityManager entityMapper;
|
||||||
|
|
@ -279,13 +278,29 @@ public class TaskServiceImpl implements TaskService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
public ApiResult manualReceiving(String rfid,Point pointStart,int agvFlag) {
|
||||||
public ApiResult readRfid(String rfid,String type) {
|
ApiResult apiResult;
|
||||||
|
String billTypeCode="";//单据类型
|
||||||
|
Point pointEnd=null;
|
||||||
|
// 解析RFID信息
|
||||||
String[] rfids=rfid.split("\\|");
|
String[] rfids=rfid.split("\\|");
|
||||||
String itemCode=rfids[0]+"";
|
String itemCode=rfids[0]+"";
|
||||||
|
Item item=itemRepository.findByCode(itemCode);
|
||||||
|
if (item==null){
|
||||||
|
return ApiResult.result(500, "没有物料", "");
|
||||||
|
}
|
||||||
String propC1=rfids[1]+"";
|
String propC1=rfids[1]+"";
|
||||||
String propC2=rfids[2]+"";
|
String propC2=rfids[2]+"";
|
||||||
String propC3=rfids[3]+"";// 系统单号
|
String propC3=rfids[3]+"";// 系统单号
|
||||||
|
Asn asn=asnRepository.findByRelatedBill1(propC3);
|
||||||
|
if (asn==null){
|
||||||
|
return ApiResult.result(201, "没有入库单", "");
|
||||||
|
}else {
|
||||||
|
if (!asn.getStatus().equals(BizStatus.RECEIVING)&&!asn.getStatus().equals(BizStatus.ACTIVE)){
|
||||||
|
return ApiResult.result(500, "入库单未激活", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
billTypeCode=asn.getBillType().getCode();//入库-单据类型
|
||||||
String propC4=rfids[4]+"";
|
String propC4=rfids[4]+"";
|
||||||
String propC5=rfids[5]+"";//16进制 供货数量
|
String propC5=rfids[5]+"";//16进制 供货数量
|
||||||
StringBuffer propC6 = new StringBuffer();//流水号
|
StringBuffer propC6 = new StringBuffer();//流水号
|
||||||
|
|
@ -297,31 +312,21 @@ public class TaskServiceImpl implements TaskService {
|
||||||
String propC6Title=null;//成品收货-成品码抬头
|
String propC6Title=null;//成品收货-成品码抬头
|
||||||
Long propC6_start_d = 0l;//成品收货-成品码起始码
|
Long propC6_start_d = 0l;//成品收货-成品码起始码
|
||||||
Long propC6_end_d=0l;//成品收货-成品码终止码
|
Long propC6_end_d=0l;//成品收货-成品码终止码
|
||||||
Asn asn=asnRepository.findByRelatedBill1(propC3);
|
// 更新当前点位 存储容器状态
|
||||||
if (asn==null){
|
String storageType="";
|
||||||
return ApiResult.result(201, "没有入库单", "");
|
if (billTypeCode.equals(BizStatus.FC_RK)) {
|
||||||
}else {
|
|
||||||
if (!asn.getStatus().equals(BizStatus.RECEIVING)&&!asn.getStatus().equals(BizStatus.ACTIVE)){
|
|
||||||
return ApiResult.result(500, "入库单未激活", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (asn.getBillType().getCode().equals(BizStatus.FC_RK)){
|
|
||||||
propC6Title=rfids[7].substring(0, 6);
|
propC6Title=rfids[7].substring(0, 6);
|
||||||
propC6_start_d=Long.valueOf(rfids[7].substring(6, rfids[7].length()-1));//起始成品码
|
propC6_start_d=Long.valueOf(rfids[7].substring(6, rfids[7].length()-1));//起始成品码
|
||||||
propC6_end_d=Long.valueOf(rfids[8].substring(6, rfids[8].length()-1));//终止成品码
|
propC6_end_d=Long.valueOf(rfids[8].substring(6, rfids[8].length()-1));//终止成品码
|
||||||
propC6.append(propC6Title+propC6_start_d+"-"+propC6Title+propC6_end_d);
|
propC6.append(propC6Title+propC6_start_d+"-"+propC6Title+propC6_end_d);
|
||||||
/*for (Long i = propC6_start_d; i < propC6_end_d; i++) {
|
|
||||||
if (propC6.length()<1){
|
|
||||||
propC6.append(propC6Title+i);
|
|
||||||
}else {
|
|
||||||
propC6.append(","+propC6Title+i);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
xs = Integer.parseInt(rfids[9], 16);//箱数
|
xs = Integer.parseInt(rfids[9], 16);//箱数
|
||||||
xs_start_d = Double.valueOf(rfids[10]);//料箱起始码
|
xs_start_d = Double.valueOf(rfids[10]);//料箱起始码
|
||||||
xs_end_d = Double.valueOf(rfids[11]);//料箱终止码
|
xs_end_d = Double.valueOf(rfids[11]);//料箱终止码
|
||||||
xs_d = Integer.parseInt(propC5, 16) / xs;//单箱数量
|
xs_d = Integer.parseInt(propC5, 16) / xs;//单箱数量
|
||||||
}else {
|
|
||||||
|
//成品容器类型 入库
|
||||||
|
storageType=BizStatus.CTP_STO;
|
||||||
|
} else if (billTypeCode.equals(BizStatus.SM_RK)) {
|
||||||
for (int i = 6; i < rfids.length; i++) {
|
for (int i = 6; i < rfids.length; i++) {
|
||||||
int decimalNumber = Integer.parseInt(rfids[i], 16);
|
int decimalNumber = Integer.parseInt(rfids[i], 16);
|
||||||
int decimalMin = Integer.parseInt("0001", 16);
|
int decimalMin = Integer.parseInt("0001", 16);
|
||||||
|
|
@ -337,108 +342,142 @@ public class TaskServiceImpl implements TaskService {
|
||||||
System.out.println("无效RFID:" + rfids[i]);
|
System.out.println("无效RFID:" + rfids[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//半成品 入库
|
||||||
|
storageType=BizStatus.TP_STO;
|
||||||
|
} else if (billTypeCode.equals(BizStatus.RM_RK)) {
|
||||||
|
for (int i = 6; i < rfids.length; i++) {
|
||||||
|
int decimalNumber = Integer.parseInt(rfids[i], 16);
|
||||||
|
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 {
|
||||||
|
System.out.println("无效RFID:" + rfids[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//料箱 入库
|
||||||
|
if (pointStart.getArea().getId()==45){
|
||||||
|
storageType=BizStatus.LXZ_STO;
|
||||||
|
}else {
|
||||||
|
storageType=BizStatus.LX_STO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
ItemKey itemKey;
|
||||||
Item item=itemRepository.findByCode(itemCode);
|
// 已生成ItemKey
|
||||||
if (item==null){
|
|
||||||
return ApiResult.result(500, "没有物料", "");
|
|
||||||
}
|
|
||||||
if (itemKeyRepository.getByItemKey(item.getId(),propC1,propC2,propC3,propC4,propC5,propC6.toString())!=null){
|
if (itemKeyRepository.getByItemKey(item.getId(),propC1,propC2,propC3,propC4,propC5,propC6.toString())!=null){
|
||||||
return ApiResult.result(500, "重复读取", "");
|
return ApiResult.result(500, "重复读取", "");
|
||||||
};
|
|
||||||
|
|
||||||
ItemKey itemKey=itemKeyService.getItemKey(item, propC1, propC2,propC3,propC4,propC5,propC6.toString(),rfid);
|
|
||||||
//获取流水号
|
|
||||||
String[] lsh=itemKey.getPropC6().split(",");
|
|
||||||
int taskSum=0;// 生成task数量
|
|
||||||
if (asn.getBillType().getCode().equals(BizStatus.FC_RK)){
|
|
||||||
taskSum = xs;//按 料箱数量生成task
|
|
||||||
}else {
|
}else {
|
||||||
if (lsh.length!=itemKey.getIntPropC5()){
|
itemKey = itemKeyService.getItemKey(item, propC1, propC2, propC3, propC4, propC5, propC6.toString(), rfid);
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
//获取流水号
|
||||||
return ApiResult.result(500, "流水号数量和供货数量不一致", "");
|
String[] lsh = itemKey.getPropC6().split(",");
|
||||||
}
|
int taskSum = 0;// 生成task数量
|
||||||
taskSum = lsh.length;//按 流水号数量生成task
|
if (asn.getBillType().getCode().equals(BizStatus.FC_RK)) {
|
||||||
}
|
taskSum = xs;//按 料箱数量生成task
|
||||||
for (int i = 0; i < taskSum; i++) {
|
} else {
|
||||||
Task task = new Task();
|
if (lsh.length != itemKey.getIntPropC5()) {
|
||||||
if (asn.getBillType().getCode().equals(BizStatus.FC_RK)){
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
task.setPlanQty((double) xs_d);//单箱数量
|
return ApiResult.result(500, "流水号数量和供货数量不一致", "");
|
||||||
StringBuffer putCode=new StringBuffer();
|
|
||||||
for (int j = 0; j < xs_d; j++) {
|
|
||||||
if (putCode.length()<1){
|
|
||||||
putCode.append(propC6Title+(propC6_start_d+j));
|
|
||||||
}else {
|
|
||||||
putCode.append(","+propC6Title+(propC6_start_d+j));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
propC6_start_d=propC6_start_d+xs_d;
|
taskSum = lsh.length;//按 流水号数量生成task
|
||||||
task.setPutCode(putCode.toString());//箱内 流水号
|
|
||||||
task.setSrcStockCode((xs_start_d+i)+"");
|
|
||||||
}else {
|
|
||||||
task.setPlanQty(1d);
|
|
||||||
task.setPutCode(lsh[i]);
|
|
||||||
}
|
}
|
||||||
task.setItemKey(itemKey);
|
if (agvFlag==1) {
|
||||||
task.setDept(UserUtils.getDept());
|
String stockTypeCode="";
|
||||||
task.setTaskStatus(BizStatus.RECEIVING);
|
if (billTypeCode.equals(BizStatus.RM_RK)){
|
||||||
if (type.equals("AGV")) {
|
stockTypeCode=BizStatus.LX;
|
||||||
task.setBeSkip(1);
|
}else if (billTypeCode.equals(BizStatus.SM_RK)){
|
||||||
} else if (type.equals("RG")) {
|
stockTypeCode=BizStatus.BCP;
|
||||||
task.setBeSkip(0);
|
}else if (billTypeCode.equals(BizStatus.FC_CK)){
|
||||||
|
stockTypeCode=BizStatus.CP;
|
||||||
|
}
|
||||||
|
// 分配目标库位
|
||||||
|
List<Point> pointEndList = pointRepository.findByAreaCode(stockTypeCode);
|
||||||
|
if (pointEndList.size() > 0) {
|
||||||
|
pointEnd = pointEndList.get(0);
|
||||||
|
} else {
|
||||||
|
return ApiResult.fail(500, "料箱入库没有可用存储库位", null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
task.setBillCode(propC3);
|
|
||||||
task.setTaskType(asn.getBillType().getCode());
|
|
||||||
Point startPoint = pointRepository.findByTypeAndArea(BaseStatus.PLATFORM, item.getGoodType());
|
|
||||||
task.setSrcPoint(startPoint);
|
|
||||||
taskRepository.save(task);
|
|
||||||
}
|
|
||||||
return ApiResult.result(200, "操作成功", asn.getBillType().getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ApiResult manualReceiving(JSONObject request) {
|
for (int i = 0; i < taskSum; i++) {
|
||||||
String rfid=request.getString("RFID");
|
Task task = new Task();
|
||||||
Point point= pointRepository.getById(request.getLong("pointId"));
|
if (asn.getBillType().getCode().equals(BizStatus.FC_RK)) {
|
||||||
// 读取RFID生成Task
|
task.setPlanQty((double) xs_d);//单箱数量
|
||||||
String billTypeCode="";//单据类型
|
StringBuffer putCode = new StringBuffer();
|
||||||
ApiResult apiResult = readRfid(rfid, "RG");
|
for (int j = 0; j < xs_d; j++) {
|
||||||
if (apiResult.getStatus()!=200){
|
if (putCode.length() < 1) {
|
||||||
return apiResult;
|
putCode.append(propC6Title + (propC6_start_d + j));
|
||||||
}else {
|
} else {
|
||||||
if (apiResult.getStatus()==200){
|
putCode.append("," + propC6Title + (propC6_start_d + j));
|
||||||
billTypeCode=apiResult.getData()+"";
|
}
|
||||||
|
}
|
||||||
|
propC6_start_d = propC6_start_d + xs_d;
|
||||||
|
task.setPutCode(putCode.toString());//箱内 流水号
|
||||||
|
task.setSrcStockCode((xs_start_d + i) + "");
|
||||||
|
} else {
|
||||||
|
task.setPlanQty(1d);
|
||||||
|
task.setPutCode(lsh[i]);
|
||||||
|
}
|
||||||
|
task.setItemKey(itemKey);
|
||||||
|
task.setDept(UserUtils.getDept());
|
||||||
|
task.setTaskStatus(BizStatus.RECEIVING);
|
||||||
|
task.setBeSkip(agvFlag);
|
||||||
|
task.setBillCode(propC3);
|
||||||
|
task.setTaskType(asn.getBillType().getCode());
|
||||||
|
task.setSrcPoint(pointStart);
|
||||||
|
if (pointEnd==null){
|
||||||
|
task.setDstPoint(pointStart);
|
||||||
|
}else {
|
||||||
|
task.setDstPoint(pointEnd);
|
||||||
|
}
|
||||||
|
taskRepository.save(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 分配Task库位
|
if (agvFlag==1) {
|
||||||
List<Task> taskList=taskRepository.findByItemType(BizStatus.RECEIVING,0,billTypeCode);
|
/** AGV人工入库*/
|
||||||
for (int i = 0; i < taskList.size(); i++) {
|
pointStart.setStorageType(storageType);
|
||||||
Task task=taskList.get(i);
|
pointRepository.save(pointStart);
|
||||||
ApiResult api = getAsnTask(point, task);
|
if (pointEnd.getArea().getId()==39&&pointEnd.getType().equals(BaseStatus.STORAGE)){
|
||||||
taskRepository.save(task);
|
pointEnd.setStorageType(BizStatus.LX_STO);
|
||||||
}
|
}else {
|
||||||
// 生成库存
|
pointEnd.setStorageType(storageType);
|
||||||
List<Map<String,Object>> taskMapList=taskRepository.findByAgvTask(null,billTypeCode,0l);
|
}
|
||||||
Inventory inventory = inventoryService.asnAddInventory(taskMapList);
|
pointRepository.save(pointEnd);
|
||||||
// 更新当前点位 存储容器状态 ###
|
return ApiResult.result(200, "操作成功", billTypeCode);
|
||||||
point.setStorageType(inventory.getItemKey().getItem().getGoodType());
|
|
||||||
if (point.getStatus().equals(BaseStatus.USED)){
|
|
||||||
point.setStatus(BaseStatus.FREE);
|
|
||||||
}else {
|
}else {
|
||||||
|
/** 人工入库*/
|
||||||
|
Point point=pointStart;
|
||||||
|
// 生成库存
|
||||||
|
Inventory inventory = addAsnInventory(billTypeCode, point,null,0l,itemKey.getId());
|
||||||
|
}
|
||||||
|
return ApiResult.result(200, "操作成功", null);
|
||||||
|
}
|
||||||
|
/** 入库-生成库存*/
|
||||||
|
public Inventory addAsnInventory(String billTypeCode, Point point, Integer agvTaskId,Long agvFlag,Long itemKeyId) {
|
||||||
|
List<Map<String, Object>> taskMapList = taskRepository.findByAgvTask(agvTaskId, billTypeCode, agvFlag,itemKeyId);
|
||||||
|
Inventory inventory = inventoryService.asnAddInventory(taskMapList);
|
||||||
|
if (point.getStatus().equals(BaseStatus.USED)) {
|
||||||
|
point.setStatus(BaseStatus.FREE);
|
||||||
|
} else {
|
||||||
// 人工入库没有选中推荐库位,清除一个库位的占用状态
|
// 人工入库没有选中推荐库位,清除一个库位的占用状态
|
||||||
List<Point> pointList=pointRepository.findByAreaCodeCp(inventory.getItemKey().getItem().getGoodType(),BaseStatus.USED);
|
List<Point> pointList = pointRepository.findByAreaCodeCp(inventory.getItemKey().getItem().getGoodType(), BaseStatus.USED);
|
||||||
for (int i = 0; i < pointList.size(); i++) {
|
for (int i = 0; i < pointList.size(); i++) {
|
||||||
Point pointUsed =pointList.get(0);
|
Point pointUsed = pointList.get(0);
|
||||||
if (point.getHeat()==null||point.getHeat()==1){
|
if (point.getHeat() == null || point.getHeat() == 1) {
|
||||||
//浅位 直接取消
|
//浅位 直接取消
|
||||||
pointUsed.setStatus(BaseStatus.FREE);
|
pointUsed.setStatus(BaseStatus.FREE);
|
||||||
}else {
|
} else {
|
||||||
// 深位,查询浅位是否空闲
|
// 深位,查询浅位是否空闲
|
||||||
List<Point> pointListQ=pointRepository.findByBeatCode(point.getBeatCode(),point.getHeat());
|
List<Point> pointListQ = pointRepository.findByBeatCode(point.getBeatCode(), point.getHeat());
|
||||||
if (pointListQ.size()>0){
|
if (pointListQ.size() > 0) {
|
||||||
// 浅位空闲
|
// 浅位空闲
|
||||||
continue;
|
continue;
|
||||||
}else {
|
} else {
|
||||||
pointUsed.setStatus(BaseStatus.FREE);
|
pointUsed.setStatus(BaseStatus.FREE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -447,7 +486,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pointRepository.save(point);
|
pointRepository.save(point);
|
||||||
return ApiResult.result(200, "操作成功", "");
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Object[]> queryAreaMonth(String type) {
|
public List<Object[]> queryAreaMonth(String type) {
|
||||||
|
|
@ -487,9 +526,10 @@ public class TaskServiceImpl implements TaskService {
|
||||||
return taskList;
|
return taskList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiResult getAsnTask(Point point, Task task) {
|
public ApiResult getAsnTask(Point endPoint, Task task) {
|
||||||
task.setDstPoint(point);
|
task.setDstPoint(endPoint);
|
||||||
task.setMoveQty(task.getPlanQty());
|
task.setMoveQty(task.getPlanQty());
|
||||||
|
taskRepository.save(task);
|
||||||
List<AsnDetail> asnDetailList=asnDetailRepository.findByAsnAndItem(task.getBillCode(), task.getItemKey().getItem().getCode());
|
List<AsnDetail> asnDetailList=asnDetailRepository.findByAsnAndItem(task.getBillCode(), task.getItemKey().getItem().getCode());
|
||||||
if (asnDetailList.size()>0){
|
if (asnDetailList.size()>0){
|
||||||
AsnDetail asnDetail=asnDetailList.get(0);
|
AsnDetail asnDetail=asnDetailList.get(0);
|
||||||
|
|
@ -507,13 +547,19 @@ public class TaskServiceImpl implements TaskService {
|
||||||
Long id=ids[i];
|
Long id=ids[i];
|
||||||
Task task=taskRepository.getById(id);
|
Task task=taskRepository.getById(id);
|
||||||
taskList.add(task);
|
taskList.add(task);
|
||||||
|
if (task.getAgvTask()!=null){
|
||||||
|
AgvTask agvTask=task.getAgvTask();
|
||||||
|
if (agvTask.getStatus().equals(BizStatus.OPEN)||agvTask.getStatus().equals(BizStatus.ATWORK)){
|
||||||
|
return ApiResult.fail(500,"AGV搬运任务未完成",task);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
inventoryService.pickDelInventory(taskList);
|
inventoryService.pickDelInventory(taskList);
|
||||||
return ApiResult.fail(200,"操作成功","");
|
return ApiResult.fail(200,"拣货成功","");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResult devanRfidAsn(String rfid) {
|
public ApiResult devanRfidAsn(String rfid,String pointType) {
|
||||||
String[] rfids=rfid.split("\\|");
|
String[] rfids=rfid.split("\\|");
|
||||||
JSONObject data=new JSONObject();
|
JSONObject data=new JSONObject();
|
||||||
if (rfids.length>4){
|
if (rfids.length>4){
|
||||||
|
|
@ -525,27 +571,45 @@ public class TaskServiceImpl implements TaskService {
|
||||||
|
|
||||||
Asn asn=asnRepository.findByRelatedBill1(propC3);
|
Asn asn=asnRepository.findByRelatedBill1(propC3);
|
||||||
if (asn!=null){
|
if (asn!=null){
|
||||||
if (asn.getBillType().getCode().equals(BizStatus.FC_RK)){
|
String billTypeCode=asn.getBillType().getCode();
|
||||||
// 成品入库
|
data.put("relatedBill1",asn.getRelatedBill1());
|
||||||
|
data.put("relatedBill2",asn.getRelatedBill2());
|
||||||
|
data.put("billType",asn.getBillType());
|
||||||
|
data.put("sku",sku);
|
||||||
|
data.put("RFID",rfid);
|
||||||
|
List<AsnDetail> asnDetailList = asnDetailRepository.findByAsnAndItem(asn.getRelatedBill1(),sku);
|
||||||
|
if (asnDetailList.size()<1){
|
||||||
|
return ApiResult.fail(500,"未查询到入库信息",data);
|
||||||
|
}
|
||||||
|
double orderQty=0;
|
||||||
|
for (int i = 0; i < asnDetailList.size(); i++) {
|
||||||
|
orderQty=orderQty+(asnDetailList.get(i).getOrderQty()-asnDetailList.get(i).getReceivedQty());
|
||||||
|
}
|
||||||
|
data.put("orderQty",orderQty);
|
||||||
|
data.put("lineNos",asnDetailList.size());
|
||||||
|
data.put("receivedQty",Integer.parseInt(propC5, 16));
|
||||||
|
String areaCode="";
|
||||||
|
if (billTypeCode.equals(BizStatus.FC_RK)){
|
||||||
|
// 成品条码解析
|
||||||
if (rfids.length==13){
|
if (rfids.length==13){
|
||||||
data.put("relatedBill1",asn.getRelatedBill1());
|
areaCode=BizStatus.CP;
|
||||||
data.put("relatedBill2",asn.getRelatedBill2());
|
|
||||||
data.put("billType",asn.getBillType());
|
|
||||||
data.put("sku",sku);
|
|
||||||
List<AsnDetail> asnDetailList = asnDetailRepository.findByAsnAndItem(asn.getRelatedBill1(),sku);
|
|
||||||
double orderQty=0;
|
|
||||||
for (int i = 0; i < asnDetailList.size(); i++) {
|
|
||||||
orderQty=orderQty+(asnDetailList.get(i).getOrderQty()-asnDetailList.get(i).getReceivedQty());
|
|
||||||
}
|
|
||||||
data.put("lineNos",asnDetailList.size());
|
|
||||||
data.put("RFID",rfid);
|
|
||||||
data.put("orderQty",orderQty);
|
|
||||||
data.put("billCode",BizStatus.CP);
|
|
||||||
data.put("receivedQty",Integer.parseInt(propC5, 16));
|
|
||||||
}else {
|
}else {
|
||||||
return ApiResult.fail(400,"rfid长度不为13","");
|
return ApiResult.fail(400,"rfid长度不为13","");
|
||||||
}
|
}
|
||||||
|
}else if (billTypeCode.equals(BizStatus.RM_RK)){
|
||||||
|
areaCode=BizStatus.LX;
|
||||||
|
}else if (billTypeCode.equals(BizStatus.SM_RK)){
|
||||||
|
// 半成品入库
|
||||||
|
areaCode=BizStatus.BCP;
|
||||||
}
|
}
|
||||||
|
data.put("billCode",areaCode);
|
||||||
|
// 查询推荐库位
|
||||||
|
List<Point> pointEndList = pointRepository.getTjPointList(areaCode, pointType);
|
||||||
|
String pointCode="";
|
||||||
|
if (pointEndList.size()>0){
|
||||||
|
pointCode=pointEndList.get(0).getCode();
|
||||||
|
}
|
||||||
|
data.put("pointCode",pointCode);
|
||||||
}else {
|
}else {
|
||||||
return ApiResult.fail(400,"未查询到系统单号","");
|
return ApiResult.fail(400,"未查询到系统单号","");
|
||||||
}
|
}
|
||||||
|
|
@ -568,44 +632,65 @@ public class TaskServiceImpl implements TaskService {
|
||||||
if (item==null){
|
if (item==null){
|
||||||
return ApiResult.fail(400,"没有找到物料",null);
|
return ApiResult.fail(400,"没有找到物料",null);
|
||||||
}
|
}
|
||||||
|
StringBuffer propC6 = new StringBuffer();//流水号
|
||||||
if (item.getGoodType().equals(BizStatus.CP)){
|
if (item.getGoodType().equals(BizStatus.CP)){
|
||||||
String propC7=rfids[7].substring(0, rfids[7].length()-1);//起始成品码
|
String propC7=rfids[7].substring(0, rfids[7].length()-1);//起始成品码
|
||||||
String propC8=rfids[8].substring(0, rfids[8].length()-1);//终止成品码
|
String propC8=rfids[8].substring(0, rfids[8].length()-1);//终止成品码
|
||||||
// 成品解析
|
propC6.append(propC7+"-"+propC8);
|
||||||
ItemKey itemKey=itemKeyRepository.getByItemKey(item.getId(),propC1,propC2,propC3,propC4,propC5,propC7+"-"+propC8);
|
}else {
|
||||||
if (itemKey==null){
|
for (int i = 6; i < rfids.length; i++) {
|
||||||
return ApiResult.fail(400,"没有找到RFID码对应的库存",null);
|
int decimalNumber = Integer.parseInt(rfids[i], 16);
|
||||||
}
|
int decimalMin = Integer.parseInt("0001", 16);
|
||||||
Inventory inventory=inventoryRepository.findByItemKey(itemKey.getId());
|
int decimalMax = Integer.parseInt("EA60", 16);
|
||||||
if (inventory==null){
|
if (decimalNumber >= decimalMin && decimalNumber <= decimalMax) {
|
||||||
return ApiResult.fail(500,"库存异常",null);
|
if (propC6.length() < 1) {
|
||||||
|
propC6.append(rfids[i]);
|
||||||
|
} else {
|
||||||
|
propC6.append(",");
|
||||||
|
propC6.append(rfids[i]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.out.println("无效RFID:" + rfids[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// 成品解析
|
||||||
|
ItemKey itemKey=itemKeyRepository.getByItemKey(item.getId(),propC1,propC2,propC3,propC4,propC5,propC6.toString());
|
||||||
|
if (itemKey==null){
|
||||||
|
return ApiResult.fail(400,"没有找到RFID码对应的库存",null);
|
||||||
|
}
|
||||||
|
Inventory inventory=inventoryRepository.findByItemKey(itemKey.getId());
|
||||||
|
if (inventory==null){
|
||||||
|
return ApiResult.fail(500,"库存异常",null);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inventory.getQueuedQty()<=0){
|
||||||
|
// 未分配
|
||||||
|
data.put("sku",sku);
|
||||||
|
data.put("RFID",rfid);
|
||||||
|
data.put("invId",inventory.getId());
|
||||||
|
return ApiResult.fail(201,"库存未进行分配,请选择需要出库出库单",data);
|
||||||
|
}else {
|
||||||
|
// 已分配
|
||||||
|
data.put("sku",sku);
|
||||||
|
data.put("RFID",rfid);
|
||||||
|
data.put("invId",inventory.getId());
|
||||||
|
data.put("receivedQty",inventory.getQueuedQty());
|
||||||
|
/** 查询关联Task任务*/
|
||||||
|
List<Task> taskList=taskRepository.findByItemKey(itemKey.getId(), BizStatus.ALLOCATE);
|
||||||
|
Task task=taskList.get(0);
|
||||||
|
PickDetail pickDetail=task.getPickDetail();
|
||||||
|
Pick pick=pickDetail.getPick();
|
||||||
|
// 已占用库存 推荐库存
|
||||||
|
data.put("relatedBill1",pick.getRelatedBill1());
|
||||||
|
data.put("relatedBill2",pick.getRelatedBill2());
|
||||||
|
data.put("billType",pick.getBillType());
|
||||||
|
data.put("pdId",pickDetail.getId());
|
||||||
|
data.put("taskId",task.getId());
|
||||||
|
data.put("orderQty",pickDetail.getAllocatedQty()-pickDetail.getPickedQty());
|
||||||
|
}
|
||||||
|
if (item.getGoodType().equals(BizStatus.CP)){
|
||||||
|
|
||||||
if (inventory.getQueuedQty()<=0){
|
|
||||||
// 未分配
|
|
||||||
data.put("sku",sku);
|
|
||||||
data.put("RFID",rfid);
|
|
||||||
data.put("invId",inventory.getId());
|
|
||||||
return ApiResult.fail(201,"库存未进行分配,请选择需要出库出库单",data);
|
|
||||||
}else {
|
|
||||||
// 已分配
|
|
||||||
data.put("sku",sku);
|
|
||||||
data.put("RFID",rfid);
|
|
||||||
data.put("invId",inventory.getId());
|
|
||||||
data.put("receivedQty",inventory.getQueuedQty());
|
|
||||||
/** 查询关联Task任务*/
|
|
||||||
List<Task> taskList=taskRepository.findByItemKey(itemKey.getId(), BizStatus.ALLOCATE);
|
|
||||||
Task task=taskList.get(0);
|
|
||||||
PickDetail pickDetail=task.getPickDetail();
|
|
||||||
Pick pick=pickDetail.getPick();
|
|
||||||
// 已占用库存 推荐库存
|
|
||||||
data.put("relatedBill1",pick.getRelatedBill1());
|
|
||||||
data.put("relatedBill2",pick.getRelatedBill2());
|
|
||||||
data.put("billType",pick.getBillType());
|
|
||||||
data.put("pdId",pickDetail.getId());
|
|
||||||
data.put("taskId",task.getId());
|
|
||||||
data.put("orderQty",pickDetail.getAllocatedQty()-pickDetail.getPickedQty());
|
|
||||||
}
|
|
||||||
}else if (item.getGoodType().equals(BizStatus.BCP)){
|
}else if (item.getGoodType().equals(BizStatus.BCP)){
|
||||||
|
|
||||||
}else if (item.getGoodType().equals(BizStatus.LX)){
|
}else if (item.getGoodType().equals(BizStatus.LX)){
|
||||||
|
|
@ -617,4 +702,56 @@ public class TaskServiceImpl implements TaskService {
|
||||||
return ApiResult.fail(200, "操作成功", data);
|
return ApiResult.fail(200, "操作成功", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApiResult butSTputaway(Long taskId, Long pointId) {
|
||||||
|
Task task=taskRepository.getById(taskId);
|
||||||
|
/** 料箱上架,添加库存*/
|
||||||
|
Inventory inventory = addAsnInventory(BizStatus.RM_RK, task.getDstPoint(), task.getAgvTask().getId(),1l,task.getItemKey().getId());
|
||||||
|
/** 库存移位*/
|
||||||
|
if (!task.getDstPoint().getId().equals(pointId)){
|
||||||
|
// 目标位
|
||||||
|
Point pointEnd=pointRepository.getById(pointId);
|
||||||
|
// 起点位
|
||||||
|
Point pointStart=inventory.getPoint();
|
||||||
|
// 移位
|
||||||
|
//写入终点
|
||||||
|
if (pointEnd.getArea().getId()==39&&pointEnd.getType().equals(BaseStatus.STORAGE)){
|
||||||
|
pointEnd.setStorageType(BizStatus.LX_STO);
|
||||||
|
}else {
|
||||||
|
pointEnd.setStorageType(pointStart.getStorageType());
|
||||||
|
}
|
||||||
|
pointRepository.save(pointEnd);
|
||||||
|
//释放起点
|
||||||
|
pointStart.setStorageType(null);
|
||||||
|
pointRepository.save(pointStart);
|
||||||
|
//更新库存位置
|
||||||
|
inventory.setPoint(pointEnd);
|
||||||
|
inventoryRepository.save(inventory);
|
||||||
|
/** 添加库存日志-移位*/
|
||||||
|
inventoryLogService.storeInventoryLog(BizStatus.MOVE,BizStatus.ADD,inventory.getItemKey().getPropC3(),inventory.getItemKey(),pointStart,inventory.getPoint(),null,null,0d,inventory.getQuantity(), inventory.getItemKey().getPropC6(),null,inventory.getId(),"");
|
||||||
|
}
|
||||||
|
return ApiResult.fail(200,"上架成功",null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApiResult rmCkPickUp(JSONArray taskIds) {
|
||||||
|
AgvTask agvTask = null;
|
||||||
|
for (int i = 0; i < taskIds.size(); i++) {
|
||||||
|
Task task=taskRepository.getById(taskIds.getLong(i));
|
||||||
|
if (i==0){
|
||||||
|
String storageType=null;
|
||||||
|
String startPointCode=null;
|
||||||
|
if (task.getSrcPoint().getArea().getId()==39&&task.getSrcPoint().getType().equals(BaseStatus.STORAGE)){
|
||||||
|
storageType=BizStatus.LXZ_STO;
|
||||||
|
startPointCode=task.getDstPoint().getBeatCode();
|
||||||
|
}
|
||||||
|
// 第一个任务 先生成AgvTask任务
|
||||||
|
agvTask = agvTaskService.addAgvTask(BizStatus.AGV, storageType, startPointCode, task.getDstPoint().getCode(), BizStatus.OPEN, BizStatus.PICK);
|
||||||
|
}
|
||||||
|
task.setAgvTask(agvTask);
|
||||||
|
taskRepository.save(task);
|
||||||
|
}
|
||||||
|
return ApiResult.fail(200,"生成搬运任务:"+agvTask.getId(),null);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
package com.youchain.modules.quartz.rest;
|
package com.youchain.modules.quartz.rest;
|
||||||
|
|
||||||
|
|
||||||
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.annotation.Log;
|
import com.youchain.annotation.Log;
|
||||||
import com.youchain.exception.BadRequestException;
|
import com.youchain.exception.BadRequestException;
|
||||||
import com.youchain.modules.quartz.domain.QuartzJob;
|
import com.youchain.modules.quartz.domain.QuartzJob;
|
||||||
|
|
@ -74,7 +75,7 @@ public class QuartzJobController {
|
||||||
|
|
||||||
@ApiOperation("查询任务执行日志")
|
@ApiOperation("查询任务执行日志")
|
||||||
@GetMapping(value = "/logs")
|
@GetMapping(value = "/logs")
|
||||||
@PreAuthorize("@el.check('timing:list')")
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> queryQuartzJobLog(JobQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryQuartzJobLog(JobQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(quartzJobService.queryAllLog(criteria,pageable), HttpStatus.OK);
|
return new ResponseEntity<>(quartzJobService.queryAllLog(criteria,pageable), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,9 @@ import com.youchain.businessdata.repository.AsnRepository;
|
||||||
import com.youchain.businessdata.service.AgvTaskService;
|
import com.youchain.businessdata.service.AgvTaskService;
|
||||||
import com.youchain.businessdata.service.AsnService;
|
import com.youchain.businessdata.service.AsnService;
|
||||||
import com.youchain.exception.handler.ApiResult;
|
import com.youchain.exception.handler.ApiResult;
|
||||||
|
import com.youchain.utils.BaseStatus;
|
||||||
import com.youchain.utils.BizStatus;
|
import com.youchain.utils.BizStatus;
|
||||||
|
import lombok.Synchronized;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.checkerframework.checker.units.qual.A;
|
import org.checkerframework.checker.units.qual.A;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -93,15 +95,28 @@ public class TestTask {
|
||||||
@PostMapping("/asnTask")
|
@PostMapping("/asnTask")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> asnTask(){
|
public ResponseEntity<Object> asnTask(){
|
||||||
/*List<Point> pointList = pointRepository.findByAreaCode("RKGZ");
|
System.out.println("查询Task任务生成AgvTask入库任务");
|
||||||
for (int i = 0; i < pointList.size(); i++) {
|
ApiResult apiResult = agvTaskService.addAgvAsn(BizStatus.LX,BizStatus.RM_RK);
|
||||||
Point point =pointList.get(i);
|
|
||||||
if (point.getStorageType()!=null&&point.getStorageType().length()>0){
|
|
||||||
System.out.println("生成入库搬运任务");
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
System.out.println("入库任务");
|
|
||||||
ApiResult apiResult = agvTaskService.addAgvAsn();
|
|
||||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
}
|
}
|
||||||
|
// @PostMapping("/asnPutaway")
|
||||||
|
// @AnonymousAccess
|
||||||
|
@Transactional
|
||||||
|
public void asnPutaway(String req){
|
||||||
|
synchronized (BaseStatus.Lock.rfid_SJ) {
|
||||||
|
JSONObject requestJson = JSONObject.parseObject(req);
|
||||||
|
JSONArray jsonArray = requestJson.getJSONArray("billType");
|
||||||
|
/** RFID入库-上架*/
|
||||||
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
|
String billCode = jsonArray.getString(i);
|
||||||
|
String areaCode = "";
|
||||||
|
if (billCode.equals(BizStatus.RM_RK)) {
|
||||||
|
areaCode = BizStatus.LX;
|
||||||
|
} else if (billCode.equals(BizStatus.SM_RK)) {
|
||||||
|
areaCode = BizStatus.BCP;
|
||||||
|
}
|
||||||
|
agvTaskService.addAgvAsn(areaCode, billCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.modules.system.rest;
|
package com.youchain.modules.system.rest;
|
||||||
|
|
||||||
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
@ -55,7 +56,7 @@ public class DictController {
|
||||||
|
|
||||||
@ApiOperation("查询字典")
|
@ApiOperation("查询字典")
|
||||||
@GetMapping(value = "/all")
|
@GetMapping(value = "/all")
|
||||||
@PreAuthorize("@el.check('dict:list')")
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> queryAllDict(){
|
public ResponseEntity<Object> queryAllDict(){
|
||||||
return new ResponseEntity<>(dictService.queryAll(new DictQueryCriteria()),HttpStatus.OK);
|
return new ResponseEntity<>(dictService.queryAll(new DictQueryCriteria()),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ public interface BaseStatus {
|
||||||
public static Boolean F =false;
|
public static Boolean F =false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 点位类型-按钮盒点位
|
* 点位类型-线边点位
|
||||||
*/
|
*/
|
||||||
public static String BOX = "BOX";
|
public static String BOX = "BOX";
|
||||||
|
|
||||||
|
|
@ -41,4 +41,9 @@ public interface BaseStatus {
|
||||||
*/
|
*/
|
||||||
public static String EMPTY = "EMPTY";
|
public static String EMPTY = "EMPTY";
|
||||||
|
|
||||||
|
/** 锁*/
|
||||||
|
class Lock{
|
||||||
|
/** RFID-上架*/
|
||||||
|
public static String rfid_SJ="sj";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,12 @@ public interface BizStatus {
|
||||||
* 出库任务
|
* 出库任务
|
||||||
*/
|
*/
|
||||||
public static String PICK = "PICK";
|
public static String PICK = "PICK";
|
||||||
|
/** 料箱出库*/
|
||||||
|
public static String RM_CK = "RM_CK";
|
||||||
|
/** 成品出库*/
|
||||||
|
public static String FC_CK = "FC_CK";
|
||||||
|
/** 半成品出库*/
|
||||||
|
public static String SM_CK = "SM_CK";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 盘点任务
|
* 盘点任务
|
||||||
|
|
@ -214,21 +220,57 @@ public interface BizStatus {
|
||||||
String AGV_R="AGV_R";
|
String AGV_R="AGV_R";
|
||||||
/** AGV_容器出场*/
|
/** AGV_容器出场*/
|
||||||
String AGV_C="AGV_C";
|
String AGV_C="AGV_C";
|
||||||
/** 半成品*/
|
/** 库区*/
|
||||||
|
/*料箱货架区*/
|
||||||
|
String LX="LX";
|
||||||
|
/*半成品 存储区*/
|
||||||
String BCP="BCP";
|
String BCP="BCP";
|
||||||
/** 成品*/
|
/*成品 存储区*/
|
||||||
String CP="CP";
|
String CP="CP";
|
||||||
/** 成品入库*/
|
/** 成品入库*/
|
||||||
String FC_RK="FC_RK";
|
String FC_RK="FC_RK";
|
||||||
/** 料箱*/
|
/** 半成品入库*/
|
||||||
String LX="LX";
|
String SM_RK="SM_RK";
|
||||||
|
/** 料箱入库*/
|
||||||
|
String RM_RK="RM_RK";
|
||||||
|
/*料箱存储区 容器类型stockType-料箱*/
|
||||||
|
String LX_STO="LX-STO";
|
||||||
|
String LXMode="";
|
||||||
|
/* 容器类型stockType-料箱载具*/
|
||||||
|
String LXZ_STO="LXZ-STO";
|
||||||
|
String LXZMode="K-MRES潜伏车模型";
|
||||||
|
/** 容器类型stockType-叉车托盘*/
|
||||||
|
String CTP_STO="CTP-STO";
|
||||||
|
String CTPMode="K-MRES叉车模型";
|
||||||
|
/*容器类型stockType-半成品托盘*/
|
||||||
|
String TP_STO="TP-STO";
|
||||||
|
String TPMode="K-MRES潜伏车模型";
|
||||||
String BCP_PT="BCP_PT";
|
String BCP_PT="BCP_PT";
|
||||||
/** AGV出库*/
|
/** AGV出库*/
|
||||||
String AGV_PT=" AGV_PT";
|
String AGV_PT="AGV_PT";
|
||||||
/** 人工出库*/
|
/** 人工出库*/
|
||||||
String RG_PT="RG_PT";
|
String RG_PT="RG_PT";
|
||||||
/** AGV入库*/
|
/** AGV入库*/
|
||||||
String AGV_ASN="AGV_ASN";
|
String AGV_ASN="AGV_ASN";
|
||||||
/** 人工入库*/
|
/** 人工入库*/
|
||||||
String RG_ASN="RG_ASN";
|
String RG_ASN="RG_ASN";
|
||||||
|
|
||||||
|
static String getBillToStock(String billTypeCode) {
|
||||||
|
if (billTypeCode.equals(BizStatus.FC_RK)){
|
||||||
|
return BizStatus.CP;
|
||||||
|
} else if (billTypeCode.equals(BizStatus.SM_RK)) {
|
||||||
|
return BizStatus.BCP;
|
||||||
|
} else if (billTypeCode.equals(BizStatus.RM_RK)) {
|
||||||
|
return BizStatus.LX;
|
||||||
|
}else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean Continued(String status) {
|
||||||
|
if (status.equals(BizStatus.OPEN)||status.equals(BizStatus.OPEN)||status.equals(BizStatus.OPEN)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue