Sfoglia il codice sorgente

Merge branch 'guoqiang.duan/storage_bill'

guoqiang 1 mese fa
parent
commit
e21974443e

+ 8 - 3
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/service/impl/StorageBillServiceImpl.java

@@ -5624,6 +5624,9 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
         // Step 4: 处理每条 bill
         for (StorageBill bill : bills) {
+            // 生成一个新的对象
+            StorageBill newBill = new StorageBill();
+            newBill.setId(bill.getId());
             String key = String.join("_", bill.getCcmNo(), bill.getShiftGroup(), bill.getShift(),
                     DateFormatUtils.format(DateUtils.getStartOfDay(bill.getCreateTime()), "yyyy-MM-dd"));
 
@@ -5657,7 +5660,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                         .filter(b -> !b.getId().equals(bill.getId()))
                         .filter(b -> b.getCreateTime().before(bill.getCreateTime()))
                         .count();
-                bill.setCarNum((int) index + 1);
+                newBill.setCarNum((int) index + 1);
                 updated = true;
             }
 
@@ -5674,11 +5677,13 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                         .filter(b -> !b.getId().equals(bill.getId()))
                         .filter(b -> b.getCreateTime().before(bill.getCreateTime()))
                         .count();
-                bill.setCarAllNum((int) totalIndex + 1);
+                newBill.setCarAllNum((int) totalIndex + 1);
                 updated = true;
             }
 
-            if (updated) this.updateById(bill);
+            if (updated) {
+                this.updateById(newBill);
+            }
 
             // 更新交班 outCarNum(依赖 carAllNum,不管车牌状态)
             if (shiftRecord.getOutCarNum() == null || shiftRecord.getOutCarNum() == 0) {