This commit is contained in:
2023-03-28 17:51:24 +08:00
7 changed files with 411 additions and 146 deletions

View File

@@ -44,8 +44,17 @@ public class CacheLineHandController{
@Log("物料查询")
@ApiOperation("物料查询")
public CommonResult<List<MaterialDto>> materialQuery(@RequestBody JSONObject form) {
String params = form.getString("search_bar");
//任务类型和任务ID校验instruct_uuid为前端参数命名本来应为task_id
if(StringUtils.isNotEmpty(params)) {
//限制查询参数过短,模糊力度大
int length = params.length();
if(length < 3) {
throw new BizCoreException("您输入的条件匹配的范围太大,请重新输入稍长一点的内容。");
}
}
log.info("海亮缓存线手持服务 [查询物料] 接口被请求, 请求参数-{}", form);
return RestBusinessTemplate.execute(() -> cacheLineHandService.materialQuery(form.getString("search_bar")));
return RestBusinessTemplate.execute(() -> cacheLineHandService.materialQuery(params));
}
@PostMapping("/queryMaterial")
@@ -112,14 +121,14 @@ public class CacheLineHandController{
@PostMapping("/instOperation")
@Log("任务操作")
@ApiOperation("任务操作")
public CommonResult<Void> instOperation(@RequestBody JSONObject param) {
public CommonResult<String> instOperation(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [任务操作] 接口被请求, 请求参数-{}", param);
return RestBusinessTemplate.execute(() -> {
//任务类型和任务ID校验instruct_uuid为前端参数命名本来应为task_id
if(StringUtils.isEmpty(param.getString("instruct_uuid")) || StringUtils.isEmpty(param.getString("opt_type"))) {
throw new BizCoreException(ResultCode.MISS_PARAMETER);
}
cacheLineHandService.instOperation(param);
return cacheLineHandService.instOperation(param);
});
}
@@ -138,10 +147,10 @@ public class CacheLineHandController{
@PostMapping("/cacheLineOutBoxExceptionConfirm")
@Log("缓存线出入箱异常-确认")
@ApiOperation("缓存线出入箱异常-确认")
public CommonResult<Void> cacheLineOutBoxExceptionConfirm(@RequestBody JSONObject param) {
public CommonResult<String> cacheLineOutBoxExceptionConfirm(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线出箱异常-确认] 接口被请求, 请求参数-{}", param);
//参数校验
if( StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("position_code")) || StringUtils.isEmpty(param.getString("vehicle_code"))) {
if(StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("position_code")) || StringUtils.isEmpty(param.getString("vehicle_code"))) {
throw new BizCoreException(ResultCode.MISS_PARAMETER);
}
return RestBusinessTemplate.execute(() -> cacheLineHandService.cacheLineOutBoxExceptionConfirm(param));
@@ -158,8 +167,12 @@ public class CacheLineHandController{
@PostMapping("/inOutEmptyBox")
@Log("空箱初始化--出入空箱")
@ApiOperation("空箱初始化--出入空箱")
public CommonResult<Void> inOutEmptyBox(@RequestBody JSONObject param) {
public CommonResult<String> inOutEmptyBox(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [空箱初始化--出入空箱] 接口被请求, 请求参数-{}", param);
//参数校验
if(StringUtils.isEmpty(param.getString("inOut_type")) || StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("vehicle_code"))) {
throw new BizCoreException(ResultCode.MISS_PARAMETER);
}
return RestBusinessTemplate.execute(() -> cacheLineHandService.inOutEmptyBox(param));
}
@@ -167,15 +180,19 @@ public class CacheLineHandController{
@Log("缓存线出入箱异常指令查询")
@ApiOperation("缓存线出入箱异常指令查询")
public CommonResult<JSONArray> inOutExceptionInstQuery(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线出入箱异常指令查询] 接口被请求, 请求参数-{}", param);
log.info("海亮缓存线手持服务 [缓存线出入箱异常指令查询] 接口被·请求, 请求参数-{}", param);
return RestBusinessTemplate.execute(() -> cacheLineHandService.inOutExceptionInstQuery(param));
}
@PostMapping("/inOutExceptionInstConfirm")
@Log("缓存线出入箱异常指令确认")
@ApiOperation("缓存线出入箱异常指令确认")
public CommonResult<Void> inOutExceptionInstConfirm(@RequestBody JSONObject param) {
public CommonResult<String> inOutExceptionInstConfirm(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线出入箱异常指令确认] 接口被请求, 请求参数-{}", param);
//参数校验
if(StringUtils.isEmpty(param.getString("instruct_uuid")) || StringUtils.isEmpty(param.getString("inOut_type")) || StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("vehicle_code"))) {
throw new BizCoreException(ResultCode.MISS_PARAMETER);
}
return RestBusinessTemplate.execute(() -> cacheLineHandService.inOutExceptionInstConfirm(param));
}
@@ -246,7 +263,7 @@ public class CacheLineHandController{
@PostMapping("/cacheLineExcepOpt")
@Log("缓存线异常处理")
@ApiOperation("缓存线异常处理")
public CommonResult<Void> cacheLineExcepOpt(@RequestBody JSONObject param) {
public CommonResult<String> cacheLineExcepOpt(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线异常处理] 接口被请求, 请求参数-{}", param);
//参数校验
if(StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("opt_type"))) {

View File

@@ -86,16 +86,6 @@ public interface CacheLineHandService{
*/
JSONArray instStatusQuery(String param);
/**
* 任务操作
*
* @Param: form 任务参数
* @return: 操作结果
* @author gbx
* @date 2023/3/23
*/
void instOperation(JSONObject param);
/**
* 任务分页查询
*
@@ -124,15 +114,6 @@ public interface CacheLineHandService{
*/
JSONArray cacheLineMaterInfoQuery(JSONObject param);
/**
* 空箱初始化--出入空箱
*
* @param param 查询参数 inOut_type:1 入空箱 2 出空箱 vehicle_code:载具编码
* @author gbx
* @date 2023/3/24
*/
void inOutEmptyBox(JSONObject param);
/**
* 缓存线出入箱异常指令查询
*
@@ -150,7 +131,36 @@ public interface CacheLineHandService{
* @author gbx
* @date 2023/3/24
*/
void inOutExceptionInstConfirm(JSONObject param);
String inOutExceptionInstConfirm(JSONObject param);
/**
* 任务操作
*
* @Param: form 任务参数
* @return: 操作结果
* @author gbx
* @date 2023/3/23
*/
String instOperation(JSONObject param);
/**
* 缓存线出箱异常-确认
*
* @param param 查询参数
* @return String 处理结果
* @author gbx
* @date 2023/3/24
*/
String cacheLineOutBoxExceptionConfirm(JSONObject param);
/**
* 空箱初始化--出入空箱
*
* @param param 查询参数 inOut_type:1 入空箱 2 出空箱 vehicle_code:载具编码
* @author gbx
* @date 2023/3/24
*/
String inOutEmptyBox(JSONObject param);
/**
* 设置满框
@@ -208,15 +218,6 @@ public interface CacheLineHandService{
*/
void agvOutBoxExceptionConfirm(JSONObject param);
/**
* 缓存线出箱异常-确认
*
* @param param 查询参数
* @author gbx
* @date 2023/3/24
*/
void cacheLineOutBoxExceptionConfirm(JSONObject param);
/**
* 设置缓存线货位为空位置
*
@@ -240,10 +241,11 @@ public interface CacheLineHandService{
* 缓存线异常处理
*
* @param param 查询参数
* @return String 处理结果
* @author gbx
* @date 2023/3/24
*/
void cacheLineExcepOpt(JSONObject param);
String cacheLineExcepOpt(JSONObject param);
/**
* 倒料操作
@@ -256,6 +258,7 @@ public interface CacheLineHandService{
/**
* 缓存线下拉框
*
* @param param
* @return
*/
@@ -263,6 +266,7 @@ public interface CacheLineHandService{
/**
* 缓存线物料信息盘点
*
* @param param
* @return
*/
@@ -270,12 +274,14 @@ public interface CacheLineHandService{
/**
* 获取生产区域下拉框
*
* @return
*/
JSONArray getProductArea();
/**
* 删除箱子
*
* @param param
*/
void deleteBox(JSONObject param);

View File

@@ -16,6 +16,7 @@ import org.nl.common.enums.StatusEnum;
import org.nl.common.utils.*;
import org.nl.config.thread.ThreadPoolExecutorUtil;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.exception.BizCoreException;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
@@ -30,6 +31,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.xml.transform.Result;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor;
@@ -71,6 +73,9 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
// stopWatch.start();
// stopWatch.stop();
// System.out.println("缓存本地花费时间 totalTime = " + stopWatch.getTotalTimeMillis());
if(StringUtils.isEmpty(param)) {
return WQL.getWO("PDA_QUERY").addParam("flag", "6").addParam("condition", param).process().getResultJSONArray(0).toJavaList(MaterialDto.class);
}
List<MaterialDto> materialList;
ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll();
//12W种物料信息查本地缓存
@@ -81,7 +86,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
//2.查reids
materialList = redisUtils.get("materialList", MaterialDto.class);
if(null != materialList) {
//设置本地缓存
// //设置本地缓存
cache.setLocalCache("materialList", materialList);
return getMaterialDto(materialList, param);
}
@@ -110,7 +115,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
private List<MaterialDto> getMaterialDto(List<MaterialDto> materialList, String param) {
if(StringUtils.isNotEmpty(param)) {
//按条件搜索
materialList = materialList.stream().filter(m -> (m.getMaterial_name().contains(param)) || m.getMaterial_code().contains(param) || m.getMaterial_spec().contains(param) || m.getClass_name().contains(param)).collect(Collectors.toList());
materialList = materialList.stream().filter(m -> (m.getMaterial_name().indexOf(param) > -1) || (m.getMaterial_code().indexOf(param)) > -1 || (m.getMaterial_spec().indexOf(param)) > -1).collect(Collectors.toList());
return materialList;
}
return materialList;
@@ -184,25 +189,28 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
}
@Override
public void instOperation(JSONObject param) {
public String instOperation(JSONObject param) {
String optType = param.getString("opt_type");
SpeMachineryTask SpeMachineryTask = new SpeMachineryTask();
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
JSONObject taskObject = taskTab.query("task_id =" + param.getString("instruct_uuid")).uniqueResult(0);
//01-取消、02-完成、03-任务下发,根据操作类型执行相关操作
if("01".equals(optType) || "02".equals(optType)) {
updateTaskStatus(taskObject, optType);
if("1".equals(optType) || "2".equals(optType)) {
return updateTaskStatus(taskObject, optType);
}
//任务下发
if("03".equals(optType)) {
SpeMachineryTask.createTask(taskObject);
else if("3".equals(optType)) {
return SpeMachineryTask.createTask(taskObject);
}
else{
return null;
}
}
/**
* 任务取消和完成操作,更新任务状态
*/
public void updateTaskStatus(JSONObject taskObj, String status) {
public String updateTaskStatus(JSONObject taskObj, String status) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
HashMap<String,String> map = new HashMap<>(4);
@@ -210,12 +218,14 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
map.put("update_optid", currentUserId);
map.put("update_optname", nickName);
map.put("update_time", DateUtil.now());
WQLObject.getWQLObject("sch_base_task").update(map, "task_id = '" + taskObj.getString("task_id") + "'");
int result = (WQLObject.getWQLObject("sch_base_task").update(map, "task_id = '" + taskObj.getString("task_id") + "'").getSucess());
return Integer.toString(result);
}
@Override
@Async
public void cacheLineMaterSync(String cachelineCode) {
public void cacheLineMaterSync(
String cachelineCode) {
if(StringUtils.isEmpty(cachelineCode)) {
return;
}
@@ -264,13 +274,13 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
json.put("quantity", "0");
//不展示
if("0".equals(json.getString("is_show"))) {
json.put("vehicle_status", "04");
json.put("vehicle_status", "4");
}
//展示
else{
//是否空位
if("1".equals(json.getString("is_empty"))) {
json.put("vehicle_status", "00");
json.put("vehicle_status", "0");
}
else{
// 载具不是空位
@@ -279,7 +289,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
JSONObject ivtObj = ivtTab.query("vehicle_code = '" + vehicle_code + "' and cacheLine_code like '%" + param.getString("wcsdevice_code") + "%'").uniqueResult(0);
if(ivtObj == null) {
//标记为红色异常
json.put("vehicle_status", "03");
json.put("vehicle_status", "3");
}
else{
json.put("vehicle_status", ivtObj.getString("vehicle_status"));
@@ -331,9 +341,13 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
WQLObject meTab = WQLObject.getWQLObject("md_me_materialbase");
// 查询工序信息
JSONObject wpObj = wpTab.query("workprocedure_code = '" + workprocedure_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(wpObj)) throw new BadRequestException("工序查询错误,请检查工序");
if(ObjectUtil.isEmpty(wpObj)) {
throw new BadRequestException("工序查询错误,请检查工序");
}
JSONObject meObj = meTab.query("material_id = '" + semimanufactures_uuid + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(meObj)) throw new BadRequestException("物料查询错误,请检查物料");
if(ObjectUtil.isEmpty(meObj)) {
throw new BadRequestException("物料查询错误,请检查物料");
}
vehiobj.put("vehicle_code", vehicle_code);
//2.缓存线位置通过扫码绑定料箱条码
positionTab.update(vehiobj);
@@ -363,7 +377,8 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
@Override
@Transactional(rollbackFor = Exception.class)
public void setEmptyBox(JSONObject param) {
public void setEmptyBox(
JSONObject param) {
// 缓存线位置编码
String position_code = param.getString("position_code");
// 载具条码
@@ -415,10 +430,12 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
* 出入空箱,出入类型 inOut_type 1 入空箱 2 出空箱 缓存线编码 wcsdevice_code 料箱码 vehicle_code
*/
@Override
public void inOutEmptyBox(JSONObject param) {
public String inOutEmptyBox(JSONObject param) {
String inOut_type = param.getString("inOut_type");
String cacheLine_code = param.getString("wcsdevice_code");
String vehicle_code = param.getString("vehicle_code");
String position_code = param.getString("position_code");
int result = 1;
// 缓存线位置表
WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position");
//缓存线载具物料表
@@ -431,30 +448,32 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
throw new BadRequestException("箱子【" + vehicle_code + "】已在库内,无法入空箱!");
}
// 3.判断是否可以放入空箱子
JSONObject json = positionTab.query("cacheLine_code = '" + cacheLine_code + "' and is_blank= '1'").uniqueResult(0);
JSONObject json = positionTab.query("cacheLine_code = '" + cacheLine_code + "position_code = '" + position_code + "' and is_blank= '1'").uniqueResult(0);
if(json == null) {
throw new BadRequestException("无法找到缓存线【" + cacheLine_code + "】的空位,无法入空箱!");
throw new BadRequestException("无法找到缓存线【" + position_code + "】的空位,无法入空箱!");
}
// 3.入空箱子
JSONObject afterIvt = new JSONObject();
afterIvt.put("vehmaterial_id", IdUtil.getStringId());
afterIvt.put("vehicle_code", vehicle_code);
afterIvt.put("cacheLine_code", cacheLine_code);
afterIvt.put("vehicle_status", "01");
afterIvt.put("position_code", position_code);
afterIvt.put("vehicle_status", "1");
afterIvt.put("update_time", DateUtil.now());
afterIvt.put("create_time", DateUtil.now());
vehMaterTab.insert(afterIvt);
result = vehMaterTab.insert(afterIvt).getSucess();
}
// 出空箱
if("2".equals(inOut_type)) {
// 缓存线载具物料表
JSONObject json = vehMaterTab.query("cacheLine_code = '" + cacheLine_code + "' and vehicle_status= '01' and vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
JSONObject json = vehMaterTab.query("cacheLine_code = '" + position_code + "' and vehicle_status= '1' and vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
if(json == null) {
throw new BadRequestException("无法找到缓存线【" + cacheLine_code + "】的空箱【" + vehicle_code + "】,出空箱失败");
}
// 删除掉出库的箱子及关联物料
vehMaterTab.delete("cacheLine_code = '" + cacheLine_code + "' and vehicle_code = '" + vehicle_code + "'");
result = vehMaterTab.delete("cacheLine_code = '" + position_code + "' and vehicle_code = '" + vehicle_code + "'").getSucess();
}
return Integer.toString(result);
}
/**
@@ -465,53 +484,52 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
*/
@Override
public JSONArray inOutExceptionInstQuery(JSONObject param) {
// 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码
// 出入类型 inOut_type
// 缓存线编码 wcsdevice_code
// 料箱码 vehicle_code
// {"inOut_type":"1","wcsdevice_code":"HCX01","vehicle_code":"10001"}
//料箱号
String vehicle_code = param.getString("vehicle_code");
//缓存线编号
String wcsdevice_code = param.getString("wcsdevice_code");
//出入箱类型
String inOut_type = param.getString("inOut_type");
//任务表信息
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
JSONArray result = new JSONArray();
// 入箱扫码异常
if("1".equals(inOut_type)) {
String where = "point_code2 = '" + wcsdevice_code + "' and instruct_status <> '06'";
String where = "point_code2 = '" + wcsdevice_code + "' and task_status <> '7'";
if(StringUtils.isNotBlank(vehicle_code)) {
where = "point_code2 = '" + wcsdevice_code + "' and invehicle_code = '" + vehicle_code + "' and instruct_status <> '06'";
where = "point_code2 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'";
}
JSONArray arr = instructTab.query(where).getResultJSONArray(0);
for(int i = 0; i < arr.size(); i++) {
JSONObject row = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("instruct_uuid", row.getString("task_id"));
json.put("instructorder_no", row.getString("instructorder_no"));
json.put("instructorder_no", row.getString("task_code"));
json.put("wcsdevice_code", row.getString("point_code2"));
json.put("vehicle_code", row.getString("invehicle_code"));
json.put("startpoint_code", row.getString("startpoint_code"));
json.put("nextpoint_code", row.getString("nextpoint_code"));
json.put("nextpoint_code2", row.getString("nextpoint_code2"));
json.put("vehicle_code", row.getString("vehicle_code"));
json.put("startpoint_code", row.getString("point_code1"));
json.put("nextpoint_code", row.getString("point_code2"));
json.put("nextpoint_code2", row.getString("point_code3"));
result.add(json);
}
}
// 出箱扫码异常
if("2".equals(inOut_type)) {
String where = "startwcsdevice_code = '" + wcsdevice_code + "' and instruct_status <> '06'";
String where = "point_code1 = '" + wcsdevice_code + "' and task_status <> '7'";
if(StringUtils.isNotBlank(vehicle_code)) {
where = "startwcsdevice_code = '" + wcsdevice_code + "' and outvehicle_code = '" + vehicle_code + "' and instruct_status <> '06'";
where = "point_code1 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'";
}
JSONArray arr = instructTab.query(where).getResultJSONArray(0);
for(int i = 0; i < arr.size(); i++) {
JSONObject row = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("instruct_uuid", row.getString("task_id"));
json.put("instructorder_no", row.getString("instructorder_no"));
json.put("vehicle_code", row.getString("outvehicle_code"));
json.put("wcsdevice_code", row.getString("startwcsdevice_code"));
json.put("startpoint_code", row.getString("startpoint_code"));
json.put("nextpoint_code", row.getString("nextpoint_code"));
json.put("nextpoint_code2", row.getString("nextpoint_code2"));
json.put("instructorder_no", row.getString("task_code"));
json.put("vehicle_code", row.getString("vehicle_code"));
json.put("wcsdevice_code", row.getString("point_code1"));
json.put("startpoint_code", row.getString("point_code1"));
json.put("nextpoint_code", row.getString("point_code2"));
json.put("nextpoint_code2", row.getString("point_code3"));
result.add(json);
}
}
@@ -526,26 +544,56 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void inOutExceptionInstConfirm(JSONObject param) {
public String inOutExceptionInstConfirm(JSONObject param) {
// 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码
String inOut_type = param.getString("inOut_type");
// 缓存线编码
String wcsdevice_code = param.getString("wcsdevice_code");
//
//缓存线点位
String position_code = param.getString("position_code");
//载具编码
String vehicle_code = param.getString("vehicle_code");
// 指令标识
// String instruct_uuid = param.getString("instruct_uuid");
// JSONObject instObj = instructTab.query("task_id = '" + instruct_uuid +
// "'").uniqueResult(0);
// 封装给wcs的数据
// 封装给acs的数据
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
jsonObject.put("inOut_type", inOut_type);
jsonObject.put("wcsdevice_code", wcsdevice_code);
jsonObject.put("vehicle_code", vehicle_code);
jsonObject.put("position_code", position_code);
jsonArray.add(jsonObject);
try {
//TOFIX 等确定api后换成下发的url
AcsUtil.notifyAcs("api", jsonArray);
return AcsUtil.notifyAcs("api", jsonArray).getString("status");
}
catch(Exception e) {
throw new BadRequestException(e.getMessage());
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public String cacheLineExcepOpt(JSONObject param) {
// 缓存线编码
String wcsdevice_code = param.getString("wcsdevice_code");
// 1-暂停、2-启动
String opt_type = param.getString("opt_type");
// 类型:恢复是0暂停是1
String type = "1";
if("2".equals(opt_type)) {
type = "0";
}
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
jsonObject.put("type", type);
jsonObject.put("wcsdevice_code", wcsdevice_code);
jsonArray.add(jsonObject);
try {
//TOFIX 等确定api后换成下发的url
return AcsUtil.notifyAcs("api", jsonArray).getString("status");
}
catch(Exception e) {
throw new BadRequestException(e.getMessage());
}
}
/**
@@ -558,7 +606,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
// JSONArray arr = WQLObject.getWQLObject("sch_cacheline_position").query("cacheLine_code like '%" + wcsdevice_code + "%'").getResultJSONArray(0);
// StringBuilder sd = new StringBuilder();
// for(int i = 0; i < arr.size(); i++) {
// JSONObject row = arr.getJSONObject(i);
// JSONObject row = arr.getJSONObject(i);.
// sd.append(row.getString("task_id")).append(",");
// }
// String taskIdList = sd.toString();
@@ -567,16 +615,16 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
String wcsdevice_code = param.getString("wcsdevice_code");
String position_code = param.getString("position_code");
//根据缓存线编码和缓存线点位查找任务ID
JSONObject posiObj = WQLObject.getWQLObject("sch_cacheline_position").query("position_code = " + position_code + " and cacheLine_code like '%" + wcsdevice_code + "%'").uniqueResult(0);
JSONObject posiObj = WQLObject.getWQLObject("sch_cacheline_position").query("position_code like '%" + position_code + "%'" + " and cacheLine_code like '%" + wcsdevice_code + "%'").uniqueResult(0);
//查不到点位信息
if(null == posiObj) {
throw new BadRequestException("未找到该缓存线的点位信息!");
}
//查不到任务信息
if(StringUtils.isNotEmpty(posiObj.getString("task_id"))) {
if(StringUtils.isEmpty(posiObj.getString("task_id"))) {
throw new BadRequestException("未找到该缓存线的点位的任务信息!");
}
return WQL.getWO("QSCH_TASK_01").addParam("flag", 10).addParam("task_id", posiObj.getString("task_id")).process().getResultJSONArray(0);
return WQL.getWO("PDA_QUERY").addParam("flag", "10").addParam("task_id", posiObj.getString("task_id")).process().getResultJSONArray(0);
}
/**
@@ -587,7 +635,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
* 料箱码 vehicle_code
*/
@Override
public void cacheLineOutBoxExceptionConfirm(JSONObject param) {
public String cacheLineOutBoxExceptionConfirm(JSONObject param) {
String inOut_type = param.getString("inOut_type");
String wcsdevice_code = param.getString("wcsdevice_code");
String position_code = param.getString("position_code");
@@ -637,12 +685,12 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
json.put("material_name", meObj.getString("material_name"));
json.put("quantity", instructObj.getString("material_qty"));
json.put("product_area", instructObj.getString("product_area"));
json.put("vehicle_status", "02");
json.put("vehicle_status", "2");
}
// 出满箱扫码异常
if("2".equals(inOut_type)) {
//5.重新新建该缓存线位置上的料箱为空箱子,是空料箱没有放物料等其他信息
json.put("vehicle_status", "01");
json.put("vehicle_status", "1");
json.put("material_uuid", "");
json.put("material_code", "");
json.put("material_spec", "");
@@ -653,7 +701,8 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
json.put("workprocedure_name", "");
json.put("product_area", "");
}
ivtTab.insert(json);
int result = ivtTab.insert(json).getSucess();
return Integer.toString(result);
}
/**
@@ -666,7 +715,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
String where = "point_code2 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'";
if(StringUtils.isEmpty(vehicle_code)) {
where = "point_code2 = '" + wcsdevice_code + "' and instruct_status <> '7'";
where = "point_code2 = '" + wcsdevice_code + "' and task_status <> '7'";
}
JSONArray arr = instructTab.query(where).getResultJSONArray(0);
JSONArray result = new JSONArray();
@@ -674,11 +723,11 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
JSONObject row = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("instruct_uuid", row.getString("task_id"));
json.put("instructorder_no", row.getString("instructorder_no"));
json.put("instructorder_no", row.getString("task_code"));
json.put("wcsdevice_code", row.getString("point_code2"));
json.put("startpoint_code", row.getString("startpoint_code"));
json.put("nextpoint_code", row.getString("nextpoint_code"));
json.put("nextpoint_code2", row.getString("nextpoint_code2"));
json.put("point_code1", row.getString("point_code1"));
json.put("nextpoint_code", row.getString("point_code2"));
json.put("nextpoint_code2", row.getString("point_code3"));
result.add(json);
}
return result;
@@ -720,22 +769,22 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
JSONArray arr;
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
if(StringUtils.isEmpty(vehicle_code)) {
arr = instructTab.query("startwcsdevice_code = '" + wcsdevice_code + "' and instruct_status <> '06'").getResultJSONArray(0);
arr = instructTab.query("point_code1 = '" + wcsdevice_code + "' and task_status <> '7'").getResultJSONArray(0);
}
else{
arr = instructTab.query("startwcsdevice_code = '" + wcsdevice_code + "' and outvehicle_code = '" + vehicle_code + "' and instruct_status <> '06'").getResultJSONArray(0);
arr = instructTab.query("point_code1 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'").getResultJSONArray(0);
}
JSONArray result = new JSONArray();
for(int i = 0; i < arr.size(); i++) {
JSONObject row = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("instruct_uuid", row.getString("task_id"));
json.put("instructorder_no", row.getString("instructorder_no"));
json.put("wcsdevice_code", row.getString("startwcsdevice_code"));
json.put("vehicle_code", row.getString("outvehicle_code"));
json.put("startpoint_code", row.getString("startpoint_code"));
json.put("nextpoint_code", row.getString("nextpoint_code"));
json.put("nextpoint_code2", row.getString("nextpoint_code2"));
json.put("instructorder_no", row.getString("task_code"));
json.put("wcsdevice_code", row.getString("point_code1"));
json.put("vehicle_code", row.getString("vehicle_code"));
json.put("startpoint_code", row.getString("point_code1"));
json.put("nextpoint_code", row.getString("point_code2"));
json.put("nextpoint_code2", row.getString("point_code3"));
result.add(json);
}
return result;
@@ -761,26 +810,6 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
// inst.updateInstStatus(instObj, "2");
}
@Override
public void cacheLineExcepOpt(JSONObject param) {
// 缓存线编码
String wcsdevice_code = param.getString("wcsdevice_code");
// 1-暂停、2-启动
String opt_type = param.getString("opt_type");
// 类型:恢复是0暂停是1
String type = "1";
if("02".equals(opt_type)) {
type = "0";
}
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
jsonObject.put("type", type);
jsonObject.put("wcsdevice_code", wcsdevice_code);
jsonArray.add(jsonObject);
//TOFIX 等确定api后换成下发的url
AcsUtil.notifyAcs("api", jsonArray);
}
@Override
public void pourMaterial(JSONObject param) {
// 指令标识
@@ -802,10 +831,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
public JSONArray getCacheLine(JSONObject param) {
// 生产区域
String product_area = param.getString("product_area");
JSONArray resultJSONArray = WQL.getWO("PDA_QUERY")
.addParamMap(MapOf.of("flag", "7", "product_area", product_area))
.process()
.getResultJSONArray(0);
JSONArray resultJSONArray = WQL.getWO("PDA_QUERY").addParamMap(MapOf.of("flag", "7", "product_area", product_area)).process().getResultJSONArray(0);
return resultJSONArray;
}
@@ -833,6 +859,8 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
public void deleteBox(JSONObject param) {
WQLObject cvTab = WQLObject.getWQLObject("SCH_CacheLine_VehileMaterial");
String vehicleCode = param.getString("vehicle_code");
if (ObjectUtil.isNotEmpty(vehicleCode)) cvTab.delete("vehicle_code = '" + vehicleCode + "'");
if(ObjectUtil.isNotEmpty(vehicleCode)) {
cvTab.delete("vehicle_code = '" + vehicleCode + "'");
}
}
}

View File

@@ -17,6 +17,14 @@
输入.condition TYPEAS s_string
输入.cacheLine_code TYPEAS s_string
输入.product_area TYPEAS s_string
输入.status TYPEAS s_string
输入.inst_num TYPEAS s_string
输入.start_point TYPEAS s_string
输入.end_point TYPEAS s_string
输入.start_date TYPEAS s_string
输入.end_date TYPEAS s_string
输入.task_id TYPEAS s_string
[临时表]
@@ -140,6 +148,9 @@
LEFT JOIN MD_PB_ClassStandard class ON class.class_id = mb.material_type_id
WHERE
mb.is_delete = '0'
ORDER BY
mb.material_id desc
LIMIT 1000
OPTION 输入.condition <> ""
mb.material_name LIKE CONCAT ('%', 输入.condition, '%')
OR mb.material_code LIKE CONCAT ('%', 输入.condition, '%')
@@ -239,17 +250,20 @@
OPTION 输入.status <> ""
find_in_set(task.task_status,输入.status)
ENDOPTION
OPTION 输入.inst_num <>""
(task.task_code like 输入.inst_num)
OPTION 输入.inst_num <> ""
(task.task_code like CONCAT ('%', 输入.inst_num, '%'))
ENDOPTION
OPTION 输入.vehicle_code <> ""
(task.vehicle_code like 输入.vehicle_code)
(task.vehicle_code like CONCAT ('%', 输入.vehicle_code, '%'))
ENDOPTION
OPTION 输入.start_point <> ""
(task.point_code1 like 输入.start_point)
(task.point_code1 like CONCAT ('%', 输入.start_point, '%'))
ENDOPTION
OPTION 输入.task_id <> ""
(task.task_id = 输入.task_id )
ENDOPTION
OPTION 输入.end_point <> ""
(task.point_code2 like 输入.end_point)
(task.point_code2 like CONCAT ('%', 输入.end_point, '%'))
ENDOPTION
OPTION 输入.start_date <> ""
task.create_time >= 输入.start_date

View File

@@ -53,8 +53,8 @@ public class SpeMachineryTask extends AbstractAcsTask {
@Override
public String createTask(JSONObject form) {
String start_point_code = form.getString("start_point_code");
String next_point_code = form.getString("next_point_code");
String start_point_code = form.getString("point_code1");
String next_point_code = form.getString("point_code2");
String vehicle_code = form.getString("vehicle_code");
String type = form.getString("type");
if (StrUtil.isEmpty(start_point_code)) {
@@ -68,7 +68,6 @@ public class SpeMachineryTask extends AbstractAcsTask {
}
String taskdtl_id = IdUtil.getSnowflake(1, 1).nextId() + "";
JSONObject task = new JSONObject();
task.put("taskdtl_id", taskdtl_id);
task.put("task_id", taskdtl_id);
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
task.put("task_type", type);

View File

@@ -0,0 +1,201 @@
server:
port: 8011
#配置数据源
spring:
data:
elasticsearch:
repositories:
enabled: true
client:
reactive:
#endpoints: 172.31.185.110:9200,172.31.154.9:9200 #内网
# endpoints: 47.96.133.178:8200 #外网
endpoints: http://47.96.133.178:8200 #外网
elasticsearch:
rest:
#uris: 172.31.185.110:9200,172.31.154.9:9200 #内网
# uris: 47.96.133.178:8200 #外网
uris: http://47.96.133.178:8200 #外网
username: elastic
password: 123456
datasource:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
#url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
username: ${DB_USER:shenhua}
#password: ${DB_PWD:P@ssw0rd}
#password: ${DB_PWD:root}
#password: ${DB_PWD:Root.123456}
password: ${DB_PWD:123456789}
# 初始连接数
initial-size: 5
# 最小连接数
min-idle: 15
# 最大连接数
max-active: 30
# 是否自动回收超时连接
remove-abandoned: true
# 超时时间(以秒数为单位)
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
filters:
DruidFilter,stat
redis:
#数据库索引
database: ${REDIS_DB:1}
#host: ${REDIS_HOST:127.0.0.1}
host: ${REDIS_HOST:localhost}
port: ${REDIS_PORT:6379}
password: ${REDIS_PWD:}
#连接超时时间
timeout: 5000
redisson:
config: |
threads: 4
nettyThreads: 4
singleServerConfig:
connectionMinimumIdleSize: 8
connectionPoolSize: 8
address: redis://127.0.0.1:6379
idleConnectionTimeout: 10000
timeout: 3000
# 登录相关配置
login:
# 登录缓存
cache-enable: true
# 是否限制单用户登录
single-login: false
# 验证码
login-code:
# 验证码类型配置 查看 LoginProperties 类
code-type: arithmetic
# 登录图形验证码有效时间/分钟
expiration: 2
# 验证码高度
width: 111
# 验证码宽度
heigth: 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: 100
avatarMaxSize: 5
sa-token:
# token 名称 (同时也是cookie名称)
token-name: Authorization
# token 有效期单位s 默认30天, -1代表永不过期
timeout: 2592000
# token 临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
activity-timeout: -1
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
is-concurrent: true
# 在多人登录同一账号时是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
is-share: false
# token风格
token-style: random-128
# 是否输出操作日志
is-log: false
jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq
# token 前缀
token-prefix:
cookie:
# 配置 Cookie 作用域:根据二级域名实现sso登入如lms.sso.com;acs.sso.com
domain:
#jetcache:
# defaultCacheType: LOCAL
# statIntervalMinutes: 15
# areaInCacheName: false
# hiddenPackages: com.yb
# local:
# default:
# type: caffeine
# limit: 100
# keyConvertor: fastjson
# expireAfterWriteInMillis: 60000
# remote:
# default:
# type: redis.lettuce
# keyConvertor: fastjson
# valueEncoder: kryo
# valueDecoder: kryo
# poolConfig:
# minIdle: 5
# maxIdle: 200
# maxTotal: 1000
# uri:
# - redis://127.0.0.1:6379
es:
index: mes_log