|
@@ -1120,7 +1120,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
|
|
|
|
|
|
/**
|
|
|
* 钢坯热送信息查询、更新
|
|
|
- * 棒一、棒二、棒三、上若、高线 基础表和明细 新增、更新
|
|
|
+ * 棒二、棒三、上若、基础表和明细 新增、更新
|
|
|
* 交班记录表查询 更新
|
|
|
* @param billetHotsend
|
|
|
* @param billetHotsendDetailsVo
|
|
@@ -2683,6 +2683,123 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public JSONObject billetAutoTmpDataSyn(StorageBill storageBill) {
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ try {
|
|
|
+ log.info("{}{}", "未知目的地数据同步装运单信息:", JSON.toJSON(storageBill));
|
|
|
+
|
|
|
+ List<RollClubCommon> rollClubCommonList = new ArrayList<>();
|
|
|
+ // 根据装运单ID查询钢坯临时表
|
|
|
+ List<BilletAutoTmp> billetAutoTmpList = billetAutoTmpService.list(new LambdaQueryWrapper<BilletAutoTmp>()
|
|
|
+ .eq(BilletAutoTmp::getStorageBillId, storageBill.getId()));
|
|
|
+ if (oConvertUtils.listIsEmpty(billetAutoTmpList)){
|
|
|
+ result.put("fail", "钢坯装运未知目的地明细不存在!");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ billetAutoTmpList.forEach(x ->{
|
|
|
+ RollClubCommon rollClubCommon = new RollClubCommon();
|
|
|
+ BeanUtils.copyProperties(x, rollClubCommon);
|
|
|
+ rollClubCommon.setGrade(x.getSteel());
|
|
|
+ rollClubCommon.setLength(Integer.valueOf(x.getSize()));
|
|
|
+ rollClubCommon.setBilletWeight(x.getBlankOutput());
|
|
|
+ rollClubCommonList.add(rollClubCommon);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 根据ID获取钢坯配置信息
|
|
|
+ BilletHotsend billetHotsend = new BilletHotsend();
|
|
|
+ billetHotsend.setCcmNo(storageBill.getCcmNo());
|
|
|
+ BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(storageBill.getTypeConfigId());
|
|
|
+
|
|
|
+ BilletHotsendDetailsVo billetHotsendDetailsVo = new BilletHotsendDetailsVo();
|
|
|
+ billetHotsendDetailsVo.setBelongTable(billetHotsendTypeConfig.getBelongTable());
|
|
|
+ billetHotsendDetailsVo.setBelongTypeName(billetHotsendTypeConfig.getTypeName());
|
|
|
+
|
|
|
+ billetHotsendDetailsVo.setDestination(billetHotsendTypeConfig.getTypeName());
|
|
|
+ billetHotsendDetailsVo.setDestinationId(billetHotsendTypeConfig.getId());
|
|
|
+ billetHotsendDetailsVo.setBilletHotsendTypeConfigId(billetHotsendTypeConfig.getId());
|
|
|
+
|
|
|
+ billetHotsendDetailsVo.setStorageBill(storageBill);
|
|
|
+ billetHotsendDetailsVo.setBilletHotsend(billetHotsend);
|
|
|
+ billetHotsendDetailsVo.setRollClubCommonList(rollClubCommonList);
|
|
|
+
|
|
|
+ Map<String, List<RollClubCommon>> rollClubCommonLists = groupByShiftAttributes(rollClubCommonList);
|
|
|
+ /**
|
|
|
+ * 维护热送单炉信息 保存棒二或或棒三明细 更新钢坯基础信息
|
|
|
+ * 在这里可以添加更多针对每个分组(键和对应列表)的业务逻辑操作,比如遍历列表中的元素等
|
|
|
+ */
|
|
|
+ for (Map.Entry<String, List<RollClubCommon>> entry : rollClubCommonLists.entrySet()) {
|
|
|
+ String[] parts = entry.getKey().split(",");
|
|
|
+ billetHotsend.setHeatNo(parts[0]);// 炉号
|
|
|
+ billetHotsend.setShiftGroup(parts[1]);// 班组
|
|
|
+ billetHotsend.setShift(parts[2]);// 班别
|
|
|
+ List<RollClubCommon> groupRollClubCommonList = entry.getValue();
|
|
|
+ JSONObject jsonObject = commonBilletHotsenAndDetailsHandle(billetHotsend, billetHotsendDetailsVo, billetHotsendTypeConfig, storageBill, groupRollClubCommonList, null);
|
|
|
+ if (jsonObject.containsKey("fail")) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ log.info("{}{}", "B端钢坯装运单未知目的地数据同步操作失败,事务回滚!", jsonObject);
|
|
|
+ return jsonObject;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<String> billetNos = rollClubCommonList.stream().map(RollClubCommon::getBilletNo).collect(Collectors.toList());
|
|
|
+ //查询并批量更新钢坯基础信息 belongTable
|
|
|
+ LambdaQueryWrapper<BilletBasicInfo> queryWrapperls = new LambdaQueryWrapper<BilletBasicInfo>()
|
|
|
+ .eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsend.getCcmNo()))
|
|
|
+ .in(BilletBasicInfo::getBilletNo, billetNos);
|
|
|
+ List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapperls);
|
|
|
+ billetBasicInfoList.forEach(x ->{
|
|
|
+ if ("roll_club_two".equals(billetHotsendDetailsVo.getBelongTable())){
|
|
|
+ x.setBelongTable("roll_club_two");
|
|
|
+ }else if ("roll_club_three".equals(billetHotsendDetailsVo.getBelongTable())){
|
|
|
+ x.setBelongTable("roll_club_three");
|
|
|
+ }else if ("roll_out_shipp".equals(billetHotsendDetailsVo.getBelongTable())){
|
|
|
+ x.setBelongTable("roll_out_shipp");
|
|
|
+ }
|
|
|
+ x.setBhtcId(billetHotsendDetailsVo.getBilletHotsendTypeConfigId());
|
|
|
+ x.setUpdateTime(new Date());
|
|
|
+ });
|
|
|
+ billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
|
|
|
+
|
|
|
+// // 维护支数、组坯号、
|
|
|
+// storageBill.setAmountTotal();
|
|
|
+// storageBill.setAssemblyNumber(storageBill.getAssemblyNumber());
|
|
|
+// // 更新装运单目的地、发车时间
|
|
|
+// storageBill.setUpdateTime(new Date());
|
|
|
+// baseMapper.updateById(storageBill);
|
|
|
+
|
|
|
+// // 发车后,新增储运记录 storage_car_log
|
|
|
+// StorageCarLog storageCarLog = new StorageCarLog();
|
|
|
+// BeanUtils.copyProperties(storageBill, storageCarLog);
|
|
|
+// storageCarLog.setCarNm(storageBill.getLicensePlate());// 车牌号
|
|
|
+// storageCarLog.setTypeConfigId(storageBill.getTypeConfigId()); // 钢坯配置类型ID
|
|
|
+//
|
|
|
+// List<String> sizeList = rollClubCommonList.stream().map(RollClubCommon::getSize).distinct().collect(Collectors.toList());
|
|
|
+// List<String> heatNoList = rollClubCommonList.stream().map(RollClubCommon::getHeatNo).distinct().collect(Collectors.toList());
|
|
|
+// long count = rollClubCommonList.stream().count();
|
|
|
+//
|
|
|
+// storageCarLog.setHeatNo(String.join(",", heatNoList));
|
|
|
+// storageCarLog.setSize(String.join(",", sizeList));// 定尺
|
|
|
+// storageCarLog.setAmount(Integer.valueOf((int) count));// 支数
|
|
|
+//
|
|
|
+// storageCarLog.setDataTime(new Date());
|
|
|
+// storageCarLog.setCreateTime(new Date());
|
|
|
+// storageCarLogService.save(storageCarLog);
|
|
|
+// log.info("{}{}", "B端钢坯车位发车成功!", storageBill.getLicensePlate());
|
|
|
+
|
|
|
+
|
|
|
+ // 物理删除钢坯临时表记录
|
|
|
+ billetAutoTmpService.removeBatchByIds(billetAutoTmpList.stream().map(BilletAutoTmp::getId).collect(Collectors.toList()));
|
|
|
+ result.put("success", "B端钢坯车位发车成功!");
|
|
|
+ return result;
|
|
|
+ }catch (Exception e){
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ // 记录异常日志
|
|
|
+ log.error("钢坯车位发车发生异常", e.getMessage());
|
|
|
+ result.put("fail", "系统错误,请稍后再试!");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// 计算整数总和的方法
|
|
|
private int calculateIntSum(List<DestinationStatisticsDetails> list) {
|