소스 검색

Mes后台功能处理

oyq28 1 주 전
부모
커밋
3fbf3db7ae

+ 10 - 3
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/externalApi/service/impl/MesNoticeServiceImpl.java

@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -110,16 +111,22 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
     public boolean addNotice(MesNotice model) {
         BaseContextHandler.setTenant("0000");
         if (checkExists(model)) {
-            throw new BizException("此订单已存在");
+            MesNotice data = baseMapper.selectOne(new LbqWrapper<MesNotice>().eq(MesNotice::getOrderNo, model.getOrderNo()).ne(MesNotice::getStatus, "3").eq(MesNotice::getBuType, model.getBuType()).last("limit 1"));
+            if(data == null) throw new BizException("数据有误");
+            BigDecimal b1 = new BigDecimal(data.getOrderInfo());
+            BigDecimal b2 = new BigDecimal(0.5);
+            double num  = b1.add(b2).doubleValue();
+            data.setStatus(model.getStatus()).setOrderInfo(String.valueOf(num));
+            baseMapper.updateAllById(data);
+        }else {
+            baseMapper.insert(model);
         }
-        baseMapper.insert(model);
 
         MesNoticeLog mesNoticeLog = new MesNoticeLog();
         BeanUtils.copyProperties(model, mesNoticeLog);
         mesNoticeLog.setNoticeId(model.getId());
         mesNoticeLog.setId(null);
         mesNoticeLogMapper.insert(mesNoticeLog);
-
         return true;
     }
 

+ 1 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskServiceImpl.java

@@ -1776,6 +1776,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
                 dataInfo.put("plmenge", acceptPar.getString("plmenge"));
                 dataInfo.put("pnr", mesNotice.getUserCode());
                 dataInfo.put("status", status);
+                dataInfo.put("batchno", order.getBatchNo());
             }else if(mesNotice.getApiType().equals("QUALITYTASK") && !bool){
                 dataInfo = JSONObject.parseObject(mesNotice.getAcceptPar());
                 OrderQuality orderQuality = orderQualityService.getOne(new LbqWrapper<OrderQuality>().eq(OrderQuality::getOrderId, order.getId()).eq(OrderQuality::getMeasuringType, "1").last("limit 1"));

+ 6 - 5
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/externalApi/MesController.java

@@ -163,6 +163,7 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
                 apiType("QUALITYREPORT").
                 lineCode("407109").
                 status("1").
+                orderInfo("1.0").
                 userCode(threeCoordinateDto.getUserCode()).
                 batchNo(threeCoordinateDto.getBatchNo()).
                 source("产线管控单元").
@@ -333,9 +334,9 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
         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.getString("auidnr")).status(params.getString("status")).afonr(bom.getNo()).pnr(params.getString("pnr")).kapaz(params.getString("kapaz")).plmenge(1.0)
+        MesProcessReportDto mesProcessReportDto = MesProcessReportDto.builder().finr("407").kpf("109").auidnr(params.getString("auidnr")).status(params.getString("status")).afonr(bom.getNo()).pnr(params.getString("pnr")).kapaz(params.getString("kapaz")).plmenge(Double.parseDouble(order.getProduceNum().toString()))
                 .build();
-        boolean status = params.get("status").equals("JS")? true: false;
+        boolean status = params.getString("status").equals("JS")? true: false;
         if(status){
             //默认处理
             mesProcessReportDto.setGutmenge(1.0).setAusschuss(0).setAussfinish(0);
@@ -343,9 +344,9 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
         JSONObject jsonParam = (JSONObject)JSONObject.toJSON(mesProcessReportDto);
         String data = jsonParam.toJSONString();
 
-        MesNotice mesNotice = MesNotice.builder().orderNo(params.getString("auidnr")).userCode(params.getString("pnr")).
-                buType("TASKAPPLY").lineCode("407109").status("1").source("产线管控单元").apiType("MESPROCESSREPORT").apiAddress(instructionUrl)
-                .targetSource("智能总控系统").acceptPar(data).build();
+        MesNotice mesNotice = MesNotice.builder().orderNo(params.getString("auidnr")).userCode(params.getString("pnr")).batchNo(params.getString("batchno")).
+                buType("TASKAPPLY").lineCode("407109").status(status?"1":"0").source("产线管控单元").apiType("MESPROCESSREPORT").apiAddress(instructionUrl)
+                .targetSource("智能总控系统").acceptPar(data).orderInfo("0.5").build();
         try {
             boolean b = baseService.addNotice(mesNotice);
         } catch (Exception e) {