Bläddra i källkod

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/SaleApplication.java
rainco 7 år sedan
förälder
incheckning
b58d5c5881

+ 9 - 1
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/dto/ListReqDTO.java

@@ -34,6 +34,13 @@ public class ListReqDTO implements Serializable {
         this.mode = mode;
         this.mode = mode;
     }
     }
 
 
+    /**
+    * @Description 拼最后查询条件
+    * @Param: []
+    * @return: java.lang.String
+    * @Author: guq
+    * @Date: 2018/10/25
+    */
     public String getFinalCondition() {
     public String getFinalCondition() {
         try {
         try {
             JSONArray jsonArray = JSONArray.parseArray(this.condition);
             JSONArray jsonArray = JSONArray.parseArray(this.condition);
@@ -76,10 +83,11 @@ public class ListReqDTO implements Serializable {
                 }
                 }
                 return finalCondition.substring(0, finalCondition.length() - 3);
                 return finalCondition.substring(0, finalCondition.length() - 3);
             }
             }
+            return null;
         }catch (Exception e){
         }catch (Exception e){
             return null;
             return null;
         }
         }
-        return null;
+
     }
     }
 }
 }
 
 

+ 67 - 0
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/po/BillCodeSeq.java

@@ -0,0 +1,67 @@
+package com.usoftchina.saas.commons.po;
+
+/**
+ * @author: guq
+ * @create: 2018-10-25 09:36
+ **/
+public enum  BillCodeSeq {
+
+    PRODUCT("物料资料", "Product"),
+
+    CUSTOMER("客户资料", "Customer"),
+
+    VENDOR("供应商资料", "Vendor"),
+
+    WAREHOUSE("仓库资料", "Warehouse"),
+
+    PURCHASE("采购订单", "Purchase"),
+
+    PURCHASEIN("采购验收单", "PurchaseIn"),
+
+    PURCHASEOUT("采购验退单", "PurchaseOut"),
+
+    SALE("销售订单", "Sale"),
+
+    SALEOUT("销售出货单", "SaleOut"),
+
+    SALEIN("销售退货单", "SaleIn"),
+
+    OTHERIN("其它入库单", "OtherIn"),
+
+    OTHEROUT("其它出库单", "OtherOut"),
+
+    APPROPRIATIONINOUT("调拨单", "AppropriationInOut"),
+
+    MAKE("制造单", "Make"),
+
+    PAYBALANCE("付款单", "PayBalance"),
+
+    RECBALANCE("收款单", "RecBalance"),
+
+    VERIFICATION("核价单", "Verification");
+
+    BillCodeSeq(String name, String caller) {
+        this.name = name;
+        this.caller = caller;
+    }
+
+    private String name;
+    private String caller;
+
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getCaller() {
+        return caller;
+    }
+
+    public void setCaller(String caller) {
+        this.caller = caller;
+    }
+}

+ 2 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleMapper.java

@@ -31,4 +31,6 @@ public interface SaleMapper {
     String validateAudit(List<DocBaseDTO> baseDTOs);
     String validateAudit(List<DocBaseDTO> baseDTOs);
 
 
     Integer validateCodeWhenUpdate(@Param("code") String code,@Param("id") Long id);
     Integer validateCodeWhenUpdate(@Param("code") String code,@Param("id") Long id);
+
+    void updateTotal(Long id);
 }
 }

+ 11 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java

@@ -133,6 +133,8 @@ public class SaleServiceImpl implements SaleService{
                 saledetailMapper.batchInsert(insertDetails);
                 saledetailMapper.batchInsert(insertDetails);
             }
             }
             baseDTO = getBaseDTOById(sa_id);
             baseDTO = getBaseDTOById(sa_id);
+            //更新销售金额
+            getTotal(sa_id);
             //日志记录
             //日志记录
             //messageLogService.save(baseDTO);
             //messageLogService.save(baseDTO);
             return baseDTO;
             return baseDTO;
@@ -159,6 +161,8 @@ public class SaleServiceImpl implements SaleService{
             saledetailMapper.batchUpdate(updateDetails);
             saledetailMapper.batchUpdate(updateDetails);
         }
         }
         baseDTO = getBaseDTOById(sa_id);
         baseDTO = getBaseDTOById(sa_id);
+        //更新销售金额
+        getTotal(sa_id);
         //日志
         //日志
         //messageLogService.save(baseDTO);
         //messageLogService.save(baseDTO);
         return baseDTO;
         return baseDTO;
