|
|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
package com.aucma.production.controller;
|
|
|
|
|
|
|
|
|
|
import com.aucma.base.domain.BaseProcessStation;
|
|
|
|
|
import com.aucma.base.service.IBaseProcessStationService;
|
|
|
|
|
import com.aucma.base.domain.BaseProductLine;
|
|
|
|
|
import com.aucma.base.service.IBaseProductLineService;
|
|
|
|
|
import com.aucma.common.constant.AnDonConstants;
|
|
|
|
|
import com.aucma.common.core.domain.AjaxResult;
|
|
|
|
|
import com.aucma.common.utils.DateUtils;
|
|
|
|
|
@ -38,7 +38,7 @@ import java.util.Map;
|
|
|
|
|
public class AndonMobileController {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IBaseProcessStationService baseProcessStationService;
|
|
|
|
|
private IBaseProductLineService baseProductLineService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private AndonRuleMapper andonRuleMapper;
|
|
|
|
|
@ -102,15 +102,16 @@ public class AndonMobileController {
|
|
|
|
|
return AjaxResult.error("呼叫类型不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 1. 根据 stationCode 查询工位信息
|
|
|
|
|
BaseProcessStation stationQuery = new BaseProcessStation();
|
|
|
|
|
stationQuery.setProcessCode(stationCode);
|
|
|
|
|
List<BaseProcessStation> stations = baseProcessStationService.selectBaseProcessStationList(stationQuery);
|
|
|
|
|
if (stations == null || stations.isEmpty()) {
|
|
|
|
|
// 1. 根据 stationCode 查询产线信息(productLineType=2 表示工位)
|
|
|
|
|
BaseProductLine lineQuery = new BaseProductLine();
|
|
|
|
|
lineQuery.setProductLineCode(stationCode);
|
|
|
|
|
lineQuery.setProductLineType(2L); // 2表示工位类型
|
|
|
|
|
List<BaseProductLine> lines = baseProductLineService.selectBaseProductLineList(lineQuery);
|
|
|
|
|
if (lines == null || lines.isEmpty()) {
|
|
|
|
|
return AjaxResult.error("工位不存在:" + stationCode);
|
|
|
|
|
}
|
|
|
|
|
BaseProcessStation station = stations.get(0);
|
|
|
|
|
String productLineCode = station.getProductLineCode();
|
|
|
|
|
BaseProductLine productLine = lines.get(0);
|
|
|
|
|
String productLineCode = productLine.getParentId(); // 父级产线编码
|
|
|
|
|
|
|
|
|
|
// 2. 根据 stationCode + callTypeCode 匹配安灯规则
|
|
|
|
|
AndonRule ruleQuery = new AndonRule();
|
|
|
|
|
@ -155,7 +156,7 @@ public class AndonMobileController {
|
|
|
|
|
Map<String, Object> data = new LinkedHashMap<>();
|
|
|
|
|
data.put("eventId", event.getEventId());
|
|
|
|
|
data.put("callCode", event.getCallCode());
|
|
|
|
|
data.put("stationName", station.getStationName() != null ? station.getStationName() : station.getProcessName());
|
|
|
|
|
data.put("stationName", productLine.getProductLineName());
|
|
|
|
|
data.put("callType", rule.getRuleName());
|
|
|
|
|
data.put("message", "安灯呼叫成功,已通知相关人员");
|
|
|
|
|
return AjaxResult.success(data);
|
|
|
|
|
|