单据提交按照业务单提交

dev_unify
yewj 4 months ago
parent c92d07bdcf
commit f2ebe1872b

@ -44,6 +44,7 @@ import com.glxp.api.service.inout.impl.IoOrderInvoiceService;
import com.glxp.api.service.system.SystemParamConfigService;
import com.glxp.api.util.CustomUtil;
import com.glxp.api.util.GennerOrderUtils;
import com.glxp.api.util.IntUtil;
import com.glxp.api.util.OrderNoTypeBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -252,22 +253,22 @@ public class IoOrderController extends BaseController {
ioAddInoutService.dealProcess(orderEntity);
//增加药品单据的一个判断是否全部维护关联关系
if (orderEntity.getProductType() == 2){
if (orderEntity.getProductType() == 2) {
//加载开关
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("warning_relCode_switch");
if (systemParamConfigEntity.getParamValue().equals("1")) {
List<IoCodeTempEntity> codeTempEntities = codeTempService.findByOrderId(orderEntity.getBillNo());
if (CollUtil.isNotEmpty(codeTempEntities)){
if (CollUtil.isNotEmpty(codeTempEntities)) {
boolean flag = false;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < codeTempEntities.size(); i++) {
IoCodeTempEntity ioCodeTempEntity = codeTempEntities.get(i);
if (ioCodeTempEntity.getDrugLink() == 0 ){
if (ioCodeTempEntity.getDrugLink() == 0) {
flag = true;
sb.append(ioCodeTempEntity.getNameCode()).append(";");
}
}
if (flag){
if (flag) {
sb.append("的关联关系未关联");
return ResultVOUtils.error(500, String.valueOf(sb));
}
@ -324,6 +325,7 @@ public class IoOrderController extends BaseController {
public BaseResponse submitOrderWeb(@RequestBody AddOrderRequest addOrderRequest) {
IoOrderEntity orderEntity = orderService.findByBillNo(addOrderRequest.getBillNo());
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction());
if (StringUtils.isNotBlank(addOrderRequest.getRemark())) {
orderEntity.setRemark(addOrderRequest.getRemark());
}
@ -346,16 +348,22 @@ public class IoOrderController extends BaseController {
if (checkInoutService.checkManual(addOrderRequest.getBillNo())) {
if (CollUtil.isNotEmpty(orderDetailBizEntities)) {
String errMsg = checkInoutService.bizOrderCheck(orderDetailBizEntities, orderDetailCodeEntities);
if (StrUtil.isNotEmpty(errMsg)) {
return ResultVOUtils.error(500, errMsg);
}
errMsg = checkInoutService.codeOrderCheck(orderDetailCodeEntities, orderDetailBizEntities);
if (StrUtil.isNotEmpty(errMsg)) {
return ResultVOUtils.error(500, errMsg);
if (IntUtil.value(bussinessTypeEntity.getCheckWebNewType()) == 3) {
String errMsg = checkInoutService.bizOrderCheckPass(orderDetailBizEntities, orderDetailCodeEntities);
if (StrUtil.isNotEmpty(errMsg)) {
return ResultVOUtils.error(500, errMsg);
}
} else {
String errMsg = checkInoutService.bizOrderCheck(orderDetailBizEntities, orderDetailCodeEntities);
if (StrUtil.isNotEmpty(errMsg)) {
return ResultVOUtils.error(500, errMsg);
}
errMsg = checkInoutService.codeOrderCheck(orderDetailCodeEntities, orderDetailBizEntities);
if (StrUtil.isNotEmpty(errMsg)) {
return ResultVOUtils.error(500, errMsg);
}
}
saveOrderWeb(addOrderRequest);
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_CHECK);
orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_POST);

@ -489,4 +489,9 @@ public class BasicBussinessTypeEntity {
return false;
}
/**
* 0:1;3,
*/
private int checkWebNewType;
}

@ -192,5 +192,8 @@ public class BasicBussinessTypeResponse {
private Integer codeCheck;
private Integer productType;
/**
* 0:1
*/
private int checkWebNewType;
}

@ -452,8 +452,8 @@ public class IoCheckInoutService {
orderDetailResultEntity.setCount(orderDetailCodeEntity.getReCount());
orderDetailResultEntity.setReCount(orderDetailCodeEntity.getReCount());
orderDetailResultEntity.setId(null);
UdiProductEntity product = udiProductService.findProductByNameCode(orderDetailCodeEntity.getNameCode());
if (product.getProductsType() == 2){
UdiProductEntity product = udiProductService.findProductByNameCode(orderDetailCodeEntity.getNameCode());
if (product.getProductsType() == 2) {
//药品 拿到药品赋值
orderDetailResultEntity.setSpec(product.getBzgg());
}
@ -579,8 +579,8 @@ public class IoCheckInoutService {
BeanUtils.copyProperties(orderDetailBizEntity, orderDetailResultEntity);
orderDetailResultEntity.setId(null);
orderDetailResultEntity.setReCount(orderDetailBizEntity.getScanCount());
UdiProductEntity product = udiProductService.findProductByNameCode(orderDetailBizEntity.getNameCode());
if (product.getProductsType() == 2){
UdiProductEntity product = udiProductService.findProductByNameCode(orderDetailBizEntity.getNameCode());
if (product.getProductsType() == 2) {
//药品 拿到药品赋值
orderDetailResultEntity.setSpec(product.getBzgg());
}
@ -662,7 +662,6 @@ public class IoCheckInoutService {
) {
if (checkCount(bizEntity, codeEntity) == null) {
bizEntity.setCheckSuccess(true);
codeEntity.setCheckSuccess(true);
bizEntity.setScanCount(codeEntity.getReCount());
@ -719,6 +718,51 @@ public class IoCheckInoutService {
return errMsg;
}
public String bizOrderCheckPass(List<IoOrderDetailBizEntity> orderDetailBizEntities, List<IoOrderDetailCodeEntity> orderDetailCodeEntities) {
String errMsg = "";
//初始化默认值
for (IoOrderDetailCodeEntity codeEntity : orderDetailCodeEntities) {
codeEntity.setCheckSuccess(false);
}
for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) {
bizEntity.setCheckSuccess(false);
}
for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) {
String msg = "";
for (IoOrderDetailCodeEntity codeEntity : orderDetailCodeEntities) {
if (!bizEntity.isCheckSuccess() && !codeEntity.isCheckSuccess() && checkId(bizEntity, codeEntity) == null
&& checkBatchNo(bizEntity, codeEntity) == null
&& checkProductDate(bizEntity, codeEntity) == null
&& checkExpireDate(bizEntity, codeEntity) == null
) {
if (checkBizCount(bizEntity, codeEntity) == null) {
bizEntity.setCheckSuccess(true);
codeEntity.setCheckSuccess(true);
bizEntity.setScanCount(codeEntity.getReCount());
} else {
msg = "扫码数量超出";
bizEntity.setCheckSuccess(false);
}
break;
}
}
if (StrUtil.isEmpty(msg) && !bizEntity.isCheckSuccess()) {
msg = "三期不匹配";
}
bizEntity.setErrMsg(msg);
}
for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) {
if (!bizEntity.isCheckSuccess()) {
errMsg = errMsg + bizEntity.getCoName() + bizEntity.getErrMsg() + ";";
}
}
return errMsg;
}
//单据合并校验
public List<IoOrderCheckResultResponse> combineCheck(List<IoOrderDetailBizEntity> orderDetailBizEntities, List<IoOrderDetailCodeEntity> orderDetailCodeEntities) {
@ -802,7 +846,6 @@ public class IoCheckInoutService {
&& checkExpireDate(bizEntity, codeEntity) == null
) {
if (checkCount(bizEntity, codeEntity) == null) {
bizEntity.setCheckSuccess(true);
codeEntity.setCheckSuccess(true);
codeEntity.setOrderCount(bizEntity.getCount());
@ -1200,4 +1243,19 @@ public class IoCheckInoutService {
}
/**
*
*
* @param bizEntity
* @param codeEntity
* @return
*/
public String checkBizCount(IoOrderDetailBizEntity bizEntity, IoOrderDetailCodeEntity codeEntity) {
if (bizEntity.getCount() > codeEntity.getReCount()) {
return null;
}
return bizEntity.getCoName() + "数量不匹配!";
}
}

@ -172,8 +172,16 @@ public class FilterUdiUtils {
public static UdiEntity getDrugInfo(String data) {
UdiEntity udiEntity = new UdiEntity();
String prefix = data.substring(0, 7);
String serialNo = data.substring(7, 16);
String prefix;
String serialNo;
if (data.startsWith("89")) {
prefix = data.substring(0, 8);
serialNo = data.substring(8, 16);
} else {
prefix = data.substring(0, 7);
serialNo = data.substring(7, 16);
}
udiEntity.setBatchNo(null);
udiEntity.setExpireDate(null);
udiEntity.setProduceDate(null);
@ -184,6 +192,7 @@ public class FilterUdiUtils {
}
public static UdiProductEntity transUdi(UdiProductEntity data) {
UdiEntity udiEntity = getUdi(data.getCode());
if (udiEntity != null) {

@ -1207,7 +1207,8 @@ CALL Pro_Temp_ColumnWork('customer_info', 'appSecret',
CALL Pro_Temp_ColumnWork('customer_info', 'refEntId',
' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT ''接口调用企业的唯一标识''',
1);
INSERT ignore INTO `sys_param_config` (`id`, `parentId`, `paramName`, `paramKey`, `paramValue`, `paramStatus`, `paramType`, `paramExplain`, `updateTime`)
INSERT ignore INTO `sys_param_config` (`id`, `parentId`, `paramName`, `paramKey`, `paramValue`, `paramStatus`,
`paramType`, `paramExplain`, `updateTime`)
VALUES (20100, 0, '是否全部维护关联关系', 'warning_relCode_switch', '1', 1, 0, '01', NULL);
@ -1230,12 +1231,16 @@ CALL Pro_Temp_ColumnWork('third_ali_drug', 'packUnitName',
' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT ''包装单位''',
1);
CREATE TABLE IF NOT EXISTS `auth_ali_user` (
`id` bigint NOT NULL,
`erpId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '第三方ID',
`appKey` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '阿里KEY',
CREATE TABLE IF NOT EXISTS `auth_ali_user`
(
`id` bigint NOT NULL,
`erpId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '第三方ID',
`appKey` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '阿里KEY',
`appSecret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '阿里密钥',
`refEntId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '厂家标识',
`type` varchar(255) DEFAULT NULL COMMENT '1 为生成企业 2为零售药店',
`refEntId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '厂家标识',
`type` varchar(255) DEFAULT NULL COMMENT '1 为生成企业 2为零售药店',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'checkWebNewType', 'tinyint', 1);

Loading…
Cancel
Save