From 4a3c1692763126d82ac3be7c9d599e3869ed6890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=81=E5=86=9C=E7=9A=84=E6=98=A5=E5=A4=A9?= <416662981@qq.com> Date: Sun, 22 Oct 2017 21:43:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0jdbc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/common/jdbc.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/common/jdbc.properties b/src/main/resources/common/jdbc.properties index 19baf067..662148d1 100644 --- a/src/main/resources/common/jdbc.properties +++ b/src/main/resources/common/jdbc.properties @@ -1,4 +1,4 @@ -jdbcUrl= jdbc\:mysql\://localhost\:3306/jsh_erp?useUnicode\=true&characterEncoding\=UTF-8 +jdbcUrl= jdbc\:mysql\://localhost\:3306/jsh_erp_guoku1009?useUnicode\=true&characterEncoding\=UTF-8 driverClass= com.mysql.jdbc.Driver user= root password=1234 \ No newline at end of file From 26c4950b107209621b6d78b31276b9ac3021e190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=81=E5=86=9C=E7=9A=84=E6=98=A5=E5=A4=A9?= <416662981@qq.com> Date: Mon, 23 Oct 2017 00:37:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=92=8C=E5=8D=95?= =?UTF-8?q?=E6=8D=AE=E4=B8=AD=E5=95=86=E5=93=81=E4=BF=A1=E6=81=AF=E7=9A=84?= =?UTF-8?q?'=E6=89=A9=E5=B1=95=E4=BF=A1=E6=81=AF'=E7=9A=84=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsh/action/materials/DepotItemAction.java | 80 ++++++++++++------- .../jsh/action/materials/MaterialAction.java | 38 +++++++-- .../service/materials/MaterialService.java | 24 +----- src/main/webapp/pages/materials/material.jsp | 44 +++++++--- .../webapp/pages/reports/buy_in_report.jsp | 51 +++++++++--- .../pages/reports/gift_manage_report.jsp | 37 ++++++++- .../pages/reports/in_out_stock_report.jsp | 40 ++++++++-- .../webapp/pages/reports/sale_out_report.jsp | 42 ++++++++-- 8 files changed, 257 insertions(+), 99 deletions(-) diff --git a/src/main/java/com/jsh/action/materials/DepotItemAction.java b/src/main/java/com/jsh/action/materials/DepotItemAction.java index 16788073..98da1fa4 100644 --- a/src/main/java/com/jsh/action/materials/DepotItemAction.java +++ b/src/main/java/com/jsh/action/materials/DepotItemAction.java @@ -283,27 +283,8 @@ public class DepotItemAction extends BaseAction } //品名/型号/扩展信息/包装 String MaterialName = depotItem.getMaterialId().getName() + ((depotItem.getMaterialId().getModel() == null || depotItem.getMaterialId().getModel().equals(""))?"":"("+depotItem.getMaterialId().getModel() + ")"); - for(int i=0; i< mpArr.length; i++) { - if(mpArr[i].equals("颜色")) { - MaterialName = MaterialName + ((depotItem.getMaterialId().getColor() == null || depotItem.getMaterialId().getColor().equals(""))?"":"("+depotItem.getMaterialId().getColor() + ")"); - } - if(mpArr[i].equals("规格")) { - MaterialName = MaterialName + ((depotItem.getMaterialId().getStandard() == null || depotItem.getMaterialId().getStandard().equals(""))?"":"("+depotItem.getMaterialId().getStandard() + ")"); - } - if(mpArr[i].equals("制造商")) { - MaterialName = MaterialName + ((depotItem.getMaterialId().getMfrs() == null || depotItem.getMaterialId().getMfrs().equals(""))?"":"("+depotItem.getMaterialId().getMfrs() + ")"); - } - if(mpArr[i].equals("自定义1")) { - MaterialName = MaterialName + ((depotItem.getMaterialId().getOtherField1() == null || depotItem.getMaterialId().getOtherField1().equals(""))?"":"("+depotItem.getMaterialId().getOtherField1() + ")"); - } - if(mpArr[i].equals("自定义2")) { - MaterialName = MaterialName + ((depotItem.getMaterialId().getOtherField2() == null || depotItem.getMaterialId().getOtherField2().equals(""))?"":"("+depotItem.getMaterialId().getOtherField2() + ")"); - } - if(mpArr[i].equals("自定义3")) { - MaterialName = MaterialName + ((depotItem.getMaterialId().getOtherField3() == null || depotItem.getMaterialId().getOtherField3().equals(""))?"":"("+depotItem.getMaterialId().getOtherField3() + ")"); - } - } - MaterialName = MaterialName + ratio; + String materialOther = getOtherInfo(mpArr, depotItem); + MaterialName = MaterialName + materialOther + ratio; item.put("MaterialName", MaterialName); item.put("Unit", depotItem.getMUnit()); item.put("OperNumber", depotItem.getOperNumber()); @@ -354,7 +335,8 @@ public class DepotItemAction extends BaseAction pageUtil.setAdvSearch(getConditionALL()); depotItemService.find(pageUtil); List dataList = pageUtil.getPageList(); - + String mpList = model.getMpList(); //商品属性 + String[] mpArr = mpList.split(","); JSONObject outer = new JSONObject(); outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 @@ -373,7 +355,9 @@ public class DepotItemAction extends BaseAction item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId()); item.put("MaterialName", depotItem.getMaterialId().getName()); item.put("MaterialModel", depotItem.getMaterialId().getModel()); - item.put("MaterialStandard", depotItem.getMaterialId().getStandard()); + //扩展信息 + String materialOther = getOtherInfo(mpArr, depotItem); + item.put("MaterialOther", materialOther); item.put("MaterialColor", depotItem.getMaterialId().getColor()); item.put("MaterialUnit", depotItem.getMaterialId().getUnit()); Double unitPrice = 0.0; @@ -459,7 +443,8 @@ public class DepotItemAction extends BaseAction pageUtil.setAdvSearch(getConditionALL()); depotItemService.find(pageUtil); List dataList = pageUtil.getPageList(); - + String mpList = model.getMpList(); //商品属性 + String[] mpArr = mpList.split(","); JSONObject outer = new JSONObject(); outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 @@ -474,7 +459,9 @@ public class DepotItemAction extends BaseAction item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId()); item.put("MaterialName", depotItem.getMaterialId().getName()); item.put("MaterialModel", depotItem.getMaterialId().getModel()); - item.put("MaterialStandard", depotItem.getMaterialId().getStandard()); + //扩展信息 + String materialOther = getOtherInfo(mpArr, depotItem); + item.put("MaterialOther", materialOther); item.put("MaterialColor", depotItem.getMaterialId().getColor()); item.put("MaterialUnit", depotItem.getMaterialId().getUnit()); item.put("thisSum", InSum - OutSum); @@ -507,7 +494,8 @@ public class DepotItemAction extends BaseAction pageUtil.setAdvSearch(getConditionALL()); depotItemService.find(pageUtil); List dataList = pageUtil.getPageList(); - + String mpList = model.getMpList(); //商品属性 + String[] mpArr = mpList.split(","); JSONObject outer = new JSONObject(); outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 @@ -525,7 +513,9 @@ public class DepotItemAction extends BaseAction item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId()); item.put("MaterialName", depotItem.getMaterialId().getName()); item.put("MaterialModel", depotItem.getMaterialId().getModel()); - item.put("MaterialStandard", depotItem.getMaterialId().getStandard()); + //扩展信息 + String materialOther = getOtherInfo(mpArr, depotItem); + item.put("MaterialOther", materialOther); item.put("MaterialColor", depotItem.getMaterialId().getColor()); item.put("MaterialUnit", depotItem.getMaterialId().getUnit()); item.put("InSum", InSum); @@ -562,7 +552,8 @@ public class DepotItemAction extends BaseAction pageUtil.setAdvSearch(getConditionALL()); depotItemService.find(pageUtil); List dataList = pageUtil.getPageList(); - + String mpList = model.getMpList(); //商品属性 + String[] mpArr = mpList.split(","); JSONObject outer = new JSONObject(); outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 @@ -584,7 +575,9 @@ public class DepotItemAction extends BaseAction item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId()); item.put("MaterialName", depotItem.getMaterialId().getName()); item.put("MaterialModel", depotItem.getMaterialId().getModel()); - item.put("MaterialStandard", depotItem.getMaterialId().getStandard()); + //扩展信息 + String materialOther = getOtherInfo(mpArr, depotItem); + item.put("MaterialOther", materialOther); item.put("MaterialColor", depotItem.getMaterialId().getColor()); item.put("MaterialUnit", depotItem.getMaterialId().getUnit()); item.put("OutSum", OutSumRetail + OutSum); @@ -843,6 +836,35 @@ public class DepotItemAction extends BaseAction sumPrice = Double.parseDouble(allPrice); return sumPrice; } + + /** + * 获取扩展信息 + * @return + */ + public String getOtherInfo(String[] mpArr, DepotItem depotItem){ + String materialOther = ""; + for(int i=0; i< mpArr.length; i++) { + if(mpArr[i].equals("颜色")) { + materialOther = materialOther + ((depotItem.getMaterialId().getColor() == null || depotItem.getMaterialId().getColor().equals(""))?"":"("+depotItem.getMaterialId().getColor() + ")"); + } + if(mpArr[i].equals("规格")) { + materialOther = materialOther + ((depotItem.getMaterialId().getStandard() == null || depotItem.getMaterialId().getStandard().equals(""))?"":"("+depotItem.getMaterialId().getStandard() + ")"); + } + if(mpArr[i].equals("制造商")) { + materialOther = materialOther + ((depotItem.getMaterialId().getMfrs() == null || depotItem.getMaterialId().getMfrs().equals(""))?"":"("+depotItem.getMaterialId().getMfrs() + ")"); + } + if(mpArr[i].equals("自定义1")) { + materialOther = materialOther + ((depotItem.getMaterialId().getOtherField1() == null || depotItem.getMaterialId().getOtherField1().equals(""))?"":"("+depotItem.getMaterialId().getOtherField1() + ")"); + } + if(mpArr[i].equals("自定义2")) { + materialOther = materialOther + ((depotItem.getMaterialId().getOtherField2() == null || depotItem.getMaterialId().getOtherField2().equals(""))?"":"("+depotItem.getMaterialId().getOtherField2() + ")"); + } + if(mpArr[i].equals("自定义3")) { + materialOther = materialOther + ((depotItem.getMaterialId().getOtherField3() == null || depotItem.getMaterialId().getOtherField3().equals(""))?"":"("+depotItem.getMaterialId().getOtherField3() + ")"); + } + } + return materialOther; + } /** * 拼接搜索条件 * @return diff --git a/src/main/java/com/jsh/action/materials/MaterialAction.java b/src/main/java/com/jsh/action/materials/MaterialAction.java index a8199dd0..437fc1d0 100644 --- a/src/main/java/com/jsh/action/materials/MaterialAction.java +++ b/src/main/java/com/jsh/action/materials/MaterialAction.java @@ -303,7 +303,8 @@ public class MaterialAction extends BaseAction materialService.find(pageUtil); getSession().put("pageUtilMaterial", pageUtil); List dataList = pageUtil.getPageList(); - + String mpList = model.getMpList(); //商品属性 + String[] mpArr = mpList.split(","); JSONObject outer = new JSONObject(); outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 @@ -317,12 +318,32 @@ public class MaterialAction extends BaseAction item.put("Name", material.getName()); item.put("CategoryId", material.getMaterialCategory().getId()); //类型Id item.put("CategoryName", material.getMaterialCategory().getName()); //类型名称 - item.put("Mfrs", material.getMfrs()==null?"" : material.getMfrs()); item.put("Packing", material.getPacking()==null?"" : material.getPacking()); item.put("SafetyStock", material.getSafetyStock()==null?"" : material.getSafetyStock()); item.put("Model", material.getModel()==null?"" : material.getModel()); - item.put("Standard", material.getStandard()==null?"": material.getStandard()); - item.put("Color", material.getColor()==null?"": material.getColor()); + //扩展信息 + String materialOther = ""; + for(int i=0; i< mpArr.length; i++) { + if(mpArr[i].equals("颜色")) { + materialOther = materialOther + ((material.getColor() == null || material.getColor().equals(""))?"":"("+material.getColor() + ")"); + } + if(mpArr[i].equals("规格")) { + materialOther = materialOther + ((material.getStandard() == null || material.getStandard().equals(""))?"":"("+material.getStandard() + ")"); + } + if(mpArr[i].equals("制造商")) { + materialOther = materialOther + ((material.getMfrs() == null || material.getMfrs().equals(""))?"":"("+material.getMfrs() + ")"); + } + if(mpArr[i].equals("自定义1")) { + materialOther = materialOther + ((material.getOtherField1() == null || material.getOtherField1().equals(""))?"":"("+material.getOtherField1() + ")"); + } + if(mpArr[i].equals("自定义2")) { + materialOther = materialOther + ((material.getOtherField2() == null || material.getOtherField2().equals(""))?"":"("+material.getOtherField2() + ")"); + } + if(mpArr[i].equals("自定义3")) { + materialOther = materialOther + ((material.getOtherField3() == null || material.getOtherField3().equals(""))?"":"("+material.getOtherField3() + ")"); + } + } + item.put("MaterialOther", materialOther); item.put("Unit", material.getUnit()==null?"": material.getUnit()); item.put("RetailPrice", material.getRetailPrice()); item.put("LowPrice", material.getLowPrice()); @@ -335,9 +356,12 @@ public class MaterialAction extends BaseAction item.put("PriceStrategy", material.getPriceStrategy()); item.put("Enabled", material.getEnabled()); item.put("Remark", material.getRemark()); - item.put("OtherField1", material.getOtherField1()); - item.put("OtherField2", material.getOtherField2()); - item.put("OtherField3", material.getOtherField3()); + item.put("Color", material.getColor()==null?"" : material.getColor()); + item.put("Standard", material.getStandard()==null?"" : material.getStandard()); + item.put("Mfrs", material.getMfrs()==null?"" : material.getMfrs()); + item.put("OtherField1", material.getOtherField1()==null?"" : material.getOtherField1()); + item.put("OtherField2", material.getOtherField2()==null?"" : material.getOtherField2()); + item.put("OtherField3", material.getOtherField3()==null?"" : material.getOtherField3()); item.put("op", 1); dataArray.add(item); } diff --git a/src/main/java/com/jsh/service/materials/MaterialService.java b/src/main/java/com/jsh/service/materials/MaterialService.java index 0801e853..c15c84ad 100644 --- a/src/main/java/com/jsh/service/materials/MaterialService.java +++ b/src/main/java/com/jsh/service/materials/MaterialService.java @@ -89,7 +89,7 @@ public class MaterialService extends BaseService implements MaterialIS workbook = Workbook.createWorkbook(os); WritableSheet sheet = workbook.createSheet("信息报表", 0); //增加列头 - String[] colunmName = {"品名","类型","型号","颜色","规格","安全存量","单位","零售价","最低售价","预计采购价","批发价","备注","状态"}; + String[] colunmName = {"品名","类型","型号","安全存量","单位","零售价","最低售价","预计采购价","批发价","备注","状态"}; for(int i = 0 ;i < colunmName.length;i ++) { sheet.setColumnView(i, 10); sheet.addCell(new Label(i, 0, colunmName[i])); @@ -102,8 +102,6 @@ public class MaterialService extends BaseService implements MaterialIS sheet.addCell(new Label(j++,i, material.getName())); sheet.addCell(new Label(j++,i, material.getMaterialCategory().getName())); sheet.addCell(new Label(j++,i, material.getModel() == null ?"": material.getModel())); - sheet.addCell(new Label(j++,i, material.getColor() == null ?"": material.getColor())); - sheet.addCell(new Label(j++,i, material.getStandard() == null ?"": material.getStandard())); sheet.addCell(getLabelInfo(cellInfo,j++,i, material.getSafetyStock() == null ?"": material.getSafetyStock().toString(),material)); sheet.addCell(new Label(j++,i, material.getUnit() == null ?"": material.getUnit())); sheet.addCell(new Label(j++,i, material.getRetailPrice() == null ?"": material.getRetailPrice().toString())); @@ -206,8 +204,6 @@ public class MaterialService extends BaseService implements MaterialIS while(itsheet.hasNext()) { //获取当前行数据 Row row = itsheet.next(); - //获取一行有多少单元格 -// System.out.println(row.getLastCellNum()); //excel表格第几行数据 从1开始 0 是表头 int rowNum = row.getRowNum(); @@ -242,7 +238,7 @@ public class MaterialService extends BaseService implements MaterialIS Log.infoFileSync("==================excel表格中第" + totalRow + "行的第 " + cellIndex + "列的值为" + cell.getStringCellValue()); - //每行中数据顺序 "品名","类型","型号","颜色","规格","安全存量","单位","零售价","最低售价","预计采购价","批发价","备注","状态" + //每行中数据顺序 "品名","类型","型号","安全存量","单位","零售价","最低售价","预计采购价","批发价","备注","状态" switch(cellIndex) { case MaterialConstants.BusinessForExcel.EXCEL_NAME : String materialName = cell.getStringCellValue(); @@ -268,22 +264,6 @@ public class MaterialService extends BaseService implements MaterialIS } material.setModel(model); break; - case MaterialConstants.BusinessForExcel.EXCEL_COLOR : - String color = cell.getStringCellValue(); - if(null == color || "".equals(color)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(颜色)信息"); - break; - } - material.setColor(color); - break; - case MaterialConstants.BusinessForExcel.EXCEL_STANDARD : - String standard = cell.getStringCellValue(); - if(null == standard || "".equals(standard)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(规格)信息"); - break; - } - material.setStandard(standard); - break; case MaterialConstants.BusinessForExcel.EXCEL_SAFETY_STOCK : String safetyStock = cell.getStringCellValue(); if(null == safetyStock || "".equals(safetyStock)) { diff --git a/src/main/webapp/pages/materials/material.jsp b/src/main/webapp/pages/materials/material.jsp index bd3f8350..f672498c 100644 --- a/src/main/webapp/pages/materials/material.jsp +++ b/src/main/webapp/pages/materials/material.jsp @@ -35,10 +35,7 @@ - 颜色: - - - +   类别: @@ -253,6 +250,7 @@ var cid=1; var multiple = 0; //倍数 var mPropertyList = null; //商品属性列表 + var mPropertyListShort = ""; //商品属性列表-传值 //初始化界面 $(function() { @@ -263,6 +261,7 @@ initSelectInfo("edit_first"); manyUnitFun(); priceKeyUp();//价格触发事件 + initMPropertyShort(); //初始化商品属性 initTableData(); ininPager(); initForm(); @@ -529,6 +528,34 @@ }); } + //初始化商品属性 + function initMPropertyShort(){ + $.ajax({ + type: "post", + url: "<%=path %>/materialProperty/findBy.action", + dataType: "json", + async: false, + success: function (res) { + if (res && res.rows) { + var thisRows = res.rows; + for(var i=0; i < thisRows.length; i++) { + if(thisRows[i].enabled){ + mPropertyListShort += thisRows[i].nativeName +","; + } + } + if(mPropertyListShort){ + mPropertyListShort = mPropertyListShort.substring(0,mPropertyListShort.length-1); + } + } + }, + //此处添加错误处理 + error:function() { + $.messager.alert('查询提示','查询信息异常,请稍后再试!','error'); + return; + } + }); + } + //初始化表格数据 function initTableData() { //改变宽度和高度 @@ -550,7 +577,6 @@ //fitColumns:true, //单击行是否选中 //checkOnSelect : false, - url:'<%=path %>/material/findBy.action?pageSize=' + initPageSize+'&CategoryIds='+setCategoryId+'&CategoryId='+cid, pagination: true, //交替出现背景 striped : true, @@ -576,8 +602,7 @@ }, { title: '品名',field: 'Name',width:80}, { title: '型号',field: 'Model',width:80}, - { title: '颜色',field: 'Color',width:80}, - { title: '规格',field: 'Standard',width:80}, + { title: '扩展信息',field: 'MaterialOther',width:150}, { title: '单位',field: 'Unit',width:60}, { title: '安全存量',field: 'SafetyStock',width:90}, { title: '零售价',field: 'RetailPrice',width:60}, @@ -651,6 +676,7 @@ return; } }); + showMaterialDetails(1,initPageSize); } //初始化键盘enter事件 @@ -1384,8 +1410,7 @@ }); - function showMaterialDetails(pageNo,pageSize) - { + function showMaterialDetails(pageNo,pageSize) { if(setCategoryId!="1") { cid = 2; } @@ -1402,6 +1427,7 @@ Color: $.trim($("#searchColor").val()), CategoryId:cid, CategoryIds:setCategoryId, + mpList: mPropertyListShort, pageNo:pageNo, pageSize:pageSize }), diff --git a/src/main/webapp/pages/reports/buy_in_report.jsp b/src/main/webapp/pages/reports/buy_in_report.jsp index 3ad17758..bb682845 100644 --- a/src/main/webapp/pages/reports/buy_in_report.jsp +++ b/src/main/webapp/pages/reports/buy_in_report.jsp @@ -48,24 +48,50 @@