rev:设备监控、新增手动入箱回传、出箱回传
This commit is contained in:
@@ -63,6 +63,9 @@ public class FaultDeviceServiceImpl implements FaultDeviceService {
|
||||
String is_fault = MapUtil.getStr(whereJson, "is_fault");
|
||||
String region_code = MapUtil.getStr(whereJson, "region_code");
|
||||
String plant_code = MapUtil.getStr(whereJson, "plant_code");
|
||||
if (StrUtil.isEmpty(plant_code)){
|
||||
throw new BadRequestException("输入的区域不能为空!");
|
||||
}
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(device_code)) {
|
||||
@@ -73,29 +76,19 @@ public class FaultDeviceServiceImpl implements FaultDeviceService {
|
||||
// 不为空则只需要查询专机设备
|
||||
JSONObject jsonStr = WQL.getWO("QMD_BI_FAULT").addParam("flag", "3").process().uniqueResult(0);
|
||||
String str = jsonStr.getString("str");
|
||||
String product_area = jsonStr.getString("product_area");
|
||||
param.put("device_code",str);
|
||||
param.put("product_area",product_area);
|
||||
param.put("product_area",plant_code);
|
||||
}
|
||||
|
||||
// 调用acs接口获取设备
|
||||
JSONObject result = SpringContextHolder.getBean(WmsToAcsServiceImpl.class).realTimefaultInfo(param);
|
||||
JSONArray data = result.getJSONArray("data");
|
||||
|
||||
JSONObject result2 = SpringContextHolder.getBean(WmsToAcsServiceImpl.class).queryDeviceInfo(new JSONObject());
|
||||
JSONObject jsonData = result2.getJSONObject("data");
|
||||
JSONArray data1 = new JSONArray();
|
||||
JSONObject result2 = SpringContextHolder.getBean(WmsToAcsServiceImpl.class).queryDeviceInfo(param);
|
||||
JSONArray rows = result2.getJSONArray("data");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonData)) {
|
||||
JSONArray jsonA1 = jsonData.getJSONArray("jsonA1");
|
||||
JSONArray jsonLK = jsonData.getJSONArray("jsonLK");
|
||||
|
||||
data1.addAll(jsonA1);
|
||||
data1.addAll(jsonLK);
|
||||
}
|
||||
|
||||
for (int i = 0; i < data1.size(); i++) {
|
||||
JSONObject jsonObject = data1.getJSONObject(i);
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject jsonObject = rows.getJSONObject(i);
|
||||
double electricity = jsonObject.getDoubleValue("electricity");
|
||||
|
||||
if (electricity <= 30) {
|
||||
|
||||
@@ -91,8 +91,7 @@
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
GROUP_CONCAT(device_code) AS str,
|
||||
plant_code AS product_area
|
||||
GROUP_CONCAT(device_code) AS str
|
||||
FROM
|
||||
EM_BI_MonitorDevice
|
||||
WHERE
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
import org.nl.wms.pda.mps.service.impl.BakingServiceImpl;
|
||||
import org.nl.wms.pda.st.service.PrintService;
|
||||
import org.nl.wms.pda.st.service.impl.PrintServiceImpl;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.tasks.CutConveyorTask;
|
||||
import org.nl.wms.sch.tasks.EmptyVehicleTask;
|
||||
@@ -100,21 +101,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
// 任务处理类
|
||||
try {
|
||||
Class<?> clz = Class.forName(processing_class);
|
||||
AbstractAcsTask bean = SpringContextHolder.getBean(processing_class);
|
||||
bean.updateTaskStatus(row, status);
|
||||
/*Class<?> clz = Class.forName(processing_class);
|
||||
Object obj = clz.newInstance();
|
||||
// 调用每个任务类的forceFinishInst()强制结束方法
|
||||
Method m = obj.getClass().getDeclaredMethod("updateTaskStatus", JSONObject.class, String.class);
|
||||
m.invoke(obj, row, status);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
//空指针
|
||||
if (ObjectUtil.isNull(e.getTargetException().getMessage())) {
|
||||
message = e.getTargetException().toString();
|
||||
} else {
|
||||
message = e.getTargetException().getMessage();
|
||||
}
|
||||
throw new BadRequestException(message);
|
||||
|
||||
m.invoke(obj, row, status);*/
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = e.getMessage();
|
||||
@@ -872,8 +865,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
tran_jo.put("point_code1", translate_code1);
|
||||
tran_jo.put("point_code2", translate_code2);
|
||||
tran_jo.put("vehicle_code", right_point.getString("qzzno"));
|
||||
if (StrUtil.isEmpty(right_point.getString("vehicle_code"))){
|
||||
throw new BadRequestException("点位:"+right_point.getString("point_code")+"载具号为空!");
|
||||
if (StrUtil.isEmpty(right_point.getString("vehicle_code"))) {
|
||||
throw new BadRequestException("点位:" + right_point.getString("point_code") + "载具号为空!");
|
||||
}
|
||||
tran_jo.put("vehicle_code2", right_point.getString("vehicle_code"));
|
||||
tran_jo.put("task_type", "010406");
|
||||
|
||||
@@ -242,10 +242,19 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
//ACS地址:127.0.0.1:8010
|
||||
String acsUrl = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("acs_url").getValue();
|
||||
String product_area = whereJson.getString("product_area");
|
||||
|
||||
String url = acsUrl + api;
|
||||
if (StrUtil.isEmpty(product_area)) {
|
||||
throw new BadRequestException("区域不能为空!下发信息:" + whereJson.toString());
|
||||
}
|
||||
|
||||
String acs_url = URLEnum.find(product_area);
|
||||
if (StrUtil.isEmpty(acs_url)) {
|
||||
log.info(product_area);
|
||||
throw new BadRequestException("未查询到区域对应的acs地址!");
|
||||
}
|
||||
|
||||
String url = acs_url + api;
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(whereJson))
|
||||
@@ -255,9 +264,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
// 重新组织数据
|
||||
JSONArray data = result.getJSONArray("data");
|
||||
|
||||
JSONObject nowJson = new JSONObject(); // 返回数据
|
||||
JSONArray ArrA1 = new JSONArray(); // A1车间
|
||||
JSONArray ArrLk = new JSONArray(); // LK车间
|
||||
JSONArray rows = new JSONArray();
|
||||
|
||||
String run_time = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("AGV_RUN_TIME").getValue();
|
||||
|
||||
@@ -268,17 +275,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
// 工作时长:电量百分比*6
|
||||
String electricity = json.getString("electricity");
|
||||
json.put("run_time", NumberUtil.round(NumberUtil.div(NumberUtil.mul(electricity, run_time), 100), 1));
|
||||
|
||||
if ("2,3".contains(json.getString("car_no"))) {
|
||||
ArrA1.add(json);
|
||||
}
|
||||
if ("1".contains(json.getString("car_no"))) {
|
||||
ArrLk.add(json);
|
||||
}
|
||||
rows.add(json);
|
||||
}
|
||||
nowJson.put("jsonA1", ArrA1);
|
||||
nowJson.put("jsonLK", ArrLk);
|
||||
result.put("data", nowJson);
|
||||
result.put("data", rows);
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
@@ -314,11 +313,19 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
|
||||
return result;
|
||||
}
|
||||
String product_area = whereJson.getString("product_area");
|
||||
|
||||
//ACS地址:127.0.0.1:8010
|
||||
String acsUrl = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("acs_url").getValue();
|
||||
if (StrUtil.isEmpty(product_area)) {
|
||||
throw new BadRequestException("区域不能为空!下发信息:" + whereJson.toString());
|
||||
}
|
||||
|
||||
String url = acsUrl + api;
|
||||
String acs_url = URLEnum.find(product_area);
|
||||
if (StrUtil.isEmpty(acs_url)) {
|
||||
log.info(product_area);
|
||||
throw new BadRequestException("未查询到区域对应的acs地址!");
|
||||
}
|
||||
|
||||
String url = acs_url + api;
|
||||
|
||||
// 判断此此号属于哪个系统
|
||||
String car_no = whereJson.getString("car_no");
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package org.nl.wms.pdm.ivt.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -71,4 +72,12 @@ public class HotPointIvtController {
|
||||
public ResponseEntity<Object> taskDtlQuery(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(hotpointivtService.taskDtlQuery(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/uploadMes")
|
||||
@Log("手动回传MES")
|
||||
@ApiOperation("手动回传MES")
|
||||
public ResponseEntity<Object> uploadMes(@RequestBody JSONObject form){
|
||||
hotpointivtService.uploadMes(form);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
package org.nl.wms.pdm.ivt.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.pdm.ivt.service.dto.HotPointIvtDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -70,4 +71,6 @@ public interface HotPointIvtService {
|
||||
*/
|
||||
Map<String,Object> taskDtlQuery(Map whereJson, Pageable page);
|
||||
|
||||
void uploadMes(JSONObject form);
|
||||
|
||||
}
|
||||
@@ -15,7 +15,10 @@ import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
|
||||
import org.nl.wms.pdm.ivt.service.HotPointIvtService;
|
||||
import org.nl.wms.pdm.ivt.service.dto.HotPointIvtDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -27,21 +30,21 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2022-10-09
|
||||
**/
|
||||
* @author lyd
|
||||
* @description 服务实现
|
||||
* @date 2022-10-09
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class HotPointIvtServiceImpl implements HotPointIvtService {
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(Map whereJson, Pageable page){
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
HashMap map = new HashMap();
|
||||
map.put("flag", "1");
|
||||
if (whereJson.get("point_code")!=null)
|
||||
map.put("point_code", "%" + whereJson.get("point_code") + "%");
|
||||
if (whereJson.get("point_code") != null)
|
||||
map.put("point_code", "%" + whereJson.get("point_code") + "%");
|
||||
map.put("point_status", whereJson.get("point_status"));
|
||||
map.put("product_area", whereJson.get("product_area"));
|
||||
map.put("is_used", whereJson.get("is_used"));
|
||||
@@ -54,7 +57,7 @@ public class HotPointIvtServiceImpl implements HotPointIvtService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HotPointIvtDto> queryAll(Map whereJson){
|
||||
public List<HotPointIvtDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_hotpointivt");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(HotPointIvtDto.class);
|
||||
@@ -65,18 +68,18 @@ public class HotPointIvtServiceImpl implements HotPointIvtService {
|
||||
public HotPointIvtDto findById(Long ivt_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_hotpointivt");
|
||||
JSONObject json = wo.query("ivt_id = '" + ivt_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( HotPointIvtDto.class);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(HotPointIvtDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HotPointIvtDto findByCode(String code) {
|
||||
public HotPointIvtDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_hotpointivt");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( HotPointIvtDto.class);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(HotPointIvtDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -117,8 +120,8 @@ public class HotPointIvtServiceImpl implements HotPointIvtService {
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_hotpointivt");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
if (!json.containsKey("temperature")){
|
||||
json.put("temperature",null);
|
||||
if (!json.containsKey("temperature")) {
|
||||
json.put("temperature", null);
|
||||
}
|
||||
wo.update(json);
|
||||
}
|
||||
@@ -131,7 +134,7 @@ public class HotPointIvtServiceImpl implements HotPointIvtService {
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_hotpointivt");
|
||||
for (Long ivt_id: ids) {
|
||||
for (Long ivt_id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("ivt_id", String.valueOf(ivt_id));
|
||||
param.put("is_delete", "1");
|
||||
@@ -142,6 +145,48 @@ public class HotPointIvtServiceImpl implements HotPointIvtService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadMes(JSONObject form) {
|
||||
String flag = form.getString("flag");
|
||||
|
||||
// 将入烘箱信息发送给mes
|
||||
JSONObject param = new JSONObject();
|
||||
String userName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
|
||||
String passWord = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
|
||||
param.put("iContainerName", form.getString("container_name"));
|
||||
param.put("iResourceName", form.getString(""));
|
||||
param.put("iMoveInDate", DateUtil.now());
|
||||
param.put("iPlanBakingTemperature", form.getDoubleValue("temperature"));
|
||||
param.put("iPlanBakingTimer", form.getDoubleValue("oven_time"));
|
||||
param.put("UserName", userName);
|
||||
param.put("PassWord", passWord);
|
||||
|
||||
//入箱回传
|
||||
if ("1".equals(flag)) {
|
||||
//判断该接口是否需要回传
|
||||
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'momRollBakeInBound'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(back_jo) && "1".equals(back_jo.getString("is_back"))) {
|
||||
new LmsToMesServiceImpl().momRollBakeInBound(param);
|
||||
}
|
||||
|
||||
//将该母卷的入烘箱标识改为0
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("is_baking", "0");
|
||||
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + form.getString("container_name") + "'");
|
||||
log.info("母卷:" + form.getString("container_name") + "对应的入烘箱任务完成,请求烘烤标识改为0");
|
||||
}
|
||||
//出箱回传
|
||||
if ("2".equals(flag)) {
|
||||
//判断该接口是否需要回传
|
||||
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'momRollBakeOutBound'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(back_jo) && "1".equals(back_jo.getString("is_back"))) {
|
||||
new LmsToMesServiceImpl().momRollBakeOutBound(param);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> taskDtlQuery(Map whereJson, Pageable page) {
|
||||
|
||||
@@ -151,15 +196,15 @@ public class HotPointIvtServiceImpl implements HotPointIvtService {
|
||||
String container_name = MapUtil.getStr(whereJson, "container_name");
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag","2");
|
||||
map.put("bill_code", MapUtil.getStr(whereJson,"bill_code"));
|
||||
map.put("dtl_status", MapUtil.getStr(whereJson,"dtl_status"));
|
||||
map.put("flag", "2");
|
||||
map.put("bill_code", MapUtil.getStr(whereJson, "bill_code"));
|
||||
map.put("dtl_status", MapUtil.getStr(whereJson, "dtl_status"));
|
||||
map.put("begin_time", whereJson.get("begin_time"));
|
||||
map.put("end_time", whereJson.get("end_time"));
|
||||
map.put("container_name", container_name);
|
||||
if (ObjectUtil.isNotEmpty(task_code)) map.put("task_code","%"+task_code+"%");
|
||||
if (ObjectUtil.isNotEmpty(start_point_code)) map.put("start_point_code","%"+start_point_code+"%");
|
||||
if (ObjectUtil.isNotEmpty(next_point_code)) map.put("next_point_code","%"+next_point_code+"%");
|
||||
if (ObjectUtil.isNotEmpty(task_code)) map.put("task_code", "%" + task_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(start_point_code)) map.put("start_point_code", "%" + start_point_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(next_point_code)) map.put("next_point_code", "%" + next_point_code + "%");
|
||||
|
||||
JSONObject json = WQL.getWO("ST_IVT_HOTPOINTIVT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "create_time DESC");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user