|
|
|
@ -916,14 +916,6 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
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, "无效条码!批次号超出最大范围");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//批次号校验
|
|
|
|
|
//判断此产品是否开启允许无批次号
|
|
|
|
@ -931,126 +923,10 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
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()) {
|
|
|
|
@ -1086,7 +962,6 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
|
|
|
|
|
if (resultTime > 0) {
|
|
|
|
|
long time = resultTime / (60 * 60 * 1000);
|
|
|
|
|
// long time = resultTime / (24 * 60 * 60 * 1000);
|
|
|
|
|
if (resultTime < recentTieme) {
|
|
|
|
|
return ResultVOUtils.error(505, "当前产品临近过期,距过期还剩" + time + "时,是否确定继续添加?");
|
|
|
|
|
}
|
|
|
|
@ -1111,53 +986,10 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//校验预验收是否已存在
|
|
|
|
|
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())) {
|
|
|
|
|
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 = "";
|
|
|
|
@ -1175,7 +1007,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
exitLocalEntity = isExitLocal(code, codeEnttitys);
|
|
|
|
|
if (exitLocalEntity != null) {
|
|
|
|
|
if (StrUtil.isEmpty(exitLocalEntity.getSupId()) || exitLocalEntity.getRelId() == null) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前UDI码已存在,且存在异常未处理!");
|
|
|
|
|
return ResultVOUtils.error(500, "当前药品追溯码已存在,且存在异常未处理!");
|
|
|
|
|
}
|
|
|
|
|
udiRelevanceResponses = udiRelevanceService.selectGroupByNameCode(exitLocalEntity.getNameCode(), null);
|
|
|
|
|
|
|
|
|
@ -1190,7 +1022,6 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
if (!StringUtils.isBlank(exitLocalEntity.getSerialNo())) {
|
|
|
|
|
return ResultVOUtils.error(500, "重复扫码!");
|
|
|
|
|
}
|
|
|
|
|
// IoCodeTempEntity codeTempEntity = isExitToatal(code, codeEnttitys);
|
|
|
|
|
//校验库存
|
|
|
|
|
BaseResponse invRes = null;
|
|
|
|
|
if (IntUtil.value(bussinessTypeEntity.getUseDyCount()) == 2) {
|
|
|
|
@ -1278,6 +1109,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
codeEnttity.setPreSpaceCode(addOrderRequest.getPreCurSpaceCode());
|
|
|
|
|
codeEnttity.setPreInSpaceCode(addOrderRequest.getCheckPreInSpaceCode());
|
|
|
|
|
codeEnttity.setRelId(addOrderRequest.getRelId());
|
|
|
|
|
codeEnttity.setProductType(2);
|
|
|
|
|
codeEnttity.setCount(1);
|
|
|
|
|
String unitFk = null;
|
|
|
|
|
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
|
|
|
|
@ -1350,6 +1182,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
orderEntity.setBusType(bussinessTypeEntity.getBusType());
|
|
|
|
|
orderEntity.setSickerAdNum(addOrderRequest.getSickerAdNum());
|
|
|
|
|
orderEntity.setWorkPlaceCode(addOrderRequest.getWorkPlaceCode());
|
|
|
|
|
orderEntity.setProductType(2);
|
|
|
|
|
orderService.insertOrder(orderEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1436,7 +1269,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
} else
|
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
} else if (bussinessTypeEntity.getCheckWebNew() == 2 && bussinessTypeEntity.isCheckEnable()) {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkNoPiCode(codeEnttity);
|
|
|
|
|
String errMsg = ioCheckInoutService.checkDrugNoPiCode(codeEnttity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
} else
|
|
|
|
|