From b392ca2326ddefda33845611f9c7499d0fd6fcef Mon Sep 17 00:00:00 2001 From: tqs <56479841@qq.com> Date: 星期六, 29 十月 2022 15:51:28 +0800 Subject: [PATCH] Merge remote-tracking branch 'gitbit/bfasrs' into bfasrs --- src/main/java/com/zy/asrs/controller/LocDetlController.java | 133 ++++++----- src/main/java/com/zy/asrs/entity/LocDetl.java | 149 ++++++++----- src/main/webapp/static/js/locDetlGroup/locDetlGroup.js | 322 +++++++++++++++-------------- src/main/webapp/static/js/order/order.js | 13 + 4 files changed, 338 insertions(+), 279 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/LocDetlController.java b/src/main/java/com/zy/asrs/controller/LocDetlController.java index 767f5a5..1eadc60 100644 --- a/src/main/java/com/zy/asrs/controller/LocDetlController.java +++ b/src/main/java/com/zy/asrs/controller/LocDetlController.java @@ -22,8 +22,10 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import javax.xml.crypto.Data; import java.io.IOException; import java.net.URLEncoder; +import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; @@ -53,7 +55,7 @@ @RequestMapping(value = "/locDetl/auth") @ManagerAuth - public R stockOutList(@RequestParam(value = "locNos[]") List<String> locNos){ + public R stockOutList(@RequestParam(value = "locNos[]") List<String> locNos) { if (!locNos.isEmpty()) { List<LocDetl> res = new ArrayList<>(); for (String locNo : new HashSet<>(locNos)) { @@ -69,10 +71,10 @@ @RequestMapping(value = "/stock/out/list/auth") @ManagerAuth - public R stockOutList(@RequestParam(defaultValue = "1")Integer curr, - @RequestParam(defaultValue = "10")Integer limit, - @RequestParam Map<String, Object> param){ - if (!Cools.isEmpty(param.get("modi_time"))){ + public R stockOutList(@RequestParam(defaultValue = "1") Integer curr, + @RequestParam(defaultValue = "10") Integer limit, + @RequestParam Map<String, Object> param) { + if (!Cools.isEmpty(param.get("modi_time"))) { String val = String.valueOf(param.get("modi_time")); if (val.contains(RANGE_TIME_LINK)) { String[] dates = val.split(RANGE_TIME_LINK); @@ -86,13 +88,13 @@ @RequestMapping(value = "/locDetl/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, + 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, - @RequestParam(required = false)Boolean unreason){ + @RequestParam(required = false) Boolean unreason) { if (!Cools.isEmpty(unreason) && unreason) { return R.ok(locDetlService.selectPage(new Page<>(curr, limit), new EntityWrapper<LocDetl>() @@ -107,7 +109,7 @@ if (chooseRow.length() == 1) { row = "0" + chooseRow; param.remove("row"); - }else { + } else { row = chooseRow; param.remove("row"); } @@ -115,19 +117,21 @@ 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("")){ + if (!Cools.isEmpty(orderByField)) { + wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); + } + if (!row.equals("")) { wrapper.and() - .where("loc_no like '" +row +"%'"); + .where("loc_no like '" + row + "%'"); } return R.ok(locDetlService.selectPage(new Page<>(curr, limit), wrapper)); } - private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ - for (Map.Entry<String, Object> entry : map.entrySet()){ + private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { + for (Map.Entry<String, Object> entry : map.entrySet()) { String val = String.valueOf(entry.getValue()); - if (val.contains(RANGE_TIME_LINK)){ + 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])); @@ -152,10 +156,10 @@ return R.ok(); } - @RequestMapping(value = "/locDetl/update/auth") - @ManagerAuth(memo = "搴撲綅鏄庣粏淇敼") - public R update(LocDetl locDetl){ - if (Cools.isEmpty(locDetl) || null==locDetl.getMatnr()){ + @RequestMapping(value = "/locDetl/update/auth") + @ManagerAuth(memo = "搴撲綅鏄庣粏淇敼") + public R update(LocDetl locDetl) { + if (Cools.isEmpty(locDetl) || null == locDetl.getMatnr()) { return R.error(); } locDetl.setModiUser(getUserId()); @@ -166,12 +170,12 @@ @RequestMapping(value = "/locDetl/delete/auth") @ManagerAuth(memo = "搴撲綅鏄庣粏鍒犻櫎") - public R delete(@RequestParam String param){ + public R delete(@RequestParam String param) { List<LocDetl> list = JSONArray.parseArray(param, LocDetl.class); - if (Cools.isEmpty(list)){ + if (Cools.isEmpty(list)) { return R.error(); } - for (LocDetl entity : list){ + for (LocDetl entity : list) { locDetlService.delete(new EntityWrapper<>(entity)); } return R.ok(); @@ -179,7 +183,7 @@ @RequestMapping(value = "/locDetl/export/auth") @ManagerAuth(memo = "搴撲綅鏄庣粏瀵煎嚭") - public synchronized 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")); @@ -189,15 +193,15 @@ if (chooseRow.length() == 1) { row = "0" + chooseRow; map.remove("row"); - }else { + } else { row = chooseRow; map.remove("row"); } } convert(map, wrapper); - if (!row.equals("")){ + if (!row.equals("")) { wrapper.and() - .where("loc_no like '" +row +"%'"); + .where("loc_no like '" + row + "%'"); } List<LocDetl> list = locDetlService.selectList(wrapper); return R.ok(exportSupport(list, fields)); @@ -210,7 +214,7 @@ wrapper.like("matnr", condition); Page<LocDetl> page = locDetlService.selectPage(new Page<>(0, 10), wrapper); List<Map<String, Object>> result = new ArrayList<>(); - for (LocDetl locDetl : page.getRecords()){ + for (LocDetl locDetl : page.getRecords()) { Map<String, Object> map = new HashMap<>(); map.put("id", locDetl.getMatnr()); map.put("value", locDetl.getMatnr()); @@ -223,7 +227,7 @@ @ManagerAuth public R query(@RequestBody JSONObject param) { Wrapper<LocDetl> wrapper = new EntityWrapper<LocDetl>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); - if (null != locDetlService.selectOne(wrapper)){ + if (null != locDetlService.selectOne(wrapper)) { return R.parse(BaseRes.REPEAT).add(getComment(LocDetl.class, String.valueOf(param.get("key")))); } return R.ok(); @@ -231,8 +235,8 @@ @RequestMapping(value = "/locDetl/statis/auth") @ManagerAuth - public R statis(@RequestParam(defaultValue = "1")Integer curr, - @RequestParam(defaultValue = "10")Integer limit, + public R statis(@RequestParam(defaultValue = "1") Integer curr, + @RequestParam(defaultValue = "10") Integer limit, @RequestParam Map<String, Object> param) { Page<LocDetl> stockStatis = locDetlService.getStockStatis(toPage(curr, limit, param, LocDetl.class)); for (LocDetl locDetl : stockStatis.getRecords()) { @@ -269,10 +273,11 @@ /** * 鑾峰彇搴撳瓨鎬绘暟 + * * @return */ @RequestMapping("/locDetl/count") - public R getAllCount(){ + public R getAllCount() { Integer sum = locDetlService.sum(); return R.ok(sum); } @@ -282,44 +287,53 @@ @RequestMapping(value = "/locDetl/grouplist/auth") @ManagerAuth - public R groupList(@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){ + public R groupList(@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) { List<LocDetl> result = new ArrayList<>(); // excludeTrash(param); - param.put("curr",curr); - param.put("limit",limit); - List<LocDetl> groupLocDetl = locDetlService.selectGroupPage(param,curr,limit); + param.put("curr", curr); + param.put("limit", limit); + List<LocDetl> groupLocDetl = locDetlService.selectGroupPage(param, curr, limit); for (LocDetl locDetl : groupLocDetl) { Mat mat = matService.selectOne(new EntityWrapper<Mat>() .eq("matnr", locDetl.getMatnr())); + locDetl.setStoreMax(mat.getStoreMax()); + locDetl.setStoreMaxDate(mat.getStoreMaxDate()); + locDetl.setStoreMin(mat.getStoreMin()); if (Cools.isEmpty(mat) || Cools.isEmpty(mat.getStoreMax()) || Cools.isEmpty(mat.getStoreMaxDate()) || Cools.isEmpty(mat.getStoreMin())) { continue; - } - if (locDetl.getAnfme() > mat.getStoreMax()){ - result.add(locDetl); + } else if (Cools.isEmpty(locDetl.getBatch())) { + continue; + } else if (locDetl.getBatch().length() != 8) { continue; } - if (locDetl.getAnfme() < mat.getStoreMin()){ + try { + SimpleDateFormat simple = new SimpleDateFormat("yyyyMMdd"); + Date maxDate = simple.parse(locDetl.getBatch()); + long time = maxDate.getTime(); + Date now = new Date(); + long time1 = now.getTime(); + locDetl.setNowTime((int)((time1 - time)/(1000*60*60*24))); + } catch (ParseException e) { + e.printStackTrace(); + } + if (locDetl.getAnfme() > mat.getStoreMax()) { + result.add(locDetl); + continue; + } else if (locDetl.getAnfme() < mat.getStoreMin()) { result.add(locDetl); continue; } - - if (Cools.isEmpty(locDetl.getBatch())) { - continue; - } - if (locDetl.getBatch().length() != 8){ - continue; - } - try{ + try { SimpleDateFormat simple = new SimpleDateFormat("yyyyMMdd"); Date maxDate = simple.parse(locDetl.getBatch()); Calendar calendar = new GregorianCalendar(); @@ -332,14 +346,13 @@ if (now.compareTo(maxDate) > 0) { result.add(locDetl); } - - }catch (Exception e){ + } catch (Exception e) { continue; } } Page<LocDetl> locDetlPage = new Page<>(); - locDetlPage.setRecords(paging(result,curr,limit)); + locDetlPage.setRecords(paging(result, curr, limit)); locDetlPage.setTotal(result.size()); locDetlPage.setCurrent(curr); locDetlPage.setSize(limit); @@ -350,10 +363,10 @@ List<LocDetl> pageRecord = new ArrayList<LocDetl>(); int minIndex = (curr - 1) * limit; int maxIndex = (curr * limit) - 1; - if (result.size() < maxIndex){ + if (result.size() < maxIndex) { maxIndex = result.size(); } - for (int i = minIndex; i < maxIndex; i++){ + for (int i = minIndex; i < maxIndex; i++) { pageRecord.add(result.get(i)); } return pageRecord; diff --git a/src/main/java/com/zy/asrs/entity/LocDetl.java b/src/main/java/com/zy/asrs/entity/LocDetl.java index 28f9ab5..86354b0 100644 --- a/src/main/java/com/zy/asrs/entity/LocDetl.java +++ b/src/main/java/com/zy/asrs/entity/LocDetl.java @@ -24,152 +24,175 @@ private static final long serialVersionUID = 1L; - @ApiModelProperty(value= "搴撲綅鍙�") + @ApiModelProperty(value = "搴撲綅鍙�") @TableField("loc_no") private String locNo; - @ApiModelProperty(value= "鎵樼洏鏉$爜") + @ApiModelProperty(value = "鎵樼洏鏉$爜") private String zpallet; - @ApiModelProperty(value= "鏁伴噺") + @ApiModelProperty(value = "鏁伴噺") @ExcelProperty("鏁伴噺") private Double anfme; - @ApiModelProperty(value= "鍟嗗搧缂栧彿") + @ApiModelProperty(value = "鍟嗗搧缂栧彿") @ExcelProperty("鍟嗗搧缂栧彿") private String matnr; - @ApiModelProperty(value= "鍟嗗搧鍚嶇О") + @ApiModelProperty(value = "鍟嗗搧鍚嶇О") @ExcelProperty("鍟嗗搧鍚嶇О") private String maktx; - @ApiModelProperty(value= "搴忓垪鐮�") + @ApiModelProperty(value = "搴忓垪鐮�") @ExcelProperty("搴忓垪鐮�") private String batch; - @ApiModelProperty(value= "鍗曟嵁缂栧彿") + @ApiModelProperty(value = "鍗曟嵁缂栧彿") @ExcelProperty("鍗曟嵁缂栧彿") @TableField("order_no") private String orderNo; - @ApiModelProperty(value= "c") + @ApiModelProperty(value = "c") @ExcelProperty("瑙勬牸") private String specs; - @ApiModelProperty(value= "鍨嬪彿") + @ApiModelProperty(value = "鍨嬪彿") private String model; - @ApiModelProperty(value= "棰滆壊") + @ApiModelProperty(value = "棰滆壊") private String color; - @ApiModelProperty(value= "鍝佺墝") + @ApiModelProperty(value = "鍝佺墝") private String brand; - @ApiModelProperty(value= "鍗曚綅") + @ApiModelProperty(value = "鍗曚綅") private String unit; - @ApiModelProperty(value= "鍗曚环") + @ApiModelProperty(value = "鍗曚环") private Double price; - @ApiModelProperty(value= "sku") + @ApiModelProperty(value = "sku") private String sku; - @ApiModelProperty(value= "鍗曚綅閲�") + @ApiModelProperty(value = "鍗曚綅閲�") private Double units; - @ApiModelProperty(value= "鏉$爜") + @ApiModelProperty(value = "鏉$爜") private String barcode; - @ApiModelProperty(value= "浜у湴") + @ApiModelProperty(value = "浜у湴") private String origin; - @ApiModelProperty(value= "鍘傚") + @ApiModelProperty(value = "鍘傚") private String manu; - @ApiModelProperty(value= "鐢熶骇鏃ユ湡") + @ApiModelProperty(value = "鐢熶骇鏃ユ湡") @TableField("manu_date") private String manuDate; - @ApiModelProperty(value= "鍝侀」鏁�") + @ApiModelProperty(value = "鍝侀」鏁�") @TableField("item_num") private String itemNum; - @ApiModelProperty(value= "瀹夊叏搴撳瓨閲�") + @ApiModelProperty(value = "瀹夊叏搴撳瓨閲�") @TableField("safe_qty") private Double safeQty; - @ApiModelProperty(value= "閲嶉噺") + @ApiModelProperty(value = "閲嶉噺") private Double weight; - @ApiModelProperty(value= "闀垮害") + @ApiModelProperty(value = "闀垮害") private Double length; - @ApiModelProperty(value= "浣撶Н") + @ApiModelProperty(value = "浣撶Н") private Double volume; - @ApiModelProperty(value= "涓夋柟缂栫爜") + @ApiModelProperty(value = "涓夋柟缂栫爜") @TableField("three_code") private String threeCode; - @ApiModelProperty(value= "渚涘簲鍟�") + @ApiModelProperty(value = "渚涘簲鍟�") private String supp; - @ApiModelProperty(value= "渚涘簲鍟嗙紪鐮�") + @ApiModelProperty(value = "渚涘簲鍟嗙紪鐮�") @TableField("supp_code") private String suppCode; - @ApiModelProperty(value= "鏄惁鎵规 1: 鏄� 0: 鍚� ") + @ApiModelProperty(value = "鏄惁鎵规 1: 鏄� 0: 鍚� ") @TableField("be_batch") private Integer beBatch; - @ApiModelProperty(value= "淇濊川鏈�") + @ApiModelProperty(value = "淇濊川鏈�") @TableField("dead_time") private String deadTime; - @ApiModelProperty(value= "棰勮澶╂暟") + @ApiModelProperty(value = "棰勮澶╂暟") @TableField("dead_warn") private Integer deadWarn; - @ApiModelProperty(value= "鍒惰喘 1: 鍒堕�� 2: 閲囪喘 3: 澶栧崗 ") + @ApiModelProperty(value = "鍒惰喘 1: 鍒堕�� 2: 閲囪喘 3: 澶栧崗 ") private Integer source; - @ApiModelProperty(value= "瑕佹眰妫�楠� 1: 鏄� 0: 鍚� ") + @ApiModelProperty(value = "瑕佹眰妫�楠� 1: 鏄� 0: 鍚� ") private Integer inspect; - @ApiModelProperty(value= "鍗遍櫓鍝� 1: 鏄� 0: 鍚� ") + @ApiModelProperty(value = "鍗遍櫓鍝� 1: 鏄� 0: 鍚� ") private Integer danger; - @ApiModelProperty(value= "淇敼浜哄憳") + @ApiModelProperty(value = "淇敼浜哄憳") @TableField("modi_user") private Long modiUser; - @ApiModelProperty(value= "淇敼鏃堕棿") + @ApiModelProperty(value = "淇敼鏃堕棿") @TableField("modi_time") private Date modiTime; - @ApiModelProperty(value= "鍒涘缓鑰�") + @ApiModelProperty(value = "鍒涘缓鑰�") @TableField("appe_user") private Long appeUser; - @ApiModelProperty(value= "娣诲姞鏃堕棿") + @ApiModelProperty(value = "娣诲姞鏃堕棿") @TableField("appe_time") private Date appeTime; - @ApiModelProperty(value= "澶囨敞") + @ApiModelProperty(value = "澶囨敞") private String memo; - public String getLocNo$(){ + /** + * 搴撳瓨棰勮鏁伴噺涓婇檺 + */ + private Double storeMax; + + /** + * 搴撳瓨棰勮鏁伴噺涓嬮檺 + */ + private Double storeMin; + + /** + * 搴撻緞棰勮涓婇檺 + */ + private Integer storeMaxDate; + + /** + * 瀹為檯鍦ㄥ簱澶╂暟 + */ + private Integer nowTime; + + + public String getLocNo$() { LocMastService service = SpringUtils.getBean(LocMastService.class); LocMast locMast = service.selectById(this.locNo); - if (!Cools.isEmpty(locMast)){ + if (!Cools.isEmpty(locMast)) { return String.valueOf(locMast.getLocNo()); } return null; } - public String getBeBatch$(){ - if (null == this.beBatch){ return null; } - switch (this.beBatch){ + public String getBeBatch$() { + if (null == this.beBatch) { + return null; + } + switch (this.beBatch) { case 1: return "鏄�"; case 0: @@ -179,9 +202,11 @@ } } - public String getSource$(){ - if (null == this.source){ return null; } - switch (this.source){ + public String getSource$() { + if (null == this.source) { + return null; + } + switch (this.source) { case 1: return "鍒堕��"; case 2: @@ -193,9 +218,11 @@ } } - public String getInspect$(){ - if (null == this.inspect){ return null; } - switch (this.inspect){ + public String getInspect$() { + if (null == this.inspect) { + return null; + } + switch (this.inspect) { case 1: return "鏄�"; case 0: @@ -205,9 +232,11 @@ } } - public String getDanger$(){ - if (null == this.danger){ return null; } - switch (this.danger){ + public String getDanger$() { + if (null == this.danger) { + return null; + } + switch (this.danger) { case 1: return "鏄�"; case 0: @@ -217,33 +246,33 @@ } } - public String getModiUser$(){ + public String getModiUser$() { UserService service = SpringUtils.getBean(UserService.class); User user = service.selectById(this.modiUser); - if (!Cools.isEmpty(user)){ + if (!Cools.isEmpty(user)) { return String.valueOf(user.getUsername()); } return null; } - public String getModiTime$(){ - if (Cools.isEmpty(this.modiTime)){ + public String getModiTime$() { + if (Cools.isEmpty(this.modiTime)) { return ""; } return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.modiTime); } - public String getAppeUser$(){ + public String getAppeUser$() { UserService service = SpringUtils.getBean(UserService.class); User user = service.selectById(this.appeUser); - if (!Cools.isEmpty(user)){ + if (!Cools.isEmpty(user)) { return String.valueOf(user.getUsername()); } return null; } - public String getAppeTime$(){ - if (Cools.isEmpty(this.appeTime)){ + public String getAppeTime$() { + if (Cools.isEmpty(this.appeTime)) { return ""; } return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.appeTime); diff --git a/src/main/webapp/static/js/locDetlGroup/locDetlGroup.js b/src/main/webapp/static/js/locDetlGroup/locDetlGroup.js index bcee2fc..af9eb14 100644 --- a/src/main/webapp/static/js/locDetlGroup/locDetlGroup.js +++ b/src/main/webapp/static/js/locDetlGroup/locDetlGroup.js @@ -1,13 +1,16 @@ var pageCurr; + function getCol() { var cols = [ - {field: 'matnr', align: 'center',title: '鐗╂枡鍙�', sort:true} - ,{field: 'maktx', align: 'center',title: '鐗╂枡鍚嶇О', sort:true} - ,{field: 'specs', align: 'center',title: '瑙勬牸'} - - ,{field: 'batch', align: 'center',title: '鎵瑰彿', width: 300, sort:true} - - ,{field: 'anfme', align: 'center',title: '鏁伴噺'} + {field: 'matnr', align: 'center', title: '鐗╂枡鍙�', sort: true} + , {field: 'maktx', align: 'center', title: '鐗╂枡鍚嶇О', sort: true} + , {field: 'specs', align: 'center', title: '瑙勬牸'} + , {field: 'batch', align: 'center', title: '鎵瑰彿', width: 300, sort: true} + , {field: 'storeMax', align: 'center', title: '鏁伴噺涓婇檺', sort: true} + , {field: 'storeMin', align: 'center', title: '鏁伴噺涓嬮檺', sort: true} + , {field: 'storeMaxDate', align: 'center', title: '搴撻緞涓婇檺', sort: true} + , {field: 'anfme', align: 'center', title: '瀹為檯鏁伴噺'} + , {field: 'nowTime', align: 'center', title: '瀹為檯搴撻緞'} ]; @@ -15,7 +18,7 @@ return cols; } -layui.use(['table','laydate', 'form'], function(){ +layui.use(['table', 'laydate', 'form'], function () { var table = layui.table; var $ = layui.jquery; var layer = layui.layer; @@ -26,7 +29,7 @@ tableIns = table.render({ elem: '#locDetl', headers: {token: localStorage.getItem('token')}, - url: baseUrl+'/locDetl/grouplist/auth', + url: baseUrl + '/locDetl/grouplist/auth', page: true, limit: 20, limits: [20, 30, 50, 100, 200, 500], @@ -49,17 +52,17 @@ response: { statusCode: 200 }, - done: function(res, curr, count) { + done: function (res, curr, count) { if (res.code === 403) { - top.location.href = baseUrl+"/"; + top.location.href = baseUrl + "/"; } - pageCurr=curr; + pageCurr = curr; limit(); form.on('checkbox(tableCheckbox)', function (data) { - var _index = $(data.elem).attr('table-index')||0; - if(data.elem.checked){ + var _index = $(data.elem).attr('table-index') || 0; + if (data.elem.checked) { res.data[_index][data.value] = 'Y'; - }else{ + } else { res.data[_index][data.value] = 'N'; } }); @@ -69,7 +72,7 @@ // 鐩戝惉鎺掑簭浜嬩欢 table.on('sort(locDetl)', function (obj) { var searchData = {}; - $.each($('#search-box [name]').serializeArray(), function() { + $.each($('#search-box [name]').serializeArray(), function () { searchData[this.name] = this.value; }); searchData['orderByField'] = obj.field; @@ -81,9 +84,9 @@ }, done: function (res, curr, count) { if (res.code === 403) { - top.location.href = baseUrl+"/"; + top.location.href = baseUrl + "/"; } - pageCurr=curr; + pageCurr = curr; limit(); } }); @@ -92,7 +95,7 @@ // 鐩戝惉澶村伐鍏锋爮浜嬩欢 table.on('toolbar(locDetl)', function (obj) { var checkStatus = table.checkStatus(obj.config.id); - switch(obj.event) { + switch (obj.event) { case 'addData': layer.open({ type: 2, @@ -101,10 +104,11 @@ area: [top.detailWidth, top.detailHeight], shadeClose: false, content: 'locDetl_detail.html', - success: function(layero, index){ + success: function (layero, index) { layer.getChildFrame('#data-detail-submit-edit', index).hide(); - clearFormVal(layer.getChildFrame('#detail', index)); - layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); + clearFormVal(layer.getChildFrame('#detail', index)); + layer.iframeAuto(index); + layer.style(index, {top: (($(window).height() - layer.getChildFrame('#data-detail', index).height()) / 3) + "px"}); } }); break; @@ -118,22 +122,22 @@ break; case 'deleteData': var data = checkStatus.data; - if (data.length === 0){ + if (data.length === 0) { layer.msg('璇烽�夋嫨鏁版嵁'); } else { - layer.confirm('纭畾鍒犻櫎'+(data.length===1?'姝�':data.length)+'鏉℃暟鎹悧', function(){ + layer.confirm('纭畾鍒犻櫎' + (data.length === 1 ? '姝�' : data.length) + '鏉℃暟鎹悧', function () { $.ajax({ - url: baseUrl+"/locDetl/delete/auth", + url: baseUrl + "/locDetl/delete/auth", headers: {'token': localStorage.getItem('token')}, data: {param: JSON.stringify(data)}, method: 'POST', - traditional:true, + traditional: true, success: function (res) { - if (res.code === 200){ + if (res.code === 200) { layer.closeAll(); tableReload(false); - } else if (res.code === 403){ - top.location.href = baseUrl+"/"; + } else if (res.code === 403) { + top.location.href = baseUrl + "/"; } else { layer.msg(res.msg) } @@ -143,9 +147,9 @@ } break; case 'exportData': - layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){ - var titles=[]; - var fields=[]; + layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function () { + var titles = []; + var fields = []; obj.config.cols[0].map(function (col) { if (col.type === 'normal' && col.hide === false && col.toolbar == null) { titles.push(col.title); @@ -153,7 +157,7 @@ } }); var exportData = {}; - $.each($('#search-box [name]').serializeArray(), function() { + $.each($('#search-box [name]').serializeArray(), function () { exportData[this.name] = this.value; }); var param = { @@ -162,19 +166,19 @@ }; var loadIndex = layer.msg('姝e湪瀵煎嚭...', {icon: 16, shade: 0.01, time: false}); $.ajax({ - url: baseUrl+"/locDetl/export/auth", + url: baseUrl + "/locDetl/export/auth", headers: {'token': localStorage.getItem('token')}, data: JSON.stringify(param), - dataType:'json', - contentType:'application/json;charset=UTF-8', + dataType: 'json', + contentType: 'application/json;charset=UTF-8', method: 'POST', success: function (res) { layer.close(loadIndex); layer.closeAll(); if (res.code === 200) { - table.exportFile(titles,res.data,'xls'); + table.exportFile(titles, res.data, 'xls'); } else if (res.code === 403) { - top.location.href = baseUrl+"/"; + top.location.href = baseUrl + "/"; } else { layer.msg(res.msg) } @@ -186,7 +190,7 @@ }); // 鐩戝惉琛屽伐鍏蜂簨浠� - table.on('tool(locDetl)', function(obj){ + table.on('tool(locDetl)', function (obj) { var data = obj.data; switch (obj.event) { // 璇︽儏 @@ -198,11 +202,12 @@ area: [top.detailWidth, top.detailHeight], shadeClose: false, content: 'locDetl_detail.html', - success: function(layero, index){ + success: function (layero, index) { setFormVal(layer.getChildFrame('#detail', index), data, true); top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); - layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); + layer.iframeAuto(index); + layer.style(index, {top: (($(window).height() - layer.getChildFrame('#data-detail', index).height()) / 3) + "px"}); layero.find('iframe')[0].contentWindow.layui.form.render('select'); layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); } @@ -217,12 +222,13 @@ area: [top.detailWidth, top.detailHeight], shadeClose: false, content: 'locDetl_detail.html', - success: function(layero, index){ + success: function (layero, index) { layer.getChildFrame('#data-detail-submit-save', index).hide(); setFormVal(layer.getChildFrame('#detail', index), data, false); top.convertDisabled(layer.getChildFrame('#data-detail :input', index), false); top.convertDisabled(layer.getChildFrame('#locNo,#matnr', index), true); - layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); + layer.iframeAuto(index); + layer.style(index, {top: (($(window).height() - layer.getChildFrame('#data-detail', index).height()) / 3) + "px"}); layero.find('iframe')[0].contentWindow.layui.form.render('select'); layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); } @@ -233,35 +239,36 @@ if (param === undefined) { layer.msg("鏃犳暟鎹�"); } else { - layer.open({ - type: 2, - title: '搴撲綅鍙疯鎯�', - maxmin: true, - area: [top.detailWidth, top.detailHeight], - shadeClose: false, - content: '../locMast/locMast_detail.html', - success: function(layero, index){ - $.ajax({ - url: baseUrl+"/locMast/"+ param +"/auth", - headers: {'token': localStorage.getItem('token')}, - method: 'GET', - success: function (res) { - if (res.code === 200){ - setFormVal(layer.getChildFrame('#detail', index), res.data, true); - top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); - layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); - layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); - layero.find('iframe')[0].contentWindow.layui.form.render('select'); - layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); - } else if (res.code === 403){ - parent.location.href = "/"; - }else { - layer.msg(res.msg) - } - } - }) - } - }); + layer.open({ + type: 2, + title: '搴撲綅鍙疯鎯�', + maxmin: true, + area: [top.detailWidth, top.detailHeight], + shadeClose: false, + content: '../locMast/locMast_detail.html', + success: function (layero, index) { + $.ajax({ + url: baseUrl + "/locMast/" + param + "/auth", + headers: {'token': localStorage.getItem('token')}, + method: 'GET', + success: function (res) { + if (res.code === 200) { + setFormVal(layer.getChildFrame('#detail', index), res.data, true); + top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); + layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); + layer.iframeAuto(index); + layer.style(index, {top: (($(window).height() - layer.getChildFrame('#data-detail', index).height()) / 3) + "px"}); + layero.find('iframe')[0].contentWindow.layui.form.render('select'); + layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); + } else if (res.code === 403) { + parent.location.href = "/"; + } else { + layer.msg(res.msg) + } + } + }) + } + }); } break; case 'modiUser': @@ -269,35 +276,36 @@ if (param === undefined) { layer.msg("鏃犳暟鎹�"); } else { - layer.open({ - type: 2, - title: '淇敼浜哄憳璇︽儏', - maxmin: true, - area: [top.detailWidth, top.detailHeight], - shadeClose: false, - content: '../user/user_detail.html', - success: function(layero, index){ - $.ajax({ - url: baseUrl+"/user/"+ param +"/auth", - headers: {'token': localStorage.getItem('token')}, - method: 'GET', - success: function (res) { - if (res.code === 200){ - setFormVal(layer.getChildFrame('#detail', index), res.data, true); - top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); - layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); - layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); - layero.find('iframe')[0].contentWindow.layui.form.render('select'); - layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); - } else if (res.code === 403){ - parent.location.href = "/"; - }else { - layer.msg(res.msg) - } - } - }) - } - }); + layer.open({ + type: 2, + title: '淇敼浜哄憳璇︽儏', + maxmin: true, + area: [top.detailWidth, top.detailHeight], + shadeClose: false, + content: '../user/user_detail.html', + success: function (layero, index) { + $.ajax({ + url: baseUrl + "/user/" + param + "/auth", + headers: {'token': localStorage.getItem('token')}, + method: 'GET', + success: function (res) { + if (res.code === 200) { + setFormVal(layer.getChildFrame('#detail', index), res.data, true); + top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); + layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); + layer.iframeAuto(index); + layer.style(index, {top: (($(window).height() - layer.getChildFrame('#data-detail', index).height()) / 3) + "px"}); + layero.find('iframe')[0].contentWindow.layui.form.render('select'); + layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); + } else if (res.code === 403) { + parent.location.href = "/"; + } else { + layer.msg(res.msg) + } + } + }) + } + }); } break; case 'appeUser': @@ -305,35 +313,36 @@ if (param === undefined) { layer.msg("鏃犳暟鎹�"); } else { - layer.open({ - type: 2, - title: '鍒涘缓鑰呰鎯�', - maxmin: true, - area: [top.detailWidth, top.detailHeight], - shadeClose: false, - content: '../user/user_detail.html', - success: function(layero, index){ - $.ajax({ - url: baseUrl+"/user/"+ param +"/auth", - headers: {'token': localStorage.getItem('token')}, - method: 'GET', - success: function (res) { - if (res.code === 200){ - setFormVal(layer.getChildFrame('#detail', index), res.data, true); - top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); - layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); - layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); - layero.find('iframe')[0].contentWindow.layui.form.render('select'); - layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); - } else if (res.code === 403){ - parent.location.href = "/"; - }else { - layer.msg(res.msg) - } - } - }) - } - }); + layer.open({ + type: 2, + title: '鍒涘缓鑰呰鎯�', + maxmin: true, + area: [top.detailWidth, top.detailHeight], + shadeClose: false, + content: '../user/user_detail.html', + success: function (layero, index) { + $.ajax({ + url: baseUrl + "/user/" + param + "/auth", + headers: {'token': localStorage.getItem('token')}, + method: 'GET', + success: function (res) { + if (res.code === 200) { + setFormVal(layer.getChildFrame('#detail', index), res.data, true); + top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); + layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); + layer.iframeAuto(index); + layer.style(index, {top: (($(window).height() - layer.getChildFrame('#data-detail', index).height()) / 3) + "px"}); + layero.find('iframe')[0].contentWindow.layui.form.render('select'); + layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); + } else if (res.code === 403) { + parent.location.href = "/"; + } else { + layer.msg(res.msg) + } + } + }) + } + }); } break; @@ -342,7 +351,7 @@ // 鏁版嵁淇濆瓨鍔ㄤ綔 form.on('submit(save)', function () { - if (banMsg != null){ + if (banMsg != null) { layer.msg(banMsg); return; } @@ -354,9 +363,9 @@ method("update") }); - function method(name){ + function method(name) { var index = layer.load(1, { - shade: [0.5,'#000'] //0.1閫忔槑搴︾殑鑳屾櫙 + shade: [0.5, '#000'] //0.1閫忔槑搴︾殑鑳屾櫙 }); var data = { // id: $('#id').val(), @@ -380,20 +389,20 @@ }; $.ajax({ - url: baseUrl+"/locDetl/"+name+"/auth", + url: baseUrl + "/locDetl/" + name + "/auth", headers: {'token': localStorage.getItem('token')}, data: top.reObject(data), method: 'POST', success: function (res) { - if (res.code === 200){ + if (res.code === 200) { parent.layer.closeAll(); parent.$(".layui-laypage-btn")[0].click(); $("#data-detail :input").each(function () { $(this).val(""); }); - } else if (res.code === 403){ - top.location.href = baseUrl+"/"; - }else { + } else if (res.code === 403) { + top.location.href = baseUrl + "/"; + } else { layer.msg(res.msg) } layer.close(index); @@ -439,9 +448,9 @@ done: function (res, curr, count) { if (res.code === 403) { - top.location.href = baseUrl+"/"; + top.location.href = baseUrl + "/"; } - pageCurr=curr; + pageCurr = curr; limit(child); } @@ -462,14 +471,13 @@ }); // 鍏抽棴鍔ㄤ綔 -$(document).on('click','#data-detail-close', function () { +$(document).on('click', '#data-detail-close', function () { parent.layer.closeAll(); }); function tableReload(child) { - var searchData = { - }; - $.each($('#search-box [name]').serializeArray(), function() { + var searchData = {}; + $.each($('#search-box [name]').serializeArray(), function () { searchData[this.name] = this.value; }); (child ? parent.tableIns : tableIns).reload({ @@ -479,14 +487,14 @@ }, done: function (res, curr, count) { if (res.code === 403) { - top.location.href = baseUrl+"/"; + top.location.href = baseUrl + "/"; } - pageCurr=curr; + pageCurr = curr; if (res.data.length === 0 && count !== 0) { tableIns.reload({ where: searchData, page: { - curr: pageCurr-1 + curr: pageCurr - 1 } }); pageCurr -= 1; @@ -499,10 +507,10 @@ function setFormVal(el, data, showImg) { for (var val in data) { var find = el.find(":input[id='" + val + "']"); - if (find[0]!=null){ - if (find[0].type === 'checkbox'){ - if (data[val]==='Y'){ - find.attr("checked","checked"); + if (find[0] != null) { + if (find[0].type === 'checkbox') { + if (data[val] === 'Y') { + find.attr("checked", "checked"); find.val('Y'); } else { find.remove("checked"); @@ -512,9 +520,9 @@ } } find.val(data[val]); - if (showImg){ + if (showImg) { var next = find.next(); - if (next.get(0)){ + if (next.get(0)) { if (next.get(0).localName === "img") { find.hide(); next.attr("src", data[val]); @@ -534,13 +542,13 @@ function detailScreen(index) { var detail = layer.getChildFrame('#data-detail', index); - var height = detail.height()+60; - if (height > ($(window).height()*0.9)) { - height = ($(window).height()*0.8); + var height = detail.height() + 60; + if (height > ($(window).height() * 0.9)) { + height = ($(window).height() * 0.8); } layer.style(index, { // top: (($(window).height()-height)/3)+"px", - height: height+'px' + height: height + 'px' }); } diff --git a/src/main/webapp/static/js/order/order.js b/src/main/webapp/static/js/order/order.js index 27e4712..3622707 100644 --- a/src/main/webapp/static/js/order/order.js +++ b/src/main/webapp/static/js/order/order.js @@ -341,8 +341,17 @@ async: false, success: function (res) { if (res.code === 200){ - xxDataList.push(res.data); - insTbSSXM.reload({data: xxDataList, page: {curr: 1}}); + var bige=true; + for (var j = 0; j < xxDataList.length; j++) { + if (xxDataList[j].matnr === res.data.matnr && xxDataList[j].batch === res.data.batch) { + bige=false; + break; + } + } + if (bige){ + xxDataList.push(res.data); + insTbSSXM.reload({data: xxDataList, page: {curr: 1}}); + } } else if (res.code === 403){ top.location.href = baseUrl+"/"; }else { -- Gitblit v1.9.1