湖里妇幼单据上传

Lhxyy
yewj 3 months ago
parent 55e7c7052d
commit 2f72b8b6ac

@ -352,4 +352,6 @@ public abstract class CommonHttpClient implements BaseHttpClient {
}
}

@ -667,40 +667,7 @@ public class HlfyyyClient extends CommonHttpClient {
//查询单据类型
BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeDao.selectByAction(ioCollectOrder.getBusType());
if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_HOSPTIAL)) {
//医院客户
zaxzyyOrderRequest.setCorpId(orderEntity.getFromCorp());
//查询客户名称
String corpName = basicCorpDao.selectNameByErpId(orderEntity.getFromCorp());
zaxzyyOrderRequest.setCorpName(corpName);
} else if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_INTTERNAL)) {
//内部科室
BasicCorpEntity basicCorpEntity = null;
if (StrUtil.isNotEmpty(orderEntity.getFromCorp())) {
basicCorpEntity = basicCorpDao.selectByErpId(orderEntity.getFromCorp());
}
if (basicCorpEntity != null) {
zaxzyyOrderRequest.setCorpId(basicCorpEntity.getThirdId());
zaxzyyOrderRequest.setCorpName(basicCorpEntity.getName());
} else {
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", ioCollectOrder.getFromCorp()));
try {
//根据第三方系统标识,获取对应字段的值
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
.eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
zaxzyyOrderRequest.setCorpId(thrInvWarehouseEntity.getCode());
zaxzyyOrderRequest.setCorpName(thrInvWarehouseEntity.getName());
} catch (Exception e) {
String msg = "查询单据对应往来单位的第三方仓库信息异常";
orderUploadLogService.updateLocalErr(orderEntity, msg);
log.error("----单据提交-----" + orderEntity.getBillNo() + msg);
return ResultVOUtils.error(500, msg);
}
}
} else {
//供应商
BasicCorpEntity basicCorpEntity = null;
if (StrUtil.isNotEmpty(orderEntity.getFromCorp())) {
@ -715,23 +682,12 @@ public class HlfyyyClient extends CommonHttpClient {
log.error("----单据提交-----" + orderEntity.getBillNo() + msg);
return ResultVOUtils.error(500, msg);
}
}
//查询仓库信息
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", orderEntity.getInvCode()));
try {
// va004Service.getOne(new LambdaQueryWrapper<VA004>()
// .eq(VA004::getCode, warehouseEntity.getCode())
//
// );
// ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
// .eq(ThrInvWarehouseEntity::getCode, warehouseEntity.getCode())
//// .eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId())
// );
zaxzyyOrderRequest.setLocInvCode(warehouseEntity.getCode());
zaxzyyOrderRequest.setLocInvCode(warehouseEntity.getThirdId());
zaxzyyOrderRequest.setLocInvName(warehouseEntity.getName());
zaxzyyOrderRequest.setLocStorageCode(warehouseEntity.getCode());
zaxzyyOrderRequest.setLocStorageCode(warehouseEntity.getThirdId());
zaxzyyOrderRequest.setLocStorageName(warehouseEntity.getName());
} catch (Exception e) {
log.error("查询第三方系统仓库信息异常", e);
@ -755,36 +711,36 @@ public class HlfyyyClient extends CommonHttpClient {
.ne("action", "StockCheck")
);
List<UdiwmsOrderDetailRequest> items = new ArrayList<>();
//查询业务单据详情
// List<IoOrderDetailBizEntity> detailBizEntities = orderDetailBizDao.selectList(new QueryWrapper<IoOrderDetailBizEntity>().eq("orderIdFk", orderEntity.getBillNo()));
// String errMsg = setOrderDetailList(ioCodeEntities, items, detailBizEntities);
// zaxzyyOrderRequest.setItem(items);
// if (CollUtil.isEmpty(items)) {
// orderUploadLogService.updateLocalErr(orderEntity, errMsg);
// return ResultVOUtils.error(500, errMsg);
// }
//
// if (StrUtil.isNotEmpty(errMsg)) {
// orderUploadLogService.updateLocalErr(orderEntity, errMsg);
// return ResultVOUtils.error(500, errMsg);
// }
// for (UdiwmsOrderDetailRequest i : items) {
// String fphm = "";
// String fprq = null;
// List<IoOrderInvoiceEntity> invoiceList = IoOrderInvoiceEntity.builder().build()
// .selectList(Wrappers.lambdaQuery(IoOrderInvoiceEntity.class).eq(IoOrderInvoiceEntity::getOrderIdFk, orderEntity.getBillNo())
// .eq(IoOrderInvoiceEntity::getBindRlFk, i.getBindRlFk())
// .eq(StrUtil.isNotEmpty(i.getBatchNo()), IoOrderInvoiceEntity::getBatchNo, i.getBatchNo()).
// groupBy(IoOrderInvoiceEntity::getInvoiceEncode));
// if (CollectionUtil.isNotEmpty(invoiceList)) {
// fphm = invoiceList.stream().map(IoOrderInvoiceEntity::getInvoiceEncode).collect(Collectors.joining(","));
// if (invoiceList.get(0).getInvoiceDate() != null)
// fprq = DateUtil.formatDateTime(invoiceList.get(0).getInvoiceDate());
// }
// i.setFirstSalesInvNo(fphm);
// i.setSecSalesInvNo(fphm);
// i.setInvoiceDate(fprq);
// }
// 查询业务单据详情
List<IoOrderDetailBizEntity> detailBizEntities = orderDetailBizDao.selectList(new QueryWrapper<IoOrderDetailBizEntity>().eq("orderIdFk", orderEntity.getBillNo()));
String errMsg = setOrderDetailList(ioCodeEntities, items, detailBizEntities);
zaxzyyOrderRequest.setItem(items);
if (CollUtil.isEmpty(items)) {
orderUploadLogService.updateLocalErr(orderEntity, errMsg);
return ResultVOUtils.error(500, errMsg);
}
if (StrUtil.isNotEmpty(errMsg)) {
orderUploadLogService.updateLocalErr(orderEntity, errMsg);
return ResultVOUtils.error(500, errMsg);
}
for (UdiwmsOrderDetailRequest i : items) {
String fphm = "";
String fprq = null;
List<IoOrderInvoiceEntity> invoiceList = IoOrderInvoiceEntity.builder().build()
.selectList(Wrappers.lambdaQuery(IoOrderInvoiceEntity.class).eq(IoOrderInvoiceEntity::getOrderIdFk, orderEntity.getBillNo())
.eq(IoOrderInvoiceEntity::getBindRlFk, i.getBindRlFk())
.eq(StrUtil.isNotEmpty(i.getBatchNo()), IoOrderInvoiceEntity::getBatchNo, i.getBatchNo()).
groupBy(IoOrderInvoiceEntity::getInvoiceEncode));
if (CollectionUtil.isNotEmpty(invoiceList)) {
fphm = invoiceList.stream().map(IoOrderInvoiceEntity::getInvoiceEncode).collect(Collectors.joining(","));
if (invoiceList.get(0).getInvoiceDate() != null)
fprq = DateUtil.formatDateTime(invoiceList.get(0).getInvoiceDate());
}
i.setFirstSalesInvNo(fphm);
i.setSecSalesInvNo(fphm);
i.setInvoiceDate(fprq);
}
//构造诏安接口参数
ZzzyyRequest zaZyRequest = new ZzzyyRequest();
zaZyRequest.setMsgHeader(getMsgHeader("saveBuyApplyInfo"));
@ -792,11 +748,11 @@ public class HlfyyyClient extends CommonHttpClient {
submitByWebService(zaZyRequest.getMsgHeader(), zaZyRequest.getMsgBody());
return submitOrder(orderEntity, zaZyRequest);
}
public BaseResponse submitOrders(UdiwmsOrderRequest udiwmsOrderRequest) {
if (StrUtil.isBlank(udiwmsOrderRequest.getBillNo())) {
return ResultVOUtils.error(500, "单据号不能为空");
}
udiwmsOrderRequest.setBillType("SC73450632224238");
ZaxzyyOrderRequest zaxzyyOrderRequest = new ZaxzyyOrderRequest();
BeanUtil.copyProperties(udiwmsOrderRequest, zaxzyyOrderRequest);
//查询单据和详情信息,组装第三方系统接口所需参数
@ -804,46 +760,10 @@ public class HlfyyyClient extends CommonHttpClient {
zaxzyyOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime()));
//查询对应的第三方单据类型
ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new QueryWrapper<ThrSystemBusApiEntity>().eq("code", udiwmsOrderRequest.getBillType()));
zaxzyyOrderRequest.setBillType(udiwmsOrderRequest.getBillType());
zaxzyyOrderRequest.setBillType("01");
zaxzyyOrderRequest.setBillFlag("1");
zaxzyyOrderRequest.setThirdSys("thirdSys");
//查询单据类型
BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeDao.selectByAction(udiwmsOrderRequest.getBillType());
if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_HOSPTIAL)) {
//医院客户
zaxzyyOrderRequest.setCorpId(orderEntity.getFromCorp());
//查询客户名称
String corpName = basicCorpDao.selectNameByErpId(orderEntity.getFromCorp());
zaxzyyOrderRequest.setCorpName(corpName);
} else if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_INTTERNAL)) {
//内部科室
BasicCorpEntity basicCorpEntity = null;
if (StrUtil.isNotEmpty(orderEntity.getFromCorp())) {
basicCorpEntity = basicCorpDao.selectByErpId(orderEntity.getFromCorp());
}
if (basicCorpEntity != null) {
zaxzyyOrderRequest.setCorpId(basicCorpEntity.getThirdId());
zaxzyyOrderRequest.setCorpName(basicCorpEntity.getName());
} else {
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", udiwmsOrderRequest.getCorpId()));
try {
//根据第三方系统标识,获取对应字段的值
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
.eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
zaxzyyOrderRequest.setCorpId(thrInvWarehouseEntity.getCode());
zaxzyyOrderRequest.setCorpName(thrInvWarehouseEntity.getName());
} catch (Exception e) {
String msg = "查询单据对应往来单位的第三方仓库信息异常";
orderUploadLogService.updateLocalErr(orderEntity, msg);
log.error("----单据提交-----" + orderEntity.getBillNo() + msg);
return ResultVOUtils.error(500, msg);
}
}
} else {
//供应商
BasicCorpEntity basicCorpEntity = null;
if (StrUtil.isNotEmpty(orderEntity.getFromCorp())) {
@ -858,38 +778,19 @@ public class HlfyyyClient extends CommonHttpClient {
log.error("----单据提交-----" + orderEntity.getBillNo() + msg);
return ResultVOUtils.error(500, msg);
}
}
//查询仓库信息
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", orderEntity.getInvCode()));
try {
// va004Service.getOne(new LambdaQueryWrapper<VA004>()
// .eq(VA004::getCode, warehouseEntity.getCode())
//
// );
// ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
// .eq(ThrInvWarehouseEntity::getCode, warehouseEntity.getCode())
//// .eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId())
// );
zaxzyyOrderRequest.setLocInvCode(warehouseEntity.getCode());
zaxzyyOrderRequest.setLocInvName(warehouseEntity.getName());
zaxzyyOrderRequest.setLocStorageCode(warehouseEntity.getCode());
zaxzyyOrderRequest.setLocStorageName(warehouseEntity.getName());
} catch (Exception e) {
log.error("查询第三方系统仓库信息异常", e);
String msg = "查询第三方系统仓库信息异常";
orderUploadLogService.updateLocalErr(orderEntity, msg);
return ResultVOUtils.error(500, msg);
}
//设置单据出入库类型
if (basicBussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
zaxzyyOrderRequest.setInoutType(1); //入库
} else if (basicBussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
zaxzyyOrderRequest.setInoutType(2); //出库
}
//设置备注信息
zaxzyyOrderRequest.setRemark("udi管理系统提交单据");
//组装单据明细数据
@ -899,35 +800,35 @@ public class HlfyyyClient extends CommonHttpClient {
);
List<UdiwmsOrderDetailRequest> items = new ArrayList<>();
//查询业务单据详情
// List<IoOrderDetailBizEntity> detailBizEntities = orderDetailBizDao.selectList(new QueryWrapper<IoOrderDetailBizEntity>().eq("orderIdFk", orderEntity.getBillNo()));
// String errMsg = setOrderDetailList(ioCodeEntities, items, detailBizEntities);
// zaxzyyOrderRequest.setItem(items);
// if (CollUtil.isEmpty(items)) {
// orderUploadLogService.updateLocalErr(orderEntity, errMsg);
// return ResultVOUtils.error(500, errMsg);
// }
//
// if (StrUtil.isNotEmpty(errMsg)) {
// orderUploadLogService.updateLocalErr(orderEntity, errMsg);
// return ResultVOUtils.error(500, errMsg);
// }
// for (UdiwmsOrderDetailRequest i : items) {
// String fphm = "";
// String fprq = null;
// List<IoOrderInvoiceEntity> invoiceList = IoOrderInvoiceEntity.builder().build()
// .selectList(Wrappers.lambdaQuery(IoOrderInvoiceEntity.class).eq(IoOrderInvoiceEntity::getOrderIdFk, orderEntity.getBillNo())
// .eq(IoOrderInvoiceEntity::getBindRlFk, i.getBindRlFk())
// .eq(StrUtil.isNotEmpty(i.getBatchNo()), IoOrderInvoiceEntity::getBatchNo, i.getBatchNo()).
// groupBy(IoOrderInvoiceEntity::getInvoiceEncode));
// if (CollectionUtil.isNotEmpty(invoiceList)) {
// fphm = invoiceList.stream().map(IoOrderInvoiceEntity::getInvoiceEncode).collect(Collectors.joining(","));
// if (invoiceList.get(0).getInvoiceDate() != null)
// fprq = DateUtil.formatDateTime(invoiceList.get(0).getInvoiceDate());
// }
// i.setFirstSalesInvNo(fphm);
// i.setSecSalesInvNo(fphm);
// i.setInvoiceDate(fprq);
// }
List<IoOrderDetailBizEntity> detailBizEntities = orderDetailBizDao.selectList(new QueryWrapper<IoOrderDetailBizEntity>().eq("orderIdFk", orderEntity.getBillNo()));
String errMsg = setOrderDetailList(ioCodeEntities, items, detailBizEntities);
zaxzyyOrderRequest.setItem(items);
if (CollUtil.isEmpty(items)) {
orderUploadLogService.updateLocalErr(orderEntity, errMsg);
return ResultVOUtils.error(500, errMsg);
}
if (StrUtil.isNotEmpty(errMsg)) {
orderUploadLogService.updateLocalErr(orderEntity, errMsg);
return ResultVOUtils.error(500, errMsg);
}
for (UdiwmsOrderDetailRequest i : items) {
String fphm = "";
String fprq = null;
List<IoOrderInvoiceEntity> invoiceList = IoOrderInvoiceEntity.builder().build()
.selectList(Wrappers.lambdaQuery(IoOrderInvoiceEntity.class).eq(IoOrderInvoiceEntity::getOrderIdFk, orderEntity.getBillNo())
.eq(IoOrderInvoiceEntity::getBindRlFk, i.getBindRlFk())
.eq(StrUtil.isNotEmpty(i.getBatchNo()), IoOrderInvoiceEntity::getBatchNo, i.getBatchNo()).
groupBy(IoOrderInvoiceEntity::getInvoiceEncode));
if (CollectionUtil.isNotEmpty(invoiceList)) {
fphm = invoiceList.stream().map(IoOrderInvoiceEntity::getInvoiceEncode).collect(Collectors.joining(","));
if (invoiceList.get(0).getInvoiceDate() != null)
fprq = DateUtil.formatDateTime(invoiceList.get(0).getInvoiceDate());
}
i.setFirstSalesInvNo(fphm);
i.setSecSalesInvNo(fphm);
i.setInvoiceDate(fprq);
}
//构造诏安接口参数
ZzzyyRequest zaZyRequest = new ZzzyyRequest();
zaZyRequest.setMsgHeader(getMsgHeader("saveBuyApplyInfo"));
@ -1365,30 +1266,35 @@ public class HlfyyyClient extends CommonHttpClient {
item.setExpireDate(DateUtil.formatExpireTime(StrUtil.isBlank(detailBizEntity.getExpireDate()) ? null : "20" + detailBizEntity.getExpireDate()));
String thirdProductId = (String) ReflectUtil.getFieldValue(basicUdirel, thirdSysConfig.getThirdId());
item.setProductId(thirdProductId); //产品ID
//查询第三方产品名称
//查询第三方产品名称 --医保编码
ThrProductsEntity thrProductsEntity = thrProductsDao.selectOne(new LambdaQueryWrapper<ThrProductsEntity>()
.eq(ThrProductsEntity::getCode, thirdProductId).last("limit 1"));
// 物资字典
// ThrProductsEntity thrProductsEntity = thrProductsDao.selectOne(new LambdaQueryWrapper<ThrProductsEntity>()
// .eq(ThrProductsEntity::getCode, thirdProductId).eq(ThrProductsEntity::getThirdSysFk, "thirdId1").last("limit 1"));
if (thrProductsEntity == null) {
log.error("第三方产品编码未关联");
return null;
}
item.setProductName(thrProductsEntity.getName()); //产品名称
item.setBindRlFk(detailBizEntity.getBindRlFk());
// item.setBindRlFk(detailBizEntity.getBindRlFk());
item.setStandard(detailBizEntity.getSpec()); //规格型号
item.setBillNo(detailBizEntity.getOrderIdFk()); //单据号
item.setRegisterNo(detailBizEntity.getCertCode()); //注册/备案证号
item.setManufactory(basicProducts.getManufactory()); //生产厂家
item.setMeasname(thrProductsEntity.getMeasname()); //计量单位
item.setAllowNoBatch(IntUtil.value(basicProducts.getAllowNoBatch())); //是否允许无批次号
if (StrUtil.isNotEmpty(item.getManufactory())) {
ThrCorpEntity thrCorpEntity = thrCorpService.getThrCorpByName(item.getManufactory());
if (thrCorpEntity != null)
item.setManufactoryCode(thrCorpEntity.getUnitId());
}
item.setSupCode(thrProductsEntity.getSupCode());
item.setCplb(thrProductsEntity.getFlbm());
item.setHslb(thrProductsEntity.getCplb());
// if (StrUtil.isNotEmpty(item.getManufactory())) {
// ThrCorpEntity thrCorpEntity = thrCorpService.getThrCorpByName(item.getManufactory());
// if (thrCorpEntity != null)
// item.setManufactoryCode(thrCorpEntity.getUnitId());
// }
// item.setSupCode(thrProductsEntity.getSupCode());
// item.setCplb(thrProductsEntity.getFlbm());
// item.setHslb(thrProductsEntity.getCplb());
item.setCount(detailBizEntity.getCount());
return item;
}
@ -2571,6 +2477,10 @@ public class HlfyyyClient extends CommonHttpClient {
Class<?>[] returnTypes = new Class[]{String.class};
// Invoke the web service
log.error("msgHeader:" + msgHeader);
log.error("msgBody:" + msgBody);
Object[] response = serviceClient.invokeBlocking(QName.valueOf(METHOD_NAME), params, returnTypes);
// Return the response

Loading…
Cancel
Save