|
@@ -679,10 +679,18 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
|
|
|
@DeleteMapping(value = "/delete")
|
|
|
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
|
|
|
- return Result.error("当前操作被禁止:不允许删除钢坯装运单!");
|
|
|
-// StorageBill storageBill = storageBillService.getById(id);
|
|
|
-// storageBillService.removeById(storageBill.getId());
|
|
|
-// return Result.OK("删除成功!");
|
|
|
+ StorageBill storageBill = storageBillService.getById(id);
|
|
|
+ if (storageBill == null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 删除 StorageBillPrint 中关联的记录
|
|
|
+ deleteWithPrint(id);
|
|
|
+
|
|
|
+ // 删除 StorageBill 本体
|
|
|
+ storageBillService.removeById(id);
|
|
|
+
|
|
|
+ return Result.OK("删除钢坯装运单以及票据成功!");
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -976,11 +984,11 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
|
|
|
@DeleteMapping(value = "/deleteBatch")
|
|
|
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
|
|
|
- return Result.error("当前操作被禁止:不允许删除钢坯装运单!");
|
|
|
-// for (String id : Arrays.asList(ids.split(","))) {
|
|
|
-// this.delete(id);
|
|
|
-// }
|
|
|
-// return Result.OK("批量删除成功!");
|
|
|
+ for (String id : Arrays.asList(ids.split(","))) {
|
|
|
+ this.delete(id);
|
|
|
+ deleteWithPrint(id);
|
|
|
+ }
|
|
|
+ return Result.OK("批量删除钢坯装运单以及票据成功!");
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -3038,4 +3046,14 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
|
|
|
.last("LIMIT 1")
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+ private void deleteWithPrint(String id) {
|
|
|
+ // 删除主表数据
|
|
|
+ storageBillService.removeById(id);
|
|
|
+
|
|
|
+ // 同步删除 StorageBillPrint 表中关联记录
|
|
|
+ QueryWrapper<StorageBillPrint> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("storage_bill_id", id);
|
|
|
+ storageBillPrintService.remove(queryWrapper);
|
|
|
+ }
|
|
|
}
|