rev:修改
This commit is contained in:
@@ -36,4 +36,9 @@ public class EXTConstant {
|
||||
* ACS下发 获取称重信息
|
||||
*/
|
||||
public final static String GET_EMP_READY_ACS_API = "api/wms/getEmpReady";
|
||||
|
||||
/**
|
||||
* ACS下发 获取设备状态
|
||||
*/
|
||||
public final static String GET_DEVICE = "api/wms/getDevice";
|
||||
}
|
||||
|
||||
@@ -41,10 +41,19 @@ public interface WmsToAcsService {
|
||||
/**
|
||||
* 确认取放货
|
||||
* @param whereJson {
|
||||
* type: 1-取货完成 2- 放货完成
|
||||
* type: 1-取货完成 2- 放货完成 3-复位
|
||||
* device_code: 点位编码
|
||||
* }
|
||||
* @return AcsResponse
|
||||
*/
|
||||
AcsResponse confirmAgv(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 获取设备
|
||||
* @param whereJson {
|
||||
* device_code: 点位编码
|
||||
* }
|
||||
* @return AcsResponse
|
||||
*/
|
||||
AcsResponse getDevice(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -42,4 +42,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
public AcsResponse confirmAgv(JSONObject whereJson) {
|
||||
return AcsUtil.notifyAcs(EXTConstant.CONFIRM_AGV_ACS_API, whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AcsResponse getDevice(JSONObject whereJson) {
|
||||
return AcsUtil.notifyAcs(EXTConstant.GET_DEVICE, whereJson);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.nl.wms.ext.service.WmsToNotCarService;
|
||||
import org.nl.wms.ext.util.NoCarResponse;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.DigestUtils;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -27,7 +28,8 @@ public class WmsToNotCarServiceImpl implements WmsToNotCarService {
|
||||
|
||||
@Override
|
||||
public NoCarResponse isGoBack(JSONObject param) {
|
||||
log.info("下发无人车接口isGoBack的输入参数为:-------------------" + param.toString());
|
||||
JSONObject appKey = this.param();
|
||||
log.info("下发无人车接口isGoBack的输入参数为:-------------------" + param.toString() + "签名参数为:-----------" + appKey.toString());
|
||||
// 返回参数
|
||||
NoCarResponse resultCar;
|
||||
|
||||
@@ -51,6 +53,9 @@ public class WmsToNotCarServiceImpl implements WmsToNotCarService {
|
||||
String url = acsUrlParam.getValue() + "openapi/callback/isGoBack";
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.header("appkey", appKey.getString("appKey"))
|
||||
.header("timestamp", appKey.getString("timestamp"))
|
||||
.header("sign", appKey.getString("sign"))
|
||||
.body(String.valueOf(param))
|
||||
.execute().body();
|
||||
// 格式转换
|
||||
@@ -68,7 +73,8 @@ public class WmsToNotCarServiceImpl implements WmsToNotCarService {
|
||||
|
||||
@Override
|
||||
public NoCarResponse callNotCat(JSONObject param) {
|
||||
log.info("下发无人车接口callNotCat的输入参数为:-------------------" + param.toString());
|
||||
JSONObject appKey = this.param();
|
||||
log.info("下发无人车接口callNotCat的输入参数为:-------------------" + param.toString() + "签名参数为:-----------" + appKey.toString());
|
||||
// 返回参数
|
||||
NoCarResponse resultCar;
|
||||
|
||||
@@ -92,6 +98,9 @@ public class WmsToNotCarServiceImpl implements WmsToNotCarService {
|
||||
String url = acsUrlParam.getValue() + "openapi/wcs/task";
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.header("appkey", appKey.getString("appKey"))
|
||||
.header("timestamp", appKey.getString("timestamp"))
|
||||
.header("sign", appKey.getString("sign"))
|
||||
.body(String.valueOf(param))
|
||||
.execute().body();
|
||||
// 格式转换
|
||||
@@ -109,7 +118,8 @@ public class WmsToNotCarServiceImpl implements WmsToNotCarService {
|
||||
|
||||
@Override
|
||||
public NoCarResponse continueTask(JSONObject param) {
|
||||
log.info("下发无人车接口continueTask的输入参数为:-------------------" + param.toString());
|
||||
JSONObject appKey = this.param();
|
||||
log.info("下发无人车接口continueTask的输入参数为:-------------------" + param.toString() + "签名参数为:-----------" + appKey.toString());
|
||||
// 返回参数
|
||||
NoCarResponse resultCar;
|
||||
|
||||
@@ -133,6 +143,9 @@ public class WmsToNotCarServiceImpl implements WmsToNotCarService {
|
||||
String url = acsUrlParam.getValue() + "openapi/task/continueTask";
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.header("appkey", appKey.getString("appKey"))
|
||||
.header("timestamp", appKey.getString("timestamp"))
|
||||
.header("sign", appKey.getString("sign"))
|
||||
.body(String.valueOf(param))
|
||||
.execute().body();
|
||||
// 格式转换
|
||||
@@ -147,4 +160,23 @@ public class WmsToNotCarServiceImpl implements WmsToNotCarService {
|
||||
}
|
||||
return resultCar;
|
||||
}
|
||||
|
||||
public JSONObject param() {
|
||||
String appkey = "631ce482-f8c3-4f28-b710-cb68e50e799a";
|
||||
String appsecret = "038755f0462ec4785fe0a5181490b413";
|
||||
String appsalt = "leador";
|
||||
|
||||
String appkeystr = "appsalt=" + appsalt + "&appkey=" + appkey;
|
||||
String appkeyEcrypt = DigestUtils.md5DigestAsHex(appkeystr.getBytes());
|
||||
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
String origin = appkeyEcrypt + "&appsecret=" + appsecret + "×tamp=" + timestamp + "&uniquestr=" + timestamp;
|
||||
String signstr = DigestUtils.md5DigestAsHex(origin.getBytes());
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("appkey", appkey);
|
||||
jsonObject.put("timestamp", timestamp);
|
||||
jsonObject.put("sign", signstr);
|
||||
return jsonObject;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,4 +68,32 @@ public class PdaPointAndPointController {
|
||||
return new ResponseEntity<>(pdaPointAndPointBoxService.clearVehicle(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryPointInfo")
|
||||
@Log("取放货确认 - 查询点位信息")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> queryPointInfo(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaPointAndPointBoxService.queryPointInfo(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/putConfirm")
|
||||
@Log("取放货确认 - 放货完成")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> putConfirm(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaPointAndPointBoxService.putConfirm(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getConfirm")
|
||||
@Log("取放货确认 - 取货完成")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getConfirm(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaPointAndPointBoxService.getConfirm(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/reduce")
|
||||
@Log("取放货确认 - 复位")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> reduce(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaPointAndPointBoxService.reduce(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -67,4 +67,40 @@ public interface PdaPointAndPointBoxService {
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse clearMaterial(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 取放货确认 - 查询点位信息
|
||||
* @param whereJson {
|
||||
* point_code: 点位编码
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse queryPointInfo(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 取放货确认 - 放货完成
|
||||
* @param whereJson {
|
||||
* rows: 列表明细
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse putConfirm(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 取放货确认 - 取货完成
|
||||
* @param whereJson {
|
||||
* rows: 列表明细
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse getConfirm(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 取放货确认 - 复位
|
||||
* @param whereJson {
|
||||
* rows: 列表明细
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse reduce(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
package org.nl.wms.pda.general_management.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.ext.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.service.util.AcsResponse;
|
||||
import org.nl.wms.pda.general_management.service.PdaPointAndPointBoxService;
|
||||
import org.nl.wms.pda.util.PdaResponse;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.sch_manage.service.PointToPointService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch_manage.service.dao.mapper.SchBasePointMapper;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
||||
@@ -41,12 +46,24 @@ public class PdaPointAndPointServiceImpl implements PdaPointAndPointBoxService {
|
||||
@Autowired
|
||||
private SchBasePointMapper schBasePointMapper;
|
||||
|
||||
/**
|
||||
* 点位服务
|
||||
*/
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
|
||||
/**
|
||||
* 组盘服务
|
||||
*/
|
||||
@Autowired
|
||||
private IMdPbGroupplateService iMdPbGroupplateService;
|
||||
|
||||
/**
|
||||
* 调用ACS服务
|
||||
*/
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
|
||||
@Override
|
||||
public PdaResponse createTask(JSONObject whereJson) {
|
||||
pointToPointService.create(whereJson);
|
||||
@@ -111,4 +128,69 @@ public class PdaPointAndPointServiceImpl implements PdaPointAndPointBoxService {
|
||||
);
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse queryPointInfo(JSONObject whereJson) {
|
||||
JSONArray result = new JSONArray();
|
||||
// 查询点位信息
|
||||
SchBasePoint pointDao = schBasePointMapper.selectById(whereJson.getString("point_code"));
|
||||
if (ObjectUtil.isEmpty(pointDao)) {
|
||||
throw new BadRequestException("点位不存在【"+whereJson.getString("point_code")+"】");
|
||||
}
|
||||
JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(pointDao), JSONObject.class);
|
||||
json.put("device_code", pointDao.getPoint_code());
|
||||
try {
|
||||
// 查询设备状态
|
||||
AcsResponse device = wmsToAcsService.getDevice(json);
|
||||
if (device.getStatus() != 200) {
|
||||
throw new BadRequestException("获取设备失败:" + device.getMessage());
|
||||
}
|
||||
JSONObject data = device.getParameters();
|
||||
Boolean get_status = data.getBoolean("get_status");
|
||||
Boolean put_status = data.getBoolean("put_status");
|
||||
if (get_status) {
|
||||
json.put("get_status","是");
|
||||
} else {
|
||||
json.put("get_status","否");
|
||||
}
|
||||
if (put_status) {
|
||||
json.put("put_status","是");
|
||||
} else {
|
||||
json.put("put_status","否");
|
||||
}
|
||||
result.add(json);
|
||||
} catch (Exception e) {
|
||||
result.add(json);
|
||||
return PdaResponse.requestParamOk(result);
|
||||
}
|
||||
return PdaResponse.requestParamOk(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse putConfirm(JSONObject whereJson) {
|
||||
List<JSONObject> list = whereJson.getJSONArray("rows").toJavaList(JSONObject.class);
|
||||
iSchBasePointService.putConfirm(list.get(0));
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse getConfirm(JSONObject whereJson) {
|
||||
List<JSONObject> list = whereJson.getJSONArray("rows").toJavaList(JSONObject.class);
|
||||
iSchBasePointService.getConfirm(list.get(0));
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse reduce(JSONObject whereJson) {
|
||||
List<JSONObject> list = whereJson.getJSONArray("rows").toJavaList(JSONObject.class);
|
||||
|
||||
JSONObject jsonParam = new JSONObject();
|
||||
jsonParam.put("type", IOSConstant.THREE);
|
||||
jsonParam.put("device_code", list.get(0).getString("point_code"));
|
||||
AcsResponse acsResponse = wmsToAcsService.confirmAgv(jsonParam);
|
||||
if (acsResponse.getStatus() != 200) {
|
||||
throw new BadRequestException(acsResponse.getMessage());
|
||||
}
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE_CarToWms" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/CarToWms/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.wms.ext.service.impl.NotCarToWmsServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="FILE_CarToWms"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE_WmsToCar" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/WmsToCar/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.wms.ext.service.impl.WmsToNotCarServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="FILE_WmsToCar"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -17,6 +17,8 @@ https://juejin.cn/post/6844903775631572999
|
||||
<!--引入默认的一些设置-->
|
||||
<include resource="log/SendAcsTask.xml"/>
|
||||
<include resource="log/AcsToWms.xml"/>
|
||||
<include resource="log/CarToWms.xml"/>
|
||||
<include resource="log/WmsToCar.xml"/>
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!--withJansi 参数改为true-->
|
||||
|
||||
Reference in New Issue
Block a user