|
@@ -1385,11 +1385,12 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
|
|
|
|
|
|
// 查询最新的 StorageBill
|
|
|
LambdaQueryWrapper<StorageBill> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(StorageBill::getCcmNo, ccmNo)
|
|
|
- .eq(StorageBill::getPositionNum, positionNum)
|
|
|
- .orderByDesc(StorageBill::getCreateTime)
|
|
|
- .last("LIMIT 1");
|
|
|
-
|
|
|
+ queryWrapper.eq(StorageBill::getPositionNum, positionNum);
|
|
|
+ // 车位不等于 2铸机号 加铸机号条件
|
|
|
+ if (!positionNum.equals("2")) {
|
|
|
+ queryWrapper.eq(StorageBill::getCcmNo, ccmNo);
|
|
|
+ }
|
|
|
+ queryWrapper.orderByDesc(StorageBill::getCreateTime).last("LIMIT 1");
|
|
|
StorageBill latestStorageBill = storageBillService.getOne(queryWrapper);
|
|
|
|
|
|
// 判空,避免 NullPointerException
|
|
@@ -1461,14 +1462,40 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
|
|
|
if (oConvertUtils.isEmpty(bill)){
|
|
|
return Result.OK("装运单信息为空,更新车牌号失败!");
|
|
|
}
|
|
|
- bill.setLicensePlate(storageBill.getLicensePlate());
|
|
|
- if ("1".equals(bill.getLicensePlateStatus().toString())){
|
|
|
- bill.setLicensePlateStatus(0);
|
|
|
+
|
|
|
+ if (oConvertUtils.isNotEmpty(storageBill.getLicensePlate())){ // 更新车牌
|
|
|
+ bill.setLicensePlate(storageBill.getLicensePlate());
|
|
|
+ }
|
|
|
+ if (oConvertUtils.isNotEmpty(storageBill.getCcmNo())){ // 更新铸机号
|
|
|
+ String uniqueCode = generateUniqueCode(new Date(), storageBill.getCcmNo(), bill.getShift(), bill.getShiftGroup());
|
|
|
+ bill.setUniqueCode(uniqueCode);
|
|
|
+ bill.setCcmNo(storageBill.getCcmNo());
|
|
|
}
|
|
|
+
|
|
|
storageBillService.updateById(bill);
|
|
|
return Result.OK("更新车牌号成功!");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 生成综合唯一编码
|
|
|
+ * @param date
|
|
|
+ * @param ccmNo
|
|
|
+ * @param shift
|
|
|
+ * @param shiftGroup
|
|
|
+ * @return uniqueCode
|
|
|
+ */
|
|
|
+ private String generateUniqueCode(Date date, String ccmNo, String shift, String shiftGroup) {
|
|
|
+ // 将日期转换为指定格式的字符串
|
|
|
+ String dateStr = DateUtils.date2Str(date, DateUtils.yyyymmddhhmmss.get());
|
|
|
+ // 将 shift 转换为 ShiftEnum 的名称
|
|
|
+ String shiftName = ShiftEnum.fromCode(shift).name();
|
|
|
+ // 将 shiftGroup 转换为 ShiftGroupEnum 的名称
|
|
|
+ String shiftGroupName = ShiftGroupEnum.fromCode(shiftGroup).name();
|
|
|
+ // 组合生成唯一代码
|
|
|
+ String uniqueCode = dateStr + "-" + ccmNo + "#" + shiftName + "-" + shiftGroupName;
|
|
|
+ return uniqueCode;
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value="当班所有装运信息-车辆运行看板", notes="当班所有装运信息-车辆运行看板")
|
|
|
@GetMapping(value = "/queryOnDutyAllStorageBillBoard")
|
|
|
public Result<OnDutyStorageBillVo> queryOnDutyAllStorageBillInfoBoard(@RequestParam(name="ccmNo") String ccmNo) {
|