用车需求删除同步 删除用车计算数据,更新发货需求数据

This commit is contained in:
王帅 2025-04-25 09:55:19 +08:00
parent 9f4c9ee075
commit f45a68c1ba
5 changed files with 34 additions and 0 deletions

View File

@ -17,4 +17,6 @@ public interface IDeliveryDemandService extends IService<DeliveryDemand> {
Result<?> handleMerge(List<String> ids);
Result<?> getPalletsNum(DeliveryDemand deliveryDemand);
void updateByVdNo(String vdNo);
}

View File

@ -1,6 +1,8 @@
package org.jeecg.modules.tms.outbound.deliverydemand.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.RequiredArgsConstructor;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.tms.basicdata.constant.GeneralSequenceConstant;
@ -116,4 +118,12 @@ public class DeliveryDemandServiceImpl extends ServiceImpl<DeliveryDemandMapper,
BigDecimal result = dividend.divide(divisor, 0, RoundingMode.CEILING);
return Result.OK(result);
}
@Override
public void updateByVdNo(String vdNo) {
LambdaUpdateWrapper<DeliveryDemand> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
lambdaUpdateWrapper.eq(DeliveryDemand::getVdNo, vdNo)
.set(DeliveryDemand::getCurrentStatus, '0');
deliveryDemandMapper.update(new DeliveryDemand(), lambdaUpdateWrapper);
}
}

View File

@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.tms.outbound.deliverydemand.service.IDeliveryDemandService;
import org.jeecg.modules.tms.outbound.vehicledemand.entity.VehicleDemand;
import org.jeecg.modules.tms.outbound.vehicledemand.service.IVehicleDemandService;
@ -20,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.tms.outbound.vehicledemandcount.service.IVehicleDemandCountService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
@ -27,6 +29,7 @@ import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -49,6 +52,10 @@ import org.jeecg.common.aspect.annotation.AutoLog;
public class VehicleDemandController extends JeecgController<VehicleDemand, IVehicleDemandService> {
@Autowired
private IVehicleDemandService vehicleDemandService;
@Autowired
private IVehicleDemandCountService vehicleDemandCountService;
@Autowired
private IDeliveryDemandService deliveryDemandService;
/**
* 分页列表查询
@ -111,8 +118,14 @@ public class VehicleDemandController extends JeecgController<VehicleDemand, IVeh
@AutoLog(value = "用车需求-通过id删除")
@ApiOperation(value="用车需求-通过id删除", notes="用车需求-通过id删除")
//@RequiresPermissions("org.jeecg.modules.tms:tms_vehicle_demand:delete")
@Transactional
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
VehicleDemand byId = vehicleDemandService.getById(id);
// 删除用车计算中的数据
vehicleDemandCountService.deleteByVdNo(byId.getVdNo());
// 更新发货需求数据
deliveryDemandService.updateByVdNo(byId.getVdNo());
vehicleDemandService.removeById(id);
return Result.OK("删除成功!");
}

View File

@ -14,4 +14,5 @@ import java.util.List;
public interface IVehicleDemandCountService extends IService<VehicleDemandCount> {
List<VehicleDemandCount> getByVdNo(String vdNo);
void deleteByVdNo(String vdNo);
}

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.tms.outbound.vehicledemandcount.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import org.jeecg.modules.tms.outbound.vehicledemandcount.entity.VehicleDemandCount;
import org.jeecg.modules.tms.outbound.vehicledemandcount.mapper.VehicleDemandCountMapper;
@ -26,4 +27,11 @@ public class VehicleDemandCountServiceImpl extends ServiceImpl<VehicleDemandCoun
public List<VehicleDemandCount> getByVdNo(String vdNo) {
return vehicleDemandCountMapper.getByVdNo(vdNo);
}
@Override
public void deleteByVdNo(String vdNo) {
LambdaQueryWrapper<VehicleDemandCount> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(VehicleDemandCount::getVdNo, vdNo);
vehicleDemandCountMapper.delete(lambdaQueryWrapper);
}
}