This commit is contained in:
2022-08-05 12:15:35 +08:00
parent e8c8e0047c
commit 6a21976711
11 changed files with 105 additions and 79 deletions

View File

@@ -131,58 +131,70 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public Map<String, Object> orderFinish(String string) {
JSONObject orderJson = JSONObject.parseObject(string);
String ext_order_id = orderJson.getString("ext_order_id");
// JSONArray array = JSONArray.parseArray(string);
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("MPS_BD_ProduceShiftOrder");
JSONObject map = new JSONObject();
map.put("produceorder_id", ext_order_id);
map.put("order_status", "04");
map.put("update_optid", 1001001);
map.put("device_id", "");
map.put("update_optname", "acs");
map.put("update_time", now);
map.put("realproduceend_date", now);
wo.update(map, "produceorder_id = '" + ext_order_id + "'");
JSONObject result = new JSONObject();
try {
JSONObject orderJson = JSONObject.parseObject(string);
String ext_order_id = orderJson.getString("ext_order_id");
// JSONArray array = JSONArray.parseArray(string);
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("MPS_BD_ProduceShiftOrder");
JSONObject map = new JSONObject();
map.put("produceorder_id", ext_order_id);
map.put("order_status", "04");
map.put("update_optid", 1001001);
map.put("device_id", "");
map.put("update_optname", "acs");
map.put("update_time", now);
map.put("realproduceend_date", now);
wo.update(map, "produceorder_id = '" + ext_order_id + "'");
} catch (Exception e){
result.put("status", 400);
result.put("message", e.getMessage());
return result;
}
result.put("status", HttpStatus.OK.value());
result.put("message", "任务状态反馈成功!");
result.put("message", "订单完成状态反馈成功!");
return result;
}
@Override
public Map<String, Object> feedDeviceStatusType(String string) {
JSONObject param = JSONObject.parseObject(string);
String device_code = param.getString("device_code");
String status_type = param.getString("status_type");
String start_time = param.getString("start_time");
Integer error_code = Integer.parseInt(param.getString("error_code"));
WQLObject wo = WQLObject.getWQLObject("pdm_bi_device");
JSONObject device_json = wo.query("is_delete = '0' and is_active = '1' and device_code = '" + device_code + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(device_json)) {
String device_id = device_json.getString("device_id");
WQLObject wo_status = WQLObject.getWQLObject("PDM_BI_DeviceRunStatusRecord");
JSONObject status_json = wo_status.query("device_id = '" + device_id + "' and (end_time is null or end_time = '' )").uniqueResult(0);
if (ObjectUtil.isNotEmpty(status_json)) {
status_json.put("end_time", start_time);
wo_status.update(status_json);
log.warn("上一次设备状态结束时间修改成功:{}",device_code);
}
JSONObject map = new JSONObject();
map.put("record_id", IdUtil.getSnowflake(1, 1).nextId());
map.put("device_id", device_id);
map.put("status_type", status_type);
map.put("start_time", start_time);
if (error_code > 0) {
map.put("err_status_id", error_code);
} else {
map.put("err_status_id", null);
}
wo_status.insert(map);
log.warn("设备状态新增成功{}",device_code);
}
JSONObject result = new JSONObject();
try {
JSONObject param = JSONObject.parseObject(string);
String device_code = param.getString("device_code");
String status_type = param.getString("status_type");
String start_time = param.getString("start_time");
Integer error_code = Integer.parseInt(param.getString("error_code"));
WQLObject wo = WQLObject.getWQLObject("pdm_bi_device");
JSONObject device_json = wo.query("is_delete = '0' and is_active = '1' and device_code = '" + device_code + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(device_json)) {
String device_id = device_json.getString("device_id");
WQLObject wo_status = WQLObject.getWQLObject("PDM_BI_DeviceRunStatusRecord");
JSONObject status_json = wo_status.query("device_id = '" + device_id + "' and (end_time is null or end_time = '' )").uniqueResult(0);
if (ObjectUtil.isNotEmpty(status_json)) {
status_json.put("end_time", start_time);
wo_status.update(status_json);
log.warn("上一次设备状态结束时间修改成功:{}",device_code);
}
JSONObject map = new JSONObject();
map.put("record_id", IdUtil.getSnowflake(1, 1).nextId());
map.put("device_id", device_id);
map.put("status_type", status_type);
map.put("start_time", start_time);
if (error_code > 0) {
map.put("err_status_id", error_code);
} else {
map.put("err_status_id", null);
}
wo_status.insert(map);
log.warn("设备状态新增成功{}",device_code);
}
} catch (Exception e){
result.put("status", 400);
result.put("message", e.getMessage());
return result;
}
result.put("status", HttpStatus.OK.value());
result.put("message", "设备状态反馈成功");
return result;
@@ -190,14 +202,20 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public Map<String, Object> feedOrderRealQty(String string) {
JSONObject param = JSONObject.parseObject(string);
String order_code = param.getString("order");
String real_qty = param.getString("real_qty");
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
JSONObject map = new JSONObject();
map.put("real_qty", real_qty);
wo.update(map, "produceorder_code = '" + order_code + "' and order_status != '04'");
JSONObject result = new JSONObject();
try {
JSONObject param = JSONObject.parseObject(string);
String order_code = param.getString("order");
String real_qty = param.getString("real_qty");
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
JSONObject map = new JSONObject();
map.put("real_qty", real_qty);
wo.update(map, "produceorder_code = '" + order_code + "' and order_status != '04'");
} catch (Exception e){
result.put("status", 400);
result.put("message", e.getMessage());
}
result.put("status", HttpStatus.OK.value());
result.put("message", "设备状态反馈成功");
return result;