|
|
|
@ -179,8 +179,8 @@ public class PtxhyyClient extends CommonHttpClient {
|
|
|
|
|
List<IoOrderDetailBizEntity> detailBizEntities = orderDetailBizDao.selectList(new LambdaQueryWrapper<IoOrderDetailBizEntity>().eq(IoOrderDetailBizEntity::getOrderIdFk, orderEntity.getBillNo()));
|
|
|
|
|
|
|
|
|
|
//单据金额
|
|
|
|
|
BigDecimal djje = detailBizEntities.stream().map(IoOrderDetailBizEntity::getPrice).reduce(BigDecimal.ONE, BigDecimal::add);
|
|
|
|
|
List<IoOrderInvoiceEntity> ioOrderInvoiceEntities = IoOrderInvoiceEntity.builder().build().selectList(Wrappers.lambdaQuery(IoOrderInvoiceEntity.class).eq(IoOrderInvoiceEntity::getOrderIdFk, orderEntity.getId()));
|
|
|
|
|
BigDecimal djje = detailBizEntities.stream().map(IoOrderDetailBizEntity::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
List<IoOrderInvoiceEntity> ioOrderInvoiceEntities = IoOrderInvoiceEntity.builder().build().selectList(Wrappers.lambdaQuery(IoOrderInvoiceEntity.class).eq(IoOrderInvoiceEntity::getOrderIdFk, orderEntity.getBillNo()));
|
|
|
|
|
int fbbz = 0;
|
|
|
|
|
if (CollectionUtil.isNotEmpty(ioOrderInvoiceEntities) && ioOrderInvoiceEntities.size() > 0) {
|
|
|
|
|
fbbz = 1;
|
|
|
|
@ -193,7 +193,7 @@ public class PtxhyyClient extends CommonHttpClient {
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.info("查询操作人异常", ExceptionUtil.stacktraceToString(e));
|
|
|
|
|
return ResultVOUtils.error(500, "查询操作人异常!");
|
|
|
|
|
userName = getUserName(orderEntity);
|
|
|
|
|
}
|
|
|
|
|
PtxhyyOrderRequest ptxhyyOrderRequest = PtxhyyOrderRequest
|
|
|
|
|
.builder()
|
|
|
|
@ -211,7 +211,10 @@ public class PtxhyyClient extends CommonHttpClient {
|
|
|
|
|
.udixh(udiwmsOrderRequest.getBillNo())
|
|
|
|
|
.build();
|
|
|
|
|
ptxhyyOrderRequest.setDetailList(new ArrayList<>());
|
|
|
|
|
setOrderDetailList(ioCodeEntities, items, detailBizEntities);
|
|
|
|
|
String errMs = setOrderDetailList(ioCodeEntities, items, detailBizEntities);
|
|
|
|
|
if (errMs != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMs);
|
|
|
|
|
}
|
|
|
|
|
Collections.reverse(items);
|
|
|
|
|
for (UdiwmsOrderDetailRequest i : items) {
|
|
|
|
|
String udim = "";
|
|
|
|
@ -219,23 +222,28 @@ public class PtxhyyClient extends CommonHttpClient {
|
|
|
|
|
udim = i.getCodeList().stream().map(UdiwmsOrderDetailRequest.CodeDetailEntity::getCode).collect(Collectors.joining(","));
|
|
|
|
|
}
|
|
|
|
|
String fphm = "";
|
|
|
|
|
LocalDateTime fprq = null;
|
|
|
|
|
String fprq = null;
|
|
|
|
|
if (CollectionUtil.isNotEmpty(ioOrderInvoiceEntities)) {
|
|
|
|
|
List<IoOrderInvoiceEntity> invoiceList = ioOrderInvoiceEntities.stream().filter(s -> i.getBindRlFk().equals(s.getBindRlFk()) && i.getBatchNo().equals(s.getBatchNo()))
|
|
|
|
|
.sorted(Comparator.comparing(IoOrderInvoiceEntity::getInvoiceDate, Comparator.reverseOrder())).collect(Collectors.toList());
|
|
|
|
|
if (CollectionUtil.isNotEmpty(invoiceList)) {
|
|
|
|
|
fphm = invoiceList.stream().map(IoOrderInvoiceEntity::getInvoiceCode).collect(Collectors.joining(","));
|
|
|
|
|
fprq = LocalDateTime.parse(DateUtil.formatDateTime(invoiceList.get(0).getInvoiceDate()));
|
|
|
|
|
if (invoiceList.get(0).getInvoiceDate() != null)
|
|
|
|
|
fprq = DateUtil.formatDateTime(invoiceList.get(0).getInvoiceDate());
|
|
|
|
|
ioOrderInvoiceEntities.removeAll(invoiceList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BigDecimal wzje = i.getPrice().multiply(BigDecimal.valueOf(i.getCount().intValue()));
|
|
|
|
|
PtxhyyOrderDetailRequest detailRequest = PtxhyyOrderDetailRequest.builder()
|
|
|
|
|
.wzxh(i.getProductId())
|
|
|
|
|
.cjxh(i.getManufactoryCode())
|
|
|
|
|
.bzdw(i.getMeasname())
|
|
|
|
|
.bzsl(i.getCount())
|
|
|
|
|
.wzjg(i.getPrice())
|
|
|
|
|
.lsje(i.getPrice())
|
|
|
|
|
.lsjg(i.getPrice() + "")
|
|
|
|
|
.lsje(wzje)
|
|
|
|
|
.wzje(wzje + "")
|
|
|
|
|
.udim(udim)
|
|
|
|
|
.hsfl(i.getCplb())
|
|
|
|
|
.wzph(i.getBatchNo())
|
|
|
|
@ -256,13 +264,17 @@ public class PtxhyyClient extends CommonHttpClient {
|
|
|
|
|
* @param orderDetailRequests 单据详情参数
|
|
|
|
|
* @param detailBizEntities 单据业务详情
|
|
|
|
|
*/
|
|
|
|
|
private void setOrderDetailList(List<IoCodeEntity> ioCodeEntities, List<UdiwmsOrderDetailRequest> orderDetailRequests, List<IoOrderDetailBizEntity> detailBizEntities) {
|
|
|
|
|
private String setOrderDetailList(List<IoCodeEntity> ioCodeEntities, List<UdiwmsOrderDetailRequest> orderDetailRequests, List<IoOrderDetailBizEntity> detailBizEntities) {
|
|
|
|
|
for (IoOrderDetailBizEntity detailBizEntity : detailBizEntities) {
|
|
|
|
|
UdiwmsOrderDetailRequest item = submitOrderUtil.buildProductInfo(detailBizEntity);
|
|
|
|
|
if (item == null) {
|
|
|
|
|
return detailBizEntity.getNameCode() + "第三方产品编码未关联";
|
|
|
|
|
}
|
|
|
|
|
//封装条码信息
|
|
|
|
|
submitOrderUtil.setCodeList(ioCodeEntities, detailBizEntity, item);
|
|
|
|
|
orderDetailRequests.add(item);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@ -280,15 +292,18 @@ public class PtxhyyClient extends CommonHttpClient {
|
|
|
|
|
public String getUserName(IoOrderEntity orderEntity) {
|
|
|
|
|
|
|
|
|
|
//创建人非供应商
|
|
|
|
|
if (StrUtil.isNotEmpty(orderEntity.getCreateUser()) && orderEntity.getCreateUser().length() != 14) {
|
|
|
|
|
if (StrUtil.isNotEmpty(orderEntity.getCheckUser())) {
|
|
|
|
|
AuthUserEntity authUserEntity = authUserDao.selectById(orderEntity.getReviewUser());
|
|
|
|
|
return authUserEntity.getUserName();
|
|
|
|
|
} else if (StrUtil.isNotEmpty(orderEntity.getReviewUser())) {
|
|
|
|
|
AuthUserEntity authUserEntity = authUserDao.selectById(orderEntity.getReviewUser());
|
|
|
|
|
return authUserEntity.getUserName();
|
|
|
|
|
} else if (StrUtil.isNotEmpty(orderEntity.getCreateUser()) && orderEntity.getCreateUser().length() != 14) {
|
|
|
|
|
AuthUserEntity authUserEntity = authUserDao.selectById(orderEntity.getCreateUser());
|
|
|
|
|
return authUserEntity.getUserName();
|
|
|
|
|
} else if (StrUtil.isNotEmpty(orderEntity.getUpdateUser()) && orderEntity.getUpdateUser().length() != 14) {
|
|
|
|
|
AuthUserEntity authUserEntity = authUserDao.selectById(orderEntity.getUpdateUser());
|
|
|
|
|
return authUserEntity.getUserName();
|
|
|
|
|
} else if (StrUtil.isNotEmpty(orderEntity.getReviewUser())) {
|
|
|
|
|
AuthUserEntity authUserEntity = authUserDao.selectById(orderEntity.getReviewUser());
|
|
|
|
|
return authUserEntity.getUserName();
|
|
|
|
|
} else {
|
|
|
|
|
List<AuthWarehouseUser> authWarehouseUsers = authWarehouseUserMapper.selectList(new QueryWrapper<AuthWarehouseUser>().eq("code", orderEntity.getInvCode()));
|
|
|
|
|
if (CollUtil.isNotEmpty(authWarehouseUsers)) {
|
|
|
|
@ -299,6 +314,15 @@ public class PtxhyyClient extends CommonHttpClient {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getDefaultUserName(IoOrderEntity orderEntity) {
|
|
|
|
|
List<AuthWarehouseUser> authWarehouseUsers = authWarehouseUserMapper.selectList(new QueryWrapper<AuthWarehouseUser>().eq("code", orderEntity.getInvCode()));
|
|
|
|
|
if (CollUtil.isNotEmpty(authWarehouseUsers)) {
|
|
|
|
|
return authWarehouseUsers.get(0).getUserName();
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BaseResponse submitOrder(IoOrderEntity orderEntity, Object udiwmsOrderRequest) {
|
|
|
|
|
//记录日志
|
|
|
|
|
IoOrderUploadLogEntity uploadLog = new IoOrderUploadLogEntity();
|
|
|
|
@ -310,8 +334,6 @@ public class PtxhyyClient extends CommonHttpClient {
|
|
|
|
|
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_ORDER_SUBMIT_URL), udiwmsOrderRequest);
|
|
|
|
|
if (StrUtil.isNotBlank(response)) {
|
|
|
|
|
try {
|
|
|
|
|
// BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
|
|
|
|
|
|
|
|
|
|
BaseResponse<OrderUploadResponse> baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse<OrderUploadResponse>>() {
|
|
|
|
|
});
|
|
|
|
|