feat: 出库导入费用
This commit is contained in:
@@ -0,0 +1,162 @@
|
||||
package org.nl.b_lms.storage_manage.md.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 运输公司基本信息表
|
||||
* @Author: lyd
|
||||
* @Date: 2025/7/3
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("MD_CS_TransportationBase")
|
||||
public class MdCsTransportationBase {
|
||||
/** 物流公司标识 */
|
||||
@TableId
|
||||
private String cust_id;
|
||||
|
||||
/**
|
||||
* 物流公司编码
|
||||
*/
|
||||
private String cust_code;
|
||||
|
||||
/**
|
||||
* 物流公司名称
|
||||
*/
|
||||
private String cust_name;
|
||||
|
||||
/**
|
||||
* 物流公司简称
|
||||
*/
|
||||
private String cust_simple_name;
|
||||
|
||||
/**
|
||||
* 国家
|
||||
*/
|
||||
private String country;
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
private String state;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 传真
|
||||
*/
|
||||
private String faxnumber;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String webSite;
|
||||
|
||||
/**
|
||||
* 法人代表
|
||||
*/
|
||||
private String jurid_name;
|
||||
|
||||
/**
|
||||
* 税务登记号
|
||||
*/
|
||||
private String tax_no;
|
||||
|
||||
/**
|
||||
* 工商注册号
|
||||
*/
|
||||
private String register_no;
|
||||
|
||||
/**
|
||||
* 经营许可证号
|
||||
*/
|
||||
private String manage_lice_no;
|
||||
|
||||
/**
|
||||
* 营业执照
|
||||
*/
|
||||
private String busi_char_name;
|
||||
|
||||
/**
|
||||
* 行政区划
|
||||
*/
|
||||
private String area_id;
|
||||
|
||||
/**
|
||||
* 邮政编码
|
||||
*/
|
||||
private String zip_code;
|
||||
|
||||
/**
|
||||
* 公司电话
|
||||
*/
|
||||
private String corp_tele_no;
|
||||
|
||||
/**
|
||||
* 公司地址
|
||||
*/
|
||||
private String corp_address;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 启用时间
|
||||
*/
|
||||
private String is_used_time;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_used;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 外部标识
|
||||
*/
|
||||
private String ext_id;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
}
|
||||
@@ -18,7 +18,6 @@ import java.math.BigDecimal;
|
||||
@Builder
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("md_me_materialbase")
|
||||
|
||||
public class MdMeMaterialBase implements Serializable {
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.nl.b_lms.storage_manage.md.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.b_lms.storage_manage.md.dao.MdCsTransportationBase;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Date: 2025/7/3
|
||||
*/
|
||||
public interface MdCsTransportationBaseMapper extends BaseMapper<MdCsTransportationBase> {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.b_lms.storage_manage.md.dao.mapper.MdCsTransportationBaseMapper">
|
||||
</mapper>
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.nl.b_lms.storage_manage.md.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.b_lms.storage_manage.md.dao.MdCsTransportationBase;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Date: 2025/7/3
|
||||
*/
|
||||
public interface IMdCsTransportationBaseService extends IService<MdCsTransportationBase> {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.nl.b_lms.storage_manage.md.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.storage_manage.md.dao.MdCsTransportationBase;
|
||||
import org.nl.b_lms.storage_manage.md.dao.mapper.MdCsTransportationBaseMapper;
|
||||
import org.nl.b_lms.storage_manage.md.service.IMdCsTransportationBaseService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Date: 2025/7/3
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MdCsTransportationBaseServiceImpl extends ServiceImpl<MdCsTransportationBaseMapper, MdCsTransportationBase> implements IMdCsTransportationBaseService {
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.st.outbill.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
@@ -13,8 +14,10 @@ import org.nl.wms.st.outbill.service.dto.*;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
@@ -130,4 +133,10 @@ public class CheckOutBillController {
|
||||
checkOutBillService.outReturn(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/importExcel")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> importExcel(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
|
||||
checkOutBillService.importExcel(file, request);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@ import org.nl.wms.st.outbill.service.dto.*;
|
||||
import org.nl.wms.st.outbill.service.vo.OutBillDtlVo;
|
||||
import org.nl.wms.st.outbill.service.vo.OutBillTaskVo;
|
||||
import org.nl.wms.st.outbill.service.vo.StockMaterialVo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
@@ -81,4 +83,10 @@ public interface CheckOutBillService {
|
||||
* @param whereJson
|
||||
*/
|
||||
void outReturn(JSONObject whereJson);
|
||||
/**
|
||||
* 导入运费
|
||||
* @param file 文件
|
||||
* @param request 请求头
|
||||
*/
|
||||
void importExcel(MultipartFile file, HttpServletRequest request);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package org.nl.wms.st.outbill.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.poi.excel.ExcelReader;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -11,7 +16,10 @@ import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvService;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvdisService;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvdtlService;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinv;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinvdtl;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.mapper.StIvtIostorinvMapper;
|
||||
import org.nl.b_lms.storage_manage.md.dao.MdCsTransportationBase;
|
||||
import org.nl.b_lms.storage_manage.md.service.IMdCsTransportationBaseService;
|
||||
import org.nl.b_lms.storage_manage.st.dao.mapper.StIvtStructivtMapper;
|
||||
import org.nl.b_lms.storage_manage.st.service.StIvtBsrealstorattrService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -28,9 +36,14 @@ import org.nl.wms.st.outbill.service.vo.StockMaterialVo;
|
||||
import org.nl.wms.stat.service.enums.OutBillTypeEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -52,6 +65,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
private StIvtIostorinvMapper stIvtIostorinvMapper;
|
||||
@Autowired
|
||||
private StIvtStructivtMapper stIvtStructivtMapper;
|
||||
@Autowired
|
||||
private IMdCsTransportationBaseService mdCsTransportationBaseService;
|
||||
|
||||
@Override
|
||||
public List<OutBillDtlVo> getOutBillDtl(OutBillDtlQueryParam param) {
|
||||
@@ -229,6 +244,73 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
// bean.uploadMES(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importExcel(MultipartFile file, HttpServletRequest request) {
|
||||
// 1.获取上传文件输入流
|
||||
InputStream inputStream = null;
|
||||
|
||||
try {
|
||||
inputStream = file.getInputStream();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 查询所有物流公司
|
||||
List<MdCsTransportationBase> tranList = mdCsTransportationBaseService.list(new LambdaQueryWrapper<MdCsTransportationBase>()
|
||||
.eq(MdCsTransportationBase::getIs_delete, "0")
|
||||
.eq(MdCsTransportationBase::getIs_used, "1"));
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||
List<List<Object>> read = excelReader.read(1, excelReader.getRowCount());
|
||||
for (int i = 0; i < read.size(); i++) {
|
||||
List list = read.get(i);
|
||||
|
||||
// 交货单
|
||||
String vbeln = list.get(0).toString();
|
||||
|
||||
if (ObjectUtil.isEmpty(vbeln)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 根据交货单找到主单据
|
||||
List<JSONObject> jsonDtls = iostorinvdtlService.listObjs(new LambdaQueryWrapper<StIvtIostorinvdtl>().eq(StIvtIostorinvdtl::getVbeln, vbeln)
|
||||
, dtl -> (JSONObject) JSON.toJSON(dtl));
|
||||
if (jsonDtls.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
// 获取其中一个
|
||||
JSONObject jsonDtl = jsonDtls.get(0);
|
||||
StIvtIostorinv jsonMst = stIvtIostorinvService.getById(jsonDtl.getString("iostorinv_id"));
|
||||
|
||||
// 物流公司名称
|
||||
String cust_name = list.get(1).toString();
|
||||
// 匹配对应的物流公司
|
||||
MdCsTransportationBase trans = tranList.stream()
|
||||
.filter(row -> row.getCust_name().equals(cust_name))
|
||||
.findFirst().orElse(null);
|
||||
|
||||
// 运单号
|
||||
String order_number = list.get(2).toString();
|
||||
|
||||
// 车型
|
||||
String car_type = list.get(3).toString();
|
||||
|
||||
// 其他费用
|
||||
String other_freight = list.get(4).toString();
|
||||
|
||||
// 其他费用
|
||||
String estimated_freight = list.get(5).toString();
|
||||
|
||||
// 更新主表
|
||||
jsonMst.setTrans_code( ObjectUtil.isNotEmpty(trans) ? trans.getCust_code() : "" );
|
||||
jsonMst.setOrder_number(order_number);
|
||||
jsonMst.setCar_type(car_type);
|
||||
jsonMst.setOther_freight(new BigDecimal(other_freight));
|
||||
jsonMst.setEstimated_freight(new BigDecimal(estimated_freight));
|
||||
stIvtIostorinvService.updateById(jsonMst);
|
||||
}
|
||||
}
|
||||
|
||||
private void doLikeOrInParam(OutManageParam paramMap) {
|
||||
if (StrUtil.isNotEmpty(paramMap.getVbeln())){
|
||||
// 判断是否有空格
|
||||
|
||||
Reference in New Issue
Block a user