手持下发任务修复
This commit is contained in:
@@ -2,6 +2,7 @@ package org.nl.wms.pda.sendmaterial.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
@@ -80,6 +81,32 @@ public class SendMaterialServiceImpl implements SendMaterialService {
|
|||||||
public JSONObject confirm(JSONObject param) {
|
public JSONObject confirm(JSONObject param) {
|
||||||
// 返回值
|
// 返回值
|
||||||
JSONObject resultJSON = new JSONObject();
|
JSONObject resultJSON = new JSONObject();
|
||||||
|
|
||||||
|
// 参数校验
|
||||||
|
String startRegionId = param.getString("start_region_id");
|
||||||
|
if (StrUtil.isEmpty(startRegionId)) {
|
||||||
|
resultJSON.put("code", "0");
|
||||||
|
resultJSON.put("desc", "起点区域不能为空");
|
||||||
|
return resultJSON;
|
||||||
|
}
|
||||||
|
String startPointCode = param.getString("start_point_code");
|
||||||
|
if (StrUtil.isEmpty(startPointCode)) {
|
||||||
|
resultJSON.put("code", "0");
|
||||||
|
resultJSON.put("desc", "起点不能为空");
|
||||||
|
return resultJSON;
|
||||||
|
}
|
||||||
|
String nextRegionId = param.getString("next_region_id");
|
||||||
|
if (StrUtil.isEmpty(nextRegionId)) {
|
||||||
|
resultJSON.put("code", "0");
|
||||||
|
resultJSON.put("desc", "终点区域不能为空");
|
||||||
|
return resultJSON;
|
||||||
|
}
|
||||||
|
String nextPointCode = param.getString("next_point_code");
|
||||||
|
if (StrUtil.isEmpty(nextPointCode)) {
|
||||||
|
resultJSON.put("code", "0");
|
||||||
|
resultJSON.put("desc", "终点不能为空");
|
||||||
|
return resultJSON;
|
||||||
|
}
|
||||||
String point_id=param.getString("point_id");
|
String point_id=param.getString("point_id");
|
||||||
int type=param.getIntValue("type");
|
int type=param.getIntValue("type");
|
||||||
String quality_scode=param.getString("quality_scode");
|
String quality_scode=param.getString("quality_scode");
|
||||||
@@ -90,7 +117,52 @@ public class SendMaterialServiceImpl implements SendMaterialService {
|
|||||||
}else if (type==2){
|
}else if (type==2){
|
||||||
ivt_json.put("quality_scode",null);
|
ivt_json.put("quality_scode",null);
|
||||||
}
|
}
|
||||||
ivtTab.update(ivt_json);
|
|
||||||
|
WQLObject regionIOTable = WQLObject.getWQLObject("st_ivt_regionio");
|
||||||
|
long id = IdUtil.getSnowflake(1, 1).nextId();
|
||||||
|
try {
|
||||||
|
// 创建搬运记录
|
||||||
|
RegionioDto dto = new RegionioDto();
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String nickName = SecurityUtils.getNickName();
|
||||||
|
String now = DateUtil.now();
|
||||||
|
dto.setIostorinv_id(id);
|
||||||
|
dto.setBill_code(CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||||
|
dto.setIo_type("0");
|
||||||
|
dto.setBill_status("10");
|
||||||
|
dto.setStart_region_id(startRegionId);
|
||||||
|
dto.setStart_point_code(startPointCode);
|
||||||
|
dto.setEnd_region_id(nextRegionId);
|
||||||
|
dto.setEnd_point_code(nextPointCode);
|
||||||
|
dto.setCreate_mode("02");
|
||||||
|
dto.setCreate_id(currentUserId);
|
||||||
|
dto.setCreate_name(nickName);
|
||||||
|
dto.setUpdate_optid(currentUserId);
|
||||||
|
dto.setUpdate_optname(nickName);
|
||||||
|
dto.setUpdate_time(now);
|
||||||
|
dto.setCreate_time(now);
|
||||||
|
regionIOTable.insert(JSONObject.parseObject(JSON.toJSONString(dto)));
|
||||||
|
|
||||||
|
// 创建任务并自动下发
|
||||||
|
String taskId = sendMaterialTask.createTask(param);
|
||||||
|
|
||||||
|
// 创建并下发成功后更新搬运记录
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("task_id", taskId);
|
||||||
|
json.put("bill_status", "20");
|
||||||
|
regionIOTable.update(json, "iostorinv_id = " + id);
|
||||||
|
if(ObjectUtil.isNotEmpty(ivt_json)) {
|
||||||
|
ivtTab.update(ivt_json);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("异常{}",e,e.getMessage());
|
||||||
|
// 手动回滚事务
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
|
||||||
|
resultJSON.put("code", "0");
|
||||||
|
resultJSON.put("desc", e.getMessage());
|
||||||
|
return resultJSON;
|
||||||
|
}
|
||||||
|
|
||||||
// 返回
|
// 返回
|
||||||
resultJSON.put("code", "1");
|
resultJSON.put("code", "1");
|
||||||
|
|||||||
Reference in New Issue
Block a user