From c6bc9682699d3e10dc06a3d6641a70179e64f9a1 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期二, 14 九月 2021 08:32:11 +0800
Subject: [PATCH] Merge branch 'xgmasrs' of https://gitee.com/luxiaotao1123/zy-asrs into xgmasrs
---
src/main/java/com/zy/asrs/controller/PltBarcodeController.java | 157 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 157 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/PltBarcodeController.java b/src/main/java/com/zy/asrs/controller/PltBarcodeController.java
new file mode 100644
index 0000000..826ace7
--- /dev/null
+++ b/src/main/java/com/zy/asrs/controller/PltBarcodeController.java
@@ -0,0 +1,157 @@
+package com.zy.asrs.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.mapper.Wrapper;
+import com.baomidou.mybatisplus.plugins.Page;
+import com.core.annotations.ManagerAuth;
+import com.core.common.BaseRes;
+import com.core.common.Cools;
+import com.core.common.DateUtils;
+import com.core.common.R;
+import com.zy.asrs.entity.LocDetl;
+import com.zy.asrs.entity.PltBarcode;
+import com.zy.asrs.entity.WrkDetl;
+import com.zy.asrs.service.LocDetlService;
+import com.zy.asrs.service.PltBarcodeService;
+import com.zy.asrs.service.WrkDetlService;
+import com.zy.common.web.BaseController;
+import com.zy.ints.entity.WaitMatin;
+import com.zy.ints.service.WaitMatinService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+public class PltBarcodeController extends BaseController {
+
+ @Autowired
+ private PltBarcodeService pltBarcodeService;
+ @Autowired
+ private LocDetlService locDetlService;
+ @Autowired
+ private WrkDetlService wrkDetlService;
+ @Autowired
+ private WaitMatinService waitMatinService;
+
+ @RequestMapping(value = "/pltBarcode/{id}/auth")
+ @ManagerAuth
+ public R get(@PathVariable("id") String id) {
+ return R.ok(pltBarcodeService.selectById(String.valueOf(id)));
+ }
+
+ @RequestMapping(value = "/pltBarcode/list/auth")
+ @ManagerAuth
+ public R list(@RequestParam(defaultValue = "1")Integer curr,
+ @RequestParam(defaultValue = "10")Integer limit,
+ @RequestParam(required = false)String orderByField,
+ @RequestParam(required = false)String orderByType,
+ @RequestParam(required = false)String condition,
+ @RequestParam Map<String, Object> param){
+ EntityWrapper<PltBarcode> wrapper = new EntityWrapper<>();
+ excludeTrash(param);
+ convert(param, wrapper);
+ allLike(PltBarcode.class, param.keySet(), wrapper, condition);
+ if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
+ return R.ok(pltBarcodeService.selectPage(new Page<>(curr, limit), wrapper));
+ }
+
+ private void convert(Map<String, Object> map, EntityWrapper wrapper){
+ for (Map.Entry<String, Object> entry : map.entrySet()){
+ String val = String.valueOf(entry.getValue());
+ if (val.contains(RANGE_TIME_LINK)){
+ String[] dates = val.split(RANGE_TIME_LINK);
+ wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
+ wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
+ } else {
+ wrapper.like(entry.getKey(), val);
+ }
+ }
+ }
+
+ @RequestMapping(value = "/pltBarcode/add/auth")
+ @ManagerAuth
+ public R add(PltBarcode pltBarcode) {
+ pltBarcodeService.insert(pltBarcode);
+ return R.ok();
+ }
+
+ @RequestMapping(value = "/pltBarcode/update/auth")
+ @ManagerAuth
+ public R update(PltBarcode pltBarcode){
+ if (Cools.isEmpty(pltBarcode) || null==pltBarcode.getSeqNo()){
+ return R.error();
+ }
+ pltBarcodeService.updateById(pltBarcode);
+ return R.ok();
+ }
+
+ @RequestMapping(value = "/pltBarcode/delete/auth")
+ @ManagerAuth
+ public R delete(@RequestParam(value="ids[]") String[] ids){
+ for (String id : ids){
+ int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",id));
+ int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",id));
+ if (countLoc > 0 || countWrk > 0) {
+ return R.error("宸ヤ綔妗f垨搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�");
+ }else {
+// List<WaitMatin> waitMatins = waitMatinService.selectList();
+ List<PltBarcode> pltBarcodes = pltBarcodeService.selectList(new EntityWrapper<PltBarcode>().eq("barcode", id));
+ for(PltBarcode pltBarcode : pltBarcodes){
+ WaitMatin waitMatin = waitMatinService.selectOne(new EntityWrapper<WaitMatin>().eq("bill_no",pltBarcode.getBillNo())
+ .eq("seq_no",pltBarcode.getSeqNo()).eq("mat_no",pltBarcode.getMatNo()));
+ if(null != waitMatin){
+ waitMatin.setInQty(waitMatin.getInQty()-pltBarcode.getQty());
+ waitMatinService.update(waitMatin,new EntityWrapper<WaitMatin>().eq("bill_no",pltBarcode.getBillNo())
+ .eq("seq_no",pltBarcode.getSeqNo()).eq("mat_no",pltBarcode.getMatNo()));
+ }
+ }
+ pltBarcodeService.delete(new EntityWrapper<PltBarcode>().eq("barcode", id));
+ }
+// pltBarcodeService.deleteById(id);
+ }
+ return R.ok();
+ }
+
+ @RequestMapping(value = "/pltBarcode/export/auth")
+ @ManagerAuth
+ public R export(@RequestBody JSONObject param){
+ EntityWrapper<PltBarcode> wrapper = new EntityWrapper<>();
+ List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
+ Map<String, Object> map = excludeTrash(param.getJSONObject("pltBarcode"));
+ convert(map, wrapper);
+ List<PltBarcode> list = pltBarcodeService.selectList(wrapper);
+ return R.ok(exportSupport(list, fields));
+ }
+
+ @RequestMapping(value = "/pltBarcodeQuery/auth")
+ @ManagerAuth
+ public R query(String condition) {
+ EntityWrapper<PltBarcode> wrapper = new EntityWrapper<>();
+ wrapper.like("mat_no", condition);
+ Page<PltBarcode> page = pltBarcodeService.selectPage(new Page<>(0, 10), wrapper);
+ List<Map<String, Object>> result = new ArrayList<>();
+ for (PltBarcode pltBarcode : page.getRecords()){
+ Map<String, Object> map = new HashMap<>();
+ map.put("id", pltBarcode.getSeqNo());
+ map.put("value", pltBarcode.getMatNo());
+ result.add(map);
+ }
+ return R.ok(result);
+ }
+
+ @RequestMapping(value = "/pltBarcode/check/column/auth")
+ @ManagerAuth
+ public R query(@RequestBody JSONObject param) {
+ Wrapper<PltBarcode> wrapper = new EntityWrapper<PltBarcode>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
+ if (null != pltBarcodeService.selectOne(wrapper)){
+ return R.parse(BaseRes.REPEAT).add(getComment(PltBarcode.class, String.valueOf(param.get("key"))));
+ }
+ return R.ok();
+ }
+
+}
--
Gitblit v1.9.1