|
@@ -18,6 +18,7 @@ import com.github.zuihou.business.controller.productionReadyCenter.MMeterialCont
|
|
|
import com.github.zuihou.business.externalApi.dto.*;
|
|
|
import com.github.zuihou.business.externalApi.entity.MesAttachment;
|
|
|
import com.github.zuihou.business.externalApi.entity.MesNotice;
|
|
|
+import com.github.zuihou.business.externalApi.entity.R2;
|
|
|
import com.github.zuihou.business.externalApi.service.MesAttachmentService;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.Order;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.OrderProduct;
|
|
@@ -113,6 +114,9 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
|
|
|
@Value("${zuihou.file.storage-path}")
|
|
|
private String storagePath;
|
|
|
|
|
|
+ @Value("${mes-auto-post.enabled:false}")
|
|
|
+ private Boolean autoPostEnable;
|
|
|
+
|
|
|
|
|
|
@ApiOperation(value = "接受质检任务下发通知接口", notes = "接受质检任务下发通知接口")
|
|
|
@PostMapping("/externalApi/measuringTaskReceive")
|
|
@@ -201,9 +205,9 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
|
|
|
|
|
|
log.info("任务数据{}", data);
|
|
|
try {
|
|
|
-// JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
|
|
|
- MesNotice mesNotice = MesNotice.builder().orderNo(System.currentTimeMillis() + "").
|
|
|
+ MesNotice mesNotice = MesNotice.builder().orderNo(jsonObject.getString("auidnr")).userCode(jsonObject.getString("usercode")).
|
|
|
buType("TASKDISTRIBUTE").lineCode("407109").status("1").source("智能总控系统").apiType("MESTASK")
|
|
|
.targetSource("产线管控单元").acceptPar(data).build();
|
|
|
boolean b = baseService.addNotice(mesNotice);
|
|
@@ -216,6 +220,72 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
|
|
|
return R.success();
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "工序报工接口", notes = "工序报工接口")
|
|
|
+ @PostMapping("/externalApi/order/mesProcessReport")
|
|
|
+ public R mesProcessReport(@RequestBody Map<String, String> params) {
|
|
|
+ BaseContextHandler.setTenant("0000");
|
|
|
+ String instructionUrl="http://192.168.11.40:11024/Mesbg";
|
|
|
+ if(!params.containsKey("auidnr") || !params.containsKey("usercode") || !params.containsKey("status") || !params.containsKey("kapaz")) return R.fail("传参有误");
|
|
|
+ Order order = orderService.getOne(new LbqWrapper<Order>().eq(Order::getSource, "2").eq(Order::getOrderNo, params.get("auidnr").toString()));
|
|
|
+ BBom bom = bBomService.getOne(new LbqWrapper<BBom>().eq(BBom::getBatchNo, order.getBatchNo()).eq(BBom::getStatus,"1").eq(BBom::getSynFlag, "1").last("LIMIT 1"));
|
|
|
+ if( order == null || bom == null) return R.fail("数据不存在");
|
|
|
+ MesProcessReportDto mesProcessReportDto = MesProcessReportDto.builder().finr("407").kpf("109").auidnr(params.get("auidnr")).status(params.get("status")).afonr(bom.getNo()).pnr(params.get("usercode")).kapaz(params.get("kapaz")).plmenge(1.0)
|
|
|
+ .build();
|
|
|
+ boolean status = params.get("status").equals("JS")? true: false;
|
|
|
+ if(status){
|
|
|
+ //默认处理
|
|
|
+ mesProcessReportDto.setGutmenge(1.0).setAusschuss(0).setAussfinish(0);
|
|
|
+ }
|
|
|
+ JSONObject jsonParam = (JSONObject)JSONObject.toJSON(mesProcessReportDto);
|
|
|
+ String data = jsonParam.toJSONString();
|
|
|
+
|
|
|
+ MesNotice mesNotice = MesNotice.builder().orderNo(params.get("auidnr")).userCode(params.get("usercode")).
|
|
|
+ buType("TASKAPPLY").lineCode("407109").status("1").source("产线管控单元").apiType("MESPROCESSREPORT").apiAddress(instructionUrl)
|
|
|
+ .targetSource("智能总控系统").acceptPar(data).build();
|
|
|
+ try {
|
|
|
+ boolean b = baseService.addNotice(mesNotice);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return R.fail(e.getMessage());
|
|
|
+ }
|
|
|
+ if(!autoPostEnable){
|
|
|
+ mesNotice.setStatus("0");
|
|
|
+ baseService.updateById(mesNotice);
|
|
|
+ String returnData = msgUtil.httpForPost(instructionUrl, data);
|
|
|
+ return R.success(returnData);
|
|
|
+ }
|
|
|
+ return R.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "设备异常接口", notes = "设备异常接口")
|
|
|
+ @PostMapping("/externalApi/order/mesAbnormalReport")
|
|
|
+ public R mesAbnormalReport(@RequestBody Map<String, String> params) {
|
|
|
+ BaseContextHandler.setTenant("0000");
|
|
|
+ String instructionUrl="http://192.168.11.40:11024/Mesyc";
|
|
|
+
|
|
|
+ if(!params.containsKey("status") || !params.containsKey("errorCode") || !params.containsKey("kapaz") || !params.containsKey("errorMsg")) return R.fail("传参有误");
|
|
|
+
|
|
|
+ MesAbnormalReportDto mesAbnormalReportDto = BeanUtil.mapToBean(params, MesAbnormalReportDto.class, true);
|
|
|
+ mesAbnormalReportDto.setFinr("407").setKpf("109").setPlkapaz("109");
|
|
|
+ JSONObject jsonParam = (JSONObject)JSONObject.toJSON(mesAbnormalReportDto);
|
|
|
+ String data = jsonParam.toJSONString();
|
|
|
+
|
|
|
+ MesNotice mesNotice = MesNotice.builder().orderNo(System.currentTimeMillis()+"").userCode("").
|
|
|
+ buType("TASKAPPLY").lineCode("407109").status("1").source("产线管控单元").apiType("MESABNORMALREPORT").apiAddress(instructionUrl)
|
|
|
+ .targetSource("智能总控系统").acceptPar(data).build();
|
|
|
+
|
|
|
+ try {
|
|
|
+ boolean b = baseService.addNotice(mesNotice);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return R.fail(e.getMessage());
|
|
|
+ }
|
|
|
+ if(!autoPostEnable){
|
|
|
+ mesNotice.setStatus("0");
|
|
|
+ baseService.updateById(mesNotice);
|
|
|
+ String returnData = msgUtil.httpForPost(instructionUrl, data);
|
|
|
+ return R.success(returnData);
|
|
|
+ }
|
|
|
+ return R.success();
|
|
|
+ }
|
|
|
@ApiOperation(value = "任务修改", notes = "任务修改")
|
|
|
@PostMapping("/notice/modify")
|
|
|
public R addNotice(@RequestBody MesNotice mesNotice) {
|
|
@@ -779,10 +849,8 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
|
|
|
orderProductSeqList.add(data);
|
|
|
} else {
|
|
|
String plmenge = dataInfo.getString("plmenge");
|
|
|
- if (StringUtil.isEmpty(plmenge)) {
|
|
|
- msgUtil.createWarnLog("Mes订单加工零件个数不允许为空", "MESException");
|
|
|
-
|
|
|
- return;
|
|
|
+ if(StringUtil.isEmpty(plmenge)) {
|
|
|
+ msgUtil.createWarnLog("Mes订单加工零件个数不允许为空","MESException");
|
|
|
}
|
|
|
List<JSONObject> dataList = IntStream.range(0, (int) Float.parseFloat(plmenge)).mapToObj(i -> {
|
|
|
JSONObject obj = new JSONObject();
|