系统升级相关接口修改

dev
anthonywj 1 year ago
parent 8c642d6364
commit ab4e8c6a8c

@ -1,6 +1,7 @@
package com.glxp.mipsdl.client.dsxyy;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -9,22 +10,30 @@ import com.glxp.mipsdl.client.BaseHttpClient;
import com.glxp.mipsdl.config.ThirdSysConfig;
import com.glxp.mipsdl.constant.ConstantType;
import com.glxp.mipsdl.constant.Constants;
import com.glxp.mipsdl.dao.auth.AuthUserDao;
import com.glxp.mipsdl.dao.auth.AuthWarehouseDao;
import com.glxp.mipsdl.dao.basic.BasicBussinessTypeDao;
import com.glxp.mipsdl.dao.basic.BasicCorpDao;
import com.glxp.mipsdl.dao.basic.BasicProductsDao;
import com.glxp.mipsdl.dao.basic.BasicUdirelDao;
import com.glxp.mipsdl.dao.inout.IoCodeDao;
import com.glxp.mipsdl.dao.inout.IoOrderDao;
import com.glxp.mipsdl.dao.inout.IoOrderDetailBizDao;
import com.glxp.mipsdl.dao.thrsys.ThrBustypeOriginDao;
import com.glxp.mipsdl.dao.thrsys.ThrInvWarehouseDao;
import com.glxp.mipsdl.dao.thrsys.ThrProductsDao;
import com.glxp.mipsdl.dao.thrsys.ThrSystemBusApiDao;
import com.glxp.mipsdl.entity.auth.AuthUserEntity;
import com.glxp.mipsdl.entity.auth.AuthWarehouseEntity;
import com.glxp.mipsdl.entity.basic.BasicBussinessTypeEntity;
import com.glxp.mipsdl.entity.basic.BasicProductsEntity;
import com.glxp.mipsdl.entity.basic.BasicUdirelEntity;
import com.glxp.mipsdl.entity.inout.IoCodeEntity;
import com.glxp.mipsdl.entity.inout.IoOrderDetailBizEntity;
import com.glxp.mipsdl.entity.inout.IoOrderEntity;
import com.glxp.mipsdl.entity.thrsys.ThrCorpEntity;
import com.glxp.mipsdl.entity.thrsys.ThrInvWarehouseEntity;
import com.glxp.mipsdl.entity.thrsys.ThrProductsEntity;
import com.glxp.mipsdl.entity.thrsys.ThrSystemBusApiEntity;
import com.glxp.mipsdl.http.HttpClient;
import com.glxp.mipsdl.req.base.*;
@ -40,14 +49,12 @@ import com.glxp.mipsdl.res.BaseResponse;
import com.glxp.mipsdl.service.auth.AuthWarehouseService;
import com.glxp.mipsdl.service.thrsys.ThrCorpService;
import com.glxp.mipsdl.service.thrsys.ThrSystemDetailService;
import com.glxp.mipsdl.util.DateUtil;
import com.glxp.mipsdl.util.DictUtl;
import com.glxp.mipsdl.util.ResultVOUtils;
import com.glxp.mipsdl.util.SubmitOrderUtil;
import com.glxp.mipsdl.util.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -89,6 +96,14 @@ public class DsxyyClient implements BaseHttpClient {
private IoOrderDetailBizDao orderDetailBizDao;
@Resource
private SubmitOrderUtil submitOrderUtil;
@Resource
AuthUserDao authUserDao;
@Resource
private BasicUdirelDao basicUdirelDao;
@Resource
private BasicProductsDao basicProductsDao;
@Resource
private ThrProductsDao thrProductsDao;
@Override
public BaseResponse getUnit(UdiwmsUnitRequest udiwmsUnitRequest) {
@ -140,9 +155,18 @@ public class DsxyyClient implements BaseHttpClient {
BeanUtil.copyProperties(udiwmsOrderRequest, dsOrderRequest);
//查询单据和详情信息,组装第三方系统接口参数
IoOrderEntity orderEntity = orderDao.selectOne(new LambdaQueryWrapper<IoOrderEntity>().eq(IoOrderEntity::getBillNo, udiwmsOrderRequest.getBillNo()));
IoOrderEntity orderEntity = orderDao.selectOne(new LambdaQueryWrapper<IoOrderEntity>().eq(IoOrderEntity::getBillNo, udiwmsOrderRequest.getBillNo()).last("limit 1"));
dsOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime()));
//设置操作人
if (orderEntity.getReviewUser() != null) {
AuthUserEntity authAdmin = authUserDao.selectById(orderEntity.getReviewUser());
udiwmsOrderRequest.setOperUser(authAdmin.getUserName());
} else if (orderEntity.getCreateUser() != null) {
AuthUserEntity authAdmin = authUserDao.selectById(orderEntity.getCreateUser());
udiwmsOrderRequest.setOperUser(authAdmin.getUserName());
}
//查询对应的第三方单据类型
ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new LambdaQueryWrapper<ThrSystemBusApiEntity>().eq(ThrSystemBusApiEntity::getCode, udiwmsOrderRequest.getBillType()));
if (StrUtil.isBlank(thrSystemBusApiEntity.getUrl())) {
@ -150,6 +174,14 @@ public class DsxyyClient implements BaseHttpClient {
}
dsOrderRequest.setBillType(thrSystemBusApiEntity.getThirdBuyCode());
if (orderEntity.getInvCode().equals("1000000")) {
udiwmsOrderRequest.setLocInvCode("1161");
udiwmsOrderRequest.setLocInvName("设备科");
} else {
udiwmsOrderRequest.setLocInvCode("4050");
udiwmsOrderRequest.setLocInvName("西药库");
}
//查询单据类型,设置往来单位信息
BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeDao.selectByAction(udiwmsOrderRequest.getBillType());
@ -184,31 +216,31 @@ public class DsxyyClient implements BaseHttpClient {
}
}
//查询仓库信息
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new LambdaQueryWrapper<AuthWarehouseEntity>().eq(AuthWarehouseEntity::getCode, orderEntity.getInvCode()));
try {
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
.eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
dsOrderRequest.setLocInvCode(thrInvWarehouseEntity.getCode());
dsOrderRequest.setLocInvName(thrInvWarehouseEntity.getName());
dsOrderRequest.setLocStorageCode(thrInvWarehouseEntity.getCode());
dsOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName());
} catch (Exception e) {
log.info("查询第三方系统仓库信息异常", e);
}
if (StrUtil.nullToEmpty(thrSystemBusApiEntity.getUrl()).equals("useOut")) {
dsOrderRequest.setCorpId(dsOrderRequest.getLocStorageCode());
dsOrderRequest.setCorpName(dsOrderRequest.getLocStorageName());
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>().eq(ThrInvWarehouseEntity::getCode, "29")
.eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
dsOrderRequest.setLocStorageCode("29");
dsOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName());
}
// //查询仓库信息
// AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new LambdaQueryWrapper<AuthWarehouseEntity>().eq(AuthWarehouseEntity::getCode, orderEntity.getInvCode()));
// try {
// ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
// .eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
// .eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
//
// dsOrderRequest.setLocInvCode(thrInvWarehouseEntity.getCode());
// dsOrderRequest.setLocInvName(thrInvWarehouseEntity.getName());
//
// dsOrderRequest.setLocStorageCode(thrInvWarehouseEntity.getCode());
// dsOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName());
// } catch (Exception e) {
// log.info("查询第三方系统仓库信息异常", e);
// }
// if (StrUtil.nullToEmpty(thrSystemBusApiEntity.getUrl()).equals("useOut")) {
// dsOrderRequest.setCorpId(dsOrderRequest.getLocStorageCode());
// dsOrderRequest.setCorpName(dsOrderRequest.getLocStorageName());
//
// ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>().eq(ThrInvWarehouseEntity::getCode, "29")
// .eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
// dsOrderRequest.setLocStorageCode("29");
// dsOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName());
// }
dsOrderRequest.setBillFlag("1");
//设置单据出入库类型
@ -223,7 +255,6 @@ public class DsxyyClient implements BaseHttpClient {
//组装单据明细数据
List<IoCodeEntity> ioCodeEntities = codeDao.selectList(new LambdaQueryWrapper<IoCodeEntity>()
.eq(IoCodeEntity::getOrderId, orderEntity.getBillNo())
.ne(IoCodeEntity::getAction, "StockCheck")
);
List<UdiwmsOrderDetailRequest> items = new ArrayList<>();
@ -248,7 +279,19 @@ public class DsxyyClient implements BaseHttpClient {
*/
private void setOrderDetailList(List<IoCodeEntity> ioCodeEntities, List<UdiwmsOrderDetailRequest> orderDetailRequests, List<IoOrderDetailBizEntity> detailBizEntities) {
for (IoOrderDetailBizEntity detailBizEntity : detailBizEntities) {
UdiwmsOrderDetailRequest item = submitOrderUtil.buildProductInfo(detailBizEntity);
UdiwmsOrderDetailRequest item = buildProductInfo(detailBizEntity);
if (StrUtil.isNotEmpty(item.getProductDate())) {
item.setProductDate("20" + item.getProductDate());
} else {
item.setProductDate("19990101");
}
if (StrUtil.isNotEmpty(item.getExpireDate())) {
item.setExpireDate("20" + item.getExpireDate());
} else {
item.setExpireDate("20991231");
}
//封装条码信息
submitOrderUtil.setCodeList(ioCodeEntities, detailBizEntity, item);
@ -256,6 +299,47 @@ public class DsxyyClient implements BaseHttpClient {
}
}
public UdiwmsOrderDetailRequest buildProductInfo(IoOrderDetailBizEntity detailBizEntity) {
//查询产品信息
BasicUdirelEntity basicUdirel = basicUdirelDao.selectById(detailBizEntity.getBindRlFk());
BasicProductsEntity basicProducts = basicProductsDao.selectOne(new LambdaQueryWrapper<BasicProductsEntity>().eq(BasicProductsEntity::getUuid, basicUdirel.getUuid()).last("limit 1"));
UdiwmsOrderDetailRequest item = new UdiwmsOrderDetailRequest();
BeanUtil.copyProperties(detailBizEntity, item);
item.setProductDate(DateUtil.formatExpireTime(StrUtil.isBlank(detailBizEntity.getProductDate()) ? null : "20" + detailBizEntity.getProductDate()));
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"));
if (thrProductsEntity == null) {
log.error("第三方产品编码未关联");
return null;
}
if (StrUtil.isEmpty(thrProductsEntity.getPrice())) {
item.setPrice(new BigDecimal(0));
} else
item.setPrice(new BigDecimal(thrProductsEntity.getPrice()));
item.setProductName(thrProductsEntity.getName()); //产品名称
item.setBindRlFk(detailBizEntity.getBindRlFk());
item.setStandard(detailBizEntity.getSpec()); //规格型号
item.setBillNo(detailBizEntity.getOrderIdFk()); //单据号
item.setRegisterNo(detailBizEntity.getCertCode()); //注册/备案证号
item.setManufactory(basicProducts.getManufactory()); //生产厂家
item.setMeasname(basicProducts.getMeasname()); //计量单位
item.setAllowNoBatch(IntUtil.value(basicProducts.getAllowNoBatch())); //是否允许无批次号
item.setManufactoryCode(thrProductsEntity.getManufactoryCode());
item.setSupCode(thrProductsEntity.getSupCode());
item.setCplb(thrProductsEntity.getFlbm());
item.setCount(detailBizEntity.getCount());
return item;
}
@Override
public BaseResponse getInvProducts(UdiwmsInvProductsRequest udiwmsInvProductsRequest) {
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_INV_PI_URL), udiwmsInvProductsRequest);

@ -1,6 +1,7 @@
package com.glxp.mipsdl.client.phxyy;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -12,19 +13,24 @@ import com.glxp.mipsdl.constant.Constants;
import com.glxp.mipsdl.dao.auth.AuthWarehouseDao;
import com.glxp.mipsdl.dao.basic.BasicBussinessTypeDao;
import com.glxp.mipsdl.dao.basic.BasicCorpDao;
import com.glxp.mipsdl.dao.basic.BasicUdirelDao;
import com.glxp.mipsdl.dao.inout.IoCodeDao;
import com.glxp.mipsdl.dao.inout.IoOrderDao;
import com.glxp.mipsdl.dao.inout.IoOrderDetailBizDao;
import com.glxp.mipsdl.dao.thrsys.ThrBustypeOriginDao;
import com.glxp.mipsdl.dao.thrsys.ThrInvWarehouseDao;
import com.glxp.mipsdl.dao.thrsys.ThrProductsDao;
import com.glxp.mipsdl.dao.thrsys.ThrSystemBusApiDao;
import com.glxp.mipsdl.entity.auth.AuthWarehouseEntity;
import com.glxp.mipsdl.entity.basic.BasicBussinessTypeEntity;
import com.glxp.mipsdl.entity.basic.BasicUdirelEntity;
import com.glxp.mipsdl.entity.inout.IoCodeEntity;
import com.glxp.mipsdl.entity.inout.IoOrderDetailBizEntity;
import com.glxp.mipsdl.entity.inout.IoOrderEntity;
import com.glxp.mipsdl.entity.inout.IoOrderUploadLogEntity;
import com.glxp.mipsdl.entity.thrsys.ThrCorpEntity;
import com.glxp.mipsdl.entity.thrsys.ThrInvWarehouseEntity;
import com.glxp.mipsdl.entity.thrsys.ThrProductsEntity;
import com.glxp.mipsdl.entity.thrsys.ThrSystemBusApiEntity;
import com.glxp.mipsdl.http.HttpClient;
import com.glxp.mipsdl.req.base.*;
@ -38,13 +44,12 @@ import com.glxp.mipsdl.req.post.PostThrInvProductsRequest;
import com.glxp.mipsdl.req.post.PostThrProductsRequest;
import com.glxp.mipsdl.res.BaseResponse;
import com.glxp.mipsdl.service.auth.AuthWarehouseService;
import com.glxp.mipsdl.service.order.OrderUploadLogService;
import com.glxp.mipsdl.service.thrsys.ThrCorpService;
import com.glxp.mipsdl.service.thrsys.ThrSystemDetailService;
import com.glxp.mipsdl.util.DateUtil;
import com.glxp.mipsdl.util.DictUtl;
import com.glxp.mipsdl.util.ResultVOUtils;
import com.glxp.mipsdl.util.SubmitOrderUtil;
import com.glxp.mipsdl.util.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -89,6 +94,12 @@ public class PhxyyClient implements BaseHttpClient {
private IoOrderDetailBizDao orderDetailBizDao;
@Resource
private SubmitOrderUtil submitOrderUtil;
@Resource
private BasicUdirelDao basicUdirelDao;
@Resource
ThrProductsDao thrProductsDao;
@Resource
private OrderUploadLogService orderUploadLogService;
@Override
public BaseResponse getUnit(UdiwmsUnitRequest udiwmsUnitRequest) {
@ -141,14 +152,12 @@ public class PhxyyClient implements BaseHttpClient {
//查询单据和详情信息,组装第三方系统接口参数
IoOrderEntity orderEntity = orderDao.selectOne(new LambdaQueryWrapper<IoOrderEntity>().eq(IoOrderEntity::getBillNo, udiwmsOrderRequest.getBillNo()));
phOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime()));
//查询对应的第三方单据类型
ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new LambdaQueryWrapper<ThrSystemBusApiEntity>().eq(ThrSystemBusApiEntity::getCode, udiwmsOrderRequest.getBillType()));
if (StrUtil.isBlank(thrSystemBusApiEntity.getUrl())) {
return ResultVOUtils.error(500, "接口未配置,无法提交!");
}
phOrderRequest.setBillType(thrSystemBusApiEntity.getThirdBuyCode());
//查询单据类型,设置往来单位信息
@ -223,7 +232,6 @@ public class PhxyyClient implements BaseHttpClient {
//组装单据明细数据
List<IoCodeEntity> ioCodeEntities = codeDao.selectList(new LambdaQueryWrapper<IoCodeEntity>()
.eq(IoCodeEntity::getOrderId, orderEntity.getBillNo())
.ne(IoCodeEntity::getAction, "StockCheck")
);
List<UdiwmsOrderDetailRequest> items = new ArrayList<>();
@ -231,32 +239,96 @@ public class PhxyyClient implements BaseHttpClient {
List<IoOrderDetailBizEntity> detailBizEntities = orderDetailBizDao.selectList(new LambdaQueryWrapper<IoOrderDetailBizEntity>().eq(IoOrderDetailBizEntity::getOrderIdFk, orderEntity.getBillNo()));
setOrderDetailList(ioCodeEntities, items, detailBizEntities);
// setOrderDetailList(ioCodeEntities, items, detailBizEntities);
List<IoOrderDetailBizEntity> stockOrderDetailEntities = transferSerList(detailBizEntities, orderEntity.getBillNo());
Collections.sort(stockOrderDetailEntities, (o1, o2) -> {
String o1Str = o1.getCoName() + o1.getSpec() + o1.getBatchNo() + o1.getSerialNo();
String o2Str = o2.getCoName() + o2.getSpec() + o2.getBatchNo() + o1.getSerialNo();
Integer cp = o1Str.compareTo(o2Str);
return cp;
});
for (IoOrderDetailBizEntity stockOrderDetailEntity : stockOrderDetailEntities) {
BasicUdirelEntity udiRelevanceEntity = basicUdirelDao.selectById(stockOrderDetailEntity.getBindRlFk());
if (StrUtil.isNotEmpty(udiRelevanceEntity.getMainId())) {
ThrProductsEntity thrProductsEntity = thrProductsDao.selectOne(new QueryWrapper<ThrProductsEntity>().eq("code", udiRelevanceEntity.getMainId()).last("limit 1"));
if (thrProductsEntity != null && StrUtil.isNotEmpty(thrProductsEntity.getRegisterNo())) {
stockOrderDetailEntity.setCertCode(thrProductsEntity.getRegisterNo());
}
}
UdiwmsOrderDetailRequest item = new UdiwmsOrderDetailRequest();
BeanUtil.copyProperties(stockOrderDetailEntity, item);
if (StrUtil.isNotEmpty(stockOrderDetailEntity.getProductDate())) {
// item.setProductDate(com.glxp.mipsdl.admin.util.DateUtil.formatExpireTime("20" + stockOrderDetailEntity.getProductDate()));
}
if (StrUtil.isNotEmpty(stockOrderDetailEntity.getExpireDate())) {
// item.setExpireDate(com.glxp.mipsdl.admin.util.DateUtil.formatExpireTime("20" + stockOrderDetailEntity.getExpireDate()));
}
// item.setMeasname(udiRelevanceEntity.getMeasname());
item.setStandard(stockOrderDetailEntity.getSpec());
item.setRegisterNo(stockOrderDetailEntity.getCertCode().replace(";", ""));
IoOrderUploadLogEntity uploadLog = new IoOrderUploadLogEntity();
try {
item.setPrice(stockOrderDetailEntity.getPrice());
item.setFirstSalesInvNo(stockOrderDetailEntity.getFirstSalesInvNo());
item.setSecSalesInvNo(stockOrderDetailEntity.getSecSalesInvNo());
item.setInvoiceDate(stockOrderDetailEntity.getInvoiceDate());
item.setSecSalesListNo(stockOrderDetailEntity.getSecSalesListNo());
ThrProductsEntity thrProductsEntity = thrProductsDao.selectOne(new QueryWrapper<ThrProductsEntity>().eq("code", udiRelevanceEntity.getMainId()).last("limit 1"));
if (StrUtil.isEmpty(thrProductsEntity.getCode())) {
uploadLog.setStatus(3);
uploadLog.setResult("提交失败,错误信息:" + "产品DI未关联第三方产品信息");
orderUploadLogService.insertOrUpdate(uploadLog);
return ResultVOUtils.error(500, "提交失败");
} else {
item.setProductId(thrProductsEntity.getCode());
item.setProductName(thrProductsEntity.getName());
}
items.add(item);
} catch (Exception e) {
log.error(e.getMessage(), e);
uploadLog.setStatus(3);
uploadLog.setResult("提交失败,错误信息:" + e.getMessage());
orderUploadLogService.insertOrUpdate(uploadLog);
return ResultVOUtils.error(500, "提交失败");
}
}
Collections.reverse(items);
phOrderRequest.setItem(items);
return submitOrderUtil.submitOrder(orderEntity, phOrderRequest);
}
/**
*
*
* @param ioCodeEntities
* @param orderDetailRequests
* @param detailBizEntities
*/
private void setOrderDetailList(List<IoCodeEntity> ioCodeEntities, List<UdiwmsOrderDetailRequest> orderDetailRequests, List<IoOrderDetailBizEntity> detailBizEntities) {
for (IoOrderDetailBizEntity detailBizEntity : detailBizEntities) {
UdiwmsOrderDetailRequest item = submitOrderUtil.buildProductInfo(detailBizEntity);
//封装条码信息
submitOrderUtil.setCodeList(ioCodeEntities, detailBizEntity, item);
orderDetailRequests.add(item);
public List<IoOrderDetailBizEntity> transferSerList(List<IoOrderDetailBizEntity> stockOrderDetailEntities, String orderId) {
List<IoOrderDetailBizEntity> resultList = new ArrayList<>();
List<IoCodeEntity> ioCodeEntities = codeDao.selectList(new LambdaQueryWrapper<IoCodeEntity>()
.eq(IoCodeEntity::getOrderId, orderId)
);
if (CollUtil.isNotEmpty(ioCodeEntities)) {
for (IoCodeEntity codeDetaiEntity : ioCodeEntities) {
if (CollUtil.isNotEmpty(stockOrderDetailEntities)) {
for (IoOrderDetailBizEntity stockOrderDetailEntity : stockOrderDetailEntities) {
if (IntUtil.value(codeDetaiEntity.getRelId()) == IntUtil.value(stockOrderDetailEntity.getBindRlFk())
&& StrUtil.trimToEmpty(codeDetaiEntity.getBatchNo()).equals(StrUtil.trimToEmpty(stockOrderDetailEntity.getBatchNo()))) {
IoOrderDetailBizEntity item = new IoOrderDetailBizEntity();
BeanUtils.copyProperties(stockOrderDetailEntity, item);
item.setSerialNo(codeDetaiEntity.getSerialNo());
item.setCount(codeDetaiEntity.getReCount());
item.setReCount(codeDetaiEntity.getReCount());
resultList.add(item);
break;
}
}
}
}
}
return resultList;
}
@Override
public BaseResponse getInvProducts(UdiwmsInvProductsRequest udiwmsInvProductsRequest) {
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_INV_PI_URL), udiwmsInvProductsRequest);

@ -257,6 +257,7 @@ public class PtxhyyClient extends CommonHttpClient {
hsfl = thrHslbEntity.getHsbm();
}
}
// .udim(udim)
BigDecimal wzje = i.getPrice().multiply(BigDecimal.valueOf(i.getCount().intValue()));
PtxhyyOrderDetailRequest detailRequest = PtxhyyOrderDetailRequest.builder()
.wzxh(i.getProductId())
@ -267,7 +268,6 @@ public class PtxhyyClient extends CommonHttpClient {
.lsjg(i.getPrice() + "")
.lsje(wzje)
.wzje(wzje + "")
.udim(udim)
.hsfl(hsfl)
.wzph(i.getBatchNo())
.fphm(fphm)
@ -342,15 +342,12 @@ public class PtxhyyClient extends CommonHttpClient {
if (StrUtil.isNotEmpty(orderEntity.getReviewUser())) {
AuthUserEntity authUserEntity = authUserDao.selectById(orderEntity.getReviewUser());
return authUserEntity.getUserName();
} else if (StrUtil.isNotEmpty(orderEntity.getReviewUser())) {
AuthUserEntity authUserEntity = authUserDao.selectById(orderEntity.getReviewUser());
} else if (StrUtil.isNotEmpty(orderEntity.getUpdateUser()) && orderEntity.getUpdateUser().length() != 14) {
AuthUserEntity authUserEntity = authUserDao.selectById(orderEntity.getUpdateUser());
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 {
List<AuthWarehouseUser> authWarehouseUsers = authWarehouseUserMapper.selectList(new QueryWrapper<AuthWarehouseUser>().eq("code", orderEntity.getInvCode()));
if (CollUtil.isNotEmpty(authWarehouseUsers)) {

@ -12,20 +12,24 @@ import com.glxp.mipsdl.constant.Constants;
import com.glxp.mipsdl.dao.auth.AuthWarehouseDao;
import com.glxp.mipsdl.dao.basic.BasicBussinessTypeDao;
import com.glxp.mipsdl.dao.basic.BasicCorpDao;
import com.glxp.mipsdl.dao.basic.BasicUdirelDao;
import com.glxp.mipsdl.dao.inout.IoCodeDao;
import com.glxp.mipsdl.dao.inout.IoOrderDao;
import com.glxp.mipsdl.dao.inout.IoOrderDetailBizDao;
import com.glxp.mipsdl.dao.thrsys.ThrBustypeOriginDao;
import com.glxp.mipsdl.dao.thrsys.ThrInvWarehouseDao;
import com.glxp.mipsdl.dao.thrsys.ThrProductsDao;
import com.glxp.mipsdl.dao.thrsys.ThrSystemBusApiDao;
import com.glxp.mipsdl.entity.auth.AuthWarehouseEntity;
import com.glxp.mipsdl.entity.basic.BasicBussinessTypeEntity;
import com.glxp.mipsdl.entity.basic.BasicCorpEntity;
import com.glxp.mipsdl.entity.basic.BasicUdirelEntity;
import com.glxp.mipsdl.entity.inout.IoCodeEntity;
import com.glxp.mipsdl.entity.inout.IoOrderDetailBizEntity;
import com.glxp.mipsdl.entity.inout.IoOrderEntity;
import com.glxp.mipsdl.entity.thrsys.ThrCorpEntity;
import com.glxp.mipsdl.entity.thrsys.ThrInvWarehouseEntity;
import com.glxp.mipsdl.entity.thrsys.ThrProductsEntity;
import com.glxp.mipsdl.entity.thrsys.ThrSystemBusApiEntity;
import com.glxp.mipsdl.http.HttpClient;
import com.glxp.mipsdl.req.base.*;
@ -90,6 +94,10 @@ public class YxzyyClient implements BaseHttpClient {
private IoOrderDetailBizDao orderDetailBizDao;
@Resource
private SubmitOrderUtil submitOrderUtil;
@Resource
private ThrProductsDao thrProductsDao;
@Resource
private BasicUdirelDao basicUdirelDao;
@Override
public BaseResponse getUnit(UdiwmsUnitRequest udiwmsUnitRequest) {
@ -141,15 +149,13 @@ public class YxzyyClient implements BaseHttpClient {
BeanUtil.copyProperties(udiwmsOrderRequest, dsOrderRequest);
//查询单据和详情信息,组装第三方系统接口参数
IoOrderEntity orderEntity = orderDao.selectOne(new LambdaQueryWrapper<IoOrderEntity>().eq(IoOrderEntity::getBillNo, udiwmsOrderRequest.getBillNo()));
IoOrderEntity orderEntity = orderDao.selectOne(new LambdaQueryWrapper<IoOrderEntity>().eq(IoOrderEntity::getBillNo, udiwmsOrderRequest.getBillNo()).last("limit 1"));
dsOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime()));
//查询对应的第三方单据类型
ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new LambdaQueryWrapper<ThrSystemBusApiEntity>().eq(ThrSystemBusApiEntity::getCode, udiwmsOrderRequest.getBillType()));
ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new LambdaQueryWrapper<ThrSystemBusApiEntity>().eq(ThrSystemBusApiEntity::getCode, udiwmsOrderRequest.getBillType()).last("limit 1"));
if (StrUtil.isBlank(thrSystemBusApiEntity.getUrl())) {
return ResultVOUtils.error(500, "接口未配置,无法提交!");
}
dsOrderRequest.setBillType(thrSystemBusApiEntity.getThirdBuyCode());
//查询单据类型,设置往来单位信息
@ -209,6 +215,9 @@ public class YxzyyClient implements BaseHttpClient {
.eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
dsOrderRequest.setLocStorageCode("29");
dsOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName());
udiwmsOrderRequest.setLocInvCode("29");
udiwmsOrderRequest.setLocInvName(thrInvWarehouseEntity.getName());
}
dsOrderRequest.setBillFlag("1");
@ -224,7 +233,6 @@ public class YxzyyClient implements BaseHttpClient {
//组装单据明细数据
List<IoCodeEntity> ioCodeEntities = codeDao.selectList(new LambdaQueryWrapper<IoCodeEntity>()
.eq(IoCodeEntity::getOrderId, orderEntity.getBillNo())
.ne(IoCodeEntity::getAction, "StockCheck")
);
List<UdiwmsOrderDetailRequest> items = new ArrayList<>();
@ -252,6 +260,15 @@ public class YxzyyClient implements BaseHttpClient {
private void setOrderDetailList(List<IoCodeEntity> ioCodeEntities, List<UdiwmsOrderDetailRequest> orderDetailRequests, List<IoOrderDetailBizEntity> detailBizEntities) {
for (IoOrderDetailBizEntity detailBizEntity : detailBizEntities) {
UdiwmsOrderDetailRequest item = submitOrderUtil.buildProductInfo(detailBizEntity);
if (StrUtil.isEmpty(item.getRegisterNo())
|| item.getRegisterNo().contains(";")
|| item.getRegisterNo().contains(",")
|| item.getRegisterNo().contains("")) {
BasicUdirelEntity basicUdirel = basicUdirelDao.selectById(detailBizEntity.getBindRlFk());
ThrProductsEntity thrProductsEntity = thrProductsDao.selectOne(new LambdaQueryWrapper<ThrProductsEntity>()
.eq(ThrProductsEntity::getCode, basicUdirel.getThirdId()).last("limit 1"));
item.setRegisterNo(thrProductsEntity.getRegisterNo());
}
//封装条码信息
submitOrderUtil.setCodeList(ioCodeEntities, detailBizEntity, item);

@ -2,6 +2,7 @@ package com.glxp.mipsdl.client.zaxyy;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSONObject;
@ -15,21 +16,27 @@ import com.glxp.mipsdl.dao.auth.AuthUserDao;
import com.glxp.mipsdl.dao.auth.AuthWarehouseDao;
import com.glxp.mipsdl.dao.basic.BasicBussinessTypeDao;
import com.glxp.mipsdl.dao.basic.BasicCorpDao;
import com.glxp.mipsdl.dao.basic.BasicProductsDao;
import com.glxp.mipsdl.dao.basic.BasicUdirelDao;
import com.glxp.mipsdl.dao.inout.IoCodeDao;
import com.glxp.mipsdl.dao.inout.IoOrderDao;
import com.glxp.mipsdl.dao.inout.IoOrderDetailBizDao;
import com.glxp.mipsdl.dao.inout.IoOrderUploadLogDao;
import com.glxp.mipsdl.dao.thrsys.ThrInvWarehouseDao;
import com.glxp.mipsdl.dao.thrsys.ThrProductsDao;
import com.glxp.mipsdl.dao.thrsys.ThrSystemBusApiDao;
import com.glxp.mipsdl.entity.auth.AuthUserEntity;
import com.glxp.mipsdl.entity.auth.AuthWarehouseEntity;
import com.glxp.mipsdl.entity.basic.BasicBussinessTypeEntity;
import com.glxp.mipsdl.entity.basic.BasicProductsEntity;
import com.glxp.mipsdl.entity.basic.BasicUdirelEntity;
import com.glxp.mipsdl.entity.inout.IoCodeEntity;
import com.glxp.mipsdl.entity.inout.IoOrderDetailBizEntity;
import com.glxp.mipsdl.entity.inout.IoOrderEntity;
import com.glxp.mipsdl.entity.inout.IoOrderUploadLogEntity;
import com.glxp.mipsdl.entity.thrsys.ThrCorpEntity;
import com.glxp.mipsdl.entity.thrsys.ThrInvWarehouseEntity;
import com.glxp.mipsdl.entity.thrsys.ThrProductsEntity;
import com.glxp.mipsdl.entity.thrsys.ThrSystemBusApiEntity;
import com.glxp.mipsdl.http.HttpClient;
import com.glxp.mipsdl.req.base.*;
@ -44,6 +51,7 @@ import com.glxp.mipsdl.service.auth.AuthWarehouseService;
import com.glxp.mipsdl.service.thrsys.ThrCorpService;
import com.glxp.mipsdl.service.thrsys.ThrSystemDetailService;
import com.glxp.mipsdl.util.DateUtil;
import com.glxp.mipsdl.util.IntUtil;
import com.glxp.mipsdl.util.ResultVOUtils;
import com.glxp.mipsdl.util.SubmitOrderUtil;
import lombok.extern.slf4j.Slf4j;
@ -97,6 +105,12 @@ public class ZaxyyClient implements BaseHttpClient {
private IoOrderUploadLogDao orderUploadLogDao;
@Resource
private SubmitOrderUtil submitOrderUtil;
@Resource
private BasicUdirelDao basicUdirelDao;
@Resource
private BasicProductsDao basicProductsDao;
@Resource
private ThrProductsDao thrProductsDao;
/**
@ -205,8 +219,7 @@ public class ZaxyyClient implements BaseHttpClient {
ZaxzyyOrderRequest zaxzyyOrderRequest = new ZaxzyyOrderRequest();
BeanUtil.copyProperties(udiwmsOrderRequest, zaxzyyOrderRequest);
//查询单据和详情信息,组装第三方系统接口所需参数
IoOrderEntity orderEntity = orderDao.selectOne(new QueryWrapper<IoOrderEntity>().eq("billNo", udiwmsOrderRequest.getBillNo()));
IoOrderEntity orderEntity = orderDao.selectOne(new QueryWrapper<IoOrderEntity>().eq("billNo", udiwmsOrderRequest.getBillNo()).last("limit 1"));
zaxzyyOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime()));
//查询对应的第三方单据类型
ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new QueryWrapper<ThrSystemBusApiEntity>().eq("code", udiwmsOrderRequest.getBillType()));
@ -387,7 +400,7 @@ public class ZaxyyClient implements BaseHttpClient {
*/
private void setOrderDetailList(List<IoCodeEntity> ioCodeEntities, List<UdiwmsOrderDetailRequest> orderDetailRequests, List<IoOrderDetailBizEntity> detailBizEntities) {
for (IoOrderDetailBizEntity detailBizEntity : detailBizEntities) {
UdiwmsOrderDetailRequest item = submitOrderUtil.buildProductInfo(detailBizEntity);
UdiwmsOrderDetailRequest item = buildProductInfo(detailBizEntity);
//封装条码信息
submitOrderUtil.setCodeList(ioCodeEntities, detailBizEntity, item);
@ -396,6 +409,49 @@ public class ZaxyyClient implements BaseHttpClient {
}
}
public UdiwmsOrderDetailRequest buildProductInfo(IoOrderDetailBizEntity detailBizEntity) {
//查询产品信息
BasicUdirelEntity basicUdirel = basicUdirelDao.selectById(detailBizEntity.getBindRlFk());
BasicProductsEntity basicProducts = basicProductsDao.selectOne(new LambdaQueryWrapper<BasicProductsEntity>().eq(BasicProductsEntity::getUuid, basicUdirel.getUuid()).last("limit 1"));
UdiwmsOrderDetailRequest item = new UdiwmsOrderDetailRequest();
BeanUtil.copyProperties(detailBizEntity, item);
item.setProductDate(DateUtil.formatExpireTime(StrUtil.isBlank(detailBizEntity.getProductDate()) ? null : "20" + detailBizEntity.getProductDate()));
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"));
if (thrProductsEntity == null) {
log.error("第三方产品编码未关联");
return null;
}
item.setProductName(thrProductsEntity.getName()); //产品名称
item.setBindRlFk(detailBizEntity.getBindRlFk());
item.setStandard(detailBizEntity.getSpec()); //规格型号
item.setBillNo(detailBizEntity.getOrderIdFk()); //单据号
item.setRegisterNo(detailBizEntity.getCertCode()); //注册/备案证号
item.setPrice(detailBizEntity.getPrice());
item.setFirstSalesInvNo(detailBizEntity.getFirstSalesInvNo());
item.setSecSalesInvNo(detailBizEntity.getSecSalesInvNo());
item.setInvoiceDate(detailBizEntity.getInvoiceDate());
item.setSecSalesListNo(detailBizEntity.getSecSalesListNo());
item.setDiCode(detailBizEntity.getNameCode());
item.setManufactory(basicProducts.getManufactory()); //生产厂家
item.setMeasname(basicProducts.getMeasname()); //计量单位
item.setAllowNoBatch(IntUtil.value(basicProducts.getAllowNoBatch())); //是否允许无批次号
item.setManufactoryCode(thrProductsEntity.getManufactoryCode());
item.setSupCode(thrProductsEntity.getSupCode());
item.setCplb(thrProductsEntity.getFlbm());
item.setCount(detailBizEntity.getCount());
return item;
}
@Override
public BaseResponse getInvProducts(UdiwmsInvProductsRequest udiwmsInvProductsRequest) {
ZaZyRequest zaZyRequest = new ZaZyRequest();

@ -185,5 +185,7 @@ public class IoOrderDetailBizEntity {
@TableField(value = "remark5")
private String remark5;
@TableField(exist = false)
private String serialNo;
}
}

@ -139,6 +139,7 @@ public class UdiwmsOrderDetailRequest {
private String supCode;
private String cplb;
private String diCode;
/**
*

@ -56,7 +56,10 @@ public class UdiwmsOrderRequest {
*
*/
private String remark;
/**
*
*/
private String operUser; //
/**
*
*/

@ -117,7 +117,7 @@ public class SubmitOrderUtil {
item.setProductId(thirdProductId); //产品ID
//查询第三方产品名称
ThrProductsEntity thrProductsEntity = thrProductsDao.selectOne(new LambdaQueryWrapper<ThrProductsEntity>()
.eq(ThrProductsEntity::getCode, thirdProductId));
.eq(ThrProductsEntity::getCode, thirdProductId).last("limit 1"));
if (thrProductsEntity == null) {
log.error("第三方产品编码未关联");
return null;

Loading…
Cancel
Save