rev:1.报废出库回传修改2.出库页面导入excel
This commit is contained in:
Binary file not shown.
@@ -3,7 +3,9 @@ package org.nl.wms.st.inbill.service;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
@@ -303,4 +305,11 @@ public interface CheckOutBillService {
|
||||
* }
|
||||
*/
|
||||
JSONObject updataIsOverdue(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 导入运费
|
||||
* @param file、
|
||||
* @param request、
|
||||
*/
|
||||
void importExcel(MultipartFile file, HttpServletRequest request);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.st.outbill.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -9,7 +10,9 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
@@ -313,10 +316,16 @@ public class CheckOutBillController {
|
||||
checkOutBillService.download(map, response, stor_id, bill_status, bill_type);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/updataIsOverdue")
|
||||
@Log("更新是否超期")
|
||||
public ResponseEntity<Object> updataIsOverdue(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(checkOutBillService.updataIsOverdue(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/importExcel")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> importExcel(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
|
||||
checkOutBillService.importExcel(file, request);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
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.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
@@ -39,10 +41,13 @@ import org.nl.wms.util.TranUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -1048,6 +1053,78 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importExcel(MultipartFile file, HttpServletRequest request) {
|
||||
// 明细
|
||||
WQLObject dtl = WQLObject.getWQLObject("st_ivt_iostorinvdtl");
|
||||
// 主表
|
||||
WQLObject mst = WQLObject.getWQLObject("st_ivt_iostorinv");
|
||||
// 物流公司
|
||||
WQLObject tran = WQLObject.getWQLObject("MD_CS_TransportationBase");
|
||||
|
||||
// 1.获取上传文件输入流
|
||||
InputStream inputStream = null;
|
||||
|
||||
try {
|
||||
inputStream = file.getInputStream();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 查询所有物流公司
|
||||
List<JSONObject> tranList = tran.query("is_used = '1' and is_delete = '0'")
|
||||
.getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// 根据交货单找到主单据
|
||||
JSONObject jsonDtl = dtl.query("vbeln = '" + vbeln + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonDtl)) {
|
||||
continue;
|
||||
}
|
||||
JSONObject jsonMst = mst.query("iostorinv_id = '" + jsonDtl.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
|
||||
// 物流公司名称
|
||||
String cust_name = list.get(1).toString();
|
||||
// 匹配对应的物流公司
|
||||
JSONObject jsonTran = tranList.stream()
|
||||
.filter(row -> row.getString("cust_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.put("trans_code", ObjectUtil.isNotEmpty(jsonTran) ? jsonTran.getString("cust_code") : "" );
|
||||
jsonMst.put("order_number", order_number);
|
||||
jsonMst.put("car_type", car_type);
|
||||
jsonMst.put("other_freight", other_freight);
|
||||
jsonMst.put("estimated_freight", estimated_freight);
|
||||
mst.update(jsonMst);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(JSONObject whereJson) {
|
||||
|
||||
@@ -410,10 +410,14 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
|
||||
// List<JSONObject> planList = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name in ('" + pcsn_in + "')").getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
JSONArray item = new JSONArray();
|
||||
// 查询仓库
|
||||
JSONObject jsonStor = WQLObject.getWQLObject("st_ivt_bsrealstorattr")
|
||||
.query("stor_code = '" + jo_mst.getString("stor_code") + "'").uniqueResult(0);
|
||||
|
||||
for (int j = 0; j < disArr.size(); j++) {
|
||||
JSONObject param = new JSONObject();
|
||||
JSONArray item = new JSONArray();
|
||||
|
||||
JSONObject json = disArr.getJSONObject(j);
|
||||
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
@@ -436,9 +440,20 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
}
|
||||
jsonDtl.put("Details", details);
|
||||
item.add(jsonDtl);
|
||||
|
||||
param.put("Items", item);
|
||||
|
||||
// 仓库编码
|
||||
param.put("WareHouse", jsonStor.getString("ext_id"));
|
||||
// new LmsToMesServiceImpl().ChildScrapUpdate(param);
|
||||
|
||||
// 更新分配回传成功
|
||||
JSONObject jsonUpdate = new JSONObject();
|
||||
jsonUpdate.put("is_upload", "1");
|
||||
|
||||
WQLObject.getWQLObject("st_ivt_iostorinvdis")
|
||||
.update(jsonUpdate,"iostorinv_id = '"+jo_mst.getString("iostorinv_id")+"' and box_no = '"+json.getString("box_no")+"'");
|
||||
}
|
||||
param.put("Items", item);
|
||||
new LmsToMesServiceImpl().ChildScrapUpdate(param);
|
||||
|
||||
jo_mst.put("upload_mes", "1");
|
||||
jo_mst.put("is_upload", "1");
|
||||
|
||||
@@ -210,6 +210,7 @@
|
||||
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
|
||||
WHERE
|
||||
dis.iostorinv_id = 输入.iostorinv_id
|
||||
AND dis.is_upload <> '1'
|
||||
GROUP BY dis.box_no
|
||||
|
||||
ENDSELECT
|
||||
|
||||
Reference in New Issue
Block a user