Bläddra i källkod

钢坯实绩补录钢坯,根据补录的数量生成对应的流号

lingpeng.li 1 vecka sedan
förälder
incheckning
6b11051b18

+ 9 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/actualControl/billetActual/billetActual/service/impl/BilletBasicInfoServiceImpl.java

@@ -145,6 +145,9 @@ public class BilletBasicInfoServiceImpl extends ServiceImpl<BilletBasicInfoMappe
                     BigDecimal nextBilletNo = new BigDecimal(billetBasicInfo.getBilletNo());
                     billetBasicInfo.setBilletNo(String.valueOf(nextBilletNo.add(BigDecimal.ONE)));
                     billetBasicInfo.setHeatnoIndex(billetBasicInfo.getHeatnoIndex() + 1);
+                    // 设置流号 strandNo:1~8循环分配
+                    billetBasicInfo.setStrandNo(i % 8 + 1);
+
                     // 将对象转换为 Map
                     Map<String, Object> map = JSON.parseObject(JSON.toJSONString(billetBasicInfo), Map.class);
                     // 创建 MqttClientUtil 实例并调用非静态方法 pushCData
@@ -171,6 +174,8 @@ public class BilletBasicInfoServiceImpl extends ServiceImpl<BilletBasicInfoMappe
                         billetBasicInfo.setBilletNo(String.valueOf(nextBilletNo.add(BigDecimal.ONE)));
                         billetBasicInfo.setHeatnoIndex(++heatnoIndex);
                         billetBasicInfo.setAssemblyNumber(assemblyNumber);
+                        // 设置流号 strandNo:1~8循环分配
+                        billetBasicInfo.setStrandNo((i + j) % 8 + 1);
 
                         Map<String, Object> map = JSON.parseObject(JSON.toJSONString(billetBasicInfo), Map.class);
                         pushedDataList.add(map);
@@ -204,6 +209,10 @@ public class BilletBasicInfoServiceImpl extends ServiceImpl<BilletBasicInfoMappe
                     billetBasicInfo.setBilletNo(String.valueOf(nextBilletNo.add(BigDecimal.ONE)));
                     billetBasicInfo.setHeatnoIndex(heatnoIndex + 1);
                     billetBasicInfo.setAssemblyNumber(assemblyNumber);
+
+                    // 设置流号 strandNo:1~8循环分配
+                    billetBasicInfo.setStrandNo((i + j) % 8 + 1);
+
                     // 将对象转换为 Map
                     Map<String, Object> map = JSON.parseObject(JSON.toJSONString(billetBasicInfo), Map.class);
                     // 创建 MqttClientUtil 实例并调用非静态方法 pushCData

+ 16 - 3
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/actualControl/heatsActuals/service/impl/BilletSendProcessor.java

@@ -8,6 +8,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletBasicInfo;
 import org.jeecg.modules.actualControl.billetActual.billetActual.mapper.BilletBasicInfoMapper;
 import org.jeecg.modules.actualControl.heatsActuals.dto.BilletSendRequest;
@@ -24,6 +25,7 @@ import org.jeecg.modules.billet.rollClubTwo.entity.RollClubTwoDetails;
 import org.jeecg.modules.billet.rollClubTwo.mapper.RollClubTwoDetailsMapper;
 import org.jeecg.modules.billet.rollOutShipp.entity.RollOutShippDetails;
 import org.jeecg.modules.billet.rollOutShipp.mapper.RollOutShippDetailsMapper;
+import org.jeecg.modules.carUnit.service.ISysDictService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
@@ -59,6 +61,8 @@ public class BilletSendProcessor {
     private RollOutShippDetailsMapper rollOutShippDetailsMapper;
     @Autowired
     private BilletSendRequestLogMapper billetSendRequestLogMapper;
+    @Autowired
+    private ISysDictService sysDictService;
 
     private final ObjectMapper objectMapper = new ObjectMapper();
 
@@ -85,7 +89,7 @@ public class BilletSendProcessor {
             String belongTable = belongEntry.getKey();
             List<BilletBasicInfo> infosInBelongTable = belongEntry.getValue();
 
-            BilletSendRequest request = buildBaseRequest(heats, belongTable);
+            BilletSendRequest request = buildBaseRequest(heats, belongTable,infosInBelongTable);
 
             List<BilletSendRequest.SizeData> sizeDataList = new ArrayList<>();
 
@@ -187,10 +191,19 @@ public class BilletSendProcessor {
                 .sum();
     }
 
-    private BilletSendRequest buildBaseRequest(HeatsActuals heats, String belongTable) {
+    private BilletSendRequest buildBaseRequest(HeatsActuals heats, String belongTable,List<BilletBasicInfo> billetBasicInfoList) {
         BilletSendRequest request = new BilletSendRequest();
+        if(oConvertUtils.isNotEmpty(billetBasicInfoList)) {
+
+            BilletBasicInfo billetBasicInfo = billetBasicInfoList.get(0);
+            // 钢种牌号处理
+            String brandNum = Optional.ofNullable(billetBasicInfo.getBrandNum())
+                    .map(bn -> sysDictService.queryDictTextByKey("billet_spec", bn))
+                    .orElseGet(() -> sysDictService.queryDictTextByKey("billet_spec", "5"));
+
+            request.setSteelGrade(brandNum);
+        }
         request.setHeatNo(heats.getHeatsCode());
-        request.setSteelGrade(heats.getGrade());
         request.setSpecification(heats.getSpec());
         request.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
         request.setRollNo(convertRollNo(belongTable));