From a801b6c075becb1a8660d451cbfb31ddf782a89d Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期五, 01 九月 2023 15:35:18 +0800
Subject: [PATCH] #库存预警
---
src/main/webapp/static/js/locDetlWarning/locDetlWarning.js | 269 ++++++++++++++++++++
src/main/java/com/zy/asrs/controller/ManLocDetlController.java | 38 ++
src/main/java/com/zy/asrs/mapper/LocDetlMapper.java | 5
src/main/java/com/zy/asrs/service/LocDetlService.java | 5
src/main/webapp/views/report/locDetl.html | 12
src/main/java/com/zy/asrs/controller/LocDetlController.java | 24 +
src/main/resources/mapper/LocDetlMapper.xml | 127 +++++++++
src/main/java/com/zy/asrs/service/impl/LocDetlServiceImpl.java | 11
src/main/java/com/zy/asrs/service/impl/ManLocDetlServiceImpl.java | 5
src/main/java/com/zy/asrs/mapper/ManLocDetlMapper.java | 3
src/main/resources/mapper/ManLocDetlMapper.xml | 74 +++++
src/main/java/com/zy/asrs/entity/LocDetlWarningDTO.java | 55 ++++
src/main/webapp/views/index.html | 2
src/main/webapp/views/locDetlWarning/locDetlWarning.html | 52 ++++
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java | 39 +-
src/main/java/com/zy/asrs/service/ManLocDetlService.java | 2
src/main/webapp/static/js/common.js | 2
17 files changed, 698 insertions(+), 27 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/LocDetlController.java b/src/main/java/com/zy/asrs/controller/LocDetlController.java
index d0ccb1c..d10ed26 100644
--- a/src/main/java/com/zy/asrs/controller/LocDetlController.java
+++ b/src/main/java/com/zy/asrs/controller/LocDetlController.java
@@ -43,6 +43,30 @@
@Autowired
private ManLocDetlService manLocDetlService;
+ @RequestMapping(value = "/locDetl/selectAllWarning/auth")
+ @ManagerAuth(memo = "搴撳瓨棰勮")
+ public Map<String,Object> queryViewStayTimeListByPages(@RequestParam(defaultValue = "1")Integer curr,
+ @RequestParam(defaultValue = "10")Integer limit,
+ @RequestParam Map<String, Object> param){
+ LocDetlWarningDTO locDetlWarningDTO = new LocDetlWarningDTO();
+ locDetlWarningDTO.setPageSize(limit);
+ locDetlWarningDTO.setPageNumber(curr);
+ String locNo = String.valueOf(param.get("locNo"));
+ String matnr = String.valueOf(param.get("matnr"));
+ if (!Cools.isEmpty(locNo) && !locNo.equals("null")) {
+ locDetlWarningDTO.setLocNo(locNo);
+ }
+ if (!Cools.isEmpty(matnr) && !matnr.equals("null")) {
+ locDetlWarningDTO.setMatnr(matnr);
+ }
+ List<LocDetlWarningDTO> list = locDetlService.selectAllWarning(locDetlWarningDTO);
+ int count = locDetlService.getAllWarningCount(locDetlWarningDTO);
+ Page<LocDetlWarningDTO> page = new Page<>();
+ page.setRecords(list);
+ page.setTotal(count);
+ return R.ok(page);
+ }
+
@RequestMapping(value = "/locDetl/update")
public R update1() {
if (!locDetlService.updateLocNo("0402805", "0402804")) {
diff --git a/src/main/java/com/zy/asrs/controller/ManLocDetlController.java b/src/main/java/com/zy/asrs/controller/ManLocDetlController.java
index d87a31c..49e65f6 100644
--- a/src/main/java/com/zy/asrs/controller/ManLocDetlController.java
+++ b/src/main/java/com/zy/asrs/controller/ManLocDetlController.java
@@ -1,5 +1,7 @@
package com.zy.asrs.controller;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.annotations.ManagerAuth;
@@ -7,9 +9,13 @@
import com.core.common.DateUtils;
import com.core.common.R;
import com.zy.asrs.entity.LocDetl;
+import com.zy.asrs.entity.LocDetlWarningDTO;
import com.zy.asrs.entity.ManLocDetl;
+import com.zy.asrs.entity.Mat;
import com.zy.asrs.entity.param.LocDetlAdjustParam;
+import com.zy.asrs.service.LocDetlService;
import com.zy.asrs.service.ManLocDetlService;
+import com.zy.asrs.service.MatService;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
@@ -17,6 +23,10 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.List;
import java.util.Map;
@RestController
@@ -24,6 +34,12 @@
@Autowired
private ManLocDetlService manLocDetlService;
+
+ @Autowired
+ private LocDetlService locDetlService;
+
+ @Autowired
+ private MatService matService;
@RequestMapping(value = "/manLocDetl/list/auth")
@ManagerAuth
@@ -110,7 +126,23 @@
}
}
-
-
-
+ @RequestMapping(value = "/manlocDetl/statis/export")
+// @ManagerAuth
+ public void statisExport(HttpServletResponse response) throws IOException {
+ List<LocDetlWarningDTO> list = manLocDetlService.selectAllWarning();
+ for (LocDetlWarningDTO locDetl : list) {
+ 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(), LocDetlWarningDTO.class)
+ .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+ .sheet("琛�1")
+ .doWrite(list);
+ }
}
diff --git a/src/main/java/com/zy/asrs/entity/LocDetlWarningDTO.java b/src/main/java/com/zy/asrs/entity/LocDetlWarningDTO.java
new file mode 100644
index 0000000..26bdcc6
--- /dev/null
+++ b/src/main/java/com/zy/asrs/entity/LocDetlWarningDTO.java
@@ -0,0 +1,55 @@
+package com.zy.asrs.entity;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.core.common.Cools;
+import com.core.common.SpringUtils;
+import com.zy.common.utils.Synchro;
+import com.zy.system.entity.User;
+import com.zy.system.service.UserService;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+@Data
+@ExcelIgnoreUnannotated
+public class LocDetlWarningDTO {
+
+ private int pageNumber;
+ private int pageSize;
+ private Integer row;
+ @ExcelProperty("搴撲綅鍙�")
+ private String locNo;
+ @ExcelProperty("鐗╂枡鐮�")
+ private String matnr;
+ @ExcelProperty("鐗╂枡鍚�")
+ private String maktx;
+ @ExcelProperty("鍏ュ簱鏃堕棿")
+ private Date createTime;
+ @ExcelProperty("瑙勬牸")
+ private String specs;
+ @ExcelProperty("搴撳瓨涓婇檺")
+ private String inventoryMax;
+ @ExcelProperty("搴撳瓨涓嬮檺")
+ private String inventoryMin;
+ @ExcelProperty("搴撻緞涓婇檺")
+ private String inventoryAgeMax;
+ @ExcelProperty("搴撳瓨鎬绘暟閲�")
+ private Integer countAnfme;
+ @ExcelProperty("鍦ㄥ簱澶╂暟")
+ private Integer diffTime;
+
+ public String getcreateTime$(){
+ if (Cools.isEmpty(this.createTime)){
+ return "";
+ }
+ return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
+ }
+
+ public void sync(Object source) {
+ Synchro.Copy(source, this);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/zy/asrs/mapper/LocDetlMapper.java b/src/main/java/com/zy/asrs/mapper/LocDetlMapper.java
index 28b280d..57e39a8 100644
--- a/src/main/java/com/zy/asrs/mapper/LocDetlMapper.java
+++ b/src/main/java/com/zy/asrs/mapper/LocDetlMapper.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.zy.asrs.entity.LocDetl;
+import com.zy.asrs.entity.LocDetlWarningDTO;
import com.zy.asrs.entity.result.LocDetlAll;
import com.zy.asrs.entity.result.LocDetlDTO;
import com.zy.asrs.entity.result.StockVo;
@@ -94,4 +95,8 @@
int selectAllPymentcount(LocDetlDTO locDetlDTO);
Double sumAll();
+
+ List<LocDetlWarningDTO> selectAllWarning(LocDetlWarningDTO locDetlWarningDTO);
+
+ int getAllWarningCount(LocDetlWarningDTO locDetlWarningDTO);
}
diff --git a/src/main/java/com/zy/asrs/mapper/ManLocDetlMapper.java b/src/main/java/com/zy/asrs/mapper/ManLocDetlMapper.java
index f0ad47e..1d9ae14 100644
--- a/src/main/java/com/zy/asrs/mapper/ManLocDetlMapper.java
+++ b/src/main/java/com/zy/asrs/mapper/ManLocDetlMapper.java
@@ -1,6 +1,7 @@
package com.zy.asrs.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.zy.asrs.entity.LocDetlWarningDTO;
import com.zy.asrs.entity.ManLocDetl;
import com.zy.asrs.entity.result.StockVo;
import org.apache.ibatis.annotations.Mapper;
@@ -89,4 +90,6 @@
int deleteDatailed (String locNo, String matnr,String batch);
int increase(Double anfme,String locNo, String matnr,String batch,Double weight);
+
+ List<LocDetlWarningDTO> selectAllWarning();
}
diff --git a/src/main/java/com/zy/asrs/service/LocDetlService.java b/src/main/java/com/zy/asrs/service/LocDetlService.java
index 77b1739..c62ff89 100644
--- a/src/main/java/com/zy/asrs/service/LocDetlService.java
+++ b/src/main/java/com/zy/asrs/service/LocDetlService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.zy.asrs.entity.LocDetl;
+import com.zy.asrs.entity.LocDetlWarningDTO;
import com.zy.asrs.entity.result.LocDetlAll;
import com.zy.asrs.entity.result.LocDetlDTO;
import com.zy.asrs.entity.result.StockVo;
@@ -74,4 +75,8 @@
int selectAllCount(LocDetlDTO locDetlDTO);
int selectAllPymentcount(LocDetlDTO locDetlDTO);
+
+ List<LocDetlWarningDTO> selectAllWarning(LocDetlWarningDTO locDetlWarningDTO);
+
+ int getAllWarningCount(LocDetlWarningDTO locDetlWarningDTO);
}
diff --git a/src/main/java/com/zy/asrs/service/ManLocDetlService.java b/src/main/java/com/zy/asrs/service/ManLocDetlService.java
index 2cbf39f..1eb828d 100644
--- a/src/main/java/com/zy/asrs/service/ManLocDetlService.java
+++ b/src/main/java/com/zy/asrs/service/ManLocDetlService.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
+import com.zy.asrs.entity.LocDetlWarningDTO;
import com.zy.asrs.entity.ManLocDetl;
import com.zy.asrs.entity.param.LocDetlAdjustParam;
import com.zy.asrs.entity.result.StockVo;
@@ -69,4 +70,5 @@
int increase(Double anfme,String locNo, String matnr,String batch,Double weight);
+ List<LocDetlWarningDTO> selectAllWarning();
}
diff --git a/src/main/java/com/zy/asrs/service/impl/LocDetlServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/LocDetlServiceImpl.java
index b083fa9..02220a5 100644
--- a/src/main/java/com/zy/asrs/service/impl/LocDetlServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/LocDetlServiceImpl.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.core.common.Cools;
import com.zy.asrs.entity.LocDetl;
+import com.zy.asrs.entity.LocDetlWarningDTO;
import com.zy.asrs.entity.result.LocDetlAll;
import com.zy.asrs.entity.result.LocDetlDTO;
import com.zy.asrs.entity.result.StockVo;
@@ -183,4 +184,14 @@
public int selectAllPymentcount(LocDetlDTO locDetlDTO) {
return this.baseMapper.selectAllPymentcount(locDetlDTO);
}
+
+ @Override
+ public List<LocDetlWarningDTO> selectAllWarning(LocDetlWarningDTO locDetlWarningDTO) {
+ return this.baseMapper.selectAllWarning(locDetlWarningDTO);
+ }
+
+ @Override
+ public int getAllWarningCount(LocDetlWarningDTO locDetlWarningDTO) {
+ return this.baseMapper.getAllWarningCount(locDetlWarningDTO);
+ }
}
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 267a5cd..f9731fc 100644
--- a/src/main/java/com/zy/asrs/service/impl/ManLocDetlServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/ManLocDetlServiceImpl.java
@@ -192,5 +192,10 @@
return baseMapper.increase(anfme,locNo,matnr,batch,weight);
}
+ @Override
+ public List<LocDetlWarningDTO> selectAllWarning() {
+ return baseMapper.selectAllWarning();
+ }
+
}
diff --git a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
index 842e968..4750391 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -557,8 +557,8 @@
return R.error("鍏ュ簱鏁伴噺澶т簬鍙叆鏁伴噺");
}
//鏌ヨ骞冲簱涓槸鍚︽湁涓�鏍风殑鐗╂枡鍙凤紝鏈夌殑璇濈洿鎺ュ鍔犳暟閲�
- ManLocDetl checkManLocDetl = manLocDetlService.selectInventory(jsonLocNo,orderDetl.getMatnr(),jsonOrderDetl.getBatch());
- if (checkManLocDetl == null) {
+// ManLocDetl checkManLocDetl = manLocDetlService.selectInventory(jsonLocNo,orderDetl.getMatnr(),jsonOrderDetl.getBatch());
+// if (checkManLocDetl == null) {
ManLocDetl manLocDetl = new ManLocDetl();
Synchro.Copy(orderDetl, manLocDetl);
@@ -576,23 +576,24 @@
if(!manLocDetlService.insert(manLocDetl)){
return R.error("鎻掑叆骞冲簱鐗╂枡澶辫触锛�");
}
- } else {
- if (checkManLocDetl.getWeight() == null){
- checkManLocDetl.setWeight(0.0);
- }
- if (jsonOrderDetl.getWeight() == null){
- jsonOrderDetl.setWeight(0.0);
- }
- if(manLocDetlService.increase(checkManLocDetl.getAnfme() + jsonOrderDetl.getAnfme(),
- node.getName(),
- jsonOrderDetl.getMatnr(),
- jsonOrderDetl.getBatch(),checkManLocDetl.getWeight()+jsonOrderDetl.getWeight()
- )<=0
- ){
- return R.error("淇敼骞冲簱鐗╂枡澶辫触锛�");
- }
-
- }
+// }
+// else {
+// if (checkManLocDetl.getWeight() == null){
+// checkManLocDetl.setWeight(0.0);
+// }
+// if (jsonOrderDetl.getWeight() == null){
+// jsonOrderDetl.setWeight(0.0);
+// }
+// if(manLocDetlService.increase(checkManLocDetl.getAnfme() + jsonOrderDetl.getAnfme(),
+// node.getName(),
+// jsonOrderDetl.getMatnr(),
+// jsonOrderDetl.getBatch(),checkManLocDetl.getWeight()+jsonOrderDetl.getWeight()
+// )<=0
+// ){
+// return R.error("淇敼骞冲簱鐗╂枡澶辫触锛�");
+// }
+//
+// }
orderDetl.setQty(orderDetl.getQty() + jsonOrderDetl.getAnfme());
orderDetl.setWorkQty(orderDetl.getWorkQty() + jsonOrderDetl.getAnfme());
orderDetl.setUpdateTime(date);
diff --git a/src/main/resources/mapper/LocDetlMapper.xml b/src/main/resources/mapper/LocDetlMapper.xml
index 6a64a57..834f105 100644
--- a/src/main/resources/mapper/LocDetlMapper.xml
+++ b/src/main/resources/mapper/LocDetlMapper.xml
@@ -49,6 +49,22 @@
</resultMap>
+ <resultMap id="WarningResultMap" type="com.zy.asrs.entity.LocDetlWarningDTO">
+ <result column="loc_no" property="locNo" />
+ <result column="matnr" property="matnr" />
+ <result column="maktx" property="maktx" />
+ <result column="create_time" property="createTime" />
+ <result column="specs" property="specs" />
+ <result column="inventory_max" property="inventoryMax" />
+ <result column="inventory_min" property="inventoryMin" />
+ <result column="inventory_age_max" property="inventoryAgeMax" />
+ <result column="count_anfme" property="countAnfme" />
+ <result column="diff_time" property="diffTime" />
+ <result column="pageNumber" property="pageNumber" />
+ <result column="pageSize" property="pageSize" />
+ <result column="row" property="row" />
+ </resultMap>
+
<sql id="batchSeq">
<choose>
<when test="batch != null">
@@ -586,6 +602,117 @@
<select id="sumAll" resultType="java.lang.Double">
SELECT SUM(anfme) FROM asr_loc_detl_all
</select>
+ <!-- mapper涓嶆敮鎸乻ql璇彞宓屽鏃讹紝閲囩敤sql鐗囨鍖呭惈鏂瑰紡锛岃В鍐硏ml鏍囩闂 -->
+ <sql id="selectAllWarningSql">
+ <if test="locNo!=null and locNo!='' ">
+ and t.loc_no like '%' + #{locNo} + '%'
+ </if>
+ <if test="matnr != null and matnr !='' ">
+ and t.matnr like '%' + #{matnr} + '%'
+ </if>
+
+ </sql>
+
+ <select id="selectAllWarning" resultMap="WarningResultMap" parameterType="com.zy.asrs.entity.LocDetlWarningDTO">
+ SELECT
+ *
+ FROM
+ (
+ SELECT
+ ROW_NUMBER ( ) OVER ( ORDER BY matnr ) AS row,*
+ FROM
+ (
+ SELECT
+ loc_no,
+ locd.matnr,
+ locd.maktx,
+ create_time,
+ locd.specs,
+ locd.unit,
+ inventory_max,
+ inventory_min,
+ inventory_age_max,
+ count_anfme,
+ DATEDIFF( DAY, create_time, GETDATE( ) ) AS [diff_time]
+ FROM
+ man_loc_detl locd
+ LEFT JOIN (
+ SELECT
+ man_mat.matnr,
+ maktx,
+ specs,
+ unit,
+ inventory_max,
+ inventory_min,
+ inventory_age_max,
+ count_anfme
+ FROM
+ man_mat
+ RIGHT JOIN ( SELECT matnr, SUM ( anfme ) AS count_anfme FROM man_loc_detl loc GROUP BY matnr ) aa ON aa.matnr = man_mat.matnr
+ ) warn ON locd.matnr = warn.matnr
+ WHERE
+ DATEDIFF( DAY, create_time, GETDATE( ) ) > inventory_age_max
+ OR count_anfme > inventory_max
+ OR count_anfme < inventory_min
+ ) t
+ WHERE
+ 1 = 1
+ <include refid="selectAllWarningSql"></include>
+ ) a
+ WHERE a.row BETWEEN ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
+
+ </select>
+ <select id="getAllWarningCount" resultType="java.lang.Integer">
+ SELECT
+ COUNT(1)
+ FROM
+ (
+ SELECT
+ ROW_NUMBER ( ) OVER ( ORDER BY matnr ) AS row,*
+ FROM
+ (
+ SELECT
+ loc_no,
+ locd.matnr,
+ locd.maktx,
+ create_time,
+ locd.specs,
+ locd.unit,
+ inventory_max,
+ inventory_min,
+ inventory_age_max,
+ count_anfme,
+ DATEDIFF( DAY, create_time, GETDATE( ) ) AS [diff_time]
+ FROM
+ man_loc_detl locd
+ LEFT JOIN (
+ SELECT
+ man_mat.matnr,
+ maktx,
+ specs,
+ unit,
+ inventory_max,
+ inventory_min,
+ inventory_age_max,
+ count_anfme
+ FROM
+ man_mat
+ RIGHT JOIN ( SELECT matnr, SUM ( anfme ) AS count_anfme FROM man_loc_detl loc GROUP BY matnr ) aa ON aa.matnr = man_mat.matnr
+ ) warn ON locd.matnr = warn.matnr
+ WHERE
+ DATEDIFF( DAY, create_time, GETDATE( ) ) > inventory_age_max
+ OR count_anfme > inventory_max
+ OR count_anfme < inventory_min
+ ) t
+ WHERE
+ 1 = 1
+ <include refid="selectAllWarningSql"></include>
+ ) a
+
+
+
+
+ </select>
</mapper>
diff --git a/src/main/resources/mapper/ManLocDetlMapper.xml b/src/main/resources/mapper/ManLocDetlMapper.xml
index 395c9db..51cd24b 100644
--- a/src/main/resources/mapper/ManLocDetlMapper.xml
+++ b/src/main/resources/mapper/ManLocDetlMapper.xml
@@ -36,6 +36,22 @@
<result column="order_no" property="orderNo" />
</resultMap>
+ <resultMap id="WarningResultMap" type="com.zy.asrs.entity.LocDetlWarningDTO">
+ <result column="loc_no" property="locNo" />
+ <result column="matnr" property="matnr" />
+ <result column="maktx" property="maktx" />
+ <result column="create_time" property="createTime" />
+ <result column="specs" property="specs" />
+ <result column="inventory_max" property="inventoryMax" />
+ <result column="inventory_min" property="inventoryMin" />
+ <result column="inventory_age_max" property="inventoryAgeMax" />
+ <result column="count_anfme" property="countAnfme" />
+ <result column="diff_time" property="diffTime" />
+ <result column="pageNumber" property="pageNumber" />
+ <result column="pageSize" property="pageSize" />
+ <result column="row" property="row" />
+ </resultMap>
+
<sql id="locDetlCondition">
<if test="host_id != null and host_id != ''">
and mld.host_id = #{host_id}
@@ -342,6 +358,64 @@
</otherwise>
</choose>
</select>
+ <sql id="selectAllWarningSql">
+ <if test="locNo!=null and locNo!='' ">
+ and t.loc_no like '%' + #{locNo} + '%'
+ </if>
+ <if test="matnr != null and matnr !='' ">
+ and t.matnr like '%' + #{matnr} + '%'
+ </if>
+
+ </sql>
+ <select id="selectAllWarning" resultMap="WarningResultMap" parameterType="com.zy.asrs.entity.LocDetlWarningDTO">
+ SELECT
+ *
+ FROM
+ (
+ SELECT
+ ROW_NUMBER ( ) OVER ( ORDER BY matnr ) AS row,*
+ FROM
+ (
+ SELECT
+ loc_no,
+ locd.matnr,
+ locd.maktx,
+ create_time,
+ locd.specs,
+ locd.unit,
+ inventory_max,
+ inventory_min,
+ inventory_age_max,
+ count_anfme,
+ DATEDIFF( DAY, create_time, GETDATE( ) ) AS [diff_time]
+ FROM
+ man_loc_detl locd
+ LEFT JOIN (
+ SELECT
+ man_mat.matnr,
+ maktx,
+ specs,
+ unit,
+ inventory_max,
+ inventory_min,
+ inventory_age_max,
+ count_anfme
+ FROM
+ man_mat
+ RIGHT JOIN ( SELECT matnr, SUM ( anfme ) AS count_anfme FROM man_loc_detl loc GROUP BY matnr ) aa ON aa.matnr = man_mat.matnr
+ ) warn ON locd.matnr = warn.matnr
+ WHERE
+ DATEDIFF( DAY, create_time, GETDATE( ) ) > inventory_age_max
+ OR count_anfme > inventory_max
+ OR count_anfme < inventory_min
+ ) t
+ WHERE
+ 1 = 1
+ <include refid="selectAllWarningSql"></include>
+ ) a
+
+
+ </select>
<delete id="deleteDatailed">
delete from man_loc_detl
where loc_no = #{locNo}
diff --git a/src/main/webapp/static/js/common.js b/src/main/webapp/static/js/common.js
index 51a77a6..2e2fb75 100644
--- a/src/main/webapp/static/js/common.js
+++ b/src/main/webapp/static/js/common.js
@@ -273,8 +273,6 @@
,{field: 'source$', align: 'center',title: '鍒惰喘', hide: true}
,{field: 'check$', align: 'center',title: '瑕佹眰妫�楠�', hide: true}
,{field: 'danger$', align: 'center',title: '鍗遍櫓鍝�', hide: true}
- ,{field: 'owner$', align: 'center',title: '璐т富', hide: false}
- ,{field: 'payment$', align: 'center',title: '璐х墿褰㈡��', hide: false}
]
function getQueryVariable(variable)
diff --git a/src/main/webapp/static/js/locDetlWarning/locDetlWarning.js b/src/main/webapp/static/js/locDetlWarning/locDetlWarning.js
new file mode 100644
index 0000000..554699f
--- /dev/null
+++ b/src/main/webapp/static/js/locDetlWarning/locDetlWarning.js
@@ -0,0 +1,269 @@
+var pageCurr;
+function getCol() {
+ var cols = [
+ {field: 'countAnfme', align: 'center',title: '搴撳瓨鏁伴噺', style: 'font-weight: bold'}
+ ];
+ arrRemove(detlCols, "field", "anfme")
+ arrRemove(detlCols, "field", "zpallet")
+ cols.push.apply(cols, detlCols);
+ // cols.push({field: 'anfme', align: 'center',title: '鏁伴噺', style: 'font-weight: bold'}
+ // )
+ return cols;
+}
+
+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;
+
+ // 鏁版嵁娓叉煋
+ tableIns = table.render({
+ elem: '#locDetlWarning',
+ headers: {token: localStorage.getItem('token')},
+ url: baseUrl+'/locDetl/selectAllWarning/auth',
+ page: true,
+ limit: 20,
+ limits: [20, 30, 50, 100, 200, 500],
+ even: true,
+ toolbar: '#toolbar',
+ cellMinWidth: 50,
+ cols: [[
+ {field: 'locNo', align: 'center',title: '搴撲綅'}
+ ,{field: 'countAnfme', align: 'center',title: '搴撳瓨鏁伴噺'}
+ ,{field: 'matnr', align: 'center',title: '搴撳瓨鏍囧彿'}
+ ,{field: 'maktx', align: 'center',title: '搴撳瓨鍚嶇О'}
+ ,{field: 'createTime$', align: 'center',title: '鍏ュ簱鏃堕棿'}
+ ,{field: 'specs', align: 'center',title: '瑙勬牸'}
+ ,{field: 'inventoryMax', align: 'center',title: '鏈�澶у簱瀛樻暟閲�'}
+ ,{field: 'inventoryMin', align: 'center',title: '鏈�灏忓簱瀛樻暟閲�'}
+ ,{field: 'inventoryAgeMax', align: 'center',title: '鏈�澶у湪搴撴椂闂�(澶�)'}
+ ,{field: 'diffTime', align: 'center',title: '褰撳墠鍦ㄥ簱鏃堕棿(澶�)'}
+ ]
+ ],
+ 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+"/";
+ }
+ pageCurr=curr;
+ limit();
+ form.on('checkbox(tableCheckbox)', function (data) {
+ var _index = $(data.elem).attr('table-index')||0;
+ if(data.elem.checked){
+ res.data[_index][data.value] = 'Y';
+ }else{
+ res.data[_index][data.value] = 'N';
+ }
+ });
+ /**
+ * 鏄剧ず搴撳瓨鎬绘暟閲�
+ */
+ $.ajax({
+ url: baseUrl+"/locDetl/count",
+ headers: {'token': localStorage.getItem('token')},
+ contentType:'application/json;charset=UTF-8',
+ method: 'POST',
+ success: function (res) {
+ $("#countNum").text(res.data + '涓�');
+ }
+ });
+
+ }
+ });
+
+ // 鐩戝惉鎺掑簭浜嬩欢
+ table.on('sort(locDetlStatis)', function (obj) {
+ var searchData = {};
+ $.each($('#search-box [name]').serializeArray(), function() {
+ searchData[this.name] = this.value;
+ });
+ searchData['orderByField'] = obj.field;
+ searchData['orderByType'] = obj.type;
+ tableIns.reload({
+ where: searchData,
+ page: {
+ curr: 1
+ },
+ done: function (res, curr, count) {
+ if (res.code === 403) {
+ top.location.href = baseUrl+"/";
+ }
+ pageCurr=curr;
+ limit();
+ }
+ });
+ });
+
+ // 鐩戝惉澶村伐鍏锋爮浜嬩欢
+ table.on('toolbar(locDetlWarning)', function (obj) {
+ var checkStatus = table.checkStatus(obj.config.id);
+ switch(obj.event) {
+ case 'exportAll':
+ layer.closeAll();
+ layer.load(1, {shade: [0.1,'#fff']});
+ location.href = baseUrl + "/manlocDetl/statis/export";
+ console.log("1");
+ layer.closeAll('loading');
+ break;
+ case 'exportData':
+ 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);
+ fields.push(col.field);
+ }
+ });
+ var exportData = {};
+ $.each($('#search-box [name]').serializeArray(), function() {
+ exportData[this.name] = this.value;
+ });
+ var param = {
+ 'locDetl': exportData,
+ 'fields': fields
+ };
+ $.ajax({
+ url: baseUrl+"/locDetl/export/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data: JSON.stringify(param),
+ dataType:'json',
+ contentType:'application/json;charset=UTF-8',
+ method: 'POST',
+ success: function (res) {
+ layer.closeAll();
+ if (res.code === 200) {
+ table.exportFile(titles,res.data,'xls');
+ } else if (res.code === 403) {
+ top.location.href = baseUrl+"/";
+ } else {
+ layer.msg(res.msg)
+ }
+ }
+ });
+ });
+ break;
+ }
+ });
+
+ // 鐩戝惉琛屽伐鍏蜂簨浠�
+ table.on('tool(locDetlStatis)', function(obj){
+ var data = obj.data;
+ switch (obj.event) {
+ // 璇︽儏
+ case 'detail':
+ layer.open({
+ type: 2,
+ title: '璇︽儏',
+ maxmin: true,
+ area: [top.detailWidth, top.detailHeight],
+ shadeClose: false,
+ content: 'locDetl_detail.html',
+ 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"});
+ layero.find('iframe')[0].contentWindow.layui.form.render('select');
+ layero.find('iframe')[0].contentWindow.layui.form.render('checkbox');
+ }
+ });
+ break;
+
+ }
+ });
+
+
+ // 鎼滅储鏍忔悳绱簨浠�
+ form.on('submit(search)', function (data) {
+ pageCurr = 1;
+ tableReload(false);
+ });
+
+ // 鎼滅储鏍忛噸缃簨浠�
+ form.on('submit(reset)', function (data) {
+ pageCurr = 1;
+ clearFormVal($('#search-box'));
+ tableReload(false);
+ });
+
+ // 鏃堕棿閫夋嫨鍣�
+ layDate.render({
+ elem: '#modiTime\\$',
+ type: 'datetime'
+ });
+ layDate.render({
+ elem: '#appeTime\\$',
+ type: 'datetime'
+ });
+
+
+});
+
+// 鍏抽棴鍔ㄤ綔
+$(document).on('click','#data-detail-close', function () {
+ parent.layer.closeAll();
+});
+
+function tableReload(child) {
+ var searchData = {};
+ $.each($('#search-box [name]').serializeArray(), function() {
+ searchData[this.name] = this.value;
+ });
+ (child ? parent.tableIns : tableIns).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;
+ }
+ limit(child);
+ }
+ });
+}
+
+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);
+ }
+ layer.style(index, {
+// top: (($(window).height()-height)/3)+"px",
+ height: height+'px'
+ });
+}
+
+$('body').keydown(function () {
+ if (event.keyCode === 13) {
+ $("#search").click();
+ }
+});
diff --git a/src/main/webapp/views/index.html b/src/main/webapp/views/index.html
index 8f26118..1212d47 100644
--- a/src/main/webapp/views/index.html
+++ b/src/main/webapp/views/index.html
@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
- <title>閫熻吘 - 鑷姩鍖栫珛浣撲粨搴� - AS / RS</title>
+ <title>鍋ュ織 - 鑷姩鍖栫珛浣撲粨搴� - AS / RS</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.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
diff --git a/src/main/webapp/views/locDetlWarning/locDetlWarning.html b/src/main/webapp/views/locDetlWarning/locDetlWarning.html
new file mode 100644
index 0000000..9ec1599
--- /dev/null
+++ b/src/main/webapp/views/locDetlWarning/locDetlWarning.html
@@ -0,0 +1,52 @@
+<!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/cool.css" media="all">
+ <link rel="stylesheet" href="../../static/css/common.css" media="all">
+</head>
+<body>
+
+<!-- 鎼滅储鏍� -->
+<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 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>
+
+<!-- 琛ㄦ牸 -->
+<div class="layui-form">
+ <table class="layui-hide" id="locDetlWarning" lay-filter="locDetlWarning"></table>
+</div>
+<script type="text/html" id="toolbar">
+
+ <div class="layui-btn-container layui-col-md1">
+ <button class="layui-btn" lay-event="exportAll" style="margin-top: -0px">瀵煎嚭鍏ㄩ儴</button>
+ </div>
+</script>
+
+
+<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/locDetlWarning/locDetlWarning.js" charset="utf-8"></script>
+
+</body>
+</html>
+
diff --git a/src/main/webapp/views/report/locDetl.html b/src/main/webapp/views/report/locDetl.html
index d0a9eff..570013e 100644
--- a/src/main/webapp/views/report/locDetl.html
+++ b/src/main/webapp/views/report/locDetl.html
@@ -54,14 +54,22 @@
tableIns = table.render({
elem: '#locDetlByMap',
headers: {token: localStorage.getItem('token')},
- url: baseUrl+'/locDetl/list/auth',
+ url: baseUrl+'/manLocDetl/list/auth',
page: true,
limit: 20,
skin: 'line',
where: {loc_no: locNo},
even: true,
cellMinWidth: 50,
- cols: [getCol()],
+ cols: [[
+ {field: 'locNo', align: 'center',title: '搴撲綅鍙�'},
+ {field: 'matnr', align: 'center',title: '鍟嗗搧缂栧彿'},
+ {field: 'maktx', align: 'center',title: '鍟嗗搧鍚嶇О'},
+ {field: 'anfme', align: 'center',title: '鏁伴噺'},
+ {field: 'orderNo', align: 'center',title: '璁㈠崟鍙�'},
+ {field: 'createTime$', align: 'center',title: '鍏ュ簱鏃堕棿'},
+ {field: 'specs', align: 'center',title: '瑙勬牸'}
+ ]],
request: {
pageName: 'curr',
pageSize: 'limit'
--
Gitblit v1.9.1