|
|
|
@ -338,8 +338,13 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
|
|
|
|
|
filterInvProductRequest.setStartDate(stringToDate(days + " 00:00:00"));
|
|
|
|
|
filterInvProductRequest.setEndDate(stringToDate(days + " 23:59:59"));
|
|
|
|
|
handleExternalThrInvSfOrder(filterInvProductRequest);
|
|
|
|
|
log.info("自动抓取第三方收费出入库明细生成单据定时任务结束");
|
|
|
|
|
if (thrInvOrderMapper.countDownloadsInRange(filterInvProductRequest.getStartDate(), filterInvProductRequest.getEndDate()) <= 0) {
|
|
|
|
|
handleExternalThrInvSfOrder(filterInvProductRequest);
|
|
|
|
|
log.info("自动抓取第三方收费出入库明细生成单据定时任务结束");
|
|
|
|
|
} else {
|
|
|
|
|
log.info("已下载户略");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -844,22 +849,12 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
if (CollUtil.isNotEmpty(thrInvOrders)) {
|
|
|
|
|
|
|
|
|
|
for (ThrInvOrder thrInvOrder : thrInvOrders) {
|
|
|
|
|
/**
|
|
|
|
|
* 1、根据 外检单号 进行 分组
|
|
|
|
|
* 2、遍历不同分组 在分组的列表再次进行匹配
|
|
|
|
|
* 3、匹配到的列表 不为空 进行 新增关联的单据 插入明细操作
|
|
|
|
|
* 4、需要 回写三方的明细表 标记已处理
|
|
|
|
|
*/
|
|
|
|
|
List<ThrInvOrderDetail> thrInvOrderDetails = thrInvOrderDetailMapper.selectList(
|
|
|
|
|
new LambdaQueryWrapper<ThrInvOrderDetail>()
|
|
|
|
|
.and(o -> o.isNull(ThrInvOrderDetail::getHandleStatus).or().ne(ThrInvOrderDetail::getHandleStatus, 1)).
|
|
|
|
|
eq(ThrInvOrderDetail::getOrderIdFk, thrInvOrder.getBillNo())
|
|
|
|
|
);
|
|
|
|
|
if (CollectionUtil.isEmpty(thrInvOrderDetails)) continue;
|
|
|
|
|
log.info("扫描处理第三方收费明细生成单据定时任务==orderIdFk==:[" + thrInvOrder.getBillNo() + "]");
|
|
|
|
|
//新单号
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//通过单号获取单据信息
|
|
|
|
|
QueryWrapper<ThrInvOrder> qw = new QueryWrapper<>();
|
|
|
|
|
qw.eq("billNo", thrInvOrder.getBillNo());
|
|
|
|
@ -873,7 +868,7 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
AtomicInteger fullGen = new AtomicInteger();
|
|
|
|
|
thrInvOrderDetails.forEach(item -> {
|
|
|
|
|
Long relId = item.getRelId();
|
|
|
|
|
if (ObjectUtil.isNull(relId)) {
|
|
|
|
|
if (ObjectUtil.isNull(relId)) {
|
|
|
|
|
String thrCode = item.getThrCode();
|
|
|
|
|
Integer count = Integer.valueOf(item.getReCount());
|
|
|
|
|
List<BasicSkProjectDetailEntity> skProjectDetailEntityList = basicDestinyRelService.filterDestinyRelListByPId(thrCode);
|
|
|
|
@ -898,6 +893,8 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
});
|
|
|
|
|
fullGen.getAndIncrement();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
updateThrInvOrderDetails.add(item);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (thrInvOrderDetails.size() == fullGen.intValue()) {
|
|
|
|
@ -947,23 +944,24 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
//新增明细
|
|
|
|
|
if (CollectionUtil.isNotEmpty(addThrInvOrderDetails)) {
|
|
|
|
|
thrInvOrderDetailMapper.insertBatch(addThrInvOrderDetails);
|
|
|
|
|
genOrder(thrInvOrder, bussinessTypeEntity, addThrInvOrderDetails);
|
|
|
|
|
}
|
|
|
|
|
//更新明细
|
|
|
|
|
if (CollectionUtil.isNotEmpty(updateThrInvOrderDetails)) {
|
|
|
|
|
thrInvOrderDetailMapper.updateBatchById(updateThrInvOrderDetails);
|
|
|
|
|
genOrder(thrInvOrder, bussinessTypeEntity, updateThrInvOrderDetails);
|
|
|
|
|
}
|
|
|
|
|
genOrder(thrInvOrder, bussinessTypeEntity);
|
|
|
|
|
log.info("扫描处理第三方收费明细生成单据定时任务结束");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean genOrder(
|
|
|
|
|
ThrInvOrder thrInvOrder, BasicBussinessTypeEntity bussinessTypeEntity) {
|
|
|
|
|
QueryWrapper<ThrInvOrderDetail> qwd = new QueryWrapper<>();
|
|
|
|
|
qwd.eq("orderIdFk", thrInvOrder.getBillNo());
|
|
|
|
|
List<ThrInvOrderDetail> thrInvOrderDetails = thrInvOrderDetailMapper.selectList(qwd);
|
|
|
|
|
ThrInvOrder thrInvOrder, BasicBussinessTypeEntity bussinessTypeEntity, List<ThrInvOrderDetail> thrInvOrderDetails) {
|
|
|
|
|
// QueryWrapper<ThrInvOrderDetail> qwd = new QueryWrapper<>();
|
|
|
|
|
// qwd.eq("orderIdFk", thrInvOrder.getBillNo());
|
|
|
|
|
// List<ThrInvOrderDetail> thrInvOrderDetails = thrInvOrderDetailMapper.selectList(qwd);
|
|
|
|
|
if (CollectionUtil.isEmpty(thrInvOrderDetails))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
@ -1008,8 +1006,8 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
ioOrderEntity.setCreateUser(userId + "");
|
|
|
|
|
ioOrderEntity.setUpdateUser(userId + "");
|
|
|
|
|
ioOrderEntity.setCreateUser(userId + "");
|
|
|
|
|
ioOrderEntity.setOrderType(ConstantStatus.ORDER_TYPE_SCAN);//正常单据处理
|
|
|
|
|
List<IoOrderDetailBizEntity> newOrderDetailBiz = new ArrayList<>();
|
|
|
|
|
if (entry.getValue().size() > 0) {
|
|
|
|
@ -1023,6 +1021,7 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
// 使用substring()去掉第一个字符
|
|
|
|
|
toBillNo = toBillNo.substring(1);
|
|
|
|
|
}
|
|
|
|
|
thrInvOrderDetailMapper.updateBatchById(thrInvOrderDetails);
|
|
|
|
|
thrInvOrder.setToBillNo(toBillNo);
|
|
|
|
|
thrInvOrderMapper.updateById(thrInvOrder);
|
|
|
|
|
ioOrderService.insertOrder(ioOrderEntity);
|
|
|
|
@ -1122,7 +1121,6 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
if (udiRlSupEntity != null) {
|
|
|
|
|
item.setSupId(udiRlSupEntity.getCustomerId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1191,6 +1189,11 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
thrInvOrder.setToBillNo(toBillNo);
|
|
|
|
|
|
|
|
|
|
thrInvOrderMapper.updateById(thrInvOrder);
|
|
|
|
|
thrInvOrderDetails.forEach(item -> {
|
|
|
|
|
item.setToBillNo(newBillNo);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
thrInvOrderDetailMapper.updateBatchById(thrInvOrderDetails);
|
|
|
|
|
ioOrderService.insertOrder(ioOrderEntity);
|
|
|
|
|
ioOrderDetailBizService.batchInsertBizs(newOrderDetailBiz);
|
|
|
|
|
//自动处理业务单据
|
|
|
|
@ -1346,10 +1349,11 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
parameterPackag(basicProductsEntity, ioOrderDetailBizEntity, thrInvOrderDetail);
|
|
|
|
|
ioOrderDetailBizEntity.setOrderIdFk(newBillNo);
|
|
|
|
|
ioOrderDetailBizEntity.setBatchNo("/");
|
|
|
|
|
thrInvOrderDetail.setToBillNo(newBillNo);
|
|
|
|
|
thrInvOrderDetail.setHandleStatus(1);
|
|
|
|
|
newOrderDetailBiz.add(ioOrderDetailBizEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -1561,14 +1565,11 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
//通过thrCode获取到项目组套
|
|
|
|
|
List<BasicSkProjectDetailEntity> skProjectDetailEntityList = basicDestinyRelService.filterDestinyRelListByPId(thrCode);
|
|
|
|
|
if (CollectionUtil.isNotEmpty(skProjectDetailEntityList) && count > 0) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Integer finalCount = count;
|
|
|
|
|
if (IntUtil.value(cpMutiFilter) > 0 && IntUtil.value(finalCount) > 1) {
|
|
|
|
|
if (IntUtil.value(cpMutiFilter) > 0 && skProjectDetailEntityList.size() > 1) {
|
|
|
|
|
log.error(item.getCpmctymc() + "," + item.getThrCode() + "项目关联多个耗材对照,已被过滤!");
|
|
|
|
|
} else {
|
|
|
|
|
skProjectDetailEntityList.forEach(sk -> {
|
|
|
|
|
|
|
|
|
|
ThrInvOrderDetail thrInvOrderDetail = new ThrInvOrderDetail();
|
|
|
|
|
BeanUtils.copyProperties(item, thrInvOrderDetail);
|
|
|
|
|
thrInvOrderDetail.setOrderIdFk(billNo);
|
|
|
|
@ -1582,7 +1583,6 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
if (skCount != null && skCount > 0) {
|
|
|
|
|
thrInvOrderDetail.setReCount(String.valueOf(skCount * finalCount));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//过滤是否高值
|
|
|
|
|
if (IntUtil.value(highFilter) > 0) {
|
|
|
|
|
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(sk.getRelId());
|
|
|
|
@ -1592,7 +1592,6 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
} else {
|
|
|
|
|
thrInvOrderDetails.add(thrInvOrderDetail);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|