前端修改 机械手双工位任务完成修改 工单反馈mes修改为系统参数控制

This commit is contained in:
张江玮
2023-01-12 15:27:18 +08:00
parent c6b177e6cd
commit f4711db7b5
7 changed files with 96 additions and 70 deletions

View File

@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.dto.ParamDto;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.basedata.service.MaterialbaseService;
@@ -169,16 +170,19 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
message = "操作成功!";
// 操作成功后向 MES 反馈
// JSONObject param = new JSONObject();
// param.put("material_code", materialbaseService.findById(jsonObject1.getLong("material_id")).getMaterial_code());
// param.put("workorder_code", jsonObject1.getString("workorder_code"));
// param.put("workorder_qty", jsonObject1.getString("plan_qty"));
// param.put("device_code", deviceService.findByCode(jsonObject1.getString("device_code")).getExtend_code());
// String workorder_uri = paramService.findByCode("mes_url").getValue() + "api/mes/materialIvt";
// HttpRequest
// .post(workorder_uri)
// .body(param.toJSONString())
// .execute();
ParamDto has_mes = paramService.findByCode("has_mes");
if (ObjectUtil.isNotEmpty(has_mes) && StrUtil.equals(has_mes.getValue(), "1")) {
JSONObject param = new JSONObject();
param.put("material_code", materialbaseService.findById(jsonObject1.getLong("material_id")).getMaterial_code());
param.put("workorder_code", jsonObject1.getString("workorder_code"));
param.put("workorder_qty", jsonObject1.getString("plan_qty"));
param.put("device_code", deviceService.findByCode(jsonObject1.getString("device_code")).getExtend_code());
String workorder_uri = paramService.findByCode("mes_url").getValue() + "api/mes/materialIvt";
HttpRequest
.post(workorder_uri)
.body(param.toJSONString())
.execute();
}
} catch (Exception e) {
status = "400";
message = "操作失败!";

View File

@@ -19,6 +19,7 @@ import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.common.utils.dto.CurrentUser;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.dto.ParamDto;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
@@ -28,6 +29,7 @@ import org.nl.wms.basedata.service.ClassstandardService;
import org.nl.wms.basedata.service.MaterialbaseService;
import org.nl.wms.basedata.service.dto.MaterialbaseDto;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.pdm.service.DeviceService;
import org.nl.wms.pdm.service.WorkordeService;
import org.nl.wms.pdm.service.dto.WorkorderDto;
@@ -53,6 +55,7 @@ public class WorkorderServiceImpl implements WorkordeService {
private final WmsToAcsService wmsToAcsService;
private final MaterialbaseService materialbaseService;
private final ParamService paramService;
private final DeviceService deviceService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
@@ -422,7 +425,7 @@ public class WorkorderServiceImpl implements WorkordeService {
array.add(map);
Map<String, Object> resp = wmsToAcsService.orderStatusUpdate(array);
if (StrUtil.equals(String.valueOf(resp.get("status")), "200")) {
JSONObject produceorderMap = new JSONObject();
JSONObject produceorderMap = JSONObject.parseObject(JSONObject.toJSONString(this.findById(Long.valueOf(workorder_id))));
produceorderMap.put("workorder_id", workorder_id);
produceorderMap.put("order_status", "5");
produceorderMap.put("update_optid", currentUserId);
@@ -430,6 +433,21 @@ public class WorkorderServiceImpl implements WorkordeService {
produceorderMap.put("update_time", now);
produceorderMap.put("realproduceend_date", now);
wo.update(produceorderMap);
// 操作成功后向 MES 反馈
ParamDto has_mes = paramService.findByCode("has_mes");
if (ObjectUtil.isNotEmpty(has_mes) && StrUtil.equals(has_mes.getValue(), "1")) {
JSONObject mes_param = new JSONObject();
mes_param.put("material_code", materialbaseService.findById(produceorderMap.getLong("material_id")).getMaterial_code());
mes_param.put("workorder_code", produceorderMap.getString("workorder_code"));
mes_param.put("workorder_qty", produceorderMap.getString("plan_qty"));
mes_param.put("device_code", deviceService.findByCode(produceorderMap.getString("device_code")).getExtend_code());
String workorder_uri = paramService.findByCode("mes_url").getValue() + "api/mes/materialIvt";
HttpRequest
.post(workorder_uri)
.body(mes_param.toJSONString())
.execute();
}
}
}

View File

@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
@@ -88,6 +89,11 @@ public class YljCallMaterialTask extends AbstractAcsTask {
return;
}
String vehicle_code = taskObj.getString("vehicle_code");
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
redisUtils.del(vehicle_code);
redisUtils.del(vehicle_code + "-ivt_qty");
// 更改任务状态为完成
taskObj.put("task_status", TaskStatusEnum.FINISHED.getCode());
taskObj.put("update_optname", "acs");