no message
parent
4a77f075a0
commit
6b8a6fe2e7
|
|
@ -2,6 +2,7 @@ package com.youchain.utils;
|
|||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.youchain.exception.BadRequestException;
|
||||
import org.apache.commons.compress.utils.IOUtils;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
|
@ -12,69 +13,13 @@ import java.net.URL;
|
|||
import java.net.URLConnection;
|
||||
|
||||
public class HttpPostUtil {
|
||||
public static String sendPostReq(String url, String param) {
|
||||
PrintWriter out = null;
|
||||
BufferedReader in = null;
|
||||
String result = "";
|
||||
try {
|
||||
URL realUrl = new URL(url);
|
||||
// 打开和URL之间的连接
|
||||
HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
|
||||
// 设置通用的请求属性
|
||||
// conn.setRequestProperty("accept", "*/*");
|
||||
// conn.setRequestProperty("connection", "Keep-Alive");
|
||||
// conn.setRequestProperty("user-agent",
|
||||
// "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
|
||||
conn.setRequestMethod("POST");//默认get
|
||||
|
||||
// 发送POST请求必须设置如下两行
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
//post请求不能使用缓存
|
||||
conn.setUseCaches(false);
|
||||
|
||||
// 获取URLConnection对象对应的输出流
|
||||
out = new PrintWriter(conn.getOutputStream());
|
||||
// 发送请求参数
|
||||
out.print(param);
|
||||
// flush输出流的缓冲
|
||||
out.flush();
|
||||
// 定义BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader(
|
||||
new InputStreamReader(conn.getInputStream()));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("code","400");
|
||||
jsonObject.put("message","接口调用异常");
|
||||
result=jsonObject.toString();
|
||||
}
|
||||
//使用finally块来关闭输出流、输入流
|
||||
finally {
|
||||
try {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/*public static String sendPostReq(String api_url, String request){
|
||||
public static String sendPostReq(String api_url, String request) {
|
||||
System.out.println("接口任务下发:"+api_url+":"+request);
|
||||
InputStream instr = null;
|
||||
String str = "";
|
||||
try {
|
||||
URL url = new URL(api_url);
|
||||
URLConnection urlCon = url.openConnection();
|
||||
HttpURLConnection urlCon = (HttpURLConnection) url.openConnection();
|
||||
urlCon.setConnectTimeout(3000);
|
||||
byte[] xmlData = request.getBytes();
|
||||
urlCon.setDoOutput(true);
|
||||
|
|
@ -87,7 +32,14 @@ public class HttpPostUtil {
|
|||
printout.write(xmlData);
|
||||
printout.flush();
|
||||
printout.close();
|
||||
if (urlCon.getResponseCode() != HttpURLConnection.HTTP_OK
|
||||
&&urlCon.getResponseCode() != HttpURLConnection.HTTP_CREATED
|
||||
&&urlCon.getResponseCode() != HttpURLConnection.HTTP_ACCEPTED ) {
|
||||
instr = urlCon.getErrorStream();
|
||||
}
|
||||
else{
|
||||
instr = urlCon.getInputStream();
|
||||
}
|
||||
byte[] bis = IOUtils.toByteArray(instr);
|
||||
String ResponseString = new String(bis, "UTF-8");
|
||||
if ((ResponseString == null) || ("".equals(ResponseString.trim()))) {
|
||||
|
|
@ -95,9 +47,15 @@ public class HttpPostUtil {
|
|||
}
|
||||
str = ResponseString;
|
||||
}catch (Exception e){
|
||||
/*JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("code","0");
|
||||
jsonObject.put("message","");
|
||||
jsonObject.put("data","");
|
||||
jsonObject.put("success","true");
|
||||
str=jsonObject.toString();*/
|
||||
throw new BadRequestException(HttpStatus.NOT_IMPLEMENTED, "接口调用异常"+api_url+request);
|
||||
}
|
||||
System.out.println("接口任务返回:"+str);
|
||||
return str;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,89 @@
|
|||
package com.youchain.utils;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
public class HttpPutUtil {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("HttpPutUtil.main");
|
||||
String url="http://192.168.0.201:8092/synq/orders/pick-confirmation";
|
||||
JSONObject paramsJson=new JSONObject();
|
||||
JSONArray orderLine=new JSONArray();
|
||||
JSONObject order = new JSONObject();
|
||||
order.put("orderLineNumber", "1");
|
||||
order.put("quantity", "10");
|
||||
order.put("productId", "704237988");
|
||||
JSONArray attributeValue=new JSONArray();
|
||||
JSONObject ztBidName=new JSONObject();
|
||||
ztBidName.put("name", "ztBidName");
|
||||
ztBidName.put("value", "2202山东单相表");
|
||||
attributeValue.add(ztBidName);
|
||||
JSONObject prodMtrlNo=new JSONObject();
|
||||
prodMtrlNo.put("name", "prodMtrlNo");
|
||||
prodMtrlNo.put("value", "704520757");
|
||||
attributeValue.add(prodMtrlNo);
|
||||
|
||||
order.put("attributeValue",attributeValue);
|
||||
orderLine.add(order);
|
||||
paramsJson.put("orderLine",orderLine);
|
||||
String res = HttpPutUtil.sendPutReq(url+"/NARI/S202405071551WLDD1",paramsJson.toString());
|
||||
System.out.println("返回:"+res);
|
||||
}
|
||||
public static String sendPutReq(String httpUrl, String params) {
|
||||
System.out.println("url:"+httpUrl);
|
||||
System.out.println("params:"+params);
|
||||
String result = "";
|
||||
URL url = null;
|
||||
try {
|
||||
url = new URL(httpUrl);
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (url != null) {
|
||||
try {
|
||||
/*HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
|
||||
urlConn.setRequestProperty("content-type", "application/json");
|
||||
urlConn.setDoInput(true);
|
||||
urlConn.setDoOutput(true);
|
||||
urlConn.setConnectTimeout(5 * 1000);
|
||||
//设置请求方式为 PUT
|
||||
urlConn.setRequestMethod("PUT");
|
||||
|
||||
urlConn.setRequestProperty("Content-Type", "application/json");
|
||||
urlConn.setRequestProperty("Accept", "application/json");
|
||||
|
||||
urlConn.setRequestProperty("Charset", "UTF-8");
|
||||
|
||||
|
||||
DataOutputStream dos = new DataOutputStream(urlConn.getOutputStream());
|
||||
//写入请求参数
|
||||
//这里要注意的是,在构造JSON字符串的时候,实践证明,最好不要使用单引号,而是用“\”进行转义,否则会报错
|
||||
// 关于这一点在上面给出的参考文章里面有说明
|
||||
// String jsonParam = params;
|
||||
dos.write(params.getBytes());
|
||||
dos.flush();
|
||||
dos.close();
|
||||
|
||||
if (urlConn.getResponseCode() == 200) {
|
||||
InputStreamReader isr = new InputStreamReader(urlConn.getInputStream());
|
||||
BufferedReader br = new BufferedReader(isr);
|
||||
String inputLine = null;
|
||||
while ((inputLine = br.readLine()) != null) {
|
||||
result += inputLine;
|
||||
}
|
||||
isr.close();
|
||||
urlConn.disconnect();
|
||||
}*/
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -21,14 +21,13 @@ 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.dto.InventoryDto;
|
||||
import com.youchain.businessdata.service.mapstruct.InventoryMapper;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.modules.system.service.DictService;
|
||||
import com.youchain.modules.system.service.dto.DictDto;
|
||||
import com.youchain.modules.system.service.dto.DictQueryCriteria;
|
||||
import com.youchain.utils.AreaNameDic;
|
||||
import com.youchain.utils.BaseStatus;
|
||||
import com.youchain.utils.BizStatus;
|
||||
import com.youchain.utils.UserUtils;
|
||||
import com.youchain.utils.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -63,12 +62,14 @@ public class SceneAppController {
|
|||
private final PointService pointService;
|
||||
private final TaskRepository taskRepository;
|
||||
private final BillTypeRepository billTypeRepository;
|
||||
private final InventoryLogService inventoryLogService;
|
||||
private final PointRepository pointRepository;
|
||||
private final StockService stockService;
|
||||
private final StockTypeRepository stockTypeRepository;
|
||||
private final BoxRepository boxRepository;
|
||||
|
||||
private final DictService dictService;
|
||||
private final InventoryMapper inventoryMapper;
|
||||
private final AsnDetailService asnDetailService;
|
||||
private final PickDetailService pickDetailService;
|
||||
private final ItemKeyService itemKeyService;
|
||||
|
|
@ -86,17 +87,17 @@ public class SceneAppController {
|
|||
@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);
|
||||
ApiResult apiResult=ApiResult.success(OK.value(), "操作成功", "");
|
||||
if (type.equals("asn")) {
|
||||
agvTaskService.pointStockRk(storageType, point.getId());
|
||||
apiResult = agvTaskService.pointStockRk(storageType, point.getId());
|
||||
}else if (type.equals("pick")){
|
||||
agvTaskService.pointStockCk(storageType, point.getId());
|
||||
apiResult = agvTaskService.pointStockCk(storageType, point.getId());
|
||||
}
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "操作成功", ""), HttpStatus.OK);
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
@PostMapping("/asn/rkReadRFID")
|
||||
@Log("app接口》成品/料箱 人工入库-读取RFID")
|
||||
|
|
@ -124,11 +125,9 @@ public class SceneAppController {
|
|||
JSONObject jsonObject=JSONObject.parseObject(data);
|
||||
Long taskId=jsonObject.getLong("id");
|
||||
Box box=boxRepository.getById(taskId);
|
||||
String stockType = BizStatus.getBillToStock(box.getLampStatus());
|
||||
// 根据点位 获取容器类型
|
||||
String stockType = BizStatus.getBillToAgv(box.getLampStatus());
|
||||
ApiResult apiResult;
|
||||
if (stockType.equals(BizStatus.LX)){
|
||||
stockType=BizStatus.LXZ_STO;
|
||||
}
|
||||
apiResult = agvTaskService.pointStockRk(stockType,box.getPoint().getId());
|
||||
Point pointEndCode=pointRepository.findByTypeAndArea(BaseStatus.PLATFORM,"TAGM");
|
||||
if (apiResult.getStatus()==200){
|
||||
|
|
@ -149,7 +148,7 @@ public class SceneAppController {
|
|||
if (point.getType().equals(BaseStatus.BOX)){
|
||||
if (apiResult.getStatus()==200){
|
||||
// AGV入库 生成搬运任务(目标库区,单据任务类型)
|
||||
apiResult = agvTaskService.addAgvAsn(point.getArea().getCode(),apiResult.getData().toString());
|
||||
apiResult = agvTaskService.addAgvAsn(apiResult.getData().toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -190,7 +189,7 @@ public class SceneAppController {
|
|||
if (billType!=null){
|
||||
jsonObject.put("stockTypeName", billType.getName());
|
||||
}
|
||||
jsonObject.put("pointName", box.getPoint().getName());
|
||||
jsonObject.put("pointName", box.getPoint().getCode());
|
||||
jsonObject.put("boxCode", box.getCode());
|
||||
if (box.getPoint().getStorageType()==null||box.getPoint().getStorageType().length()<1){
|
||||
jsonObject.put("status", "");
|
||||
|
|
@ -420,6 +419,11 @@ public class SceneAppController {
|
|||
JSONArray invIds=request.getJSONArray("invIds");//invIds
|
||||
String rfid1=request.getString("rfid1");//
|
||||
String rfid2=request.getString("rfid2");//
|
||||
if (rfid1.equals(rfid2)){
|
||||
ApiResult apiResult=ApiResult.fail(500,"拆托后两个RFID信息重复",null);
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
|
||||
Point point = null;
|
||||
for (int i = 0; i < invIds.size(); i++) {
|
||||
long invId=invIds.getLong(i);
|
||||
|
|
@ -427,19 +431,36 @@ public class SceneAppController {
|
|||
if (point==null){
|
||||
point=startInventory.getPoint();
|
||||
}
|
||||
InventoryDto inventoryDto= inventoryMapper.toDto(startInventory);
|
||||
inventoryRepository.delete(startInventory);
|
||||
// 添加删除 日志
|
||||
inventoryLogService.storeInventoryLog(BizStatus.MODIFY_LOT,BizStatus.REDUCE,inventoryDto.getItemKey().getPropC3(),inventoryDto.getItemKey(),point,null,null,null,inventoryDto.getQuantity(),inventoryDto.getQuantity(), inventoryDto.getItemKey().getPropC6(),null,inventoryDto.getId(),inventoryDto.getDescription());
|
||||
// 库存调整反馈
|
||||
UrlApi.invBackSap(inventoryDto.getOwner(), inventoryDto.getItemKey().getItem().getCode(),0+""
|
||||
, inventoryDto.getQuantity()+"",inventoryDto.getZtBid(),inventoryDto.getProdMtrl(),inventoryDto.getDescription());
|
||||
}
|
||||
// 解析RFID信息
|
||||
if (rfid1!=null&&!rfid1.equals("null")) {
|
||||
Inventory inventory1 = getApiResult(rfid1);
|
||||
inventory1.setPoint(point);
|
||||
inventoryRepository.save(inventory1);
|
||||
// 库存调整反馈
|
||||
UrlApi.invBackSap(inventory1.getOwner(), inventory1.getItemKey().getItem().getCode(),inventory1.getQuantity()+""
|
||||
, 0+"",inventory1.getZtBid(),inventory1.getProdMtrl(),inventory1.getDescription());
|
||||
}
|
||||
if (rfid2!=null&&!rfid2.equals("null")) {
|
||||
Inventory inventory2 = getApiResult(rfid2);
|
||||
// 库存调整反馈
|
||||
UrlApi.invBackSap(inventory2.getOwner(), inventory2.getItemKey().getItem().getCode(),inventory2.getQuantity()+""
|
||||
, 0+"",inventory2.getZtBid(),inventory2.getProdMtrl(),inventory2.getDescription());
|
||||
}
|
||||
ApiResult apiResult=ApiResult.fail(200,"操作成功",null);
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
private Inventory getApiResult(String rfid1) {
|
||||
String itemCode=rfid1.substring(0, 9);
|
||||
Item item=itemRepository.findByCode(itemCode);
|
||||
|
||||
String propC1=rfid1.substring(9, 11);
|
||||
String propC2=rfid1.substring(11, 13);
|
||||
String propC3=rfid1.substring(13, 19);// 系统单号
|
||||
|
|
@ -496,7 +517,7 @@ public class SceneAppController {
|
|||
|
||||
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);
|
||||
Inventory inventoryRfid1 = inventoryService.getInventory(Double.valueOf(qty), itemKeyRfid1.getId(), null,BizStatus.MODIFY_LOT);
|
||||
return inventoryRfid1;
|
||||
}
|
||||
@PostMapping("/sto/getStockType")
|
||||
|
|
|
|||
|
|
@ -128,21 +128,6 @@ public class XyjAppController {
|
|||
return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), "未找到按钮盒信息!", ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/callBox")
|
||||
@Log("按钮盒呼叫")
|
||||
@ApiOperation("按钮盒呼叫")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> callBox(@RequestBody CallBox callBox) {
|
||||
BoxDto boxDto = boxService.findById(callBox.getId());//按钮盒
|
||||
try {
|
||||
boxService.callBox(boxDto);
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "呼叫成功!", ""), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/callTrolley")
|
||||
@Log("按钮车呼叫")
|
||||
@ApiOperation("按钮车呼叫")
|
||||
|
|
|
|||
|
|
@ -17,9 +17,11 @@ package com.youchain.basicdata.rest;
|
|||
|
||||
import com.youchain.annotation.Log;
|
||||
import com.youchain.basicdata.domain.Box;
|
||||
import com.youchain.basicdata.repository.BoxRepository;
|
||||
import com.youchain.basicdata.service.BoxService;
|
||||
import com.youchain.basicdata.service.dto.BoxQueryCriteria;
|
||||
import com.youchain.exception.handler.ApiError;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.utils.CodeUtils;
|
||||
import com.youchain.utils.UserUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -49,6 +51,7 @@ import static org.springframework.http.HttpStatus.OK;
|
|||
public class BoxController {
|
||||
|
||||
private final BoxService boxService;
|
||||
private final BoxRepository boxRepository;
|
||||
|
||||
private final CodeUtils codeUtils;
|
||||
|
||||
|
|
@ -76,8 +79,9 @@ public class BoxController {
|
|||
@PreAuthorize("@el.check('box:add')")
|
||||
public ResponseEntity<Object> createBox(@Validated @RequestBody Box resources) {
|
||||
resources.setDept(UserUtils.getDept());
|
||||
boxService.create(resources);
|
||||
return new ResponseEntity<>(boxService.create(resources), HttpStatus.CREATED);
|
||||
boxRepository.save(resources);
|
||||
ApiResult apiResult=ApiResult.fail(200,"操作成工", null);
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.youchain.annotation.AnonymousAccess;
|
|||
import com.youchain.annotation.Log;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.StockType;
|
||||
import com.youchain.basicdata.repository.ItemRepository;
|
||||
import com.youchain.basicdata.service.ItemService;
|
||||
import com.youchain.basicdata.service.StockTypeService;
|
||||
import com.youchain.basicdata.service.dto.ItemDto;
|
||||
|
|
@ -70,6 +71,7 @@ import javax.transaction.Transactional;
|
|||
public class ItemController {
|
||||
|
||||
private final ItemService itemService;
|
||||
private final ItemRepository itemRepository;
|
||||
private final FileProperties properties;
|
||||
private final StockTypeService stockTypeService;
|
||||
private final DictDetailService dictDetailService;
|
||||
|
|
@ -94,8 +96,8 @@ public class ItemController {
|
|||
@Log("查询所有的物料数据")
|
||||
@ApiOperation("查询所有的物料数据")
|
||||
@PreAuthorize("@el.check('item:list')")
|
||||
public ResponseEntity<List<ItemDto>> queryItemList(ItemQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(itemService.queryAll(criteria), HttpStatus.OK);
|
||||
public ResponseEntity<Object> queryItemList(){
|
||||
return new ResponseEntity<>(itemRepository.findAll(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ import com.youchain.basicdata.domain.LampLog;
|
|||
import com.youchain.basicdata.service.dto.LampLogDto;
|
||||
import com.youchain.basicdata.service.dto.LampLogQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
|
|
@ -73,6 +75,11 @@ public interface LampLogService {
|
|||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/***
|
||||
* 保存日志
|
||||
*/
|
||||
LampLog readRfidLog();
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ public class PointQueryCriteria {
|
|||
/** 状态 */
|
||||
@Query(type = Query.Type.EQUAL)
|
||||
private String status;
|
||||
@Query(type = Query.Type.EQUAL)
|
||||
private String agvStatus;
|
||||
|
||||
/** 类型 */
|
||||
@Query(type = Query.Type.EQUAL)
|
||||
|
|
@ -52,6 +54,8 @@ public class PointQueryCriteria {
|
|||
/** 状态:1启用、0禁用 */
|
||||
@Query(type = Query.Type.EQUAL)
|
||||
private Boolean enabled;
|
||||
@Query(type = Query.Type.EQUAL)
|
||||
private String storageType;
|
||||
|
||||
/** 冷却区-小库区编号 */
|
||||
@Query(type = Query.Type.EQUAL)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
package com.youchain.basicdata.service.impl;
|
||||
|
||||
import com.youchain.basicdata.domain.LampLog;
|
||||
import com.youchain.rfid.RfidDocJava;
|
||||
import com.youchain.utils.FileUtil;
|
||||
import com.youchain.utils.PageUtil;
|
||||
import com.youchain.utils.QueryHelp;
|
||||
|
|
@ -30,12 +31,10 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
|
|
@ -91,6 +90,20 @@ public class LampLogServiceImpl implements LampLogService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LampLog readRfidLog() {
|
||||
String rc="";
|
||||
HashSet vt = RfidDocJava.readRfid();
|
||||
rc = vt.toString();
|
||||
LampLog lampLog=new LampLog();
|
||||
lampLog.setIp(RfidDocJava.ip);
|
||||
lampLog.setOperationType("入库门");
|
||||
lampLog.setRequestContent(rc);
|
||||
lampLogRepository.save(lampLog);
|
||||
// LampLog lampLog = lampLogRepository.getById(41688l);
|
||||
return lampLog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<LampLogDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import javax.persistence.*;
|
|||
import javax.validation.constraints.*;
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
|
|
@ -85,7 +86,8 @@ public class Asn extends BaseEntity implements Serializable {
|
|||
@Column(name = "`address`")
|
||||
@ApiModelProperty(value = "地址")
|
||||
private String address;
|
||||
|
||||
/*@OneToMany(mappedBy = "asn")
|
||||
private List<AsnDetail> asnDetails;*/
|
||||
public void copy(Asn source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,15 @@ public class Inventory extends BaseEntity implements Serializable {
|
|||
@Column(name = "`bill_code`")
|
||||
@ApiModelProperty(value = "单据号")
|
||||
private String billCode;
|
||||
|
||||
@Column(name = "`owner`")
|
||||
@ApiModelProperty(value = "货主")
|
||||
private String owner;
|
||||
@Column(name = "`prod_mtrl_mo`")
|
||||
@ApiModelProperty(value = "成品物料编码")
|
||||
private String prodMtrl;
|
||||
@Column(name = "`zt_bid_value`")
|
||||
@ApiModelProperty(value = "中标批次")
|
||||
private String ztBid;
|
||||
@OneToOne
|
||||
@JoinColumn(name = "`item_key_id`")
|
||||
@ApiModelProperty(value = "物料属性")
|
||||
|
|
|
|||
|
|
@ -97,11 +97,6 @@ public class ItemKey extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "是否启用")
|
||||
private Boolean enabled=true;
|
||||
|
||||
public int getIntPropC5() {
|
||||
int decimalNumber = Integer.valueOf(propC5);
|
||||
return decimalNumber;
|
||||
}
|
||||
|
||||
public void copy(ItemKey source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,4 +84,7 @@ public interface AgvTaskRepository extends JpaRepository<AgvTask, Integer>, JpaS
|
|||
*/
|
||||
@Query(value = "select * from data_agv_task where line_slot_code=?1 and type='PICK' and `status`='OPEN' and line_slot_code is not null ORDER BY create_time ", nativeQuery = true)
|
||||
List<AgvTask> queryLineAgvTask(String line_slot_code);
|
||||
/** 定时发送任务*/
|
||||
@Query(value = "select * from data_agv_task where `status`='OPEN' ", nativeQuery = true)
|
||||
List<AgvTask> findByTiming();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public interface AsnDetailRepository extends JpaRepository<AsnDetail, Long>, Jpa
|
|||
+" where a.`status`=?1 and bt.`code`=?2 "
|
||||
+" group by i.id ",nativeQuery = true)
|
||||
List<Map<String,Object>> findByAsn(String asnStatus, String billTypeCode);
|
||||
/***/
|
||||
/** 查询RFID对应的收货明细*/
|
||||
@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);
|
||||
@Query("select d from AsnDetail d where d.asn.id=?1 and d.asn.status=?2")
|
||||
|
|
@ -48,4 +48,6 @@ public interface AsnDetailRepository extends JpaRepository<AsnDetail, Long>, Jpa
|
|||
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)
|
||||
List<AsnDetail> findByAsnId(Long asnId);
|
||||
@Query(value = "select d.* from data_asn_detail d where d.asn_id=?1",nativeQuery = true)
|
||||
List<AsnDetail> findByAsn(Long asnId);
|
||||
}
|
||||
|
|
@ -36,6 +36,8 @@ public interface InventoryRepository extends JpaRepository<Inventory, Long>, Jpa
|
|||
*/
|
||||
@Query(value = "SELECT * FROM data_inventory inv WHERE inv.item_key_id in (select id from data_item_key where item_id = ?1 ) and inv.quantity>0 and inv.queued_qty=0 order by inv.create_time ", nativeQuery = true)
|
||||
List<Inventory> queryInventory(long itemId);
|
||||
@Query(value = "SELECT i FROM Inventory i WHERE i.itemKey.item.id=?1 and i.point.id=?2 ", nativeQuery = false)
|
||||
List<Inventory> findByItemAndPoint(long itemId,long pointId);
|
||||
@Query(value = "SELECT i FROM Inventory i WHERE i.itemKey.id=?1", nativeQuery = false)
|
||||
Inventory findByItemKey(Long itemKeyId);
|
||||
@Query(value = "SELECT i FROM Inventory i WHERE i.itemKey.propC7=?1", nativeQuery = false)
|
||||
|
|
@ -46,4 +48,6 @@ public interface InventoryRepository extends JpaRepository<Inventory, Long>, Jpa
|
|||
|
||||
@Query(value = "SELECT i FROM Inventory i WHERE i.id=?1", nativeQuery = false)
|
||||
Inventory findByInvId(Long l);
|
||||
@Query(value = "SELECT i FROM Inventory i WHERE i.point.id=?1", nativeQuery = false)
|
||||
List<Inventory> findByPoint(Long id);
|
||||
}
|
||||
|
|
@ -41,15 +41,16 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
|||
* @param agvFlag 是否AGV任务
|
||||
* @return
|
||||
*/
|
||||
@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) " +
|
||||
@Query(value = " select sum(plan_qty)-sum(move_qty) qty,GROUP_CONCAT(id) taskIds,item_key_id ikID,max(dst_point_id) pointId from data_task where if((?1 !='' or ?1 is not null),agv_task_id=?1,1=1) " +
|
||||
"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);
|
||||
@Query(value = "SELECT t from Task t where t.agvTask.id=?1 and t.taskStatus=?2")
|
||||
List<Task> findByAgvTaskSj(Integer agvTaskId,String taskStatus);
|
||||
/** 生成库存的 Task 任务*/
|
||||
@Query(value = "SELECT t from Task t where t.agvTask.id=?1 and t.beSkip=1 and t.taskStatus in ('PUTAWAY')")
|
||||
List<Task> findByAgvTaskSj(Integer agvTaskId);
|
||||
/**
|
||||
* 根据出库单明细查询未完成的Task集合
|
||||
* @param id
|
||||
|
|
@ -115,7 +116,7 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
|||
|
||||
@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")
|
||||
@Query(value = "select t from Task t where t.taskStatus =?1 and t.beSkip=?2 and t.taskType=?3")
|
||||
List<Task> findByGroupItemKey(String taskStatus, int beSkip, String taskType);
|
||||
@Query(value = " select i.code 'sku',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 "
|
||||
|
|
@ -129,21 +130,22 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
|||
" 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 agv.`status` 'agvStatus',i.code 'sku',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 "
|
||||
@Query(value = " select agv.`status` 'agvStatus',i.code 'sku',t.agv_task_id 'agvId',t.id,p.`code` 'pointCode',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_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' "
|
||||
+" group by t.item_key_id ",nativeQuery = true)
|
||||
,nativeQuery = true)
|
||||
List<Map<String,Object>> findBySjTask();
|
||||
@Query(value = " select i.`code` '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 "
|
||||
/** 查询 料箱 待上架明细*/
|
||||
@Query(value = " select i.`code` 'sku',agv.`status` 'agvStatus',t.agv_task_id 'agvId',t.id,p.`code` 'pointCode',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_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)
|
||||
,nativeQuery = true)
|
||||
List<Map<String,Object>> findBySjTask(String propC7);
|
||||
@Query(value = " select ik.`prop_c7` 'rfid',i.`code` 'sku',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 "
|
||||
|
|
|
|||
|
|
@ -105,15 +105,16 @@ public class AgvTaskController {
|
|||
@ApiOperation("AGV搬运任务回调接口")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> agvTaskCallback(@RequestBody String json){
|
||||
System.out.println("json:"+json);
|
||||
System.out.println("AGV搬运任务回调接口:"+json);
|
||||
JSONObject jsonObject = JSON.parseObject(json);
|
||||
String taskCode = jsonObject.getString("missionCode")==null?"":jsonObject.getString("missionCode");//任务编号
|
||||
String podCode = jsonObject.getString("podCode")==null?"":jsonObject.getString("podCode");//容器编号
|
||||
String currentNodeCode = jsonObject.getString("currentNodeCode")==null?"":jsonObject.getString("currentNodeCode");//当前位置
|
||||
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("COMPLETED")) missionStatus="3";
|
||||
if (missionStatus.equals("CANCELED")) missionStatus="4";
|
||||
if (missionStatus.equals("ARRIVED_RFID")) missionStatus="5";
|
||||
agvTaskService.agvTaskCallback(taskCode,missionStatus);
|
||||
return new ResponseEntity<>(ApiResult.success("",""),HttpStatus.OK);
|
||||
//查询对应BOX
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ import com.youchain.annotation.Log;
|
|||
import com.youchain.businessdata.service.AsnDetailService;
|
||||
import com.youchain.businessdata.service.PickDetailService;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.modules.system.repository.DeptRepository;
|
||||
import com.youchain.utils.UserUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -23,21 +26,36 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@RequestMapping("/synq/resources")
|
||||
public class InterfaceController {
|
||||
private final AsnDetailService asnDetailService;
|
||||
public static Dept dept;
|
||||
private final DeptRepository deptRepository;
|
||||
private final PickDetailService pickDetailService;
|
||||
@PostMapping("/importAsnApi")
|
||||
@PostMapping("/expected-receipts")
|
||||
@Log("接收SAP入库单")
|
||||
@ApiOperation("接收SAP入库单")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> importAsnApi(@RequestBody JSONObject jsonObject) {
|
||||
dept=deptRepository.getById(7l);
|
||||
ApiResult apiResult = asnDetailService.importAsnApi(jsonObject);
|
||||
if (apiResult.getStatus()!=201){
|
||||
JSONObject respJson=new JSONObject();
|
||||
respJson.put("errorCode", apiResult.getStatus());
|
||||
respJson.put("errorText", apiResult.getMessage());
|
||||
return new ResponseEntity<>(respJson, HttpStatus.valueOf(400));
|
||||
}
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
@PostMapping("/importPtApi")
|
||||
@PostMapping("/orders/batch")
|
||||
@Log("接收SAP出库单")
|
||||
@ApiOperation("接收SAP出库单")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> importPtApi(@RequestBody JSONObject jsonObject) {
|
||||
ApiResult apiResult = pickDetailService.importPtApi(jsonObject);
|
||||
if (apiResult.getStatus()!=201){
|
||||
JSONObject respJson=new JSONObject();
|
||||
respJson.put("errorCode", apiResult.getStatus());
|
||||
respJson.put("errorText", apiResult.getMessage());
|
||||
return new ResponseEntity<>(respJson, HttpStatus.valueOf(400));
|
||||
}
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,12 +102,13 @@ public class TaskController {
|
|||
String rfid=request.getString("RFID");
|
||||
int agvFlag=request.getIntValue("agvFlag");
|
||||
Point point= pointRepository.getById(request.getLong("pointId"));
|
||||
String type=point.getType();
|
||||
// 人工入库 直接生成库存
|
||||
ApiResult apiResult = taskService.manualReceiving(rfid,point,agvFlag);
|
||||
if (point.getType().equals(BaseStatus.BOX)){
|
||||
if (type.equals(BaseStatus.BOX)){
|
||||
if (apiResult.getStatus()==200){
|
||||
// AGV入库 生成搬运任务(目标库区,单据任务类型)
|
||||
apiResult = agvTaskService.addAgvAsn(point.getArea().getCode(),apiResult.getData().toString());
|
||||
apiResult = agvTaskService.addAgvAsn(apiResult.getData().toString());
|
||||
}
|
||||
}
|
||||
if (apiResult.getStatus()!=200&&apiResult.getStatus()!=201){
|
||||
|
|
@ -263,7 +264,7 @@ public class TaskController {
|
|||
}else if (billCode.equals(BizStatus.SM_RK)){
|
||||
areaCode=BizStatus.BCP;
|
||||
}
|
||||
apiResult = agvTaskService.addAgvAsn(areaCode, billCode);
|
||||
apiResult = agvTaskService.addAgvAsn(billCode);
|
||||
}
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}catch (Exception e){
|
||||
|
|
|
|||
|
|
@ -86,10 +86,10 @@ public interface AgvTaskService {
|
|||
|
||||
/**
|
||||
* 发送货架搬运接口任务
|
||||
* @param agvTasks
|
||||
* @param agvTask
|
||||
* @return
|
||||
*/
|
||||
String sendAgvTaskImpl(AgvTask agvTasks);
|
||||
String sendAgvTaskImpl(AgvTask agvTask);
|
||||
|
||||
/**
|
||||
* 发送料箱搬运接口任务
|
||||
|
|
@ -232,7 +232,7 @@ public interface AgvTaskService {
|
|||
/**
|
||||
* 生成入库AGV搬运任务
|
||||
*/
|
||||
ApiResult addAgvAsn(String areaCode,String billType);
|
||||
|
||||
ApiResult addAgvAsn(String billType);
|
||||
void addTaskRfid(String areaCode);
|
||||
ApiResult addAgvAsnTage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,15 +102,14 @@ public interface InventoryService {
|
|||
|
||||
/**
|
||||
* 入库生成库存
|
||||
* @param taskListMap 收货任务总结
|
||||
* @param task 收货任务总结
|
||||
* @return
|
||||
*/
|
||||
Inventory asnAddInventory(List<Map<String,Object>> taskListMap);
|
||||
Inventory asnAddInventoryList(Task taskList);
|
||||
|
||||
/** 添加*/
|
||||
@Transactional
|
||||
Inventory getInventory(Double qty, Long ikID, Long pointId, String logType);
|
||||
|
||||
/**
|
||||
* 出库完成 删除库存
|
||||
* @param taskList
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ public class AsnDetailQueryCriteria{
|
|||
// 左关联查询,left Join , joinName为关联实体名称 , propName为关联实体 字段
|
||||
@Query(joinName = "item", propName="code",type = Query.Type.EQUAL)
|
||||
private String itemCode;
|
||||
@Query(joinName = "asn", propName="id",type = Query.Type.EQUAL)
|
||||
private Long asnId;
|
||||
@Query(joinName = "asn", propName="relatedBill1",type = Query.Type.EQUAL)
|
||||
private String relatedBill1;
|
||||
|
||||
|
|
@ -54,8 +56,8 @@ public class AsnDetailQueryCriteria{
|
|||
/** 等于 */
|
||||
@Query(propName="status",type = Query.Type.EQUAL)
|
||||
private String status;
|
||||
@Query(propName="status",type = Query.Type.IN)
|
||||
private List<String> statusList;
|
||||
/*@Query(propName="status",type = Query.Type.IN)
|
||||
private List<String> statusList;*/
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
package com.youchain.businessdata.service.dto;
|
||||
|
||||
import com.youchain.basicdata.domain.BillType;
|
||||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import lombok.Data;
|
||||
import java.sql.Timestamp;
|
||||
|
|
@ -68,6 +69,7 @@ public class AsnDto implements Serializable {
|
|||
|
||||
/** 修改人 */
|
||||
private String updateBy;
|
||||
private AsnDetail asnDetails;
|
||||
|
||||
/** 创建时间 */
|
||||
private Timestamp createTime;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,12 @@ public class InventoryDto implements Serializable {
|
|||
|
||||
/** 单据号 */
|
||||
private String billCode;
|
||||
/** 货主 */
|
||||
private String owner;
|
||||
/** 成品物料编码*/
|
||||
private String prodMtrl;
|
||||
/** 中标批次*/
|
||||
private String ztBid;
|
||||
|
||||
/** 物料属性 */
|
||||
private ItemKey itemKey;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ public class PickDetailQueryCriteria{
|
|||
private String itemName;
|
||||
@Query(joinName = "pick", propName="relatedBill1",type = Query.Type.EQUAL)
|
||||
private String relatedBill1;
|
||||
|
||||
@Query(joinName = "pick", propName="id",type = Query.Type.EQUAL)
|
||||
private String pickId;
|
||||
/** 模糊 */
|
||||
@Query(type = Query.Type.INNER_LIKE)
|
||||
private String po;
|
||||
|
|
@ -46,8 +47,8 @@ public class PickDetailQueryCriteria{
|
|||
/** 等于 */
|
||||
@Query(type = Query.Type.EQUAL)
|
||||
private String status;
|
||||
@Query( propName="status",type = Query.Type.IN)
|
||||
private List<String> statusList;
|
||||
/*@Query( propName="status",type = Query.Type.IN)
|
||||
private List<String> statusList;*/
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
/* @Query( propName="status",type = Query.Type.IN)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import com.youchain.basicdata.domain.*;
|
|||
import com.youchain.basicdata.repository.*;
|
||||
import com.youchain.basicdata.service.BoxService;
|
||||
import com.youchain.basicdata.service.ItemService;
|
||||
import com.youchain.basicdata.service.LampLogService;
|
||||
import com.youchain.basicdata.service.PointService;
|
||||
import com.youchain.basicdata.service.impl.BoxServiceImpl;
|
||||
import com.youchain.businessdata.domain.*;
|
||||
|
|
@ -34,6 +35,7 @@ import com.youchain.modules.quartz.utils.TimeNumberUtils;
|
|||
import com.youchain.modules.system.service.DictService;
|
||||
import com.youchain.modules.system.service.dto.DictDto;
|
||||
import com.youchain.modules.system.service.dto.DictQueryCriteria;
|
||||
import com.youchain.rfid.RfidDocJava;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.youchain.businessdata.repository.AgvTaskRepository;
|
||||
|
|
@ -68,7 +70,10 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
private final AgvTaskRepository agvTaskRepository;
|
||||
private final AgvTaskMapper agvTaskMapper;
|
||||
private final TaskRepository taskRepository;
|
||||
private final TaskService taskService;
|
||||
private final InventoryService inventoryService;
|
||||
private final LampLogService lampLogService;
|
||||
private final LampLogRepository lampLogRepository;
|
||||
private final PointRepository pointRepository;
|
||||
private final StockTypeRepository stockTypeRepository;
|
||||
private final AsnDetailRepository asnDetailRepository;
|
||||
|
|
@ -175,12 +180,12 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
}
|
||||
if (agvTask.getType().equals(BizStatus.AGV_C)){
|
||||
jsonObject.put("requestId", agvTask.getId());
|
||||
jsonObject.put("containerCode", "");
|
||||
jsonObject.put("position", agvTask.getEndSlotCode());
|
||||
api=UrlApi.containerOut;
|
||||
}
|
||||
String resultJson = HttpPostUtil.sendPostReq(api, jsonObject.toString());//返回ResponseJson*/
|
||||
JSONObject resulObject = JSON.parseObject(resultJson);
|
||||
System.out.println("result:"+resulObject);
|
||||
String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
||||
if (code.equals("0")) {
|
||||
if (agvTask.getType().equals(BizStatus.AGV_R)||agvTask.getType().equals(BizStatus.AGV_C)){
|
||||
|
|
@ -455,7 +460,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void agvTaskCallback(String taskCode, String status) {
|
||||
// agvTask搬运任务
|
||||
AgvTask agvTask=agvTaskRepository.getById(Integer.valueOf(taskCode));
|
||||
|
|
@ -463,14 +467,16 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
// List<Task> tasks=taskRepository.getAgvTaskList(agvTask.getId(),BizStatus.ASN);
|
||||
Point startPoint=null;
|
||||
Point endPoint=null;
|
||||
startPoint=pointRepository.findByCode(agvTask.getStartSlotCode());
|
||||
endPoint=pointRepository.findByCode(agvTask.getEndSlotCode());
|
||||
if (status.equals("1")){
|
||||
// 开始执行
|
||||
// agvTask.setStatus(BizStatus.ATWORK);
|
||||
}else if (status.equals("2")){
|
||||
// 取料完成
|
||||
startPoint=pointRepository.findByCode(agvTask.getStartSlotCode());
|
||||
if (startPoint!=null) {
|
||||
startPoint.setAgvStatus(BaseStatus.FREE);
|
||||
startPoint.setStatus(BaseStatus.FREE);
|
||||
startPoint.setStorageType(null);
|
||||
pointRepository.save(startPoint);
|
||||
agvTask.setStartTime(new Timestamp((new Date()).getTime()));
|
||||
|
|
@ -491,22 +497,27 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
agvTask.setStatus(BizStatus.FINISH);
|
||||
agvTask.setEndTime(new Timestamp((new Date()).getTime()));
|
||||
// 放料完成
|
||||
endPoint=pointRepository.findByCode(agvTask.getEndSlotCode());
|
||||
if (endPoint!=null) {
|
||||
endPoint.setAgvStatus(BaseStatus.FREE);
|
||||
pointRepository.save(endPoint);
|
||||
if (agvTask.getJobType().equals(BizStatus.ASN)) {
|
||||
List<Task> taskList = taskRepository.findByAgvTask(agvTask.getId(), BizStatus.RECEIVING);
|
||||
if (agvTask.getJobType().equals(BizStatus.PUT)) {
|
||||
// 上架任务,生成库存
|
||||
List<Task> taskList = taskRepository.findByAgvTaskSj(agvTask.getId());
|
||||
if (taskList.size() > 0) {
|
||||
if (taskList.get(0).getTaskType().equals(BizStatus.RM_RK)) {
|
||||
|
||||
} else {
|
||||
for (int i = 0; i < taskList.size(); i++) {
|
||||
Inventory inventory = inventoryService.asnAddInventoryList(taskList.get(i));
|
||||
}
|
||||
|
||||
/*List<Task> taskList
|
||||
List<Map<String, Object>> taskMapList = taskRepository.findByAgvTask(agvTask.getId()
|
||||
, taskList.get(0).getTaskType(), 1l,null);
|
||||
if (taskMapList.size() > 0) {
|
||||
/** 入库任务回调 生成库存 */
|
||||
*//** 入库任务回调 生成库存 *//*
|
||||
Inventory inventory = inventoryService.asnAddInventory(taskMapList);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -515,6 +526,9 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
List<Task> taskList=taskRepository.findByAgvTask(agvTask.getId());
|
||||
/** 出库任务回调 生成删除库存*/
|
||||
inventoryService.pickDelInventory(taskList);
|
||||
}else if (agvTask.getJobType().equals(BizStatus.ASN)) {
|
||||
// 感应门扫描 数据 并保存日志
|
||||
addTaskRfid(startPoint.getArea().getCode());
|
||||
}
|
||||
|
||||
} else if (status.equals("4")) {
|
||||
|
|
@ -528,10 +542,52 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
startPoint.setAgvStatus(BaseStatus.FREE);
|
||||
pointRepository.save(startPoint);
|
||||
}
|
||||
}else if (status.equals("5")) {
|
||||
RfidDocJava.startRfid();
|
||||
}
|
||||
agvTaskRepository.save(agvTask);
|
||||
}
|
||||
|
||||
/** 入库任务完成后,感应门扫描RFID生成Task任务*/
|
||||
@Override
|
||||
public void addTaskRfid(String areaCode) {
|
||||
LampLog lampLog = lampLogService.readRfidLog();
|
||||
String[] rfids=lampLog.getRequestContent()
|
||||
.substring(1, lampLog.getRequestContent().length()-1)
|
||||
.replaceAll(" ","")
|
||||
.split(",");
|
||||
List returnContent=new ArrayList();
|
||||
List returnState=new ArrayList();
|
||||
for (int i = 0; i < rfids.length; i++) {
|
||||
String rfid=rfids[i];
|
||||
if (rfid.length()<1){
|
||||
continue;
|
||||
}
|
||||
ApiResult apiResult = taskService.manualReceiving(rfid,BaseStatus.DoorPoint,1);
|
||||
|
||||
if (apiResult.getStatus()==200){
|
||||
// 解析成功
|
||||
returnContent.add(rfid);
|
||||
}
|
||||
returnState.add(apiResult.getMessage());
|
||||
}
|
||||
lampLog.setReturnContent(returnContent.toString());
|
||||
lampLog.setReturnState(returnState.toString());
|
||||
lampLogRepository.save(lampLog);
|
||||
|
||||
// 生成上架任务
|
||||
if (areaCode.equals(BizStatus.BCP)){
|
||||
// 半成品区
|
||||
addAgvAsn(BizStatus.SM_RK);
|
||||
}else if (areaCode.equals(BizStatus.LX)){
|
||||
// 料箱区
|
||||
addAgvAsn(BizStatus.RM_RK);
|
||||
}else if (areaCode.equals(BizStatus.CP)){
|
||||
// 成品区
|
||||
addAgvAsn(BizStatus.FC_RK);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgvTask findBycontainerCode(String containerCode) {
|
||||
return agvTaskRepository.findBycontainerCode(containerCode);
|
||||
|
|
@ -624,7 +680,9 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
@Override
|
||||
public ApiResult pointStockRk(String storageType, Long id) {
|
||||
Point point=pointRepository.getById(id);
|
||||
System.out.println("调用容器入场接口");
|
||||
if (point.getStorageType()!=null&&point.getStorageType().length()>0){
|
||||
return ApiResult.fail(500, "点位已记录容器", null);
|
||||
}
|
||||
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")){
|
||||
|
|
@ -637,7 +695,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
@Override
|
||||
public ApiResult pointStockCk(String storageType, Long 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_C,storageType,null,point.getCode(),BizStatus.OPEN,BizStatus.ASN);
|
||||
|
|
@ -645,7 +703,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
if (!resultJson.getString("code").equals("0")){
|
||||
return ApiResult.fail(500, "容器入场失败", resultJson);
|
||||
}
|
||||
point.setStorageType(storageType);
|
||||
point.setStorageType(null);
|
||||
pointRepository.save(point);
|
||||
return ApiResult.fail(200, "操作成功", null);
|
||||
}
|
||||
|
|
@ -654,6 +712,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
AgvTask agvTask = new AgvTask();
|
||||
List<AgvTask> agvTaskList=agvTaskRepository.findByRptAgvTask(startSlotCode,endSlotCode);
|
||||
if (agvTaskList.size()>0){
|
||||
System.out.println("搬运任务重复");
|
||||
return agvTaskList.get(0);
|
||||
}
|
||||
agvTask.setType(type);
|
||||
|
|
@ -703,8 +762,20 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public ApiResult addAgvAsn(String areaCode,String billType) {
|
||||
public ApiResult addAgvAsn(String billType) {
|
||||
AgvTask agvTask=null;
|
||||
String areaCode=BizStatus.getBillToStock(billType);
|
||||
List<Task> taskItemKeyList=taskRepository.findByGroupItemKey(BizStatus.RECEIVING,1,billType);
|
||||
if (billType.equals(BizStatus.RM_RK)){
|
||||
// 料箱入库票数
|
||||
if (taskItemKeyList.size()!=BaseStatus.DoorPoint_LX_SUM){
|
||||
return ApiResult.fail(201,"料箱入库当前RFID票数:"+taskItemKeyList.size(),null);
|
||||
}
|
||||
}else if(billType.equals(BizStatus.SM_RK)){
|
||||
if (taskItemKeyList.size()!=BaseStatus.DoorPoint_BCP_SUM){
|
||||
return ApiResult.fail(201,"半成品入库当前RFID票数:"+taskItemKeyList.size(),null);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < taskItemKeyList.size(); i++) {
|
||||
Task taskItemKey=taskItemKeyList.get(i);
|
||||
// 搬运 起点
|
||||
|
|
@ -721,23 +792,30 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
return ApiResult.fail(201,"已读取到成品入库RFID票数:"+taskItemKeyList.size(),null);
|
||||
}
|
||||
}else if(taskItemKey.getTaskType().equals(BizStatus.RM_RK)){
|
||||
// 料箱入库
|
||||
stockTypeCode=BizStatus.LXZ_STO;
|
||||
if (taskItemKeyList.size()==3){
|
||||
endPointCode=taskItemKey.getDstPoint().getBeatCode();
|
||||
}else {
|
||||
return ApiResult.fail(201,"已读取到料箱入库RFID票数:"+taskItemKeyList.size(),null);
|
||||
}
|
||||
endPointCode=BaseStatus.LxZPoint.getCode();
|
||||
}else if(taskItemKey.getTaskType().equals(BizStatus.SM_RK)){
|
||||
stockTypeCode=BizStatus.TP_STO;
|
||||
if (taskItemKeyList.size()==1){
|
||||
if (taskItemKeyList.size()>=1){
|
||||
|
||||
}else {
|
||||
return ApiResult.fail(201,"已读取到半成品入库RFID票数:"+taskItemKeyList.size(),null);
|
||||
}
|
||||
}
|
||||
// 生成AgvTask搬运任务
|
||||
AgvTask agvTask = addAgvTask(BizStatus.AGV, stockTypeCode, startPointCode,endPointCode , BizStatus.OPEN, BizStatus.ASN);
|
||||
// 入库的Task任务
|
||||
String jobType=BizStatus.PUT;
|
||||
if (endPointCode==BaseStatus.DoorPoint.getCode()){
|
||||
jobType=BizStatus.ASN;
|
||||
}
|
||||
// 生成搬运任务
|
||||
if (agvTask==null) {
|
||||
agvTask = addAgvTask(BizStatus.AGV, stockTypeCode, startPointCode, endPointCode, BizStatus.OPEN, jobType);
|
||||
}
|
||||
taskItemKey.setAgvTask(agvTask);
|
||||
taskItemKey.setTaskStatus(BizStatus.PUTAWAY);
|
||||
taskRepository.save(taskItemKey);
|
||||
/*// 入库的Task任务
|
||||
List<Task> taskList=taskRepository.findByItemKey(taskItemKey.getItemKey().getId(), taskItemKey.getTaskStatus());
|
||||
for (int j = 0; j < taskList.size(); j++) {
|
||||
Task task=taskList.get(j);
|
||||
|
|
@ -746,7 +824,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
task.setTaskStatus(BizStatus.PUTAWAY);
|
||||
}
|
||||
taskRepository.save(task);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
return ApiResult.success(200, "操作成功", null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import com.youchain.businessdata.domain.Asn;
|
|||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import com.youchain.businessdata.repository.AsnRepository;
|
||||
import com.youchain.businessdata.repository.TaskRepository;
|
||||
import com.youchain.businessdata.rest.InterfaceController;
|
||||
import com.youchain.businessdata.service.AsnService;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
|
|
@ -198,8 +199,6 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
|
||||
@Override
|
||||
public AsnDetail createAsnDetail(AsnDetail asnDetail){
|
||||
Asn asn=asnRepository.findByRelatedBill1(asnDetail.getAsn().getRelatedBill1());
|
||||
asnDetail.setAsn(asn);
|
||||
asnDetail=asnDetailRepository.save(asnDetail);
|
||||
return asnDetail;
|
||||
}
|
||||
|
|
@ -233,7 +232,7 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
try {
|
||||
er = DateUtil.parseLocalDateTimeZone(erTime, "UTC");
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
// throw new RuntimeException(e);
|
||||
}
|
||||
Asn asn = asnService.addAsn(billType,relatedBill2,structure,"SAP推送",er);
|
||||
|
||||
|
|
@ -247,7 +246,7 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
item=new Item();
|
||||
item.setCode(itemCode);
|
||||
item.setName(itemCode);
|
||||
item.setDept(UserUtils.getDept());
|
||||
item.setDept(InterfaceController.dept);
|
||||
item.setGoodType(BizStatus.getBillToStock(billType.getCode()));
|
||||
item.setUnit("200001");
|
||||
itemRepository.save(item);
|
||||
|
|
@ -273,13 +272,13 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
asnDetail.setLineNo(Long.valueOf(lineNo));
|
||||
asnDetail.setOrderQty(Double.valueOf(quantityExpected));
|
||||
asnDetail.setAsn(asn);
|
||||
asnDetail.setDept(UserUtils.getDept());
|
||||
asnDetail.setDept(InterfaceController.dept);
|
||||
asnDetail.setPropC1(attributeValue.get("ztBidName")+"");
|
||||
asnDetail.setPropC2(attributeValue.get("prodMtrlNo")+"");
|
||||
asnDetail.setPropC3(attributeValue.get("loadUnitId")+"");
|
||||
asnDetailRepository.save(asnDetail);
|
||||
}
|
||||
return ApiResult.fail(200,"成功",null);
|
||||
return ApiResult.fail(201,"成功",null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import com.youchain.businessdata.domain.Asn;
|
|||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import com.youchain.businessdata.repository.AsnDetailRepository;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.modules.system.repository.DeptRepository;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -54,6 +55,7 @@ public class AsnServiceImpl implements AsnService {
|
|||
private final AsnRepository asnRepository;
|
||||
private final AsnDetailRepository asnDetailRepository;
|
||||
private final PointRepository pointRepository;
|
||||
private final DeptRepository deptRepository;
|
||||
private final AsnMapper asnMapper;
|
||||
|
||||
@Override
|
||||
|
|
@ -94,6 +96,11 @@ public class AsnServiceImpl implements AsnService {
|
|||
@Override
|
||||
public void deleteAll(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
List<AsnDetail> asnDetailList=asnDetailRepository.findByAsn(id);
|
||||
for (int i = 0; i < asnDetailList.size(); i++) {
|
||||
AsnDetail asnDetail=asnDetailList.get(i);
|
||||
asnDetailRepository.deleteById(asnDetail.getId());
|
||||
}
|
||||
asnRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -134,7 +141,7 @@ public class AsnServiceImpl implements AsnService {
|
|||
asn.setBillType(billType);
|
||||
// 默认单号
|
||||
asn.setRelatedBill1(relatedBill2);
|
||||
asn.setDept(UserUtils.getDept());
|
||||
asn.setDept(deptRepository.getById(7l));
|
||||
asn.setRelatedBill2(relatedBill2);
|
||||
asn.setStructure(structure);
|
||||
asn.setOrderOrigin(orderOrigin);
|
||||
|
|
@ -159,6 +166,9 @@ public class AsnServiceImpl implements AsnService {
|
|||
AsnDetail asnDetail=asnDetailList.get(i);
|
||||
Item item = asnDetail.getItem();
|
||||
Double zzsQty=item.getExtendD1();// 装载数
|
||||
if (zzsQty<1){
|
||||
return ApiResult.success(500,"请写入物料单个库位的预期占用数量"+item.getCode(),asn.getId());
|
||||
}
|
||||
Double orderQty=asnDetail.getOrderQty()-asnDetail.getReceivedQty();// 订单数
|
||||
double result = orderQty / zzsQty;
|
||||
int floorNum = (int) Math.floor(result);// 整托数
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import org.springframework.data.domain.Pageable;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
|
@ -53,6 +54,8 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
|
||||
private final InventoryRepository inventoryRepository;
|
||||
private final InventoryLogService inventoryLogService;
|
||||
private final AsnRepository asnRepository;
|
||||
private final AsnDetailRepository asnDetailRepository;
|
||||
private final InventoryMapper inventoryMapper;
|
||||
private final PickDetailRepository pickDetailRepository;
|
||||
private final EntityManager entityManager;
|
||||
|
|
@ -104,6 +107,8 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
public void deleteAll(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
Inventory inventory=inventoryRepository.getById(id);
|
||||
InventoryDto inventoryDto= inventoryMapper.toDto(inventory);
|
||||
double quantity=inventory.getQuantity();
|
||||
ItemKey itemKey=inventory.getItemKey();
|
||||
itemKey.setEnabled(false);
|
||||
Point point=inventory.getPoint();
|
||||
|
|
@ -114,6 +119,11 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
}
|
||||
itemKeyRepository.save(itemKey);
|
||||
inventoryRepository.deleteById(id);
|
||||
// 添加日志
|
||||
inventoryLogService.storeInventoryLog(BizStatus.DEL,BizStatus.REDUCE,itemKey.getPropC3(),itemKey,point,null,null,null,quantity,quantity, itemKey.getPropC6(),null,inventoryDto.getId(),inventoryDto.getDescription());
|
||||
// 反馈修改库存
|
||||
UrlApi.invBackSap(inventoryDto.getOwner(), itemKey.getItem().getCode(),0+""
|
||||
, quantity+"",inventoryDto.getZtBid(),inventory.getProdMtrl(),inventoryDto.getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -218,27 +228,41 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public Inventory asnAddInventory(List<Map<String,Object>> taskListMap) {
|
||||
for (int i = 0; i < taskListMap.size(); i++) {
|
||||
Map<String,Object> taskMap=taskListMap.get(i);
|
||||
Double qty=Double.valueOf( taskMap.get("qty")+"");
|
||||
String taskIds=taskMap.get("taskIds")+"";
|
||||
Long ikID=Long.valueOf(taskMap.get("ikID")+"");
|
||||
Long pointId=Long.valueOf(taskMap.get("pointId")+"");
|
||||
Inventory inventory = getInventory(qty, ikID, pointId,BizStatus.RECEIVING_UP);
|
||||
String[] arrTaskIds=taskIds.split(",");
|
||||
for (int j = 0; j < arrTaskIds.length; j++) {
|
||||
Long taskId=Long.valueOf(arrTaskIds[j]+"");
|
||||
Task task =taskRepository.getById(taskId);
|
||||
public Inventory asnAddInventoryList(Task task) {
|
||||
Inventory inventory = getInventory(task.getPlanQty(), task.getItemKey().getId()
|
||||
, task.getDstPoint().getId(), BizStatus.RECEIVING_UP);
|
||||
/*List<Inventory> inventoryList = inventoryRepository.findByItemAndPoint(task.getItemKey().getItem().getId(),task.getDstPoint().getId());
|
||||
if (inventoryList.size()>0){
|
||||
inventory = inventoryList.get(0);
|
||||
}
|
||||
if (inventory==null) {
|
||||
inventory = getInventory(task.getPlanQty(), task.getItemKey().getId()
|
||||
, task.getDstPoint().getId(), BizStatus.RECEIVING_UP);
|
||||
}else {
|
||||
inventory.setQuantity(inventory.getQuantity()+task.getPlanQty());
|
||||
}*/
|
||||
task.setTaskStatus(BizStatus.RECEIVED);
|
||||
task.setMoveQty(task.getPlanQty());
|
||||
task.setInventory(inventory);
|
||||
taskRepository.save(task);
|
||||
Asn asn=asnRepository.findByRelatedBill2(task.getBillCode());
|
||||
AsnDetail asnDetail=task.getAsnDetail();
|
||||
asnDetail.setPutQty(asnDetail.getPutQty()+task.getMoveQty());
|
||||
asnDetailRepository.save(asnDetail);
|
||||
if (asn!=null){
|
||||
// 添加 登记单号 货主
|
||||
inventory.setBillCode(task.getBillCode());
|
||||
inventory.setOwner(asn.getStructure());
|
||||
inventoryRepository.save(inventory);
|
||||
}
|
||||
UrlApi.asnBackSap(inventory.getOwner(),
|
||||
inventory.getBillCode(),
|
||||
task.getAsnDetail().getLineNo()+"",
|
||||
task.getItemKey().getItem().getCode(),
|
||||
task.getAsnDetail().getOrderQty()+"",
|
||||
task.getAsnDetail().getPutQty()+"");
|
||||
return inventory;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
@Transactional
|
||||
public Inventory getInventory(Double qty, Long ikID, Long pointId, String logType) {
|
||||
|
|
@ -254,17 +278,25 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
inventory.setStatus(BizStatus.OPEN);
|
||||
inventoryRepository.save(inventory);
|
||||
//添加库存日志
|
||||
inventoryLogService.storeInventoryLog(logType,BizStatus.ADD,itemKey.getPropC3(),itemKey,null,inventory.getPoint(),null,null,0d,inventory.getQuantity(), itemKey.getPropC6(),null,inventory.getId(),"");
|
||||
inventoryLogService.storeInventoryLog(logType,BizStatus.ADD,itemKey.getPropC3(),itemKey,null,inventory.getPoint(),null,null,0d,inventory.getQuantity(), itemKey.getPropC6(),null,inventory.getId(),inventory.getDescription());
|
||||
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pickDelInventory(List<Task> taskList) {
|
||||
Point pointStart=null;
|
||||
Point pointEnd=null;
|
||||
//删除库存
|
||||
for (int i = 0; i < taskList.size(); i++) {
|
||||
/** 书安心Task表*/
|
||||
Task task=taskList.get(i);
|
||||
if (pointStart==null){
|
||||
pointStart = task.getSrcPoint();
|
||||
}
|
||||
if (pointEnd==null){
|
||||
pointEnd = task.getDstPoint();
|
||||
}
|
||||
task.setTaskStatus(BizStatus.PICK_ALL);
|
||||
task.setMoveQty(task.getPlanQty());
|
||||
taskRepository.save(task);
|
||||
|
|
@ -284,6 +316,9 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
}
|
||||
/** 添加库存日志,删除库存*/
|
||||
Inventory inventory=task.getInventory();
|
||||
if (inventory==null){
|
||||
continue;
|
||||
}
|
||||
inventoryLogService.storeInventoryLog(BizStatus.PICK_DOWN,BizStatus.REDUCE,inventory.getItemKey().getPropC3(),inventory.getItemKey(),task.getSrcPoint(),task.getDstPoint(),null,null,inventory.getQuantity(),task.getMoveQty(), task.getItemKey().getPropC6(),null,inventory.getId(),"");
|
||||
inventoryRepository.delete(inventory);
|
||||
// 失效ItemKey
|
||||
|
|
@ -291,6 +326,16 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
itemKey.setEnabled(false);
|
||||
itemKeyRepository.save(itemKey);
|
||||
}
|
||||
// 查询原库位是否有其他库存,如果有移出到线边
|
||||
if (pointStart!=null){
|
||||
List<Inventory> inventoryList=inventoryRepository.findByPoint(pointStart.getId());
|
||||
for (int i = 0; i < inventoryList.size(); i++) {
|
||||
Inventory inventory=inventoryList.get(i);
|
||||
inventory.setPoint(pointEnd);
|
||||
inventoryRepository.save(inventory);
|
||||
inventoryLogService.storeInventoryLog(BizStatus.MOVE,BizStatus.REDUCE,inventory.getItemKey().getPropC3(),inventory.getItemKey(),pointStart,pointEnd,null,null,inventory.getQuantity(),0d, inventory.getItemKey().getPropC6(),null,inventory.getId(),"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import com.youchain.businessdata.domain.ItemKey;
|
|||
import com.youchain.businessdata.domain.Task;
|
||||
import com.youchain.businessdata.repository.InventoryRepository;
|
||||
import com.youchain.businessdata.service.InventoryService;
|
||||
import com.youchain.exception.BadRequestException;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -34,6 +35,7 @@ import com.youchain.businessdata.service.ItemKeyService;
|
|||
import com.youchain.businessdata.service.dto.ItemKeyDto;
|
||||
import com.youchain.businessdata.service.dto.ItemKeyQueryCriteria;
|
||||
import com.youchain.businessdata.service.mapstruct.ItemKeyMapper;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
|
@ -174,7 +176,14 @@ public class ItemKeyServiceImpl implements ItemKeyService {
|
|||
itemKey.setPropC7(propC7);
|
||||
itemKey.setPropC6(propC6.toString());
|
||||
itemKeyRepository.save(itemKey);
|
||||
}else if (itemKey.getEnabled()==true){
|
||||
// 已使用
|
||||
throw new BadRequestException(HttpStatus.NOT_IMPLEMENTED, "RFID已使用:"+propC7);
|
||||
}else if (itemKey.getEnabled()==false){
|
||||
itemKey.setEnabled(true);
|
||||
itemKeyRepository.save(itemKey);
|
||||
}
|
||||
|
||||
return itemKey;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import org.springframework.data.domain.Page;
|
|||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
|
@ -181,6 +182,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
if (pickDetail.getOrderQty() > pickDetail.getAllocatedQty()) {
|
||||
List<Inventory> inventoryList = inventoryRepository.queryInventory(item.getId());
|
||||
if (inventoryList.size() > 0) {
|
||||
// 查询当前库存 所在库位物料总数
|
||||
ApiResult apiResult = allocate(pickDetail, dept, quantity, agvFlag, endPoint, inventoryList);
|
||||
if (apiResult != null) return apiResult;
|
||||
}
|
||||
|
|
@ -479,7 +481,12 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
JSONObject order=orders.getJSONObject(i);
|
||||
String orderId=order.getString("orderId");
|
||||
String erTime=order.getString("orderDate");//操作时间
|
||||
Timestamp er = Timestamp.valueOf(DateUtil.parseLocalDateTimeFormat(erTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
Timestamp er=null;
|
||||
try {
|
||||
er = DateUtil.parseLocalDateTimeZone(erTime, "UTC");
|
||||
} catch (ParseException e) {
|
||||
// throw new RuntimeException(e);
|
||||
}
|
||||
String owner=order.getString("owner");//货主
|
||||
String orderType=order.getString("orderType");//订单类型
|
||||
List<BillType> billTypeList=billTypeRepository.findBySourceName(orderType);
|
||||
|
|
@ -488,7 +495,12 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
}
|
||||
BillType billType=billTypeList.get(0);
|
||||
String dispatchDate=order.getString("dispatchDate");//发货日期
|
||||
Timestamp dc = Timestamp.valueOf(DateUtil.parseLocalDateTimeFormat(dispatchDate, "yyyy-MM-dd HH:mm:ss"));
|
||||
Timestamp dc=null;
|
||||
try {
|
||||
dc = DateUtil.parseLocalDateTimeZone(dispatchDate, "UTC");
|
||||
} catch (ParseException e) {
|
||||
// throw new RuntimeException(e);
|
||||
}
|
||||
Long priority=order.getLong("priority");//订单类型
|
||||
String address=order.getString("consolidationLoc");//地址
|
||||
Pick pick;
|
||||
|
|
@ -541,7 +553,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
pickDetailRepository.save(pickDetail);
|
||||
}
|
||||
}
|
||||
return ApiResult.result(200, "操作成功",null);
|
||||
return ApiResult.result(201, "操作成功",null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,12 +19,14 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.LampLog;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.repository.ItemRepository;
|
||||
import com.youchain.basicdata.repository.PointRepository;
|
||||
import com.youchain.basicdata.repository.StockRepository;
|
||||
import com.youchain.basicdata.repository.StockTypeRepository;
|
||||
import com.youchain.basicdata.service.LampLogService;
|
||||
import com.youchain.businessdata.ReturnJson.RPTaskList;
|
||||
import com.youchain.businessdata.domain.*;
|
||||
import com.youchain.businessdata.inputJson.IPTask;
|
||||
|
|
@ -69,11 +71,11 @@ public class TaskServiceImpl implements TaskService {
|
|||
private final AsnRepository asnRepository;
|
||||
private final InventoryRepository inventoryRepository;
|
||||
private final InventoryService inventoryService;
|
||||
private final AgvTaskService agvTaskService;
|
||||
private final PickDetailRepository pickDetailRepository;
|
||||
private final AsnDetailRepository asnDetailRepository;
|
||||
private final StockTypeRepository stockTypeRepository;
|
||||
private final AsnDetailService asnDetailService;
|
||||
private final LampLogService lampLogService;
|
||||
private final InventoryLogService inventoryLogService;
|
||||
private final EntityManager entityMapper;
|
||||
private final StockRepository stockRepository;
|
||||
|
|
@ -351,6 +353,11 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
i=i+4;
|
||||
}
|
||||
// 查询是否有其他已分配库位的RFID票
|
||||
List<Task> taskList=taskRepository.findByItemType(BizStatus.PUTAWAY, 1, billTypeCode);
|
||||
if (taskList.size()>0){
|
||||
pointEnd=taskList.get(0).getDstPoint();
|
||||
}
|
||||
//半成品 入库
|
||||
storageType=BizStatus.TP_STO;
|
||||
} else if (billTypeCode.equals(BizStatus.RM_RK)) {
|
||||
|
|
@ -372,15 +379,15 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
i=i+4;
|
||||
}
|
||||
//料箱 入库
|
||||
if (pointStart.getArea().getId()==45){
|
||||
if (agvFlag==1){
|
||||
storageType=BizStatus.LXZ_STO;
|
||||
}else {
|
||||
storageType=BizStatus.LX_STO;
|
||||
storageType=BizStatus.LX;
|
||||
}
|
||||
}
|
||||
if (agvFlag==1) {
|
||||
String stockTypeCode="";
|
||||
// 分配库位 区域
|
||||
if (billTypeCode.equals(BizStatus.RM_RK)){
|
||||
stockTypeCode=BizStatus.LX;
|
||||
}else if (billTypeCode.equals(BizStatus.SM_RK)){
|
||||
|
|
@ -388,6 +395,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
}else if (billTypeCode.equals(BizStatus.FC_RK)){
|
||||
stockTypeCode=BizStatus.CP;
|
||||
}
|
||||
if (pointEnd==null) {
|
||||
// 分配目标库位
|
||||
List<Point> pointEndList = pointRepository.findByCpAreaCode(stockTypeCode);
|
||||
if (pointEndList.size() > 0) {
|
||||
|
|
@ -396,6 +404,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
return ApiResult.fail(500, "没有可用存储库位", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ItemKey itemKey=itemKeyRepository.getByItemKeyPro7(rfid);
|
||||
if (itemKey==null){
|
||||
|
|
@ -406,6 +415,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
}else {
|
||||
return ApiResult.result(500, "重复读取", "");
|
||||
}
|
||||
Task task=null;
|
||||
// 已生成ItemKey
|
||||
{
|
||||
//获取流水号
|
||||
|
|
@ -414,7 +424,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
if (asn.getBillType().getCode().equals(BizStatus.FC_RK)) {
|
||||
taskSum = 1;//按 一张rfid生成一个task
|
||||
} else {
|
||||
if (lsh.length != itemKey.getIntPropC5()) {
|
||||
if (lsh.length != Integer.valueOf(itemKey.getPropC5())) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ApiResult.result(500, "流水号数量和供货数量不一致", "");
|
||||
}
|
||||
|
|
@ -427,8 +437,9 @@ public class TaskServiceImpl implements TaskService {
|
|||
return ApiResult.fail(500,"收货单中没有对应物料",null);
|
||||
}
|
||||
boolean adFlag=false;
|
||||
AsnDetail asnDetail=null;
|
||||
for (int i = 0; i < asnDetailList.size(); i++) {
|
||||
AsnDetail asnDetail=asnDetailList.get(i);
|
||||
asnDetail=asnDetailList.get(i);
|
||||
if (!BizStatus.getBillToStock(asnDetail.getAsn().getBillType().getCode()).equals(item.getGoodType())){
|
||||
return ApiResult.fail(500,"收货单类型错误",null);
|
||||
}
|
||||
|
|
@ -442,29 +453,16 @@ public class TaskServiceImpl implements TaskService {
|
|||
if (adFlag==false){
|
||||
return ApiResult.fail(500,"入库单剩余收货数量小于当前收货数量",null);
|
||||
}
|
||||
for (int i = 0; i < taskSum; i++) {
|
||||
Task task = new Task();
|
||||
task.setPlanQty(Double.valueOf(propC5));//收货数量
|
||||
/*if (asn.getBillType().getCode().equals(BizStatus.FC_RK)) {
|
||||
*//*task.setPlanQty(Double.valueOf(Integer.parseInt(propC5, 16)));//收货数量
|
||||
|
||||
StringBuffer putCode = new StringBuffer();
|
||||
for (int j = xs_start_d; j <=xs_end_d ; j++) {
|
||||
if (putCode.length()<1){
|
||||
putCode.append(j);
|
||||
}
|
||||
}*//*
|
||||
// propC6_start_d = propC6_start_d + xs_d;
|
||||
// task.setPutCode(putCode.toString());//流水号 起止码
|
||||
} else {
|
||||
task.setPutCode(propC6.toString());
|
||||
}*/
|
||||
task = new Task();
|
||||
task.setAsnDetail(asnDetail);
|
||||
task.setPlanQty(Double.valueOf(propC5));//收货数量
|
||||
task.setPutCode(propC6.toString());
|
||||
task.setItemKey(itemKey);
|
||||
task.setDept(UserUtils.getDept());
|
||||
task.setTaskStatus(BizStatus.RECEIVING);
|
||||
task.setBeSkip(agvFlag);
|
||||
task.setBillCode(propC3);
|
||||
task.setBillCode(asn.getRelatedBill2());
|
||||
task.setTaskType(asn.getBillType().getCode());
|
||||
task.setSrcPoint(pointStart);
|
||||
if (pointEnd==null){
|
||||
|
|
@ -474,7 +472,6 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
taskRepository.save(task);
|
||||
}
|
||||
}
|
||||
|
||||
if (agvFlag==1) {
|
||||
/** AGV人工入库*/
|
||||
|
|
@ -489,20 +486,22 @@ public class TaskServiceImpl implements TaskService {
|
|||
return ApiResult.result(200, "操作成功", billTypeCode);
|
||||
}else {
|
||||
/** 人工入库*/
|
||||
Point point=pointStart;
|
||||
point.setStorageType(storageType);
|
||||
pointRepository.save(point);
|
||||
pointStart.setStorageType(storageType);
|
||||
pointStart.setStatus(BaseStatus.USED);
|
||||
pointRepository.save(pointStart);
|
||||
// 生成库存
|
||||
Inventory inventory = addAsnInventory(billTypeCode, point,null,0l,itemKey.getId());
|
||||
Inventory inventory = addAsnInventory(task);
|
||||
}
|
||||
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);
|
||||
public Inventory addAsnInventory(Task task) {
|
||||
Point point=task.getDstPoint();
|
||||
/*List<Task> taskList=new ArrayList<>();
|
||||
taskList.add(task);*/
|
||||
Inventory inventory = inventoryService.asnAddInventoryList(task);
|
||||
if (point.getStatus().equals(BaseStatus.USED)) {
|
||||
point.setStatus(BaseStatus.FREE);
|
||||
// point.setStatus(BaseStatus.FREE);
|
||||
} else {
|
||||
// 人工入库没有选中推荐库位,清除一个库位的占用状态
|
||||
List<Point> pointList = pointRepository.findByAreaCodeCp(inventory.getItemKey().getItem().getGoodType(), BaseStatus.USED);
|
||||
|
|
@ -526,6 +525,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
}
|
||||
pointRepository.save(point);
|
||||
//入库成功 反馈给上游
|
||||
return inventory;
|
||||
}
|
||||
|
||||
|
|
@ -719,7 +719,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
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());
|
||||
Inventory inventory = addAsnInventory(task);
|
||||
/** 库存移位*/
|
||||
if (!task.getDstPoint().getId().equals(pointId)){
|
||||
// 目标位
|
||||
|
|
@ -759,12 +759,11 @@ public class TaskServiceImpl implements TaskService {
|
|||
startPointCode=task.getDstPoint().getBeatCode();
|
||||
}
|
||||
// 第一个任务 先生成AgvTask任务
|
||||
agvTask = agvTaskService.addAgvTask(BizStatus.AGV, storageType, startPointCode, task.getDstPoint().getCode(), BizStatus.OPEN, BizStatus.PICK);
|
||||
// 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,5 +30,7 @@ public class ConstructTest {
|
|||
@PostConstruct
|
||||
public void configUrlApi(){
|
||||
quartzJobService.execution(quartzJobService.findById(3l));
|
||||
quartzJobService.execution(quartzJobService.findById(4l));
|
||||
quartzJobService.execution(quartzJobService.findById(6l));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ package com.youchain.modules.quartz.task;
|
|||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.uhf.api.cls.Reader;
|
||||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.basicdata.domain.BillType;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
|
|
@ -28,7 +29,10 @@ import com.youchain.businessdata.repository.AgvTaskRepository;
|
|||
import com.youchain.businessdata.repository.AsnRepository;
|
||||
import com.youchain.businessdata.service.AgvTaskService;
|
||||
import com.youchain.businessdata.service.AsnService;
|
||||
import com.youchain.exception.BadRequestException;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.modules.system.repository.DeptRepository;
|
||||
import com.youchain.rfid.RfidDocJava;
|
||||
import com.youchain.utils.BaseStatus;
|
||||
import com.youchain.utils.BizStatus;
|
||||
import com.youchain.utils.UrlApi;
|
||||
|
|
@ -65,6 +69,8 @@ public class TestTask {
|
|||
@Autowired
|
||||
private PointRepository pointRepository;
|
||||
@Autowired
|
||||
private DeptRepository deptRepository;
|
||||
@Autowired
|
||||
private AsnRepository asnRepository;
|
||||
@Autowired
|
||||
private AsnService asnService;
|
||||
|
|
@ -97,7 +103,7 @@ public class TestTask {
|
|||
@AnonymousAccess
|
||||
public ResponseEntity<Object> asnTask(){
|
||||
System.out.println("查询Task任务生成AgvTask入库任务");
|
||||
ApiResult apiResult = agvTaskService.addAgvAsn(BizStatus.LX,BizStatus.RM_RK);
|
||||
ApiResult apiResult = agvTaskService.addAgvAsn(BizStatus.RM_RK);
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
// @PostMapping("/asnPutaway")
|
||||
|
|
@ -107,31 +113,58 @@ public class TestTask {
|
|||
UrlApi.containerIn=requestJson.getString("containerIn");
|
||||
UrlApi.containerOut=requestJson.getString("containerOut");
|
||||
UrlApi.submitMission=requestJson.getString("submitMission");
|
||||
UrlApi.sapIpPort=requestJson.getString("sapIpPort");
|
||||
|
||||
System.out.println("更新地址");
|
||||
System.out.println(UrlApi.containerIn);
|
||||
System.out.println(UrlApi.containerOut);
|
||||
System.out.println(UrlApi.submitMission);
|
||||
}
|
||||
public void posBaseStatus(String req){
|
||||
public void LinkOpenRfidDoor(String req){
|
||||
JSONObject requestJson=JSONObject.parseObject(req);
|
||||
String doorPointCode = requestJson.getString("doorPoint");
|
||||
BaseStatus.DoorPoint=pointRepository.findByCode(doorPointCode);
|
||||
RfidDocJava.POWER=requestJson.getIntValue("power");
|
||||
BaseStatus.DoorPoint_BCP_SUM=requestJson.getIntValue("bcp_rfid_sum");
|
||||
BaseStatus.DoorPoint_LX_SUM=requestJson.getIntValue("lx_rfid_sum");
|
||||
String err = RfidDocJava.linkOpen();
|
||||
if (!err.equals("MT_OK_ERR")){
|
||||
throw new BadRequestException(HttpStatus.NOT_IMPLEMENTED, "连接感应门失败:"+err);
|
||||
}
|
||||
}
|
||||
public void TimingSendAgvTask(){
|
||||
// 定时发送任务
|
||||
List<AgvTask> agvTasks=agvTaskRepository.findByTiming();
|
||||
for (int i = 0; i < agvTasks.size(); i++) {
|
||||
agvTaskService.sendAgvTaskImpl(agvTasks.get(i));
|
||||
}
|
||||
}
|
||||
public void posBaseStatus(String req){
|
||||
BaseStatus.Dept=deptRepository.getById(7l);
|
||||
|
||||
JSONObject requestJson=JSONObject.parseObject(req);
|
||||
// 感应门终点编码
|
||||
String doorPointCodeEnd = requestJson.getString("DoorPointEnd");
|
||||
BaseStatus.DoorPoint=pointRepository.findByCode(doorPointCodeEnd);
|
||||
|
||||
// 启动感应门 编码
|
||||
String DoorPointStart = requestJson.getString("DoorPointStart");
|
||||
BaseStatus.DoorPointEd=pointRepository.findByCode(DoorPointStart);
|
||||
// 料箱货架去 点位
|
||||
String LxZPointCode = requestJson.getString("LxZPoint");
|
||||
BaseStatus.LxZPoint=pointRepository.findByCode(LxZPointCode);
|
||||
// 感应门编码解析RFID规则 长度
|
||||
JSONObject rfidVerify = requestJson.getJSONObject("RfidVerify");
|
||||
BaseStatus.lengthVerifyList = JSONObject.parseArray(rfidVerify.getJSONArray("LengthList").toJSONString(),Long.class);
|
||||
|
||||
}
|
||||
@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);
|
||||
Point point=pointRepository.getById(BaseStatus.DoorPoint.getId());
|
||||
String st = point.getStorageType();
|
||||
if (st.equals("BTP")){
|
||||
agvTaskService.addTaskRfid(BizStatus.BCP);
|
||||
}else if (st.equals("LXZ")){
|
||||
agvTaskService.addTaskRfid(BizStatus.LX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,46 @@
|
|||
package com.youchain.rfid;
|
||||
|
||||
import com.uhf.api.cls.*;
|
||||
import com.uhf.api.cls.Reader.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import com.uhf.api.cls.BackReadOption;
|
||||
import com.uhf.api.cls.GpiInfo_ST;
|
||||
import com.uhf.api.cls.GpiTriggerBoundaryListener;
|
||||
import com.uhf.api.cls.GpiTriggerBoundaryReasonType;
|
||||
import com.uhf.api.cls.GpiTriggerBoundaryType;
|
||||
import com.uhf.api.cls.GpiTriggerListener;
|
||||
import com.uhf.api.cls.GpiTrigger_Type;
|
||||
import com.uhf.api.cls.ReadExceptionListener;
|
||||
import com.uhf.api.cls.ReadListener;
|
||||
import com.uhf.api.cls.Reader;
|
||||
import com.uhf.api.cls.Reader.AntPower;
|
||||
import com.uhf.api.cls.Reader.AntPowerConf;
|
||||
import com.uhf.api.cls.Reader.EmbededData_ST;
|
||||
import com.uhf.api.cls.Reader.Inv_Potl;
|
||||
import com.uhf.api.cls.Reader.Inv_Potls_ST;
|
||||
import com.uhf.api.cls.Reader.Lock_Obj;
|
||||
import com.uhf.api.cls.Reader.Lock_Type;
|
||||
import com.uhf.api.cls.Reader.Mtr_Param;
|
||||
import com.uhf.api.cls.Reader.READER_ERR;
|
||||
import com.uhf.api.cls.Reader.SL_TagProtocol;
|
||||
import com.uhf.api.cls.Reader.TAGINFO;
|
||||
import com.uhf.api.cls.Reader.TagFilter_ST;
|
||||
import com.youchain.utils.BaseStatus;
|
||||
|
||||
public class LongTermAsyncRead extends JFrame{
|
||||
Vector<String> vt=new Vector<String>();
|
||||
|
||||
JButton jbt1;
|
||||
JButton jbt2;
|
||||
Vector<String> vt=new Vector<String>();
|
||||
|
||||
JList jlist;
|
||||
ReaderExceptionChecker rechecker = new ReaderExceptionChecker(3, 60);
|
||||
|
||||
|
|
@ -31,7 +55,6 @@ public class LongTermAsyncRead extends JFrame{
|
|||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
vt.clear();
|
||||
// TODO Auto-generated method stub
|
||||
if (StartReadTags()!= READER_ERR.MT_OK_ERR)
|
||||
{
|
||||
|
|
@ -41,7 +64,6 @@ public class LongTermAsyncRead extends JFrame{
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
jbt2=new JButton("停止盘存");
|
||||
jbt2.addActionListener(new ActionListener(){
|
||||
|
||||
|
|
@ -161,16 +183,23 @@ public class LongTermAsyncRead extends JFrame{
|
|||
//System.out.println("update ui ...");
|
||||
for(int i=0;i<tag.length;i++)
|
||||
{
|
||||
if(tag[i].EmbededDatalen==0)
|
||||
vt.add(Reader.bytes_Hexstr(tag[i].EpcId));
|
||||
String v=Reader.bytes_Hexstr(tag[i].EpcId);
|
||||
// RFID长度验证
|
||||
boolean flag = BaseStatus.lengthVerifyList.contains(Long.valueOf(v.length()));
|
||||
if (flag) {
|
||||
vt.add(Reader.bytes_Hexstr(tag[i].EpcId)+"天线:"+tag[i].AntennaID);
|
||||
}
|
||||
|
||||
/*if(tag[i].EmbededDatalen==0)
|
||||
vt.add(Reader.bytes_Hexstr(tag[i].EpcId)+"天线:"+tag[i].ReadCnt);
|
||||
else
|
||||
vt.add(Reader.bytes_Hexstr(tag[i].EpcId)+" "+Reader.bytes_Hexstr(tag[i].EmbededData));
|
||||
vt.add(Reader.bytes_Hexstr(tag[i].EpcId)+" "+Reader.bytes_Hexstr(tag[i].EmbededData));*/
|
||||
}
|
||||
// 去重
|
||||
HashSet set = new HashSet(vt);
|
||||
vt= new Vector(set);
|
||||
|
||||
jlist.setListData(vt);
|
||||
|
||||
}
|
||||
});
|
||||
//*/
|
||||
|
|
@ -283,8 +312,6 @@ public class LongTermAsyncRead extends JFrame{
|
|||
int portnum = 4; //注意是读写器天线端口数,不是已连接数量
|
||||
rdr=new Reader();
|
||||
err = rdr.InitReader_Notype("192.168.0.224",4);
|
||||
err = rdr.ParamSet(Reader.Mtr_Param.MTR_PARAM_RF_MAXPOWER, new int[]{0});
|
||||
|
||||
System.out.println("connect:"+err.toString());
|
||||
if (err != READER_ERR.MT_OK_ERR)
|
||||
return err;
|
||||
|
|
@ -296,8 +323,7 @@ public class LongTermAsyncRead extends JFrame{
|
|||
|
||||
//获取读写器最大发射功率
|
||||
int[] maxpower=new int[1];
|
||||
err=rdr.ParamGet(Mtr_Param.MTR_PARAM_RF_MAXPOWER, maxpower);
|
||||
//*
|
||||
maxpower[0]=2200;
|
||||
if (err != READER_ERR.MT_OK_ERR)
|
||||
return err;
|
||||
|
||||
|
|
@ -395,15 +421,15 @@ public class LongTermAsyncRead extends JFrame{
|
|||
//本例只使用天线1进行盘存,如果要使用多个天线则只需要将使用的天线编
|
||||
//号赋值到数组ants中,例如同时使用天线1和2,则代码应该改为ants[0] = 1;
|
||||
//ants[1] = 2;antcnt = 2;
|
||||
int antcnt=1;
|
||||
int[] ants=new int[antcnt];
|
||||
for(int i=0;i<antcnt;i++)
|
||||
ants[i]=i+1;
|
||||
int antcnt=4;
|
||||
int[] ants=new int[]{1,2,3,4};
|
||||
/*for(int i=0;i<antcnt;i++)
|
||||
ants[i]=i+1;*/
|
||||
/*是否采用高速模式(目前只有slr11xx和slr12xx系列读写器才支持),对于
|
||||
*一般标签数量不大,速度不快的应用没有必要使用高速模式,本例没有设置
|
||||
*使用高速模式
|
||||
* */
|
||||
m_BROption.IsFastRead = true;//采用非高速模式盘存标签
|
||||
m_BROption.IsFastRead = false;//采用非高速模式盘存标签
|
||||
|
||||
|
||||
///非高速盘存模式下必须要设置的参数*******************************************
|
||||
|
|
@ -519,5 +545,4 @@ public class LongTermAsyncRead extends JFrame{
|
|||
LongTermAsyncRead fm=new LongTermAsyncRead(300,650);
|
||||
|
||||
}
|
||||
//*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,18 @@
|
|||
package com.youchain.rfid;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 用于统计读写器发生断线和异常的频率,读写器工作的时候由于网络连接和外部环境(比
|
||||
* 如有金属物体紧贴天线或者有外物撞击了天线导致天线连接断开)都有可能造成工作中断,
|
||||
* 如果引起异常的外部因素只是偶尔出现,重新初始化读写器一般都能继续工作。如果发生
|
||||
* 的频率很高则应该检查网络或读写器安装部署环境是否有问题。此类的构造函数包含两个
|
||||
* 参数,参数1是发生异常的最大次数,参数2则规定了一个时间段(单位为秒),例如参数1
|
||||
* 设置为3,参数2设置为60,则具体含义为:如果读写器在60秒内发生了3次异常则IsTrigger
|
||||
* 方法则会返回true,表示读写器发生异常的频率过高,超过了构造函数设置的门限值。
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD>ƶ<EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߺ<EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD>Ƶ<EFBFBD>ʣ<EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӻ<EFBFBD><EFBFBD>ⲿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* <EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӶϿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>п<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϣ<EFBFBD>
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD>ż<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><EFBFBD><EFBFBD><EFBFBD>³<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD>һ<EFBFBD>㶼<EFBFBD>ܼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* <EFBFBD><EFBFBD>Ƶ<EFBFBD>ʺܸ<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ü<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⡣<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD>涨<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>Σ<EFBFBD><EFBFBD><EFBFBD>λΪ<EFBFBD>룩<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ60<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>庬<EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>60<EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD>IsTrigger
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>᷵<EFBFBD><EFBFBD>true<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD>Ƶ<EFBFBD>ʹ<EFBFBD><EFBFBD>ߣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˹<EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>
|
||||
* */
|
||||
public class ReaderExceptionChecker {
|
||||
public ReaderExceptionChecker(int maxerrcnt, int dursec)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,218 @@
|
|||
package com.youchain.rfid;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.functions.Length;
|
||||
import com.uhf.api.cls.BackReadOption;
|
||||
import com.uhf.api.cls.ReadExceptionListener;
|
||||
import com.uhf.api.cls.ReadListener;
|
||||
import com.uhf.api.cls.Reader;
|
||||
import com.uhf.api.cls.Reader.READER_ERR;
|
||||
import com.youchain.basicdata.domain.LampLog;
|
||||
import com.youchain.utils.BaseStatus;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
public class RfidDocJava {
|
||||
public static String ip="192.168.0.224";
|
||||
public static int POWER=3300;
|
||||
public static Reader rdr = null;
|
||||
private static HashSet vt;
|
||||
// Vector<String> vt=new Vector<String>();
|
||||
|
||||
public static void main(String[] args) {
|
||||
HashSet rfids = RfidDocJava.readRfid();
|
||||
System.out.println(rfids);
|
||||
}
|
||||
public static String linkOpen(){
|
||||
RfidDocJava rfidDocJava=new RfidDocJava();
|
||||
return rfidDocJava.OpenReader().toString();// 初始化
|
||||
}
|
||||
public static HashSet<String> readRfid(){
|
||||
RfidDocJava rfidDocJava=new RfidDocJava();
|
||||
/*try {
|
||||
Thread.sleep(3000);
|
||||
}catch (Exception e){
|
||||
|
||||
}*/
|
||||
rfidDocJava.stopRead();
|
||||
return vt;
|
||||
}
|
||||
public static void startRfid(){
|
||||
RfidDocJava rfidDocJava=new RfidDocJava();
|
||||
rfidDocJava.startRead();
|
||||
}
|
||||
public void startRead(){
|
||||
vt=new HashSet();
|
||||
StartReadTags();
|
||||
}
|
||||
public void stopRead(){
|
||||
rdr.StopReading();
|
||||
}
|
||||
READER_ERR StartReadTags()
|
||||
{
|
||||
//初始化结BackReadOption
|
||||
BackReadOption m_BROption=new BackReadOption();
|
||||
//本例只使用天线1进行盘存,如果要使用多个天线则只需要将使用的天线编
|
||||
//号赋值到数组ants中,例如同时使用天线1和2,则代码应该改为ants[0] = 1;
|
||||
//ants[1] = 2;antcnt = 2;
|
||||
int antcnt=4;
|
||||
int[] ants=new int[]{1,2,3,4};
|
||||
/*是否采用高速模式(目前只有slr11xx和slr12xx系列读写器才支持),对于
|
||||
*一般标签数量不大,速度不快的应用没有必要使用高速模式,本例没有设置
|
||||
*使用高速模式
|
||||
* */
|
||||
m_BROption.IsFastRead = true;//采用非高速模式盘存标签
|
||||
|
||||
|
||||
///非高速盘存模式下必须要设置的参数*******************************************
|
||||
//盘存周期,单位为ms,可根据实际使用的天线个数按照每个天线需要200ms
|
||||
//的方式计算得出,如果启用高速模式则此选项没有任何意义,可以设置为
|
||||
//任意值,或者干脆不设置
|
||||
m_BROption.ReadDuration = (short)(200 * antcnt);
|
||||
//盘存周期间的设备不工作时间,单位为ms,一般可设置为0,增加设备不工作
|
||||
//时间有利于节电和减少设备发热(针对某些使用电池供电或空间结构不利
|
||||
//于散热的情况会有帮助)
|
||||
m_BROption.ReadInterval = 0;
|
||||
//****************************************************************************
|
||||
|
||||
|
||||
//高速盘存模式参数设置********************************************************
|
||||
//以下为选择使用高速模式才起作用的选项参,照如下设置即可,如果使能高速
|
||||
//模式,即把IsFastRead设置为true则,只需取消以下被注释的代码即可
|
||||
//*
|
||||
//高速模式下为取得最佳效果设置为0即可
|
||||
m_BROption.FastReadDutyRation = 0;
|
||||
//标签信息是否携带识别天线的编号
|
||||
m_BROption.TMFlags.IsAntennaID = true;
|
||||
//标签信息是否携带标签识别次数
|
||||
m_BROption.TMFlags.IsReadCnt = false;
|
||||
//标签信息是否携带识别标签时的信号强度
|
||||
m_BROption.TMFlags.IsRSSI = false;
|
||||
//标签信息是否携带时间戳
|
||||
m_BROption.TMFlags.IsTimestamp = false;
|
||||
//标签信息是否携带识别标签时的工作频点
|
||||
m_BROption.TMFlags.IsFrequency = false;
|
||||
//标签信息是否携带识别标签时同时读取的其它bank数据信息,如果要获取在
|
||||
//盘存时同时读取其它bank的信息还必须设置MTR_PARAM_TAG_EMBEDEDDATA参数,
|
||||
//(目前只有slr11xx和slr12xx系列读写器才支持)
|
||||
m_BROption.TMFlags.IsEmdData = false;
|
||||
//保留字段,可始终设置为0
|
||||
m_BROption.TMFlags.IsRFU = false;
|
||||
return rdr.StartReading(ants, antcnt, m_BROption);
|
||||
}
|
||||
READER_ERR OpenReader()
|
||||
{
|
||||
READER_ERR err = READER_ERR.MT_OK_ERR;
|
||||
if (rdr != null)
|
||||
{
|
||||
rdr.CloseReader();
|
||||
rdr=null;
|
||||
}
|
||||
//初始化读写器实例************************************************************
|
||||
//当使用设备的串口进行连接的时候,InitReader_Notype函数的第一个参数也可
|
||||
//能是串口号(例如com1)当设备仅有一个天线端口时(例如一体机或者发卡器),
|
||||
//InitReader_Notype函数的第二个参数也可能为1
|
||||
//读写器出厂默认IP为192.168.1.100 com4
|
||||
int portnum = 4; //注意是读写器天线端口数,不是已连接数量
|
||||
rdr=new Reader();
|
||||
err =rdr.InitReader_Notype(ip, portnum);
|
||||
System.out.println("connect:"+err.toString());
|
||||
if (err != READER_ERR.MT_OK_ERR)
|
||||
return err;
|
||||
//****************************************************************************
|
||||
|
||||
//以下为必须要设置的参数和事件回调处理函数************************************
|
||||
//设置读写器发射功率,本例设置为最大发射功率,可根据实际情况调整,
|
||||
//一般来说,功率越大则识别距离越远
|
||||
|
||||
//获取读写器最大发射功率
|
||||
int[] maxpower=new int[1];
|
||||
maxpower[0]=POWER;
|
||||
/*err=rdr.ParamGet(Reader.Mtr_Param.MTR_PARAM_RF_MAXPOWER, maxpower);
|
||||
//*
|
||||
if (err != READER_ERR.MT_OK_ERR)
|
||||
return err;*/
|
||||
|
||||
Reader.AntPowerConf apcf=rdr.new AntPowerConf();
|
||||
apcf.antcnt=portnum;
|
||||
for(int i=0;i<apcf.antcnt;i++)
|
||||
{
|
||||
Reader.AntPower jaap=rdr.new AntPower();
|
||||
jaap.antid=i+1;
|
||||
jaap.readPower=(short)maxpower[0];
|
||||
jaap.writePower=(short)maxpower[0];
|
||||
apcf.Powers[i]=jaap;
|
||||
}
|
||||
err=rdr.ParamSet( Reader.Mtr_Param.MTR_PARAM_RF_ANTPOWER, apcf);
|
||||
//*
|
||||
if (err != READER_ERR.MT_OK_ERR)
|
||||
return err;
|
||||
|
||||
//设置读写器执行GEN2空中接口协议
|
||||
Reader.Inv_Potls_ST ipst=rdr.new Inv_Potls_ST();
|
||||
ipst.potlcnt=1;
|
||||
ipst.potls=new Reader.Inv_Potl[1];
|
||||
for(int i=0;i<ipst.potlcnt;i++)
|
||||
{
|
||||
Reader.Inv_Potl ipl=rdr.new Inv_Potl();
|
||||
ipl.weight=30;
|
||||
ipl.potl= Reader.SL_TagProtocol.SL_TAG_PROTOCOL_GEN2;
|
||||
ipst.potls[0]=ipl;
|
||||
}
|
||||
//不用检查返回值,不会失败
|
||||
err= rdr.ParamSet(Reader.Mtr_Param.MTR_PARAM_TAG_INVPOTL, ipst);
|
||||
|
||||
|
||||
//设置盘存到标签时的回调处理函数
|
||||
rdr.addReadListener(RL);
|
||||
//*
|
||||
//设置读写器发生错误时的回调处理函数
|
||||
rdr.addReadExceptionListener(REL);
|
||||
//****************************************************************************
|
||||
|
||||
//以下为根据应用需求可能要设置的参数******************************************
|
||||
//*
|
||||
//标签数量比较大,且移动速度缓慢或静止不动,设置为Session1可取得更
|
||||
//好效果,反之标签数量较少移动速度较快应设置为Session0,读写器默认
|
||||
//为Session0
|
||||
|
||||
int[] gen2session=new int[]{1};
|
||||
err =rdr.ParamSet(Reader.Mtr_Param.MTR_PARAM_POTL_GEN2_SESSION, gen2session);
|
||||
if (err != READER_ERR.MT_OK_ERR)
|
||||
return err;
|
||||
return READER_ERR.MT_OK_ERR;
|
||||
}
|
||||
ReadListener RL=new ReadListener()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void tagRead(Reader r, final Reader.TAGINFO[] tag) {
|
||||
// TODO Auto-generated method stub
|
||||
SwingUtilities.invokeLater(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
for(int i=0;i<tag.length;i++){
|
||||
String v=Reader.bytes_Hexstr(tag[i].EpcId);
|
||||
// RFID长度验证
|
||||
boolean flag = BaseStatus.lengthVerifyList.contains(Long.valueOf(v.length()));
|
||||
if (flag) {
|
||||
vt.add(Reader.bytes_Hexstr(tag[i].EpcId));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
ReadExceptionListener REL=new ReadExceptionListener()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void tagReadException(Reader reader, READER_ERR readerErr) {
|
||||
System.out.println("读写器错误");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
package com.youchain.rfid;
|
||||
|
||||
|
||||
import com.uhf.api.cls.BackReadOption;
|
||||
import com.uhf.api.cls.JniModuleAPI;
|
||||
import com.uhf.api.cls.Reader;
|
||||
import com.uhf.api.cls.Reader.READER_ERR;
|
||||
import com.youchain.annotation.AnonymousAccess;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/bool")
|
||||
public class rfidDocJava extends JFrame {
|
||||
@PostMapping("/readRfid")
|
||||
@AnonymousAccess
|
||||
public void readRfid() {
|
||||
System.out.println("读取");
|
||||
int[] ants = new int[]{1,2, 3, 4};
|
||||
BackReadOption Brop = new BackReadOption();
|
||||
Brop.ReadDuration = 200;
|
||||
Brop.ReadInterval = 10;
|
||||
Brop.IsFastRead = false;
|
||||
Brop.IsGPITrigger = false;
|
||||
Reader rdr=new Reader();
|
||||
READER_ERR err = rdr.InitReader_Notype("192.168.0.224",4);
|
||||
READER_ERR err1 = rdr.StartReading(ants, 3, Brop);
|
||||
}
|
||||
// public static Reader rdr=null;
|
||||
public static void main(String[] args) {
|
||||
/*Reader rdr=null;
|
||||
if (rdr != null)
|
||||
rdr.CloseReader();
|
||||
rdr=null;
|
||||
}*/
|
||||
Reader rdr=new Reader();
|
||||
int[] ants = new int[]{1,2, 3, 4};
|
||||
BackReadOption prop = new BackReadOption();
|
||||
prop.ReadDuration = 200;
|
||||
prop.ReadInterval = 10;
|
||||
prop.IsFastRead = false;
|
||||
prop.IsGPITrigger = false;
|
||||
Reader.READER_ERR err = rdr.InitReader_Notype("192.168.0.224",4);
|
||||
Reader.READER_ERR err1 = rdr.StartReading(ants, 3, prop);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,11 @@
|
|||
package com.youchain.utils;
|
||||
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
|
|
@ -44,7 +49,13 @@ public class BaseStatus {
|
|||
*/
|
||||
public static String EMPTY = "EMPTY";
|
||||
public static Point DoorPoint = null;
|
||||
|
||||
public static Point DoorPointEd = null;
|
||||
//料箱载具 货位
|
||||
public static Point LxZPoint = null;
|
||||
public static List<Long> lengthVerifyList= Arrays.asList(86l, 124l);
|
||||
public static Dept Dept;
|
||||
public static int DoorPoint_BCP_SUM=50;
|
||||
public static int DoorPoint_LX_SUM=3;
|
||||
/** 锁*/
|
||||
public static class Lock{
|
||||
/** RFID-上架*/
|
||||
|
|
|
|||
|
|
@ -87,6 +87,10 @@ public interface BizStatus {
|
|||
* 入库任务
|
||||
*/
|
||||
public static String ASN = "ASN";
|
||||
/**
|
||||
* 上架
|
||||
*/
|
||||
public static String PUT = "PUT";
|
||||
/**
|
||||
* 出库任务
|
||||
*/
|
||||
|
|
@ -115,6 +119,8 @@ public interface BizStatus {
|
|||
* 库存日志-拆托
|
||||
*/
|
||||
public static String MODIFY_LOT = "MODIFY_LOT";
|
||||
/** 删除*/
|
||||
public static String DEL = "DEL";
|
||||
/**
|
||||
* 库存日志-状态调整
|
||||
*/
|
||||
|
|
@ -243,7 +249,7 @@ public interface BizStatus {
|
|||
String CTP_STO="CTP";
|
||||
String CTPMode="K-MRES叉车模型";
|
||||
/*容器类型stockType-半成品托盘*/
|
||||
String TP_STO="TP";
|
||||
String TP_STO="BTP";
|
||||
String TPMode="K-MRES潜伏车模型";
|
||||
String BCP_PT="BCP_PT";
|
||||
/** AGV出库*/
|
||||
|
|
@ -268,11 +274,11 @@ public interface BizStatus {
|
|||
}
|
||||
static String getBillToAgv(String billTypeCode) {
|
||||
if (billTypeCode.equals(BizStatus.FC_RK)){
|
||||
return BizStatus.CP;
|
||||
return "CTP";
|
||||
} else if (billTypeCode.equals(BizStatus.SM_RK)) {
|
||||
return BizStatus.BCP;
|
||||
return "BTP";
|
||||
} else if (billTypeCode.equals(BizStatus.RM_RK)) {
|
||||
return BizStatus.LX;
|
||||
return "LXZ";
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package com.youchain.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
|
||||
public class UrlApi {
|
||||
/**
|
||||
|
|
@ -32,7 +35,103 @@ public class UrlApi {
|
|||
* 输送线点位查询
|
||||
*/
|
||||
public static String QueryCount="http://10.177.188.11:4080/webapi/mes/QueryCount";
|
||||
public static String sapIpPort="http://192.168.0.201:8092";
|
||||
/** 入库单反馈*/
|
||||
public static String asnBack = UrlApi.asnBack = sapIpPort+"/synq/expected-receipts/check-in-confirmation";
|
||||
/**
|
||||
* 入库完成反馈
|
||||
* @param owner 货主
|
||||
* @param expectedReceiptId 登记单号
|
||||
* @param lineNumber 行号
|
||||
* @param productId sku
|
||||
* @param quantityExpected 期望数量
|
||||
* @param quantityReceived 收货数量
|
||||
* */
|
||||
public static void asnBackSap(String owner,String expectedReceiptId,String productId,String lineNumber
|
||||
,String quantityExpected,String quantityReceived) {
|
||||
JSONObject paramsJson=new JSONObject();
|
||||
JSONArray erLine=new JSONArray();
|
||||
JSONObject er = new JSONObject();
|
||||
er.put("lineNumber", lineNumber);
|
||||
er.put("quantityExpected", quantityExpected);
|
||||
er.put("quantityReceived", quantityReceived);
|
||||
er.put("productId", productId);
|
||||
erLine.add(er);
|
||||
paramsJson.put("erLine",erLine);
|
||||
String res = HttpPutUtil.sendPutReq(asnBack+"/"+owner+"/"+expectedReceiptId,paramsJson.toString());
|
||||
}
|
||||
/** 出库单反馈*/
|
||||
public static String ptBack = sapIpPort+"/synq/orders/pick-confirmation";
|
||||
/**
|
||||
* 出库完成反馈
|
||||
* @param owner 货主
|
||||
* @param expectedReceiptId 登记单号
|
||||
* @param orderLineNumber 行号
|
||||
* @param productId sku
|
||||
* @param quantity 出库数量
|
||||
* @param ztBidNameValue 中标批次名称
|
||||
* @param prodMtrlNoValue 成品物料编码
|
||||
* */
|
||||
public static void ptBackSap(String owner,String expectedReceiptId,String productId,String orderLineNumber
|
||||
,String quantity,String ztBidNameValue,String prodMtrlNoValue) {
|
||||
JSONObject paramsJson=new JSONObject();
|
||||
JSONArray orderLine=new JSONArray();
|
||||
JSONObject order = new JSONObject();
|
||||
order.put("orderLineNumber", orderLineNumber);
|
||||
order.put("quantity", quantity);
|
||||
order.put("productId", productId);
|
||||
JSONArray attributeValue=new JSONArray();
|
||||
JSONObject ztBidName=new JSONObject();
|
||||
ztBidName.put("name", "ztBidName");
|
||||
ztBidName.put("value", ztBidNameValue);
|
||||
attributeValue.add(ztBidName);
|
||||
JSONObject prodMtrlNo=new JSONObject();
|
||||
prodMtrlNo.put("name", "prodMtrlNo");
|
||||
prodMtrlNo.put("value", prodMtrlNoValue);
|
||||
attributeValue.add(prodMtrlNo);
|
||||
|
||||
order.put("attributeValue",attributeValue);
|
||||
orderLine.add(order);
|
||||
paramsJson.put("orderLine",orderLine);
|
||||
String res = HttpPutUtil.sendPutReq(ptBack+"/"+owner+"/"+expectedReceiptId,paramsJson.toString());
|
||||
}
|
||||
/** 库存调整反馈*/
|
||||
public static String invBack = UrlApi.asnBack = sapIpPort+"/synq/load-units/batch-update";
|
||||
|
||||
/**
|
||||
* 库存调整反馈
|
||||
* @param owner 货主
|
||||
* @param productId sku
|
||||
* @param quantity 调整后数量
|
||||
* @param quantityed 调整前数量
|
||||
* @param ztBidNameValue 中标批次名称
|
||||
* @param prodMtrlNoValue 成品物料编码
|
||||
* @param reason 备注
|
||||
*/
|
||||
public static void invBackSap(String owner,String productId
|
||||
,String quantity,String quantityed,String ztBidNameValue
|
||||
,String prodMtrlNoValue,String reason){
|
||||
JSONObject paramsJson=new JSONObject();
|
||||
JSONArray loadUnit=new JSONArray();
|
||||
JSONObject load = new JSONObject();
|
||||
load.put("productId",productId);
|
||||
load.put("productOwner",owner);
|
||||
load.put("quantityOnHand",quantity);
|
||||
load.put("prevQuantityOnHand",quantityed);
|
||||
load.put("reasonCode",reason);
|
||||
JSONArray attributeValue=new JSONArray();
|
||||
JSONObject ztBidName=new JSONObject();
|
||||
ztBidName.put("name", "ztBidName");
|
||||
ztBidName.put("value", ztBidNameValue);
|
||||
attributeValue.add(ztBidName);
|
||||
JSONObject prodMtrlNo=new JSONObject();
|
||||
prodMtrlNo.put("name", "prodMtrlNo");
|
||||
prodMtrlNo.put("value", prodMtrlNoValue);
|
||||
attributeValue.add(prodMtrlNo);
|
||||
load.put("attributeValue",attributeValue);
|
||||
loadUnit.add(load);
|
||||
paramsJson.put("loadUnit",loadUnit);
|
||||
String res = HttpPutUtil.sendPutReq(ptBack,paramsJson.toString());
|
||||
}
|
||||
public static Point DoorPoint;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,13 @@ import java.util.List;
|
|||
@Slf4j
|
||||
public class UserUtils {
|
||||
public static Dept getDept(){
|
||||
List<Long> dataScopes = SecurityUtils.getCurrentUserDataScope();
|
||||
Dept dept=new Dept();
|
||||
|
||||
List<Long> dataScopes = SecurityUtils.getCurrentUserDataScope();
|
||||
if(dataScopes.size()>0){
|
||||
dept.setId(dataScopes.get(0));
|
||||
}else{
|
||||
dept.setId(0L);
|
||||
dept.setId(7L);
|
||||
}
|
||||
log.error(JSONUtil.toJsonStr("用户仓库ID:"+dept.getId()));
|
||||
return dept;
|
||||
|
|
|
|||
Loading…
Reference in New Issue