From a658fd5d4b9d4dc0332c90614be4d7e2e112e9b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com>
Date: Sun, 4 Aug 2019 23:11:44 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=93=E5=BA=93=E5=92=8C?=
=?UTF-8?q?=E5=AE=A2=E6=88=B7=E9=85=8D=E7=BD=AE=E5=BC=80=E5=85=B3=EF=BC=88?=
=?UTF-8?q?=E5=85=A8=E9=83=A8=E5=AE=8C=E6=88=90=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
erp_web/js/pages/materials/in_out.js | 37 +++++++++----------
erp_web/pages/manage/systemConfig.html | 4 +-
erp_web/pages/reports/in_detail.html | 16 +++++---
erp_web/pages/reports/in_material_count.html | 16 +++++---
.../pages/reports/in_out_stock_report.html | 13 ++++---
erp_web/pages/reports/out_detail.html | 16 +++++---
erp_web/pages/reports/out_material_count.html | 16 +++++---
.../pages/reports/stock_warning_report.html | 13 ++++---
.../jsh/erp/controller/DepotController.java | 15 +++++++-
.../erp/controller/SupplierController.java | 8 +++-
.../systemConfig/SystemConfigService.java | 34 +++++++++++++++++
11 files changed, 131 insertions(+), 57 deletions(-)
diff --git a/erp_web/js/pages/materials/in_out.js b/erp_web/js/pages/materials/in_out.js
index de86b434..44b823d6 100644
--- a/erp_web/js/pages/materials/in_out.js
+++ b/erp_web/js/pages/materials/in_out.js
@@ -217,28 +217,27 @@
//初始化页面选项卡
function initSelectInfo_depot(){
var options = "";
-
- if(depotList !=null)
- {
+ if(depotList !=null) {
options = "";
- for(var i = 0 ;i < depotList.length;i++)
- {
- var depot = depotList[i];
-
- if(userdepot!=null)
- {
- if(userdepot.indexOf("["+depot.id+"]")!=-1)
- {
- if(depot.isDefault){
- defDepotId = depot.id;
- }
- options += '';
- depotString = depotString + depot.id + ",";
- }
- }
- if(depot.type === 1){
+ for(var i = 0 ;i < depotList.length;i++) {
+ var depot = depotList[i];
+ if(depot.isDefault){
+ defDepotId = depot.id;
+ }
+ var config = getSystemConfig();
+ if(config && config.depotFlag == "1") {
+ if(userdepot!=null) {
+ if(userdepot.indexOf("["+depot.id+"]")!=-1) {
+ options += '';
+ depotString = depotString + depot.id + ",";
+ }
+ }
+ } else {
depotString = depotString + depot.id + ",";
}
+ if(depot.type === 1){
+ depotString = depotString + depot.id + ",";
+ }
}
depotString = depotString.substring(1, depotString.length-1);
$("#ProjectId").empty().append(options);
diff --git a/erp_web/pages/manage/systemConfig.html b/erp_web/pages/manage/systemConfig.html
index c5e8ca00..965f10a0 100644
--- a/erp_web/pages/manage/systemConfig.html
+++ b/erp_web/pages/manage/systemConfig.html
@@ -72,11 +72,11 @@
-
+
-
+
diff --git a/erp_web/pages/reports/in_detail.html b/erp_web/pages/reports/in_detail.html
index 97e7d3a3..ebcb5fcd 100644
--- a/erp_web/pages/reports/in_detail.html
+++ b/erp_web/pages/reports/in_detail.html
@@ -154,17 +154,21 @@
//初始化页面选项卡
function initSelectInfo_depot() {
var options = "";
-
if (depotList != null) {
options = "";
for (var i = 0; i < depotList.length; i++) {
var depot = depotList[i];
-
- if (userdepot != null) {
- if (userdepot.indexOf("[" + depot.id + "]") != -1) {
- options += '';
- depotString = depotString + depot.id + ",";
+ var config = getSystemConfig();
+ if(config && config.depotFlag == "1") {
+ if (userdepot != null) {
+ if (userdepot.indexOf("[" + depot.id + "]") != -1) {
+ options += '';
+ depotString = depotString + depot.id + ",";
+ }
}
+ } else {
+ options += '';
+ depotString = depotString + depot.id + ",";
}
}
depotString = depotString.substring(0, depotString.length - 1);
diff --git a/erp_web/pages/reports/in_material_count.html b/erp_web/pages/reports/in_material_count.html
index 6a2e7d34..2529e282 100644
--- a/erp_web/pages/reports/in_material_count.html
+++ b/erp_web/pages/reports/in_material_count.html
@@ -153,17 +153,21 @@
//初始化页面选项卡
function initSelectInfo_depot() {
var options = "";
-
if (depotList != null) {
options = "";
for (var i = 0; i < depotList.length; i++) {
var depot = depotList[i];
-
- if (userdepot != null) {
- if (userdepot.indexOf("[" + depot.id + "]") != -1) {
- options += '';
- depotString = depotString + depot.id + ",";
+ var config = getSystemConfig();
+ if(config && config.depotFlag == "1") {
+ if (userdepot != null) {
+ if (userdepot.indexOf("[" + depot.id + "]") != -1) {
+ options += '';
+ depotString = depotString + depot.id + ",";
+ }
}
+ } else {
+ options += '';
+ depotString = depotString + depot.id + ",";
}
}
depotString = depotString.substring(0, depotString.length - 1);
diff --git a/erp_web/pages/reports/in_out_stock_report.html b/erp_web/pages/reports/in_out_stock_report.html
index 584ebf77..ec5f17fc 100644
--- a/erp_web/pages/reports/in_out_stock_report.html
+++ b/erp_web/pages/reports/in_out_stock_report.html
@@ -145,16 +145,19 @@
//初始化页面选项卡
function initSelectInfo_depot() {
var options = "";
-
if (depotList != null) {
options = "";
for (var i = 0; i < depotList.length; i++) {
var depot = depotList[i];
-
- if (userdepot != null) {
- if (userdepot.indexOf("[" + depot.id + "]") != -1) {
- options += '';
+ var config = getSystemConfig();
+ if(config && config.depotFlag == "1") {
+ if (userdepot != null) {
+ if (userdepot.indexOf("[" + depot.id + "]") != -1) {
+ options += '';
+ }
}
+ } else {
+ options += '';
}
}
$("#searchProjectId").empty().append(options);
diff --git a/erp_web/pages/reports/out_detail.html b/erp_web/pages/reports/out_detail.html
index 0238eb2c..4bb1de4e 100644
--- a/erp_web/pages/reports/out_detail.html
+++ b/erp_web/pages/reports/out_detail.html
@@ -154,17 +154,21 @@
//初始化页面选项卡
function initSelectInfo_depot() {
var options = "";
-
if (depotList != null) {
options = "";
for (var i = 0; i < depotList.length; i++) {
var depot = depotList[i];
-
- if (userdepot != null) {
- if (userdepot.indexOf("[" + depot.id + "]") != -1) {
- options += '';
- depotString = depotString + depot.id + ",";
+ var config = getSystemConfig();
+ if(config && config.depotFlag == "1") {
+ if (userdepot != null) {
+ if (userdepot.indexOf("[" + depot.id + "]") != -1) {
+ options += '';
+ depotString = depotString + depot.id + ",";
+ }
}
+ } else {
+ options += '';
+ depotString = depotString + depot.id + ",";
}
}
depotString = depotString.substring(0, depotString.length - 1);
diff --git a/erp_web/pages/reports/out_material_count.html b/erp_web/pages/reports/out_material_count.html
index b13c6ea2..7fc61c1c 100644
--- a/erp_web/pages/reports/out_material_count.html
+++ b/erp_web/pages/reports/out_material_count.html
@@ -153,17 +153,21 @@
//初始化页面选项卡
function initSelectInfo_depot() {
var options = "";
-
if (depotList != null) {
options = "";
for (var i = 0; i < depotList.length; i++) {
var depot = depotList[i];
-
- if (userdepot != null) {
- if (userdepot.indexOf("[" + depot.id + "]") != -1) {
- options += '';
- depotString = depotString + depot.id + ",";
+ var config = getSystemConfig();
+ if(config && config.depotFlag == "1") {
+ if (userdepot != null) {
+ if (userdepot.indexOf("[" + depot.id + "]") != -1) {
+ options += '';
+ depotString = depotString + depot.id + ",";
+ }
}
+ } else {
+ options += '';
+ depotString = depotString + depot.id + ",";
}
}
depotString = depotString.substring(0, depotString.length - 1);
diff --git a/erp_web/pages/reports/stock_warning_report.html b/erp_web/pages/reports/stock_warning_report.html
index ff4d484d..d6cce0dd 100644
--- a/erp_web/pages/reports/stock_warning_report.html
+++ b/erp_web/pages/reports/stock_warning_report.html
@@ -139,16 +139,19 @@
//初始化页面选项卡
function initSelectInfo_depot() {
var options = "";
-
if (depotList != null) {
options = "";
for (var i = 0; i < depotList.length; i++) {
var depot = depotList[i];
-
- if (userdepot != null) {
- if (userdepot.indexOf("[" + depot.id + "]") != -1) {
- options += '';
+ var config = getSystemConfig();
+ if(config && config.depotFlag == "1") {
+ if (userdepot != null) {
+ if (userdepot.indexOf("[" + depot.id + "]") != -1) {
+ options += '';
+ }
}
+ } else {
+ options += '';
}
}
$("#searchProjectId").empty().append(options);
diff --git a/src/main/java/com/jsh/erp/controller/DepotController.java b/src/main/java/com/jsh/erp/controller/DepotController.java
index 7c76af09..d3d5c361 100644
--- a/src/main/java/com/jsh/erp/controller/DepotController.java
+++ b/src/main/java/com/jsh/erp/controller/DepotController.java
@@ -12,6 +12,7 @@ import com.jsh.erp.datasource.entities.Depot;
import com.jsh.erp.datasource.entities.DepotEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.depot.DepotService;
+import com.jsh.erp.service.systemConfig.SystemConfigService;
import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.*;
import org.slf4j.Logger;
@@ -40,6 +41,9 @@ public class DepotController {
@Resource
private UserBusinessService userBusinessService;
+ @Resource
+ private SystemConfigService systemConfigService;
+
@GetMapping(value = "/getAllList")
public BaseResponseInfo getAllList(HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
@@ -102,6 +106,14 @@ public class DepotController {
return arr;
}
+ /**
+ * 获取用户拥有权限的仓库列表
+ * @param type
+ * @param keyId
+ * @param request
+ * @return
+ * @throws Exception
+ */
@RequestMapping(value = "/findDepotByUserId")
public JSONArray findDepotByUserId(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
HttpServletRequest request) throws Exception{
@@ -110,6 +122,7 @@ public class DepotController {
List dataList = depotService.findUserDepot();
//开始拼接json数据
if (null != dataList) {
+ boolean depotFlag = systemConfigService.getDepotFlag();
for (Depot depot : dataList) {
JSONObject item = new JSONObject();
//勾选判断1
@@ -119,7 +132,7 @@ public class DepotController {
} catch (DataAccessException e) {
logger.error(">>>>>>>>>>>>>>>>>查询用户对应的仓库:类型" + type + " KeyId为: " + keyId + " 存在异常!");
}
- if (flag == true) {
+ if (!depotFlag || flag) {
item.put("id", depot.getId());
item.put("depotName", depot.getName());
arr.add(item);
diff --git a/src/main/java/com/jsh/erp/controller/SupplierController.java b/src/main/java/com/jsh/erp/controller/SupplierController.java
index 2b2ad3d4..0f7a9413 100644
--- a/src/main/java/com/jsh/erp/controller/SupplierController.java
+++ b/src/main/java/com/jsh/erp/controller/SupplierController.java
@@ -7,6 +7,7 @@ import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.Supplier;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.supplier.SupplierService;
+import com.jsh.erp.service.systemConfig.SystemConfigService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.*;
@@ -44,6 +45,10 @@ public class SupplierController {
@Resource
private UserBusinessService userBusinessService;
+
+ @Resource
+ private SystemConfigService systemConfigService;
+
@Resource
private UserService userService;
@@ -81,6 +86,7 @@ public class SupplierController {
List supplierList = supplierService.findBySelectCus();
JSONArray dataArray = new JSONArray();
if (null != supplierList) {
+ boolean depotFlag = systemConfigService.getDepotFlag();
for (Supplier supplier : supplierList) {
JSONObject item = new JSONObject();
//勾选判断1
@@ -90,7 +96,7 @@ public class SupplierController {
} catch (DataAccessException e) {
logger.error(">>>>>>>>>>>>>>>>>查询用户对应的客户:存在异常!");
}
- if (flag == true) {
+ if (!depotFlag || flag) {
item.put("id", supplier.getId());
item.put("supplier", supplier.getSupplier()); //客户名称
dataArray.add(item);
diff --git a/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigService.java b/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigService.java
index eb6befdc..f6331cbd 100644
--- a/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigService.java
+++ b/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigService.java
@@ -187,4 +187,38 @@ public class SystemConfigService {
}
return result;
}
+
+ /**
+ * 获取仓库开关
+ * @return
+ * @throws Exception
+ */
+ public boolean getDepotFlag() throws Exception {
+ boolean depotFlag = false;
+ List list = getSystemConfig();
+ if(list.size()>0) {
+ String flag = list.get(0).getDepotFlag();
+ if(("1").equals(flag)) {
+ depotFlag = true;
+ }
+ }
+ return depotFlag;
+ }
+
+ /**
+ * 获取客户开关
+ * @return
+ * @throws Exception
+ */
+ public boolean getCustomerFlag() throws Exception {
+ boolean customerFlag = false;
+ List list = getSystemConfig();
+ if(list.size()>0) {
+ String flag = list.get(0).getCustomerFlag();
+ if(("1").equals(flag)) {
+ customerFlag = true;
+ }
+ }
+ return customerFlag;
+ }
}