@@ -482,5 +486,12 @@ public class SaleServiceImpl implements SaleService{
         //messageLogService.unAudit(docBaseDTO);
         //messageLogService.unAudit(docBaseDTO);
     }
     }
 
 
+    //更新最新销售总额
+    private void getTotal(Long id) {
+        if (null == id) {
+            return;
+        }
+        saleMapper.updateTotal(id);
+    }
 
 
 }
 }

+ 3 - 0
applications/sale/sale-server/src/main/resources/mapper/SaleMapper.xml

@@ -361,4 +361,7 @@
   <select id="validateUnAudit" parameterType="long" resultType="java.lang.String">
   <select id="validateUnAudit" parameterType="long" resultType="java.lang.String">
     select sa_code from sale where sa_id = #{id} and IFNULL(sa_statuscode,'UNAUDITED')='UNAUDITED'
     select sa_code from sale where sa_id = #{id} and IFNULL(sa_statuscode,'UNAUDITED')='UNAUDITED'
   </select>
   </select>
+  <update id="updateTotal" parameterType="long">
+    	update sale a set sa_total=(select sum(sd_price*sd_qty) from saledetail b where b.sd_said=a.sa_id ) where sa_id=#{id};
+  </update>
 </mapper>
 </mapper>

+ 102 - 94
frontend/saas-web/Readme.md

