no message
parent
b4ad892629
commit
4a77f075a0
|
|
@ -2,15 +2,74 @@ package com.youchain.utils;
|
|||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.youchain.exception.BadRequestException;
|
||||
import org.apache.commons.compress.utils.IOUtils;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
public class HttpPostUtil {
|
||||
public static String sendPostReq(String api_url, String request){
|
||||
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){
|
||||
System.out.println("接口任务下发:"+api_url+":"+request);
|
||||
InputStream instr = null;
|
||||
String str = "";
|
||||
try {
|
||||
|
|
@ -36,15 +95,9 @@ public class HttpPostUtil {
|
|||
}
|
||||
str = ResponseString;
|
||||
}catch (Exception e){
|
||||
System.out.println("接口异常!");
|
||||
// throw new Error(e.getMessage());
|
||||
throw new BadRequestException(HttpStatus.NOT_IMPLEMENTED, "接口调用异常"+api_url+request);
|
||||
}
|
||||
/*JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.accumulate("code", "0");
|
||||
jsonObject.accumulate("message", "");
|
||||
jsonObject.accumulate("success", true);
|
||||
jsonObject.accumulate("data", "");
|
||||
str= JSONUtil.toJsonStr(jsonObject.toString());*/
|
||||
System.out.println("接口任务返回:"+str);
|
||||
return str;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,9 +127,6 @@
|
|||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<!-- 打包 -->
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@Api(hidden = true)
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement
|
||||
@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class})
|
||||
//@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class})
|
||||
@EnableJpaAuditing(auditorAwareRef = "auditorAware")
|
||||
|
||||
public class AppRun {
|
||||
|
|
|
|||
|
|
@ -117,8 +117,8 @@ public class SceneAppController {
|
|||
}
|
||||
|
||||
@PostMapping("/asn/rqRkSub")
|
||||
@Log("app接口》半成品/料箱 AGV入库-容器入库")
|
||||
@ApiOperation("半成品/料箱 AGV入库-容器入库")
|
||||
@Log("app接口》半成品/料箱 AGV入库-RFID容器入场")
|
||||
@ApiOperation("半成品/料箱 AGV入库-RFID容器入场")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> rqRkSub(@RequestBody String data) {
|
||||
JSONObject jsonObject=JSONObject.parseObject(data);
|
||||
|
|
@ -126,6 +126,9 @@ public class SceneAppController {
|
|||
Box box=boxRepository.getById(taskId);
|
||||
String stockType = BizStatus.getBillToStock(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){
|
||||
|
|
@ -137,11 +140,10 @@ public class SceneAppController {
|
|||
@Log("app接口》成品/料箱 人工入库-确定收货")
|
||||
@ApiOperation("成品/料箱 人工入库-确定收货")
|
||||
@AnonymousAccess
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseEntity<Object> rkSub(@RequestBody JSONObject request) {
|
||||
String rfid=request.getString("rfid");
|
||||
int agvFlag=request.getIntValue("agvFlag");
|
||||
Point point= pointRepository.findByCode(request.getString("pointCode"));
|
||||
Point point= pointRepository.findByName(request.getString("pointCode"));
|
||||
// 人工入库 直接生成库存
|
||||
ApiResult apiResult = taskService.manualReceiving(rfid,point,agvFlag);
|
||||
if (point.getType().equals(BaseStatus.BOX)){
|
||||
|
|
@ -159,11 +161,12 @@ public class SceneAppController {
|
|||
@AnonymousAccess
|
||||
public ResponseEntity<Object> sjTaskList(@RequestBody(required=false) String request) {
|
||||
List<Map<String, Object>> taskList;
|
||||
if (request==null) {
|
||||
JSONObject requestJson=JSONObject.parseObject(request);
|
||||
String rfid=requestJson.getString("rfid");
|
||||
if (rfid.length()<1) {
|
||||
taskList = taskRepository.findBySjTask();
|
||||
}else {
|
||||
JSONObject requestJson=JSONObject.parseObject(request);
|
||||
String rfid=requestJson.getString("rfid");
|
||||
|
||||
taskList = taskRepository.findBySjTask(rfid);
|
||||
// 人工入库 直接生成库存
|
||||
if (taskList==null||taskList.size()<1){
|
||||
|
|
@ -220,6 +223,10 @@ public class SceneAppController {
|
|||
@Transactional
|
||||
public ResponseEntity<Object> bcpRgRkSub(@RequestBody JSONObject request) {
|
||||
Point point= pointRepository.findByCode(request.getString("pointCode"));
|
||||
if (point==null){
|
||||
ApiResult apiResult=ApiResult.fail(500,"点位错误","");
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
int agvFlag=request.getIntValue("agvFlag");
|
||||
JSONArray tableList=request.getJSONArray("tableList");
|
||||
int apiCode=200;
|
||||
|
|
@ -227,21 +234,34 @@ public class SceneAppController {
|
|||
for (int i = 0; i < tableList.size(); i++) {
|
||||
JSONObject tableSize=tableList.getJSONObject(i);
|
||||
String rfid=tableSize.getString("rfid");
|
||||
String id=tableSize.getString("id");
|
||||
ApiResult apiResult = taskService.manualReceiving(rfid,point,agvFlag);
|
||||
JSONObject data=new JSONObject();
|
||||
//如果物料不是半成品
|
||||
String itemCode=rfid.substring(0, 9);
|
||||
Item item=itemRepository.findByCode(itemCode);
|
||||
|
||||
String id = tableSize.getString("id");
|
||||
String status = tableSize.getString("status");
|
||||
ApiResult apiResult;
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("id", id);
|
||||
apiResult.setData(data);
|
||||
data.put("rfid", rfid);
|
||||
if (!item.getGoodType().equals(BizStatus.BCP)){
|
||||
apiResult=ApiResult.fail(500,"非半成品",null);
|
||||
System.out.println();
|
||||
}else {
|
||||
apiResult = taskService.manualReceiving(rfid, point, agvFlag);
|
||||
}
|
||||
data.put("status", apiResult.getMessage());
|
||||
if (apiResult.getStatus()!=200){
|
||||
apiCode=500;
|
||||
}
|
||||
apiData.add(apiResult);
|
||||
apiData.add(data);
|
||||
}
|
||||
String msg="解析完成-操作成功";
|
||||
if (apiCode!=200){
|
||||
msg="解析完成-操作失败";
|
||||
//回滚
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
// apiCode=200;
|
||||
}
|
||||
ApiResult apiResult=ApiResult.fail(apiCode,msg,apiData);
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
|
|
@ -251,15 +271,16 @@ public class SceneAppController {
|
|||
@ApiOperation("半成品人工入库-推荐库位")
|
||||
@AnonymousAccess
|
||||
@Transactional
|
||||
public ResponseEntity<Object> bcpRgRkTjPoint(@RequestBody String type) {
|
||||
System.out.println(type);
|
||||
public ResponseEntity<Object> bcpRgRkTjPoint(@RequestBody JSONObject request) {
|
||||
String type=request.getString("type");
|
||||
ApiResult apiResult;
|
||||
JSONObject data = new JSONObject();
|
||||
if (type.equals(BizStatus.BCP)) {
|
||||
List<Point> pointEndList = pointRepository.findByAreaCode(BizStatus.BCP);
|
||||
if (pointEndList.size() < 1) {
|
||||
apiResult = ApiResult.fail(200, "没有推荐库位", "");
|
||||
data.put("pointCode", "");
|
||||
apiResult = ApiResult.fail(200, "没有推荐库位", data);
|
||||
} else {
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("pointCode", pointEndList.get(0).getCode());
|
||||
apiResult = ApiResult.fail(200, "操作成功", data);
|
||||
}
|
||||
|
|
@ -274,11 +295,11 @@ public class SceneAppController {
|
|||
@AnonymousAccess
|
||||
public ResponseEntity<Object> rfJhTaskList(@RequestBody(required=false) String request) {
|
||||
List<Map<String, Object>> taskList;
|
||||
if (request==null) {
|
||||
JSONObject requestJson=JSONObject.parseObject(request);
|
||||
String rfid=requestJson.getString("rfid");
|
||||
if (rfid.length()<1) {
|
||||
taskList = taskRepository.findByRgJhTask(null);
|
||||
}else {
|
||||
JSONObject requestJson=JSONObject.parseObject(request);
|
||||
String rfid=requestJson.getString("rfid");
|
||||
taskList = taskRepository.findByRgJhTask(rfid);
|
||||
// 人工入库 直接生成库存
|
||||
if (taskList==null||taskList.size()<1){
|
||||
|
|
@ -293,13 +314,13 @@ public class SceneAppController {
|
|||
@Log("app接口》料箱拣货 查询料箱拣货Task任务")
|
||||
@ApiOperation("人工拣货 查询已分配Task任务")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> lxJhTaskList(@RequestBody(required=false) String request) {
|
||||
public ResponseEntity<Object> lxJhTaskList(@RequestBody(required=false) String requestText) {
|
||||
JSONObject request=JSONObject.parseObject(requestText);
|
||||
String rfid=request.getString("rfid")+"";
|
||||
List<Map<String, Object>> taskList;
|
||||
if (request==null) {
|
||||
if (rfid.length()<1) {
|
||||
taskList = taskRepository.findByLxJhTask(null);
|
||||
}else {
|
||||
JSONObject requestJson=JSONObject.parseObject(request);
|
||||
String rfid=requestJson.getString("rfid");
|
||||
taskList = taskRepository.findByLxJhTask(rfid);
|
||||
if (taskList==null||taskList.size()<1){
|
||||
ApiResult apiResult = ApiResult.fail(500,"未查询到数据",taskList);
|
||||
|
|
@ -322,6 +343,28 @@ public class SceneAppController {
|
|||
ApiResult apiResult=taskService.picking(taskId);
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
@PostMapping("/inv/subInvPoint")
|
||||
@Log("app接口》库存-更新点位")
|
||||
@ApiOperation("库存-库存查询")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> subInvPoint(@RequestBody(required=false) String requestText) {
|
||||
JSONObject request=JSONObject.parseObject(requestText);
|
||||
Long invId=request.getLong("id");
|
||||
String pointCode=request.getJSONObject("point").getString("code");
|
||||
Point point=pointRepository.findByCode(pointCode);
|
||||
ApiResult apiResult;
|
||||
if (point.getStorageType()==null){
|
||||
apiResult = ApiResult.fail(500, "请先做容器入场", "");
|
||||
}else {
|
||||
Inventory inventory = inventoryService.editInvPoint(invId,point);
|
||||
if (inventory.getQueuedQty()<1){
|
||||
apiResult = ApiResult.fail(200, "修改成功", "");
|
||||
}else {
|
||||
apiResult = ApiResult.fail(500, "库存被占用", "");
|
||||
}
|
||||
}
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
@PostMapping("/inv/thInvList")
|
||||
@Log("app接口》库存查询")
|
||||
@ApiOperation("拣货-库存查询")
|
||||
|
|
@ -335,9 +378,9 @@ public class SceneAppController {
|
|||
}else {
|
||||
String type=request.getString("type");
|
||||
String rfid=request.getString("rfid");
|
||||
String param=request.getString("param");
|
||||
// String param=request.getString("param");
|
||||
if (type.equals("query")){
|
||||
inventoryList=inventoryRepository.findByParam(param);
|
||||
inventoryList=inventoryRepository.findByParam(rfid);
|
||||
msg="查询成功";
|
||||
}else {
|
||||
inventoryList = inventoryRepository.findByItemKeyC7(rfid);
|
||||
|
|
@ -348,8 +391,11 @@ public class SceneAppController {
|
|||
}
|
||||
Inventory inventory = inventoryList.get(0);
|
||||
if (type.equals("startInv")) {
|
||||
if (inventory.getQueuedQty() < 1 || inventory.getPoint().getStatus().equals(BaseStatus.USED)) {
|
||||
ApiResult apiResult = ApiResult.fail(500, "库存未被占用或搬运任务未完成", null);
|
||||
if (inventory.getQueuedQty() < 1) {
|
||||
ApiResult apiResult = ApiResult.fail(500, "未分配", null);
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
} else if (inventory.getPoint().getStatus().equals(BaseStatus.USED)) {
|
||||
ApiResult apiResult = ApiResult.fail(500, "搬运中", null);
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
msg = "被替换库存";
|
||||
|
|
@ -392,15 +438,13 @@ public class SceneAppController {
|
|||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
private Inventory getApiResult(String rfid1) {
|
||||
String[] rfids=rfid1.split("\\|");
|
||||
String itemCode= rfids[0]+"";
|
||||
String itemCode=rfid1.substring(0, 9);
|
||||
Item item=itemRepository.findByCode(itemCode);
|
||||
String propC1= rfids[1]+"";
|
||||
String propC2= rfids[2]+"";
|
||||
String propC3= rfids[3]+"";// 系统单号
|
||||
|
||||
String propC4= rfids[4]+"";
|
||||
String propC5= rfids[5]+"";//16进制 供货数量
|
||||
String propC1=rfid1.substring(9, 11);
|
||||
String propC2=rfid1.substring(11, 13);
|
||||
String propC3=rfid1.substring(13, 19);// 系统单号
|
||||
String propC4=rfid1.substring(19, 20);//供货商
|
||||
String propC5=rfid1.substring(20, 24);//16进制 供货数量
|
||||
StringBuffer propC6 = new StringBuffer();//流水号
|
||||
StringBuffer propC7 = new StringBuffer();//成品物料码
|
||||
int xs = 0;//成品收货-箱数
|
||||
|
|
@ -413,32 +457,38 @@ public class SceneAppController {
|
|||
// 更新当前点位 存储容器状态
|
||||
String storageType=item.getGoodType();
|
||||
if (item.getGoodType().equals(BizStatus.CP)) {
|
||||
propC6Title= rfids[7].substring(0, 6);
|
||||
propC6_start_d=Long.valueOf(rfids[7].substring(6, rfids[7].length()-1));//起始成品码
|
||||
propC6_end_d=Long.valueOf(rfids[8].substring(6, rfids[8].length()-1));//终止成品码
|
||||
propC6.append(propC6Title+propC6_start_d+"-"+propC6Title+propC6_end_d);
|
||||
xs = Integer.parseInt(rfids[9], 16);//箱数
|
||||
xs_start_d = Double.valueOf(rfids[10]);//料箱起始码
|
||||
xs_end_d = Double.valueOf(rfids[11]);//料箱终止码
|
||||
String tzm=rfid1.substring(24,28);//特征码
|
||||
String sm=rfid1.substring(28,50);//始码
|
||||
String zm=rfid1.substring(50,72);//止码
|
||||
xs = Integer.parseInt(rfid1.substring(72, 74));//箱数
|
||||
xs_start_d = Double.valueOf(rfid1.substring(74,78));//成品包装箱起始码
|
||||
xs_end_d = Double.valueOf(rfid1.substring(78,82));//成品包装箱终止码
|
||||
xs_d = Integer.parseInt(propC5, 16) / xs;//单箱数量
|
||||
|
||||
propC6Title= sm.substring(0, 6);
|
||||
propC6_start_d=Long.valueOf(sm.substring(6, sm.length()-1));//起始成品码
|
||||
propC6_end_d=Long.valueOf(zm.substring(6, zm.length()-1));//终止成品码
|
||||
propC6.append(propC6Title+propC6_start_d+"-"+propC6Title+propC6_end_d);
|
||||
String endm = rfid1.substring(82,86);//结束吗
|
||||
//成品容器类型 入库
|
||||
storageType=BizStatus.CTP_STO;
|
||||
} else {
|
||||
for (int i = 6; i < rfids.length; i++) {
|
||||
int decimalNumber = Integer.parseInt(rfids[i], 16);
|
||||
int decimalMin = Integer.parseInt("0001", 16);
|
||||
int decimalMax = Integer.parseInt("EA60", 16);
|
||||
String lshBf=rfid1.substring(24,rfid1.length());
|
||||
int decimalMin = Integer.parseInt("0001", 16);//流水号范围
|
||||
int decimalMax = Integer.parseInt("EA60", 16);//流水号范围
|
||||
for (int i = 0; i < lshBf.length(); i++) {
|
||||
String lsh=lshBf.substring(i,i+4);
|
||||
int decimalNumber = Integer.parseInt(lsh, 16);
|
||||
if (decimalNumber >= decimalMin && decimalNumber <= decimalMax) {
|
||||
if (propC6.length() < 1) {
|
||||
propC6.append(rfids[i]);
|
||||
propC6.append(lsh);
|
||||
} else {
|
||||
propC6.append(",");
|
||||
propC6.append(rfids[i]);
|
||||
propC6.append(lsh);
|
||||
}
|
||||
} else {
|
||||
System.out.println("无效RFID:" + rfids[i]);
|
||||
System.out.println("无效RFID:" + lsh);
|
||||
}
|
||||
i=i+4;
|
||||
}
|
||||
//半成品 入库
|
||||
storageType=BizStatus.TP_STO;
|
||||
|
|
@ -461,7 +511,8 @@ public class SceneAppController {
|
|||
@Log("app接口》拣货-确认替换分配库存")
|
||||
@ApiOperation("拣货-确认替换分配库存")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> thInvSub(@RequestBody(required=false) JSONArray request) {
|
||||
public ResponseEntity<Object> thInvSub(@RequestBody(required=false) String text) {
|
||||
JSONArray request=JSONObject.parseObject(text).getJSONArray("datas");
|
||||
Long startId=null;
|
||||
Long endId=null;
|
||||
for (int i = 0; i < request.size(); i++) {
|
||||
|
|
@ -704,63 +755,12 @@ public class SceneAppController {
|
|||
System.out.println("容器搬运"+jsonObject);
|
||||
String pointEndCode = jsonObject.getString("pointCode");
|
||||
JSONArray ids=jsonObject.getJSONArray("ids");
|
||||
ApiResult apiResult = null;
|
||||
for (int i = 0; i < ids.size(); i++) {
|
||||
Long id=ids.getLong(i);
|
||||
agvTaskService.addAgvTask(id,pointEndCode);
|
||||
apiResult = agvTaskService.addAgvTask(id,pointEndCode);
|
||||
}
|
||||
/*String pointCode = pointCallStock.getPointCode();
|
||||
String agvScene = pointCallStock.getAgvScene();
|
||||
String code = "0";
|
||||
String message = null;
|
||||
String agv_on_off = "OFF";
|
||||
agv_on_off = dictService.getDictDescription("agv_on_off") == null ? "OFF" : dictService.getDictDescription("agv_on_off").getDescription();
|
||||
String srcAreaName = null;
|
||||
String endAreaName = null;
|
||||
if (agvScene.equals(BizStatus.ZC)) {
|
||||
endAreaName = AreaNameDic.ZCFB;
|
||||
srcAreaName = AreaNameDic.ZCK;
|
||||
} else if (agvScene.equals(BizStatus.MF)) {
|
||||
endAreaName = AreaNameDic.MFJB;
|
||||
srcAreaName = AreaNameDic.MFK;
|
||||
}
|
||||
Point endPoint = pointService.getPoint(pointCode, null, null, endAreaName);
|
||||
if (endPoint == null) {
|
||||
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), pointCode + "点位不存在!", ""), HttpStatus.BAD_REQUEST);
|
||||
} else if (endPoint.getStatus().equals(BaseStatus.USED)) {
|
||||
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), pointCode + "点位状态已占用!", ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
//查询空料车
|
||||
Stock stock = stockService.findStockByPoint(srcAreaName);
|
||||
if (stock == null) {
|
||||
throw new RuntimeException(srcAreaName + "没有空料车!");
|
||||
}
|
||||
Point srcPoint = stock.getPoint();
|
||||
String stockCode = stock.getCode();
|
||||
|
||||
//生成搬运任务
|
||||
AgvTask agvTask = new AgvTask(BizStatus.EMPTY_OUT, stockCode, srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "RACK_MOVE");
|
||||
agvTaskService.create(agvTask);
|
||||
|
||||
if (agv_on_off.equals("ON")) {
|
||||
String resultJson = agvTaskService.sendAgvTaskImpl(agvTask);//发送任务
|
||||
JSONObject resulObject = JSON.parseObject(resultJson);
|
||||
code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
||||
message = resulObject.getString("message") == null ? "" : resulObject.getString("message");
|
||||
}
|
||||
if (code.equals("0")) {
|
||||
endPoint.setStatus(BaseStatus.USED);
|
||||
pointService.update(endPoint);
|
||||
//将容器对应地标改为目的地标
|
||||
if (stock != null) {
|
||||
stock.setPoint(endPoint);
|
||||
stockService.update(stock);
|
||||
}
|
||||
srcPoint.setStatus(BaseStatus.FREE);
|
||||
pointService.update(srcPoint);
|
||||
} else {
|
||||
throw new RuntimeException(message);
|
||||
}*/
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK);
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -134,12 +134,6 @@ public class ContainerServiceImpl implements ContainerService {
|
|||
if (agv_on_off.equals("ON")) {
|
||||
//调用容器入场接口
|
||||
String resultJson = HttpPostUtil.sendPostReq(UrlApi.containerIn, jsonObject.toString());
|
||||
// String resultJson = "{\n" +
|
||||
// " \"data\": null,\n" +
|
||||
// " \"code\": 0,\n" +
|
||||
// " \"message\": null,\n" +
|
||||
// " \"success\": true\n" +
|
||||
// "}";
|
||||
JSONObject resulObject = JSON.parseObject(resultJson);
|
||||
code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
||||
message = resulObject.getString("message") == null ? "" : resulObject.getString("message");
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class Item extends BaseEntity implements Serializable {
|
|||
private String description;
|
||||
|
||||
@Column(name = "`enabled`")
|
||||
@ApiModelProperty(value = "状态")
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
private Boolean enabled=true;
|
||||
|
||||
@Column(name = "`valid_period`")
|
||||
|
|
|
|||
|
|
@ -53,7 +53,9 @@ public class Point extends BaseEntity implements Serializable {
|
|||
@Column(name = "`status`")
|
||||
@ApiModelProperty(value = "状态")
|
||||
private String status;
|
||||
|
||||
@Column(name = "`agvStatus`")
|
||||
@ApiModelProperty(value = "锁定状态")
|
||||
private String agvStatus;
|
||||
@Column(name = "`description`")
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String description;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,10 @@ public interface PointRepository extends JpaRepository<Point, Long>, JpaSpecific
|
|||
"and p.enabled=true and (p.storageType is null or length(p.storageType)=0 or p.code=?3)", nativeQuery = false)
|
||||
List<Point> getLxzPointList(String areaCode, String asnType,String inCode);
|
||||
|
||||
/** 分配 库位*/
|
||||
/** AGV成品分配库位*/
|
||||
@Query(value = "SELECT p FROM Point p WHERE p.area.code=?1 and p.status='USED' and p.type='STORAGE' and p.enabled=true and (p.storageType is null or length(p.storageType)=0) order by p.heat desc ")
|
||||
List<Point> findByCpAreaCode(String areaCode);
|
||||
/** 取消 库位*/
|
||||
@Query(value = "SELECT p FROM Point p WHERE p.area.code=?1 and p.status='USED' and p.enabled=true and (p.storageType is null or length(p.storageType)=0) order by p.heat asc ")
|
||||
List<Point> findByAreaCode(String areaCode);
|
||||
/**成品区- 占用库位*/
|
||||
|
|
@ -50,6 +53,8 @@ public interface PointRepository extends JpaRepository<Point, Long>, JpaSpecific
|
|||
List<Point> findByAreaCodeCp(String areaCode,String status);
|
||||
@Query(value = "SELECT p FROM Point p WHERE p.code=?1")
|
||||
Point findByCode(String code);
|
||||
@Query(value = "SELECT p FROM Point p WHERE p.name=?1")
|
||||
Point findByName(String pointName);
|
||||
@Query(value = "SELECT p FROM Point p WHERE p.type=?1 and p.area.code=?2 and p.enabled=true")
|
||||
Point findByTypeAndArea(String type,String areaCode);
|
||||
/** 查询深位是否有库存 */
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ public class PointDto implements Serializable {
|
|||
|
||||
/** 状态 */
|
||||
private String status;
|
||||
/** agv占用状态*/
|
||||
private String agvStatus;
|
||||
|
||||
/** 描述 */
|
||||
private String description;
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public class ItemKey extends BaseEntity implements Serializable {
|
|||
private Boolean enabled=true;
|
||||
|
||||
public int getIntPropC5() {
|
||||
int decimalNumber = Integer.parseInt(propC5, 16);
|
||||
int decimalNumber = Integer.valueOf(propC5);
|
||||
return decimalNumber;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ public class Task extends BaseEntity implements Serializable {
|
|||
private Double moveQty=0d;
|
||||
|
||||
@Column(name = "`put_code`")
|
||||
@ApiModelProperty(value = "流水号")
|
||||
@ApiModelProperty(value = "")
|
||||
private String putCode;
|
||||
@JoinColumn(name="inv_id")
|
||||
@ApiModelProperty(value = "库存ID")
|
||||
|
|
|
|||
|
|
@ -34,4 +34,6 @@ public interface ItemKeyRepository extends JpaRepository<ItemKey, Long>, JpaSpec
|
|||
|
||||
@Query(value = "SELECT inv.itemKey FROM Inventory inv WHERE inv.id in ?1")
|
||||
List<ItemKey> getByInv(List<Long> ids);
|
||||
@Query(value = "SELECT ik FROM ItemKey ik WHERE ik.propC7=?1")
|
||||
ItemKey getByItemKeyPro7(String propC7);
|
||||
}
|
||||
|
|
@ -48,7 +48,8 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
|||
/**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集合
|
||||
* @param id
|
||||
|
|
@ -116,15 +117,9 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
|||
List<Task> findByStartPoint();
|
||||
@Query(value = "select t from Task t where t.taskStatus =?1 and t.beSkip=?2 and t.taskType=?3 group by t.itemKey.id")
|
||||
List<Task> findByGroupItemKey(String taskStatus, int beSkip, String taskType);
|
||||
@Query(value = " select agv.`status` 'agvStatus',t.agv_task_id 'agvId',t.id,p.`code` 'pointCode',sum(t.plan_qty) 'quantity',ik.prop_c1 'pch',ik.prop_c6 'lsh' from data_task t "
|
||||
+" left join data_item_key ik on ik.id=t.item_key_id "
|
||||
+" left join base_point p on t.dst_point_id=p.id "
|
||||
+" left join data_agv_task agv on t.agv_task_id=agv.id "
|
||||
+" where t.task_status='PUTAWAY' "
|
||||
+" group by t.item_key_id ",nativeQuery = true)
|
||||
List<Map<String,Object>> findBySjTask();
|
||||
@Query(value = " select t.id,p.related_bill1 'relatedBill1',sp.`code` 'startPointCode',ep.`code` 'endPointCode',t.plan_qty 'quantity',ik.prop_c1 'pch',ik.prop_c6 'lsh' from data_task t "
|
||||
@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 "
|
||||
+" left join base_item i on i.id=ik.item_id "
|
||||
+" left join data_pick_detail pd on pd.id=t.pick_detail_id "
|
||||
+" left join data_pick p on p.id=pd.pick_id "
|
||||
+" left join base_point ep on t.dst_point_id=ep.id "
|
||||
|
|
@ -134,16 +129,25 @@ 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 t.item 'sku',agv.`status` 'agvStatus',t.agv_task_id 'agvId',t.id,p.`code` 'pointCode',sum(t.plan_qty) 'quantity',ik.prop_c1 'pch',ik.prop_c6 'lsh' from data_task t "
|
||||
@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 "
|
||||
+" left join data_item_key ik on ik.id=t.item_key_id "
|
||||
+" left join data_item i on i.id=ik.item_id "
|
||||
+" left join base_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)
|
||||
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 "
|
||||
+" 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)
|
||||
List<Map<String,Object>> findBySjTask(String propC7);
|
||||
@Query(value = " select t.id,p.related_bill1 'relatedBill1',sp.`code` 'startPointCode',ep.`code` 'endPointCode',t.plan_qty 'quantity',ik.prop_c1 'pch',ik.prop_c6 'lsh' from data_task t "
|
||||
@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 "
|
||||
+" left join base_item i on i.id=ik.item_id "
|
||||
+" left join data_pick_detail pd on pd.id=t.pick_detail_id "
|
||||
+" left join data_pick p on p.id=pd.pick_id "
|
||||
+" left join base_point ep on t.dst_point_id=ep.id "
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ import com.youchain.businessdata.service.AgvTaskService;
|
|||
import com.youchain.businessdata.service.dto.AgvTaskDto;
|
||||
import com.youchain.businessdata.service.dto.AgvTaskQueryCriteria;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.utils.BaseStatus;
|
||||
import com.youchain.utils.BizStatus;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
|
@ -98,7 +100,7 @@ public class AgvTaskController {
|
|||
* 料箱任务接口回调
|
||||
* @param json
|
||||
*/
|
||||
@PostMapping("/agvTaskCallback")
|
||||
@PostMapping("/missionStateCallback")
|
||||
@Log("AGV搬运任务回调接口")
|
||||
@ApiOperation("AGV搬运任务回调接口")
|
||||
@AnonymousAccess
|
||||
|
|
@ -196,7 +198,25 @@ public class AgvTaskController {
|
|||
public ResponseEntity<Object> sendAgvTask(@RequestBody Integer id){
|
||||
// System.out.println("AgvTask:"+id);
|
||||
AgvTask agvTask=agvTaskRepository.getById(id);
|
||||
agvTaskService.sendAgvTaskImpl(agvTask);
|
||||
String requestText = agvTaskService.sendAgvTaskImpl(agvTask);
|
||||
JSONObject request=JSONObject.parseObject(requestText);
|
||||
String code=request.getString("code");
|
||||
ApiResult apiResult;
|
||||
if (code.equals("0")){
|
||||
apiResult=ApiResult.fail(200,"发送成功",null);
|
||||
}else {
|
||||
apiResult=ApiResult.fail(201,"发送失败",null);
|
||||
}
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
@PostMapping("/toAgvTaskFinish")
|
||||
@Log("AgvTask-发送")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> toAgvTaskFinish(@RequestBody Integer id){
|
||||
// System.out.println("AgvTask:"+id);
|
||||
AgvTask agvTask=agvTaskRepository.getById(id);
|
||||
agvTask.setStatus(BizStatus.UNUSUAL);
|
||||
agvTaskRepository.save(agvTask);
|
||||
ApiResult apiResult=ApiResult.fail(200,"操作成功",null);
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,45 +49,4 @@ public class LineController {
|
|||
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getConveyorState")
|
||||
@Log("读取输送线、流利式货架状态")
|
||||
@ApiOperation("读取输送线、流利式货架状态")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> getConveyorState(String conveyorId) {
|
||||
//查询点位是否允许取放;conveyorId出入口编号
|
||||
boolean success=false;
|
||||
String code="400";
|
||||
String message="";
|
||||
String state="";
|
||||
//查询输送线出入口是否有容器;有则,否则
|
||||
Stock stock=null;
|
||||
if(conveyorId.equals("入")){
|
||||
if(stock==null){
|
||||
state="3";//不允许取货
|
||||
}else{
|
||||
state="1";//允许取货
|
||||
code="200";
|
||||
success=true;
|
||||
}
|
||||
}else if(conveyorId.equals("出")){
|
||||
if(stock==null){
|
||||
state="4";//不允许放货
|
||||
}else{
|
||||
state="2";//允许取货
|
||||
code="200";
|
||||
success=true;
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||
Map<String, Object> objMap = new LinkedHashMap<>();
|
||||
objMap.put("success", success);//
|
||||
objMap.put("code", code);//
|
||||
objMap.put("message", message);//
|
||||
objMap.put("conveyorId", conveyorId);//
|
||||
objMap.put("state", state);//
|
||||
jsonObject.putAll(objMap);
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", jsonObject), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
|||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.utils.BaseStatus;
|
||||
import com.youchain.utils.BizStatus;
|
||||
import com.youchain.utils.UrlApi;
|
||||
import com.youchain.utils.UserUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.catalina.util.StandardSessionIdGenerator;
|
||||
|
|
@ -243,31 +244,32 @@ public class TaskController {
|
|||
@PostMapping("/readRfid")
|
||||
@Log("半成品/料箱 AGV入库-读取RFID码生成ItemKey和Task任务")
|
||||
@AnonymousAccess
|
||||
@Transactional
|
||||
public ResponseEntity<Object> readRfid(@RequestBody JSONObject body) {
|
||||
String rfid=body.getString("rfid");
|
||||
int agvFlag=body.getIntValue("agvFlag");
|
||||
Point pointStartCode=pointRepository.findByTypeAndArea(BaseStatus.PLATFORM,"TAGM");
|
||||
// 收货生成Task
|
||||
ApiResult apiResult = taskService.manualReceiving(rfid,pointStartCode,agvFlag);
|
||||
if (apiResult.getStatus()!=200){
|
||||
try {
|
||||
ApiResult apiResult = taskService.manualReceiving(rfid,pointStartCode,agvFlag);
|
||||
if (apiResult.getStatus()!=200){
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
synchronized (BaseStatus.Lock.rfid_SJ) {
|
||||
/** 半成品/料箱 AGV入库*/
|
||||
String billCode=apiResult.getData().toString();
|
||||
String areaCode="";
|
||||
if (billCode.equals(BizStatus.RM_RK)){
|
||||
areaCode=BizStatus.LX;
|
||||
}else if (billCode.equals(BizStatus.SM_RK)){
|
||||
areaCode=BizStatus.BCP;
|
||||
}
|
||||
apiResult = agvTaskService.addAgvAsn(areaCode, billCode);
|
||||
}
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}catch (Exception e){
|
||||
ApiResult apiResult = ApiResult.fail(500, "事务错误", e.getMessage());
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
synchronized (BaseStatus.Lock.rfid_SJ) {
|
||||
/** 半成品/料箱 AGV入库*/
|
||||
String billCode=apiResult.getData().toString();
|
||||
String areaCode="";
|
||||
if (billCode.equals(BizStatus.RM_RK)){
|
||||
areaCode=BizStatus.LX;
|
||||
}else if (billCode.equals(BizStatus.SM_RK)){
|
||||
areaCode=BizStatus.BCP;
|
||||
}
|
||||
apiResult = agvTaskService.addAgvAsn(areaCode, billCode);
|
||||
}
|
||||
if (apiResult.getStatus()!=201&&apiResult.getStatus()!=200){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
}
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
@PostMapping("/STAgvReceiving")
|
||||
@Log("容器入场-搬运容器到RFID门")
|
||||
|
|
@ -278,10 +280,39 @@ public class TaskController {
|
|||
String storageType = jsonObject.getString("storageType");
|
||||
JSONArray ids=jsonObject.getJSONArray("ids");
|
||||
ApiResult apiResult = agvTaskService.pointStockRk(storageType,ids.getLong(0));
|
||||
Point pointEndCode=pointRepository.findByTypeAndArea(BaseStatus.PLATFORM,"TAGM");
|
||||
Point pointEndCode= BaseStatus.DoorPoint;
|
||||
if (apiResult.getStatus()==200){
|
||||
apiResult = agvTaskService.addAgvTask(ids.getLong(0),pointEndCode.getCode());
|
||||
}
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
@PostMapping("/pointStockRk")
|
||||
@Log("容器入场")
|
||||
@AnonymousAccess
|
||||
@Transactional
|
||||
public ResponseEntity<Object> pointStockRk(@RequestBody JSONObject jsonObject) {
|
||||
System.out.println("容器入场:"+jsonObject);
|
||||
String storageType = jsonObject.getString("storageType");
|
||||
JSONArray ids=jsonObject.getJSONArray("ids");
|
||||
ApiResult apiResult = agvTaskService.pointStockRk(storageType,ids.getLong(0));
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
@PostMapping("/pointStockCk")
|
||||
@Log("容器出场")
|
||||
@AnonymousAccess
|
||||
@Transactional
|
||||
public ResponseEntity<Object> pointStockCk(@RequestBody JSONObject jsonObject) {
|
||||
JSONArray ids=jsonObject.getJSONArray("ids");
|
||||
Point point=pointRepository.getById(ids.getLong(0));
|
||||
String storageType = point.getStorageType();
|
||||
ApiResult apiResult;
|
||||
if (storageType==null||storageType.length()<1){
|
||||
apiResult = ApiResult.fail(500,"库位没有容器",null);
|
||||
} else if (point.getStatus().equals(BaseStatus.USED)) {
|
||||
apiResult = ApiResult.fail(500,"容器错误",null);
|
||||
} else {
|
||||
apiResult = agvTaskService.pointStockCk(storageType,ids.getLong(0));
|
||||
}
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,4 +116,6 @@ public interface InventoryService {
|
|||
* @param taskList
|
||||
*/
|
||||
void pickDelInventory(List<Task> taskList);
|
||||
|
||||
Inventory editInvPoint(Long invId, Point point);
|
||||
}
|
||||
|
|
@ -26,6 +26,8 @@ import com.youchain.businessdata.service.dto.TaskDto;
|
|||
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ public class AsnDetailQueryCriteria{
|
|||
/** 等于 */
|
||||
@Query(propName="status",type = Query.Type.EQUAL)
|
||||
private String status;
|
||||
@Query(propName="status",type = Query.Type.EQUAL)
|
||||
private String statusList;
|
||||
@Query(propName="status",type = Query.Type.IN)
|
||||
private List<String> statusList;
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
}
|
||||
|
|
@ -163,6 +163,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
jsonObject.put("containerModeCode", agvTask.getStockTypeCode());
|
||||
jsonObject.put("startPosition", agvTask.getStartSlotCode());
|
||||
jsonObject.put("endPosition", agvTask.getEndSlotCode());
|
||||
// jsonObject.put("viewBoardType", "");
|
||||
api=UrlApi.submitMission;
|
||||
}
|
||||
if (agvTask.getType().equals(BizStatus.AGV_R)){
|
||||
|
|
@ -179,6 +180,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
}
|
||||
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)){
|
||||
|
|
@ -468,7 +470,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
// 取料完成
|
||||
startPoint=pointRepository.findByCode(agvTask.getStartSlotCode());
|
||||
if (startPoint!=null) {
|
||||
startPoint.setStatus(BaseStatus.FREE);
|
||||
startPoint.setAgvStatus(BaseStatus.FREE);
|
||||
startPoint.setStorageType(null);
|
||||
pointRepository.save(startPoint);
|
||||
agvTask.setStartTime(new Timestamp((new Date()).getTime()));
|
||||
|
|
@ -479,7 +481,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
if (task.getTaskType().equals(BizStatus.RM_CK)) {
|
||||
/** 入库为料箱出库 出库所有的清空搬运任务关联的所有Point*/
|
||||
Point point = task.getSrcPoint();
|
||||
point.setStatus(BaseStatus.FREE);
|
||||
point.setAgvStatus(BaseStatus.FREE);
|
||||
point.setStorageType(null);
|
||||
pointRepository.save(point);
|
||||
}
|
||||
|
|
@ -491,8 +493,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
// 放料完成
|
||||
endPoint=pointRepository.findByCode(agvTask.getEndSlotCode());
|
||||
if (endPoint!=null) {
|
||||
endPoint.setStatus(BaseStatus.FREE);
|
||||
endPoint.setStorageType(agvTask.getStockTypeCode());
|
||||
endPoint.setAgvStatus(BaseStatus.FREE);
|
||||
pointRepository.save(endPoint);
|
||||
if (agvTask.getJobType().equals(BizStatus.ASN)) {
|
||||
List<Task> taskList = taskRepository.findByAgvTask(agvTask.getId(), BizStatus.RECEIVING);
|
||||
|
|
@ -518,6 +519,15 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
|
||||
} else if (status.equals("4")) {
|
||||
// 取消任务
|
||||
agvTask.setStatus(BizStatus.CANCEL);
|
||||
if (endPoint.getType().equals(BaseStatus.STORAGE)){
|
||||
endPoint.setAgvStatus(BaseStatus.FREE);
|
||||
pointRepository.save(endPoint);
|
||||
}
|
||||
if (startPoint.getType().equals(BaseStatus.STORAGE)){
|
||||
startPoint.setAgvStatus(BaseStatus.FREE);
|
||||
pointRepository.save(startPoint);
|
||||
}
|
||||
}
|
||||
agvTaskRepository.save(agvTask);
|
||||
}
|
||||
|
|
@ -615,8 +625,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
public ApiResult pointStockRk(String storageType, Long id) {
|
||||
Point point=pointRepository.getById(id);
|
||||
System.out.println("调用容器入场接口");
|
||||
// AgvTask agvTask = addAgvTask(BizStatus.AGV, stockType, task.getSrcPoint().getCode(),task.getDstPoint().getCode() , BizStatus.OPEN, BizStatus.ASN);
|
||||
|
||||
AgvTask agvTask=addAgvTask(BizStatus.AGV_R,storageType,null,point.getCode(),BizStatus.OPEN,BizStatus.ASN);
|
||||
JSONObject resultJson = JSONObject.parseObject(sendAgvTaskImpl(agvTask));
|
||||
if (!resultJson.getString("code").equals("0")){
|
||||
|
|
@ -649,7 +657,8 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
return agvTaskList.get(0);
|
||||
}
|
||||
agvTask.setType(type);
|
||||
agvTask.setStockTypeCode(stockTypeCode);
|
||||
String storageType=stockTypeRepository.findByCode(stockTypeCode).getMode();
|
||||
agvTask.setStockTypeCode(storageType);
|
||||
agvTask.setStartSlotCode(startSlotCode);
|
||||
agvTask.setEndSlotCode(endSlotCode);
|
||||
agvTask.setStatus(status);
|
||||
|
|
@ -660,11 +669,11 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
Point endPoint=pointRepository.findByCode(endSlotCode);
|
||||
if (!type.equals(BizStatus.AGV_R)&&!type.equals(BizStatus.AGV_C)) {
|
||||
if (startPoint!=null&&startPoint.getType().equals("STORAGE")) {
|
||||
startPoint.setStatus(BaseStatus.USED);
|
||||
startPoint.setAgvStatus(BaseStatus.USED);
|
||||
pointRepository.save(startPoint);
|
||||
}
|
||||
if (endPoint!=null&&endPoint.getType().equals("STORAGE")) {
|
||||
endPoint.setStatus(BaseStatus.USED);
|
||||
endPoint.setAgvStatus(BaseStatus.USED);
|
||||
pointRepository.save(endPoint);
|
||||
}
|
||||
}
|
||||
|
|
@ -682,6 +691,9 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
if (!endPoint.getStatus().equals(BaseStatus.FREE)){
|
||||
return ApiResult.fail(500,endPoint.getCode()+":被任务占用",null);
|
||||
}
|
||||
if (startPoint.getStorageType()==null||startPoint.getStorageType().length()<1){
|
||||
return ApiResult.fail(500,startPoint.getCode()+":没有容器",null);
|
||||
}
|
||||
AgvTask agvTask = addAgvTask(BizStatus.AGV, startPoint.getStorageType(), startPoint.getCode(),endPoint.getCode() , BizStatus.OPEN, BizStatus.ASN);
|
||||
}else {
|
||||
return ApiResult.fail(500,pointEndCode+":目标点错误",null);
|
||||
|
|
@ -709,7 +721,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
return ApiResult.fail(201,"已读取到成品入库RFID票数:"+taskItemKeyList.size(),null);
|
||||
}
|
||||
}else if(taskItemKey.getTaskType().equals(BizStatus.RM_RK)){
|
||||
stockTypeCode=BizStatus.LX_STO;
|
||||
stockTypeCode=BizStatus.LXZ_STO;
|
||||
if (taskItemKeyList.size()==3){
|
||||
endPointCode=taskItemKey.getDstPoint().getBeatCode();
|
||||
}else {
|
||||
|
|
@ -723,15 +735,16 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
return ApiResult.fail(201,"已读取到半成品入库RFID票数:"+taskItemKeyList.size(),null);
|
||||
}
|
||||
}
|
||||
String stockType=stockTypeRepository.findByCode(stockTypeCode).getMode();
|
||||
// 生成AgvTask搬运任务
|
||||
AgvTask agvTask = addAgvTask(BizStatus.AGV, stockType, startPointCode,endPointCode , BizStatus.OPEN, BizStatus.ASN);
|
||||
AgvTask agvTask = addAgvTask(BizStatus.AGV, stockTypeCode, startPointCode,endPointCode , BizStatus.OPEN, BizStatus.ASN);
|
||||
// 入库的Task任务
|
||||
List<Task> taskList=taskRepository.findByItemKey(taskItemKey.getItemKey().getId(), taskItemKey.getTaskStatus());
|
||||
for (int j = 0; j < taskList.size(); j++) {
|
||||
Task task=taskList.get(j);
|
||||
task.setAgvTask(agvTask);
|
||||
task.setTaskStatus(BizStatus.PUTAWAY);
|
||||
if (stockTypeCode.equals("LXZ")){
|
||||
task.setTaskStatus(BizStatus.PUTAWAY);
|
||||
}
|
||||
taskRepository.save(task);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ import com.youchain.businessdata.repository.AsnRepository;
|
|||
import com.youchain.businessdata.repository.TaskRepository;
|
||||
import com.youchain.businessdata.service.AsnService;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.modules.system.repository.DeptRepository;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.youchain.businessdata.repository.AsnDetailRepository;
|
||||
|
|
@ -66,6 +68,7 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
private final AsnDetailMapper asnDetailMapper;
|
||||
private final AsnService asnService;
|
||||
private final AsnRepository asnRepository;
|
||||
private final DeptRepository deptRepository;
|
||||
private final EntityManager entityMapper;
|
||||
private final TaskRepository taskRepository;
|
||||
private final ItemRepository itemRepository;
|
||||
|
|
@ -109,6 +112,7 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
AsnDetail asnDetail = asnDetailRepository.findById(resources.getId()).orElseGet(AsnDetail::new);
|
||||
ValidationUtil.isNull( asnDetail.getId(),"AsnDetail","id",resources.getId());
|
||||
asnDetail.copy(resources);
|
||||
asnDetail.setAsn(asnRepository.findByRelatedBill1(resources.getAsn().getRelatedBill1()));
|
||||
asnDetailRepository.save(asnDetail);
|
||||
}
|
||||
|
||||
|
|
@ -239,7 +243,15 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
String itemCode=erLine.getString("productId");//料号
|
||||
Item item=itemRepository.findByCode(itemCode);
|
||||
if (item==null){
|
||||
return ApiResult.fail(500,"没有查询到物料号:"+itemCode,null);
|
||||
// 添加 新物料
|
||||
item=new Item();
|
||||
item.setCode(itemCode);
|
||||
item.setName(itemCode);
|
||||
item.setDept(UserUtils.getDept());
|
||||
item.setGoodType(BizStatus.getBillToStock(billType.getCode()));
|
||||
item.setUnit("200001");
|
||||
itemRepository.save(item);
|
||||
// return ApiResult.fail(500,"没有查询到物料号:"+itemCode,null);
|
||||
}
|
||||
String lineNo=erLine.getString("lineNumber");//行号
|
||||
String quantityExpected=erLine.getString("quantityExpected");//数量
|
||||
|
|
|
|||
|
|
@ -103,6 +103,16 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
@Override
|
||||
public void deleteAll(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
Inventory inventory=inventoryRepository.getById(id);
|
||||
ItemKey itemKey=inventory.getItemKey();
|
||||
itemKey.setEnabled(false);
|
||||
Point point=inventory.getPoint();
|
||||
if (point!=null) {
|
||||
point.setStorageType(null);
|
||||
point.setStatus(BaseStatus.FREE);
|
||||
pointRepository.save(point);
|
||||
}
|
||||
itemKeyRepository.save(itemKey);
|
||||
inventoryRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -283,6 +293,16 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory editInvPoint(Long invId, Point point) {
|
||||
Inventory inventory=inventoryRepository.getById(invId);
|
||||
if (inventory!=null&&inventory.getQueuedQty()<1){
|
||||
inventory.setPoint(point);
|
||||
inventoryRepository.save(inventory);
|
||||
}
|
||||
return inventory;
|
||||
}
|
||||
|
||||
public List<Object[]> queryItemStock(){
|
||||
String hql = "select inv.itemKey.item.code,max(inv.itemKey.item.name),count(inv.id) " +
|
||||
" from Inventory inv where 1=1 and inv.quantity>0 group by inv.itemKey.item.code order by inv.itemKey.item.code";
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ public class ItemKeyServiceImpl implements ItemKeyService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public ItemKey getItemKey(Item item, String propC1, String propC2, String propC3, String propC4, String propC5, String propC6,String propC7) {
|
||||
ItemKey itemKey;
|
||||
itemKey = itemKeyRepository.getByItemKey(item.getId(),propC1,propC2,propC3,propC4,propC5,propC6);
|
||||
itemKey = itemKeyRepository.getByItemKeyPro7(propC7);
|
||||
if (itemKey==null){
|
||||
itemKey=new ItemKey();
|
||||
itemKey.setItem(item);
|
||||
|
|
@ -258,27 +258,6 @@ public class ItemKeyServiceImpl implements ItemKeyService {
|
|||
|
||||
@Override
|
||||
public ApiResult devanning(JSONObject req) {
|
||||
/*JSONArray invIds=req.getJSONArray("invIds");//invIds
|
||||
String rfid1=req.getString("rfid1");//
|
||||
String rfid2=req.getString("rfid2");//
|
||||
Point point = null;
|
||||
for (int i = 0; i < invIds.size(); i++) {
|
||||
Long invId=invIds.getLong(i);
|
||||
Inventory startInventory=inventoryRepository.getById(invId);
|
||||
if (point==null){
|
||||
point=startInventory.getPoint();
|
||||
}
|
||||
*//*if (inventory.getQueuedQty()>0){
|
||||
return ApiResult.fail(200,inventory.getId()+"被占用",null);
|
||||
}*//*
|
||||
inventoryRepository.delete(startInventory);
|
||||
}
|
||||
// 解析RFID信息
|
||||
String[] rfids=rfid1.split("\\|");
|
||||
Inventory inventory1 = getApiResult(rfid1, rfids);
|
||||
inventory1.setPoint(point);
|
||||
inventoryRepository.save(inventory1);
|
||||
Inventory inventory2 = getApiResult(rfid2, rfids);*/
|
||||
JSONArray invIds=req.getJSONArray("invIds");//invIds
|
||||
|
||||
String text1PropC6=req.getString("text1PropC6");
|
||||
|
|
|
|||
|
|
@ -212,9 +212,6 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
inv.setQueuedQty(allocateQty);
|
||||
inventoryRepository.save(inv);
|
||||
unQty = unQty-allocateQty;
|
||||
//占用点位
|
||||
/*startPoint.setStatus(BaseStatus.USED);
|
||||
pointRepository.save(startPoint);*/
|
||||
//更新出库单
|
||||
pickDetail.setAllocatedQty(pickDetail.getAllocatedQty() + allocateQty);
|
||||
pickDetail.setStatus(BizStatus.ALLOCATE);
|
||||
|
|
|
|||
|
|
@ -278,21 +278,24 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ApiResult manualReceiving(String rfid,Point pointStart,int agvFlag) {
|
||||
ApiResult apiResult;
|
||||
String billTypeCode="";//单据类型
|
||||
Point pointEnd=null;
|
||||
// 解析RFID信息
|
||||
String[] rfids=rfid.split("\\|");
|
||||
String itemCode=rfids[0]+"";
|
||||
String itemCode=rfid.substring(0, 9);
|
||||
Item item=itemRepository.findByCode(itemCode);
|
||||
if (item==null){
|
||||
return ApiResult.result(500, "没有物料", "");
|
||||
}
|
||||
String propC1=rfids[1]+"";
|
||||
String propC2=rfids[2]+"";
|
||||
String propC3=rfids[3]+"";// 系统单号
|
||||
String propC1=rfid.substring(9, 11);
|
||||
String propC2=rfid.substring(11, 13);
|
||||
String propC3=rfid.substring(13, 19);// 系统单号
|
||||
Asn asn=asnRepository.findByRelatedBill1(propC3);
|
||||
if (!BizStatus.getBillToStock(asn.getBillType().getCode()).equals(item.getGoodType())){
|
||||
return ApiResult.fail(500,"单据类型和物料类型不匹配",null);
|
||||
}
|
||||
if (asn==null){
|
||||
return ApiResult.result(201, "没有入库单", "");
|
||||
}else {
|
||||
|
|
@ -301,64 +304,73 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
}
|
||||
billTypeCode=asn.getBillType().getCode();//入库-单据类型
|
||||
String propC4=rfids[4]+"";
|
||||
String propC5=rfids[5]+"";//16进制 供货数量
|
||||
String propC4=rfid.substring(19, 20);//供货商
|
||||
String propC5=Integer.valueOf(rfid.substring(20, 24),16)+"";//16进制 供货数量
|
||||
StringBuffer propC6 = new StringBuffer();//流水号
|
||||
StringBuffer propC7 = new StringBuffer();//成品物料码
|
||||
int xs = 0;//成品收货-箱数
|
||||
int xs_d = 0;//成品收货-单箱数量
|
||||
Double xs_start_d = 0d;//成品收货-起始箱码
|
||||
Double xs_end_d=0d;//成品收货-终止箱码
|
||||
String propC6Title=null;//成品收货-成品码抬头
|
||||
Long propC6_start_d = 0l;//成品收货-成品码起始码
|
||||
Long propC6_end_d=0l;//成品收货-成品码终止码
|
||||
/*Long propC6_start_d = 0l;//成品收货-成品码起始码
|
||||
Long propC6_end_d=0l;//成品收货-成品码终止码*/
|
||||
// 更新当前点位 存储容器状态
|
||||
String storageType="";
|
||||
if (billTypeCode.equals(BizStatus.FC_RK)) {
|
||||
propC6Title=rfids[7].substring(0, 6);
|
||||
propC6_start_d=Long.valueOf(rfids[7].substring(6, rfids[7].length()-1));//起始成品码
|
||||
propC6_end_d=Long.valueOf(rfids[8].substring(6, rfids[8].length()-1));//终止成品码
|
||||
propC6.append(propC6Title+propC6_start_d+"-"+propC6Title+propC6_end_d);
|
||||
xs = Integer.parseInt(rfids[9], 16);//箱数
|
||||
xs_start_d = Double.valueOf(rfids[10]);//料箱起始码
|
||||
xs_end_d = Double.valueOf(rfids[11]);//料箱终止码
|
||||
xs_d = Integer.parseInt(propC5, 16) / xs;//单箱数量
|
||||
//String tzm=rfid.substring(24,28);//特征码
|
||||
String sm=rfid.substring(28,50);//始码
|
||||
String zm=rfid.substring(50,72);//止码
|
||||
xs = Integer.parseInt(rfid.substring(72, 74),16);//箱数
|
||||
Integer xs_start_d = Integer.parseInt(rfid.substring(74,78));//成品包装箱起始码
|
||||
Integer xs_end_d = Integer.parseInt(rfid.substring(78,82));//成品包装箱终止码
|
||||
for (int i = xs_start_d; i <= xs_end_d; i++) {
|
||||
if (propC6.length()<1){
|
||||
propC6.append(i);
|
||||
}else {
|
||||
propC6.append(","+i);
|
||||
}
|
||||
}
|
||||
//String endm = rfid.substring(82,86);//结束吗
|
||||
|
||||
//成品容器类型 入库
|
||||
storageType=BizStatus.CTP_STO;
|
||||
} else if (billTypeCode.equals(BizStatus.SM_RK)) {
|
||||
for (int i = 6; i < rfids.length; i++) {
|
||||
int decimalNumber = Integer.parseInt(rfids[i], 16);
|
||||
int decimalMin = Integer.parseInt("0001", 16);
|
||||
int decimalMax = Integer.parseInt("EA60", 16);
|
||||
String lshBf=rfid.substring(24,rfid.length());
|
||||
int decimalMin = Integer.parseInt("0001", 16);//流水号范围
|
||||
int decimalMax = Integer.parseInt("EA60", 16);//流水号范围
|
||||
for (int i = 0; i < lshBf.length();) {
|
||||
String lsh=lshBf.substring(i,i+4);
|
||||
int decimalNumber = Integer.parseInt(lsh, 16);
|
||||
if (decimalNumber >= decimalMin && decimalNumber <= decimalMax) {
|
||||
if (propC6.length() < 1) {
|
||||
propC6.append(rfids[i]);
|
||||
propC6.append(lsh);
|
||||
} else {
|
||||
propC6.append(",");
|
||||
propC6.append(rfids[i]);
|
||||
propC6.append(lsh);
|
||||
}
|
||||
} else {
|
||||
System.out.println("无效RFID:" + rfids[i]);
|
||||
System.out.println("无效RFID:" + lsh);
|
||||
}
|
||||
i=i+4;
|
||||
}
|
||||
//半成品 入库
|
||||
storageType=BizStatus.TP_STO;
|
||||
} else if (billTypeCode.equals(BizStatus.RM_RK)) {
|
||||
for (int i = 6; i < rfids.length; i++) {
|
||||
int decimalNumber = Integer.parseInt(rfids[i], 16);
|
||||
int decimalMin = Integer.parseInt("0001", 16);
|
||||
int decimalMax = Integer.parseInt("EA60", 16);
|
||||
String lshBf=rfid.substring(24,rfid.length());
|
||||
int decimalMin = Integer.parseInt("0001", 16);//流水号范围
|
||||
int decimalMax = Integer.parseInt("EA60", 16);//流水号范围
|
||||
for (int i = 0; i < lshBf.length();) {
|
||||
String lsh=lshBf.substring(i,i+4);
|
||||
int decimalNumber = Integer.parseInt(lsh, 16);
|
||||
if (decimalNumber >= decimalMin && decimalNumber <= decimalMax) {
|
||||
if (propC6.length() < 1) {
|
||||
propC6.append(rfids[i]);
|
||||
propC6.append(decimalNumber);
|
||||
} else {
|
||||
propC6.append(",");
|
||||
propC6.append(rfids[i]);
|
||||
propC6.append(decimalNumber);
|
||||
}
|
||||
} else {
|
||||
System.out.println("无效RFID:" + rfids[i]);
|
||||
System.out.println("无效RFID:" + lsh);
|
||||
}
|
||||
i=i+4;
|
||||
}
|
||||
//料箱 入库
|
||||
if (pointStart.getArea().getId()==45){
|
||||
|
|
@ -367,62 +379,87 @@ public class TaskServiceImpl implements TaskService {
|
|||
storageType=BizStatus.LX_STO;
|
||||
}
|
||||
}
|
||||
ItemKey itemKey;
|
||||
// 已生成ItemKey
|
||||
if (itemKeyRepository.getByItemKey(item.getId(),propC1,propC2,propC3,propC4,propC5,propC6.toString())!=null){
|
||||
return ApiResult.result(500, "重复读取", "");
|
||||
}else {
|
||||
if (agvFlag==1) {
|
||||
String stockTypeCode="";
|
||||
if (billTypeCode.equals(BizStatus.RM_RK)){
|
||||
stockTypeCode=BizStatus.LX;
|
||||
}else if (billTypeCode.equals(BizStatus.SM_RK)){
|
||||
stockTypeCode=BizStatus.BCP;
|
||||
}else if (billTypeCode.equals(BizStatus.FC_RK)){
|
||||
stockTypeCode=BizStatus.CP;
|
||||
}
|
||||
// 分配目标库位
|
||||
List<Point> pointEndList = pointRepository.findByCpAreaCode(stockTypeCode);
|
||||
if (pointEndList.size() > 0) {
|
||||
pointEnd = pointEndList.get(0);
|
||||
} else {
|
||||
return ApiResult.fail(500, "没有可用存储库位", null);
|
||||
}
|
||||
}
|
||||
|
||||
ItemKey itemKey=itemKeyRepository.getByItemKeyPro7(rfid);
|
||||
if (itemKey==null){
|
||||
itemKey = itemKeyService.getItemKey(item, propC1, propC2, propC3, propC4, propC5, propC6.toString(), rfid);
|
||||
}else if (itemKey.getEnabled()==false){
|
||||
itemKey.setEnabled(true);
|
||||
itemKeyRepository.save(itemKey);
|
||||
}else {
|
||||
return ApiResult.result(500, "重复读取", "");
|
||||
}
|
||||
// 已生成ItemKey
|
||||
{
|
||||
//获取流水号
|
||||
String[] lsh = itemKey.getPropC6().split(",");
|
||||
int taskSum = 0;// 生成task数量
|
||||
if (asn.getBillType().getCode().equals(BizStatus.FC_RK)) {
|
||||
taskSum = xs;//按 料箱数量生成task
|
||||
taskSum = 1;//按 一张rfid生成一个task
|
||||
} else {
|
||||
if (lsh.length != itemKey.getIntPropC5()) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ApiResult.result(500, "流水号数量和供货数量不一致", "");
|
||||
}
|
||||
taskSum = lsh.length;//按 流水号数量生成task
|
||||
taskSum = 1;//按 一张rfid生成一个task
|
||||
}
|
||||
if (agvFlag==1) {
|
||||
String stockTypeCode="";
|
||||
if (billTypeCode.equals(BizStatus.RM_RK)){
|
||||
stockTypeCode=BizStatus.LX;
|
||||
}else if (billTypeCode.equals(BizStatus.SM_RK)){
|
||||
stockTypeCode=BizStatus.BCP;
|
||||
}else if (billTypeCode.equals(BizStatus.FC_CK)){
|
||||
stockTypeCode=BizStatus.CP;
|
||||
// 更新收货明细
|
||||
List<AsnDetail> asnDetailList=asnDetailRepository.findByAsnAndItem(asn.getRelatedBill1(), itemCode);
|
||||
int asnQty = Integer.parseInt(propC5, 16);//收货数量
|
||||
if(asnDetailList.size()<1){
|
||||
return ApiResult.fail(500,"收货单中没有对应物料",null);
|
||||
}
|
||||
boolean adFlag=false;
|
||||
for (int i = 0; i < asnDetailList.size(); i++) {
|
||||
AsnDetail asnDetail=asnDetailList.get(i);
|
||||
if (!BizStatus.getBillToStock(asnDetail.getAsn().getBillType().getCode()).equals(item.getGoodType())){
|
||||
return ApiResult.fail(500,"收货单类型错误",null);
|
||||
}
|
||||
// 分配目标库位
|
||||
List<Point> pointEndList = pointRepository.findByAreaCode(stockTypeCode);
|
||||
if (pointEndList.size() > 0) {
|
||||
pointEnd = pointEndList.get(0);
|
||||
} else {
|
||||
return ApiResult.fail(500, "料箱入库没有可用存储库位", null);
|
||||
if (asnDetail.getOrderQty()-asnDetail.getReceivedQty()>=asnQty){
|
||||
asnDetail.setReceivedQty(asnDetail.getReceivedQty()+asnQty);
|
||||
asnDetailRepository.save(asnDetail);
|
||||
adFlag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (adFlag==false){
|
||||
return ApiResult.fail(500,"入库单剩余收货数量小于当前收货数量",null);
|
||||
}
|
||||
for (int i = 0; i < taskSum; i++) {
|
||||
Task task = new Task();
|
||||
if (asn.getBillType().getCode().equals(BizStatus.FC_RK)) {
|
||||
task.setPlanQty((double) xs_d);//单箱数量
|
||||
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 = 0; j < xs_d; j++) {
|
||||
if (putCode.length() < 1) {
|
||||
putCode.append(propC6Title + (propC6_start_d + j));
|
||||
} else {
|
||||
putCode.append("," + propC6Title + (propC6_start_d + j));
|
||||
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());//箱内 流水号
|
||||
task.setSrcStockCode((xs_start_d + i) + "");
|
||||
}*//*
|
||||
// propC6_start_d = propC6_start_d + xs_d;
|
||||
// task.setPutCode(putCode.toString());//流水号 起止码
|
||||
} else {
|
||||
task.setPlanQty(1d);
|
||||
task.setPutCode(lsh[i]);
|
||||
}
|
||||
task.setPutCode(propC6.toString());
|
||||
}*/
|
||||
task.setPutCode(propC6.toString());
|
||||
task.setItemKey(itemKey);
|
||||
task.setDept(UserUtils.getDept());
|
||||
task.setTaskStatus(BizStatus.RECEIVING);
|
||||
|
|
@ -438,6 +475,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
taskRepository.save(task);
|
||||
}
|
||||
}
|
||||
|
||||
if (agvFlag==1) {
|
||||
/** AGV人工入库*/
|
||||
pointStart.setStorageType(storageType);
|
||||
|
|
@ -452,6 +490,8 @@ public class TaskServiceImpl implements TaskService {
|
|||
}else {
|
||||
/** 人工入库*/
|
||||
Point point=pointStart;
|
||||
point.setStorageType(storageType);
|
||||
pointRepository.save(point);
|
||||
// 生成库存
|
||||
Inventory inventory = addAsnInventory(billTypeCode, point,null,0l,itemKey.getId());
|
||||
}
|
||||
|
|
@ -560,14 +600,17 @@ public class TaskServiceImpl implements TaskService {
|
|||
|
||||
@Override
|
||||
public ApiResult devanRfidAsn(String rfid,String pointType) {
|
||||
String[] rfids=rfid.split("\\|");
|
||||
JSONObject data=new JSONObject();
|
||||
if (rfids.length>4){
|
||||
String sku=rfids[0]+"";//sku
|
||||
String propC1=rfids[1]+"";
|
||||
String propC2=rfids[2]+"";
|
||||
String propC3=rfids[3]+"";// 系统单号
|
||||
String propC5=rfids[5]+"";// 收货数量(16禁止)
|
||||
if (rfid.length()>24){
|
||||
String sku=rfid.substring(0, 9)+"";//sku
|
||||
Item item=itemRepository.findByCode(sku);
|
||||
if (item.getGoodType().equals(BizStatus.CP)){
|
||||
rfid=rfid.substring(0,86);
|
||||
}
|
||||
String propC1=rfid.substring(9, 11)+"";
|
||||
String propC2=rfid.substring(11, 13)+"";
|
||||
String propC3=rfid.substring(13, 19)+"";// 系统单号
|
||||
String propC5=rfid.substring(20, 24)+"";// 收货数量(16禁止)
|
||||
|
||||
Asn asn=asnRepository.findByRelatedBill1(propC3);
|
||||
if (asn!=null){
|
||||
|
|
@ -591,10 +634,10 @@ public class TaskServiceImpl implements TaskService {
|
|||
String areaCode="";
|
||||
if (billTypeCode.equals(BizStatus.FC_RK)){
|
||||
// 成品条码解析
|
||||
if (rfids.length==13){
|
||||
if (rfid.length()==86){
|
||||
areaCode=BizStatus.CP;
|
||||
}else {
|
||||
return ApiResult.fail(400,"rfid长度不为13","");
|
||||
return ApiResult.fail(400,"rfid长度不为86","");
|
||||
}
|
||||
}else if (billTypeCode.equals(BizStatus.RM_RK)){
|
||||
areaCode=BizStatus.LX;
|
||||
|
|
@ -619,85 +662,55 @@ public class TaskServiceImpl implements TaskService {
|
|||
|
||||
@Override
|
||||
public ApiResult devanRfidPT(String rfid) {
|
||||
String[] rfids=rfid.split("\\|");
|
||||
JSONObject data=new JSONObject();
|
||||
if (rfids.length>4) {
|
||||
String sku = rfids[0] + "";//sku
|
||||
String propC1 = rfids[1] + "";
|
||||
String propC2 = rfids[2] + "";
|
||||
String propC3 = rfids[3] + "";// 系统单号
|
||||
String propC4 = rfids[4] + "";// 厂家代码
|
||||
String propC5 = rfids[5] + "";// 收货数量(16禁止)
|
||||
Item item=itemRepository.findByCode(sku);
|
||||
if (item==null){
|
||||
return ApiResult.fail(400,"没有找到物料",null);
|
||||
}
|
||||
StringBuffer propC6 = new StringBuffer();//流水号
|
||||
if (item.getGoodType().equals(BizStatus.CP)){
|
||||
String propC7=rfids[7].substring(0, rfids[7].length()-1);//起始成品码
|
||||
String propC8=rfids[8].substring(0, rfids[8].length()-1);//终止成品码
|
||||
propC6.append(propC7+"-"+propC8);
|
||||
}else {
|
||||
for (int i = 6; i < rfids.length; i++) {
|
||||
int decimalNumber = Integer.parseInt(rfids[i], 16);
|
||||
int decimalMin = Integer.parseInt("0001", 16);
|
||||
int decimalMax = Integer.parseInt("EA60", 16);
|
||||
if (decimalNumber >= decimalMin && decimalNumber <= decimalMax) {
|
||||
if (propC6.length() < 1) {
|
||||
propC6.append(rfids[i]);
|
||||
} else {
|
||||
propC6.append(",");
|
||||
propC6.append(rfids[i]);
|
||||
}
|
||||
} else {
|
||||
System.out.println("无效RFID:" + rfids[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 成品解析
|
||||
ItemKey itemKey=itemKeyRepository.getByItemKey(item.getId(),propC1,propC2,propC3,propC4,propC5,propC6.toString());
|
||||
if (itemKey==null){
|
||||
return ApiResult.fail(400,"没有找到RFID码对应的库存",null);
|
||||
}
|
||||
Inventory inventory=inventoryRepository.findByItemKey(itemKey.getId());
|
||||
if (inventory==null){
|
||||
return ApiResult.fail(500,"库存异常",null);
|
||||
}
|
||||
String sku=rfid.substring(0, 9);// sku
|
||||
Item item=itemRepository.findByCode(sku);
|
||||
if (item==null){
|
||||
return ApiResult.fail(400,"没有找到物料",null);
|
||||
}
|
||||
// 成品解析
|
||||
ItemKey itemKey=itemKeyRepository.getByItemKeyPro7(rfid);
|
||||
if (itemKey==null){
|
||||
return ApiResult.fail(400,"没有找到RFID码对应的库存",null);
|
||||
}
|
||||
Inventory inventory=inventoryRepository.findByItemKey(itemKey.getId());
|
||||
if (inventory==null){
|
||||
return ApiResult.fail(500,"库存异常",null);
|
||||
}
|
||||
|
||||
if (inventory.getQueuedQty()<=0){
|
||||
// 未分配
|
||||
data.put("sku",sku);
|
||||
data.put("RFID",rfid);
|
||||
data.put("invId",inventory.getId());
|
||||
return ApiResult.fail(201,"库存未进行分配,请选择需要出库出库单",data);
|
||||
}else {
|
||||
// 已分配
|
||||
data.put("sku",sku);
|
||||
data.put("RFID",rfid);
|
||||
data.put("invId",inventory.getId());
|
||||
data.put("receivedQty",inventory.getQueuedQty());
|
||||
/** 查询关联Task任务*/
|
||||
List<Task> taskList=taskRepository.findByItemKey(itemKey.getId(), BizStatus.ALLOCATE);
|
||||
Task task=taskList.get(0);
|
||||
PickDetail pickDetail=task.getPickDetail();
|
||||
Pick pick=pickDetail.getPick();
|
||||
// 已占用库存 推荐库存
|
||||
data.put("relatedBill1",pick.getRelatedBill1());
|
||||
data.put("relatedBill2",pick.getRelatedBill2());
|
||||
data.put("billType",pick.getBillType());
|
||||
data.put("pdId",pickDetail.getId());
|
||||
data.put("taskId",task.getId());
|
||||
data.put("orderQty",pickDetail.getAllocatedQty()-pickDetail.getPickedQty());
|
||||
}
|
||||
if (item.getGoodType().equals(BizStatus.CP)){
|
||||
if (inventory.getQueuedQty()<=0){
|
||||
// 未分配
|
||||
data.put("sku",sku);
|
||||
data.put("RFID",rfid);
|
||||
data.put("invId",inventory.getId());
|
||||
return ApiResult.fail(201,"库存未进行分配,请选择需要出库出库单",data);
|
||||
}else {
|
||||
// 已分配
|
||||
data.put("sku",sku);
|
||||
data.put("RFID",rfid);
|
||||
data.put("invId",inventory.getId());
|
||||
data.put("receivedQty",inventory.getQueuedQty());
|
||||
/** 查询关联Task任务*/
|
||||
List<Task> taskList=taskRepository.findByItemKey(itemKey.getId(), BizStatus.ALLOCATE);
|
||||
Task task=taskList.get(0);
|
||||
PickDetail pickDetail=task.getPickDetail();
|
||||
Pick pick=pickDetail.getPick();
|
||||
// 已占用库存 推荐库存
|
||||
data.put("relatedBill1",pick.getRelatedBill1());
|
||||
data.put("relatedBill2",pick.getRelatedBill2());
|
||||
data.put("billType",pick.getBillType());
|
||||
data.put("pdId",pickDetail.getId());
|
||||
data.put("taskId",task.getId());
|
||||
data.put("orderQty",pickDetail.getAllocatedQty()-pickDetail.getPickedQty());
|
||||
}
|
||||
if (item.getGoodType().equals(BizStatus.CP)){
|
||||
|
||||
}else if (item.getGoodType().equals(BizStatus.BCP)){
|
||||
}else if (item.getGoodType().equals(BizStatus.BCP)){
|
||||
|
||||
}else if (item.getGoodType().equals(BizStatus.LX)){
|
||||
// 料箱解析
|
||||
}else {
|
||||
return ApiResult.fail(400,"请维护物料类型,无法识别解析方式",null);
|
||||
}
|
||||
}else if (item.getGoodType().equals(BizStatus.LX)){
|
||||
// 料箱解析
|
||||
}else {
|
||||
return ApiResult.fail(400,"请维护物料类型,无法识别解析方式",null);
|
||||
}
|
||||
return ApiResult.fail(200, "操作成功", data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package com.youchain.modules.quartz.task;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.youchain.modules.quartz.service.QuartzJobService;
|
||||
import com.youchain.modules.system.service.DictDetailService;
|
||||
import com.youchain.modules.system.service.dto.DictDetailDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class ConstructTest {
|
||||
|
||||
@Autowired
|
||||
private DictDetailService dictDetailService;
|
||||
@Autowired
|
||||
private QuartzJobService quartzJobService;
|
||||
|
||||
public ConstructTest() {
|
||||
System.out.println("加载配置文件");
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载外部接口地址
|
||||
*/
|
||||
@PostConstruct
|
||||
public void configUrlApi(){
|
||||
quartzJobService.execution(quartzJobService.findById(3l));
|
||||
}
|
||||
}
|
||||
|
|
@ -31,6 +31,7 @@ import com.youchain.businessdata.service.AsnService;
|
|||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.utils.BaseStatus;
|
||||
import com.youchain.utils.BizStatus;
|
||||
import com.youchain.utils.UrlApi;
|
||||
import lombok.Synchronized;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
|
|
@ -101,6 +102,21 @@ public class TestTask {
|
|||
}
|
||||
// @PostMapping("/asnPutaway")
|
||||
// @AnonymousAccess
|
||||
public void posApiUrl(String req){
|
||||
JSONObject requestJson=JSONObject.parseObject(req);
|
||||
UrlApi.containerIn=requestJson.getString("containerIn");
|
||||
UrlApi.containerOut=requestJson.getString("containerOut");
|
||||
UrlApi.submitMission=requestJson.getString("submitMission");
|
||||
System.out.println("更新地址");
|
||||
System.out.println(UrlApi.containerIn);
|
||||
System.out.println(UrlApi.containerOut);
|
||||
System.out.println(UrlApi.submitMission);
|
||||
}
|
||||
public void posBaseStatus(String req){
|
||||
JSONObject requestJson=JSONObject.parseObject(req);
|
||||
String doorPointCode = requestJson.getString("doorPoint");
|
||||
BaseStatus.DoorPoint=pointRepository.findByCode(doorPointCode);
|
||||
}
|
||||
@Transactional
|
||||
public void asnPutaway(String req){
|
||||
synchronized (BaseStatus.Lock.rfid_SJ) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,523 @@
|
|||
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.HashSet;
|
||||
import java.util.Vector;
|
||||
|
||||
public class LongTermAsyncRead extends JFrame{
|
||||
Vector<String> vt=new Vector<String>();
|
||||
JButton jbt1;
|
||||
JButton jbt2;
|
||||
JList jlist;
|
||||
ReaderExceptionChecker rechecker = new ReaderExceptionChecker(3, 60);
|
||||
|
||||
public LongTermAsyncRead(int h,int w)
|
||||
{ super();
|
||||
|
||||
Container coter=this.getContentPane();
|
||||
this.setLayout(null);
|
||||
|
||||
jbt1=new JButton("开始盘存");
|
||||
jbt1.addActionListener(new ActionListener(){
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
vt.clear();
|
||||
// TODO Auto-generated method stub
|
||||
if (StartReadTags()!= READER_ERR.MT_OK_ERR)
|
||||
{
|
||||
MessageBox("开始盘存失败");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
jbt2=new JButton("停止盘存");
|
||||
jbt2.addActionListener(new ActionListener(){
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
System.out.println("盘存打印:"+vt);
|
||||
// TODO Auto-generated method stub
|
||||
if (rdr.StopReading() != READER_ERR.MT_OK_ERR)
|
||||
{
|
||||
MessageBox("停止盘存失败");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
jlist=new JList();
|
||||
|
||||
coter.add(jbt1);
|
||||
coter.add(jbt2);
|
||||
|
||||
coter.add(jlist);
|
||||
|
||||
int stx=50,sty=20,ey=20,bx=100,by=25;
|
||||
jbt1.setBounds(stx, sty, bx, by);
|
||||
jbt2.setBounds(stx, sty+ey+by, bx, by);
|
||||
|
||||
jlist.setBounds(jbt1.location().x+jbt1.size().width+50, jbt1.location().y,
|
||||
400, 200);
|
||||
|
||||
// this.setContentPane(coter);
|
||||
|
||||
this.setBounds(0, 0, w, h);
|
||||
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
this.setVisible(true);
|
||||
|
||||
if(OpenReader()!=READER_ERR.MT_OK_ERR)
|
||||
{ MessageBox("初始化读写器失败,请检查设备地址以及类型,重新打开");
|
||||
return;
|
||||
}
|
||||
|
||||
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent e) {
|
||||
if(rdr!=null)
|
||||
{
|
||||
rdr.StopReading();
|
||||
rdr.CloseReader();
|
||||
}
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void MessageBox(String mes)
|
||||
{
|
||||
JOptionPane.showMessageDialog(null, mes, "消息提示", JOptionPane.INFORMATION_MESSAGE);
|
||||
|
||||
}
|
||||
|
||||
ReadListener RL=new ReadListener()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void tagRead(Reader r, final TAGINFO[] tag) {
|
||||
// TODO Auto-generated method stub
|
||||
//可以对读到的标签做进一步的读,写,锁和GPIO等操作******************************
|
||||
/*
|
||||
//以下示例写入两个块的数据到盘存到的标签的USER区中。
|
||||
//注:只有在非高速盘存模式下才可以进行其它的标签操作,高速盘存模式下禁
|
||||
//止再进行其它标签操作,否则盘存操作将被终止,其它的标签操作也不会成功。
|
||||
//但GPIO的操作是例外,不论哪种盘存模式都可以在此处操作GPIO
|
||||
TagFilter_ST oldfilter=rdr.new TagFilter_ST();
|
||||
byte[] wdata=new byte[4];
|
||||
wdata[0] = 0x12;
|
||||
wdata[1] = 0x34;
|
||||
wdata[2] = 0x56;
|
||||
wdata[3] = 0x78;
|
||||
READER_ERR er = READER_ERR.MT_OK_ERR;
|
||||
//先将盘存的过滤条件保存,因为对标签进行写操作的时候也需要设置过滤条件,
|
||||
//此过滤条件可能和盘存的过滤条件不同,在完成写操作后还需要将盘存的过滤
|
||||
//条件恢复。不用检查返回值,不会失败
|
||||
|
||||
er=rdr.ParamGet(Mtr_Param.MTR_PARAM_TAG_FILTER, oldfilter);
|
||||
|
||||
TagFilter_ST newfilter=rdr.new TagFilter_ST();
|
||||
newfilter.bank=1;
|
||||
newfilter.fdata=tag[0].EpcId;
|
||||
newfilter.flen=tag[0].Epclen*8;
|
||||
newfilter.isInvert=0;
|
||||
newfilter.startaddr=32;
|
||||
|
||||
//设置写标签操作时的过滤条件(以标签的EPC码为过滤条件)
|
||||
er=rdr.ParamSet(Mtr_Param.MTR_PARAM_TAG_FILTER, newfilter);
|
||||
//一般使用标签被盘存到时的天线编号作为进一步操作的天线
|
||||
er = rdr.WriteTagData(tag[0].AntennaID, (char)3, 0, wdata, 4, null, (short)1000);
|
||||
if (er != READER_ERR.MT_OK_ERR)
|
||||
{
|
||||
//操作有可能失败(很多原因可能造成操作失败,常见的比如标签速度过快,
|
||||
//已经不在天线场内)
|
||||
}
|
||||
if (oldfilter.flen == 0) //表示盘存时没有设置过滤条件
|
||||
rdr.ParamSet(Mtr_Param.MTR_PARAM_TAG_FILTER, null);
|
||||
else //恢复盘存时的过滤条件
|
||||
rdr.ParamSet(Mtr_Param.MTR_PARAM_TAG_FILTER, oldfilter);
|
||||
|
||||
//设置GPO1为1
|
||||
//*
|
||||
if (rdr.SetGPO(1, 1) != READER_ERR.MT_OK_ERR)
|
||||
{
|
||||
//操作有可能失败,比如由于断网
|
||||
}
|
||||
//*/
|
||||
SwingUtilities.invokeLater(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
//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));
|
||||
else
|
||||
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);
|
||||
}
|
||||
});
|
||||
//*/
|
||||
}
|
||||
|
||||
};
|
||||
ReadExceptionListener REL=new ReadExceptionListener()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void tagReadException(Reader r, final READER_ERR re) {
|
||||
|
||||
//如果需要可在此处记录异常日志
|
||||
System.out.println(r.GetReaderAddress() + "--异常信息:" + re.toString());
|
||||
//判断是否异常发生过于频繁
|
||||
if (rechecker.IsTrigger())
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
SwingUtilities.invokeLater(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
MessageBox("读写器异常太过频繁,错误信息:"+re.toString());
|
||||
}
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
rechecker.AddErr();
|
||||
|
||||
//尝试重新连接读写器并启动盘存操作,如果5次均失败则弹出提示
|
||||
//尝试重新连接读写器并启动盘存操作,如果5次均失败则弹出提示
|
||||
READER_ERR resume_err = READER_ERR.MT_OK_ERR;
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
resume_err = OpenReader();
|
||||
if (resume_err == READER_ERR.MT_OK_ERR)
|
||||
{
|
||||
resume_err = StartReadTags();
|
||||
if (resume_err == READER_ERR.MT_OK_ERR)
|
||||
break;
|
||||
}
|
||||
try {
|
||||
Thread.sleep(4000);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (resume_err != READER_ERR.MT_OK_ERR)
|
||||
{
|
||||
//如果需要可在此处记录异常日志
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
MessageBox("重连读写器失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
GpiTriggerListener GTL=new GpiTriggerListener()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void GpiTrigger(Reader r, GpiInfo_ST gist,int id) {
|
||||
// TODO Auto-generated method stub
|
||||
System.out.println(r.GetReaderAddress());
|
||||
|
||||
for (int i = 0; i < gist.gpiCount; ++i)
|
||||
{
|
||||
System.out.println(gist.gpiStats[i].GpiId+" "+gist.gpiStats[i].State+" "+id);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
GpiTriggerBoundaryListener GTBL=new GpiTriggerBoundaryListener()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void GpiTriggerBoundary(Reader r, GpiTriggerBoundaryType btype,
|
||||
GpiTriggerBoundaryReasonType reason) {
|
||||
// TODO Auto-generated method stub
|
||||
System.out.println(r.GetReaderAddress());
|
||||
|
||||
System.out.println(btype+" "+reason);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reader rdr = null;
|
||||
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("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;
|
||||
//****************************************************************************
|
||||
|
||||
//以下为必须要设置的参数和事件回调处理函数************************************
|
||||
//设置读写器发射功率,本例设置为最大发射功率,可根据实际情况调整,
|
||||
//一般来说,功率越大则识别距离越远
|
||||
|
||||
//获取读写器最大发射功率
|
||||
int[] maxpower=new int[1];
|
||||
err=rdr.ParamGet(Mtr_Param.MTR_PARAM_RF_MAXPOWER, maxpower);
|
||||
//*
|
||||
if (err != READER_ERR.MT_OK_ERR)
|
||||
return err;
|
||||
|
||||
AntPowerConf apcf=rdr.new AntPowerConf();
|
||||
apcf.antcnt=portnum;
|
||||
for(int i=0;i<apcf.antcnt;i++)
|
||||
{
|
||||
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( Mtr_Param.MTR_PARAM_RF_ANTPOWER, apcf);
|
||||
//*
|
||||
if (err != READER_ERR.MT_OK_ERR)
|
||||
return err;
|
||||
|
||||
//设置读写器执行GEN2空中接口协议
|
||||
Inv_Potls_ST ipst=rdr.new Inv_Potls_ST();
|
||||
ipst.potlcnt=1;
|
||||
ipst.potls=new Inv_Potl[1];
|
||||
for(int i=0;i<ipst.potlcnt;i++)
|
||||
{
|
||||
Inv_Potl ipl=rdr.new Inv_Potl();
|
||||
ipl.weight=30;
|
||||
ipl.potl=SL_TagProtocol.SL_TAG_PROTOCOL_GEN2;
|
||||
ipst.potls[0]=ipl;
|
||||
}
|
||||
//不用检查返回值,不会失败
|
||||
err= rdr.ParamSet(Mtr_Param.MTR_PARAM_TAG_INVPOTL, ipst);
|
||||
|
||||
|
||||
//设置盘存到标签时的回调处理函数
|
||||
rdr.addReadListener(RL);
|
||||
//*
|
||||
//设置读写器发生错误时的回调处理函数
|
||||
rdr.addReadExceptionListener(REL);
|
||||
//****************************************************************************
|
||||
|
||||
//以下为根据应用需求可能要设置的参数******************************************
|
||||
//*
|
||||
//标签数量比较大,且移动速度缓慢或静止不动,设置为Session1可取得更
|
||||
//好效果,反之标签数量较少移动速度较快应设置为Session0,读写器默认
|
||||
//为Session0
|
||||
|
||||
int[] gen2session=new int[]{1};
|
||||
err =rdr.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_SESSION, gen2session);
|
||||
if (err != READER_ERR.MT_OK_ERR)
|
||||
return err;
|
||||
//*/
|
||||
|
||||
/*
|
||||
//对于某些应用可能需要读写器只盘存符合某些数据特征的标签,可以通
|
||||
//过设置过滤条件来实现,这样对于不符合特征的标签就不会被采集,以
|
||||
//下代码实现只盘存EPC码以0011010011(二进制)开头的标签
|
||||
byte[] filterbytes=new byte[2];
|
||||
filterbytes[0] = 0x34;
|
||||
filterbytes[1] = (byte) 0xC0;
|
||||
|
||||
TagFilter_ST filter=rdr.new TagFilter_ST();
|
||||
filter.bank=1;
|
||||
filter.fdata=filterbytes;
|
||||
filter.flen=4;
|
||||
filter.isInvert=0;
|
||||
filter.startaddr=32;
|
||||
|
||||
//不用检查返回值,不会失败
|
||||
rdr.ParamSet(Mtr_Param.MTR_PARAM_TAG_FILTER, filter);//*/
|
||||
|
||||
|
||||
/*
|
||||
//有些应用除了快速盘存标签的EPC码外还想同时抓取某一个bank内的数据,
|
||||
//可以通过设置此参数实现(目前只有slr11xx和slr12xx系列读写器才支
|
||||
//持),以下代码实现抓取tid区从0块开始的12个字节的数据,需要注意的
|
||||
//是抓取的字节数必须是2的倍数,如果成功获得其它bank的数据则TAGINFO
|
||||
//结构的成员EmbededData则为获得的数据,如果失败的话则TAGINFO结构
|
||||
//的成员EmbededDatalen为0
|
||||
|
||||
EmbededData_ST edst = rdr.new EmbededData_ST();
|
||||
edst.startaddr=0;
|
||||
edst.bank=2;
|
||||
//bytecnt=0 取消嵌入数据
|
||||
edst.bytecnt=12;
|
||||
edst.accesspwd=null;
|
||||
//不用检查返回值,不会失败
|
||||
rdr.ParamSet(Mtr_Param.MTR_PARAM_TAG_EMBEDEDDATA, edst);//*/
|
||||
return READER_ERR.MT_OK_ERR;
|
||||
}
|
||||
|
||||
READER_ERR StartReadTags()
|
||||
{
|
||||
//初始化结BackReadOption
|
||||
BackReadOption m_BROption=new BackReadOption();
|
||||
//本例只使用天线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;
|
||||
/*是否采用高速模式(目前只有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;
|
||||
//*/
|
||||
//****************************************************************************
|
||||
|
||||
|
||||
//使用GPI输入信号触发读写器工作***********************************************
|
||||
//*
|
||||
//共有三种触发模式:
|
||||
//1 预定义两种GPI状态,一种作为触发读写器启动盘存的条件,另一种
|
||||
// 作为停止盘存的条件
|
||||
//2 预定义一种GPI状态,触发读写器启动盘存,指定一段时间(必须大于
|
||||
// 5秒)后自动停止盘存标签
|
||||
//3 预定义两种GPI状态,满足任何一种GPI状态都触发读写器启动盘存,
|
||||
// 指定一段时间(必须大于5秒)后自动停止盘存标签
|
||||
//详见"读写器GPI触发工作模式.pdf"
|
||||
//以下示例为模式1,Trigger1State为启动工作时的GPI状态,且可以指
|
||||
//定多个GPI的状态,此例指定当GPI1为0时读写器开始盘存,当GPI2为0时
|
||||
//读写器停止盘存
|
||||
//m_BROption.IsGPITrigger = true;
|
||||
//设置读写器发生GPI时的回调处理函数
|
||||
// rdr.addGpiTriggerListener(GTL);
|
||||
// rdr.addGpiTriggerBoundaryListener(GTBL);
|
||||
|
||||
//第一种触发模式
|
||||
/*
|
||||
m_BROption.GpiTrigger.TriggerType = GpiTrigger_Type.GPITRIGGER_TRI1START_TRI2STOP;
|
||||
m_BROption.GpiTrigger.GpiTrigger1States.gpiCount = 1;
|
||||
m_BROption.GpiTrigger.GpiTrigger1States.gpiStats[0].GpiId = 1;
|
||||
m_BROption.GpiTrigger.GpiTrigger1States.gpiStats[0].State = 0;
|
||||
m_BROption.GpiTrigger.GpiTrigger2States.gpiCount = 1;
|
||||
m_BROption.GpiTrigger.GpiTrigger2States.gpiStats[0].GpiId = 2;
|
||||
m_BROption.GpiTrigger.GpiTrigger2States.gpiStats[0].State = 0;
|
||||
*/
|
||||
//第二种触发模式
|
||||
/*m_BROption.GpiTrigger.TriggerType = GpiTrigger_Type.GPITRIGGER_TRI1ORTRI2START_TIMEOUTSTOP;
|
||||
m_BROption.GpiTrigger.GpiTrigger1States.gpiCount = 1;
|
||||
m_BROption.GpiTrigger.GpiTrigger1States.gpiStats[0].GpiId = 1;
|
||||
m_BROption.GpiTrigger.GpiTrigger1States.gpiStats[0].State = 0;
|
||||
m_BROption.GpiTrigger.GpiTrigger2States.gpiCount = 1;
|
||||
m_BROption.GpiTrigger.GpiTrigger2States.gpiStats[0].GpiId = 2;
|
||||
m_BROption.GpiTrigger.GpiTrigger2States.gpiStats[0].State = 0;
|
||||
m_BROption.GpiTrigger.StopTriggerTimeout=5000;
|
||||
*/
|
||||
|
||||
//第三种触发模式
|
||||
/*
|
||||
m_BROption.GpiTrigger.TriggerType = GpiTrigger_Type.GPITRIGGER_TRI1START_TIMEOUTSTOP;
|
||||
m_BROption.GpiTrigger.GpiTrigger1States.gpiCount = 1;
|
||||
m_BROption.GpiTrigger.GpiTrigger1States.gpiStats[0].GpiId = 3;
|
||||
m_BROption.GpiTrigger.GpiTrigger1States.gpiStats[0].State = 0;
|
||||
m_BROption.GpiTrigger.StopTriggerTimeout=5000;
|
||||
*/
|
||||
|
||||
//在GPI触发工作时,当触发条件发生时的处理函数,可通过此事件获取触
|
||||
//发时刻的GPI状态,如果不关心触发时刻的GPI状态以及时序关系,可以
|
||||
//不设置此事件,详见文档"读写器GPI触发工作模式.pdf"
|
||||
|
||||
return rdr.StartReading(ants, antcnt, m_BROption);
|
||||
}
|
||||
//*
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.out.println(System.getProperty("java.library.path"));
|
||||
try {
|
||||
if(!System.getProperty("os.arch").contains("64"))
|
||||
{
|
||||
//32位系统需要这个支持库
|
||||
System.loadLibrary("ACE");
|
||||
|
||||
}
|
||||
System.loadLibrary("PCOMM");
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
System.out.println("hello into the longtermasyncread of samples for java");
|
||||
LongTermAsyncRead fm=new LongTermAsyncRead(300,650);
|
||||
|
||||
}
|
||||
//*/
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.youchain.rfid;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
|
||||
/*
|
||||
* 用于统计读写器发生断线和异常的频率,读写器工作的时候由于网络连接和外部环境(比
|
||||
* 如有金属物体紧贴天线或者有外物撞击了天线导致天线连接断开)都有可能造成工作中断,
|
||||
* 如果引起异常的外部因素只是偶尔出现,重新初始化读写器一般都能继续工作。如果发生
|
||||
* 的频率很高则应该检查网络或读写器安装部署环境是否有问题。此类的构造函数包含两个
|
||||
* 参数,参数1是发生异常的最大次数,参数2则规定了一个时间段(单位为秒),例如参数1
|
||||
* 设置为3,参数2设置为60,则具体含义为:如果读写器在60秒内发生了3次异常则IsTrigger
|
||||
* 方法则会返回true,表示读写器发生异常的频率过高,超过了构造函数设置的门限值。
|
||||
* */
|
||||
public class ReaderExceptionChecker {
|
||||
public ReaderExceptionChecker(int maxerrcnt, int dursec)
|
||||
{
|
||||
dts = new Calendar[maxerrcnt];
|
||||
index = 0;
|
||||
maxdursec = dursec;
|
||||
}
|
||||
public void AddErr()
|
||||
{
|
||||
dts[index++] = Calendar.getInstance();
|
||||
}
|
||||
|
||||
Calendar[] dts;
|
||||
int maxdursec;
|
||||
int index;
|
||||
public boolean IsTrigger()
|
||||
{
|
||||
Calendar dt = Calendar.getInstance();
|
||||
if (index == dts.length - 1)
|
||||
{
|
||||
|
||||
if ( (dt.getTimeInMillis() - dts[0].getTimeInMillis())/1000 < maxdursec)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,10 +1,13 @@
|
|||
package com.youchain.utils;
|
||||
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author houjianlan
|
||||
* @date 2023-08-16
|
||||
**/
|
||||
public interface BaseStatus {
|
||||
public class BaseStatus {
|
||||
/**
|
||||
* 空闲
|
||||
*/
|
||||
|
|
@ -40,10 +43,12 @@ public interface BaseStatus {
|
|||
* 输送线
|
||||
*/
|
||||
public static String EMPTY = "EMPTY";
|
||||
public static Point DoorPoint = null;
|
||||
|
||||
/** 锁*/
|
||||
class Lock{
|
||||
public static class Lock{
|
||||
/** RFID-上架*/
|
||||
public static String rfid_SJ="sj";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -234,16 +234,16 @@ public interface BizStatus {
|
|||
/** 料箱入库*/
|
||||
String RM_RK="RM_RK";
|
||||
/*料箱存储区 容器类型stockType-料箱*/
|
||||
String LX_STO="LX-STO";
|
||||
String LX_STO="LX";
|
||||
String LXMode="";
|
||||
/* 容器类型stockType-料箱载具*/
|
||||
String LXZ_STO="LXZ-STO";
|
||||
String LXZ_STO="LXZ";
|
||||
String LXZMode="K-MRES潜伏车模型";
|
||||
/** 容器类型stockType-叉车托盘*/
|
||||
String CTP_STO="CTP-STO";
|
||||
String CTP_STO="CTP";
|
||||
String CTPMode="K-MRES叉车模型";
|
||||
/*容器类型stockType-半成品托盘*/
|
||||
String TP_STO="TP-STO";
|
||||
String TP_STO="TP";
|
||||
String TPMode="K-MRES潜伏车模型";
|
||||
String BCP_PT="BCP_PT";
|
||||
/** AGV出库*/
|
||||
|
|
@ -266,6 +266,17 @@ public interface BizStatus {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
static String getBillToAgv(String billTypeCode) {
|
||||
if (billTypeCode.equals(BizStatus.FC_RK)){
|
||||
return BizStatus.CP;
|
||||
} else if (billTypeCode.equals(BizStatus.SM_RK)) {
|
||||
return BizStatus.BCP;
|
||||
} else if (billTypeCode.equals(BizStatus.RM_RK)) {
|
||||
return BizStatus.LX;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static boolean Continued(String status) {
|
||||
if (status.equals(BizStatus.OPEN)||status.equals(BizStatus.OPEN)||status.equals(BizStatus.OPEN)){
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.youchain.utils;
|
||||
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
|
||||
public class UrlApi {
|
||||
/**
|
||||
* 料箱任务下发
|
||||
|
|
@ -32,4 +34,5 @@ public class UrlApi {
|
|||
public static String QueryCount="http://10.177.188.11:4080/webapi/mes/QueryCount";
|
||||
|
||||
|
||||
public static Point DoorPoint;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,22 @@
|
|||
#配置数据源
|
||||
spring:
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:0}
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
#password: ${REDIS_PWD:123abc}
|
||||
#连接超时时间
|
||||
timeout: 5000
|
||||
datasource:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:47.100.54.81}:${DB_PORT:53306}/${DB_NAME:nrwms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:nrwms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:Youchain@56}
|
||||
password: ${DB_PWD:123456}
|
||||
# password: ${DB_PWD:Youchain@56}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
|
|
|
|||
|
|
@ -0,0 +1,136 @@
|
|||
#配置数据源
|
||||
spring:
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:0}
|
||||
host: ${REDIS_HOST:youchain-redis}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
#password: ${REDIS_PWD:123abc}
|
||||
#连接超时时间
|
||||
timeout: 5000
|
||||
datasource:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:youchain-mysql}:${DB_PORT:3306}/${DB_NAME:wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# password: ${DB_PWD:Youchain@56}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
min-idle: 15
|
||||
# 最大连接数
|
||||
max-active: 30
|
||||
# 超时时间(以秒数为单位)
|
||||
remove-abandoned-timeout: 180
|
||||
# 获取连接超时时间
|
||||
max-wait: 3000
|
||||
# 连接有效性检测时间
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 连接在池中最小生存的时间
|
||||
min-evictable-idle-time-millis: 300000
|
||||
# 连接在池中最大生存的时间
|
||||
max-evictable-idle-time-millis: 900000
|
||||
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
|
||||
test-while-idle: true
|
||||
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
|
||||
test-on-borrow: true
|
||||
# 是否在归还到池中前进行检验
|
||||
test-on-return: false
|
||||
# 检测连接是否有效
|
||||
validation-query: select 1
|
||||
# 配置监控统计
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: /druid/*
|
||||
reset-enable: false
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 记录慢SQL
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
|
||||
# 登录相关配置
|
||||
login:
|
||||
# 是否限制单用户登录
|
||||
single-login: false
|
||||
# Redis用户登录缓存配置
|
||||
user-cache:
|
||||
# 存活时间/秒
|
||||
idle-time: 7200
|
||||
# 验证码
|
||||
login-code:
|
||||
# 验证码类型配置 查看 LoginProperties 类
|
||||
code-type: arithmetic
|
||||
# 登录图形验证码有效时间/分钟
|
||||
expiration: 2
|
||||
# 验证码高度
|
||||
width: 111
|
||||
# 验证码宽度
|
||||
height: 36
|
||||
# 内容长度
|
||||
length: 2
|
||||
# 字体名称,为空则使用默认字体
|
||||
font-name:
|
||||
# 字体大小
|
||||
font-size: 25
|
||||
|
||||
#jwt
|
||||
jwt:
|
||||
header: Authorization
|
||||
# 令牌前缀
|
||||
token-start-with: Bearer
|
||||
# 必须使用最少88位的Base64对该令牌进行编码
|
||||
base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI=
|
||||
# 令牌过期时间 此处单位/毫秒 ,默认4小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
|
||||
token-validity-in-seconds: 14400000
|
||||
# 在线用户key
|
||||
online-key: online-token-
|
||||
# 验证码
|
||||
code-key: code-key-
|
||||
# token 续期检查时间范围(默认30分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期
|
||||
detect: 1800000
|
||||
# 续期时间范围,默认1小时,单位毫秒
|
||||
renew: 3600000
|
||||
|
||||
#是否允许生成代码,生产环境设置为false
|
||||
generator:
|
||||
enabled: true
|
||||
|
||||
#是否开启 swagger-ui
|
||||
swagger:
|
||||
enabled: true
|
||||
|
||||
# IP 本地解析
|
||||
ip:
|
||||
local-parsing: true
|
||||
|
||||
# 文件存储路径
|
||||
file:
|
||||
mac:
|
||||
path: ~/file/
|
||||
avatar: ~/avatar/
|
||||
linux:
|
||||
path: /home/eladmin/file/
|
||||
avatar: /home/eladmin/avatar/
|
||||
windows:
|
||||
path: C:\eladmin\file\
|
||||
avatar: C:\eladmin\avatar\
|
||||
# 文件大小 /M
|
||||
maxSize: 200
|
||||
avatarMaxSize: 5
|
||||
minidao:
|
||||
base-package: org.jeecg.modules.jmreport.desreport.dao*
|
||||
db-type: mysql
|
||||
task:
|
||||
onOff:
|
||||
zCJXBTask: false
|
||||
|
|
@ -1,5 +1,14 @@
|
|||
#配置数据源
|
||||
spring:
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:0}
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
#password: ${REDIS_PWD:123abc}
|
||||
#连接超时时间
|
||||
timeout: 5000
|
||||
datasource:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
|
|
|
|||
|
|
@ -26,17 +26,6 @@ spring:
|
|||
hibernate:
|
||||
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
|
||||
|
||||
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:0}
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
#password: ${REDIS_PWD:123abc}
|
||||
#连接超时时间
|
||||
timeout: 5000
|
||||
|
||||
task:
|
||||
pool:
|
||||
# 核心线程池大小
|
||||
|
|
|
|||
Loading…
Reference in New Issue