From eb151270cf5ec0166d11ad59af42785cf31b183c Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期五, 06 九月 2024 15:18:46 +0800
Subject: [PATCH] #
---
zy-asrs-wms/src/main/java/com/zy/asrs/wms/controller/TagController.java | 184 ++++++++++++++++++++++++++++++++++++++--------
1 files changed, 152 insertions(+), 32 deletions(-)
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/controller/TagController.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/controller/TagController.java
index 4576e75..00adcbe 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/controller/TagController.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/controller/TagController.java
@@ -5,11 +5,15 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zy.asrs.common.domain.CodeRes;
+import com.zy.asrs.common.domain.entity.LocInPrintMatExcel;
import com.zy.asrs.common.domain.entity.MatExcel;
import com.zy.asrs.common.domain.entity.MatPrint;
+import com.zy.asrs.common.domain.entity.OutLocOrderExcel;
import com.zy.asrs.common.utils.*;
+import com.zy.asrs.common.wms.entity.LocInPrintMat;
import com.zy.asrs.common.wms.entity.Mat;
import com.zy.asrs.common.wms.entity.Tag;
+import com.zy.asrs.common.wms.service.LocInPrintMatService;
import com.zy.asrs.common.wms.service.MatService;
import com.zy.asrs.common.wms.service.TagService;
import com.zy.asrs.framework.annotations.ManagerAuth;
@@ -41,6 +45,22 @@
private MatService matService;
@Autowired
private TreeUtils treeUtils;
+ @Autowired
+ private LocInPrintMatService locInPrintMatService;
+
+
+ @RequestMapping(value = "/tag/list/pda/auth")
+ @ManagerAuth
+ public R pdaList(@RequestParam(defaultValue = "1")Integer curr,
+ @RequestParam(defaultValue = "10")Integer limit,
+ @RequestParam(required = false)Long parentId){
+ LambdaQueryWrapper<Tag> tagLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ if(!Cools.isEmpty(parentId)) {
+ tagLambdaQueryWrapper.eq(Tag::getParentId, parentId == null ? getOriginTag().getId() : parentId);
+ }
+ List<Tag> tags = tagService.list(tagLambdaQueryWrapper);
+ return R.ok().add(tags);
+ }
@RequestMapping(value = "/tag/{id}/auth")
@ManagerAuth
@@ -50,26 +70,24 @@
@RequestMapping(value = "/tag/page/auth")
@ManagerAuth
- public R page(@RequestParam(defaultValue = "1") Integer curr,
- @RequestParam(defaultValue = "10") Integer limit,
- @RequestParam(required = false) String condition,
- @RequestParam(required = false) String timeRange) {
+ public R page(@RequestParam(defaultValue = "1")Integer curr,
+ @RequestParam(defaultValue = "10")Integer limit,
+ @RequestParam(required = false)String orderByField,
+ @RequestParam(required = false)String orderByType,
+ @RequestParam Map<String, Object> param) {
+ Long hostId = getHostId();
LambdaQueryWrapper<Tag> wrapper = new LambdaQueryWrapper<>();
- if (!Cools.isEmpty(condition)) {
- wrapper.like(Tag::getId, condition);
- }
- if (!Cools.isEmpty(timeRange)) {
- String[] range = timeRange.split(RANGE_TIME_LINK);
- wrapper.ge(Tag::getCreateTime, DateUtils.convert(range[0]));
- wrapper.le(Tag::getCreateTime, DateUtils.convert(range[1]));
- }
- return R.ok(tagService.page(new Page<>(curr, limit), wrapper));
+ wrapper.eq(Tag::getHostId, hostId);
+ excludeTrash(param);
+ return R.parse("0-鎿嶄綔鎴愬姛").add(tagService.list(wrapper));
}
@RequestMapping(value = "/tag/add/auth")
@ManagerAuth
public R add(Tag tag) {
+ tag.setHostId(getHostId());
+ tag.setStatus(1);
tagService.save(tag);
return R.ok();
}
@@ -124,7 +142,7 @@
@PostMapping(value = "/tag/tree/auth")
@ManagerAuth
public R tree(@RequestParam(required = false, defaultValue = "") String condition) throws IOException, ClassNotFoundException {
- ArrayList<Map> tree = treeUtils.getTree(String.valueOf(getOriginTag().getId()));
+ ArrayList<Map> tree = treeUtils.getTree(getOriginTag().getId(), getHostId());
// 娣辨嫹璐�
List<Map> result = ListUtils.deepCopy(tree);
if (!Cools.isEmpty(condition)) {
@@ -177,7 +195,66 @@
print.setSpecs(mat.getSpecs());
print.setUnit(mat.getUnit());
print.setMemo(mat.getMemo());
+
+ print.setMaterial(mat.getMaterial());
+ print.setDecrees(mat.getDecrees());
+ print.setImgNum(mat.getImgNum());
+ print.setWeight(String.valueOf(mat.getWeight()));
+ print.setModel(mat.getModel());
+ print.setLength(String.valueOf(mat.getLength()));
+ print.setWidth(mat.getWidth());
+ print.setHeight(mat.getHeight());
res.add(print);
+ }
+ return R.ok().add(res);
+ }
+
+ // 鎵撳嵃
+ @RequestMapping(value = "/loc/in/mat/print/auth")
+ @ManagerAuth(memo = "鍟嗗搧缂栫爜鎵撳嵃")
+ public R locInMatCodePrint(@RequestParam(value = "param[]") Long[] ids) {
+ if(Cools.isEmpty(ids)) {
+ return R.parse(CodeRes.EMPTY);
+ }
+ List<MatPrint> res = new ArrayList<>();
+ for (Long id : ids){
+ LocInPrintMat locInPrintMat = locInPrintMatService.getById(id);
+ Mat mat = matService.getOne(new LambdaQueryWrapper<Mat>().eq(Mat::getMatnr, locInPrintMat.getMatnr()));
+ if (Cools.isEmpty(mat)){
+ return R.error("鍝佸彿:"+locInPrintMat.getMatnr()+"涓嶅瓨鍦紝璇峰厛鏂板鍟嗗搧妗f锛侊紒锛�").add("鍝佸彿:"+locInPrintMat.getMatnr()+"涓嶅瓨鍦紝璇峰厛鏂板鍟嗗搧妗f锛侊紒锛�");
+ }
+ // 鎵撳嵃鏁版嵁娉ㄥ叆
+ MatPrint print = new MatPrint();
+ print.setMatnr(mat.getMatnr());
+ print.setBarcode(mat.getBarcode());
+ print.setMaktx(mat.getMaktx());
+ print.setSpecs(mat.getSpecs());
+ print.setUnit(mat.getUnit());
+ print.setMemo(mat.getMemo());
+
+ print.setMaterial(mat.getMaterial());
+ print.setDecrees(mat.getDecrees());
+ print.setImgNum(mat.getImgNum());
+ print.setWeight(String.valueOf(mat.getWeight()));
+ print.setModel(mat.getModel());
+ print.setLength(String.valueOf(mat.getLength()));
+ print.setWidth(mat.getWidth());
+ print.setHeight(mat.getHeight());
+// // 鎵撳嵃鏁版嵁娉ㄥ叆
+// MatPrint print = new MatPrint();
+// print.setMatnr(locInPrintMat.getMatnr());
+// print.setMaktx(locInPrintMat.getMaktx());
+// print.setBatch(locInPrintMat.getBatch());
+// print.setAnfme(locInPrintMat.getAnfme());
+// print.setLocNo(locInPrintMat.getLocNo());
+// print.setOwnerId(locInPrintMat.getOwnerId());
+// print.setOwner(locInPrintMat.getOwner$());
+ print.setId(locInPrintMat.getId());
+ res.add(print);
+ locInPrintMat.setUpdateTime(new Date());
+ locInPrintMat.setUpdateBy(getUserId());
+ locInPrintMat.setStatus(2);
+ locInPrintMatService.updateById(locInPrintMat);
}
return R.ok().add(res);
}
@@ -201,34 +278,77 @@
.doWrite(excels);
}
+// // excel瀵煎叆-------鍒ゆ柇鏄惁鏈夐噸澶嶇墿鏂�
+// @PostMapping(value = "/mat/excel/import/check/auth")
+// @ManagerAuth(memo = "鍟嗗搧妗f鏁版嵁瀵煎叆")
+// @Transactional
+// public R matExcelImportCheck(MultipartFile file) throws IOException {
+// MatExcelListener listener = new MatExcelListener(getUserId(), getHostId());
+// EasyExcel.read(file.getInputStream(), MatExcel.class, listener).sheet().doRead();
+// return R.ok("鎴愬姛鍚屾"+listener.getTotal()+"鏉″晢鍝佹暟鎹�");
+// }
+
// excel瀵煎叆
@PostMapping(value = "/mat/excel/import/auth")
@ManagerAuth(memo = "鍟嗗搧妗f鏁版嵁瀵煎叆")
@Transactional
public R matExcelImport(MultipartFile file) throws IOException {
- MatExcelListener listener = new MatExcelListener(getUserId());
+ MatExcelListener listener = new MatExcelListener(getUserId(), getHostId());
EasyExcel.read(file.getInputStream(), MatExcel.class, listener).sheet().doRead();
return R.ok("鎴愬姛鍚屾"+listener.getTotal()+"鏉″晢鍝佹暟鎹�");
}
- /*************************************** xm-select ***********************************************/
- // xm-select 鎼滅储鍟嗗搧鍒楄〃
- @RequestMapping("/mat/all/get/kv")
- @ManagerAuth
- public R getMatDataKV(@RequestParam(required = false) String condition) {
- LambdaQueryWrapper<Mat> wrapper = new LambdaQueryWrapper<Mat>()
- .like(Mat::getMatnr, condition).or().like(Mat::getMaktx, condition)
- .orderByAsc(Mat::getCreateTime);
- List<Mat> mats = matService.page(new Page<>(1, 30), wrapper).getRecords();
- List<KeyValueVo> valueVos = new ArrayList<>();
- for (Mat mat : mats) {
- KeyValueVo vo = new KeyValueVo();
- vo.setName(mat.getMatnr() + " - " + mat.getMaktx());
- vo.setValue(mat.getId());
- valueVos.add(vo);
- }
- return R.ok().add(valueVos);
+ /**
+ * excel瀵煎叆妯℃澘涓嬭浇
+ */
+ @RequestMapping(value = "/out/loc/box/excel/import/mould")
+ public void outLocBoxExcelImportMould(HttpServletResponse response) throws IOException {
+ List<LocInPrintMatExcel> excels = new ArrayList<>();
+ 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(), LocInPrintMatExcel.class)
+ .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+ .sheet("寰呮墦鍗扮墿鏂欐ā鏉�")
+ .doWrite(excels);
+ }
+
+ // excel瀵煎叆
+ @PostMapping(value = "/out/loc/box/excel/import/auth")
+ @ManagerAuth(memo = "瀵煎叆寰呮墦鍗扮墿鏂欐ā鏉�")
+ @Transactional
+ public R outLocBoxExcelImport(MultipartFile file) throws IOException {
+ LocInPrintMatExcelListener listener = new LocInPrintMatExcelListener(getUserId(), getHostId());
+ EasyExcel.read(file.getInputStream(), LocInPrintMatExcel.class, listener).sheet().doRead();
+ return R.ok("鎴愬姛瀵煎叆"+listener.getTotal()[0]+"绉嶅緟鎵撳嵃鐗╂枡淇℃伅锛屽叡鐢熸垚"+listener.getTotal()[1]+"鏉″緟鎵撳嵃鏉$爜锛�");
+ }
+
+ /**
+ * excel瀵煎叆妯℃澘涓嬭浇
+ */
+ @RequestMapping(value = "/out/loc/box/excel/import/out/mould")
+ public void outLocBoxExcelImportOutMould(HttpServletResponse response) throws IOException {
+ List<OutLocOrderExcel> excels = new ArrayList<>();
+ 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(), OutLocOrderExcel.class)
+ .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+ .sheet("鍑哄簱妯℃澘")
+ .doWrite(excels);
+ }
+
+ // excel瀵煎叆
+ @PostMapping(value = "/out/loc/box/excel/import/out/auth")
+ @ManagerAuth(memo = "瀵煎叆璁㈠崟淇℃伅鍑哄簱")
+ @Transactional
+ public R outLocBoxExcelImportOut(MultipartFile file) throws IOException {
+ OutLocOrderExcelListener listener = new OutLocOrderExcelListener(getUserId(), getHostId());
+ EasyExcel.read(file.getInputStream(), OutLocOrderExcel.class, listener).sheet().doRead();
+ return R.ok("鎴愬姛瀵煎叆"+listener.getTotal()[0]+"鏉¤鍗曟槑缁嗭紒");
}
}
--
Gitblit v1.9.1