|
|
|
@ -43,6 +43,7 @@ import com.glxp.api.util.*;
|
|
|
|
|
import com.glxp.api.util.udi.FilterUdiUtils;
|
|
|
|
|
import com.glxp.api.util.udi.UdiCalCountUtil;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.regexp.RE;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
@ -585,11 +586,11 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
|
|
|
|
|
BaseResponse invRes = null;
|
|
|
|
|
if (bussinessTypeEntity.isScanPreIn()) { //校验预验收库存
|
|
|
|
|
invRes = checkPreInInv(bussinessTypeEntity, genDetaiEntity);
|
|
|
|
|
invRes = checkPreInInv(bussinessTypeEntity, genDetaiEntity,false);
|
|
|
|
|
} else if (bussinessTypeEntity.isAdvancePreIn()) { //校验寄售库存
|
|
|
|
|
invRes = checkPreInv(bussinessTypeEntity, genDetaiEntity);
|
|
|
|
|
invRes = checkPreInv(bussinessTypeEntity, genDetaiEntity,false);
|
|
|
|
|
} else {
|
|
|
|
|
invRes = checkInv(bussinessTypeEntity, genDetaiEntity);
|
|
|
|
|
invRes = checkInv(bussinessTypeEntity, genDetaiEntity, false);
|
|
|
|
|
}
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
return invRes;
|
|
|
|
@ -741,19 +742,19 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isScanPreIn()) { //校验预验收库存
|
|
|
|
|
BaseResponse invRes = checkPreInInv(bussinessTypeEntity, codeEnttity);
|
|
|
|
|
BaseResponse invRes = checkPreInInv(bussinessTypeEntity, codeEnttity,false);
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
deleteEmptyBillNo(orderEntity);
|
|
|
|
|
return invRes;
|
|
|
|
|
}
|
|
|
|
|
} else if (bussinessTypeEntity.isAdvancePreIn()) { //校验寄售库存
|
|
|
|
|
BaseResponse invRes = checkPreInv(bussinessTypeEntity, codeEnttity);
|
|
|
|
|
BaseResponse invRes = checkPreInv(bussinessTypeEntity, codeEnttity,false);
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
deleteEmptyBillNo(orderEntity);
|
|
|
|
|
return invRes;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
BaseResponse invRes = checkInv(bussinessTypeEntity, codeEnttity);
|
|
|
|
|
BaseResponse invRes = checkInv(bussinessTypeEntity, codeEnttity, false);
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
deleteEmptyBillNo(orderEntity);
|
|
|
|
|
return invRes;
|
|
|
|
@ -782,8 +783,78 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
return ResultVOUtils.success(addCodeResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BaseResponse checkInv(BasicBussinessTypeEntity bussinessTypeEntity, IoCodeTempEntity codeTempEntity, boolean isEdit) {
|
|
|
|
|
if (bussinessTypeEntity.isVailInv() && bussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
int count = 0;
|
|
|
|
|
if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_NULL) {
|
|
|
|
|
// if (StrUtil.isNotEmpty(codeTempEntity.getSerialNo())) {
|
|
|
|
|
// count = invProductDetailService.vailStockCountByCode(codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), null, codeTempEntity.getCode());
|
|
|
|
|
// } else
|
|
|
|
|
count = invProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), null);
|
|
|
|
|
} else if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_SET) {
|
|
|
|
|
// if (StrUtil.isNotEmpty(codeTempEntity.getSerialNo())) {
|
|
|
|
|
// count = invProductDetailService.vailStockCountByCode(codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), codeTempEntity.getWarehouseCode(), codeTempEntity.getCode());
|
|
|
|
|
// } else
|
|
|
|
|
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 {
|
|
|
|
|
// if (StrUtil.isNotEmpty(codeTempEntity.getSerialNo())) {
|
|
|
|
|
// count = invProductDetailService.vailStockCountByCode(codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), codeTempEntity.getWarehouseCode(), codeTempEntity.getCode());
|
|
|
|
|
// } else
|
|
|
|
|
count = invProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), codeTempEntity.getWarehouseCode());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (count <= 0) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前库存不足");
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
//查询此单据已扫描的条码数量
|
|
|
|
|
if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_CODE) {
|
|
|
|
|
int exitCount = IntUtil.value(codeTempService.selectExitCount(codeTempEntity.getOrderId(), codeTempEntity.getCode()));
|
|
|
|
|
if (isEdit) {
|
|
|
|
|
if (exitCount > count) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前库存不足");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if ((codeTempEntity.getMyReCount() + exitCount) > count) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前库存不足");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
int exitCount = IntUtil.value(codeTempService.selectExitCount(codeTempEntity.getOrderId(), codeTempEntity.getBatchNo(), codeTempEntity.getRelId(), codeTempEntity.getSupId()));
|
|
|
|
|
if (isEdit) {
|
|
|
|
|
if (exitCount > count) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前库存不足");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if ((codeTempEntity.getMyReCount() + exitCount) > count) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前库存不足");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 校验寄售库存
|
|
|
|
|
public BaseResponse checkPreInv(BasicBussinessTypeEntity bussinessTypeEntity, IoCodeTempEntity codeTempEntity) {
|
|
|
|
|
public BaseResponse checkPreInv(BasicBussinessTypeEntity bussinessTypeEntity, IoCodeTempEntity codeTempEntity, boolean isEdit) {
|
|
|
|
|
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByOne(ConstantStatus.ACTION_TYPE_ADVANCE);
|
|
|
|
|
int count = 0;
|
|
|
|
@ -814,15 +885,23 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
return ResultVOUtils.error(500, "寄售库存数量不足!");
|
|
|
|
|
} else {
|
|
|
|
|
int exitCount = IntUtil.value(codeTempService.selectExitCount(codeTempEntity.getOrderId(), codeTempEntity.getBatchNo(), codeTempEntity.getRelId(), codeTempEntity.getSupId()));
|
|
|
|
|
if (isEdit) {
|
|
|
|
|
if (exitCount > count) {
|
|
|
|
|
return ResultVOUtils.error(500, "寄售库存数量不足");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
if ((codeTempEntity.getMyReCount() + exitCount) > count) {
|
|
|
|
|
return ResultVOUtils.error(500, "寄售库存数量不足");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 校验预验收库存
|
|
|
|
|
public BaseResponse checkPreInInv(BasicBussinessTypeEntity bussinessTypeEntity, IoCodeTempEntity codeTempEntity) {
|
|
|
|
|
public BaseResponse checkPreInInv(BasicBussinessTypeEntity bussinessTypeEntity, IoCodeTempEntity codeTempEntity, boolean isEdit) {
|
|
|
|
|
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByOne(ConstantStatus.ACTION_TYPE_PREIN);
|
|
|
|
|
|
|
|
|
@ -873,10 +952,16 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
//无序列号,则可能存在多个预验收入库单
|
|
|
|
|
IoCodeTempEntity tempEntity = codeTempService.findByUnique(codeTempEntity.getOrderId(), codeTempEntity.getCode());
|
|
|
|
|
if (tempEntity != null) {
|
|
|
|
|
if (isEdit) {
|
|
|
|
|
if (count < (tempEntity.getMyCount())) {
|
|
|
|
|
return ResultVOUtils.error(500, "超出预验收存数量");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (count < (tempEntity.getMyCount() + 1)) {
|
|
|
|
|
return ResultVOUtils.error(500, "超出预验收存数量");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (count < 1) {
|
|
|
|
|
return ResultVOUtils.error(500, "预验收库存数量不足");
|
|
|
|
@ -1027,61 +1112,6 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BaseResponse checkInv(BasicBussinessTypeEntity bussinessTypeEntity, IoCodeTempEntity codeTempEntity) {
|
|
|
|
|
if (bussinessTypeEntity.isVailInv() && bussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
int count = 0;
|
|
|
|
|
if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_NULL) {
|
|
|
|
|
// if (StrUtil.isNotEmpty(codeTempEntity.getSerialNo())) {
|
|
|
|
|
// count = invProductDetailService.vailStockCountByCode(codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), null, codeTempEntity.getCode());
|
|
|
|
|
// } else
|
|
|
|
|
count = invProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), null);
|
|
|
|
|
} else if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_SET) {
|
|
|
|
|
// if (StrUtil.isNotEmpty(codeTempEntity.getSerialNo())) {
|
|
|
|
|
// count = invProductDetailService.vailStockCountByCode(codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), codeTempEntity.getWarehouseCode(), codeTempEntity.getCode());
|
|
|
|
|
// } else
|
|
|
|
|
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 {
|
|
|
|
|
// if (StrUtil.isNotEmpty(codeTempEntity.getSerialNo())) {
|
|
|
|
|
// count = invProductDetailService.vailStockCountByCode(codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), codeTempEntity.getWarehouseCode(), codeTempEntity.getCode());
|
|
|
|
|
// } else
|
|
|
|
|
count = invProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), codeTempEntity.getWarehouseCode());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (count <= 0) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前库存不足");
|
|
|
|
|
} else {
|
|
|
|
|
//查询此单据已扫描的条码数量
|
|
|
|
|
if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_CODE){
|
|
|
|
|
int exitCount = IntUtil.value(codeTempService.selectExitCount(codeTempEntity.getOrderId(), codeTempEntity.getCode()));
|
|
|
|
|
if ((codeTempEntity.getMyReCount() + exitCount) > count) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前库存不足");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
int exitCount = IntUtil.value(codeTempService.selectExitCount(codeTempEntity.getOrderId(), codeTempEntity.getBatchNo(), codeTempEntity.getRelId(), codeTempEntity.getSupId()));
|
|
|
|
|
if ((codeTempEntity.getMyReCount() + exitCount) > count) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前库存不足");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("admin/warehouse/inout/findErrorByOrderId")
|
|
|
|
@ -1245,16 +1275,18 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
|
|
|
|
|
IoCodeTempEntity tempEntity = codeTempService.selectById(codeTempEntity.getId());
|
|
|
|
|
codeTempEntity.setReCount(codeTempEntity.getMyCount() * udiCalCountUtil.getActCount(codeTempEntity.getNameCode()));
|
|
|
|
|
codeTempService.updateById(codeTempEntity);
|
|
|
|
|
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(tempEntity.getAction());
|
|
|
|
|
BaseResponse invRes = null;
|
|
|
|
|
if (bussinessTypeEntity.isScanPreIn()) { //校验预验收库存
|
|
|
|
|
invRes = checkPreInInv(bussinessTypeEntity, codeTempEntity);
|
|
|
|
|
invRes = checkPreInInv(bussinessTypeEntity, codeTempEntity, true);
|
|
|
|
|
} else if (bussinessTypeEntity.isAdvancePreIn()) { //校验寄售库存
|
|
|
|
|
invRes = checkPreInv(bussinessTypeEntity, codeTempEntity);
|
|
|
|
|
invRes = checkPreInv(bussinessTypeEntity, codeTempEntity, true);
|
|
|
|
|
} else {
|
|
|
|
|
invRes = checkInv(bussinessTypeEntity, codeTempEntity);
|
|
|
|
|
invRes = checkInv(bussinessTypeEntity, codeTempEntity, true);
|
|
|
|
|
}
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
codeTempService.updateById(tempEntity);
|
|
|
|
|
return invRes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1267,7 +1299,9 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
//扫码数量-1
|
|
|
|
|
int orderCount = orderDetailCodeEntity.getCount();
|
|
|
|
|
orderDetailCodeEntity.setCount(orderCount - count);
|
|
|
|
|
orderDetailCodeEntity.setReCount(orderDetailCodeEntity.getCount() * udiCalCountUtil.getActCount(codeTempEntity.getNameCode()));
|
|
|
|
|
|
|
|
|
|
int reCount = count * udiCalCountUtil.getActCount(codeTempEntity.getNameCode());
|
|
|
|
|
orderDetailCodeEntity.setReCount(IntUtil.value(orderDetailCodeEntity.getReCount()) - reCount);
|
|
|
|
|
ioOrderDetailCodeService.update(orderDetailCodeEntity);
|
|
|
|
|
}
|
|
|
|
|
int b = codeTempService.updateById(codeTempEntity);
|
|
|
|
@ -1539,11 +1573,11 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
|
|
|
|
|
BaseResponse invRes = null;
|
|
|
|
|
if (bussinessTypeEntity.isScanPreIn()) { //校验预验收库存
|
|
|
|
|
invRes = checkPreInInv(bussinessTypeEntity, genDetaiEntity);
|
|
|
|
|
invRes = checkPreInInv(bussinessTypeEntity, genDetaiEntity,false);
|
|
|
|
|
} else if (bussinessTypeEntity.isAdvancePreIn()) { //校验寄售库存
|
|
|
|
|
invRes = checkPreInv(bussinessTypeEntity, genDetaiEntity);
|
|
|
|
|
invRes = checkPreInv(bussinessTypeEntity, genDetaiEntity,false);
|
|
|
|
|
} else {
|
|
|
|
|
invRes = checkInv(bussinessTypeEntity, genDetaiEntity);
|
|
|
|
|
invRes = checkInv(bussinessTypeEntity, genDetaiEntity, false);
|
|
|
|
|
}
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
return invRes;
|
|
|
|
@ -1694,19 +1728,19 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isScanPreIn()) { //校验预验收库存
|
|
|
|
|
BaseResponse invRes = checkPreInInv(bussinessTypeEntity, codeEnttity);
|
|
|
|
|
BaseResponse invRes = checkPreInInv(bussinessTypeEntity, codeEnttity,false);
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
deleteEmptyBillNo(orderEntity);
|
|
|
|
|
return invRes;
|
|
|
|
|
}
|
|
|
|
|
} else if (bussinessTypeEntity.isAdvancePreIn()) { //校验寄售库存
|
|
|
|
|
BaseResponse invRes = checkPreInv(bussinessTypeEntity, codeEnttity);
|
|
|
|
|
BaseResponse invRes = checkPreInv(bussinessTypeEntity, codeEnttity,false);
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
deleteEmptyBillNo(orderEntity);
|
|
|
|
|
return invRes;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
BaseResponse invRes = checkInv(bussinessTypeEntity, codeEnttity);
|
|
|
|
|
BaseResponse invRes = checkInv(bussinessTypeEntity, codeEnttity, false);
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
deleteEmptyBillNo(orderEntity);
|
|
|
|
|
return invRes;
|
|
|
|
|