From aea629d098bdab0918d90e0c51af9d7b099bca12 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 31 五月 2024 20:45:51 +0800
Subject: [PATCH] #新旧物料更新接口
---
src/main/java/com/zy/asrs/controller/LocDetlController.java | 102 ++++++++++++++++++++++++++++++++++++++------------
1 files changed, 77 insertions(+), 25 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/LocDetlController.java b/src/main/java/com/zy/asrs/controller/LocDetlController.java
index b25c818..3ab417a 100644
--- a/src/main/java/com/zy/asrs/controller/LocDetlController.java
+++ b/src/main/java/com/zy/asrs/controller/LocDetlController.java
@@ -1,7 +1,5 @@
package com.zy.asrs.controller;
-import com.alibaba.excel.EasyExcel;
-import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
@@ -21,9 +19,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.net.URLEncoder;
import java.util.*;
@RestController
@@ -90,12 +85,36 @@
@RequestParam(required = false)String orderByField,
@RequestParam(required = false)String orderByType,
@RequestParam(required = false)String condition,
- @RequestParam Map<String, Object> param){
- excludeTrash(param);
+ @RequestParam Map<String, Object> param,
+ @RequestParam(required = false)Boolean unreason){
+ if (!Cools.isEmpty(unreason) && unreason) {
+
+ return R.ok(locDetlService.selectPage(new Page<>(curr, limit), new EntityWrapper<LocDetl>()
+ .where(" DATALENGTH( batch ) != 11 or\n" +
+ " batch LIKE '%[a-z]%'")));
+ }
+ param.remove("unreason");
+ String row = "";
EntityWrapper<LocDetl> wrapper = new EntityWrapper<>();
+ if (param.get("row") != null) {
+ String chooseRow = (String) param.get("row");
+ if (chooseRow.length() == 1) {
+ row = "0" + chooseRow;
+ param.remove("row");
+ }else {
+ row = chooseRow;
+ param.remove("row");
+ }
+ }
+ excludeTrash(param);
convert(param, wrapper);
allLike(LocDetl.class, param.keySet(), wrapper, condition);
if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
+ if (!row.equals("")){
+ wrapper.and()
+ .where("loc_no like '" +row +"%'");
+ }
+
return R.ok(locDetlService.selectPage(new Page<>(curr, limit), wrapper));
}
@@ -139,6 +158,16 @@
return R.ok();
}
+ @RequestMapping(value = "/locDetl/updateStockFreeze/auth")
+ @ManagerAuth(memo = "搴撲綅鍐荤粨")
+ public R updateStockFreeze(LocDetl locDetl){
+ if (Cools.isEmpty(locDetl) || null==locDetl.getMatnr()){
+ return R.error();
+ }
+ locDetlService.updateStockFreeze(locDetl.getMatnr(), locDetl.getLocNo(), locDetl.getStockFreeze());
+ return R.ok();
+ }
+
@RequestMapping(value = "/locDetl/delete/auth")
@ManagerAuth(memo = "搴撲綅鏄庣粏鍒犻櫎")
public R delete(@RequestParam String param){
@@ -154,11 +183,26 @@
@RequestMapping(value = "/locDetl/export/auth")
@ManagerAuth(memo = "搴撲綅鏄庣粏瀵煎嚭")
- public R export(@RequestBody JSONObject param){
+ public synchronized R export(@RequestBody JSONObject param){
List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
EntityWrapper<LocDetl> wrapper = new EntityWrapper<>();
Map<String, Object> map = excludeTrash(param.getJSONObject("locDetl"));
+ String row = "";
+ if (map.get("row") != null) {
+ String chooseRow = (String) map.get("row");
+ if (chooseRow.length() == 1) {
+ row = "0" + chooseRow;
+ map.remove("row");
+ }else {
+ row = chooseRow;
+ map.remove("row");
+ }
+ }
convert(map, wrapper);
+ if (!row.equals("")){
+ wrapper.and()
+ .where("loc_no like '" +row +"%'");
+ }
List<LocDetl> list = locDetlService.selectList(wrapper);
return R.ok(exportSupport(list, fields));
}
@@ -207,24 +251,32 @@
@Autowired
private LocDetlMapper LocDetlMapper;
+// @RequestMapping(value = "/locDetl/statis/export")
+//// @ManagerAuth
+// public void statisExport(HttpServletResponse response) throws IOException {
+// List<LocDetl> excel = LocDetlMapper.getStockStatisExcel();
+// for (LocDetl locDetl : excel) {
+// Mat mat = matService.selectByMatnr(locDetl.getMatnr());
+// if (mat != null) {
+// locDetl.sync(mat);
+// }
+// }
+// response.setContentType("application/vnd.ms-excel");
+// response.setCharacterEncoding("utf-8");
+// String fileName = URLEncoder.encode("搴撳瓨鏄庣粏缁熻鎶ヨ〃", "UTF-8");
+// response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
+// EasyExcel.write(response.getOutputStream(), LocDetl.class)
+// .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+// .sheet("琛�1")
+// .doWrite(excel);
+// }
+
@RequestMapping(value = "/locDetl/statis/export")
-// @ManagerAuth
- public void statisExport(HttpServletResponse response) throws IOException {
- List<LocDetl> excel = LocDetlMapper.getStockStatisExcel();
- for (LocDetl locDetl : excel) {
- Mat mat = matService.selectByMatnr(locDetl.getMatnr());
- if (mat != null) {
- locDetl.sync(mat);
- }
- }
- response.setContentType("application/vnd.ms-excel");
- response.setCharacterEncoding("utf-8");
- String fileName = URLEncoder.encode("搴撳瓨鏄庣粏缁熻鎶ヨ〃", "UTF-8");
- response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
- EasyExcel.write(response.getOutputStream(), LocDetl.class)
- .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
- .sheet("琛�1")
- .doWrite(excel);
+ @ManagerAuth(memo = "搴撲綅鏄庣粏瀵煎嚭")
+ public synchronized R statisExport(@RequestBody JSONObject param){
+ List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
+ List<LocDetl> stockStatisExcel = LocDetlMapper.getStockStatisExcel();
+ return R.ok(exportSupport(stockStatisExcel, fields));
}
/**
--
Gitblit v1.9.1