From 63fd84ee4ad4a9e39d875fb8000f2ddd12864248 Mon Sep 17 00:00:00 2001 From: mrzhssss <pro6@qq.com> Date: 星期一, 12 九月 2022 15:39:07 +0800 Subject: [PATCH] # --- src/main/resources/mapper/ManLocDetlMapper.xml | 3 src/main/webapp/static/js/saas/stockAdjust.js | 243 +++++++++++++++++ src/main/java/com/zy/asrs/controller/ManLocDetlController.java | 9 src/main/java/com/zy/asrs/controller/NodeController.java | 8 src/main/java/com/zy/asrs/service/ManLocDetlService.java | 3 src/main/java/com/zy/asrs/service/impl/ManLocDetlServiceImpl.java | 226 +++++++++------ src/main/webapp/views/saas/matQuery.html | 194 +++++++++++++ src/main/webapp/views/saas/stockAdjust.html | 133 +++++++++ 8 files changed, 728 insertions(+), 91 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/ManLocDetlController.java b/src/main/java/com/zy/asrs/controller/ManLocDetlController.java index f747394..4e377e6 100644 --- a/src/main/java/com/zy/asrs/controller/ManLocDetlController.java +++ b/src/main/java/com/zy/asrs/controller/ManLocDetlController.java @@ -6,9 +6,11 @@ import com.core.common.DateUtils; import com.core.common.R; import com.zy.asrs.entity.ManLocDetl; +import com.zy.asrs.entity.param.LocDetlAdjustParam; import com.zy.asrs.service.ManLocDetlService; import com.zy.common.web.BaseController; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -68,5 +70,12 @@ return R.ok(outPage); } + @RequestMapping("/manLocDetl/adjust/start") + @ManagerAuth(memo = "搴撳瓨璋冩暣") + public R locDetlAdjustStart(@RequestBody LocDetlAdjustParam param) { + manLocDetlService.adjustLocDetl(param, getUserId()); + return R.ok("搴撳瓨璋冩暣鎴愬姛"); + } + } diff --git a/src/main/java/com/zy/asrs/controller/NodeController.java b/src/main/java/com/zy/asrs/controller/NodeController.java index a7033ed..bf00f51 100644 --- a/src/main/java/com/zy/asrs/controller/NodeController.java +++ b/src/main/java/com/zy/asrs/controller/NodeController.java @@ -324,4 +324,12 @@ nodeService.locMove(sourceLocNo, targetLocNo, getUserId()); return R.ok("绉诲簱鍚姩鎴愬姛"); } + @RequestMapping(value = "/node/select/{id}/auth") + @ManagerAuth + public R getById(@PathVariable("id") String id) { + Node node = nodeService.selectOne(new EntityWrapper<Node>() + .eq("uuid",id)); + return R.ok(node); + } + } diff --git a/src/main/java/com/zy/asrs/service/ManLocDetlService.java b/src/main/java/com/zy/asrs/service/ManLocDetlService.java index 63b5350..dcf7459 100644 --- a/src/main/java/com/zy/asrs/service/ManLocDetlService.java +++ b/src/main/java/com/zy/asrs/service/ManLocDetlService.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.service.IService; import com.zy.asrs.entity.ManLocDetl; +import com.zy.asrs.entity.param.LocDetlAdjustParam; import com.zy.asrs.entity.result.StockVo; import java.util.List; @@ -57,5 +58,5 @@ Page<ManLocDetl> getOutPage(Page<ManLocDetl> manLocDetlPage); - + void adjustLocDetl(LocDetlAdjustParam param, Long userId); } diff --git a/src/main/java/com/zy/asrs/service/impl/ManLocDetlServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/ManLocDetlServiceImpl.java index 57e2713..3b066b9 100644 --- a/src/main/java/com/zy/asrs/service/impl/ManLocDetlServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/ManLocDetlServiceImpl.java @@ -1,126 +1,135 @@ package com.zy.asrs.service.impl; +import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import com.zy.asrs.entity.ManLocDetl; +import com.core.common.Cools; +import com.core.exception.CoolException; +import com.zy.asrs.entity.*; +import com.zy.asrs.entity.param.LocDetlAdjustParam; import com.zy.asrs.entity.result.StockVo; import com.zy.asrs.mapper.ManLocDetlMapper; import com.zy.asrs.service.ManLocDetlService; +import com.zy.asrs.service.MatService; +import com.zy.asrs.service.NodeService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; @Service("manLocDetlService") -public class ManLocDetlServiceImpl extends ServiceImpl<ManLocDetlMapper, ManLocDetl> implements ManLocDetlService{ +public class ManLocDetlServiceImpl extends ServiceImpl<ManLocDetlMapper, ManLocDetl> implements ManLocDetlService { + @Autowired + private MatService matService; + @Autowired + private NodeService nodeService; + @Override + public Page<ManLocDetl> getPage(Page<ManLocDetl> page) { + Map<String, Object> condition = page.getCondition(); + List<ManLocDetl> manLocDetls = baseMapper.listByPage(condition); + page.setRecords(manLocDetls); + page.setTotal(baseMapper.listByPageCount(page.getCondition())); + return page; + } + @Override + public Page<ManLocDetl> getStockOut(Page<ManLocDetl> page) { + page.setRecords(baseMapper.getStockOutPage(page.getCondition())); + page.setTotal(baseMapper.getStockOutPageCount(page.getCondition())); + return page; + } - @Override - public Page<ManLocDetl> getPage(Page<ManLocDetl> page) { - Map<String, Object> condition = page.getCondition(); - List<ManLocDetl> manLocDetls = baseMapper.listByPage(condition); - page.setRecords(manLocDetls); - page.setTotal(baseMapper.listByPageCount(page.getCondition())); - return page; + @Override + public boolean updateAnfme(Double anfme, String locNo, String matnr, String batch) { + if (anfme <= 0) { + return this.baseMapper.deleteItem(locNo, matnr, batch) > 0; + } else { + return baseMapper.updateAnfme(anfme, locNo, matnr, batch) > 0; } - - @Override - public Page<ManLocDetl> getStockOut(Page<ManLocDetl> page) { - page.setRecords(baseMapper.getStockOutPage(page.getCondition())); - page.setTotal(baseMapper.getStockOutPageCount(page.getCondition())); - return page; - } - - @Override - public boolean updateAnfme(Double anfme, String locNo, String matnr, String batch) { - if (anfme <= 0) { - return this.baseMapper.deleteItem(locNo, matnr, batch) > 0; - } else { - return baseMapper.updateAnfme(anfme, locNo, matnr, batch) > 0; - } - } + } - @Override - public boolean updateLocNo(String newLocNo, String oldLocNo) { - return baseMapper.updateLocNo(newLocNo, oldLocNo) > 0; - } + @Override + public boolean updateLocNo(String newLocNo, String oldLocNo) { + return baseMapper.updateLocNo(newLocNo, oldLocNo) > 0; + } - @Override - public List<String> getSameDetlToday(String matnr, Integer start, Integer end) { - return this.baseMapper.selectSameDetlToday(matnr, start, end); - } + @Override + public List<String> getSameDetlToday(String matnr, Integer start, Integer end) { + return this.baseMapper.selectSameDetlToday(matnr, start, end); + } - @Override - public Page<ManLocDetl> getStockStatis(Page<ManLocDetl> page) { - page.setRecords(baseMapper.getStockStatis(page.getCondition())); - page.setTotal(baseMapper.getStockStatisCount(page.getCondition())); - return page; - } + @Override + public Page<ManLocDetl> getStockStatis(Page<ManLocDetl> page) { + page.setRecords(baseMapper.getStockStatis(page.getCondition())); + page.setTotal(baseMapper.getStockStatisCount(page.getCondition())); + return page; + } - @Override - public Double getSumAnfme(String matnr) { - return this.baseMapper.selectSumAnfmeByMatnr(matnr); - } + @Override + public Double getSumAnfme(String matnr) { + return this.baseMapper.selectSumAnfmeByMatnr(matnr); + } - @Override - public List<ManLocDetl> selectPakoutByRule(String matnr) { - return this.baseMapper.selectPakoutByRule(matnr); - } + @Override + public List<ManLocDetl> selectPakoutByRule(String matnr) { + return this.baseMapper.selectPakoutByRule(matnr); + } - @Override - public List<ManLocDetl> getAsrsLocDetl(String matnr) { - return this.baseMapper.getAsrsLocDetl(matnr); - } + @Override + public List<ManLocDetl> getAsrsLocDetl(String matnr) { + return this.baseMapper.getAsrsLocDetl(matnr); + } - @Override - public Integer countLocNoNum(String locNo) { - return this.baseMapper.countLocNoNum(locNo); - } + @Override + public Integer countLocNoNum(String locNo) { + return this.baseMapper.countLocNoNum(locNo); + } - @Override - public List<ManLocDetl> queryStock(String matnr, String batch, String orderNo, Set<String> locNos) { - return this.baseMapper.queryStock(matnr, batch, orderNo, locNos); - } + @Override + public List<ManLocDetl> queryStock(String matnr, String batch, String orderNo, Set<String> locNos) { + return this.baseMapper.queryStock(matnr, batch, orderNo, locNos); + } - @Override - public Double queryStockAnfme(String matnr, String batch) { - return this.baseMapper.queryStockAnfme(matnr, batch); - } + @Override + public Double queryStockAnfme(String matnr, String batch) { + return this.baseMapper.queryStockAnfme(matnr, batch); + } - @Override - public List<StockVo> queryStockTotal() { - return this.baseMapper.queryStockTotal(); - } + @Override + public List<StockVo> queryStockTotal() { + return this.baseMapper.queryStockTotal(); + } - /** - * 鑾峰彇搴撳瓨鎬绘暟 - * @return - */ - @Override - public Integer sum() { + /** + * 鑾峰彇搴撳瓨鎬绘暟 + * + * @return + */ + @Override + public Integer sum() { - return this.baseMapper.sum(); - } + return this.baseMapper.sum(); + } - @Override - public List<ManLocDetl> unreason() { - return this.baseMapper.unreason(); - } + @Override + public List<ManLocDetl> unreason() { + return this.baseMapper.unreason(); + } - @Override - public ManLocDetl selectItem(String locNo, String matnr, String batch) { - return this.baseMapper.selectItem(locNo, matnr, batch); - } + @Override + public ManLocDetl selectItem(String locNo, String matnr, String batch) { + return this.baseMapper.selectItem(locNo, matnr, batch); + } - @Override - public Double getLocDetlSumQty(String locNo) { - return this.baseMapper.selectLocDetlSumQty(locNo); - } + @Override + public Double getLocDetlSumQty(String locNo) { + return this.baseMapper.selectLocDetlSumQty(locNo); + } @Override public Page<ManLocDetl> getOutPage(Page<ManLocDetl> manLocDetlPage) { @@ -131,4 +140,41 @@ return manLocDetlPage; } + @Transactional + @Override + public void adjustLocDetl(LocDetlAdjustParam param, Long userId) { + Date now = new Date(); + this.baseMapper.delete(new EntityWrapper<ManLocDetl>() + .eq("loc_no", param.getLocNo())); + for (LocDetlAdjustParam.LocDetlAdjust locDetlAdjust : param.getList()) { + Mat mat = matService.selectOne(new EntityWrapper<Mat>() + .eq("matnr", locDetlAdjust.getMatnr())); + if (mat == null) { + throw new CoolException("鏃犳硶鎵惧埌闇�瑕佽皟鏁寸殑鐗╂枡,璇疯仈绯荤鐞嗗憳"); + } + Node node = nodeService.selectOne(new EntityWrapper<Node>() + .eq("uuid", param.getLocNo())); + if (node == null) { + throw new CoolException("鏃犳硶鎵惧埌闇�瑕佽皟鏁寸殑搴撲綅,璇疯仈绯荤鐞嗗憳"); + + } + ManLocDetl manLocDetl = new ManLocDetl(); + manLocDetl.setLocNo(param.getLocNo()); + manLocDetl.setNodeId(node.getId()); + manLocDetl.setZpallet(mat.getBarcode()); + manLocDetl.setAnfme(locDetlAdjust.getCount()); + manLocDetl.setMatnr(mat.getMatnr()); + manLocDetl.setMaktx(mat.getMaktx()); + manLocDetl.setName(mat.getName()); + manLocDetl.setSpecs(mat.getSpecs()); + manLocDetl.setModel(mat.getModel()); + manLocDetl.setBatch(locDetlAdjust.getBatch()); + manLocDetl.setUnit(mat.getUnit()); + manLocDetl.setBarcode(mat.getBarcode()); + manLocDetl.setPrice(mat.getPrice()); + this.baseMapper.insert(manLocDetl); + } + } + + } diff --git a/src/main/resources/mapper/ManLocDetlMapper.xml b/src/main/resources/mapper/ManLocDetlMapper.xml index c9ece68..3f829d0 100644 --- a/src/main/resources/mapper/ManLocDetlMapper.xml +++ b/src/main/resources/mapper/ManLocDetlMapper.xml @@ -40,6 +40,9 @@ <if test="loc_no != null and loc_no != ''"> and mld.loc_no like concat('%',#{loc_no},'%') </if> + <if test="locNo != null and locNo != ''"> + and mld.loc_no like concat('%',#{loc_no},'%') + </if> <if test="matnr != null and matnr != ''"> and mld.matnr like concat('%',#{matnr},'%') </if> diff --git a/src/main/webapp/static/js/saas/stockAdjust.js b/src/main/webapp/static/js/saas/stockAdjust.js new file mode 100644 index 0000000..cb68ae0 --- /dev/null +++ b/src/main/webapp/static/js/saas/stockAdjust.js @@ -0,0 +1,243 @@ +var initCountVal = 0; +var initAnfmeVal = "-"; +var matCodeData = []; +var currLocNo; +var matCodeLayerIdx; +function getCol() { + var cols = [ + {fixed: 'left', field: 'count', title: '瀹為檯鏁伴噺', align: 'center', edit:'text', width: 120, style:'color: blue;font-weight: bold'} + ,{field: 'anfme', align: 'center',title: '鏁伴噺'} + ,{field: 'batch', align: 'center',title: '鎵瑰彿锛堢紪杈戯級', edit: true, style: 'font-weight:bold'} + ]; + arrRemove(detlCols, "field", "anfme"); + arrRemove(detlCols, "field", "batch"); + cols.push.apply(cols, detlCols); + cols.push({fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:80}) + return cols; +} + +layui.config({ + base: baseUrl + "/static/layui/lay/modules/" +}).use(['table','laydate', 'form', 'admin'], function() { + var table = layui.table; + var $ = layui.jquery; + var layer = layui.layer; + var layDate = layui.laydate; + var form = layui.form; + var admin = layui.admin; + + tableIns = table.render({ + elem: '#chooseData', + data: [], + even: true, + limit: 500, + cellMinWidth: 50, + toolbar: '#toolbar', + cols: [getCol()], + done: function (res, curr, count) { + limit(); + } + }); + + // 椤甸潰淇敼 + table.on('edit(chooseData)', function (obj) { + let index = obj.tr.attr("data-index"); + let data = matCodeData[index]; + let modify = true; + if (obj.field === 'count'){ + let vle = Number(obj.value); + if (isNaN(vle)) { + layer.msg("璇疯緭鍏ユ暟瀛�", {icon: 2}); + modify = false; + } else { + if (vle <= 0) { + layer.msg("鏁伴噺蹇呴』澶т簬闆�", {icon: 2}); + modify = false; + } + } + } + if (modify) { + data[obj.field] = obj.value; + } + tableIns.reload({data: matCodeData}); + }); + + // 鐩戝惉澶村伐鍏锋爮浜嬩欢 + table.on('toolbar(chooseData)', function (obj) { + switch(obj.event) { + case 'adjust': + if (isEmpty(currLocNo)) { + layer.msg("璇峰厛妫�绱㈠簱浣�", {icon: 2}) + inputTip($("#searchLocNo")); + return; + } + if (matCodeData.length === 0) { + layer.msg("璇峰厛娣诲姞鏄庣粏", {icon: 2}); + return; + } + for (var i=0;i<matCodeData.length;i++){ + if (isNaN(matCodeData[i].count)) { + layer.msg("璇疯緭鍏ユ暟瀛�", {icon: 2}); + return; + } + if (matCodeData[i].count < 0){ + layer.msg("鏁伴噺涓嶈兘灏忎簬闆�", {icon: 2}); + return; + } + } + layer.confirm('纭畾璋冩暣'+currLocNo+'搴撲綅鐨勬槑缁嗗悧锛�', {shadeClose: true}, function(){ + $.ajax({ + url: baseUrl+"/manLocDetl/adjust/start", + headers: {'token': localStorage.getItem('token')}, + data: JSON.stringify({ + locNo: currLocNo, + list: matCodeData + }), + contentType:'application/json;charset=UTF-8', + method: 'POST', + async: false, + success: function (res) { + if (res.code === 200){ + layer.msg(currLocNo + res.msg, {icon: 1}); + init(currLocNo) + } else if (res.code === 403){ + top.location.href = baseUrl+"/"; + }else { + layer.msg(res.msg, {icon: 2}) + } + } + }) + }); + break; + } + }); + + // 鐩戝惉琛屽伐鍏蜂簨浠� + table.on('tool(chooseData)', function(obj){ + var data = obj.data; + switch (obj.event) { + case 'remove': + let index = obj.tr.attr("data-index"); + matCodeData.splice(index, 1); + tableIns.reload({data: matCodeData}); + break; + } + }); + + // 妫�绱簨浠� + form.on('submit(search)', function (data) { + let loc_no = data.field.loc_no; + if (loc_no === "") { + inputTip($("#searchLocNo")); + layer.msg("璇疯緭鍏ュ簱浣嶅彿"); + return; + } + init(loc_no); + }); + + // 閲嶇疆浜嬩欢 + form.on('submit(reset)', function (data) { + reset(); + }); + + function init(locNo) { + http.post(baseUrl + "/manLocDetl/list", {loc_no: locNo,limit: 1000}, function (res) { + matCodeData = []; + matCodeData = res.data.records; + for (var i = 0; i<matCodeData.length; i++) { + matCodeData[i]["count"] = matCodeData[i]["anfme"]; + } + locTips(true, locNo); + tableReload(); + }) + } + + function reset() { + clearFormVal($('#search-box')); + matCodeData = []; + tableReload(); + locTips(false); + } + + // 閲嶈浇琛ㄦ牸 + function tableReload() { + tableIns.reload({data: matCodeData}); + } + + // 搴撲綅鎻愮ず妗� + function locTips(retrieve, locNo) { + if (retrieve) { + http.post(baseUrl+"/node/select/"+locNo+"/auth", null, function (res) { + console.log(res); + let data = res.data; + if (data != null) { + $(".retrieve").show(); + // $("#locMsg").html(locNo + " ,搴撲綅鐘舵�侊細" + data.locSts$); + $("#locMsg").html(locNo + " "); + $('.not-retrieve').hide(); + currLocNo = locNo; + } else { + layer.msg("璇疯緭鍏ユ湁鏁堝簱浣嶅彿", {icon: 2}); + $('.not-retrieve').show(); + $("#locMsg").html(""); + $(".retrieve").hide(); + currLocNo = null; + inputTip($("#searchLocNo")); + } + }) + } else { + $('.not-retrieve').show(); + $("#locMsg").html(""); + $(".retrieve").hide(); + currLocNo = null; + } + } + + $(document).on('click','#mat-query', function () { + if (isEmpty(currLocNo)) { + layer.msg("璇峰厛妫�绱㈠簱浣�") + inputTip($("#searchLocNo")); + return; + } + let loadIndex = layer.msg('璇锋眰涓�...', {icon: 16, shade: 0.01, time: false}); + matCodeLayerIdx = admin.open({ + type: 2, + title: false, + closeBtn: false, + maxmin: false, + area: ['90%', '85%'], + shadeClose: true, + content: 'matQuery.html', + success: function(layero, index){ + layer.close(loadIndex); + } + }); + }) + +}) + +// 鎼滅储妗嗙┖鍊兼彁绀� +function inputTip(el) { + el.css("border-color", "red"); + setTimeout(function () { + el.css("border-color", "#b8b8b8"); + }, 1000); +} + +// 娣诲姞琛ㄦ牸鏁版嵁 +function addTableData(data) { + for (let i=0;i<data.length;i++){ + for (let j=0;j<matCodeData.length;j++){ + if (data[i].matnr === matCodeData[j].matnr && data[i].batch === matCodeData[j].batch) { + data.splice(i, 1); + break; + } else { + data[i]['anfme'] = initAnfmeVal; + data[i]['count'] = initCountVal; + } + } + } + matCodeData.push.apply(matCodeData, data); + tableIns.reload({data: matCodeData}); + layer.close(matCodeLayerIdx); +} diff --git a/src/main/webapp/views/saas/matQuery.html b/src/main/webapp/views/saas/matQuery.html new file mode 100644 index 0000000..351d3d1 --- /dev/null +++ b/src/main/webapp/views/saas/matQuery.html @@ -0,0 +1,194 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title></title> + <meta name="renderer" content="webkit"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> + <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> + <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all"> + <link rel="stylesheet" href="../../static/css/cool.css" media="all"> + <link rel="stylesheet" href="../../static/css/common.css" media="all"> + <style> + body { + padding: 0 20px; + } + .layui-table-box { + border-right: 1px solid #9F9F9F; + border-left: 1px solid #9F9F9F; + } + </style> +</head> +<body> + +<!-- 鎼滅储鏍� --> +<fieldset class="layui-elem-field site-demo-button" style="margin: 20px;"> + <legend>鎼滅储鏍�</legend> + <div id="search-box" class="layui-form layui-card-header"> + <div class="layui-inline"> + <div class="layui-input-inline"> + <input class="layui-input" type="text" name="matnr" placeholder="鍟嗗搧缂栫爜" autocomplete="off"> + </div> + </div> + <div class="layui-inline"> + <div class="layui-input-inline"> + <input class="layui-input" type="text" name="maktx" placeholder="鍟嗗搧鍚嶇О" autocomplete="off"> + </div> + </div> + <!-- 鏃ユ湡鑼冨洿 --> + <div class="layui-inline" style="width: 300px"> + <div class="layui-input-inline"> + <input class="layui-input layui-laydate-range" name="update_time" type="text" placeholder="璧峰鏃堕棿 - 缁堟鏃堕棿" autocomplete="off" style="width: 300px"> + </div> + </div> + <!-- 寰呮坊鍔� --> + <div id="data-search-btn" class="layui-btn-container layui-form-item" style="display: inline-block"> + <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">鎼滅储</button> + <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">閲嶇疆</button> + </div> + </div> +</fieldset> + +<script type="text/html" id="toolbar"> + <div class="layui-btn-container"> + <button class="layui-btn" id="btn-confirm" lay-event="confirm" style="">鎻愬彇</button> + </div> +</script> + +<div class="layui-form"> + <table class="layui-hide" id="matCode" lay-filter="matCode"></table> +</div> + +<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> +<script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> +<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> +<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> +<script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> + +</body> +<script> + function getCol() { + var cols = [ + {type: 'checkbox', fixed: 'left'} + ]; + cols.push.apply(cols, matCols); + cols.push( + {field: 'updateBy$', align: 'center',title: '淇敼浜哄憳', hide: true}, + {field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'} + ) + return cols; + } + var pageCurr; + layui.use(['table','laydate', 'form'], function() { + var table = layui.table; + var $ = layui.jquery; + var layer = layui.layer; + var layDate = layui.laydate; + var form = layui.form; + // 鐗╂枡鏌ヨ鏁版嵁琛� + matQueryTable = table.render({ + elem: '#matCode', + headers: {token: localStorage.getItem('token')}, + url: baseUrl + '/mat/list/auth', + page: true, + limit: 7, + limits: [7, 10, 30,50,100], + even: true, + cellMinWidth: 50, + toolbar: '#toolbar', + cols: [getCol()], + request: { + pageName: 'curr', + pageSize: 'limit' + }, + parseData: function (res) { + return { + 'code': res.code, + 'msg': res.msg, + 'count': res.data.total, + 'data': res.data.records + } + }, + response: { + statusCode: 200 + }, + done: function (res, curr, count) { + if (res.code === 403) { + top.location.href = baseUrl + "/"; + } + } + }); + + // 鐩戝惉澶村伐鍏锋爮浜嬩欢 + table.on('toolbar(matCode)', function (obj) { + var checkStatus = table.checkStatus(obj.config.id); + var data = checkStatus.data; + switch(obj.event) { + case 'confirm': + if (data.length === 0){ + layer.msg("璇烽�夋嫨鏁版嵁"); + return; + } + parent.addTableData(data); + break; + } + }); + + // 鎼滅储鏍忔悳绱簨浠� + form.on('submit(search)', function (data) { + pageCurr = 1; + tableReload(false); + }); + + // 鎼滅储鏍忛噸缃簨浠� + form.on('submit(reset)', function (data) { + pageCurr = 1; + clearFormVal($('#search-box')); + tableReload(); + }); + + layDate.render({ + elem: '.layui-laydate-range' + ,type: 'datetime' + ,range: true + }); + }) + + function tableReload(child) { + var searchData = {}; + $.each($('#search-box [name]').serializeArray(), function() { + searchData[this.name] = this.value; + }); + matQueryTable.reload({ + where: searchData, + page: { + curr: pageCurr + }, + done: function (res, curr, count) { + if (res.code === 403) { + top.location.href = baseUrl+"/"; + } + pageCurr=curr; + if (res.data.length === 0 && count !== 0) { + tableIns.reload({ + where: searchData, + page: { + curr: pageCurr-1 + } + }); + pageCurr -= 1; + } + } + }); + } + + function clearFormVal(el) { + $(':input', el) + .val('') + .removeAttr('checked') + .removeAttr('selected'); + } +</script> +</html> + diff --git a/src/main/webapp/views/saas/stockAdjust.html b/src/main/webapp/views/saas/stockAdjust.html new file mode 100644 index 0000000..63d49fb --- /dev/null +++ b/src/main/webapp/views/saas/stockAdjust.html @@ -0,0 +1,133 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title></title> + <meta name="renderer" content="webkit"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> + <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> + <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all"> + <link rel="stylesheet" href="../../static/css/cool.css" media="all"> + <link rel="stylesheet" href="../../static/css/common.css" media="all"> + <style> + html { + height: 100%; + padding: 10px; + background-color: #f1f1f1; + box-sizing: border-box; + } + body { + background-color: #fff; + border-radius: 5px; + box-shadow: 0 0 3px rgba(0,0,0,.3); + } + + /* search */ + .layui-card-header { + border-bottom: none; + } + #search-box { + padding: 30px 0 10px 0; + } + #search-box .layui-inline:first-child { + margin-left: 30px; + } + #search-box .layui-inline { + margin-right: 5px; + } + + #data-search-btn { + margin-left: 10px; + display: inline-block; + } + #data-search-btn.layui-btn-container .layui-btn { + margin-right: 20px; + } + + /* add */ + .function-area { + padding: 15px 0 20px 40px; + } + .function-btn { + font-size: 16px; + padding: 1px 1px 1px 1px; + width: 120px; + height: 40px; + border-color: #2b425b; + border-radius: 4px; + border-width: 1px; + background: none; + border-style: solid; + transition: 0.4s; + cursor: pointer; + } + .function-btn:hover { + background-color: #2b425b; + color: #fff; + } + + #mat-query { + /*display: none;*/ + } + #btn-adjust { + /*display: none;*/ + } + </style> +</head> +<body style="padding-bottom: 30px"> + +<!-- 鎼滅储鏍� --> +<div id="search-box" class="layui-form layui-card-header"> + <div class="layui-inline"> + <div class="layui-input-inline"> + <input id="searchLocNo" class="layui-input" type="text" name="loc_no" placeholder="搴撲綅鍙�" autocomplete="off" style="height: 45px;border-color: #b8b8b8"> + </div> + </div> + <!-- 寰呮坊鍔� --> + <div id="data-search-btn" class="layui-btn-container layui-form-item" style="display: inline-block"> + <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">妫�绱�</button> + <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">閲嶇疆</button> + </div> + <!-- 搴撲綅鎻愮ず --> + <div style="display: inline-block; font-size: 20px;font-weight: 300"> + <div class="not-retrieve" style="color: #ff0000;font-family: '榛戜綋';"> + 璇峰厛妫�绱㈠簱浣� + </div> + <div class="retrieve" style="display: none;color: #0097ff;font-family: '榛戜綋';"> + 褰撳墠妫�绱㈠簱浣�: <span id="locMsg" style=""></span> + </div> + + </div> +</div> + +<hr> + +<!-- 鍔熻兘鍖� --> +<div class="function-area"> + <button id="mat-query" class="function-btn">鏂板搴撳瓨</button> +</div> + +<!-- 澶撮儴 --> +<script type="text/html" id="toolbar"> + <button class="layui-btn layui-btn-lg" id="btn-adjust" lay-event="adjust" style="">璋冩暣搴撳瓨</button> +</script> + +<!-- 琛� --> +<script type="text/html" id="operate"> + <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="remove">绉婚櫎</a> +</script> + +<!-- 琛ㄦ牸 --> +<table class="layui-table" id="chooseData" lay-filter="chooseData"></table> + +<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> +<script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> +<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> +<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> +<script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> +<script type="text/javascript" src="../../static/js/saas/stockAdjust.js" charset="utf-8"></script> + +</body> +</html> + -- Gitblit v1.9.1