|
@ -1,9 +1,14 @@ |
|
|
package org.nl.wms.st.outbill.service.impl; |
|
|
package org.nl.wms.st.outbill.service.impl; |
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
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.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
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.IStIvtIostorinvdisService; |
|
|
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvdtlService; |
|
|
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.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.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.dao.mapper.StIvtStructivtMapper; |
|
|
import org.nl.b_lms.storage_manage.st.service.StIvtBsrealstorattrService; |
|
|
import org.nl.b_lms.storage_manage.st.service.StIvtBsrealstorattrService; |
|
|
import org.nl.common.domain.query.PageQuery; |
|
|
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.nl.wms.stat.service.enums.OutBillTypeEnum; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
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 javax.servlet.http.HttpServletResponse; |
|
|
import java.io.IOException; |
|
|
import java.io.IOException; |
|
|
|
|
|
import java.io.InputStream; |
|
|
|
|
|
import java.math.BigDecimal; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -52,6 +65,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { |
|
|
private StIvtIostorinvMapper stIvtIostorinvMapper; |
|
|
private StIvtIostorinvMapper stIvtIostorinvMapper; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private StIvtStructivtMapper stIvtStructivtMapper; |
|
|
private StIvtStructivtMapper stIvtStructivtMapper; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IMdCsTransportationBaseService mdCsTransportationBaseService; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<OutBillDtlVo> getOutBillDtl(OutBillDtlQueryParam param) { |
|
|
public List<OutBillDtlVo> getOutBillDtl(OutBillDtlQueryParam param) { |
|
@ -229,6 +244,73 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { |
|
|
// bean.uploadMES(param);
|
|
|
// 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) { |
|
|
private void doLikeOrInParam(OutManageParam paramMap) { |
|
|
if (StrUtil.isNotEmpty(paramMap.getVbeln())){ |
|
|
if (StrUtil.isNotEmpty(paramMap.getVbeln())){ |
|
|
// 判断是否有空格
|
|
|
// 判断是否有空格
|
|
|