main
Dayu 11 months ago
parent 0cca737a50
commit 35c6a42413
  1. 23
      src/main/java/org/energy/modules/spares/controller/MaterialController.java

@ -37,7 +37,12 @@ import lombok.SneakyThrows;
import org.apache.commons.codec.Charsets; import org.apache.commons.codec.Charsets;
import org.energy.modules.inspection.entity.InspectionRoute; import org.energy.modules.inspection.entity.InspectionRoute;
import org.energy.modules.inspection.excel.InspectionRouteExcel; import org.energy.modules.inspection.excel.InspectionRouteExcel;
import org.energy.modules.leger.entity.EquipmentLedger;
import org.energy.modules.spares.entity.Inbound;
import org.energy.modules.spares.entity.Outbound;
import org.energy.modules.spares.excel.MaterialExcel; import org.energy.modules.spares.excel.MaterialExcel;
import org.energy.modules.spares.service.IInboundService;
import org.energy.modules.spares.service.IOutboundService;
import org.energy.modules.system.util.DataUtils; import org.energy.modules.system.util.DataUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -65,6 +70,8 @@ import java.util.Map;
public class MaterialController extends DafController { public class MaterialController extends DafController {
private IMaterialService materialService; private IMaterialService materialService;
private IInboundService inboundService;
private IOutboundService outboundService;
/** /**
* 详情 * 详情
@ -176,6 +183,22 @@ public class MaterialController extends DafController {
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids") @ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
for (String id : ids.split(",")) {
// 获取物资编码
Material sel = new Material();
sel.setId(Long.parseLong(id));
Material material = materialService.getOne(Condition.getQueryWrapper(sel));
// 通过物资编码删除入库数据
QueryWrapper<Inbound> qw1 = new QueryWrapper<>();
qw1.lambda().eq(Inbound::getMaterialNo, material.getMaterialNo());
qw1.lambda().eq(Inbound::getIsDeleted, DafConstant.DB_NOT_DELETED);
inboundService.remove(qw1);
// 通过物资编码删除出库数据
QueryWrapper<Outbound> qw2 = new QueryWrapper<>();
qw2.lambda().eq(Outbound::getMaterialNo, material.getMaterialNo());
qw2.lambda().eq(Outbound::getIsDeleted, DafConstant.DB_NOT_DELETED);
outboundService.remove(qw2);
}
return R.status(materialService.deleteLogic(Func.toLongList(ids))); return R.status(materialService.deleteLogic(Func.toLongList(ids)));
} }

Loading…
Cancel
Save