@ -26,6 +26,7 @@ import com.glxp.api.entity.inout.*;
import com.glxp.api.entity.inv.InvPreInProductDetailEntity ;
import com.glxp.api.entity.inv.InvPreProductDetailEntity ;
import com.glxp.api.entity.inv.InvPreinDetailEntity ;
import com.glxp.api.entity.inv.InvProductDetailEntity ;
import com.glxp.api.entity.system.SystemParamConfigEntity ;
import com.glxp.api.req.basic.CompanyProductRelevanceRequest ;
import com.glxp.api.req.inout.AddEnterCodeRequest ;
@ -37,6 +38,7 @@ import com.glxp.api.res.basic.UdiRelevanceResponse;
import com.glxp.api.res.basic.UdiRlSupResponse ;
import com.glxp.api.res.inout.AddCodeResult ;
import com.glxp.api.res.inout.IoCodeTempResponse ;
import com.glxp.api.res.inv.InvPlaceDetailResponse ;
import com.glxp.api.service.auth.InvWarehouseService ;
import com.glxp.api.service.basic.* ;
import com.glxp.api.service.inout.* ;
@ -516,104 +518,12 @@ public class IoCodeTempController extends BaseController {
}
}
}
} else {
return ResultVOUtils . error ( 500 , "未选择预验收入库单,请先选择预验收入库单!" ) ;
}
} else if ( bussinessTypeEntity . getBackPreinType ( ) = = 2 ) { //按货位出库
if ( StrUtil . isEmpty ( addOrderRequest . getCheckPreInSpaceCode ( ) ) )
return ResultVOUtils . error ( 500 , "" +
"请选择预验收货位!" ) ;
int preInCount = invPreinProductDetailService . findCountBySpaceCode ( addOrderRequest . getCheckPreInSpaceCode ( ) , code ) ;
InvPreInProductDetailEntity invPreinDetailEntity = invPreinProductDetailService . findUseOneByCode ( code ) ;
if ( preInCount < = 0 ) {
return ResultVOUtils . error ( 500 , "预验收库存数量不足!" ) ;
} else {
if ( StrUtil . isNotEmpty ( invPreinDetailEntity . getBatchNo ( ) ) & & StrUtil . isNotEmpty ( udiEntity . getBatchNo ( ) )
& & ! invPreinDetailEntity . getBatchNo ( ) . equals ( udiEntity . getBatchNo ( ) ) ) {
return ResultVOUtils . error ( 500 , "当前批次号与预验收录入批次号不匹配!" ) ;
}
if ( StrUtil . isNotEmpty ( orderId ) ) { //非首次添加
if ( StrUtil . isEmpty ( udiEntity . getSerialNo ( ) ) ) { //该单据已有该产品
//无序列号,则可能存在多个预验收入库单
IoCodeTempEntity codeTempEntity = codeTempService . findByUnique ( orderId , code ) ;
if ( codeTempEntity ! = null ) {
if ( preInCount < ( codeTempEntity . getMyCount ( ) + 1 ) ) {
return ResultVOUtils . error ( 500 , "超出预验收库存数量" ) ;
}
}
} else {
if ( preInCount < 1 ) {
return ResultVOUtils . error ( 500 , "预验收库存数量不足" ) ;
}
}
}
}
}
/ * *
* else { //按库存出库
* int preInCount = invPreinProductDetailService . findCountByCode ( code ) ;
* InvPreInProductDetailEntity invPreinDetailEntity = invPreinProductDetailService . findUseOneByCode ( code ) ;
* if ( preInCount < = 0 ) {
* return ResultVOUtils . error ( 500 , "预验收库存数量不足!" ) ;
* } else {
* if ( StrUtil . isNotEmpty ( invPreinDetailEntity . getBatchNo ( ) ) & & StrUtil . isNotEmpty ( udiEntity . getBatchNo ( ) )
* & & ! invPreinDetailEntity . getBatchNo ( ) . equals ( udiEntity . getBatchNo ( ) ) ) {
* return ResultVOUtils . error ( 500 , "当前批次号与预验收录入批次号不匹配!" ) ;
* }
* if ( StrUtil . isNotEmpty ( orderId ) ) { //非首次添加
* if ( StrUtil . isEmpty ( udiEntity . getSerialNo ( ) ) ) { //该单据已有该产品
* //无序列号,则可能存在多个预验收入库单
* IoCodeTempEntity codeTempEntity = codeTempService . findByUnique ( orderId , code ) ;
* if ( codeTempEntity ! = null ) {
* if ( preInCount < ( codeTempEntity . getMyCount ( ) + 1 ) ) {
* return ResultVOUtils . error ( 500 , "超出预验收库存数量" ) ;
* }
* }
* } else {
* if ( preInCount < 1 ) {
* return ResultVOUtils . error ( 500 , "预验收库存数量不足" ) ;
* }
* }
* }
* }
* }
* /
}
// 是否检验寄售库存
if ( bussinessTypeEntity . isAdvancePreIn ( ) ) {
int preInCount = invPreProductDetailService . findCountByCode ( code ) ;
InvPreProductDetailEntity invPreinDetailEntity = invPreProductDetailService . findUseOneByCode ( code ) ;
if ( preInCount < = 0 ) {
return ResultVOUtils . error ( 500 , "寄售库存数量不足!" ) ;
} else {
if ( StrUtil . isNotEmpty ( invPreinDetailEntity . getBatchNo ( ) ) & & StrUtil . isNotEmpty ( udiEntity . getBatchNo ( ) )
& & ! invPreinDetailEntity . getBatchNo ( ) . equals ( udiEntity . getBatchNo ( ) ) ) {
return ResultVOUtils . error ( 500 , "当前批次号与预验收录入批次号不匹配!" ) ;
}
if ( StrUtil . isNotEmpty ( orderId ) ) { //非首次添加
if ( StrUtil . isEmpty ( udiEntity . getSerialNo ( ) ) ) { //该单据已有该产品
//无序列号,则可能存在多个预验收入库单
IoCodeTempEntity codeTempEntity = codeTempService . findByUnique ( orderId , code ) ;
if ( codeTempEntity ! = null ) {
if ( preInCount < ( codeTempEntity . getMyCount ( ) + 1 ) ) {
return ResultVOUtils . error ( 500 , "超出寄售存数量" ) ;
}
}
} else {
if ( preInCount < 1 ) {
return ResultVOUtils . error ( 500 , "寄售库存数量不足" ) ;
}
}
}
}
}
if ( addOrderRequest . getFromCorp ( ) = = null ) {
BasicCorpEntity basicCorpEntity = basicUnitMaintainService . selectByName ( addOrderRequest . getFromCorp ( ) ) ;
if ( basicCorpEntity = = null & & bussinessTypeEntity . getCorpType ( ) = = ConstantStatus . CORP_TYPE_INPUT & & bussinessTypeEntity . isGenUnit ( ) ) {
@ -655,7 +565,14 @@ public class IoCodeTempController extends BaseController {
exitLocalEntity . setCount ( exitLocalEntity . getMyCount ( ) + 1 ) ;
exitLocalEntity . setReCount ( exitLocalEntity . getMyCount ( ) * udiCalCountUtil . getActCount ( udiRelevanceResponses . get ( 0 ) ) ) ;
BaseResponse invRes = checkInv ( bussinessTypeEntity , exitLocalEntity ) ;
BaseResponse invRes = null ;
if ( bussinessTypeEntity . isScanPreIn ( ) ) { //校验预验收库存
invRes = checkPreInInv ( bussinessTypeEntity , exitLocalEntity ) ;
} else if ( bussinessTypeEntity . isAdvancePreIn ( ) ) { //校验寄售库存
invRes = checkPreInv ( bussinessTypeEntity , exitLocalEntity ) ;
} else {
invRes = checkInv ( bussinessTypeEntity , exitLocalEntity ) ;
}
if ( invRes ! = null ) {
return invRes ;
}
@ -699,6 +616,9 @@ public class IoCodeTempController extends BaseController {
codeEnttity . setSerialNo ( udiEntity . getSerialNo ( ) ) ;
codeEnttity . setDeptCode ( invWarehouseEntity . getParentId ( ) ) ;
codeEnttity . setInvCode ( addOrderRequest . getInvCode ( ) ) ;
codeEnttity . setWarehouseCode ( addOrderRequest . getCurSpaceCode ( ) ) ;
codeEnttity . setPreSpaceCode ( addOrderRequest . getPreCurSpaceCode ( ) ) ;
codeEnttity . setPreInSpaceCode ( addOrderRequest . getCheckPreInSpaceCode ( ) ) ;
codeEnttity . setCount ( 1 ) ;
String unitFk = null ;
if ( bussinessTypeEntity . getCorpType ( ) = = ConstantStatus . CORP_TYPE_OUT ) {
@ -799,11 +719,27 @@ public class IoCodeTempController extends BaseController {
// if (DateUtil.)
// }
if ( bussinessTypeEntity . isScanPreIn ( ) ) { //校验预验收库存
BaseResponse invRes = checkPreInInv ( bussinessTypeEntity , codeEnttity ) ;
if ( invRes ! = null ) {
deleteEmptyBillNo ( orderEntity ) ;
return invRes ;
}
} else if ( bussinessTypeEntity . isAdvancePreIn ( ) ) { //校验寄售库存
BaseResponse invRes = checkPreInv ( bussinessTypeEntity , codeEnttity ) ;
if ( invRes ! = null ) {
deleteEmptyBillNo ( orderEntity ) ;
return invRes ;
}
} else {
BaseResponse invRes = checkInv ( bussinessTypeEntity , codeEnttity ) ;
if ( invRes ! = null ) {
deleteEmptyBillNo ( orderEntity ) ;
return invRes ;
}
}
genDetaiEntity = codeEnttity ;
if ( baseResponse = = null ) {
baseResponse = checkSupId ( bussinessTypeEntity , codeEnttity , unitFk ) ;
@ -841,6 +777,119 @@ public class IoCodeTempController extends BaseController {
return ResultVOUtils . success ( addCodeResult ) ;
}
// 校验寄售库存
public BaseResponse checkPreInv ( BasicBussinessTypeEntity bussinessTypeEntity , IoCodeTempEntity codeTempEntity ) {
InvWarehouseEntity invWarehouseEntity = invWarehouseService . findByOne ( ConstantStatus . ACTION_TYPE_ADVANCE ) ;
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 ( ) ) ;
}
}
InvPreProductDetailEntity invPreinDetailEntity = invPreProductDetailService . 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 , "当前批次号与预验收录入批次号不匹配!" ) ;
}
if ( StrUtil . isNotEmpty ( codeTempEntity . getOrderId ( ) ) ) { //非首次添加
if ( StrUtil . isEmpty ( codeTempEntity . getSerialNo ( ) ) ) { //该单据已有该产品
//无序列号,则可能存在多个预验收入库单
IoCodeTempEntity tempEntity = codeTempService . findByUnique ( codeTempEntity . getOrderId ( ) , codeTempEntity . getCode ( ) ) ;
if ( tempEntity ! = null ) {
if ( count < ( tempEntity . getMyCount ( ) + 1 ) ) {
return ResultVOUtils . error ( 500 , "超出寄售库存数量" ) ;
}
}
} else {
if ( count < 1 ) {
return ResultVOUtils . error ( 500 , "寄售库存数量不足" ) ;
}
}
}
}
return null ;
}
// 校验预验收库存
public BaseResponse checkPreInInv ( BasicBussinessTypeEntity bussinessTypeEntity , IoCodeTempEntity codeTempEntity ) {
InvWarehouseEntity invWarehouseEntity = invWarehouseService . findByOne ( ConstantStatus . ACTION_TYPE_PREIN ) ;
int count = 0 ;
if ( bussinessTypeEntity . getSpaceOut ( ) = = ConstantStatus . SPACE_OUT_NULL ) {
count = invPreinProductDetailService . vailStockCount ( codeTempEntity . getRelId ( ) , codeTempEntity . getBatchNo ( ) , codeTempEntity . getSupId ( ) , null , invWarehouseEntity . getCode ( ) , null ) ;
} else if ( bussinessTypeEntity . getSpaceOut ( ) = = ConstantStatus . SPACE_OUT_SET ) {
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 , "添加失败,该产品未上架货位!" ) ;
}
} else {
count = invPreinProductDetailService . vailStockCount ( codeTempEntity . getRelId ( ) , codeTempEntity . getBatchNo ( ) , codeTempEntity . getSupId ( ) , null , codeTempEntity . getInvCode ( ) , codeTempEntity . getPreInSpaceCode ( ) ) ;
}
}
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 , "当前批次号与预验收录入批次号不匹配!" ) ;
}
if ( StrUtil . isNotEmpty ( codeTempEntity . getOrderId ( ) ) ) { //非首次添加
if ( StrUtil . isEmpty ( codeTempEntity . getSerialNo ( ) ) ) { //该单据已有该产品
//无序列号,则可能存在多个预验收入库单
IoCodeTempEntity tempEntity = codeTempService . findByUnique ( codeTempEntity . getOrderId ( ) , codeTempEntity . getCode ( ) ) ;
if ( tempEntity ! = null ) {
if ( count < ( tempEntity . getMyCount ( ) + 1 ) ) {
return ResultVOUtils . error ( 500 , "超出预验收存数量" ) ;
}
}
} else {
if ( count < 1 ) {
return ResultVOUtils . error ( 500 , "寄售预验收数量不足" ) ;
}
}
}
}
return null ;
}
//校验条码完整性
public BaseResponse checkOriginCode ( UdiEntity udiEntity ) {
//校验条码的完整性
@ -979,24 +1028,38 @@ public class IoCodeTempController extends BaseController {
public BaseResponse checkInv ( BasicBussinessTypeEntity bussinessTypeEntity , IoCodeTempEntity codeTempEntity ) {
if ( bussinessTypeEntity . isVailInv ( ) & & bussinessTypeEntity . getMainAction ( ) . equals ( ConstantType . TYPE_OUT ) ) {
if ( bussinessTypeEntity . getActionType ( ) = = ConstantStatus . ACTION_TYPE_ADVANCE ) {
// int count = invPreProductDetailService.vailStockCount(code); //todo 寄售
// if (count < 0) {
// return ResultVOUtils.error(500, "当前库存不足, 不允许0库存出库");
// }
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 ( ) ) ;
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 {
int count = invProductDetailService . vailStockCount ( codeTempEntity . getRelId ( ) , codeTempEntity . getBatchNo ( ) , codeTempEntity . getSupId ( ) , codeTempEntity . getDeptCode ( ) , codeTempEntity . getInvCode ( ) , null ) ;
return ResultVOUtils . error ( 500 , "添加失败,该产品未上架货位!" ) ;
}
} else {
count = invProductDetailService . vailStockCount ( codeTempEntity . getRelId ( ) , codeTempEntity . getBatchNo ( ) , codeTempEntity . getSupId ( ) , codeTempEntity . getDeptCode ( ) , codeTempEntity . getInvCode ( ) , codeTempEntity . getWarehouseCode ( ) ) ;
}
}
if ( count < = 0 ) {
return ResultVOUtils . error ( 500 , "当前库存不足, 不允许0库存出库" ) ;
return ResultVOUtils . error ( 500 , "当前库存不足 ") ;
} else {
//查询此单据已扫描的条码数量
if ( codeTempEntity . getMyReCount ( ) > count ) {
return ResultVOUtils . error ( 500 , "当前库存不足, 不允许0库存出库" ) ;
return ResultVOUtils . error ( 500 , "当前库存不足 ") ;
}
}
}
}
return null ;
}
@ -1156,10 +1219,25 @@ public class IoCodeTempController extends BaseController {
}
}
if ( codeTempEntity . getMyCount ( ) < = 0 ) {
return ResultVOUtils . error ( 500 , "数量 不能小 于0") ;
return ResultVOUtils . error ( 500 , "数量 需要大 于0") ;
}
IoCodeTempEntity tempEntity = codeTempService . selectById ( codeTempEntity . getId ( ) ) ;
codeTempEntity . setReCount ( codeTempEntity . getMyCount ( ) * udiCalCountUtil . getActCount ( codeTempEntity . getNameCode ( ) ) ) ;
int count = tempEntity . getCount ( ) - codeTempEntity . getCount ( ) ;
//更新扫码详情
IoOrderDetailCodeEntity orderDetailCodeEntity = ioOrderDetailCodeService . findByUnique ( codeTempEntity . getOrderId ( ) , codeTempEntity . getRelId ( ) , codeTempEntity . getBatchNo ( ) ) ;
if ( orderDetailCodeEntity ! = null ) {
//扫码数量-1
int orderCount = orderDetailCodeEntity . getCount ( ) ;
orderDetailCodeEntity . setCount ( orderCount - count ) ;
orderDetailCodeEntity . setReCount ( orderDetailCodeEntity . getCount ( ) * udiCalCountUtil . getActCount ( codeTempEntity . getNameCode ( ) ) ) ;
ioOrderDetailCodeService . update ( orderDetailCodeEntity ) ;
}
int b = codeTempService . updateById ( codeTempEntity ) ;
if ( b > 0 )
return ResultVOUtils . success ( "修改成功" ) ;
else return ResultVOUtils . error ( 500 , "修改失败!" ) ;