|
|
|
@ -1,25 +1,54 @@
|
|
|
|
|
package com.glxp.mipsdl.admin.client.http;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
|
|
import com.glxp.mipsdl.admin.entity.test.TestOrderResponse;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.glxp.mipsdl.admin.constant.ConstantStatus;
|
|
|
|
|
import com.glxp.mipsdl.admin.constant.ConstantType;
|
|
|
|
|
import com.glxp.mipsdl.admin.dao.basic.BussinessTypeDao;
|
|
|
|
|
import com.glxp.mipsdl.admin.dao.basic.UdiRelevanceDao;
|
|
|
|
|
import com.glxp.mipsdl.admin.dao.business.StockOrderDao;
|
|
|
|
|
import com.glxp.mipsdl.admin.dao.business.StockOrderDetailDao;
|
|
|
|
|
import com.glxp.mipsdl.admin.dao.business.StockOrderUploadLogDao;
|
|
|
|
|
import com.glxp.mipsdl.admin.dao.inout.CodesDao;
|
|
|
|
|
import com.glxp.mipsdl.admin.dao.inout.OrderDao;
|
|
|
|
|
import com.glxp.mipsdl.admin.dao.test.*;
|
|
|
|
|
import com.glxp.mipsdl.admin.entity.basic.BussinessLocalTypeEntity;
|
|
|
|
|
import com.glxp.mipsdl.admin.entity.basic.BussinessOriginTypeEntity;
|
|
|
|
|
import com.glxp.mipsdl.admin.entity.basic.UdiRelevanceEntity;
|
|
|
|
|
import com.glxp.mipsdl.admin.entity.business.StockOrderDetailEntity;
|
|
|
|
|
import com.glxp.mipsdl.admin.entity.business.StockOrderEntity;
|
|
|
|
|
import com.glxp.mipsdl.admin.entity.business.StockOrderUploadLogEntity;
|
|
|
|
|
import com.glxp.mipsdl.admin.entity.inout.OrderEntity;
|
|
|
|
|
import com.glxp.mipsdl.admin.entity.inout.WarehouseEntity;
|
|
|
|
|
import com.glxp.mipsdl.admin.entity.thrsys.ThrCorpEntity;
|
|
|
|
|
import com.glxp.mipsdl.admin.entity.thrsys.ThrInvWarehouseEntity;
|
|
|
|
|
import com.glxp.mipsdl.admin.entity.thrsys.ThrProductsEntity;
|
|
|
|
|
import com.glxp.mipsdl.admin.entity.thrsys.ThrSubInvWarehouseEntity;
|
|
|
|
|
import com.glxp.mipsdl.admin.req.*;
|
|
|
|
|
import com.glxp.mipsdl.admin.req.phxyy.PhUnitRequest;
|
|
|
|
|
import com.glxp.mipsdl.admin.req.phxyy.BussinessOriginTypeFilterRequest;
|
|
|
|
|
import com.glxp.mipsdl.admin.req.thrsys.FilterThrCorpRequest;
|
|
|
|
|
import com.glxp.mipsdl.admin.req.thrsys.FilterThrInvWarehouseRequest;
|
|
|
|
|
import com.glxp.mipsdl.admin.req.thrsys.FilterThrProductsRequest;
|
|
|
|
|
import com.glxp.mipsdl.admin.res.system.*;
|
|
|
|
|
import com.glxp.mipsdl.admin.util.CustomUtil;
|
|
|
|
|
import com.glxp.mipsdl.admin.util.FileUtils;
|
|
|
|
|
import com.glxp.mipsdl.admin.util.SubmitOrderUtils;
|
|
|
|
|
import com.glxp.mipsdl.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.mipsdl.common.util.ResultVOUtils;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 测试客户端,用于模拟测试数据
|
|
|
|
@ -29,20 +58,55 @@ import java.util.Map;
|
|
|
|
|
public class TestClient {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
TestBusTypeDao testBusTypeDao;
|
|
|
|
|
@Resource
|
|
|
|
|
TestCorpDao testCorpDao;
|
|
|
|
|
@Resource
|
|
|
|
|
TestInvWarehouseDao testInvWarehouseDao;
|
|
|
|
|
@Resource
|
|
|
|
|
TestProductDao testProductDao;
|
|
|
|
|
@Value("${THIRD_ID}")
|
|
|
|
|
private String thirdId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BaseResponse testConnect() {
|
|
|
|
|
return ResultVOUtils.success("连接成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询往来单位信息
|
|
|
|
|
*
|
|
|
|
|
* @param testUnitRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public BaseResponse getUnit(PhUnitRequest testUnitRequest) {
|
|
|
|
|
public BaseResponse getUnit(UdiwmsUnitRequest udiwmsUnitRequest) {
|
|
|
|
|
FilterThrCorpRequest filterThrCorpRequest = new FilterThrCorpRequest();
|
|
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(udiwmsUnitRequest, filterThrCorpRequest);
|
|
|
|
|
filterThrCorpRequest.setThirdSysFk(udiwmsUnitRequest.getThirdSys());
|
|
|
|
|
List<ThrCorpEntity> thrCorpEntities = testCorpDao.filterThrCorps(filterThrCorpRequest);
|
|
|
|
|
|
|
|
|
|
String data = FileUtils.readFileAll("E:\\第三方测试数据\\第三方往来单位测试数据.json");
|
|
|
|
|
BaseResponse<PageSimpleResponse<UdiwmsUnitResponse>> udiDlDeviceResponse =
|
|
|
|
|
JSONObject.parseObject(data, new TypeReference<BaseResponse<PageSimpleResponse<UdiwmsUnitResponse>>>() {
|
|
|
|
|
});
|
|
|
|
|
return udiDlDeviceResponse;
|
|
|
|
|
List<UdiwmsUnitResponse> udiwmsUnitResponses = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(thrCorpEntities)) {
|
|
|
|
|
for (ThrCorpEntity thrCorpEntity : thrCorpEntities) {
|
|
|
|
|
UdiwmsUnitResponse udiwmsUnitResponse = new UdiwmsUnitResponse();
|
|
|
|
|
BeanUtils.copyProperties(thrCorpEntity, udiwmsUnitResponse);
|
|
|
|
|
udiwmsUnitResponses.add(udiwmsUnitResponse);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// String data = FileUtils.readFileAll("E:\\第三方测试数据\\第三方往来单位测试数据.json");
|
|
|
|
|
// BaseResponse<PageSimpleResponse<UdiwmsUnitResponse>> udiDlDeviceResponse =
|
|
|
|
|
// JSONObject.parseObject(data, new TypeReference<BaseResponse<PageSimpleResponse<UdiwmsUnitResponse>>>() {
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
PageInfo<UdiwmsUnitResponse> pageInfo;
|
|
|
|
|
pageInfo = new PageInfo<>(udiwmsUnitResponses);
|
|
|
|
|
PageSimpleResponse<UdiwmsUnitResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageSimpleResponse.setList(udiwmsUnitResponses);
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -53,11 +117,29 @@ public class TestClient {
|
|
|
|
|
*/
|
|
|
|
|
public BaseResponse getProducuts(UdiwmsProductRequest udiwmsProductRequest) {
|
|
|
|
|
|
|
|
|
|
String data = FileUtils.readFileAll("E:\\第三方测试数据\\第三方产品信息测试数据.json");
|
|
|
|
|
BaseResponse<PageSimpleResponse<UdiwmsProductInfoResponse>> udiDlDeviceResponse =
|
|
|
|
|
JSONObject.parseObject(data, new TypeReference<BaseResponse<PageSimpleResponse<UdiwmsProductInfoResponse>>>() {
|
|
|
|
|
});
|
|
|
|
|
return udiDlDeviceResponse;
|
|
|
|
|
|
|
|
|
|
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
|
|
|
|
|
BeanUtils.copyProperties(udiwmsProductRequest, filterThrProductsRequest);
|
|
|
|
|
List<ThrProductsEntity> thrProductsEntities = testProductDao.filterThrProductsRequest(filterThrProductsRequest);
|
|
|
|
|
|
|
|
|
|
List<UdiwmsProductInfoResponse> udiwmsProductInfoResponses = new ArrayList<>();
|
|
|
|
|
if (CollUtil.isNotEmpty(thrProductsEntities)) {
|
|
|
|
|
for (ThrProductsEntity thrProductsEntity : thrProductsEntities) {
|
|
|
|
|
UdiwmsProductInfoResponse udiwmsProductInfoResponse = new UdiwmsProductInfoResponse();
|
|
|
|
|
BeanUtils.copyProperties(thrProductsEntity, udiwmsProductInfoResponse);
|
|
|
|
|
udiwmsProductInfoResponses.add(udiwmsProductInfoResponse);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// String data = FileUtils.readFileAll("E:\\第三方测试数据\\第三方产品信息测试数据.json");
|
|
|
|
|
// BaseResponse<PageSimpleResponse<UdiwmsProductInfoResponse>> udiDlDeviceResponse =
|
|
|
|
|
// JSONObject.parseObject(data, new TypeReference<BaseResponse<PageSimpleResponse<UdiwmsProductInfoResponse>>>() {
|
|
|
|
|
// });
|
|
|
|
|
PageInfo<UdiwmsProductInfoResponse> pageInfo;
|
|
|
|
|
pageInfo = new PageInfo<>(udiwmsProductInfoResponses);
|
|
|
|
|
PageSimpleResponse<UdiwmsProductInfoResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageSimpleResponse.setList(udiwmsProductInfoResponses);
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -102,34 +184,169 @@ public class TestClient {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取单据类型
|
|
|
|
|
public BaseResponse getBusType(UdiwmsBusTypeRequest udiwmsBusTypeRequest) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (null == udiwmsBusTypeRequest) {
|
|
|
|
|
return ResultVOUtils.error(500, "参数不能未空");
|
|
|
|
|
}
|
|
|
|
|
String data = FileUtils.readFileAll("E:\\第三方测试数据\\第三方单据类型测试数据.json");
|
|
|
|
|
BaseResponse<PageSimpleResponse<UdiwmsBusTypeResponse>> udiDlDeviceResponse =
|
|
|
|
|
JSONObject.parseObject(data, new TypeReference<BaseResponse<PageSimpleResponse<UdiwmsBusTypeResponse>>>() {
|
|
|
|
|
});
|
|
|
|
|
return udiDlDeviceResponse;
|
|
|
|
|
|
|
|
|
|
BussinessOriginTypeFilterRequest bussinessOriginTypeFilterRequest = new BussinessOriginTypeFilterRequest();
|
|
|
|
|
BeanUtils.copyProperties(udiwmsBusTypeRequest, bussinessOriginTypeFilterRequest);
|
|
|
|
|
List<BussinessOriginTypeEntity> bussinessOriginTypeEntities = testBusTypeDao.filterList(bussinessOriginTypeFilterRequest);
|
|
|
|
|
|
|
|
|
|
List<UdiwmsBusTypeResponse> udiwmsBusTypeResponses = new ArrayList<>();
|
|
|
|
|
if (CollUtil.isNotEmpty(bussinessOriginTypeEntities)) {
|
|
|
|
|
for (BussinessOriginTypeEntity bussinessOriginTypeEntity : bussinessOriginTypeEntities) {
|
|
|
|
|
UdiwmsBusTypeResponse udiwmsBusTypeResponse = new UdiwmsBusTypeResponse();
|
|
|
|
|
BeanUtils.copyProperties(bussinessOriginTypeEntity, udiwmsBusTypeResponse);
|
|
|
|
|
udiwmsBusTypeResponses.add(udiwmsBusTypeResponse);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String data = FileUtils.readFileAll("E:\\第三方测试数据\\第三方单据类型测试数据.json");
|
|
|
|
|
// BaseResponse<PageSimpleResponse<UdiwmsBusTypeResponse>> udiDlDeviceResponse =
|
|
|
|
|
// JSONObject.parseObject(data, new TypeReference<BaseResponse<PageSimpleResponse<UdiwmsBusTypeResponse>>>() {
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
PageInfo<UdiwmsBusTypeResponse> pageInfo;
|
|
|
|
|
pageInfo = new PageInfo<>(udiwmsBusTypeResponses);
|
|
|
|
|
PageSimpleResponse<UdiwmsBusTypeResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageSimpleResponse.setList(udiwmsBusTypeResponses);
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新增订单
|
|
|
|
|
*
|
|
|
|
|
* @param udiwmsOrderRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public BaseResponse addOrders(UdiwmsOrderRequest udiwmsOrderRequest) {
|
|
|
|
|
// Map<String, Object> verifyResult = verifyOrderParams(udiwmsOrderRequest);
|
|
|
|
|
// boolean flag = (boolean) verifyResult.get("flag");
|
|
|
|
|
// if (!flag) {
|
|
|
|
|
// return ResultVOUtils.error(500, verifyResult.get("msg").toString());
|
|
|
|
|
// }
|
|
|
|
|
TestOrderResponse udiwmsOrderResponse = new TestOrderResponse();
|
|
|
|
|
udiwmsOrderResponse.setThirdBillNo(CustomUtil.getId());
|
|
|
|
|
return ResultVOUtils.success(udiwmsOrderResponse);
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
SubmitOrderUtils submitOrderUtils;
|
|
|
|
|
@Resource
|
|
|
|
|
private StockOrderDao stockOrderDao;
|
|
|
|
|
@Resource
|
|
|
|
|
private StockOrderDetailDao stockOrderDetailDao;
|
|
|
|
|
@Resource
|
|
|
|
|
private OrderDao orderDao;
|
|
|
|
|
@Resource
|
|
|
|
|
private BussinessTypeDao bussinessTypeDao;
|
|
|
|
|
@Resource
|
|
|
|
|
private CodesDao codesDao;
|
|
|
|
|
@Resource
|
|
|
|
|
private UdiRelevanceDao udiRelevanceDao;
|
|
|
|
|
@Resource
|
|
|
|
|
private StockOrderUploadLogDao stockOrderUploadLogDao;
|
|
|
|
|
|
|
|
|
|
public BaseResponse addOrders(TestOrderRequest orderRequest) {
|
|
|
|
|
if (StrUtil.isEmpty(orderRequest.getId())) {
|
|
|
|
|
return ResultVOUtils.error(500, "单据ID不能为空!");
|
|
|
|
|
}
|
|
|
|
|
StockOrderEntity stockOrderEntity = stockOrderDao.findById(orderRequest.getId());
|
|
|
|
|
OrderEntity orderEntity = orderDao.findById(stockOrderEntity.getOrderIdFk());
|
|
|
|
|
List<StockOrderDetailEntity> stockOrderDetailEntities = stockOrderDetailDao.findByOrderIdFk(stockOrderEntity.getId());
|
|
|
|
|
BussinessLocalTypeEntity bussinessLocalTypeEntity = submitOrderUtils.getCurLocType(stockOrderEntity.getBillType());
|
|
|
|
|
orderRequest.setBillDate(stockOrderEntity.getBilldate());
|
|
|
|
|
orderRequest.setBillNo(stockOrderEntity.getBillNo());
|
|
|
|
|
orderRequest.setBillType(submitOrderUtils.toBusType(stockOrderEntity.getBillType()));
|
|
|
|
|
|
|
|
|
|
if (bussinessLocalTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INPUT) {
|
|
|
|
|
orderRequest.setCorpId(stockOrderEntity.getCorpName());
|
|
|
|
|
orderRequest.setCorpName(stockOrderEntity.getCorpName());
|
|
|
|
|
} else if (bussinessLocalTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INNOR) {
|
|
|
|
|
ThrInvWarehouseEntity thrInvWarehouseEntity = submitOrderUtils.toInv(stockOrderEntity.getInvWarehouseCode(), thirdId);
|
|
|
|
|
orderRequest.setCorpId(thrInvWarehouseEntity.getCode());
|
|
|
|
|
orderRequest.setCorpName(thrInvWarehouseEntity.getName());
|
|
|
|
|
} else if (bussinessLocalTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
|
|
|
|
|
ThrCorpEntity thrCorpEntity = submitOrderUtils.toCorp(stockOrderEntity.getCorpId(), thirdId);
|
|
|
|
|
orderRequest.setCorpId(thrCorpEntity.getUnitId()); //往来单位编码,需转换为第三方系统的ID
|
|
|
|
|
orderRequest.setCorpName(thrCorpEntity.getName()); //往来单位名称,需转换为第三方系统的名称
|
|
|
|
|
}
|
|
|
|
|
ThrInvWarehouseEntity thrInvWarehouseEntity = submitOrderUtils.toInv(stockOrderEntity.getLocStorageCode(), thirdId);
|
|
|
|
|
orderRequest.setLocInvCode(thrInvWarehouseEntity.getCode());
|
|
|
|
|
orderRequest.setLocInvName(thrInvWarehouseEntity.getName());
|
|
|
|
|
ThrSubInvWarehouseEntity thrSubInvWarehouseEntity = submitOrderUtils.toSubInv(stockOrderEntity.getInvWarehouseCode(), thirdId);
|
|
|
|
|
orderRequest.setLocSubInvCode(thrSubInvWarehouseEntity.getCode());
|
|
|
|
|
orderRequest.setLocSubInvName(thrSubInvWarehouseEntity.getName());
|
|
|
|
|
String mainAction = bussinessTypeDao.selectInoutTypebByLocalAction(stockOrderEntity.getBillType());
|
|
|
|
|
if (ConstantType.TYPE_PUT.equals(mainAction)) {
|
|
|
|
|
orderRequest.setInoutType(1); //出入库类型:入库
|
|
|
|
|
} else if (ConstantType.TYPE_OUT.equals(mainAction)) {
|
|
|
|
|
orderRequest.setInoutType(2); //出入库类型:出库
|
|
|
|
|
}
|
|
|
|
|
orderRequest.setRemark("udi管理系统提交单据"); //备注
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<WarehouseEntity> warehouseEntities = codesDao.findByReceiptId(stockOrderEntity.getOrderIdFk());
|
|
|
|
|
List<UdiwmsOrderDetail> items = new ArrayList<>(stockOrderDetailEntities.size());
|
|
|
|
|
for (StockOrderDetailEntity stockOrderDetailEntity : stockOrderDetailEntities) {
|
|
|
|
|
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceDao.selectById(stockOrderDetailEntity.getRelId());
|
|
|
|
|
UdiwmsOrderDetail item = new UdiwmsOrderDetail();
|
|
|
|
|
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.getZczbhhzbapzbh());
|
|
|
|
|
|
|
|
|
|
item.setPrice(stockOrderDetailEntity.getPrice());
|
|
|
|
|
item.setFirstSalesInvNo(stockOrderDetailEntity.getFirstSalesInvNo());
|
|
|
|
|
item.setSecSalesInvNo(stockOrderDetailEntity.getSecSalesInvNo());
|
|
|
|
|
item.setInvoiceDate(stockOrderDetailEntity.getInvoiceDate());
|
|
|
|
|
item.setSecSalesListNo(stockOrderDetailEntity.getSecSalesListNo());
|
|
|
|
|
item.setCodeList(submitOrderUtils.getCodeArray(stockOrderDetailEntity, warehouseEntities));
|
|
|
|
|
ThrProductsEntity thrProductsEntity = submitOrderUtils.toProduct(stockOrderDetailEntity, thirdId);
|
|
|
|
|
item.setProductId(thrProductsEntity.getCode());
|
|
|
|
|
item.setProductName(thrProductsEntity.getName());
|
|
|
|
|
items.add(item);
|
|
|
|
|
}
|
|
|
|
|
orderRequest.setItem(items);
|
|
|
|
|
//记录日志
|
|
|
|
|
StockOrderUploadLogEntity uploadLog = new StockOrderUploadLogEntity();
|
|
|
|
|
uploadLog.setBillDate(com.glxp.mipsdl.admin.util.DateUtil.parseDate(orderRequest.getBillDate()));
|
|
|
|
|
uploadLog.setBillType(stockOrderEntity.getBillType());
|
|
|
|
|
uploadLog.setSubmitTime(new Date());
|
|
|
|
|
uploadLog.setBillNo(orderRequest.getBillNo());
|
|
|
|
|
uploadLog.setFromType(ConstantStatus.THIRD_ORDER_UPLOAD);
|
|
|
|
|
String data = JSONUtil.toJsonStr(orderRequest);
|
|
|
|
|
FileUtils.saveFileAs(data, thirdId + "_" + stockOrderEntity.getBillNo());
|
|
|
|
|
String response = "上传成功!";
|
|
|
|
|
if (StrUtil.isNotBlank(response)) {
|
|
|
|
|
try {
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
|
});
|
|
|
|
|
if (baseResponse.getCode().equals(20000)) {
|
|
|
|
|
String thirdBillNo = String.valueOf(baseResponse.getData());
|
|
|
|
|
orderEntity.setExportStatus(1);
|
|
|
|
|
orderEntity.setThirdBillNo(thirdBillNo);
|
|
|
|
|
uploadLog.setStatus(2);
|
|
|
|
|
uploadLog.setThrBillNo(thirdBillNo);
|
|
|
|
|
uploadLog.setResult("提交成功");
|
|
|
|
|
stockOrderUploadLogDao.insert(uploadLog);
|
|
|
|
|
orderDao.updateOrder(orderEntity);
|
|
|
|
|
return ResultVOUtils.success("提交成功");
|
|
|
|
|
}
|
|
|
|
|
uploadLog.setStatus(3);
|
|
|
|
|
uploadLog.setResult("提交失败,错误信息:" + baseResponse.getMessage());
|
|
|
|
|
stockOrderUploadLogDao.insert(uploadLog);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
uploadLog.setStatus(3);
|
|
|
|
|
uploadLog.setResult("提交失败,错误信息:" + response);
|
|
|
|
|
stockOrderUploadLogDao.insert(uploadLog);
|
|
|
|
|
return ResultVOUtils.error(500, "提交失败");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
uploadLog.setStatus(3);
|
|
|
|
|
uploadLog.setResult("提交失败,调用接口返回为空");
|
|
|
|
|
stockOrderUploadLogDao.insert(uploadLog);
|
|
|
|
|
return ResultVOUtils.error(500, "提交失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -221,7 +438,33 @@ public class TestClient {
|
|
|
|
|
return ResultVOUtils.success(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取仓库
|
|
|
|
|
public BaseResponse getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest) {
|
|
|
|
|
List<UdiwmsWarehouseResponse> udiwmsWarehouseResponses = new ArrayList<>();
|
|
|
|
|
FilterThrInvWarehouseRequest filterThrInvWarehouseRequest = new FilterThrInvWarehouseRequest();
|
|
|
|
|
BeanUtils.copyProperties(udiwmsWarehouseRequest, filterThrInvWarehouseRequest);
|
|
|
|
|
List<ThrInvWarehouseEntity> thrInvWarehouseEntities = testInvWarehouseDao.filterThrInvWarehouse(filterThrInvWarehouseRequest);
|
|
|
|
|
if (CollUtil.isNotEmpty(thrInvWarehouseEntities)) {
|
|
|
|
|
for (ThrInvWarehouseEntity thrInvWarehouseEntity : thrInvWarehouseEntities) {
|
|
|
|
|
UdiwmsWarehouseResponse udiwmsWarehouseResponse = new UdiwmsWarehouseResponse();
|
|
|
|
|
BeanUtils.copyProperties(thrInvWarehouseEntity, udiwmsWarehouseResponse);
|
|
|
|
|
udiwmsWarehouseResponses.add(udiwmsWarehouseResponse);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// String data = FileUtils.readFileAll("E:\\第三方测试数据\\第三方仓库字段测试数据.json");
|
|
|
|
|
// BaseResponse<PageSimpleResponse<UdiwmsWarehouseResponse>> udiDlDeviceResponse =
|
|
|
|
|
// JSONObject.parseObject(data, new TypeReference<BaseResponse<PageSimpleResponse<UdiwmsWarehouseResponse>>>() {
|
|
|
|
|
// });
|
|
|
|
|
PageInfo<UdiwmsWarehouseResponse> pageInfo;
|
|
|
|
|
pageInfo = new PageInfo<>(udiwmsWarehouseResponses);
|
|
|
|
|
PageSimpleResponse<UdiwmsWarehouseResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageSimpleResponse.setList(udiwmsWarehouseResponses);
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取分库
|
|
|
|
|
public BaseResponse getSubWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest) {
|
|
|
|
|
if (null == udiwmsWarehouseRequest || StrUtil.isBlank(udiwmsWarehouseRequest.getThirdSys())) {
|
|
|
|
|
return ResultVOUtils.error(500, "第三方系统ID不能为空");
|
|
|
|
|
}
|
|
|
|
@ -231,4 +474,5 @@ public class TestClient {
|
|
|
|
|
});
|
|
|
|
|
return udiDlDeviceResponse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|