@@ -1,94 +1,102 @@
-# saas
-
-This folder is primarily a container for the top-level pieces of the application.
-While you can remove some files and folders that this application does not use,
-be sure to read below before deciding what can be deleted and what needs to be
-kept in source control.
-
-The following files are all needed to build and load the application.
-
- - `"app.json"` - The application descriptor which controls how the application is
-   built and loaded.
- - `"app.js"` - The file that launches the application. This is primarily used to
-   launch an instance of the `MyApp.Application` class.
- - `"index.html"` - The default web page for this application. This can be customized
-   in `"app.json"`.
- - `"build.xml"` - The entry point for Sencha Cmd to access the generated build
-   script. This file is a place where you can hook into these processes and tune
-   them. See the comments in that file for more information.
-
-These files can be ignored from source control as they are regenerated by the build
-process.
-
- - `"build"` - This folder contain the output of the build. The generated CSS file,
-   consolidated resources and concatenated JavaScript file are all stored in this
-   folder.
- - `"bootstrap.*"` - These files are generated by the build and watch commands to
-   enable the application to load in "development mode".
-
-## Basic Application Structure
-
-Applications that target a single toolkit will have the following structure.
-
-    app/                # Contains JavaScript and Theme code
-        model/          # Data model classes
-        view/           # Views as well as ViewModels and ViewControllers
-        store/          # Data stores
-        controller/     # Global / application-level controllers
-
-    overrides/          # JavaScript code that is automatically required
-
-    resources/          # Assets such as images, fonts, etc.
-
-### app/
-
-This folder contains JavaScript (.js files) and styling (.scss files) common
-for all builds of the application.
-
-#### app/controller/
-
-This folder contains the application's global controllers. ViewControllers are located
-alongside their respective view class in `"./view"`. These controllers are used for routing
-and other activities that span all views.
-
-#### app/model/
-
-This folder contains the application's (data) Model classes.
-
-#### app/view/
-
-This folder contains the views as well as ViewModels and ViewControllers depending on the
-application's architecture. Pure MVC applications may not have ViewModels, for example. For
-MVCVM applications or MVC applications that use ViewControllers, the following directory
-structure is recommended:
-
-    app/view/
-        foo/                    # Some meaningful grouping of one or more views
-            Foo.js              # The view class
-            Foo.scss            # The view class styling
-            FooController.js    # The controller for Foo (a ViewController)
-            FooModel.js         # The ViewModel for Foo
-
-This structure helps keep these closely related classes together and easily identifiable in
-most tabbed IDE's or text editors.
-
-#### app/store/
-
-This folder contains any number of store instances or types that can then be reused in the
-application.
-
-## Overrides
-
-The contents of "overrides" folders are automatically required and included in
-builds. These should not be explicitly mentioned in "requires" or "uses" in code.
-This area is intended for overrides like these:
-
-    Ext.define('saas.overrides.foo.Bar', {
-        override: 'Ext.foo.Bar',
-        ...
-    });
-
-Such overrides, while automatically required, will only be included if their target
-class ("Ext.foo.Bar" in this case) is also required. This simplifies applying
-patches or extensions to other classes.
-
+# 精简SaaS前端界面配置说明
+## 导航栏配置
+
+- 配置文件:
+```
+resources/json/navigation.json
+```
+- 格式样例:
+```json
+[{
+    "text": "采购",
+    "iconCls": "x-fa fa-shopping-basket",
+    "items": [{
+        "text": "制单",
+        "items": [{
+            "id": "purchase",
+            "text": "采购单",
+            "addType": "purchase-purchase-formpanel",
+            "viewType": "purchase-purchase-querypanel"
+        }]
+    }, {
+        "text": "报表",
+        "items": [{
+            "id": "puchasedetail",
+            "text": "采购明细表"
+        }]
+    }]
+}]
+```
+- 字段说明
+```
+text: 一级菜单项名称
+iconCls: 一级菜单项图标
+items:  二级菜单
+items[0].text:  二级菜单项标题(左)
+items[1].text: 二级菜单项标题(右)
+items[i].items: 二级菜单项
+items[i].items[i].id: 二级菜单项id
+items[i].items[i].text: 二级菜单项名称
+items[i].items[i].viewType: 点击名称进入的界面的xtype
+items[i].items[i].addType: 可选设置,添加“新增”按钮,点击进入xtype对应界面
+```
+
+## 主从表配置
+- 基础主从表组件
+```
+view: view.core.form.FormPanel
+controller: view.core.form.FormPanelController
+viewModel: view.core.form.FormPanelModel
+```
+自定义的主从表view、controller、viewModel需要继承自以上基础组件。
+
+- 配置字段说明
+
+| 字段名 | 说明 | 必填 | 样例 |
+| --- | --- | --- | --- |
+| extend | 继承,默认继承基础主从表 | √ | "saas.view.core.form.FormPanel" |
+| xtype | 格式为'-'连接的该文件全小写路径 | √ | "purchase-purchase-formpanel" |
+| controller | 控制层,可定义自定义的方法等。命名与xtype一致 | x | "purchase-purchase-formpanel" |
+| viewModel | Model层,可定义数据绑定关系等。命名与xtype一致 | x | "purchase-purchase-formpanel" |
+| viewName | 用于获取界面自定义配置 | x | "purchase-purchase-formpanel" |
+| addTitle | 新增时打开的页面标题 | √ | "采购单" |
+| idField | id字段 | √ | "id" |
+| codeField | 编号字段 | √ | "pu_code" |
+| statusField | 状态字段 | √ | "pu_status" |
+| statusCodeField | 状态码字段 | √ |  "pu_statuscode" |
+| readUrl | 取数接口 | √ | basePath + "purchase/purchase/read" |
+| saveUrl | 保存接口 | √ | basePath + "purchase/purchase/save" |
+| auditUrl | 审核接口 | √ | basePath + "purchase/purchase/audit" |
+| deleteUrl | 删除接口 | √ | basePath + "purchase/purchase/delete" |
+| deleteDetailUrl | 删除明细接口 | √ | basePath + "purchase/purchase/deleteItem" |
+| toolBtns | 自定义按钮 | x | [ Button ] |
+| defaultItems | 界面字段 | √ | [ Fields ]|
+
+主表字段配置说明
+
+_包括部分原有配置和主从表专属配置_
+
+| 字段 | 说明 | 必填 | 样例 |
+| --- | --- | --- | --- |
+| name | 字段名,根据该值设置字段绑定 | √ | "pu_vendcode" |
+| ignore | 是否忽略,为真时getFormData方法不会得到该字段值 | x | true |
+| defaultValue | 默认值 | x | "1001" |
+
+从表配置说明
+
+从表被定义为一个formfield(_xtype=detailGridField_),可以与其他字段一同放到主从表的items中。
+
+| 字段 | 说明 | 必填 | 样例 |
+| --- | --- | --- | --- |
+| storeModel | grid model | √ | "saas.model.purchase.purchasedetail" |
+| detnoColumn | 序号列 | √ | "pud_detno" |
+| columns[i].ignore | 是否忽略,为真时在调用保存方法时不会取到该列值 | x | true |
+
+
+## 查询列表配置
+- 基础组件
+```
+view: view.core.query.QueryPanel
+controller: view.core.query.QuertPanelController
+viewModel: view.core.query.QueryPanelModel
+```

+ 6 - 5
frontend/saas-web/app/util/BaseUtil.js

