|
|
|
@ -132,7 +132,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
openOrderVO.setDepartureWarehouseId(warehouseId); |
|
|
|
|
openOrderVO.setTotalNum(totalNum); |
|
|
|
|
//发货单位
|
|
|
|
|
Long shipperId = basicdataForwardingUnitClient.findForwardingUnitByWarehouseIdAndUserId(warehouseId,AuthUtil.getUserId()); |
|
|
|
|
Long shipperId = basicdataForwardingUnitClient.findForwardingUnitByWarehouseId(warehouseId); |
|
|
|
|
if(!Objects.isNull(shipperId)){ |
|
|
|
|
BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findEntityById(shipperId); |
|
|
|
|
if(!Objects.isNull(basicdataClientEntity)){ |
|
|
|
@ -774,6 +774,18 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
openOrderVO.setDepartureWarehouseName(basicdataWarehouseEntity.getName()); |
|
|
|
|
openOrderVO.setDepartureWarehouseId(warehouseId); |
|
|
|
|
|
|
|
|
|
Long shipperId = basicdataForwardingUnitClient.findForwardingUnitByWarehouseId(warehouseId); |
|
|
|
|
if(!Objects.isNull(shipperId)){ |
|
|
|
|
BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findEntityById(shipperId); |
|
|
|
|
if(!Objects.isNull(basicdataClientEntity)){ |
|
|
|
|
openOrderVO.setShipperClientId(shipperId); |
|
|
|
|
openOrderVO.setShipper(basicdataClientEntity.getClientName()); |
|
|
|
|
openOrderVO.setShipperName(basicdataClientEntity.getLinkman()); |
|
|
|
|
openOrderVO.setShipperMobile(basicdataClientEntity.getPhone()); |
|
|
|
|
openOrderVO.setShipperAddress(basicdataClientEntity.getDetailedly()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//查询支付方式
|
|
|
|
|
openOrderVO.setPayTypeList(DictBizCache.getList(DictBizConstant.OPEN_ORDER_PAY_TYPE)); |
|
|
|
|
//查询付款方式
|
|
|
|
@ -1525,81 +1537,38 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
} |
|
|
|
|
InputStream inputStream = file.getInputStream(); |
|
|
|
|
|
|
|
|
|
List<OrderNoPackageExcelDTO> orderNoPackageExcelDTOS = EasyExcel.read(inputStream).head(OrderNoPackageExcelDTO.class).sheet(0).headRowNumber(2).doReadSync(); |
|
|
|
|
Map<String, List<OrderNoPackageExcelDTO>> listMap = orderNoPackageExcelDTOS.parallelStream().collect(Collectors.groupingBy(a -> a.getOrderCode() + "&" + a.getTrainNumber())); |
|
|
|
|
|
|
|
|
|
listMap.remove("null&null"); |
|
|
|
|
|
|
|
|
|
Set<String> set = listMap.keySet(); |
|
|
|
|
|
|
|
|
|
for (String str : set) { |
|
|
|
|
String[] split = str.split("&"); |
|
|
|
|
String orderCode = split[0]; |
|
|
|
|
String trainNumber = split[1]; |
|
|
|
|
List<OrderNoPackageExcelDTO> noPackageExcelDTOList = listMap.get(str); |
|
|
|
|
OrderNoPackageExcelDTO orderNoPackageExcelDTO = noPackageExcelDTOList.get(0); |
|
|
|
|
List<ImportOrderNoPackageExcelDTO> importOrderNoPackageExcelDTOS = EasyExcel.read(inputStream).head(ImportOrderNoPackageExcelDTO.class).sheet(0).headRowNumber(2).doReadSync(); |
|
|
|
|
List<TrunklineAdvanceEntity> list = new ArrayList<>(); |
|
|
|
|
for (ImportOrderNoPackageExcelDTO importOrderNoPackageExcelDTO : importOrderNoPackageExcelDTOS) { |
|
|
|
|
String orderCode = importOrderNoPackageExcelDTO.getOrderCode(); |
|
|
|
|
String trainNumber = importOrderNoPackageExcelDTO.getTrainNumber(); |
|
|
|
|
TrunklineAdvanceEntity trunklineAdvanceEntity = advanceService.findEntityByOrderCodeAndTrainNumber(orderCode, trainNumber); |
|
|
|
|
if(Objects.isNull(trunklineAdvanceEntity)){ |
|
|
|
|
trunklineAdvanceEntity = new TrunklineAdvanceVO(); |
|
|
|
|
trunklineAdvanceEntity.setWarehouseId(warehouseId); |
|
|
|
|
trunklineAdvanceEntity.setWarehouseName(warehouseName); |
|
|
|
|
trunklineAdvanceEntity.setOrderCode(orderCode); |
|
|
|
|
trunklineAdvanceEntity.setBrand(orderNoPackageExcelDTO.getBrand()); |
|
|
|
|
trunklineAdvanceEntity.setTotalNum(Integer.parseInt(orderNoPackageExcelDTO.getNum())); |
|
|
|
|
trunklineAdvanceEntity.setPackName(orderNoPackageExcelDTO.getFirsts()); |
|
|
|
|
trunklineAdvanceEntity.setDealerName(orderNoPackageExcelDTO.getDealerName()); |
|
|
|
|
trunklineAdvanceEntity.setCustomerName(orderNoPackageExcelDTO.getCustomerName()); |
|
|
|
|
trunklineAdvanceEntity.setCustomerPhone(orderNoPackageExcelDTO.getCustomerPhone()); |
|
|
|
|
trunklineAdvanceEntity.setCustomerAddress(orderNoPackageExcelDTO.getCustomerAddress()); |
|
|
|
|
trunklineAdvanceEntity.setConsigneePerson(orderNoPackageExcelDTO.getConsigneePerson()); |
|
|
|
|
trunklineAdvanceEntity.setConsigneeMobile(orderNoPackageExcelDTO.getConsigneeMobile()); |
|
|
|
|
trunklineAdvanceEntity.setConsigneeAddress(orderNoPackageExcelDTO.getConsigneeAddress()); |
|
|
|
|
trunklineAdvanceEntity.setBrand(importOrderNoPackageExcelDTO.getBrand()); |
|
|
|
|
trunklineAdvanceEntity.setTotalNum(Integer.parseInt(importOrderNoPackageExcelDTO.getNum())); |
|
|
|
|
trunklineAdvanceEntity.setDealerName(importOrderNoPackageExcelDTO.getDealerName()); |
|
|
|
|
trunklineAdvanceEntity.setCustomerName(importOrderNoPackageExcelDTO.getCustomerName()); |
|
|
|
|
trunklineAdvanceEntity.setCustomerPhone(importOrderNoPackageExcelDTO.getCustomerPhone()); |
|
|
|
|
trunklineAdvanceEntity.setCustomerAddress(importOrderNoPackageExcelDTO.getCustomerAddress()); |
|
|
|
|
trunklineAdvanceEntity.setConsigneePerson(importOrderNoPackageExcelDTO.getConsigneePerson()); |
|
|
|
|
trunklineAdvanceEntity.setConsigneeMobile(importOrderNoPackageExcelDTO.getConsigneeMobile()); |
|
|
|
|
trunklineAdvanceEntity.setConsigneeAddress(importOrderNoPackageExcelDTO.getConsigneeAddress()); |
|
|
|
|
trunklineAdvanceEntity.setSystemType("线上"); |
|
|
|
|
trunklineAdvanceEntity.setMatingType("1"); |
|
|
|
|
trunklineAdvanceEntity.setWaybillStatus("0"); |
|
|
|
|
trunklineAdvanceEntity.setTrainNumber(orderNoPackageExcelDTO.getTrainNumber()); |
|
|
|
|
trunklineAdvanceEntity.setTrainNumber(importOrderNoPackageExcelDTO.getTrainNumber()); |
|
|
|
|
trunklineAdvanceEntity.setFreezeStatus("0"); |
|
|
|
|
trunklineAdvanceEntity.setLegacyStatus("0"); |
|
|
|
|
trunklineAdvanceEntity.setHasPackage(0); |
|
|
|
|
trunklineAdvanceEntity.setCreateUserName(AuthUtil.getUserName()); |
|
|
|
|
advanceService.save(trunklineAdvanceEntity); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<TrunklineAdvanceDetailEntity> advanceDetailEntities = new ArrayList<>(); |
|
|
|
|
for (OrderNoPackageExcelDTO noPackageExcelDTO : orderNoPackageExcelDTOS) { |
|
|
|
|
|
|
|
|
|
TrunklineAdvanceDetailEntity advanceDetailModel = new TrunklineAdvanceDetailEntity(); |
|
|
|
|
advanceDetailModel.setWarehouseId(warehouseId); |
|
|
|
|
advanceDetailModel.setWarehouseName(warehouseName); |
|
|
|
|
advanceDetailModel.setAdvanceId(trunklineAdvanceEntity.getId()); |
|
|
|
|
advanceDetailModel.setOrderCode(orderCode); |
|
|
|
|
advanceDetailModel.setBrand(noPackageExcelDTO.getBrand()); |
|
|
|
|
advanceDetailModel.setSystemType("线上"); |
|
|
|
|
|
|
|
|
|
advanceDetailModel.setFirstPackName(noPackageExcelDTO.getFirsts()); |
|
|
|
|
String sencods = noPackageExcelDTO.getSencods(); |
|
|
|
|
if(StringUtil.isBlank(sencods)){ |
|
|
|
|
advanceDetailModel.setSecondPackName(noPackageExcelDTO.getFirsts()); |
|
|
|
|
}else{ |
|
|
|
|
advanceDetailModel.setSecondPackName(sencods); |
|
|
|
|
} |
|
|
|
|
String thirds = noPackageExcelDTO.getThirds(); |
|
|
|
|
if(StringUtil.isBlank(thirds)){ |
|
|
|
|
advanceDetailModel.setThirdPackName(noPackageExcelDTO.getFirsts()); |
|
|
|
|
}else{ |
|
|
|
|
advanceDetailModel.setThirdPackName(thirds); |
|
|
|
|
} |
|
|
|
|
advanceDetailModel.setQuantity(Integer.parseInt(noPackageExcelDTO.getNum())); |
|
|
|
|
advanceDetailModel.setServiceNum(noPackageExcelDTO.getServiceNum()); |
|
|
|
|
advanceDetailModel.setPackageStatus("0"); |
|
|
|
|
advanceDetailModel.setFirstPackName(noPackageExcelDTO.getFirsts()); |
|
|
|
|
advanceDetailModel.setSecondPackName(noPackageExcelDTO.getSencods()); |
|
|
|
|
advanceDetailModel.setThirdPackName(noPackageExcelDTO.getThirds()); |
|
|
|
|
advanceDetailEntities.add(advanceDetailModel); |
|
|
|
|
list.add(trunklineAdvanceEntity); |
|
|
|
|
} |
|
|
|
|
advanceDetailService.saveBatch(advanceDetailEntities); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
advanceService.saveBatch(list); |
|
|
|
|
|
|
|
|
|
return R.success("导入成功"); |
|
|
|
|
} |
|
|
|
@ -1638,9 +1607,132 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.warn("###############checkWaybill: 存入日志失败"); |
|
|
|
|
} |
|
|
|
|
return R.success("审核成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R advanceNoPackageToWaybillInfo(List<Long> advanceIds, Long warehouseId) { |
|
|
|
|
log.info("##################advanceNoPackageToWaybillInfo: 暂存单转运单"); |
|
|
|
|
|
|
|
|
|
return R.success("审核成功"); |
|
|
|
|
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId); |
|
|
|
|
if(Objects.isNull(basicdataWarehouseEntity)){ |
|
|
|
|
log.warn("##############advanceNoPackageToWaybillInfo: 仓库信息不存在 warehouseId={}",warehouseId); |
|
|
|
|
return R.fail(405,"仓库信息不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//先查询出所有的暂存单
|
|
|
|
|
List<TrunklineAdvanceEntity> list = advanceService.findListByIds(advanceIds); |
|
|
|
|
|
|
|
|
|
if(list.isEmpty()){ |
|
|
|
|
log.warn("##############advanceNoPackageToWaybillInfo: 暂存单数据不存在 advanceIds={}",advanceIds); |
|
|
|
|
return R.fail(405,"暂存单数据不存在"); |
|
|
|
|
} |
|
|
|
|
String dealerName = null; |
|
|
|
|
String brand = null; |
|
|
|
|
Integer totalNum = 0; |
|
|
|
|
for (TrunklineAdvanceEntity advanceEntity:list){ |
|
|
|
|
if(StringUtil.isBlank(dealerName)){ |
|
|
|
|
dealerName = advanceEntity.getDealerName(); |
|
|
|
|
} |
|
|
|
|
if(StringUtil.isBlank(brand)){ |
|
|
|
|
brand = advanceEntity.getBrand(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
totalNum = totalNum + advanceEntity.getTotalNum(); |
|
|
|
|
} |
|
|
|
|
OpenOrderVO openOrderVO = new OpenOrderVO(); |
|
|
|
|
//查询品牌 客户车次号 订单自编码
|
|
|
|
|
OpenOrderVO infoByIds = advanceService.selectInfoByIds(advanceIds); |
|
|
|
|
BeanUtil.copy(infoByIds,openOrderVO); |
|
|
|
|
openOrderVO.setAdvanceIds(advanceIds); |
|
|
|
|
//发站仓-----目前登录人的仓库
|
|
|
|
|
openOrderVO.setDepartureWarehouseName(basicdataWarehouseEntity.getName()); |
|
|
|
|
openOrderVO.setDepartureWarehouseId(warehouseId); |
|
|
|
|
openOrderVO.setTotalNum(totalNum); |
|
|
|
|
//发货单位
|
|
|
|
|
Long shipperId = basicdataForwardingUnitClient.findForwardingUnitByWarehouseId(warehouseId); |
|
|
|
|
if(!Objects.isNull(shipperId)){ |
|
|
|
|
BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findEntityById(shipperId); |
|
|
|
|
if(!Objects.isNull(basicdataClientEntity)){ |
|
|
|
|
openOrderVO.setShipperClientId(shipperId); |
|
|
|
|
openOrderVO.setShipper(basicdataClientEntity.getClientName()); |
|
|
|
|
openOrderVO.setShipperName(basicdataClientEntity.getLinkman()); |
|
|
|
|
openOrderVO.setShipperMobile(basicdataClientEntity.getPhone()); |
|
|
|
|
openOrderVO.setShipperAddress(basicdataClientEntity.getDetailedly()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//收货单位-----根据三方商场找到对应的clientId
|
|
|
|
|
Long clientId = basicdataTripartiteMallClient.getClientIdByNameAndBrand(dealerName, brand); |
|
|
|
|
BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findEntityById(clientId); |
|
|
|
|
if(!Objects.isNull(basicdataClientEntity)){ |
|
|
|
|
openOrderVO.setConsigneeClientId(clientId); |
|
|
|
|
openOrderVO.setConsignee(basicdataClientEntity.getClientName()); |
|
|
|
|
openOrderVO.setConsigneeName(basicdataClientEntity.getLinkman()); |
|
|
|
|
openOrderVO.setConsigneeMobile(basicdataClientEntity.getPhone()); |
|
|
|
|
openOrderVO.setConsigneeAddress(basicdataClientEntity.getDetailedly()); |
|
|
|
|
|
|
|
|
|
List<String> destinationArray = new ArrayList<>(); |
|
|
|
|
String badeRegionAreaId = basicdataClientEntity.getBladeRegionAreaId(); |
|
|
|
|
String bladeRegionProvinceId = basicdataClientEntity.getBladeRegionProvinceId(); |
|
|
|
|
String bladeRegionCityId = basicdataClientEntity.getBladeRegionCityId(); |
|
|
|
|
destinationArray.add(bladeRegionProvinceId); |
|
|
|
|
destinationArray.add(bladeRegionCityId); |
|
|
|
|
String name = regionFeign.getName(bladeRegionCityId); |
|
|
|
|
String areaId = bladeRegionCityId; |
|
|
|
|
if(!StringUtil.isBlank(badeRegionAreaId)){ |
|
|
|
|
destinationArray.add(badeRegionAreaId); |
|
|
|
|
name = regionFeign.getName(badeRegionAreaId); |
|
|
|
|
areaId = badeRegionAreaId; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
openOrderVO.setDestination(name); |
|
|
|
|
openOrderVO.setDestinationCode(areaId); |
|
|
|
|
openOrderVO.setDestinationArray(destinationArray); |
|
|
|
|
|
|
|
|
|
openOrderVO.setDefaultPayWay(basicdataClientEntity.getDefaultPaymentMethods()); |
|
|
|
|
|
|
|
|
|
//查询目的仓数据
|
|
|
|
|
BasicdataStorageServicesEntity basicdataStorageServicesEntity = basicdataStorageServicesClient.findEntityBySendWarehouseIdAndClientId(warehouseId, clientId); |
|
|
|
|
if(!Objects.isNull(basicdataStorageServicesEntity)){ |
|
|
|
|
openOrderVO.setDestinationWarehouseId(basicdataStorageServicesEntity.getServeWarehouseId()); |
|
|
|
|
openOrderVO.setDestinationWarehouseName(basicdataStorageServicesEntity.getServeWarehouseName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//组装货物数据
|
|
|
|
|
// List<AdvanceDetailGoodsVO> goodsList = advanceDetailService.findGoodsListByAdvanceIds(advanceIds);
|
|
|
|
|
//因为这个时候还没有到站信息,所有无法去匹配一个该商场的货物单价
|
|
|
|
|
// for (AdvanceDetailGoodsVO advanceDetailGoodsVO:goodsList){
|
|
|
|
|
// String goodsName = advanceDetailGoodsVO.getGoodsName();
|
|
|
|
|
// if(!Objects.isNull(basicdataClientEntity)){
|
|
|
|
|
// //TODO 这里要根据商场信息和物品名称去匹配一个预设单价
|
|
|
|
|
// advanceDetailGoodsVO.setPrice(BigDecimal.ZERO);
|
|
|
|
|
// }else{
|
|
|
|
|
// //因为没有
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// openOrderVO.setGoodsList(goodsList);
|
|
|
|
|
|
|
|
|
|
//查询支付方式
|
|
|
|
|
openOrderVO.setPayTypeList(DictBizCache.getList(DictBizConstant.OPEN_ORDER_PAY_TYPE)); |
|
|
|
|
//查询付款方式
|
|
|
|
|
openOrderVO.setPayWayList(DictBizCache.getList(DictBizConstant.OPEN_ORDER_PAY_WAY)); |
|
|
|
|
//查询送货方式
|
|
|
|
|
openOrderVO.setDeliveryWayList(DictBizCache.getList(DictBizConstant.OPEN_ORDER_DELIVERY_WAY)); |
|
|
|
|
//查询紧急度
|
|
|
|
|
openOrderVO.setUrgencyList(DictBizCache.getList(DictBizConstant.OPEN_ORDER_URGENCY)); |
|
|
|
|
//查询回单方式
|
|
|
|
|
openOrderVO.setReceiptList(DictBizCache.getList(DictBizConstant.OPEN_ORDER_RECEIPT)); |
|
|
|
|
//查询回单方式
|
|
|
|
|
openOrderVO.setTransportTypeList(DictBizCache.getList(DictBizConstant.OPEN_ORDER_TRANSPORT_TYPE)); |
|
|
|
|
|
|
|
|
|
openOrderVO.setOpenOrderUserName(AuthUtil.getNickName()); |
|
|
|
|
|
|
|
|
|
openOrderVO.setOpenOrderDate(CommonUtil.dateToStringGeneral(new Date())); |
|
|
|
|
|
|
|
|
|
return R.data(openOrderVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String verifyData(OpenOrderDTO openOrderDTO, WarehouseWaybillEntity waybillEntity) { |
|
|
|
|