|
|
@ -4,7 +4,11 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.constant.ConstantStatus;
|
|
|
|
import com.glxp.api.admin.constant.ConstantType;
|
|
|
|
import com.glxp.api.admin.constant.ConstantType;
|
|
|
|
import com.glxp.api.admin.dao.basic.BasicThirdSysBusApiDao;
|
|
|
|
import com.glxp.api.admin.dao.basic.BasicThirdSysBusApiDao;
|
|
|
|
import com.glxp.api.admin.dao.basic.BasicThirdSysDao;
|
|
|
|
import com.glxp.api.admin.dao.basic.BasicThirdSysDao;
|
|
|
@ -13,20 +17,30 @@ import com.glxp.api.admin.dao.basic.UnitMaintainDao;
|
|
|
|
import com.glxp.api.admin.dao.business.StockOrderDao;
|
|
|
|
import com.glxp.api.admin.dao.business.StockOrderDao;
|
|
|
|
import com.glxp.api.admin.dao.business.StockOrderDetailDao;
|
|
|
|
import com.glxp.api.admin.dao.business.StockOrderDetailDao;
|
|
|
|
import com.glxp.api.admin.dao.inout.OrderDao;
|
|
|
|
import com.glxp.api.admin.dao.inout.OrderDao;
|
|
|
|
import com.glxp.api.admin.entity.basic.BasicThirdSysBusApiEntity;
|
|
|
|
import com.glxp.api.admin.entity.basic.*;
|
|
|
|
import com.glxp.api.admin.entity.basic.BasicThirdSysEntity;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.entity.basic.UnitMaintainEntity;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.entity.business.StockOrderDetailEntity;
|
|
|
|
import com.glxp.api.admin.entity.business.StockOrderDetailEntity;
|
|
|
|
import com.glxp.api.admin.entity.business.StockOrderEntity;
|
|
|
|
import com.glxp.api.admin.entity.business.StockOrderEntity;
|
|
|
|
import com.glxp.api.admin.entity.business.StockOrderPrintEntity;
|
|
|
|
import com.glxp.api.admin.entity.business.StockOrderPrintEntity;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.entity.inout.OrderEntity;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.entity.inventory.InvWarehouseEntity;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.entity.thrsys.ThrInvWarehouseEntity;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.httpclient.UdiwmsOrderResponse;
|
|
|
|
import com.glxp.api.admin.httpclient.req.UdiwmsOrderDetail;
|
|
|
|
import com.glxp.api.admin.httpclient.req.UdiwmsOrderDetail;
|
|
|
|
import com.glxp.api.admin.httpclient.req.UdiwmsOrderRequest;
|
|
|
|
import com.glxp.api.admin.httpclient.req.UdiwmsOrderRequest;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.req.basic.BussinessLocalTypeFilterRequest;
|
|
|
|
import com.glxp.api.admin.req.business.StockOrderDetailFilterRequest;
|
|
|
|
import com.glxp.api.admin.req.business.StockOrderDetailFilterRequest;
|
|
|
|
import com.glxp.api.admin.req.business.StockOrderFilterRequest;
|
|
|
|
import com.glxp.api.admin.req.business.StockOrderFilterRequest;
|
|
|
|
import com.glxp.api.admin.req.business.StockOrderQueryRequest;
|
|
|
|
import com.glxp.api.admin.req.business.StockOrderQueryRequest;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.res.basic.BussinessTypResponse;
|
|
|
|
import com.glxp.api.admin.res.business.StockOrderDetailEntityVo;
|
|
|
|
import com.glxp.api.admin.res.business.StockOrderDetailEntityVo;
|
|
|
|
import com.glxp.api.admin.res.business.StockOrderExportResponse;
|
|
|
|
import com.glxp.api.admin.res.business.StockOrderExportResponse;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.service.basic.BussinessLocalTypeService;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.service.basic.BussinessTypeService;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.service.basic.UdiRelevanceService;
|
|
|
|
import com.glxp.api.admin.service.business.StockOrderService;
|
|
|
|
import com.glxp.api.admin.service.business.StockOrderService;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.service.inout.OrderService;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.service.inventory.InvWarehouseService;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.service.thrsys.ThrInvWarehouseService;
|
|
|
|
import com.glxp.api.admin.util.HttpClient;
|
|
|
|
import com.glxp.api.admin.util.HttpClient;
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
@ -56,6 +70,16 @@ public class StockOrderServiceImpl implements StockOrderService {
|
|
|
|
private BasicThirdSysDao basicThirdSysDao;
|
|
|
|
private BasicThirdSysDao basicThirdSysDao;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private OrderDao orderDao;
|
|
|
|
private OrderDao orderDao;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private OrderService orderService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
BussinessLocalTypeService bussinessLocalTypeService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
InvWarehouseService invWarehouseService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
ThrInvWarehouseService thrInvWarehouseService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
UdiRelevanceService udiRelevanceService;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<StockOrderEntity> listStockOrders(StockOrderQueryRequest stockOrderQueryRequest) {
|
|
|
|
public List<StockOrderEntity> listStockOrders(StockOrderQueryRequest stockOrderQueryRequest) {
|
|
|
@ -184,15 +208,37 @@ public class StockOrderServiceImpl implements StockOrderService {
|
|
|
|
UdiwmsOrderRequest udiwmsOrderRequest = new UdiwmsOrderRequest();
|
|
|
|
UdiwmsOrderRequest udiwmsOrderRequest = new UdiwmsOrderRequest();
|
|
|
|
udiwmsOrderRequest.setBillDate(stockOrderEntity.getBilldate()); //单据日期
|
|
|
|
udiwmsOrderRequest.setBillDate(stockOrderEntity.getBilldate()); //单据日期
|
|
|
|
udiwmsOrderRequest.setBillNo(stockOrderEntity.getBillNo()); //单号
|
|
|
|
udiwmsOrderRequest.setBillNo(stockOrderEntity.getBillNo()); //单号
|
|
|
|
//查询往来单位第三方系统对照编码
|
|
|
|
BussinessLocalTypeEntity bussinessLocalTypeEntity = bussinessLocalTypeService.findBTByAction(stockOrderEntity.getBillType());
|
|
|
|
UnitMaintainEntity unitMaintainEntity = unitMaintainDao.selectThirdInfoByErpId(stockOrderEntity.getCorpId());
|
|
|
|
|
|
|
|
udiwmsOrderRequest.setCorpId(unitMaintainEntity.getThirdId()); //往来单位编码,需转换为第三方系统的ID
|
|
|
|
|
|
|
|
udiwmsOrderRequest.setCorpName(unitMaintainEntity.getThirdName()); //往来单位名称,需转换为第三方系统的名称
|
|
|
|
|
|
|
|
udiwmsOrderRequest.setBillFlag(stockOrderEntity.getBillFlag());//单据状态
|
|
|
|
|
|
|
|
//查询第三方系统的单据ID,及第三方系统标识
|
|
|
|
//查询第三方系统的单据ID,及第三方系统标识
|
|
|
|
BasicThirdSysBusApiEntity thirdSysBusApiEntity = thirdSysBusApiDao.selectByCode(stockOrderEntity.getBillType());
|
|
|
|
BasicThirdSysBusApiEntity thirdSysBusApiEntity = thirdSysBusApiDao.selectByCode(stockOrderEntity.getBillType());
|
|
|
|
udiwmsOrderRequest.setThirdSys(thirdSysBusApiEntity.getThirdSys()); //第三方系统标识
|
|
|
|
udiwmsOrderRequest.setThirdSys(thirdSysBusApiEntity.getThirdSys()); //第三方系统标识
|
|
|
|
udiwmsOrderRequest.setBillType(thirdSysBusApiEntity.getThirdBuyName());
|
|
|
|
udiwmsOrderRequest.setBillType(thirdSysBusApiEntity.getThirdBuyCode());
|
|
|
|
|
|
|
|
if (bussinessLocalTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INPUT) {
|
|
|
|
|
|
|
|
udiwmsOrderRequest.setCorpId(stockOrderEntity.getCorpName()); //往来单位编码,需转换为第三方系统的ID
|
|
|
|
|
|
|
|
udiwmsOrderRequest.setCorpName(stockOrderEntity.getCorpName()); //往来单位名称,需转换为第三方系统的名称
|
|
|
|
|
|
|
|
} else if (bussinessLocalTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INNOR) {
|
|
|
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseService.selectByCode(stockOrderEntity.getCorpId());
|
|
|
|
|
|
|
|
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseService.selectByCode(invWarehouseEntity.getThirdId());
|
|
|
|
|
|
|
|
udiwmsOrderRequest.setCorpId(thrInvWarehouseEntity.getCode()); //往来单位编码,需转换为第三方系统的ID
|
|
|
|
|
|
|
|
udiwmsOrderRequest.setCorpName(thrInvWarehouseEntity.getName()); //往来单位名称,需转换为第三方系统的名称
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (bussinessLocalTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
|
|
|
|
|
|
|
|
//查询往来单位第三方系统对照编码
|
|
|
|
|
|
|
|
UnitMaintainEntity
|
|
|
|
|
|
|
|
unitMaintainEntity = unitMaintainDao.selectThirdInfoByErpId(stockOrderEntity.getCorpId());
|
|
|
|
|
|
|
|
udiwmsOrderRequest.setCorpId(unitMaintainEntity.getThirdId()); //往来单位编码,需转换为第三方系统的ID
|
|
|
|
|
|
|
|
udiwmsOrderRequest.setCorpName(unitMaintainEntity.getThirdName()); //往来单位名称,需转换为第三方系统的名称
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseService.selectByCode(stockOrderEntity.getLocStorageCode());
|
|
|
|
|
|
|
|
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseService.selectByCode(invWarehouseEntity.getThirdId());
|
|
|
|
|
|
|
|
udiwmsOrderRequest.setLocStorageCode(thrInvWarehouseEntity.getCode());
|
|
|
|
|
|
|
|
udiwmsOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
udiwmsOrderRequest.setBillFlag(stockOrderEntity.getBillFlag());//单据状态
|
|
|
|
|
|
|
|
|
|
|
|
//查询单据出入库类型
|
|
|
|
//查询单据出入库类型
|
|
|
|
String mainAction = bussinessTypeDao.selectInoutTypebByLocalAction(stockOrderEntity.getBillType());
|
|
|
|
String mainAction = bussinessTypeDao.selectInoutTypebByLocalAction(stockOrderEntity.getBillType());
|
|
|
|
if (ConstantType.TYPE_PUT.equals(mainAction)) {
|
|
|
|
if (ConstantType.TYPE_PUT.equals(mainAction)) {
|
|
|
@ -206,22 +252,36 @@ public class StockOrderServiceImpl implements StockOrderService {
|
|
|
|
//组装明细数据
|
|
|
|
//组装明细数据
|
|
|
|
List<UdiwmsOrderDetail> items = new ArrayList<>(stockOrderDetailEntities.size());
|
|
|
|
List<UdiwmsOrderDetail> items = new ArrayList<>(stockOrderDetailEntities.size());
|
|
|
|
for (StockOrderDetailEntity stockOrderDetailEntity : stockOrderDetailEntities) {
|
|
|
|
for (StockOrderDetailEntity stockOrderDetailEntity : stockOrderDetailEntities) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(stockOrderDetailEntity.getRelId());
|
|
|
|
UdiwmsOrderDetail item = new UdiwmsOrderDetail();
|
|
|
|
UdiwmsOrderDetail item = new UdiwmsOrderDetail();
|
|
|
|
BeanUtil.copyProperties(stockOrderDetailEntity, item);
|
|
|
|
BeanUtil.copyProperties(stockOrderDetailEntity, item);
|
|
|
|
|
|
|
|
item.setProductId(udiRelevanceEntity.getThirdId());
|
|
|
|
|
|
|
|
item.setProductName(udiRelevanceEntity.getThirdName());
|
|
|
|
items.add(item);
|
|
|
|
items.add(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
udiwmsOrderRequest.setItems(items);
|
|
|
|
udiwmsOrderRequest.setItem(items);
|
|
|
|
|
|
|
|
|
|
|
|
//提交单据到第三方服务
|
|
|
|
//提交单据到第三方服务
|
|
|
|
BasicThirdSysEntity basicThirdSysEntity = basicThirdSysDao.selectByThirdId(thirdSysBusApiEntity.getThirdSys());
|
|
|
|
BasicThirdSysEntity basicThirdSysEntity = basicThirdSysDao.selectByThirdId(thirdSysBusApiEntity.getThirdSys());
|
|
|
|
String response = HttpClient.uCloudPost(basicThirdSysEntity.getThridUrl() + "/udiwms/erp/submitOrders", udiwmsOrderRequest);
|
|
|
|
String response = HttpClient.uCloudPost(basicThirdSysEntity.getThridUrl() + "/udiwms/erp/submitOrders", udiwmsOrderRequest);
|
|
|
|
if (StrUtil.isNotBlank(response)) {
|
|
|
|
if (StrUtil.isNotBlank(response)) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
BaseResponse baseResponse = JSONUtil.toBean(response, BaseResponse.class);
|
|
|
|
|
|
|
|
|
|
|
|
BaseResponse<UdiwmsOrderResponse> baseResponse = JSONObject.parseObject(response, new TypeReference<BaseResponse<UdiwmsOrderResponse>>() {
|
|
|
|
|
|
|
|
});
|
|
|
|
if (baseResponse.getCode().equals(20000)) {
|
|
|
|
if (baseResponse.getCode().equals(20000)) {
|
|
|
|
|
|
|
|
UdiwmsOrderResponse udiwmsOrderResponse = baseResponse.getData();
|
|
|
|
|
|
|
|
|
|
|
|
//提交成功,更新导出状态
|
|
|
|
//提交成功,更新导出状态
|
|
|
|
orderDao.updateExportStatus(stockOrderEntity.getOrderIdFk(), 1);
|
|
|
|
OrderEntity orderEntity =
|
|
|
|
|
|
|
|
orderService.findById(stockOrderEntity.getOrderIdFk());
|
|
|
|
|
|
|
|
orderEntity.setExportStatus(1);
|
|
|
|
|
|
|
|
if (udiwmsOrderResponse != null) {
|
|
|
|
|
|
|
|
orderEntity.setThirdBillNo(udiwmsOrderResponse.getThirdBillNo());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
return ResultVOUtils.success("提交成功");
|
|
|
|
return ResultVOUtils.success("提交成功");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ResultVOUtils.error(500, "提交失败");
|
|
|
|
return ResultVOUtils.error(500, "提交失败");
|
|
|
|