From 6c9c0bc4a63e660e78ef2a7ab69867ce19eef7b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Wed, 21 Jun 2017 23:34:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=9B=B6=E5=94=AE=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=92=8C=E6=8A=A5=E8=A1=A8=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsh/action/materials/DepotItemAction.java | 4 ++ .../service/materials/DepotItemService.java | 17 +++--- src/main/webapp/js/pages/materials/in_out.js | 54 ++++++++++++++++++- .../webapp/pages/reports/buy_in_report.jsp | 1 + .../pages/reports/in_out_stock_report.jsp | 1 + .../webapp/pages/reports/sale_out_report.jsp | 1 + 6 files changed, 68 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/jsh/action/materials/DepotItemAction.java b/src/main/java/com/jsh/action/materials/DepotItemAction.java index 7b0141565..5ace86385 100644 --- a/src/main/java/com/jsh/action/materials/DepotItemAction.java +++ b/src/main/java/com/jsh/action/materials/DepotItemAction.java @@ -211,6 +211,7 @@ public class DepotItemAction extends BaseAction item.put("MaterialName", depotItem.getMaterialId().getName()); item.put("MaterialModel", depotItem.getMaterialId().getModel()); item.put("MaterialColor", depotItem.getMaterialId().getColor()); + item.put("MaterialUnit", depotItem.getMaterialId().getUnit()); item.put("prevSum", prevSum); item.put("InSum", InSum); item.put("OutSum", OutSum); @@ -266,6 +267,7 @@ public class DepotItemAction extends BaseAction item.put("MaterialName", depotItem.getMaterialId().getName()); item.put("MaterialModel", depotItem.getMaterialId().getModel()); item.put("MaterialColor", depotItem.getMaterialId().getColor()); + item.put("MaterialUnit", depotItem.getMaterialId().getUnit()); item.put("InSum", InSum); item.put("OutSum", OutSum); item.put("InSumPrice", InSumPrice); @@ -323,6 +325,7 @@ public class DepotItemAction extends BaseAction item.put("MaterialName", depotItem.getMaterialId().getName()); item.put("MaterialModel", depotItem.getMaterialId().getModel()); item.put("MaterialColor", depotItem.getMaterialId().getColor()); + item.put("MaterialUnit", depotItem.getMaterialId().getUnit()); item.put("OutSum", OutSumRetail + OutSum); item.put("InSum", InSumRetail + InSum); item.put("OutSumPrice", OutSumRetailPrice + OutSumPrice); @@ -416,6 +419,7 @@ public class DepotItemAction extends BaseAction item.put("MaterialName", depotItem.getMaterialId().getName()); item.put("MaterialModel", depotItem.getMaterialId().getModel()); item.put("MaterialColor", depotItem.getMaterialId().getColor()); + item.put("MaterialUnit", depotItem.getMaterialId().getUnit()); item.put("prevSum", prevSum); item.put("InSum", InSum); item.put("OutSum", OutSum); diff --git a/src/main/java/com/jsh/service/materials/DepotItemService.java b/src/main/java/com/jsh/service/materials/DepotItemService.java index ab8efea41..9982b7719 100644 --- a/src/main/java/com/jsh/service/materials/DepotItemService.java +++ b/src/main/java/com/jsh/service/materials/DepotItemService.java @@ -89,8 +89,8 @@ public class DepotItemService extends BaseService implements DepotIte workbook = Workbook.createWorkbook(os); WritableSheet sheet = workbook.createSheet("进销存报表", 0); //增加列头 - int[] colunmWidth = {10,10,10,10,15,15,15,15,15}; - String[] colunmName = {"名称","款号","颜色","单价","上月结存数量","入库数量","出库数量","本月结存数量","结存金额"}; + int[] colunmWidth = {10,10,10,10,10,15,15,15,15,15}; + String[] colunmName = {"名称","款号","颜色","单位","单价","上月结存数量","入库数量","出库数量","本月结存数量","结存金额"}; for(int i = 0 ;i < colunmWidth.length;i ++) { sheet.setColumnView(i,colunmWidth[i]); @@ -103,14 +103,15 @@ public class DepotItemService extends BaseService implements DepotIte sheet.addCell(new Label(0, j+1, jo.getString("MaterialName"))); sheet.addCell(new Label(1, j+1, jo.getString("MaterialModel"))); sheet.addCell(new Label(2, j+1, jo.getString("MaterialColor"))); - sheet.addCell(new Label(3, j+1, jo.getString("UnitPrice"))); - sheet.addCell(new Label(4, j+1, jo.getString("prevSum"))); - sheet.addCell(new Label(5, j+1, jo.getString("InSum"))); - sheet.addCell(new Label(6, j+1, jo.getString("OutSum"))); - sheet.addCell(new Label(7, j+1, jo.getString("thisSum"))); + sheet.addCell(new Label(3, j+1, jo.getString("MaterialUnit"))); + sheet.addCell(new Label(4, j+1, jo.getString("UnitPrice"))); + sheet.addCell(new Label(5, j+1, jo.getString("prevSum"))); + sheet.addCell(new Label(6, j+1, jo.getString("InSum"))); + sheet.addCell(new Label(7, j+1, jo.getString("OutSum"))); + sheet.addCell(new Label(8, j+1, jo.getString("thisSum"))); double d = Double.parseDouble(jo.getString("thisAllPrice").toString()); String s1 = String.format("%.2f", d); - sheet.addCell(new Label(8, j+1, s1)); + sheet.addCell(new Label(9, j+1, s1)); } } workbook.write(); diff --git a/src/main/webapp/js/pages/materials/in_out.js b/src/main/webapp/js/pages/materials/in_out.js index 7d48534ba..16308a3fa 100644 --- a/src/main/webapp/js/pages/materials/in_out.js +++ b/src/main/webapp/js/pages/materials/in_out.js @@ -408,7 +408,56 @@ valueField:'Id', textField:'MaterialName', method:'get', - url: path + "/material/findBySelect.action" + url: path + "/material/findBySelect.action", + onSelect:function(rec){ + if(rec) { + $.ajax({ + url: path + "/material/findById.action", + type: "get", + dataType: "json", + data: { + "MaterialID": rec.Id + }, + success: function (res) { + if(res && res.rows && res.rows[0]) { + var retailPrice = res.rows[0].RetailPrice; //零售价格 + var presetPriceOne = res.rows[0].PresetPriceOne; //价格1 + var presetPriceTwo = res.rows[0].PresetPriceTwo; //价格2 + var TotalPrice = 0; + var allPrice = 0; + var body =$("#depotHeadFM .datagrid-body"); + var footer =$("#depotHeadFM .datagrid-footer"); + var input = ".datagrid-editable-input"; + body.find("[field='OperNumber']").find(input).val(1); + if(listSubType == "零售") { + body.find("[field='UnitPrice']").find(input).val(retailPrice); + body.find("[field='AllPrice']").find(input).val(retailPrice); + allPrice = retailPrice; + } + else if(listTitle == "销售出库列表" || listTitle == "采购退货列表" || listTitle == "其它出库列表" || listTitle == "调拨出库列表") { + body.find("[field='UnitPrice']").find(input).val(presetPriceOne); + body.find("[field='AllPrice']").find(input).val(presetPriceOne); + allPrice = presetPriceOne; + } + body.find("[field='AllPrice']").each(function(){ + if($(this).find("div").text()!==""){ + TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString()); + } + }); + TotalPrice = TotalPrice + allPrice; + footer.find("[field='AllPrice']").find("div").text((TotalPrice).toFixed(2)); + if(listSubType == "零售"){ + $("#ChangeAmount, #getAmount").val((TotalPrice).toFixed(2)); + $("#backAmount").val(0); + } + } + }, + error: function() { + $.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error'); + } + }); + } + } } } }, @@ -915,7 +964,8 @@ var body =$("#depotHeadFM .datagrid-body"); var footer =$("#depotHeadFM .datagrid-footer"); var input = ".datagrid-editable-input"; - + //点击商品下拉框,自动加载数量、单价、金额 + //修改单价,自动计算金额和合计 body.find("[field='UnitPrice']").find(input).off("keyup").on("keyup",function(){ var UnitPrice =$(this).val()-0; //单价 diff --git a/src/main/webapp/pages/reports/buy_in_report.jsp b/src/main/webapp/pages/reports/buy_in_report.jsp index cc906d115..8c65360b1 100644 --- a/src/main/webapp/pages/reports/buy_in_report.jsp +++ b/src/main/webapp/pages/reports/buy_in_report.jsp @@ -77,6 +77,7 @@ { title: '名称',field: 'MaterialName',width:60}, { title: '款号',field: 'MaterialModel',width:80}, { title: '颜色',field: 'MaterialColor',width:80}, + { title: '单位',field: 'MaterialUnit',width:80}, { title: '进货数量',field: 'InSum',width:60}, { title: '进货金额',field: 'InSumPrice',width:60}, { title: '退货数量',field: 'OutSum',width:60}, diff --git a/src/main/webapp/pages/reports/in_out_stock_report.jsp b/src/main/webapp/pages/reports/in_out_stock_report.jsp index 300b8fe1c..35e640752 100644 --- a/src/main/webapp/pages/reports/in_out_stock_report.jsp +++ b/src/main/webapp/pages/reports/in_out_stock_report.jsp @@ -97,6 +97,7 @@ { title: '名称',field: 'MaterialName',width:60}, { title: '款号',field: 'MaterialModel',width:80}, { title: '颜色',field: 'MaterialColor',width:80}, + { title: '单位',field: 'MaterialUnit',width:80}, { title: '单价',field: 'UnitPrice',width:60,formatter: function(value,row,index){ return value.toFixed(2); } diff --git a/src/main/webapp/pages/reports/sale_out_report.jsp b/src/main/webapp/pages/reports/sale_out_report.jsp index 8b373d81d..dcf9ef93f 100644 --- a/src/main/webapp/pages/reports/sale_out_report.jsp +++ b/src/main/webapp/pages/reports/sale_out_report.jsp @@ -79,6 +79,7 @@ { title: '名称',field: 'MaterialName',width:60}, { title: '款号',field: 'MaterialModel',width:80}, { title: '颜色',field: 'MaterialColor',width:80}, + { title: '单位',field: 'MaterialUnit',width:80}, { title: '销售数量',field: 'OutSum',width:60}, { title: '销售金额',field: 'OutSumPrice',width:60}, { title: '退货数量',field: 'InSum',width:60},