|
|
@ -308,7 +308,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//前端扫码提交
|
|
|
|
//前端扫码提交(耗材器械)
|
|
|
|
@RepeatSubmit()
|
|
|
|
@RepeatSubmit()
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
@PostMapping("warehouse/inout/addOrderWeb")
|
|
|
|
@PostMapping("warehouse/inout/addOrderWeb")
|
|
|
@ -879,6 +879,579 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
return ResultVOUtils.success(addCodeResult);
|
|
|
|
return ResultVOUtils.success(addCodeResult);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//前端扫码提交(药品)
|
|
|
|
|
|
|
|
@RepeatSubmit()
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
|
|
|
@PostMapping("warehouse/inout/drug/addOrderWeb")
|
|
|
|
|
|
|
|
@CusRedissonAnnotation(cacheName = RedissonCacheKey.WEB_ADD_CODE, key = {"#addOrderRequest.corpOrderId", "#addOrderRequest.code"}, timeOutMsg = "系统正在处理,请勿重复扫码")
|
|
|
|
|
|
|
|
@Log(title = "单据管理", businessType = BusinessType.INSERT)
|
|
|
|
|
|
|
|
public BaseResponse addDrugOrderWeb(@RequestBody AddOrderRequest addOrderRequest, BindingResult bindingResult) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
AddCodeResult addCodeResult = new AddCodeResult();
|
|
|
|
|
|
|
|
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(addOrderRequest.getAction());
|
|
|
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByInvSubByCode(addOrderRequest.getInvCode());
|
|
|
|
|
|
|
|
String code = addOrderRequest.getCode();
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(code)) return ResultVOUtils.error(ResultEnum.DATA_ERROR);
|
|
|
|
|
|
|
|
if (code.endsWith("\u001D")) {
|
|
|
|
|
|
|
|
code = code.replace("\u001D", "");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
|
|
|
|
|
|
|
|
if (udiEntity == null)
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "无效条码!");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getBatchNo())) {
|
|
|
|
|
|
|
|
udiEntity.setBatchNo(addOrderRequest.getBatchNo());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getProduceDate())) {
|
|
|
|
|
|
|
|
udiEntity.setProduceDate(addOrderRequest.getProduceDate());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getExpireDate())) {
|
|
|
|
|
|
|
|
udiEntity.setExpireDate(addOrderRequest.getExpireDate());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getSerialNo())) {
|
|
|
|
|
|
|
|
udiEntity.setSerialNo(addOrderRequest.getSerialNo());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getSerialNo()) && udiEntity.getSerialNo().length() > 20) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "无效条码!序列号超出最大范围");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getBatchNo()) && udiEntity.getBatchNo().length() > 20) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "无效条码!批次号超出最大范围");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//批次号校验
|
|
|
|
|
|
|
|
//判断此产品是否开启允许无批次号
|
|
|
|
|
|
|
|
UdiProductEntity udiInfoEntity = udiProductService.findByNameCode(udiEntity.getUdi());
|
|
|
|
|
|
|
|
if (udiInfoEntity == null) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "耗材字典不存在此产品!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!IntUtil.value(udiInfoEntity.getAllowNoBatch())) {
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(udiEntity.getSerialNo()) && StrUtil.isEmpty(udiEntity.getBatchNo())) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "序列号与批次号不能同时为空!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//是否校验产品采购类型 :1:校验;2.无需校验
|
|
|
|
|
|
|
|
if (IntUtil.value(bussinessTypeEntity.getVailProductAttributes()) == 1) {
|
|
|
|
|
|
|
|
Integer purType = IntUtil.value(udiInfoEntity.getPurType()); //1:普通入账产品;2.预验收产品。3:寄售产品
|
|
|
|
|
|
|
|
int actionType = IntUtil.value(bussinessTypeEntity.getActionType()); //1:带票(正常);2.预验收。3:寄售
|
|
|
|
|
|
|
|
if (purType != actionType) {
|
|
|
|
|
|
|
|
//包装友好提示
|
|
|
|
|
|
|
|
String msg = "";
|
|
|
|
|
|
|
|
switch (actionType) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
msg = "普通入账产品";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
msg = "预验收产品";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
|
|
msg = "寄售产品";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String msg2 = "";
|
|
|
|
|
|
|
|
switch (purType) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
msg2 = "普通入账产品";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
msg2 = "预验收产品";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
|
|
msg2 = "寄售产品";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "单据只允许录入" + msg + ",当前录入产品为" + msg2 + ",请检查后重试!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (bussinessTypeEntity.getRequireScanCode() == 1) {
|
|
|
|
|
|
|
|
// if (udiInfoEntity.getRequireScanCode() != 1){
|
|
|
|
|
|
|
|
// return ResultVOUtils.error(500, "单据只允许录入需要扫码耗材" + ",请检查后重试!");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }else if (bussinessTypeEntity.getRequireScanCode() == 0){
|
|
|
|
|
|
|
|
// if (udiInfoEntity.getRequireScanCode() != 0){
|
|
|
|
|
|
|
|
// return ResultVOUtils.error(500, "单据只允许录入不需要扫码耗材" + ",请检查后重试!");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
if (bussinessTypeEntity != null && udiInfoEntity != null) {
|
|
|
|
|
|
|
|
//是否校验耗材材质 1:高值耗材;2.普通耗材
|
|
|
|
|
|
|
|
if (IntUtil.value(bussinessTypeEntity.getVailHcType()) == 1) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IntUtil.value(udiInfoEntity.getHcType()) != 1) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "单据只允许录入高值耗材" + ",请检查后重试!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (IntUtil.value(bussinessTypeEntity.getVailHcType()) == 2) {
|
|
|
|
|
|
|
|
if (IntUtil.value(udiInfoEntity.getHcType()) != 2) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "单据只允许录入普通耗材" + ",请检查后重试!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//是否开启校验扫码 :0:不校验;1:只允许录入扫码产品;2:只允许录入不扫码产品
|
|
|
|
|
|
|
|
if (IntUtil.value(bussinessTypeEntity.getCodeCheck() == 1)) {
|
|
|
|
|
|
|
|
if (IntUtil.value(udiInfoEntity.getRequireScanCode()) != 1) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "单据只允许录入需要扫码产品" + ",请检查后重试!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (IntUtil.value(bussinessTypeEntity.getCodeCheck() == 2)) {
|
|
|
|
|
|
|
|
if (IntUtil.value(udiInfoEntity.getRequireScanCode()) != 0) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "单据只允许录入不需要扫码产品" + ",请检查后重试!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String orderId = addOrderRequest.getBillNo();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//三期校验
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isCodeFillCheck()) {
|
|
|
|
|
|
|
|
BaseResponse checkOriginCodeRes = checkOriginCode(udiEntity);
|
|
|
|
|
|
|
|
if (checkOriginCodeRes != null) {
|
|
|
|
|
|
|
|
IoCodeLostEntity codeLostEntity = codeLostService.findByCode(code);
|
|
|
|
|
|
|
|
if (codeLostEntity == null) {
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(orderId)) {
|
|
|
|
|
|
|
|
List<IoCodeTempEntity> ioCodeEnttities = codeTempService.findByOrderId(orderId);
|
|
|
|
|
|
|
|
IoCodeTempEntity ioCodeEnttity = isExitLocal(code, ioCodeEnttities);
|
|
|
|
|
|
|
|
if (ioCodeEnttity == null) {
|
|
|
|
|
|
|
|
return checkOriginCodeRes;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
return checkOriginCodeRes;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
udiEntity.setBatchNo(codeLostEntity.getBatchNo());
|
|
|
|
|
|
|
|
udiEntity.setExpireDate(codeLostEntity.getExpireDate());
|
|
|
|
|
|
|
|
udiEntity.setProduceDate(codeLostEntity.getProduceDate());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(orderId)) {
|
|
|
|
|
|
|
|
List<IoCodeTempEntity> ioCodeEnttities = codeTempService.findByOrderId(orderId);
|
|
|
|
|
|
|
|
IoCodeTempEntity ioCodeEnttity = isExitLocal(code, ioCodeEnttities);
|
|
|
|
|
|
|
|
if (ioCodeEnttity == null) {
|
|
|
|
|
|
|
|
return checkOriginCodeRes;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
return checkOriginCodeRes;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
BaseResponse checkOriginCodeRes = checkOriginCode(udiEntity);
|
|
|
|
|
|
|
|
if (checkOriginCodeRes != null) {
|
|
|
|
|
|
|
|
IoCodeLostEntity codeLostEntity = codeLostService.findByCode(code);
|
|
|
|
|
|
|
|
if (codeLostEntity != null) {
|
|
|
|
|
|
|
|
udiEntity.setBatchNo(codeLostEntity.getBatchNo());
|
|
|
|
|
|
|
|
udiEntity.setExpireDate(codeLostEntity.getExpireDate());
|
|
|
|
|
|
|
|
udiEntity.setProduceDate(codeLostEntity.getProduceDate());
|
|
|
|
|
|
|
|
checkOriginCodeRes = checkOriginCode(udiEntity);
|
|
|
|
|
|
|
|
if (checkOriginCodeRes != null)
|
|
|
|
|
|
|
|
return checkOriginCodeRes;
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
return checkOriginCodeRes;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//过期提醒:
|
|
|
|
|
|
|
|
if (IntUtil.value(bussinessTypeEntity.getCheckExpire()) == 1 && !addOrderRequest.isIgnoreExpire()) {
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getExpireDate())) {
|
|
|
|
|
|
|
|
String expireDate = "20" + udiEntity.getExpireDate();
|
|
|
|
|
|
|
|
long expireTime = MsDateUtil.parseDateExpire(expireDate);
|
|
|
|
|
|
|
|
if (expireTime - System.currentTimeMillis() < 0) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(504, "当前产品已过期,是否确定继续添加?");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IntUtil.value(bussinessTypeEntity.getCheckExpire()) == 2) {
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getExpireDate())) {
|
|
|
|
|
|
|
|
String expireDate = "20" + udiEntity.getExpireDate();
|
|
|
|
|
|
|
|
long expireTime = MsDateUtil.parseDateExpire(expireDate);
|
|
|
|
|
|
|
|
if (expireTime - System.currentTimeMillis() < 0) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(604, "当前产品已过期,无法添加!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByNameCode(udiEntity.getUdi());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//近效期提醒
|
|
|
|
|
|
|
|
long recent = 0;
|
|
|
|
|
|
|
|
if (udiRelevanceResponse.getRecentDateTime() != null)
|
|
|
|
|
|
|
|
recent = udiRelevanceResponse.getRecentDateTime().longValue();
|
|
|
|
|
|
|
|
if (IntUtil.value(bussinessTypeEntity.getCheckVailDate()) == 1 && recent > 0 && !addOrderRequest.isIgnoreRecentExpire() && udiRelevanceResponse.getIsDateBy() == 2) {
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getExpireDate())) {
|
|
|
|
|
|
|
|
String expireDate = "20" + udiEntity.getExpireDate();
|
|
|
|
|
|
|
|
long expireTime = MsDateUtil.parseDateExpire(expireDate);
|
|
|
|
|
|
|
|
long recentTieme = Math.abs(recent * 24 * 60 * 60 * 1000);
|
|
|
|
|
|
|
|
long resultTime = expireTime - System.currentTimeMillis();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (resultTime > 0) {
|
|
|
|
|
|
|
|
long time = resultTime / (60 * 60 * 1000);
|
|
|
|
|
|
|
|
// long time = resultTime / (24 * 60 * 60 * 1000);
|
|
|
|
|
|
|
|
if (resultTime < recentTieme) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(505, "当前产品临近过期,距过期还剩" + time + "时,是否确定继续添加?");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (IntUtil.value(bussinessTypeEntity.getCheckVailDate()) == 1 && recent > 0 && !addOrderRequest.isIgnoreRecentExpire() && udiRelevanceResponse.getIsDateBy() == 1) {
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getExpireDate())) {
|
|
|
|
|
|
|
|
String expireDate = "20" + udiEntity.getExpireDate();
|
|
|
|
|
|
|
|
long expireTime = MsDateUtil.parseDateExpire(expireDate);
|
|
|
|
|
|
|
|
long recentTieme = Math.abs(recent * 24 * 60 * 60 * 1000);
|
|
|
|
|
|
|
|
long resultTime = expireTime - System.currentTimeMillis();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (resultTime > 0) {
|
|
|
|
|
|
|
|
long time = resultTime / (24 * 60 * 60 * 1000);
|
|
|
|
|
|
|
|
if (resultTime < recentTieme) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(505, "当前产品临近过期,距过期还剩" + time + "天,是否确定继续添加?");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//校验预验收是否已存在
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_PREIN && bussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getSerialNo())) {
|
|
|
|
|
|
|
|
int count = invPreinProductDetailService.findCountByCode(code);
|
|
|
|
|
|
|
|
if (count > 0) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "预验收库存已存在此UDI码,请检查后重试!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//校验预验收库存是否已存在
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isScanPreIn() && checkDiAttribute(bussinessTypeEntity, udiRelevanceResponse, 2)) {
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.getBackPreinType() == 1 && bussinessTypeEntity.isPreInBack()) {//按单出库&& bussinessTypeEntity.isPreInBack()
|
|
|
|
|
|
|
|
String orderIds = addOrderRequest.getCheckPreInOrders();
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(orderIds)) {
|
|
|
|
|
|
|
|
String[] orderIdArray = orderIds.split(",");
|
|
|
|
|
|
|
|
List<String> orderList = CollUtil.toList(orderIdArray);
|
|
|
|
|
|
|
|
int count = codeService.findByOrderIdsCount(orderList, code);
|
|
|
|
|
|
|
|
if (count <= 0) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "非预验收单产品或预验收库存数量不足!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(orderId)) {//非首次添加
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(udiEntity.getSerialNo())) {//该单据已有该产品
|
|
|
|
|
|
|
|
//无序列号,则可能存在多个预验收入库单
|
|
|
|
|
|
|
|
IoCodeTempEntity codeTempEntity = codeTempService.findByUnique(orderId, code);
|
|
|
|
|
|
|
|
if (codeTempEntity != null) {
|
|
|
|
|
|
|
|
if (count < (codeTempEntity.getMyCount() + 1)) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "超出预验收库存数量");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (count < 1) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "预验收库存数量不足");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "未选择预验收入库单,请先选择预验收入库单!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (addOrderRequest.getFromCorp() != null || StrUtil.isNotEmpty(addOrderRequest.getSickerAdNum())) {
|
|
|
|
|
|
|
|
String fromCorp = ioAddInoutService.updateCorp(bussinessTypeEntity, addOrderRequest.getFromCorp(), addOrderRequest.getSickerAdNum());
|
|
|
|
|
|
|
|
addOrderRequest.setFromCorp(fromCorp);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//先生成扫码单据
|
|
|
|
|
|
|
|
IoOrderEntity orderEntity = orderService.findByBillNo(orderId);
|
|
|
|
|
|
|
|
String inBatch = "";
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(orderId) || orderEntity == null) {
|
|
|
|
|
|
|
|
String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
|
|
|
|
|
|
|
|
orderId = orderNo;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inBatch = orderId.substring((Constant.SCAN_ORDER + StrUtil.trimToEmpty(bussinessTypeEntity.getPrefix())).length());
|
|
|
|
|
|
|
|
List<IoCodeTempEntity> codeEnttitys = codeTempService.findByOrderId(orderId);
|
|
|
|
|
|
|
|
IoCodeTempEntity exitLocalEntity = null;
|
|
|
|
|
|
|
|
IoCodeTempEntity genDetaiEntity = new IoCodeTempEntity();
|
|
|
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceResponses = null;
|
|
|
|
|
|
|
|
if (codeEnttitys.size() > 0) {
|
|
|
|
|
|
|
|
exitLocalEntity = isExitLocal(code, codeEnttitys);
|
|
|
|
|
|
|
|
if (exitLocalEntity != null) {
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(exitLocalEntity.getSupId()) || exitLocalEntity.getRelId() == null) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "当前UDI码已存在,且存在异常未处理!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
udiRelevanceResponses = udiRelevanceService.selectGroupByNameCode(exitLocalEntity.getNameCode(), null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(exitLocalEntity, genDetaiEntity);
|
|
|
|
|
|
|
|
genDetaiEntity.setCount(1);
|
|
|
|
|
|
|
|
genDetaiEntity.setReCount(udiCalCountUtil.getActCount(udiRelevanceResponses.get(0)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exitLocalEntity.setCount(exitLocalEntity.getMyCount() + 1);
|
|
|
|
|
|
|
|
exitLocalEntity.setReCount(exitLocalEntity.getMyCount() * udiCalCountUtil.getActCount(udiRelevanceResponses.get(0)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isBlank(exitLocalEntity.getSerialNo())) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "重复扫码!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// IoCodeTempEntity codeTempEntity = isExitToatal(code, codeEnttitys);
|
|
|
|
|
|
|
|
//校验库存
|
|
|
|
|
|
|
|
BaseResponse invRes = null;
|
|
|
|
|
|
|
|
if (IntUtil.value(bussinessTypeEntity.getUseDyCount()) == 2) {
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isScanPreIn() && checkDiAttribute(bussinessTypeEntity, udiRelevanceResponse, 2)) { //校验预验收库存
|
|
|
|
|
|
|
|
invRes = checkInvService.checkPreInInv(bussinessTypeEntity, genDetaiEntity, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isAdvancePreIn() && checkDiAttribute(bussinessTypeEntity, udiRelevanceResponse, 3)) { //校验寄售库存
|
|
|
|
|
|
|
|
invRes = checkInvService.checkPreInv(bussinessTypeEntity, genDetaiEntity, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isVailInv() && checkDiAttribute(bussinessTypeEntity, udiRelevanceResponse, 1)) {
|
|
|
|
|
|
|
|
invRes = checkInvService.checkInv(bussinessTypeEntity, genDetaiEntity, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isScanPreIn()) { //校验预验收库存
|
|
|
|
|
|
|
|
invRes = checkInvService.checkPreInInv(bussinessTypeEntity, genDetaiEntity, false);
|
|
|
|
|
|
|
|
} else if (bussinessTypeEntity.isAdvancePreIn()) { //校验寄售库存
|
|
|
|
|
|
|
|
invRes = checkInvService.checkPreInv(bussinessTypeEntity, genDetaiEntity, false);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
invRes = checkInvService.checkInv(bussinessTypeEntity, genDetaiEntity, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
|
|
|
return invRes;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.getCheckWebNew() == 1 && bussinessTypeEntity.isCheckEnable()) {
|
|
|
|
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(genDetaiEntity);
|
|
|
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
codeTempService.updateById(exitLocalEntity);
|
|
|
|
|
|
|
|
} else if (bussinessTypeEntity.getCheckWebNew() == 2 && bussinessTypeEntity.isCheckEnable()) {
|
|
|
|
|
|
|
|
String errMsg = ioCheckInoutService.checkNoPiCode(genDetaiEntity);
|
|
|
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
codeTempService.updateById(exitLocalEntity);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
boolean update = true;
|
|
|
|
|
|
|
|
String priceFifo = systemParamConfigService.selectValueByParamKey("price_fifo");
|
|
|
|
|
|
|
|
if (IntUtil.value(priceFifo) > 0) {
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
|
|
|
//1.获取当前批次已出库数量
|
|
|
|
|
|
|
|
Integer outCount = invProductDetailService.selectCountByInBatch(exitLocalEntity.getRelId() + "", exitLocalEntity.getBatchNo(), bussinessTypeEntity, exitLocalEntity.getInBatchNo(), exitLocalEntity.getInvCode(), ConstantType.TYPE_OUT);
|
|
|
|
|
|
|
|
//2.获取当前批次入库数量
|
|
|
|
|
|
|
|
Integer inCount = invProductDetailService.selectCountByInBatch(exitLocalEntity.getRelId() + "", exitLocalEntity.getBatchNo(), bussinessTypeEntity, exitLocalEntity.getInBatchNo(), exitLocalEntity.getInvCode(), ConstantType.TYPE_PUT);
|
|
|
|
|
|
|
|
if ((IntUtil.value(inCount) - IntUtil.value(outCount) - IntUtil.value(exitLocalEntity.getReCount())) < 0) {
|
|
|
|
|
|
|
|
InvProductDetailEntity nextInvProduct = invProductDetailService.selectNextInBatch(bussinessTypeEntity, exitLocalEntity.getRelId() + "", exitLocalEntity.getBatchNo(), exitLocalEntity.getInvCode(), ConstantType.TYPE_PUT, exitLocalEntity.getInBatchNo());
|
|
|
|
|
|
|
|
if (nextInvProduct != null) {
|
|
|
|
|
|
|
|
genDetaiEntity.setPrice(nextInvProduct.getPrice());
|
|
|
|
|
|
|
|
genDetaiEntity.setInBatchNo(nextInvProduct.getInBatchNo());
|
|
|
|
|
|
|
|
codeTempService.insert(genDetaiEntity);
|
|
|
|
|
|
|
|
update = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// checkPrice();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (update) {
|
|
|
|
|
|
|
|
codeTempService.updateById(exitLocalEntity);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (exitLocalEntity == null) {
|
|
|
|
|
|
|
|
IoCodeTempEntity codeEnttity = new IoCodeTempEntity();
|
|
|
|
|
|
|
|
codeEnttity.setCode(code);
|
|
|
|
|
|
|
|
codeEnttity.setOrderId(orderId);
|
|
|
|
|
|
|
|
codeEnttity.setCorpOrderId(addOrderRequest.getCorpOrderId());
|
|
|
|
|
|
|
|
codeEnttity.setCreateTime(new Date());
|
|
|
|
|
|
|
|
codeEnttity.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
codeEnttity.setMainAction(bussinessTypeEntity.getMainAction());
|
|
|
|
|
|
|
|
codeEnttity.setAction(bussinessTypeEntity.getAction());
|
|
|
|
|
|
|
|
codeEnttity.setNameCode(udiEntity.getUdi());
|
|
|
|
|
|
|
|
codeEnttity.setBatchNo(udiEntity.getBatchNo());
|
|
|
|
|
|
|
|
codeEnttity.setProduceDate(udiEntity.getProduceDate());
|
|
|
|
|
|
|
|
codeEnttity.setExpireDate(udiEntity.getExpireDate());
|
|
|
|
|
|
|
|
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.setRelId(addOrderRequest.getRelId());
|
|
|
|
|
|
|
|
codeEnttity.setCount(1);
|
|
|
|
|
|
|
|
String unitFk = null;
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
|
|
|
|
|
|
|
|
unitFk = addOrderRequest.getFromCorp();
|
|
|
|
|
|
|
|
} else if (StrUtil.isNotEmpty(addOrderRequest.getSelectSupId())) {
|
|
|
|
|
|
|
|
unitFk = addOrderRequest.getSelectSupId();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//产品是否禁用
|
|
|
|
|
|
|
|
udiRelevanceResponses = udiRelevanceService.selectGroupByNameCode(codeEnttity.getNameCode(), false);
|
|
|
|
|
|
|
|
if (udiRelevanceResponses.size() >= 1) {
|
|
|
|
|
|
|
|
if (udiRelevanceResponse == null) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "该产品信息未维护!");
|
|
|
|
|
|
|
|
} else if (!udiRelevanceResponse.getUseDy() && udiRelevanceResponse.getDiType() == ConstantStatus.DITYPE_SYDY) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "该产品不允许以使用单元入库!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isVailDispatch() && !udiRelevanceResponse.isDispatch()) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "该产品不可配送,请联系院方!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.getVailGroupBuy() == 1 && !udiRelevanceResponse.isGroupBuy()) { //只采集集采产品
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, bussinessTypeEntity.getName() + "单只允许录入集采产品!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.getVailGroupBuy() == 2 && udiRelevanceResponse.isGroupBuy()) { //只采集非集采产品
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, bussinessTypeEntity.getName() + "单只允许录入非集采产品!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//计算实际数量
|
|
|
|
|
|
|
|
codeEnttity.setReCount(codeEnttity.getMyCount() * udiCalCountUtil.getActCount(udiRelevanceResponse));
|
|
|
|
|
|
|
|
} else if (udiRelevanceResponses.size() == 0) {
|
|
|
|
|
|
|
|
if (unitFk == null)
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "耗材字典不存在此产品!");
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "当前供应商不存在此配送产品!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//校验供应商是否配送此产品
|
|
|
|
|
|
|
|
BaseResponse corpResponse = checkCorp(codeEnttity, bussinessTypeEntity, unitFk);
|
|
|
|
|
|
|
|
if (corpResponse != null) {
|
|
|
|
|
|
|
|
return corpResponse;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IoOrderEntity isExit = orderService.findByBillNo(orderId);
|
|
|
|
|
|
|
|
if (isExit == null) {
|
|
|
|
|
|
|
|
orderEntity = new IoOrderEntity();
|
|
|
|
|
|
|
|
orderEntity.setBillNo(orderId);
|
|
|
|
|
|
|
|
orderEntity.setCorpOrderId(addOrderRequest.getCorpOrderId());
|
|
|
|
|
|
|
|
orderEntity.setMainAction(bussinessTypeEntity.getMainAction());
|
|
|
|
|
|
|
|
orderEntity.setAction(bussinessTypeEntity.getAction());
|
|
|
|
|
|
|
|
orderEntity.setFromCorp(addOrderRequest.getFromCorp());
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getFromInvCode())) {
|
|
|
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity1 = invWarehouseService.findByInvSubByCode(addOrderRequest.getFromInvCode());
|
|
|
|
|
|
|
|
orderEntity.setFromDeptCode(invWarehouseEntity1.getParentId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
orderEntity.setFromInvCode(addOrderRequest.getFromInvCode());
|
|
|
|
|
|
|
|
orderEntity.setFromType(ConstantStatus.FROM_WEBNEW);
|
|
|
|
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
|
|
|
|
|
|
|
|
orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);
|
|
|
|
|
|
|
|
AuthAdmin authAdmin = getUser();
|
|
|
|
|
|
|
|
orderEntity.setCreateUser(authAdmin.getId() + "");
|
|
|
|
|
|
|
|
orderEntity.setCreateTime(new Date());
|
|
|
|
|
|
|
|
orderEntity.setUpdateUser(authAdmin.getId() + "");
|
|
|
|
|
|
|
|
orderEntity.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
orderEntity.setCustomerId(authAdmin.getCustomerId() + "");
|
|
|
|
|
|
|
|
orderEntity.setDeptCode(invWarehouseEntity.getParentId());
|
|
|
|
|
|
|
|
orderEntity.setCheckPreInOrders(addOrderRequest.getCheckPreInOrders());
|
|
|
|
|
|
|
|
orderEntity.setInvCode(addOrderRequest.getInvCode());
|
|
|
|
|
|
|
|
orderEntity.setOrderType(addOrderRequest.getOrderType());
|
|
|
|
|
|
|
|
orderEntity.setBusType(bussinessTypeEntity.getBusType());
|
|
|
|
|
|
|
|
orderEntity.setSickerAdNum(addOrderRequest.getSickerAdNum());
|
|
|
|
|
|
|
|
orderEntity.setWorkPlaceCode(addOrderRequest.getWorkPlaceCode());
|
|
|
|
|
|
|
|
orderService.insertOrder(orderEntity);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (IntUtil.value(addOrderRequest.getOrderType()) == ConstantStatus.ORDER_TYPE_NORMAL && bussinessTypeEntity.isCheckEnable() && bussinessTypeEntity.getCheckWebNew() != 0) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean isBillExit = orderDetailBizService.isExit(orderEntity.getBillNo());
|
|
|
|
|
|
|
|
if (!isBillExit) {
|
|
|
|
|
|
|
|
orderService.deleteByBillNo(orderEntity.getBillNo());
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "请先录入业务详情");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BaseResponse baseResponse = checkRelId(codeEnttity, unitFk);
|
|
|
|
|
|
|
|
if (baseResponse != null) {
|
|
|
|
|
|
|
|
deleteEmptyBillNo(orderEntity);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
genDetaiEntity = codeEnttity;
|
|
|
|
|
|
|
|
if (baseResponse == null) {
|
|
|
|
|
|
|
|
baseResponse = checkSupId(bussinessTypeEntity, codeEnttity, unitFk);
|
|
|
|
|
|
|
|
if (baseResponse != null)
|
|
|
|
|
|
|
|
return baseResponse;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (baseResponse.getCode() == 501) {
|
|
|
|
|
|
|
|
return baseResponse;
|
|
|
|
|
|
|
|
} else if (baseResponse.getCode() == 502) {
|
|
|
|
|
|
|
|
return baseResponse;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
checkSupId(bussinessTypeEntity, codeEnttity, unitFk);
|
|
|
|
|
|
|
|
return baseResponse;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (IntUtil.value(bussinessTypeEntity.getUseDyCount()) == 2) {
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isScanPreIn() && checkDiAttribute(bussinessTypeEntity, udiRelevanceResponse.getId(), 2)) { //校验预验收库存
|
|
|
|
|
|
|
|
BaseResponse invRes = checkInvService.checkPreInInv(bussinessTypeEntity, codeEnttity, false);
|
|
|
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
|
|
|
deleteEmptyBillNo(orderEntity);
|
|
|
|
|
|
|
|
return invRes;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isAdvancePreIn() && checkDiAttribute(bussinessTypeEntity, udiRelevanceResponse.getId(), 3)) { //校验寄售库存
|
|
|
|
|
|
|
|
BaseResponse invRes = checkInvService.checkPreInv(bussinessTypeEntity, codeEnttity, false);
|
|
|
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
|
|
|
deleteEmptyBillNo(orderEntity);
|
|
|
|
|
|
|
|
return invRes;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isVailInv() && checkDiAttribute(bussinessTypeEntity, udiRelevanceResponse.getId(), 1)) {
|
|
|
|
|
|
|
|
BaseResponse invRes = checkInvService.checkInv(bussinessTypeEntity, codeEnttity, false);
|
|
|
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
|
|
|
deleteEmptyBillNo(orderEntity);
|
|
|
|
|
|
|
|
return invRes;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isScanPreIn()) { //校验预验收库存
|
|
|
|
|
|
|
|
BaseResponse invRes = checkInvService.checkPreInInv(bussinessTypeEntity, codeEnttity, false);
|
|
|
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
|
|
|
deleteEmptyBillNo(orderEntity);
|
|
|
|
|
|
|
|
return invRes;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (bussinessTypeEntity.isAdvancePreIn()) { //校验寄售库存
|
|
|
|
|
|
|
|
BaseResponse invRes = checkInvService.checkPreInv(bussinessTypeEntity, codeEnttity, false);
|
|
|
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
|
|
|
deleteEmptyBillNo(orderEntity);
|
|
|
|
|
|
|
|
return invRes;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
BaseResponse invRes = checkInvService.checkInv(bussinessTypeEntity, codeEnttity, false);
|
|
|
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
|
|
|
deleteEmptyBillNo(orderEntity);
|
|
|
|
|
|
|
|
return invRes;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//是否边扫边校验
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.getCheckWebNew() == 1 && bussinessTypeEntity.isCheckEnable()) {
|
|
|
|
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(codeEnttity);
|
|
|
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
|
|
|
} else if (bussinessTypeEntity.getCheckWebNew() == 2 && bussinessTypeEntity.isCheckEnable()) {
|
|
|
|
|
|
|
|
String errMsg = ioCheckInoutService.checkNoPiCode(codeEnttity);
|
|
|
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
checkPrice(codeEnttity, bussinessTypeEntity, inBatch, codeEnttitys);
|
|
|
|
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
addCodeResult.setOrderId(orderId);
|
|
|
|
|
|
|
|
transInoutService.genOrderDetailCode(orderEntity, genDetaiEntity);
|
|
|
|
|
|
|
|
return ResultVOUtils.success(addCodeResult);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void checkPrice(IoCodeTempEntity codeTempEntity, BasicBussinessTypeEntity bussinessTypeEntity, String inBatch, List<IoCodeTempEntity> codeTempEntities) {
|
|
|
|
public void checkPrice(IoCodeTempEntity codeTempEntity, BasicBussinessTypeEntity bussinessTypeEntity, String inBatch, List<IoCodeTempEntity> codeTempEntities) {
|
|
|
|
String priceFifo = systemParamConfigService.selectValueByParamKey("price_fifo");
|
|
|
|
String priceFifo = systemParamConfigService.selectValueByParamKey("price_fifo");
|
|
|
|
if (IntUtil.value(priceFifo) > 0) {
|
|
|
|
if (IntUtil.value(priceFifo) > 0) {
|
|
|
|