s手持终端库存校验问题

dev2.0
anthonywj 2 years ago
parent d160138cb7
commit 490df6ea57

@ -4,12 +4,17 @@ 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.annotation.AuthRuleAnnotation;
import com.glxp.api.annotation.Log;
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.constant.BusinessType;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.controller.BaseController;
import com.glxp.api.entity.auth.InvWarehouseEntity;
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
import com.glxp.api.entity.inout.IoCodeTempEntity;
import com.glxp.api.entity.inv.InvPreProductDetailEntity;
import com.glxp.api.entity.inv.InvPreProductEntity;
import com.glxp.api.req.inv.FilterInvPreProductDetailRequest;
@ -17,13 +22,18 @@ 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.InvPlaceDetailResponse;
import com.glxp.api.res.inv.InvPreProductDetailResponse;
import com.glxp.api.res.inv.InvPreProductPageResponse;
import com.glxp.api.res.inv.InvPreProductResponse;
import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.auth.InvWarehouseService;
import com.glxp.api.service.auth.WarehouseUserService;
import com.glxp.api.service.basic.IBasicBussinessTypeService;
import com.glxp.api.service.inv.InvPreProductDetailService;
import com.glxp.api.service.inv.InvPreProductService;
import com.glxp.api.service.inv.InvPreinProductDetailService;
import com.glxp.api.util.IntUtil;
import com.glxp.api.util.udi.FilterUdiUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
@ -51,6 +61,12 @@ public class InvPreProductController extends BaseController {
private WarehouseUserService warehouseUserService;
@Resource
private CustomerService customerService;
@Resource
InvWarehouseService invWarehouseService;
@Resource
InvPreinProductDetailService invPreinProductDetailService;
@Resource
private IBasicBussinessTypeService basicBussinessTypeService;
/**
*
@ -106,7 +122,7 @@ public class InvPreProductController extends BaseController {
filterInvPreProductRequest.setInvCodes(invCodes);
}
}
List<InvPreProductResponse> list = invPreProductService.filterListStock(filterInvPreProductRequest);
List<InvPreProductResponse> list = invPreProductService.filterListStock(filterInvPreProductRequest);
PageInfo<InvPreProductResponse> pageInfo = new PageInfo<>(list);
InvPreProductPageResponse<InvPreProductResponse> pageResponse = new InvPreProductPageResponse<>();
@ -181,4 +197,42 @@ public class InvPreProductController extends BaseController {
}
}
@AuthRuleAnnotation("")
@PostMapping("spms/inv/pre/products/vailInvCount")
public BaseResponse vailInvCount(@RequestBody IoCodeTempEntity codeTempEntity) {
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByOne(ConstantStatus.ACTION_TYPE_ADVANCE);
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(codeTempEntity.getAction());
int count = 0;
if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_NULL) {
count = invPreProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), null, invWarehouseEntity.getCode(), null);
} else if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_SET) {
count = invPreProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), null, invWarehouseEntity.getCode(), codeTempEntity.getPreSpaceCode());
} else if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_CODE) {
//按指定货位出库
if (StrUtil.isEmpty(codeTempEntity.getPreSpaceCode())) {
List<InvPlaceDetailResponse> invProductDetailEntities = invPreProductDetailService.findByGroupCode(invWarehouseEntity.getCode(), codeTempEntity.getCode());
if (CollUtil.isNotEmpty(invProductDetailEntities) && invProductDetailEntities.size() > 1) {
BaseResponse baseResponse = ResultVOUtils.error(511, "存在多个货位,请指定当前货位!");
baseResponse.setData(invProductDetailEntities);
return baseResponse;
} else if (invProductDetailEntities.size() == 1) {
InvPlaceDetailResponse invPlaceDetailResponse = invProductDetailEntities.get(0);
count = invPlaceDetailResponse.getReCount();
codeTempEntity.setPreSpaceCode(invPlaceDetailResponse.getInvSpaceCode());
} else {
return ResultVOUtils.error(500, "添加失败,该产品未上架货位!");
}
} else {
count = invPreProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), null, invWarehouseEntity.getCode(), codeTempEntity.getPreSpaceCode());
}
}
if (count <= 0) {
return ResultVOUtils.error(500, "寄售库存数量不足!");
} else {
return ResultVOUtils.success(count);
}
}
}

@ -1,24 +1,33 @@
package com.glxp.api.controller.inv;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.controller.BaseController;
import com.glxp.api.entity.auth.InvWarehouseEntity;
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
import com.glxp.api.entity.basic.UdiEntity;
import com.glxp.api.entity.inout.IoCodeTempEntity;
import com.glxp.api.entity.inv.InvPreInProductDetailEntity;
import com.glxp.api.entity.inv.InvPreinDetailEntity;
import com.glxp.api.entity.inv.InvProductDetailEntity;
import com.glxp.api.req.inv.FilterInvPreinDetailRequest;
import com.glxp.api.req.inv.FilterInvPreinRequest;
import com.glxp.api.req.inv.FilterInvProductDetailRequest;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.res.inv.InvPlaceDetailResponse;
import com.glxp.api.res.inv.InvPreinDetailResponse;
import com.glxp.api.res.inv.InvPreinOrderResponse;
import com.glxp.api.service.auth.InvWarehouseService;
import com.glxp.api.service.basic.IBasicBussinessTypeService;
import com.glxp.api.service.inv.InvPreProductDetailService;
import com.glxp.api.service.inv.InvPreinDetailService;
import com.glxp.api.service.inv.InvPreinOrderService;
import com.glxp.api.service.inv.InvPreinProductDetailService;
import com.glxp.api.util.udi.FilterUdiUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.regexp.RE;
@ -34,7 +43,12 @@ import java.util.List;
@RestController
public class InvPreinOrderController extends BaseController {
@Resource
InvWarehouseService invWarehouseService;
@Resource
InvPreinProductDetailService invPreinProductDetailService;
@Resource
private IBasicBussinessTypeService basicBussinessTypeService;
@Resource
InvPreinOrderService invPreinOrderService;
@Resource
@ -72,34 +86,54 @@ public class InvPreinOrderController extends BaseController {
@AuthRuleAnnotation("")
@GetMapping("spms/prein/inv/products/getDetaiByCode")
public BaseResponse getDetaiByCode(FilterInvProductDetailRequest filterInvProductDetailRequest) {
InvPreinDetailEntity invProductDetailEntity = invPreinDetailService.findUseOneByCode(filterInvProductDetailRequest.getCode());
if (invProductDetailEntity == null) {
return ResultVOUtils.error(500, "预验收库存未存在此产品!");
} else {
if (StrUtil.isNotEmpty(invProductDetailEntity.getBatchNo()) && StrUtil.isNotEmpty(filterInvProductDetailRequest.getBatchNo())
&& !invProductDetailEntity.getBatchNo().equals(filterInvProductDetailRequest.getBatchNo())) {
return ResultVOUtils.error(500, "当前批次号与预验收录入批次号不匹配!");
}
UdiEntity udiEntity = FilterUdiUtils.getUdi(filterInvProductDetailRequest.getCode());
if (StrUtil.isEmpty(udiEntity.getSerialNo())) {//该单据已有该产品
//无序列号,则可能存在多个预验收入库单
List<InvPreinDetailEntity> invPreinDetailEntities = invPreinDetailService.findUseByCode(filterInvProductDetailRequest.getCode());
int count = 0;
for (InvPreinDetailEntity temp : invPreinDetailEntities) {
count = count + temp.getCount();
@PostMapping("spms/prein/inv/products/getDetaiByCode")
public BaseResponse getDetaiByCode(@RequestBody IoCodeTempEntity codeTempEntity) {
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByOne(ConstantStatus.ACTION_TYPE_PREIN);
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(codeTempEntity.getAction());
int count = 0;
if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_NULL) {
if (StrUtil.isNotEmpty(codeTempEntity.getSerialNo())) {
count = invPreinProductDetailService.vailStockCountByCode(null, invWarehouseEntity.getCode(), null, codeTempEntity.getCode());
} else
count = invPreinProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), null, invWarehouseEntity.getCode(), null);
} else if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_SET) {
if (StrUtil.isNotEmpty(codeTempEntity.getSerialNo())) {
count = invPreinProductDetailService.vailStockCountByCode(null, invWarehouseEntity.getCode(), codeTempEntity.getPreInSpaceCode(), codeTempEntity.getCode());
} else
count = invPreinProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), null, invWarehouseEntity.getCode(), codeTempEntity.getPreInSpaceCode());
} else if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_CODE) {
//按指定货位出库
if (StrUtil.isEmpty(codeTempEntity.getPreSpaceCode())) {
List<InvPlaceDetailResponse> invProductDetailEntities = invPreinProductDetailService.findByGroupCode(invWarehouseEntity.getCode(), codeTempEntity.getCode());
if (CollUtil.isNotEmpty(invProductDetailEntities) && invProductDetailEntities.size() > 1) {
BaseResponse baseResponse = ResultVOUtils.error(511, "存在多个货位,请指定当前货位!");
baseResponse.setData(invProductDetailEntities);
return baseResponse;
} else if (invProductDetailEntities.size() == 1) {
InvPlaceDetailResponse invPlaceDetailResponse = invProductDetailEntities.get(0);
count = invPlaceDetailResponse.getReCount();
codeTempEntity.setPreSpaceCode(invPlaceDetailResponse.getInvSpaceCode());
} else {
return ResultVOUtils.error(500, "添加失败,该产品未上架货位!");
}
invPreinDetailEntities.get(0).setCount(count);
return ResultVOUtils.success(invPreinDetailEntities.get(0));
} else {
if (invProductDetailEntity.getCount() < 1) {
return ResultVOUtils.error(500, "超出预验收库存数量");
}
if (StrUtil.isNotEmpty(codeTempEntity.getSerialNo())) {
count = invPreinProductDetailService.vailStockCountByCode(null, codeTempEntity.getInvCode(), codeTempEntity.getPreInSpaceCode(), codeTempEntity.getCode());
} else
count = invPreinProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), null, codeTempEntity.getInvCode(), codeTempEntity.getPreInSpaceCode());
}
}
return ResultVOUtils.success(invProductDetailEntity);
InvPreInProductDetailEntity invPreinDetailEntity = invPreinProductDetailService.findUseOneByCode(codeTempEntity.getCode());
if (count <= 0) {
return ResultVOUtils.error(500, "预验收库存数量不足!");
} else {
if (StrUtil.isNotEmpty(invPreinDetailEntity.getBatchNo()) && StrUtil.isNotEmpty(codeTempEntity.getBatchNo())
&& !invPreinDetailEntity.getBatchNo().equals(codeTempEntity.getBatchNo())) {
return ResultVOUtils.error(500, "当前批次号与预验收录入批次号不匹配!");
}
}
return ResultVOUtils.success(count);
}
}

@ -10,20 +10,27 @@ 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.constant.BusinessType;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.controller.BaseController;
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
import com.glxp.api.entity.inout.IoCodeTempEntity;
import com.glxp.api.entity.inv.InvProductDetailEntity;
import com.glxp.api.entity.inv.InvProductEntity;
import com.glxp.api.req.inv.FilterInvProductDetailRequest;
import com.glxp.api.req.inv.FilterInvProductRequest;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.inv.InvPlaceDetailResponse;
import com.glxp.api.res.inv.InvProductDetailResponse;
import com.glxp.api.res.inv.InvProductPageResponse;
import com.glxp.api.res.inv.InvProductResponse;
import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.auth.InvWarehouseService;
import com.glxp.api.service.auth.WarehouseUserService;
import com.glxp.api.service.basic.IBasicBussinessTypeService;
import com.glxp.api.service.inv.InvProductDetailService;
import com.glxp.api.service.inv.InvProductService;
import com.glxp.api.util.IntUtil;
import com.glxp.api.util.udi.FilterUdiUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
@ -51,7 +58,10 @@ public class InvProductController extends BaseController {
private WarehouseUserService warehouseUserService;
@Resource
private CustomerService customerService;
@Resource
InvWarehouseService invWarehouseService;
@Resource
private IBasicBussinessTypeService basicBussinessTypeService;
/**
*
@ -149,10 +159,6 @@ public class InvProductController extends BaseController {
}
/**
*
*
@ -299,17 +305,39 @@ public class InvProductController extends BaseController {
@AuthRuleAnnotation("")
@GetMapping("spms/inv/products/vailInvCount")
public BaseResponse vailInvCount(FilterInvProductDetailRequest filterInvProductDetailRequest) {
if (StrUtil.isEmpty(filterInvProductDetailRequest.getRelId())) {
return ResultVOUtils.error(500, "产品ID不能为空");
@PostMapping("spms/inv/products/vailInvCount")
public BaseResponse vailInvCount(@RequestBody IoCodeTempEntity codeTempEntity) {
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(codeTempEntity.getAction());
int count = 0;
if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_NULL) {
count = invProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), null);
} else if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_SET) {
count = invProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), codeTempEntity.getWarehouseCode());
} else if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_CODE) {
//按指定货位出库
if (StrUtil.isEmpty(codeTempEntity.getWarehouseCode())) {
List<InvPlaceDetailResponse> invProductDetailEntities = invProductDetailService.findByGroupCode(codeTempEntity.getInvCode(), codeTempEntity.getCode(), true);
if (CollUtil.isNotEmpty(invProductDetailEntities) && invProductDetailEntities.size() > 1) {
BaseResponse baseResponse = ResultVOUtils.error(511, "存在多个货位,请指定当前货位!");
baseResponse.setData(invProductDetailEntities);
return baseResponse;
} else if (invProductDetailEntities.size() == 1) {
InvPlaceDetailResponse invPlaceDetailResponse = invProductDetailEntities.get(0);
count = invPlaceDetailResponse.getReCount();
} else {
return ResultVOUtils.error(500, "添加失败,该产品未上架货位!");
}
} else {
count = invProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), codeTempEntity.getWarehouseCode());
}
}
if (StrUtil.isEmpty(filterInvProductDetailRequest.getInvCode())) {
return ResultVOUtils.error(500, "当前仓库号不能为空");
if (count <= 0) {
return ResultVOUtils.error(500, "当前库存不足");
} else {
return ResultVOUtils.success(count);
}
int count = invProductDetailService.vailStockCount(Long.parseLong(filterInvProductDetailRequest.getRelId()), filterInvProductDetailRequest.getBatchNo(), filterInvProductDetailRequest.getSupId(), filterInvProductDetailRequest.getDeptCode(), filterInvProductDetailRequest.getInvCode(), null);
return ResultVOUtils.success(count);
}
/**

@ -120,7 +120,7 @@ public class InvProductResponse {
/*
/**
*
* */
private String measname;

@ -20,8 +20,8 @@ import javax.annotation.Resource;
import java.util.Arrays;
@Slf4j
@Component
@EnableScheduling
//@Component
//@EnableScheduling
public class SyncHeartTask implements SchedulingConfigurer {
@Resource

@ -222,7 +222,7 @@
AND subInvCode = #{code}
</if>
<if test="invCode != ''and invCode != null">
AND subInvCode = #{code}
AND subInvCode = #{invCode}
</if>
<if test="userId != ''and userId != null">
AND auth_user_bustype.`userId` = #{userId}

Loading…
Cancel
Save