|
|
|
@ -4,11 +4,15 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.entity.inv.InvPreProductDetailEntity;
|
|
|
|
|
import com.glxp.api.entity.inv.InvPreProductEntity;
|
|
|
|
|
import com.glxp.api.req.inv.FilterInvPreProductDetailRequest;
|
|
|
|
|
import com.glxp.api.req.inv.FilterInvPreProductRequest;
|
|
|
|
|
import com.glxp.api.req.inv.FilterInvProductDetailRequest;
|
|
|
|
|
import com.glxp.api.req.system.DeleteRequest;
|
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.res.inv.InvPreProductDetailResponse;
|
|
|
|
|
import com.glxp.api.res.inv.InvPreProductPageResponse;
|
|
|
|
@ -19,7 +23,10 @@ import com.glxp.api.service.inv.InvPreProductDetailService;
|
|
|
|
|
import com.glxp.api.service.inv.InvPreProductService;
|
|
|
|
|
import com.glxp.api.util.udi.FilterUdiUtils;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
@ -103,4 +110,37 @@ public class InvPreProductController {
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除寄售库存
|
|
|
|
|
*
|
|
|
|
|
* @param deleteRequest
|
|
|
|
|
* @param bindingResult
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/spms/inv/pre/product/delete")
|
|
|
|
|
public BaseResponse deleteInvPreProduct(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String id = deleteRequest.getId();
|
|
|
|
|
InvPreProductEntity invPreProductEntity = invPreProductService.findById(id);
|
|
|
|
|
if (null != invPreProductEntity) {
|
|
|
|
|
FilterInvProductDetailRequest detailRequest = new FilterInvProductDetailRequest();
|
|
|
|
|
detailRequest.setSupId(invPreProductEntity.getSupId());
|
|
|
|
|
detailRequest.setRelId(String.valueOf(invPreProductEntity.getRelIdFk()));
|
|
|
|
|
detailRequest.setInvCode(invPreProductEntity.getInvCode());
|
|
|
|
|
if (StrUtil.isBlank(invPreProductEntity.getBatchNo())) {
|
|
|
|
|
detailRequest.setBatchNo("empty");
|
|
|
|
|
} else {
|
|
|
|
|
detailRequest.setBatchNo(invPreProductEntity.getBatchNo());
|
|
|
|
|
}
|
|
|
|
|
invPreProductService.deleteById(id);
|
|
|
|
|
invPreProductDetailService.deleteInvPreProductDetail(detailRequest);
|
|
|
|
|
return ResultVOUtils.success("删除成功");
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(500, "删除失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|