@@ -10,7 +10,11 @@ Ext.define('saas.util.BaseUtil', {
             params = config.params,
             params = config.params,
             async = config.async || true,
             async = config.async || true,
             method = config.method || 'GET',
             method = config.method || 'GET',
-            timeout = config.timeout || 8000;
+            timeout = config.timeout || 8000,
+            defaultHeaders = {
+                'Access-Control-Allow-Origin': '*',
+                "Content-Type": 'application/json;charset=UTF-8' 
+            };
 
 
         return new Ext.Promise(function (resolve, reject) {
         return new Ext.Promise(function (resolve, reject) {
             Ext.Ajax.request({
             Ext.Ajax.request({
@@ -19,10 +23,7 @@ Ext.define('saas.util.BaseUtil', {
                 async: async,
                 async: async,
                 method: method,
                 method: method,
                 timeout: timeout,
                 timeout: timeout,
-                headers: {
-                    'Access-Control-Allow-Origin': '*',
-                    "Content-Type": 'application/json;charset=UTF-8' 
-                },
+                headers: Ext.apply(defaultHeaders, config.headers),
                 success: function (response, opts) {
                 success: function (response, opts) {
                     var res = Ext.decode(response.responseText);
                     var res = Ext.decode(response.responseText);
                     if(res.success) {
                     if(res.success) {

+ 5 - 2
frontend/saas-web/app/util/FormUtil.js

@@ -116,6 +116,9 @@ Ext.define('saas.util.FormUtil', {
             //取后台编号
             //取后台编号
             me.BaseUtil.request({
             me.BaseUtil.request({
                 url: basePath + 'commons/number/getMaxnumber',
                 url: basePath + 'commons/number/getMaxnumber',
+                headers: {
+                    "Content-Type": 'application/x-www-form-urlencoded;charset=UTF-8'
+                },
                 params: {
                 params: {
                     caller:form.caller
                     caller:form.caller
                 },
                 },
@@ -124,7 +127,7 @@ Ext.define('saas.util.FormUtil', {
                 form.setLoading(false);
                 form.setLoading(false);
                 var res = Ext.decode(response.responseText);
                 var res = Ext.decode(response.responseText);
                 if(res.success){
                 if(res.success){
-                    var code = res.data.code;
+                    var code = res.data;
                     var viewModel = form.getViewModel();
                     var viewModel = form.getViewModel();
                     var detailGrids = form.query('detailGridField');
                     var detailGrids = form.query('detailGridField');
 
 
@@ -132,7 +135,7 @@ Ext.define('saas.util.FormUtil', {
                         grid.add10EmptyRow();
                         grid.add10EmptyRow();
                     });
                     });
                     if(code){
                     if(code){
-                        viewModel.set(form._codeField,code);
+                        viewModel.set('form.' + form._codeField,code);
                     }
                     }
                 }
                 }
             }).catch(function() {
             }).catch(function() {

+ 6 - 7
frontend/saas-web/app/view/core/form/FormPanel.js

@@ -89,15 +89,10 @@ Ext.define('saas.view.core.form.FormPanel', {
         viewModel = me.getViewModel();
         viewModel = me.getViewModel();
         
         
         var o = {};
         var o = {};
-        o[statusField] = {
-            bind: '{form.' + statusCodeField + '}',
-            get: function(value) {
-                return value == 'AUDITED' ? '已审核' : '未审核'
-            }
-        };
         o['auditBtnText'] = {
         o['auditBtnText'] = {
             bind: '{form.' + statusCodeField + '}',
             bind: '{form.' + statusCodeField + '}',
             get: function(value) {
             get: function(value) {
+                viewModel.set('form.' + statusField, value == 'AUDITED' ? '审核' : '反审核');
                 return value == 'AUDITED' ? '反审核' : '审核'
                 return value == 'AUDITED' ? '反审核' : '审核'
             }
             }
         };
         };
@@ -105,7 +100,11 @@ Ext.define('saas.view.core.form.FormPanel', {
 
 
         viewModel.set('form.createTime', new Date());
         viewModel.set('form.createTime', new Date());
         viewModel.set('form.updateTime', new Date());
         viewModel.set('form.updateTime', new Date());
-        statusCodeField ? viewModel.set('form.' + statusCodeField, "UNAUDITED") : viewModel.set('auditBtnText', "审核");
+        if(statusCodeField) {
+            viewModel.set('form.' + statusCodeField, "UNAUDITED");
+        }else {
+            viewModel.set('auditBtnText', "审核");
+        }
     },
     },
 
 
     addItems: function(items) {
     addItems: function(items) {