Merge branch 'master' of http://121.40.234.130:8899/root/hl_one
This commit is contained in:
@@ -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", 1111111111);
|
||||
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);
|
||||
}
|
||||
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 && error_code < 50){
|
||||
map.put("err_status_id",error_code);
|
||||
} else if (error_code > 50){
|
||||
map.put("err_status_id", error_code - 50);
|
||||
} else {
|
||||
map.put("err_status_id", null);
|
||||
}
|
||||
wo_status.insert(map);
|
||||
}
|
||||
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+"'");
|
||||
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;
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
where
|
||||
|
||||
shiftorder.is_delete='0'
|
||||
and shiftorder.order_status<>'00'
|
||||
OPTION 输入.worksection_type_scode <> ""
|
||||
workprocedure.worksection_type_scode = 输入.worksection_type_scode
|
||||
ENDOPTION
|
||||
@@ -134,6 +135,7 @@ ENDIF
|
||||
mps_bd_produceshiftorder shiftorder
|
||||
where
|
||||
shiftorder.is_delete='0'
|
||||
and shiftorder.order_status<>'00'
|
||||
OPTION 输入.produce_date <> ""
|
||||
shiftorder.produce_date = 输入.produce_date
|
||||
ENDOPTION
|
||||
@@ -149,6 +151,7 @@ ENDIF
|
||||
mps_bd_produceshiftorder shiftorder
|
||||
where
|
||||
shiftorder.realproduceend_date > shiftorder.planproduceend_date
|
||||
and shiftorder.order_status<>'00'
|
||||
OPTION 输入.produce_date <> ""
|
||||
shiftorder.produce_date = 输入.produce_date
|
||||
ENDOPTION
|
||||
@@ -168,6 +171,7 @@ ENDIF
|
||||
LEFT JOIN pdm_bi_workprocedure workprocedure ON workprocedure.workprocedure_id = shiftorder.workprocedure_id
|
||||
WHERE
|
||||
shiftorder.is_delete='0'
|
||||
and shiftorder.order_status<>'00'
|
||||
and workprocedure.workprocedure_code IN ( '07', '06', '02' )
|
||||
OPTION 输入.produce_date <> ""
|
||||
shiftorder.produce_date = 输入.produce_date
|
||||
@@ -268,6 +272,7 @@ IF 输入.flag = "11"
|
||||
left join md_me_materialbase material on material.material_id =shiftorder.material_id
|
||||
WHERE
|
||||
shiftorder.is_delete='0'
|
||||
and shiftorder.order_status<>'00'
|
||||
and workprocedure.workprocedure_code IN ( '07', '06', '02' )
|
||||
and shiftorder. real_qty < shiftorder.plan_qty
|
||||
OPTION 输入.produce_date <> ""
|
||||
@@ -379,9 +384,6 @@ IF 输入.flag = "14"
|
||||
OPTION 输入.worksection_type_scode <> ""
|
||||
workprocedure.worksection_type_scode = 输入.worksection_type_scode
|
||||
ENDOPTION
|
||||
OPTION 输入.produce_date <> ""
|
||||
shiftorder.produce_date = 输入.produce_date
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -202,17 +202,17 @@
|
||||
IF 输入.flag = "9"
|
||||
QUERY
|
||||
SELECT DISTINCT
|
||||
device.device_id
|
||||
device.device_id
|
||||
FROM
|
||||
pdm_bi_device device
|
||||
LEFT JOIN mps_bd_produceshiftorder shift ON shift.device_id = device.device_id
|
||||
LEFT JOIN pdm_bi_devicerunstatusrecord run ON run.device_id = device.device_id
|
||||
pdm_bi_device device
|
||||
INNER JOIN mps_bd_produceshiftorder shift ON shift.device_id = device.device_id
|
||||
INNER JOIN pdm_bi_devicerunstatusrecord run ON run.device_id = device.device_id AND IFNULL(run.end_time,'') =''
|
||||
WHERE
|
||||
shift.is_delete = '0'
|
||||
shift.is_delete = '0'
|
||||
AND
|
||||
shift.order_status <> '04'
|
||||
shift.order_status <> '04'
|
||||
AND
|
||||
(run.status_type <> '05' OR (run.status_type = '05' AND IFNULL(run.end_time,'') <> '') OR run.status_type IS NULL)
|
||||
run.status_type <> '05'
|
||||
OPTION 输入.workprocedure_id <> ""
|
||||
device.workprocedure_id = 输入.workprocedure_id
|
||||
ENDOPTION
|
||||
|
||||
@@ -102,4 +102,6 @@ public class ProduceshiftorderDto implements Serializable {
|
||||
|
||||
private Long device_id;
|
||||
private Long sale_id;
|
||||
|
||||
private Integer orderNum;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.security.service.dto.JwtUserDto;
|
||||
import org.nl.modules.system.service.UserService;
|
||||
import org.nl.modules.system.service.dto.UserDto;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
@@ -22,6 +24,7 @@ import org.nl.wms.mps.service.dto.ProduceshiftorderDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -42,6 +45,9 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
|
||||
private final ClassstandardService classstandardService;
|
||||
private final WmsToAcsService wmsToAcsService;
|
||||
|
||||
@Autowired
|
||||
UserService userService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String produceorder_code = MapUtil.getStr(whereJson, "produceorder_code");
|
||||
@@ -83,7 +89,24 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
|
||||
if (StrUtil.isNotEmpty(sale_id)) {
|
||||
map.put("sale_id", "%" + sale_id + "%");
|
||||
}
|
||||
WQLObject wo = WQLObject.getWQLObject("mps_bd_macoperaterecord");
|
||||
JSONObject jsonObject = WQL.getWO("MPS_PRODUCEDURE001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ShiftOrder.update_time desc");
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("content");
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject arrayJSONObject = jsonArray.getJSONObject(i);
|
||||
String produceorder_id = arrayJSONObject.getString("produceorder_id");
|
||||
JSONArray resultJSONArray = wo.query("produceorder_id = '" + produceorder_id + "'", "operatetime_start desc").getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(resultJSONArray)){
|
||||
JSONObject resultJSONArrayJSONObject = resultJSONArray.getJSONObject(0);
|
||||
String jockey_id = resultJSONArrayJSONObject.getString("jockey_id");
|
||||
UserDto user = userService.findById(Long.valueOf(jockey_id));
|
||||
String nick_name = "";
|
||||
if (ObjectUtil.isNotEmpty(user)){
|
||||
nick_name = user.getNickName();
|
||||
}
|
||||
arrayJSONObject.put("jockey_name",nick_name);
|
||||
}
|
||||
}
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@@ -118,28 +141,31 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(ProduceshiftorderDto dto) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
|
||||
Long deptId = currentUser.getDeptId();
|
||||
String newCode = CodeUtil.getNewCode("PDM_SHIFTORDER");
|
||||
dto.setProduce_date(dto.getProduce_date().substring(0,10));
|
||||
dto.setProduceorder_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setProduceorder_code(newCode);
|
||||
dto.setProducedeviceorder_code(newCode);
|
||||
dto.setOrder_status("00");
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
json.put("sysdeptid", deptId);
|
||||
json.put("syscompanyid", deptId);
|
||||
wo.insert(json);
|
||||
Integer orderNum = dto.getOrderNum();
|
||||
for (Integer i = 0; i < orderNum; i++) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
|
||||
Long deptId = currentUser.getDeptId();
|
||||
String newCode = CodeUtil.getNewCode("PDM_SHIFTORDER");
|
||||
dto.setProduce_date(dto.getProduce_date().substring(0,10));
|
||||
dto.setProduceorder_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setProduceorder_code(newCode);
|
||||
dto.setProducedeviceorder_code(newCode);
|
||||
dto.setOrder_status("00");
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
json.put("sysdeptid", deptId);
|
||||
json.put("syscompanyid", deptId);
|
||||
wo.insert(json);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,9 +63,12 @@
|
||||
WorkProcedure.workprocedure_code,
|
||||
WorkProcedure.workprocedure_name,
|
||||
classstandard.class_id,
|
||||
classstandard.class_name
|
||||
classstandard.class_name,
|
||||
device.device_code,
|
||||
device.device_name
|
||||
FROM
|
||||
MPS_BD_ProduceShiftOrder ShiftOrder
|
||||
left join pdm_bi_device device on ShiftOrder.device_id = device.device_id
|
||||
LEFT JOIN md_me_materialbase material ON material.material_id = ShiftOrder.material_id
|
||||
LEFT JOIN PDM_BI_WorkProcedure WorkProcedure ON WorkProcedure.workprocedure_id = ShiftOrder.workprocedure_id
|
||||
LEFT JOIN md_pb_classstandard classstandard ON classstandard.class_id = material.product_series
|
||||
|
||||
Reference in New Issue
Block a user