|
|
|
@ -341,7 +341,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("warehouse/inout/addOrderWeb")
|
|
|
|
|
@CusRedissonAnnotation(cacheName = RedissonCacheKey.WEB_ADD_CODE, key = {"#addOrderRequest.corpOrderId", "#addOrderRequest.code"}, timeOutMsg = "系统正在处理,请勿重复扫码")
|
|
|
|
|
@Log(title = "单据管理", businessType = BusinessType.INSERT)
|
|
|
|
|
@Log(title = "单据器械扫码", businessType = BusinessType.INSERT)
|
|
|
|
|
public BaseResponse addOrderWeb(@RequestBody AddOrderRequest addOrderRequest, BindingResult bindingResult) {
|
|
|
|
|
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
@ -895,6 +895,330 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
return ResultVOUtils.success(addCodeResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//前端扫码提交(药品)
|
|
|
|
|
@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());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//批次号校验
|
|
|
|
|
//判断此产品是否开启允许无批次号
|
|
|
|
|
UdiProductEntity udiInfoEntity = udiProductService.findByNameCode(udiEntity.getUdi());
|
|
|
|
|
if (udiInfoEntity == null) {
|
|
|
|
|
return ResultVOUtils.error(500, "耗材字典不存在此产品!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String orderId = addOrderRequest.getBillNo();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//过期提醒:
|
|
|
|
|
if (IntUtil.value(bussinessTypeEntity.getCheckExpire()) == 1 && !addOrderRequest.isIgnoreExpire()) {
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getExpireDate())) {
|
|
|
|
|
String expireDate = "20" + udiEntity.getExpireDate();
|
|
|
|
|
long expireTime = DateUtil.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 = DateUtil.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()) {
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getExpireDate())) {
|
|
|
|
|
String expireDate = "20" + udiEntity.getExpireDate();
|
|
|
|
|
long expireTime = DateUtil.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 (IntUtil.value(bussinessTypeEntity.getCheckVailDate()) == 2 && recent > 0) {
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getExpireDate())) {
|
|
|
|
|
String expireDate = "20" + udiEntity.getExpireDate();
|
|
|
|
|
long expireTime = DateUtil.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(605, "当前产品临近过期,距过期还剩" + time + "天,无法添加!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//先生成扫码单据
|
|
|
|
|
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, "当前追溯码已存在,且存在异常未处理!");
|
|
|
|
|
}
|
|
|
|
|
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.isNotBlank(exitLocalEntity.getSerialNo())) {
|
|
|
|
|
return ResultVOUtils.error(500, "重复扫码!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BaseResponse invRes = checkInv(bussinessTypeEntity, exitLocalEntity);
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
return invRes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (addOrderRequest.getOrderType() == ConstantStatus.ORDER_TYPE_NORMAL && bussinessTypeEntity.isCheckEnable()) {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(genDetaiEntity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
} else
|
|
|
|
|
codeTempService.updateById(exitLocalEntity);
|
|
|
|
|
} else if (addOrderRequest.getOrderType() == ConstantStatus.ORDER_TYPE_WAIT && bussinessTypeEntity.isCheckEnable()) {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkNoPiCode(genDetaiEntity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
} else
|
|
|
|
|
codeTempService.updateById(exitLocalEntity);
|
|
|
|
|
} else {
|
|
|
|
|
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.setCount(1);
|
|
|
|
|
codeEnttity.setProductType(2);
|
|
|
|
|
String unitFk = null;
|
|
|
|
|
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
|
|
|
|
|
unitFk = addOrderRequest.getFromCorp();
|
|
|
|
|
}
|
|
|
|
|
//产品是否可以以使用单元入库
|
|
|
|
|
udiRelevanceResponses = udiRelevanceService.selectGroupByNameCode(codeEnttity.getNameCode(), false);
|
|
|
|
|
if (udiRelevanceResponses.size() >= 1) {
|
|
|
|
|
// UdiRelevanceResponse udiRelevanceResponse = udiRelevanceResponses.get(0);
|
|
|
|
|
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 && !IntUtil.value(udiRelevanceResponse.getGroupBuy())) { //只采集集采产品
|
|
|
|
|
return ResultVOUtils.error(500, bussinessTypeEntity.getName() + "只允许录入集采产品!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.getVailGroupBuy() == 2 && IntUtil.value(udiRelevanceResponse.getGroupBuy())) { //只采集非集采产品
|
|
|
|
|
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.setProductType(2);
|
|
|
|
|
orderService.insertOrder(orderEntity);
|
|
|
|
|
}
|
|
|
|
|
if (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);
|
|
|
|
|
BaseResponse invRes = checkInv(bussinessTypeEntity, codeEnttity);
|
|
|
|
|
if (invRes != null) {
|
|
|
|
|
return invRes;
|
|
|
|
|
}
|
|
|
|
|
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.getCheckCertExpire()) == 2 && udiRelevanceResponse.isNeedCert()) {
|
|
|
|
|
SupProductEntity supProductEntity = supProductService.findExitByManufactury(udiRelevanceResponse.getCpmctymc(), udiRelevanceResponse.getManufactory(), unitFk);
|
|
|
|
|
if (supProductEntity != null && (supProductEntity.getAuditStatus() == ConstantStatus.AUDIT_PASS || supProductEntity.getAuditStatus() == ConstantStatus.AUDIT_CHANGE_PASS)) {
|
|
|
|
|
List<SupCertEntity> supCertEntities = supCertService.findByProductId(supProductEntity.getProductId());
|
|
|
|
|
if (CollUtil.isNotEmpty(supCertEntities)) {
|
|
|
|
|
Date curDate = new Date();
|
|
|
|
|
for (SupCertEntity supCertEntity : supCertEntities) {
|
|
|
|
|
if (supCertEntity.getExpireDate() != null && supCertEntity.getExpireDate().compareTo(curDate) < 0) {
|
|
|
|
|
return ResultVOUtils.error(500, "产品资质证书已过期!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (supProductEntity == null) {
|
|
|
|
|
return ResultVOUtils.error(500, "产品资质证书未维护!");
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(500, "产品资质证书未通过审核!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
codeEnttity.setPrice(udiRelevanceResponse.getPrice());
|
|
|
|
|
codeEnttity.setInBatchNo(inBatch);
|
|
|
|
|
//是否边扫边校验
|
|
|
|
|
if (addOrderRequest.getOrderType() == ConstantStatus.ORDER_TYPE_NORMAL && bussinessTypeEntity.isCheckEnable()) {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(codeEnttity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
} else
|
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
} else if (addOrderRequest.getOrderType() == ConstantStatus.ORDER_TYPE_WAIT && bussinessTypeEntity.isCheckEnable()) {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkDrugNoPiCode(codeEnttity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
} else
|
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
} else {
|
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
addCodeResult.setOrderId(orderId);
|
|
|
|
|
transInoutService.genOrderDetailCode(orderEntity, genDetaiEntity);
|
|
|
|
|
return ResultVOUtils.success(addCodeResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//校验条码完整性
|
|
|
|
|
public BaseResponse checkOriginCode(UdiEntity udiEntity) {
|
|
|
|
|
//校验条码的完整性
|
|
|
|
@ -923,37 +1247,6 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//校验条码完整性
|
|
|
|
|
public BaseResponse checkCodeIntegrity(UdiRelevanceResponse checkUdi, UdiEntity udiEntity) {
|
|
|
|
|
String lostMsg = "";
|
|
|
|
|
//校验条码完整性
|
|
|
|
|
if ("是".equals(checkUdi.getScbssfbhph()) && StrUtil.isEmpty(udiEntity.getBatchNo())) {
|
|
|
|
|
lostMsg = lostMsg + ",批次号";
|
|
|
|
|
}
|
|
|
|
|
if ("是".equals(checkUdi.getScbssfbhscrq()) && StrUtil.isEmpty(udiEntity.getProduceDate())) {
|
|
|
|
|
lostMsg = lostMsg + ",生产日期";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ("是".equals(checkUdi.getScbssfbhsxrq()) && StrUtil.isEmpty(udiEntity.getExpireDate())) {
|
|
|
|
|
lostMsg = lostMsg + ",失效日期";
|
|
|
|
|
}
|
|
|
|
|
if (("是".equals(checkUdi.getScbssfbhxlh()) && StrUtil.isEmpty(udiEntity.getSerialNo()))
|
|
|
|
|
) {
|
|
|
|
|
lostMsg = lostMsg + ",序列号";
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getSerialNo()) && udiEntity.getSerialNo().length() > 20) {
|
|
|
|
|
return ResultVOUtils.error(504, "序列号超出20位!");
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getBatchNo()) && udiEntity.getBatchNo().length() > 20) {
|
|
|
|
|
return ResultVOUtils.error(504, "批次号超出20位!");
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isEmpty(udiEntity.getSerialNo()) && StrUtil.isEmpty(udiEntity.getBatchNo())) {
|
|
|
|
|
lostMsg = "批次号与序列号不能同时为空!";
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotEmpty(lostMsg))
|
|
|
|
|
return ResultVOUtils.error(500, lostMsg);
|
|
|
|
|
else return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//校验供应商是否配送此产品
|
|
|
|
|
public BaseResponse checkCorp(IoCodeTempEntity codeEnttity, BasicBussinessTypeEntity bussinessTypeEntity, String unitFk) {
|
|
|
|
@ -1003,10 +1296,6 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
//校验供应商唯一性
|
|
|
|
|
public BaseResponse checkSupId(BasicBussinessTypeEntity bussinessTypeEntity, IoCodeTempEntity codeEnttity, String unitFk) {
|
|
|
|
|
String originSupId = unitFk;
|
|
|
|
|
// if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
|
|
|
|
|
// if (unitFk != null)
|
|
|
|
|
// originSupId = unitFk;
|
|
|
|
|
// }
|
|
|
|
|
if (originSupId != null) {
|
|
|
|
|
codeEnttity.setSupId(originSupId);
|
|
|
|
|
} else {
|
|
|
|
@ -1140,8 +1429,6 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
return baseResponse;
|
|
|
|
|
|
|
|
|
|
codeTempEntity.setRelId(codeSaveRequest.getRelId());
|
|
|
|
|
int reCount = udiCalCountUtil.getActCount(codeTempEntity);
|
|
|
|
|
// codeTempEntity.setReCount(reCount);
|
|
|
|
|
}
|
|
|
|
|
IoOrderEntity orderEntity = orderService.findByBillNo(codeTempEntity.getOrderId());
|
|
|
|
|
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction());
|
|
|
|
|