|
|
|
@ -188,6 +188,7 @@ public class HlfyyyClient extends CommonHttpClient {
|
|
|
|
|
private VA015Service va015Service;
|
|
|
|
|
@Resource
|
|
|
|
|
private VA002Mapper va002Mapper;
|
|
|
|
|
private VA001Mapper va002Mapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private VA003Mapper va003Mapper;
|
|
|
|
@ -650,12 +651,153 @@ public class HlfyyyClient extends CommonHttpClient {
|
|
|
|
|
@Resource
|
|
|
|
|
SysParamConfigService sysParamConfigService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse submitOrders(IoCollectOrder ioCollectOrder) {
|
|
|
|
|
if (StrUtil.isBlank(ioCollectOrder.getBillNo())) {
|
|
|
|
|
return ResultVOUtils.error(500, "单据号不能为空");
|
|
|
|
|
}
|
|
|
|
|
ZaxzyyOrderRequest zaxzyyOrderRequest = new ZaxzyyOrderRequest();
|
|
|
|
|
BeanUtil.copyProperties(ioCollectOrder, zaxzyyOrderRequest);
|
|
|
|
|
//查询单据和详情信息,组装第三方系统接口所需参数
|
|
|
|
|
IoOrderEntity orderEntity = orderDao.selectOne(new QueryWrapper<IoOrderEntity>().eq("billNo", ioCollectOrder.getBillNo()));
|
|
|
|
|
|
|
|
|
|
zaxzyyOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime()));
|
|
|
|
|
//查询对应的第三方单据类型
|
|
|
|
|
ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new QueryWrapper<ThrSystemBusApiEntity>().eq("code", ioCollectOrder.getBusType()));
|
|
|
|
|
zaxzyyOrderRequest.setBillType(ioCollectOrder.getBusType());
|
|
|
|
|
zaxzyyOrderRequest.setBillFlag("1");
|
|
|
|
|
|
|
|
|
|
//查询单据类型
|
|
|
|
|
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())) {
|
|
|
|
|
basicCorpEntity = basicCorpDao.selectByErpId(orderEntity.getFromCorp());
|
|
|
|
|
}
|
|
|
|
|
if (basicCorpEntity != null) {
|
|
|
|
|
zaxzyyOrderRequest.setCorpId(basicCorpEntity.getThirdId());
|
|
|
|
|
zaxzyyOrderRequest.setCorpName(basicCorpEntity.getName());
|
|
|
|
|
} else {
|
|
|
|
|
String msg = "查询单据对应的第三方往来单位信息异常";
|
|
|
|
|
orderUploadLogService.updateLocalErr(orderEntity, msg);
|
|
|
|
|
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管理系统提交单据");
|
|
|
|
|
//组装单据明细数据
|
|
|
|
|
List<IoCodeEntity> ioCodeEntities = codeDao.selectList(new QueryWrapper<IoCodeEntity>()
|
|
|
|
|
.eq("orderId", orderEntity.getBillNo())
|
|
|
|
|
.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);
|
|
|
|
|
// }
|
|
|
|
|
//构造诏安接口参数
|
|
|
|
|
ZzzyyRequest zaZyRequest = new ZzzyyRequest();
|
|
|
|
|
zaZyRequest.setMsgHeader(getMsgHeader("saveBuyApplyInfo"));
|
|
|
|
|
zaZyRequest.setMsgBody(JSONUtil.toJsonStr(zaxzyyOrderRequest));
|
|
|
|
|
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);
|
|
|
|
|
//查询单据和详情信息,组装第三方系统接口所需参数
|
|
|
|
@ -664,7 +806,7 @@ public class HlfyyyClient extends CommonHttpClient {
|
|
|
|
|
zaxzyyOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime()));
|
|
|
|
|
//查询对应的第三方单据类型
|
|
|
|
|
ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new QueryWrapper<ThrSystemBusApiEntity>().eq("code", udiwmsOrderRequest.getBillType()));
|
|
|
|
|
zaxzyyOrderRequest.setBillType(thrSystemBusApiEntity.getThirdBuyCode());
|
|
|
|
|
zaxzyyOrderRequest.setBillType(udiwmsOrderRequest.getBillType());
|
|
|
|
|
zaxzyyOrderRequest.setBillFlag("1");
|
|
|
|
|
|
|
|
|
|
//查询单据类型
|
|
|
|
@ -721,15 +863,20 @@ public class HlfyyyClient extends CommonHttpClient {
|
|
|
|
|
//查询仓库信息
|
|
|
|
|
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", orderEntity.getInvCode()));
|
|
|
|
|
try {
|
|
|
|
|
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
|
|
|
|
|
.eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
|
|
|
|
|
.eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
|
|
|
|
|
// 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(thrInvWarehouseEntity.getCode());
|
|
|
|
|
zaxzyyOrderRequest.setLocInvName(thrInvWarehouseEntity.getName());
|
|
|
|
|
zaxzyyOrderRequest.setLocInvCode(warehouseEntity.getCode());
|
|
|
|
|
zaxzyyOrderRequest.setLocInvName(warehouseEntity.getName());
|
|
|
|
|
|
|
|
|
|
zaxzyyOrderRequest.setLocStorageCode(thrInvWarehouseEntity.getCode());
|
|
|
|
|
zaxzyyOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName());
|
|
|
|
|
zaxzyyOrderRequest.setLocStorageCode(warehouseEntity.getCode());
|
|
|
|
|
zaxzyyOrderRequest.setLocStorageName(warehouseEntity.getName());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("查询第三方系统仓库信息异常", e);
|
|
|
|
|
String msg = "查询第三方系统仓库信息异常";
|
|
|
|
@ -753,35 +900,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"));
|
|
|
|
@ -790,7 +937,6 @@ public class HlfyyyClient extends CommonHttpClient {
|
|
|
|
|
return submitOrder(orderEntity, zaZyRequest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void submitByWebService(String msgHeader, String msgBody) {
|
|
|
|
|
try {
|
|
|
|
|
String response = callInterface(msgHeader, msgBody);
|
|
|
|
@ -1628,15 +1774,15 @@ public class HlfyyyClient extends CommonHttpClient {
|
|
|
|
|
String busType = ioCollectOrder.getBusType();
|
|
|
|
|
|
|
|
|
|
if (matchBusType(busType, buyType_3501)) {
|
|
|
|
|
optionUploadCollectOrder3501(ioCollectOrder);
|
|
|
|
|
submitOrders(ioCollectOrder);
|
|
|
|
|
} else if (matchBusType(busType, buyType_3502)) {
|
|
|
|
|
optionUploadCollectOrder3502(ioCollectOrder);
|
|
|
|
|
submitOrders(ioCollectOrder);
|
|
|
|
|
} else if (matchBusType(busType, buyType_3505)) {
|
|
|
|
|
return optionUploadCollectOrder3505(ioCollectOrder);
|
|
|
|
|
return submitOrders(ioCollectOrder);
|
|
|
|
|
} else if (matchBusType(busType, buyType_3506)) {
|
|
|
|
|
optionUploadCollectOrder3506(ioCollectOrder);
|
|
|
|
|
submitOrders(ioCollectOrder);
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(500, "业务类型未找到对应上传接口");
|
|
|
|
|
submitOrders(ioCollectOrder);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|