|
|
|
@ -16,6 +16,8 @@ import com.glxp.api.entity.basic.BasicCorpEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiProductEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.*;
|
|
|
|
|
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.http.SpsDirectClient;
|
|
|
|
|
import com.glxp.api.req.basic.CompanyProductRelevanceRequest;
|
|
|
|
@ -30,6 +32,8 @@ import com.glxp.api.res.inout.AddCodeResult;
|
|
|
|
|
import com.glxp.api.service.auth.InvWarehouseService;
|
|
|
|
|
import com.glxp.api.service.basic.*;
|
|
|
|
|
import com.glxp.api.service.inout.*;
|
|
|
|
|
import com.glxp.api.service.inv.InvPreinDetailService;
|
|
|
|
|
import com.glxp.api.service.inv.InvProductDetailService;
|
|
|
|
|
import com.glxp.api.service.system.SystemParamConfigService;
|
|
|
|
|
import com.glxp.api.util.CustomUtil;
|
|
|
|
|
import com.glxp.api.util.DateUtil;
|
|
|
|
@ -80,6 +84,10 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
InvWarehouseService invWarehouseService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoCheckInoutService ioCheckInoutService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvPreinDetailService invPreinDetailService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvProductDetailService invProductDetailService;
|
|
|
|
|
|
|
|
|
|
//手持端扫码单据上传调用接口
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
@ -414,70 +422,46 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//校验预验收是否已存在 todo
|
|
|
|
|
//校验预验收是否已存在
|
|
|
|
|
if (bussinessTypeEntity.isPreIn()) {
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getSerialNo())) {
|
|
|
|
|
// List<InvProductDetailEntity> invProductDetailEntities = invPreInProductDetailService.findByOriginCode(code);
|
|
|
|
|
// if (CollUtil.isNotEmpty(invProductDetailEntities)) {
|
|
|
|
|
// return ResultVOUtils.error(500, "条码已存在!");
|
|
|
|
|
// }
|
|
|
|
|
List<InvPreinDetailEntity> invProductDetailEntities = invPreinDetailService.findByCode(code);
|
|
|
|
|
if (CollUtil.isNotEmpty(invProductDetailEntities)) {
|
|
|
|
|
return ResultVOUtils.error(500, "预验收库存已存在此UDI码,请检查后重试!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//校验预验收库存是否已存在
|
|
|
|
|
if (addOrderRequest.isPreCheck()) {
|
|
|
|
|
// InvProductDetailEntity invProductDetailEntity = invPreInProductDetailService.statInvPreInDetail(code);
|
|
|
|
|
// if (invProductDetailEntity == null) {
|
|
|
|
|
// return ResultVOUtils.error(500, "预验收库存未存在此产品!");
|
|
|
|
|
// } else {
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// if (StrUtil.isNotEmpty(invProductDetailEntity.getBatchNo()) && StrUtil.isNotEmpty(addOrderRequest.getBatchNo())
|
|
|
|
|
// && !invProductDetailEntity.getBatchNo().equals(addOrderRequest.getBatchNo())) {
|
|
|
|
|
// return ResultVOUtils.error(500, "当前批次号与预验收录入批次号不匹配!");
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// if (StrUtil.isNotEmpty(orderId)) {//非首次添加
|
|
|
|
|
// if (StrUtil.isEmpty(udiEntity.getSerialNo())) {//该单据已有该产品
|
|
|
|
|
// WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
|
|
|
|
|
// warehouseQueryRequest.setOrderId(orderId);
|
|
|
|
|
// warehouseQueryRequest.setCode(code);
|
|
|
|
|
// List<WarehouseEntity> codeEnttitys = codesTempService.findByOrderIdAndCode(warehouseQueryRequest);
|
|
|
|
|
// if (CollUtil.isNotEmpty(codeEnttitys)) {
|
|
|
|
|
// WarehouseEntity codeEnttity = codeEnttitys.get(0);
|
|
|
|
|
// if (invProductDetailEntity.getCount() < (codeEnttity.getCount() + 1)) {
|
|
|
|
|
// return ResultVOUtils.error(500, "超出预验收库存数量");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// if (invProductDetailEntity.getCount() < 1) {
|
|
|
|
|
// return ResultVOUtils.error(500, "超出预验收库存数量");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
} else //校验库存是否存在
|
|
|
|
|
if (addOrderRequest.isVailInv()) {
|
|
|
|
|
// if (bussinessTypeEntity.isAdvanceType()) {
|
|
|
|
|
// int count = invPreProductDetailService.vailStockCount(code);
|
|
|
|
|
// if (count < 0) {
|
|
|
|
|
// return ResultVOUtils.error(500, "当前库存不足,不允许0库存出库");
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// int count = invProductDetailService.vailStockCount(code, addOrderRequest.getLocStorageCode(), addOrderRequest.getInvWarehouseCode(), null);
|
|
|
|
|
// if (count <= 0) {
|
|
|
|
|
// return ResultVOUtils.error(500, "当前库存不足,不允许0库存出库");
|
|
|
|
|
// } else if (StrUtil.isNotBlank(addOrderRequest.getOrderId())) {
|
|
|
|
|
// //查询此单据已扫描的条码数量
|
|
|
|
|
// WarehouseEntity warehouse = codesTempService.findByUnique(addOrderRequest.getOrderId(), addOrderRequest.getCode());
|
|
|
|
|
// if (null != warehouse && warehouse.getCount() >= count) {
|
|
|
|
|
// return ResultVOUtils.error(500, "当前库存不足,不允许0库存出库");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
InvPreinDetailEntity invProductDetailEntity = invPreinDetailService.findOneByCode(code);
|
|
|
|
|
if (invProductDetailEntity == null) {
|
|
|
|
|
return ResultVOUtils.error(500, "预验收库存未存在此产品!");
|
|
|
|
|
} else {
|
|
|
|
|
if (StrUtil.isNotEmpty(invProductDetailEntity.getBatchNo()) && StrUtil.isNotEmpty(addOrderRequest.getBatchNo())
|
|
|
|
|
&& !invProductDetailEntity.getBatchNo().equals(addOrderRequest.getBatchNo())) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前批次号与预验收录入批次号不匹配!");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotEmpty(orderId)) {//非首次添加
|
|
|
|
|
if (StrUtil.isEmpty(udiEntity.getSerialNo())) {//该单据已有该产品
|
|
|
|
|
IoCodeTempEntity codeTempEntity = codeTempService.findByUnique(orderId, code);
|
|
|
|
|
if (codeTempEntity != null) {
|
|
|
|
|
if (invProductDetailEntity.getCount() < (codeTempEntity.getCount() + 1)) {
|
|
|
|
|
return ResultVOUtils.error(500, "超出预验收库存数量");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (invProductDetailEntity.getCount() < 1) {
|
|
|
|
|
return ResultVOUtils.error(500, "超出预验收库存数量");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//校验库存是否存在
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (addOrderRequest.getFromCorp() == null) {
|
|
|
|
@ -515,6 +499,12 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
|
|
|
|
|
exitLocalEntity.setCount(exitLocalEntity.getCount() + 1);
|
|
|
|
|
exitLocalEntity.setReCount(exitLocalEntity.getCount() * udiCalCountUtil.getActCount(udiRelevanceResponses.get(0)));
|
|
|
|
|
|
|
|
|
|
BaseResponse invRes = checkInv(bussinessTypeEntity, exitLocalEntity);
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
return invRes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(exitLocalEntity.getSerialNo())) {
|
|
|
|
|
if (bussinessTypeEntity.isCheckEnable() && bussinessTypeEntity.isCheckWebNew()) {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(exitLocalEntity);
|
|
|
|
@ -602,6 +592,12 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BaseResponse baseResponse = checkRelId(codeEnttity, unitFk);
|
|
|
|
|
|
|
|
|
|
BaseResponse invRes = checkInv(bussinessTypeEntity, exitLocalEntity);
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
return invRes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isCheckEnable() && bussinessTypeEntity.isCheckWebNew()) {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(codeEnttity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
@ -659,15 +655,20 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
|
|
|
|
|
//校验供应商是否配送此产品
|
|
|
|
|
public BaseResponse checkCorp(IoCodeTempEntity codeEnttity, BasicBussinessTypeEntity bussinessTypeEntity, String unitFk) {
|
|
|
|
|
CompanyProductRelevanceRequest companyProductRelevanceRequest = new CompanyProductRelevanceRequest();
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(codeEnttity.getCode());
|
|
|
|
|
companyProductRelevanceRequest.setNameCode(udiEntity.getUdi());
|
|
|
|
|
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
|
|
|
|
|
CompanyProductRelevanceRequest companyProductRelevanceRequest = new CompanyProductRelevanceRequest();
|
|
|
|
|
companyProductRelevanceRequest.setUnitFk(unitFk);
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(codeEnttity.getCode());
|
|
|
|
|
companyProductRelevanceRequest.setNameCode(udiEntity.getUdi());
|
|
|
|
|
List<UdiRlSupResponse> datas = udiRlSupService.filterUdiGp(companyProductRelevanceRequest);
|
|
|
|
|
if (datas.size() <= 0) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前供应商不存在此配送产品!");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
List<UdiRlSupResponse> datas = udiRlSupService.filterUdiGp(companyProductRelevanceRequest);
|
|
|
|
|
if (datas.size() <= 0) {
|
|
|
|
|
return ResultVOUtils.error(500, "此产品无指定供应商,请检查后添加!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
@ -762,6 +763,29 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BaseResponse checkInv(BasicBussinessTypeEntity bussinessTypeEntity, IoCodeTempEntity codeTempEntity) {
|
|
|
|
|
if (bussinessTypeEntity.isVailInv()) {
|
|
|
|
|
if (bussinessTypeEntity.isAdvanceType()) {
|
|
|
|
|
// int count = invPreProductDetailService.vailStockCount(code); //todo 寄售
|
|
|
|
|
// if (count < 0) {
|
|
|
|
|
// return ResultVOUtils.error(500, "当前库存不足,不允许0库存出库");
|
|
|
|
|
// }
|
|
|
|
|
} else {
|
|
|
|
|
int count = invProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), null);
|
|
|
|
|
if (count <= 0) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前库存不足,不允许0库存出库");
|
|
|
|
|
} else {
|
|
|
|
|
//查询此单据已扫描的条码数量
|
|
|
|
|
if (codeTempEntity.getReCount() >= count) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前库存不足,不允许0库存出库");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("admin/warehouse/inout/findErrorByOrderId")
|
|
|
|
|