Browse Source

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

heqinwei 7 years ago
parent
commit
51d39cb8a7
100 changed files with 1570 additions and 652 deletions
  1. 34 0
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/dto/EndProductDTO.java
  2. 87 0
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/dto/MessagelogDTO.java
  3. 1 1
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java
  4. 1 1
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/po/BillCodeSeq.java
  5. 11 1
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/po/Operation.java
  6. 53 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/config/WebConfig.java
  7. 37 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/EndProductController.java
  8. 22 4
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/MaxnumberController.java
  9. 19 4
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/MessageLogController.java
  10. 18 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/EndProductMapper.java
  11. 3 1
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/MaxnumbersMapper.java
  12. 3 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/MessagelogMapper.java
  13. 15 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/EndProductService.java
  14. 8 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/MaxnumberService.java
  15. 5 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/MessageLogService.java
  16. 90 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/EndProductServiceImpl.java
  17. 66 1
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/MaxnumberServiceImpl.java
  18. 38 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/MessageLogServiceImpl.java
  19. 3 1
      applications/commons/commons-server/src/main/resources/i18n/messages_zh_CN.properties
  20. 31 0
      applications/commons/commons-server/src/main/resources/mapper/EndProductMapper.xml
  21. 33 15
      applications/commons/commons-server/src/main/resources/mapper/MaxnumbersMapper.xml
  22. 12 0
      applications/commons/commons-server/src/main/resources/mapper/MessagelogMapper.xml
  23. 2 1
      applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/ProductDTO.java
  24. 1 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/DocumentApplication.java
  25. 2 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/config/WebConfig.java
  26. 1 1
      applications/document/document-server/src/main/resources/mapper/AddressMapper.xml
  27. 1 1
      applications/document/document-server/src/main/resources/mapper/CustomerkindMapper.xml
  28. 2 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/config/WebConfig.java
  29. 1 1
      applications/money/money-server/src/main/resources/application.yml
  30. 4 1
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseDetailDTO.java
  31. 3 1
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseListDTO.java
  32. 14 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/PurchaseApplication.java
  33. 2 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/config/WebConfig.java
  34. 1 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/ProdInOutController.java
  35. 5 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/ProdIODetailMapper.java
  36. 0 3
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchaseMapper.java
  37. 1 4
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchasedetailMapper.java
  38. 4 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseDetail.java
  39. 3 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseList.java
  40. 2 2
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/ProdInOutService.java
  41. 55 36
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java
  42. 11 9
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  43. 21 5
      applications/purchase/purchase-server/src/main/resources/mapper/ProdIODetailMapper.xml
  44. 3 61
      applications/purchase/purchase-server/src/main/resources/mapper/PurchaseListMapper.xml
  45. 119 134
      applications/purchase/purchase-server/src/main/resources/mapper/PurchasedetailMapper.xml
  46. 1 1
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdIODetailDTO.java
  47. 2 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/config/WebConfig.java
  48. 2 2
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/ProdInOutController.java
  49. 25 1
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/SaleController.java
  50. 1 1
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/ProdInOutService.java
  51. 5 1
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/SaleService.java
  52. 16 5
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/ProdInOutServiceImpl.java
  53. 37 1
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java
  54. 8 8
      applications/sale/sale-server/src/main/resources/mapper/ProdIODetailMapper.xml
  55. 2 1
      applications/sale/sale-server/src/main/resources/mapper/SaleListMapper.xml
  56. 2 0
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/config/WebConfig.java
  57. 5 4
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/controller/ProdInOutController.java
  58. 4 0
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/mapper/ProdIODetailMapper.java
  59. 2 2
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/ProdInOutService.java
  60. 56 37
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/ProdInOutServiceImpl.java
  61. 1 1
      applications/storage/storage-server/src/main/resources/application.yml
  62. 18 5
      applications/storage/storage-server/src/main/resources/mapper/ProdIODetailMapper.xml
  63. 7 0
      applications/storage/storage-server/src/test/com/usoftchina/saas/storage/mapper/ProdIODetailMapperTest.java
  64. 13 14
      base-servers/auth/auth-dto/src/main/java/com/usoftchina/saas/auth/dto/AuthDTO.java
  65. 1 1
      base-servers/auth/auth-server/src/main/java/com/usoftchina/saas/auth/controller/AuthController.java
  66. 13 2
      frontend/saas-web/Readme.md
  67. 2 2
      frontend/saas-web/app/model/purchase/purchasedetail.js
  68. 1 1
      frontend/saas-web/app/model/sale/ProdIODetail.js
  69. 1 1
      frontend/saas-web/app/model/sale/Saledetail.js
  70. 57 11
      frontend/saas-web/app/util/FormUtil.js
  71. 2 2
      frontend/saas-web/app/view/core/base/BasePanelController.js
  72. 5 19
      frontend/saas-web/app/view/core/base/GridPanel.js
  73. 14 9
      frontend/saas-web/app/view/core/dbfind/DbfindGridPanel.js
  74. 1 1
      frontend/saas-web/app/view/core/dbfind/DbfindTrigger.js
  75. 22 12
      frontend/saas-web/app/view/core/dbfind/MultiDbfindGridPanel.js
  76. 1 1
      frontend/saas-web/app/view/core/dbfind/MultiDbfindTrigger.js
  77. 2 0
      frontend/saas-web/app/view/core/form/ConDateField.js
  78. 80 22
      frontend/saas-web/app/view/core/form/FormPanel.js
  79. 32 12
      frontend/saas-web/app/view/core/form/FormPanelController.js
  80. 1 0
      frontend/saas-web/app/view/core/form/FormPanelModel.js
  81. 85 11
      frontend/saas-web/app/view/core/form/field/DetailGridField.js
  82. 22 1
      frontend/saas-web/app/view/core/form/field/DetailGridField.scss
  83. 7 7
      frontend/saas-web/app/view/core/query/QueryGridPanel.js
  84. 2 2
      frontend/saas-web/app/view/core/query/QueryPanel.js
  85. 1 1
      frontend/saas-web/app/view/core/query/QueryPanelController.js
  86. 1 1
      frontend/saas-web/app/view/document/bom/FormController.js
  87. 20 65
      frontend/saas-web/app/view/document/bom/FormPanel.js
  88. 1 1
      frontend/saas-web/app/view/document/customer/FormController.js
  89. 8 35
      frontend/saas-web/app/view/document/customer/FormPanel.js
  90. 49 5
      frontend/saas-web/app/view/document/kind/ChildForm.js
  91. 35 5
      frontend/saas-web/app/view/document/kind/Kind.js
  92. 3 2
      frontend/saas-web/app/view/document/kind/KindController.js
  93. 2 2
      frontend/saas-web/app/view/document/kind/KindModel.js
  94. 6 1
      frontend/saas-web/app/view/document/other/Address.js
  95. 6 1
      frontend/saas-web/app/view/document/other/BankInformation.js
  96. 6 1
      frontend/saas-web/app/view/document/other/ProductBrand.js
  97. 6 1
      frontend/saas-web/app/view/document/other/ProductUnit.js
  98. 8 1
      frontend/saas-web/app/view/document/other/Warehouse.js
  99. 3 3
      frontend/saas-web/app/view/document/product/FormController.js
  100. 9 32
      frontend/saas-web/app/view/document/product/FormPanel.js

+ 34 - 0
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/dto/EndProductDTO.java

@@ -0,0 +1,34 @@
+package com.usoftchina.saas.commons.dto;
+
+import com.usoftchina.saas.base.dto.CommonBaseDTO;
+import com.usoftchina.saas.commons.po.Messagelog;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 结账  返回数据
+ * @author chenwei
+ * @date 2018/10/31
+ */
+public class EndProductDTO extends CommonBaseDTO implements Serializable {
+
+    private String main;
+    private List<MessagelogDTO> items;
+
+    public String getMain() {
+        return main;
+    }
+
+    public void setMain(String main) {
+        this.main = main;
+    }
+
+    public List<MessagelogDTO> getItems() {
+        return items;
+    }
+
+    public void setItems(List<MessagelogDTO> items) {
+        this.items = items;
+    }
+}

+ 87 - 0
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/dto/MessagelogDTO.java

@@ -0,0 +1,87 @@
+package com.usoftchina.saas.commons.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class MessagelogDTO implements Serializable {
+
+    private String ml_code;
+
+    private String ml_content;
+
+    private String ml_result;
+
+    private String ml_caller;
+
+    private String ml_man;
+
+    private Date createTime;
+
+    private Long companyId;
+
+    private Long ml_keyvalue;
+
+    public Long getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(Long companyId) {
+        this.companyId = companyId;
+    }
+
+    public Long getMl_keyvalue() {
+        return ml_keyvalue;
+    }
+
+    public void setMl_keyvalue(Long ml_keyvalue) {
+        this.ml_keyvalue = ml_keyvalue;
+    }
+
+    public String getMl_code() {
+        return ml_code;
+    }
+
+    public void setMl_code(String ml_code) {
+        this.ml_code = ml_code;
+    }
+
+    public String getMl_content() {
+        return ml_content;
+    }
+
+    public void setMl_content(String ml_content) {
+        this.ml_content = ml_content;
+    }
+
+    public String getMl_result() {
+        return ml_result;
+    }
+
+    public void setMl_result(String ml_result) {
+        this.ml_result = ml_result;
+    }
+
+    public String getMl_caller() {
+        return ml_caller;
+    }
+
+    public void setMl_caller(String ml_caller) {
+        this.ml_caller = ml_caller;
+    }
+
+    public String getMl_man() {
+        return ml_man;
+    }
+
+    public void setMl_man(String ml_man) {
+        this.ml_man = ml_man;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}

+ 1 - 1
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java

@@ -40,7 +40,7 @@ public enum BizExceptionCode implements BaseExceptionCode {
     SALE_CLOSE(72001, "单据已关闭,无法进行操作"),
     SALE_YQTYBEYONDQTY(72001, "明细行已转数量大于数量"),
     SALE_NULL_BILL(72002, "单据不存在或者明细为空"),
-    SALEOUT_ALL_TURNIN(72003, "该销售出货单已全部转退货,无法转销售退货单"),
+    SALEOUT_ALL_TURNIN(72003, "该出货单已全部转退货,无法转销售退货单"),
     SALEOUT_POSTSTATUS_ERROR(72004,"当前单据状态无法进行此操作。"),
     SALEOUT_POST_ERROR(72005,""),
     //资金

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

@@ -22,7 +22,7 @@ public enum  BillCodeSeq {
 
     SALE("销售订单", "Sale"),
 
-    SALEOUT("销售出货单", "SaleOut"),
+    SALEOUT("出货单", "SaleOut"),
 
     SALEIN("销售退货单", "SaleIn"),
 

+ 11 - 1
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/po/Operation.java

@@ -49,7 +49,17 @@ public enum Operation {
     /**
      * 禁用操作
      */
-    BANNED("msg.banned", "msg.bannedSuccess");
+    BANNED("msg.banned", "msg.bannedSuccess"),
+
+    /**
+     * 记账
+     */
+    ENDPRODUCT("msg.endProdudct", "msg.endProdudctSuccess"),
+
+    /**
+     * 反记账
+     */
+    UNENDPRODUCT("msg.unEndProduct", "msg.unEndProductSuccess");
 
     private final String title;
     private final String result;

+ 53 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/config/WebConfig.java

@@ -0,0 +1,53 @@
+package com.usoftchina.saas.commons.config;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.StringHttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
+
+import java.nio.charset.Charset;
+import java.text.SimpleDateFormat;
+import java.util.List;
+
+
+/**
+ * @author: guq
+ * @create: 2018-10-30 11:20
+ **/
+
+@Configuration
+public class WebConfig extends WebMvcConfigurationSupport{
+    @Bean
+    public HttpMessageConverter<String> responseBodyConverter() {
+        StringHttpMessageConverter converter = new StringHttpMessageConverter(Charset.forName("UTF-8"));
+        return converter;
+    }
+
+    @Bean
+    public MappingJackson2HttpMessageConverter MappingJacksonHttpMessageConverter(){
+        MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
+        ObjectMapper objectMapper = new ObjectMapper();
+        objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+        objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
+        converter.setObjectMapper(objectMapper);
+        return converter;
+    }
+
+    @Override
+    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
+        super.configureMessageConverters(converters);
+        converters.add(responseBodyConverter());
+        converters.add(MappingJacksonHttpMessageConverter());
+    }
+
+    @Override
+    public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
+        configurer.favorPathExtension(false);
+    }
+
+}

+ 37 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/EndProductController.java

@@ -0,0 +1,37 @@
+package com.usoftchina.saas.commons.controller;
+
+import com.netflix.discovery.converters.Auto;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.service.EndProductService;
+import com.usoftchina.saas.page.PageRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 结账
+ */
+@RestController
+@RequestMapping("/endProduct")
+public class EndProductController {
+
+    @Autowired
+    private EndProductService endProductService;
+
+    @GetMapping("/list")
+    public Result getListData(PageRequest page, ListReqDTO listReqDTO){
+        return Result.success(endProductService.getPeriodData(page, listReqDTO));
+    }
+
+    @PostMapping("/endAccount")
+    public Result endAccount(){
+        return Result.success(endProductService.endAccount());
+    }
+
+    @PostMapping("/unEndAccount")
+    public Result unEndAccount(){
+
+        return Result.success();
+    }
+
+}

+ 22 - 4
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/MaxnumberController.java

@@ -2,13 +2,15 @@ package com.usoftchina.saas.commons.controller;
 
 
 import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.po.Maxnumbers;
 import com.usoftchina.saas.commons.service.MaxnumberService;
 
+import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import java.sql.ResultSet;
 
 /**
  * @author: guq
@@ -31,4 +33,20 @@ public class MaxnumberController {
                                 @RequestParam("caller") String caller) {
         return Result.success(maxnumberService.pushMaxnubmer(count, code, caller));
     }
+
+    @GetMapping("/list")
+    public Result getList(PageRequest page, ListReqDTO listReqDTO){
+        return Result.success(maxnumberService.getListData(page, listReqDTO));
+    }
+
+    @PostMapping("/save")
+    public Result save(@RequestBody Maxnumbers maxnumbers){
+        return Result.success(maxnumberService.saveData(maxnumbers));
+    }
+
+    @PostMapping("/delete/{id}")
+    public Result delete(@PathVariable("id") Long id){
+        maxnumberService.removeByPrimaryKey(id);
+        return Result.success();
+    }
 }

+ 19 - 4
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/MessageLogController.java

@@ -1,14 +1,16 @@
 package com.usoftchina.saas.commons.controller;
 
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.po.Messagelog;
 import com.usoftchina.saas.commons.po.Operation;
 import com.usoftchina.saas.commons.service.MessageLogService;
 
+import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.context.request.async.DeferredResult;
 
 import java.util.concurrent.CompletableFuture;
@@ -24,6 +26,19 @@ public class MessageLogController {
     @Autowired
     private MessageLogService messageLogService;
 
+    /**
+     * 采购订单列表
+     *
+     * @param page
+     * @param req
+     * @return
+     */
+    @GetMapping("/list")
+    public Result<PageInfo<Messagelog>> getListData(PageRequest page, ListReqDTO req) {
+        PageInfo<Messagelog> listData = messageLogService.getListData(page, req);
+        return Result.success(listData);
+    }
+
     @RequestMapping("/save")
     public DeferredResult<String> save(@RequestBody DocBaseDTO baseDTO) {
         // Create the deferredResult and initiate a callback object, task, with it

+ 18 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/EndProductMapper.java

@@ -0,0 +1,18 @@
+package com.usoftchina.saas.commons.mapper;
+
+import com.usoftchina.saas.commons.dto.MessagelogDTO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+public interface EndProductMapper {
+
+    void endProduct(Map<String, Object> map);
+
+    String selectPeriod(@Param("companyId") Long companyId);
+
+    List<MessagelogDTO> getListData(@Param("condition") String condition, @Param("companyId") Long companyId);
+
+    void updatePeriodStatus(@Param("status") Long status,@Param("period") String period, @Param("companyId") Long companyId);
+}

+ 3 - 1
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/MaxnumbersMapper.java

@@ -10,7 +10,7 @@ import org.apache.ibatis.annotations.Param;
 import java.util.List;
 
 public interface MaxnumbersMapper extends CommonBaseMapper<Maxnumbers>{
-    int countByExample(MaxnumbersExample example);
+    Long countByExample(MaxnumbersExample example);
 
     int deleteByExample(MaxnumbersExample example);
 
@@ -31,4 +31,6 @@ public interface MaxnumbersMapper extends CommonBaseMapper<Maxnumbers>{
     int updateByPrimaryKeySelective(Maxnumbers record);
 
     int updateByPrimaryKey(Maxnumbers record);
+
+    List<Maxnumbers> getListDataByCondition(@Param("condition") String condition, @Param("companyId") Long companyId);
 }

+ 3 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/MessagelogMapper.java

@@ -1,6 +1,7 @@
 package com.usoftchina.saas.commons.mapper;
 
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+import com.usoftchina.saas.commons.dto.MessagelogDTO;
 import com.usoftchina.saas.commons.po.Messagelog;
 import com.usoftchina.saas.commons.po.MessagelogExample;
 import java.util.List;
@@ -28,4 +29,6 @@ public interface MessagelogMapper extends CommonBaseMapper<Messagelog>{
     int updateByPrimaryKeySelective(Messagelog record);
 
     int updateByPrimaryKey(Messagelog record);
+
+    List<Messagelog> selectMessageLog(@Param("con") String con, @Param("companyId") Long companyId);
 }

+ 15 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/EndProductService.java

@@ -0,0 +1,15 @@
+package com.usoftchina.saas.commons.service;
+
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.page.PageRequest;
+
+import java.util.Map;
+
+public interface EndProductService{
+
+    Map<String, Object> getPeriodData(PageRequest page, ListReqDTO listReqDTO);
+
+    String endAccount();
+
+    void unEndAccount();
+}

+ 8 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/MaxnumberService.java

@@ -1,8 +1,12 @@
 package com.usoftchina.saas.commons.service;
 
+import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.commons.mapper.MaxnumbersMapper;
 import com.usoftchina.saas.commons.po.Maxnumbers;
+import com.usoftchina.saas.page.PageRequest;
 
 /**
  * @author: guq
@@ -12,4 +16,8 @@ public interface MaxnumberService extends CommonBaseService<MaxnumbersMapper, Ma
     String getMaxnumner(String caller, boolean update);
 
     String pushMaxnubmer(Integer count, String code, String caller);
+
+    PageInfo<Maxnumbers> getListData(PageRequest page, ListReqDTO listReqDTO);
+
+    DocBaseDTO saveData(Maxnumbers maxnumbers);
 }

+ 5 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/MessageLogService.java

@@ -1,10 +1,13 @@
 package com.usoftchina.saas.commons.service;
 
+import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseService;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.commons.mapper.MessagelogMapper;
 import com.usoftchina.saas.commons.po.Messagelog;
 import com.usoftchina.saas.commons.po.Operation;
+import com.usoftchina.saas.page.PageRequest;
 
 public interface MessageLogService extends CommonBaseService<MessagelogMapper, Messagelog>{
     String save(DocBaseDTO baseDTO);
@@ -24,4 +27,6 @@ public interface MessageLogService extends CommonBaseService<MessagelogMapper, M
     String open(DocBaseDTO baseDTO);
 
     String customizeLog(DocBaseDTO baseDTO, Operation operation);
+
+    PageInfo<Messagelog> getListData(PageRequest page, ListReqDTO req);
 }

+ 90 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/EndProductServiceImpl.java

@@ -0,0 +1,90 @@
+package com.usoftchina.saas.commons.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.dto.MessagelogDTO;
+import com.usoftchina.saas.commons.mapper.EndProductMapper;
+import com.usoftchina.saas.commons.mapper.MessagelogMapper;
+import com.usoftchina.saas.commons.po.Operation;
+import com.usoftchina.saas.commons.service.EndProductService;
+import com.usoftchina.saas.commons.service.MessageLogService;
+import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.exception.BizException;
+import com.usoftchina.saas.page.PageRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class EndProductServiceImpl implements EndProductService {
+
+    @Autowired
+    private MessageLogService messageLogService;
+    @Autowired
+    private MessagelogMapper messagelogMapper;
+    @Autowired
+    private EndProductMapper endProductMapper;
+
+    @Override
+    public Map<String, Object> getPeriodData(PageRequest page, ListReqDTO listReqDTO) {
+        //设置分页
+        if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
+            page = new PageRequest();
+            page.setNumber(1);
+            page.setSize(10);
+        }
+        PageHelper.startPage(page.getNumber(), page.getSize());
+        //condition语句
+        String condition = listReqDTO.getFinalCondition();
+        if(condition == null){
+            condition = "1=1";
+        }
+        List<MessagelogDTO> messagelogDTOS = endProductMapper.getListData(condition, BaseContextHolder.getCompanyId());
+        //取分页信息
+        PageInfo<MessagelogDTO> pageInfo = new PageInfo<MessagelogDTO>(messagelogDTOS);
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("main", endProductMapper.selectPeriod(BaseContextHolder.getCompanyId()));
+        map.put("item",pageInfo);
+        return map;
+    }
+
+    @Override
+    public String endAccount() {
+        String period = endProductMapper.selectPeriod(BaseContextHolder.getCompanyId());
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("yearMonth", period);
+        map.put("companyId", BaseContextHolder.getCompanyId());
+        map.put("result", null);
+        endProductMapper.endProduct(map);
+        endProductMapper.updatePeriodStatus(99L, period, BaseContextHolder.getCompanyId());
+        DocBaseDTO docBaseDTO = generateMsgObj(Long.parseLong(period));
+        messageLogService.customizeLog(docBaseDTO, Operation.ENDPRODUCT);
+        return String.valueOf(map.get("result"));
+    }
+
+    @Override
+    public void unEndAccount() {
+        String period = endProductMapper.selectPeriod(BaseContextHolder.getCompanyId());
+        if (StringUtils.isEmpty(period)){
+            throw new BizException(79306,"系统还未结账,不能反结账");
+        }else{
+            endProductMapper.updatePeriodStatus(0L, period, BaseContextHolder.getCompanyId());
+            messageLogService.customizeLog(generateMsgObj(Long.parseLong(period)), Operation.UNENDPRODUCT);
+        }
+    }
+    /**
+     * 构造 记录日志对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, null, "EndProduct");
+    }
+
+}

+ 66 - 1
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/MaxnumberServiceImpl.java

@@ -1,6 +1,10 @@
 package com.usoftchina.saas.commons.service.impl;
 
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.commons.exception.BizExceptionCode;
 import com.usoftchina.saas.commons.mapper.MaxnumbersMapper;
 import com.usoftchina.saas.commons.mapper.MaxnumbersdetailMapper;
@@ -9,15 +13,18 @@ import com.usoftchina.saas.commons.po.MaxnumbersExample;
 import com.usoftchina.saas.commons.po.Maxnumbersdetail;
 import com.usoftchina.saas.commons.po.MaxnumbersdetailExample;
 import com.usoftchina.saas.commons.service.MaxnumberService;
+import com.usoftchina.saas.commons.service.MessageLogService;
 import com.usoftchina.saas.context.BaseContextHolder;
 
 import com.usoftchina.saas.exception.BizException;
+import com.usoftchina.saas.page.PageRequest;
 import com.usoftchina.saas.utils.DateUtils;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.Date;
+import java.util.List;
 
 
 /**
@@ -31,6 +38,8 @@ public class MaxnumberServiceImpl extends CommonBaseServiceImpl<MaxnumbersMapper
     private MaxnumbersMapper maxnumbersMapper;
     @Autowired
     private MaxnumbersdetailMapper maxnumbersdetailMapper;
+    @Autowired
+    private MessageLogService messageLogService;
 
     /**
     * @Description
@@ -144,6 +153,53 @@ public class MaxnumberServiceImpl extends CommonBaseServiceImpl<MaxnumbersMapper
         return maxcode;
     }
 
+    @Override
+    public PageInfo<Maxnumbers> getListData(PageRequest page, ListReqDTO listReqDTO) {
+        //设置分页
+        if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
+            page = new PageRequest();
+            page.setNumber(1);
+            page.setSize(10);
+        }
+        PageHelper.startPage(page.getNumber(), page.getSize());
+        //condition语句
+        String condition = listReqDTO.getFinalCondition();
+        if(condition == null){
+            condition = "1=1";
+        }
+
+        List<Maxnumbers> maxnumbersList = getMapper().getListDataByCondition(condition, BaseContextHolder.getCompanyId());
+        //取分页信息
+        PageInfo<Maxnumbers> pageInfo = new PageInfo<Maxnumbers>(maxnumbersList);
+        return pageInfo;
+    }
+
+    @Override
+    public DocBaseDTO saveData(Maxnumbers maxnumbers) {
+        DocBaseDTO docBaseDTO = null;
+        if(maxnumbers.getId() == 0){
+            //保存
+            maxnumbers.setCompanyId(BaseContextHolder.getCompanyId());
+            maxnumbers.setCreatorId(BaseContextHolder.getUserId());
+            maxnumbers.setCreateTime(new Date());
+
+            getMapper().insertSelective(maxnumbers);
+            //记录LOG
+            docBaseDTO = generateMsgObj(maxnumbers.getId());
+            messageLogService.save(docBaseDTO);
+        }else{
+            //更新
+            maxnumbers.setUpdaterId(BaseContextHolder.getUserId());
+            maxnumbers.setUpdateTime(new Date());
+
+            getMapper().updateByPrimaryKeySelective(maxnumbers);
+            //记录LOG
+            docBaseDTO = generateMsgObj(maxnumbers.getId());
+            messageLogService.update(docBaseDTO);
+        }
+        return docBaseDTO;
+    }
+
     /**
     * @Description
     * 根据长度跳流水号
@@ -222,11 +278,20 @@ public class MaxnumberServiceImpl extends CommonBaseServiceImpl<MaxnumbersMapper
     */
     private String getRulecode(Maxnumbers maxnumbers) {
         String rulecode = maxnumbers.getMn_leadcode();
-        Integer length = maxnumbers.getMn_number();
         String mn_rule = maxnumbers.getMn_rule();
+        mn_rule = mn_rule == null ? "" : mn_rule.toUpperCase();
         String date = "YYYYMM".equals(mn_rule) ? DateUtils.format(new Date(), "yyyyMM") :
                 DateUtils.format(new Date(), "yyyyMMdd");
         return rulecode += date;
     }
 
+    /**
+     * 构造日记记录对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, null, "Maxnumber");
+    }
+
 }

+ 38 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/MessageLogServiceImpl.java

@@ -1,19 +1,25 @@
 package com.usoftchina.saas.commons.service.impl;
 
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.commons.mapper.MessagelogMapper;
 import com.usoftchina.saas.commons.po.Messagelog;
 import com.usoftchina.saas.commons.po.Operation;
 import com.usoftchina.saas.commons.service.MessageLogService;
 import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.page.PageRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.MessageSource;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
 import java.util.Date;
+import java.util.List;
 import java.util.Locale;
 
 /**
@@ -25,6 +31,8 @@ public class MessageLogServiceImpl extends CommonBaseServiceImpl<MessagelogMappe
 
     @Autowired
     private MessageSource messageSource;
+    @Autowired
+    private MessagelogMapper messagelogMapper;
 
     @Override
     public String save(DocBaseDTO baseDTO) {
@@ -72,6 +80,22 @@ public class MessageLogServiceImpl extends CommonBaseServiceImpl<MessagelogMappe
         return log(operation, baseDTO);
     }
 
+    @Override
+    public PageInfo<Messagelog> getListData(PageRequest page, ListReqDTO req) {
+        //设置默认分页
+        if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
+            page = new PageRequest();
+            page.setNumber(1);
+            page.setSize(10);
+        }
+        PageHelper.startPage(page.getNumber(), page.getSize());
+        //查询数据
+        List<Messagelog> lists = getListByMode(req);
+        //取分页信息
+        PageInfo<Messagelog> pageInfo = new PageInfo<Messagelog>(lists);
+        return pageInfo;
+    }
+
     private String log(Operation operation, DocBaseDTO baseDTO) {
         String language = "zh_CN";
         Messagelog msg = new Messagelog();
@@ -90,4 +114,18 @@ public class MessageLogServiceImpl extends CommonBaseServiceImpl<MessagelogMappe
     private String getLocalMessage(String msg, String language) {
        return messageSource.getMessage(msg, null, Locale.CHINA);
     }
+
+
+    private List<Messagelog> getListByMode(ListReqDTO req) {
+        List<Messagelog> list = null;
+        Long companyId = BaseContextHolder.getCompanyId();
+        String con = req.getFinalCondition();
+        if (null == con) {
+            con = "1=1";
+        }
+        if (null == req || StringUtils.isEmpty(req.getMode()) || "MAIN".equals(req.getMode())) {
+            list = messagelogMapper.selectMessageLog(con, companyId);
+        }
+        return list;
+    }
 }

+ 3 - 1
applications/commons/commons-server/src/main/resources/i18n/messages_zh_CN.properties

@@ -114,4 +114,6 @@ msg.CopySuccess=\u590d\u5236\u6210\u529f,\u6765\u6e90\u5355\u53f7\uff1a
 msg.getBill=\u83b7\u53d6\u53d1\u7968\u660e\u7ec6
 msg.getARBill=\u83b7\u53d6\u5e94\u6536\u53d1\u7968
 msg.getAPBill=\u83b7\u53d6\u5e94\u4ed8\u53d1\u7968
-msg.getSuccess=\u83b7\u53d6\u6210\u529f
+msg.getSuccess=\u83b7\u53d6\u6210\u529f
+msg.endProdudct=\u8bb0\u8d26\u64cd\u4f5c
+msg.endProdudctSuccess=\u7ed3\u8d26\u6210\u529f

+ 31 - 0
applications/commons/commons-server/src/main/resources/mapper/EndProductMapper.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.usoftchina.saas.commons.mapper.EndProductMapper" >
+    <parameterMap id="spParamMap" type="java.util.Map">
+        <parameter property="yearMonth" jdbcType="VARCHAR" mode="IN" />
+        <parameter property="companyId" jdbcType="VARCHAR" mode="IN" />
+        <parameter property="result" jdbcType="VARCHAR" mode="OUT" />
+    </parameterMap>
+
+    <select id="selectPeriod" resultType="string">
+        select PD_DETNO from periodsdetail where companyid=#{companyId} and pd_status=0 order by PD_DETNO LIMIT 1;
+    </select>
+    <resultMap id="MsgResult" type="com.usoftchina.saas.commons.dto.MessagelogDTO">
+        <result column="ml_content" property="ml_content" jdbcType="VARCHAR" />
+        <result column="ml_result" property="ml_result" jdbcType="VARCHAR" />
+        <result column="ml_man" property="ml_man" jdbcType="VARCHAR" />
+        <result column="companyId" property="companyId" jdbcType="INTEGER" />
+        <result column="createTime" property="createTime" jdbcType="TIMESTAMP" />
+        <result column="ml_keyvalue" property="ml_keyvalue" jdbcType="INTEGER" />
+    </resultMap>
+    <select id="getListData" resultMap="MsgResult">
+        SELECT * FROM MESSAGELOG WHERE ML_CALLER='EndProduct' AND COMPANYID=#{companyId} AND ml_result='记账成功'
+    </select>
+
+    <select id="endProduct" parameterMap="spParamMap" statementType="CALLABLE">
+        CALL SP_ENDPRODUCT(?, ?, ?)
+    </select>
+    <update id="updatePeriodStatus" >
+        update periodsdetail set pd_status=#{status} where pd_detno=#{period} and companyId=#{companyId}
+    </update>
+</mapper>

+ 33 - 15
applications/commons/commons-server/src/main/resources/mapper/MaxnumbersMapper.xml

@@ -88,15 +88,15 @@
       order by ${orderByClause}
     </if>
   </select>
-  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
     select 
     <include refid="Base_Column_List" />
     from maxnumbers
-    where mn_id = #{id,jdbcType=INTEGER}
+    where mn_id = #{id}
   </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
     delete from maxnumbers
-    where mn_id = #{id,jdbcType=INTEGER}
+    where mn_id = #{id}
   </delete>
   <delete id="deleteByExample" parameterType="com.usoftchina.saas.commons.po.MaxnumbersExample" >
     delete from maxnumbers
@@ -105,27 +105,30 @@
     </if>
   </delete>
   <insert id="insert" parameterType="com.usoftchina.saas.commons.po.Maxnumbers" >
-    insert into maxnumbers (mn_id, mn_caller, mn_leadcode, 
+    insert into maxnumbers (mn_caller, mn_leadcode,
       mn_number, companyId, createTime, 
       creatorId, updateTime, updaterId
       )
-    values (#{id,jdbcType=INTEGER}, #{mn_caller,jdbcType=VARCHAR}, #{mn_leadcode,jdbcType=VARCHAR},
+    values (#{mn_caller,jdbcType=VARCHAR}, #{mn_leadcode,jdbcType=VARCHAR},
       #{mn_number,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
       #{creatorId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{updaterId,jdbcType=INTEGER}
       )
   </insert>
   <insert id="insertSelective" parameterType="com.usoftchina.saas.commons.po.Maxnumbers" >
+      <selectKey resultType="java.lang.Long" keyProperty="id">
+          SELECT LAST_INSERT_ID() AS ID
+      </selectKey>
     insert into maxnumbers
     <trim prefix="(" suffix=")" suffixOverrides="," >
-      <if test="id != null" >
-        mn_id,
-      </if>
       <if test="mn_caller != null" >
         mn_caller,
       </if>
       <if test="mn_leadcode != null" >
         mn_leadcode,
       </if>
+      <if test="mn_rule != null" >
+          mn_rule,
+      </if>
       <if test="mn_number != null" >
         mn_number,
       </if>
@@ -146,15 +149,15 @@
       </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides="," >
-      <if test="id != null" >
-        #{id,jdbcType=INTEGER},
-      </if>
       <if test="mn_caller != null" >
         #{mn_caller,jdbcType=VARCHAR},
       </if>
       <if test="mn_leadcode != null" >
         #{mn_leadcode,jdbcType=VARCHAR},
       </if>
+      <if test="mn_rule != null" >
+        #{mn_rule,jdbcType=VARCHAR},
+      </if>
       <if test="mn_number != null" >
         #{mn_number,jdbcType=VARCHAR},
       </if>
@@ -175,7 +178,7 @@
       </if>
     </trim>
   </insert>
-  <select id="countByExample" parameterType="com.usoftchina.saas.commons.po.MaxnumbersExample" resultType="java.lang.Integer" >
+  <select id="countByExample" parameterType="com.usoftchina.saas.commons.po.MaxnumbersExample" resultType="java.lang.Long" >
     select count(*) from maxnumbers
     <if test="_parameter != null" >
       <include refid="Example_Where_Clause" />
@@ -240,6 +243,9 @@
       <if test="mn_leadcode != null" >
         mn_leadcode = #{mn_leadcode,jdbcType=VARCHAR},
       </if>
+      <if test="mn_rule != null" >
+        mn_rule = #{mn_rule,jdbcType=VARCHAR},
+      </if>
       <if test="mn_number != null" >
         mn_number = #{mn_number,jdbcType=VARCHAR},
       </if>
@@ -259,7 +265,7 @@
         updaterId = #{updaterId,jdbcType=INTEGER},
       </if>
     </set>
-    where mn_id = #{id,jdbcType=INTEGER}
+    where mn_id = #{id}
   </update>
   <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.commons.po.Maxnumbers" >
     update maxnumbers
@@ -271,6 +277,18 @@
       creatorId = #{creatorId,jdbcType=INTEGER},
       updateTime = #{updateTime,jdbcType=TIMESTAMP},
       updaterId = #{updaterId,jdbcType=INTEGER}
-    where mn_id = #{id,jdbcType=INTEGER}
+    where mn_id = #{id}
   </update>
+    <select id="getListDataByCondition" resultMap="BaseResultMap">
+        SELECT * FROM MAXNUMBERS
+        <where>
+            <if test="condition">
+                ${condition}
+            </if>
+            <if test="companyId">
+                and COMPANYID=#{companyId}
+            </if>
+        </where>
+        ORDER BY MN_ID DESC
+    </select>
 </mapper>

+ 12 - 0
applications/commons/commons-server/src/main/resources/mapper/MessagelogMapper.xml

@@ -304,4 +304,16 @@
       updaterId = #{updaterId,jdbcType=INTEGER}
     where ml_id = #{id,jdbcType=INTEGER}
   </update>
+  <select id="selectMessageLog" resultMap="BaseResultMap">
+    select  *  from messagelog
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
+    order by ml_id
+  </select>
 </mapper>

+ 2 - 1
applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/ProductDTO.java

@@ -6,8 +6,9 @@ import lombok.Data;
 import java.io.Serializable;
 import java.util.Date;
 @Data
-public class ProductDTO extends CommonBaseDTO implements Serializable {
+public class ProductDTO implements Serializable {
 
+    private Long id;
     private String pr_code;
     private String pr_detail;
     private String pr_spec;

+ 1 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/DocumentApplication.java

@@ -13,10 +13,9 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
 @EnableTransactionManagement
 @EnableFeignClients("com.usoftchina.saas")
 @MapperScan("com.usoftchina.saas.document.mapper")
-public class DocumentApplication  {
+public class DocumentApplication {
     public static void main(String[] args) {
         SpringApplication.run(DocumentApplication.class, args);
     }
 
-
 }

+ 2 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/config/WebConfig.java

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.document.config;
 
+import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -31,6 +32,7 @@ public class WebConfig extends WebMvcConfigurationSupport{
     public MappingJackson2HttpMessageConverter MappingJacksonHttpMessageConverter(){
         MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
         ObjectMapper objectMapper = new ObjectMapper();
+        objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
         objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
         converter.setObjectMapper(objectMapper);
         return converter;

+ 1 - 1
applications/document/document-server/src/main/resources/mapper/AddressMapper.xml

@@ -182,7 +182,7 @@
     SELECT * FROM ADDRESS
   </select>
   <select id="selectCountByName" resultType="int">
-    SELECT * FROM ADDRESS WHERE AD_ADDRESS=#{name} AND COMPANYID=#{companyId}
+    SELECT count(*) FROM ADDRESS WHERE AD_ADDRESS=#{name} AND COMPANYID=#{companyId}
   </select>
     <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
         SELECT AD_ADDRESS display,AD_ADDRESS value FROM ADDRESS WHERE COMPANYID=#{companyId}

+ 1 - 1
applications/document/document-server/src/main/resources/mapper/CustomerkindMapper.xml

@@ -126,6 +126,6 @@
     SELECT ck_name display,ck_name value FROM CUSTOMERKIND WHERE COMPANYID=#{companyId}
   </select>
     <select id="selectCountByName" resultType="int">
-        SELECT * FROM CUSTOMERKIND WHERE CK_NAME=#{name} AND COMPANYID=#{companyId}
+        SELECT count(*) FROM CUSTOMERKIND WHERE CK_NAME=#{name} AND COMPANYID=#{companyId}
     </select>
 </mapper>

+ 2 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/config/WebConfig.java

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.money.config;
 
+import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -31,6 +32,7 @@ public class WebConfig extends WebMvcConfigurationSupport{
     public MappingJackson2HttpMessageConverter MappingJacksonHttpMessageConverter(){
         MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
         ObjectMapper objectMapper = new ObjectMapper();
+        objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
         objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
         converter.setObjectMapper(objectMapper);
         return converter;

+ 1 - 1
applications/money/money-server/src/main/resources/application.yml

@@ -46,7 +46,7 @@ eureka:
     serviceUrl:
       defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@192.168.0.181:8510/eureka/
 server:
-  port: 8920
+  port: 8880
   tomcat:
     uri-encoding: UTF-8
 info:

+ 4 - 1
applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseDetailDTO.java

@@ -5,6 +5,7 @@ import com.usoftchina.saas.document.dto.ProductDTO;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.Date;
 
 /**
  * @author yingp
@@ -29,6 +30,8 @@ public class PurchaseDetailDTO extends CommonBaseDTO implements Serializable{
 
     private Double pd_price;
 
+    private Double pd_taxprice;
+
     private Double pd_total;
 
     private Double pd_taxrate;
@@ -37,7 +40,7 @@ public class PurchaseDetailDTO extends CommonBaseDTO implements Serializable{
 
     private Double pd_acceptqty;
 
-    private Double pd_delivery;
+    private Date pd_delivery;
 
     private String pd_salecode;
 

+ 3 - 1
applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseListDTO.java

@@ -86,6 +86,8 @@ public class PurchaseListDTO extends CommonBaseDTO implements Serializable {
 
     private Double pd_price;
 
+    private Double pd_taxprice;
+
     private Double pd_total;
 
     private Double pd_taxrate;
@@ -94,7 +96,7 @@ public class PurchaseListDTO extends CommonBaseDTO implements Serializable {
 
     private Double pd_acceptqty;
 
-    private Double pd_delivery;
+    private Date pd_delivery;
 
     private String pd_salecode;
 

+ 14 - 1
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/PurchaseApplication.java

@@ -7,6 +7,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
 import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
 
 /**
  * @author yingp
@@ -18,8 +20,19 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
 @EnableFeignClients("com.usoftchina.saas")
 //@EnableAuthClient
 @MapperScan("com.usoftchina.saas.purchase.mapper")
-public class PurchaseApplication   {
+public class PurchaseApplication   extends WebMvcConfigurerAdapter{
     public static void main(String[] args) {
         SpringApplication.run(PurchaseApplication.class, args);
     }
+
+    @Override
+    public void addCorsMappings(CorsRegistry registry) {
+
+        registry.addMapping("/**")
+                .allowCredentials(true)
+                .allowedHeaders("*")
+                .allowedOrigins("*")
+                .allowedMethods("*");
+    }
+
 }

+ 2 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/config/WebConfig.java

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.purchase.config;
 
+import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -31,6 +32,7 @@ public class WebConfig extends WebMvcConfigurationSupport{
     public MappingJackson2HttpMessageConverter MappingJacksonHttpMessageConverter(){
         MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
         ObjectMapper objectMapper = new ObjectMapper();
+        objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
         objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
         converter.setObjectMapper(objectMapper);
         return converter;

+ 1 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/ProdInOutController.java

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
  * Created by zdw
  * 2018-10-17 11:41.
  */
+@CrossOrigin
 @RestController
 @RequestMapping("/prodinout")
 public class ProdInOutController {

+ 5 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/ProdIODetailMapper.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.purchase.mapper;
 
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.purchase.po.ProdIODetail;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -29,4 +30,8 @@ public interface ProdIODetailMapper extends CommonBaseMapper<ProdIODetail> {
     List<ProdIODetail> selectByFK(Long id);
 
     void deleteByFK(Long id);
+
+    void calcProdIn(@Param("pi_id") Long pi_id,@Param("pi_class") String pi_class);
+
+    void calcProdOut(@Param("pi_id") Long pi_id,@Param("pi_class") String pi_class);
 }

+ 0 - 3
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchaseMapper.java

@@ -10,9 +10,6 @@ import java.util.List;
 
 public interface PurchaseMapper extends CommonBaseMapper<Purchase>{
 
-
-    int insert(Purchase record);
-
     int insertSelective(Purchase record);
 
     Purchase selectByPrimaryKey(Long id);

+ 1 - 4
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchasedetailMapper.java

@@ -9,16 +9,12 @@ import java.util.List;
 public interface PurchasedetailMapper extends CommonBaseMapper<Purchase> {
     int deleteByPrimaryKey(Integer pdId);
 
-    int insert(PurchaseDetail record);
-
     int insertSelective(PurchaseDetail record);
 
     PurchaseDetail selectByPrimaryKey(Integer pdId);
 
     int updateByPrimaryKeySelective(PurchaseDetail record);
 
-    int updateByPrimaryKey(PurchaseDetail record);
-
     void batchInsert(List<PurchaseDetail> list);
 
     void batchUpdate(List<PurchaseDetail> list);
@@ -30,4 +26,5 @@ public interface PurchasedetailMapper extends CommonBaseMapper<Purchase> {
     void updatePurchaseYqty(Integer pu_id);
 
 
+    void calcPurchase(Long pu_id);
 }

+ 4 - 1
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseDetail.java

@@ -5,6 +5,7 @@ import com.usoftchina.saas.document.dto.ProductDTO;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.Date;
 
 @Data
 public class PurchaseDetail extends CommonBaseEntity implements Serializable {
@@ -25,6 +26,8 @@ public class PurchaseDetail extends CommonBaseEntity implements Serializable {
 
     private Double pd_price;
 
+    private Double pd_taxprice;
+
     private Double pd_total;
 
     private Double pd_taxrate;
@@ -33,7 +36,7 @@ public class PurchaseDetail extends CommonBaseEntity implements Serializable {
 
     private Double pd_acceptqty;
 
-    private Double pd_delivery;
+    private Date pd_delivery;
 
     private String pd_salecode;
 

+ 3 - 1
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseList.java

@@ -87,6 +87,8 @@ public class PurchaseList extends CommonBaseEntity implements Serializable {
 
     private Double pd_price;
 
+    private Double pd_taxprice;
+
     private Double pd_total;
 
     private Double pd_taxrate;
@@ -95,7 +97,7 @@ public class PurchaseList extends CommonBaseEntity implements Serializable {
 
     private Double pd_acceptqty;
 
-    private Double pd_delivery;
+    private Date pd_delivery;
 
     private String pd_salecode;
 

+ 2 - 2
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/ProdInOutService.java

@@ -47,7 +47,7 @@ public interface ProdInOutService extends CommonBaseService<ProdInOutMapper, Pro
      */
     DocBaseDTO audit(ProdInOutFormDTO formData);
 
-    void batchAudit(BatchDealBaseDTO baseDTOs);
+    String batchAudit(BatchDealBaseDTO baseDTOs);
 
     /**
      * 反审核出入库单
@@ -55,7 +55,7 @@ public interface ProdInOutService extends CommonBaseService<ProdInOutMapper, Pro
      */
     void unAudit(Long id);
 
-    void batchUnAudit(BatchDealBaseDTO baseDTOs);
+    String batchUnAudit(BatchDealBaseDTO baseDTOs);
 
     void deleteItem(Long id);
 

+ 55 - 36
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java

@@ -82,7 +82,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         if (null == con) {
             con = "1=1";
         }
-        if (null == req || StringUtils.isEmpty(req.getMode()) || "Main".equals(req.getMode())) {
+        if (null == req || StringUtils.isEmpty(req.getMode()) || "MAIN".equals(req.getMode())) {
               list = prodInOutListMapper.selectProdInOutListByCondition(con,companyId);
         } else {
               list = prodInOutListMapper.selectProdInOutBycondition(con,companyId);
@@ -153,7 +153,6 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
                 detail.setCompanyId(companyId);
                 detail.setCreatorId(userId);
                 detail.setCreateTime(new Date());
-
                 insertDetails.add(detail);
             }
             //插入从表
@@ -162,6 +161,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             }
 
             baseDTO = getBaseDTOById(pi_id,pi_class,pi_inoutno);
+            //计算金额,未税单价,未税金额等
+            calcProdInout(pi_id,pi_class);
             //日志记录
             messageLogService.save(baseDTO);
             return baseDTO;
@@ -192,14 +193,15 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             prodIODetailMapper.batchUpdate(updateDetails);
         }
         baseDTO = getBaseDTOById(pi_id,pi_class,pi_inoutno);
+        //计算金额,未税单价,未税金额等
+        calcProdInout(pi_id,pi_class);
         //更新已转数
+        updateYqty(prodInOut);
         //日志记录
         messageLogService.update(baseDTO);
-        updateYqty(prodInOut);
         return baseDTO;
     }
 
-
     @Override
     @Transactional
     public void delete(Long id) {
@@ -232,91 +234,97 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
                 baseDTO = saveFormData(formData);
                 id = baseDTO.getId();
             }
-            String res = singleAudit(formData.getMain());
-            if(res!=null){
-                new BizException(501,res);
-            }
+            singleAudit(formData.getMain());
         }
         baseDTO.setId(id);
         return baseDTO;
     }
 
-    private String singleAudit(ProdInOutDTO prodInOutDTO) {
+    private void singleAudit(ProdInOutDTO prodInOutDTO) {
         String pi_class= prodInOutDTO.getPi_class();
         Map<String, Object> map = new HashMap<String, Object>();
         map.put("inoutNo",prodInOutDTO.getPi_inoutno() );
         map.put("class", pi_class);
         map.put("commitid",BaseContextHolder.getUserId());
-        map.put("companyid",BaseContextHolder.getCompanyId());
+        map.put("companyId",BaseContextHolder.getCompanyId());
         map.put("result","");
-        warehouseApi.post(map);
-        Object result =  map.get("result");
-        if(result!=null){
-            return result.toString();
+        Result res = warehouseApi.post(map);
+        Object result =  res.getData();
+        if(!StringUtils.isEmpty(result)){
+            throw new BizException(BizExceptionCode.SALEOUT_POST_ERROR.getCode(),result.toString());
         }else{
             //记录日志
             DocBaseDTO docBaseDTO = getBaseDTOById(prodInOutDTO.getId(),pi_class,prodInOutDTO.getPi_inoutno());
             //日志
             messageLogService.audit(docBaseDTO);
-            return "";
         }
     }
 
     @Override
-    public void batchAudit(BatchDealBaseDTO baseDTOs) {
+    public String batchAudit(BatchDealBaseDTO baseDTOs) {
         if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
                 baseDTOs.getBaseDTOs().size() == 0) {
-            return;
+            return "没有可审核单据。";
         }
+        StringBuffer errorMsg = new StringBuffer();
         for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
-            Long id =  base.getId();
-            ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
-            ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
-            singleAudit(prodInOutDTO);
+            try {
+                Long id =  base.getId();
+                ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
+                ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
+                singleAudit(prodInOutDTO);
+            } catch (Exception e) {
+                errorMsg.append("编号:" + base.getCode() + "处理失败," + e.getMessage());
+            }
         }
+        return errorMsg.toString();
     }
 
     @Override
     public void unAudit(Long id) {
         ProdInOut prodInOut =checkAndReturnOrder(id);
         ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut, ProdInOutDTO.class);
-        String res =  singleUnAudit(prodInOutDTO);
-
+        singleUnAudit(prodInOutDTO);
     }
 
-    private String singleUnAudit(ProdInOutDTO prodInOutDTO) {
+    private void singleUnAudit(ProdInOutDTO prodInOutDTO) {
         String pi_class= prodInOutDTO.getPi_class();
         Map<String, Object> map = new HashMap<String, Object>();
         map.put("inoutNo",prodInOutDTO.getPi_inoutno() );
         map.put("class", pi_class);
         map.put("commitid",BaseContextHolder.getUserId());
-        map.put("companyid",BaseContextHolder.getCompanyId());
+        map.put("companyId",BaseContextHolder.getCompanyId());
         map.put("result","");
-        warehouseApi.unPost(map);
-        Object result =  map.get("result");
-        if(result!=null){
-            return result.toString();
+        Result res = warehouseApi.unPost(map);
+        Object result = res.getData();
+        if(!StringUtils.isEmpty(result)){
+            throw new BizException(BizExceptionCode.SALEOUT_POST_ERROR.getCode(),result.toString());
         }else{
             //记录日志
             DocBaseDTO docBaseDTO = getBaseDTOById(prodInOutDTO.getId(),pi_class,prodInOutDTO.getPi_inoutno());
             //日志
             messageLogService.unAudit(docBaseDTO);
-            return "";
         }
     }
 
     @Override
-    public void batchUnAudit(BatchDealBaseDTO baseDTOs) {
+    public String batchUnAudit(BatchDealBaseDTO baseDTOs) {
         if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
                 baseDTOs.getBaseDTOs().size() == 0) {
-            return;
+            return "无可反审核单据。";
         }
+        StringBuffer errorMsg = new StringBuffer();
         for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
-            Long id =  base.getId();
-            ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
-            ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
-            singleUnAudit(prodInOutDTO);
+            try {
+                Long id =  base.getId();
+                ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
+                ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
+                singleUnAudit(prodInOutDTO);
+            }catch (Exception e) {
+                errorMsg.append("编号:" + base.getCode() + "处理失败," + e.getMessage());
+            }
         }
+        return errorMsg.toString();
     }
 
     @Override
@@ -341,6 +349,17 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         }
     }
 
+
+    private void calcProdInout(Long pi_id, String pi_class) {
+        if ("采购验收单".equals(pi_class)) {
+            prodIODetailMapper.calcProdIn(pi_id,pi_class);
+        } else if ("采购验退单".equals(pi_class)) {
+            prodIODetailMapper.calcProdOut(pi_id,pi_class);
+        }
+    }
+
+
+
     private void updateYqty(ProdInOut prodInOut) {
         //更新已转数
         if ("采购验收单".equals(prodInOut.getPi_class())){

+ 11 - 9
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java

@@ -142,6 +142,8 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
                 purchasedetailMapper.batchInsert(insertDetails);
             }
             baseDTO = getBaseDTOById(pu_id);
+            //计算金额,未税单价,未税金额等
+            calcPurchase(pu_id);
             //日志记录
             messageLogService.save(baseDTO);
             return baseDTO;
@@ -171,6 +173,9 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
             purchasedetailMapper.batchUpdate(updateDetails);
         }
         baseDTO = getBaseDTOById(pu_id);
+
+        //计算金额,未税单价,未税金额等
+        calcPurchase(pu_id);
         //日志
         messageLogService.save(baseDTO);
         return baseDTO;
@@ -329,9 +334,6 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         //检查转单状态
         String acceptstatus = purchase.getPu_acceptstatuscode();
 
-        if ("TURNIN".equals(acceptstatus)){
-            return Result.error(ExceptionCode.TURNIN_EXIST);
-        }
         if ("CLOSED".equals(acceptstatus)){
             return Result.error(ExceptionCode.CLOSED_EXIST);
         }
@@ -401,16 +403,10 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
                 purchasedetailMapper.updateByPrimaryKeySelective(purchaseDetail);
             }
         }
-        //更新主表入库状态
-        purchase.setPu_acceptstatus("已入库");
-        purchase.setPu_acceptstatuscode("TURNIN");
-
         DocBaseDTO baseDTO = new DocBaseDTO();
         baseDTO.setId(pi_id);
         baseDTO.setCode(piInoutno);
         baseDTO.setName("采购验收单");
-        //更新存在字段
-        int affect = getMapper().updateByPrimaryKeySelective(purchase);
         return Result.success(baseDTO);
     }
 
@@ -505,4 +501,10 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         DocBaseDTO baseDTO = new DocBaseDTO(id, code, BillCodeSeq.PURCHASE.getCaller());
         return baseDTO;
     }
+
+    @Transactional
+    private void calcPurchase(Long pu_id) {
+        purchasedetailMapper.calcPurchase(pu_id);
+    }
+
 }

+ 21 - 5
applications/purchase/purchase-server/src/main/resources/mapper/ProdIODetailMapper.xml

@@ -721,11 +721,10 @@
   </update>
 
   <update id="updatePurchaseYqty" parameterType="java.lang.Integer">
-
-update prodiodetail a
-set a.pd_yqty =ifnull((select  b.pd_outqty  from  (select pd_ioid,sum(pd_outqty) pd_outqty from  prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='采购验退单'
-and pi_puid=#{id,jdbcType=INTEGER}  GROUP BY pd_ioid) b where ifnull(b.pd_ioid ,0)= a.pd_id ),0)
-where a.pd_piid = (select pi_id from prodinout where pi_puid=#{id,jdbcType=INTEGER} and pi_class='采购验收单')
+  update prodiodetail a
+  set a.pd_yqty =ifnull((select  b.pd_outqty  from  (select pd_ioid,sum(pd_outqty) pd_outqty from  prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='采购验退单'
+  and pi_puid=#{id,jdbcType=INTEGER}  GROUP BY pd_ioid) b where ifnull(b.pd_ioid ,0)= a.pd_id ),0)
+  where a.pd_piid = (select pi_id from prodinout where pi_puid=#{id,jdbcType=INTEGER} and pi_class='采购验收单')
   </update>
 
 
@@ -739,4 +738,21 @@ where a.pd_piid = (select pi_id from prodinout where pi_puid=#{id,jdbcType=INTEG
     where pd_piid = #{id,jdbcType=INTEGER}
   </delete>
 
+  <update id="calcProdIn">
+    update prodiodetail set pd_netprice = ifnull(pd_orderprice,0)/(1+ifnull(pd_taxrate,0)/100) where pd_piid = #{pi_id,jdbcType=INTEGER};
+    update prodiodetail set pd_total = ifnull(pd_orderprice,0)*ifnull(pd_inqty,0),pd_nettotal = pd_netprice*ifnull(pd_inqty,0) where pd_piid = #{pi_id,jdbcType=INTEGER};
+    update prodinout set pi_total = (select sum(pd_total) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ) where pi_id = #{pi_id,jdbcType=INTEGER};
+    update prodinout set pi_nettotal = (select sum(pd_nettotal) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ) where pi_id = #{pi_id,jdbcType=INTEGER};
+  </update>
+
+  <update id="calcProdOut">
+    update prodiodetail set pd_netprice = ifnull(pd_orderprice,0)/(1+ifnull(pd_taxrate,0)/100) where pd_piid = #{pi_id,jdbcType=INTEGER};
+    update prodiodetail set pd_total = ifnull(pd_orderprice,0)*ifnull(pd_outqty,0),pd_nettotal = pd_netprice*ifnull(pd_outqty,0) where pd_piid = #{pi_id,jdbcType=INTEGER};
+    update prodinout set pi_total = (select sum(pd_total) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ) where pi_id = #{pi_id,jdbcType=INTEGER};
+    update prodinout set pi_nettotal = (select sum(pd_nettotal) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ) where pi_id = #{pi_id,jdbcType=INTEGER};
+  </update>
+
+
+
+
 </mapper>

+ 3 - 61
applications/purchase/purchase-server/src/main/resources/mapper/PurchaseListMapper.xml

@@ -40,10 +40,11 @@
         <result column="PD_UNIT" property="pd_unit" jdbcType="VARCHAR" />
         <result column="PD_QTY" property="pd_qty" jdbcType="DOUBLE" />
         <result column="PD_PRICE" property="pd_price" jdbcType="DOUBLE" />
+        <result column="PD_TAXPRICE" property="pd_taxprice" jdbcType="DOUBLE" />
         <result column="PD_TOTAL" property="pd_total" jdbcType="DOUBLE" />
         <result column="PD_TAXTOTAL" property="pd_taxtotal" jdbcType="DOUBLE" />
         <result column="PD_ACCEPTQTY" property="pd_acceptqty" jdbcType="DOUBLE" />
-        <result column="PD_DELIVERY" property="pd_delivery" jdbcType="DOUBLE" />
+        <result column="PD_DELIVERY" property="pd_delivery" jdbcType="TIMESTAMP" />
         <result column="PD_SALECODE" property="pd_salecode" jdbcType="VARCHAR" />
         <result column="PD_SALEDETNO" property="pd_saledetno" jdbcType="INTEGER" />
         <result column="PD_SDID" property="pd_sdid" jdbcType="INTEGER" />
@@ -80,64 +81,5 @@
         </where>
         order by pu_id
     </select>
-    <insert id="batchInsert" parameterType="java.util.List" >
-        insert into purchasedetail ( PD_PUID, PD_CODE,
-        PD_DETNO, PD_PRODID, PD_PRODCODE,
-        PD_UNIT, PD_QTY, PD_PRICE,
-        PD_TOTAL, PD_TAXTOTAL, PD_ACCEPTQTY,
-        PD_DELIVERY, PD_SALECODE, PD_SALEDETNO,
-        PD_SDID, companyId, updaterId,
-        updateTime, pd_text1, pd_text2,
-        pd_text3, pd_text4, pd_text5,
-        pd_yqty)
-        values
-        <foreach collection="list" item="item" index="index" open="" close="" separator=",">
-            (
-            #{item.pdPuid,jdbcType=INTEGER}, #{item.pdCode,jdbcType=VARCHAR},
-            #{item.pdDetno,jdbcType=INTEGER}, #{item.pdProdid,jdbcType=INTEGER}, #{item.pdProdcode,jdbcType=VARCHAR},
-            #{item.pdUnit,jdbcType=VARCHAR}, #{item.pdQty,jdbcType=DOUBLE}, #{item.pdPrice,jdbcType=DOUBLE},
-            #{item.pdTotal,jdbcType=DOUBLE}, #{item.pdTaxtotal,jdbcType=DOUBLE}, #{item.pdAcceptqty,jdbcType=DOUBLE},
-            #{item.pdDelivery,jdbcType=DOUBLE}, #{item.pdSalecode,jdbcType=VARCHAR}, #{item.pdSaledetno,jdbcType=INTEGER},
-            #{item.pdSdid,jdbcType=INTEGER}, #{item.companyId,jdbcType=INTEGER}, #{item.updaterId,jdbcType=INTEGER},
-            #{item.updateTime,jdbcType=TIMESTAMP}, #{item.pdText1,jdbcType=VARCHAR}, #{item.pdText2,jdbcType=VARCHAR},
-            #{item.pdText3,jdbcType=VARCHAR}, #{item.pdText4,jdbcType=VARCHAR}, #{item.pdText5,jdbcType=VARCHAR},
-            #{item.pdYqty,jdbcType=DOUBLE}
-            )
-        </foreach>
-    </insert>
-    <update id="batchUpdate" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail" >
-        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
-            update purchasedetail <set>
-            PD_PUID = #{item.pdPuid},
-            PD_CODE = #{item.pdCode},
-            PD_DETNO = #{item.pdDetno},
-            PD_PRODID = #{item.pdProdid},
-            PD_PRODCODE = #{item.pdProdcode},
-            PD_UNIT = #{item.pdUnit},
-            PD_QTY = #{item.pdQty},
-            PD_PRICE = #{item.pdPrice},
-            PD_TOTAL = #{item.pdTotal},
-            PD_TAXTOTAL = #{item.pdTaxtotal},
-            PD_ACCEPTQTY = #{item.pdAcceptqty},
-            PD_DELIVERY = #{item.pdDelivery},
-            PD_SALECODE = #{item.pdSalecode},
-            PD_SALEDETNO = #{item.pdSaledetno},
-            PD_SDID = #{item.pdSdid},
-            companyId = #{item.companyId},
-            updaterId = #{item.updaterId},
-            updateTime = #{item.updateTime},
-            pd_text1 = #{item.pdText1},
-            pd_text2 = #{item.pdText2},
-            pd_text3 = #{item.pdText3},
-            pd_text4 = #{item.pdText4},
-            pd_text5 = #{item.pdText5},
-            pd_yqty = #{item.pdYqty}
-        </set>
-            where PD_ID = #{item.id,jdbcType=INTEGER}
-        </foreach>
-    </update>
-    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
-        delete from purchasedetail
-        where PD_ID = #{id}
-    </delete>
+
 </mapper>

+ 119 - 134
applications/purchase/purchase-server/src/main/resources/mapper/PurchasedetailMapper.xml

@@ -11,11 +11,12 @@
     <result column="PD_UNIT" property="pd_unit" jdbcType="VARCHAR" />
     <result column="PD_QTY" property="pd_qty" jdbcType="DOUBLE" />
     <result column="PD_PRICE" property="pd_price" jdbcType="DOUBLE" />
+    <result column="PD_TAXPRICE" property="pd_taxprice" jdbcType="DOUBLE" />
     <result column="PD_TOTAL" property="pd_total" jdbcType="DOUBLE" />
     <result column="PD_TAXRATE" property="pd_taxrate" jdbcType="DOUBLE" />
     <result column="PD_TAXTOTAL" property="pd_taxtotal" jdbcType="DOUBLE" />
     <result column="PD_ACCEPTQTY" property="pd_acceptqty" jdbcType="DOUBLE" />
-    <result column="PD_DELIVERY" property="pd_delivery" jdbcType="DOUBLE" />
+    <result column="PD_DELIVERY" property="pd_delivery" jdbcType="TIMESTAMP" />
     <result column="PD_SALECODE" property="pd_salecode" jdbcType="VARCHAR" />
     <result column="PD_SALEDETNO" property="pd_saledetno" jdbcType="INTEGER" />
     <result column="PD_SDID" property="pd_sdid" jdbcType="INTEGER" />
@@ -60,7 +61,7 @@
     </association>
   </resultMap>
   <sql id="Base_Column_List" >
-    PD_ID, PD_PUID, PD_CODE, PD_DETNO, PD_PRODID, PD_PRODCODE, PD_UNIT, PD_QTY, PD_PRICE,
+    PD_ID, PD_PUID, PD_CODE, PD_DETNO, PD_PRODID, PD_PRODCODE, PD_UNIT, PD_QTY, PD_PRICE,PD_TAXPRICE,
     PD_TOTAL, PD_TAXRATE,PD_TAXTOTAL, PD_ACCEPTQTY, PD_DELIVERY, PD_SALECODE, PD_SALEDETNO, PD_SDID,
     companyId, updaterId, updateTime, pd_text1, pd_text2, pd_text3, pd_text4, pd_text5,
     pd_yqty
@@ -75,183 +76,180 @@
     delete from purchasedetail
     where PD_ID = #{id}
   </delete>
-  <insert id="insert" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail" >
-    insert into purchasedetail (PD_PUID, PD_CODE,
-    PD_DETNO, PD_PRODID, PD_PRODCODE,
-    PD_UNIT, PD_QTY, PD_PRICE,
-    PD_TOTAL, PD_TAXTOTAL, PD_ACCEPTQTY,
-    PD_DELIVERY, PD_SALECODE, PD_SALEDETNO,
-    PD_SDID, companyId, updaterId,
-    updateTime, pd_text1, pd_text2,
-    pd_text3, pd_text4, pd_text5,
-    pd_yqty)
-    values (#{pdPuid,jdbcType=INTEGER}, #{pdCode,jdbcType=VARCHAR},
-    #{pdDetno,jdbcType=INTEGER}, #{pdProdid,jdbcType=INTEGER}, #{pdProdcode,jdbcType=VARCHAR},
-    #{pdUnit,jdbcType=VARCHAR}, #{pdQty,jdbcType=DOUBLE}, #{pdPrice,jdbcType=DOUBLE},
-    #{pdTotal,jdbcType=DOUBLE}, #{pdTaxtotal,jdbcType=DOUBLE}, #{pdAcceptqty,jdbcType=DOUBLE},
-    #{pdDelivery,jdbcType=DOUBLE}, #{pdSalecode,jdbcType=VARCHAR}, #{pdSaledetno,jdbcType=INTEGER},
-    #{pdSdid,jdbcType=INTEGER}, #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER},
-    #{updateTime,jdbcType=TIMESTAMP}, #{pdText1,jdbcType=VARCHAR}, #{pdText2,jdbcType=VARCHAR},
-    #{pdText3,jdbcType=VARCHAR}, #{pdText4,jdbcType=VARCHAR}, #{pdText5,jdbcType=VARCHAR},
-    #{pdYqty,jdbcType=DOUBLE})
-  </insert>
-  <insert id="insertSelective" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail" >
+
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail">
+    <selectKey resultType="java.lang.Long" keyProperty="id">
+      SELECT LAST_INSERT_ID() AS ID
+    </selectKey>
     insert into purchasedetail
-    <trim prefix="(" suffix=")" suffixOverrides="," >
-      <if test="pdPuid != null" >
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="PD_ID != null">
+        PD_ID,
+      </if>
+      <if test="PD_PUID != null">
         PD_PUID,
       </if>
-      <if test="pdCode != null" >
+      <if test="PD_CODE != null">
         PD_CODE,
       </if>
-      <if test="pdDetno != null" >
+      <if test="PD_DETNO != null">
         PD_DETNO,
       </if>
-      <if test="pdProdid != null" >
+      <if test="PD_PRODID != null">
         PD_PRODID,
       </if>
-      <if test="pdProdcode != null" >
+      <if test="PD_PRODCODE != null">
         PD_PRODCODE,
       </if>
-      <if test="pdUnit != null" >
+      <if test="PD_UNIT != null">
         PD_UNIT,
       </if>
-      <if test="pdQty != null" >
+      <if test="PD_QTY != null">
         PD_QTY,
       </if>
-      <if test="pdPrice != null" >
+      <if test="PD_YQTY != null">
+        PD_YQTY,
+      </if>
+      <if test="PD_PRICE != null">
         PD_PRICE,
       </if>
-      <if test="pdTotal != null" >
+      <if test="PD_TAXPRICE != null">
+        PD_TAXPRICE,
+      </if>
+      <if test="PD_TOTAL != null">
         PD_TOTAL,
       </if>
-      <if test="PD_TAXRATE != null" >
+      <if test="PD_TAXRATE != null">
         PD_TAXRATE,
       </if>
-      <if test="pdTaxtotal != null" >
+      <if test="PD_TAXTOTAL != null">
         PD_TAXTOTAL,
       </if>
-      <if test="pdAcceptqty != null" >
+      <if test="PD_ACCEPTQTY != null">
         PD_ACCEPTQTY,
       </if>
-      <if test="pdDelivery != null" >
+      <if test="PD_DELIVERY != null">
         PD_DELIVERY,
       </if>
-      <if test="pdSalecode != null" >
+      <if test="PD_SALECODE != null">
         PD_SALECODE,
       </if>
-      <if test="pdSaledetno != null" >
+      <if test="PD_SALEDETNO != null">
         PD_SALEDETNO,
       </if>
-      <if test="pdSdid != null" >
+      <if test="PD_SDID != null">
         PD_SDID,
       </if>
-      <if test="companyId != null" >
+      <if test="companyId != null">
         companyId,
       </if>
-      <if test="updaterId != null" >
+      <if test="updaterId != null">
         updaterId,
       </if>
-      <if test="updateTime != null" >
+      <if test="updateTime != null">
         updateTime,
       </if>
-      <if test="pdText1 != null" >
+      <if test="pd_text1 != null">
         pd_text1,
       </if>
-      <if test="pdText2 != null" >
+      <if test="pd_text2 != null">
         pd_text2,
       </if>
-      <if test="pdText3 != null" >
+      <if test="pd_text3 != null">
         pd_text3,
       </if>
-      <if test="pdText4 != null" >
+      <if test="pd_text4 != null">
         pd_text4,
       </if>
-      <if test="pdText5 != null" >
+      <if test="pd_text5 != null">
         pd_text5,
       </if>
-      <if test="pdYqty != null" >
-        pd_yqty,
-      </if>
     </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides="," >
-      <if test="pdPuid != null" >
-        #{pdPuid,jdbcType=INTEGER},
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+
+      <if test="PD_PUID != null">
+        #{PD_PUID,jdbcType=INTEGER},
+      </if>
+      <if test="PD_CODE != null">
+        #{PD_CODE,jdbcType=VARCHAR},
       </if>
-      <if test="pdCode != null" >
-        #{pdCode,jdbcType=VARCHAR},
+      <if test="PD_DETNO != null">
+        #{PD_DETNO,jdbcType=INTEGER},
       </if>
-      <if test="pdDetno != null" >
-        #{pdDetno,jdbcType=INTEGER},
+      <if test="PD_PRODID != null">
+        #{PD_PRODID,jdbcType=INTEGER},
       </if>
-      <if test="pdProdid != null" >
-        #{pdProdid,jdbcType=INTEGER},
+      <if test="PD_PRODCODE != null">
+        #{PD_PRODCODE,jdbcType=VARCHAR},
       </if>
-      <if test="pdProdcode != null" >
-        #{pdProdcode,jdbcType=VARCHAR},
+      <if test="PD_UNIT != null">
+        #{PD_UNIT,jdbcType=VARCHAR},
       </if>
-      <if test="pdUnit != null" >
-        #{pdUnit,jdbcType=VARCHAR},
+      <if test="PD_QTY != null">
+        #{PD_QTY,jdbcType=INTEGER},
       </if>
-      <if test="pdQty != null" >
-        #{pdQty,jdbcType=DOUBLE},
+      <if test="PD_YQTY != null">
+        #{PD_YQTY,jdbcType=INTEGER},
       </if>
-      <if test="pdPrice != null" >
-        #{pdPrice,jdbcType=DOUBLE},
+      <if test="PD_PRICE != null">
+        #{PD_PRICE,jdbcType=DOUBLE},
       </if>
-      <if test="pdTotal != null" >
-        #{pdTotal,jdbcType=DOUBLE},
+      <if test="PD_TAXPRICE != null">
+        #{PD_TAXPRICE,jdbcType=DOUBLE},
       </if>
-      <if test="PD_TAXRATE != null" >
+      <if test="PD_TOTAL != null">
+        #{PD_TOTAL,jdbcType=DOUBLE},
+      </if>
+      <if test="PD_TAXRATE != null">
         #{PD_TAXRATE,jdbcType=DOUBLE},
       </if>
-      <if test="pdTaxtotal != null" >
-        #{pdTaxtotal,jdbcType=DOUBLE},
+      <if test="PD_TAXTOTAL != null">
+        #{PD_TAXTOTAL,jdbcType=DOUBLE},
       </if>
-      <if test="pdAcceptqty != null" >
-        #{pdAcceptqty,jdbcType=DOUBLE},
+      <if test="PD_ACCEPTQTY != null">
+        #{PD_ACCEPTQTY,jdbcType=DOUBLE},
       </if>
-      <if test="pdDelivery != null" >
-        #{pdDelivery,jdbcType=DOUBLE},
+      <if test="PD_DELIVERY != null">
+        #{PD_DELIVERY,jdbcType=TIMESTAMP},
       </if>
-      <if test="pdSalecode != null" >
-        #{pdSalecode,jdbcType=VARCHAR},
+      <if test="PD_SALECODE != null">
+        #{PD_SALECODE,jdbcType=VARCHAR},
       </if>
-      <if test="pdSaledetno != null" >
-        #{pdSaledetno,jdbcType=INTEGER},
+      <if test="PD_SALEDETNO != null">
+        #{PD_SALEDETNO,jdbcType=INTEGER},
       </if>
-      <if test="pdSdid != null" >
-        #{pdSdid,jdbcType=INTEGER},
+      <if test="PD_SDID != null">
+        #{PD_SDID,jdbcType=INTEGER},
       </if>
-      <if test="companyId != null" >
+      <if test="companyId != null">
         #{companyId,jdbcType=INTEGER},
       </if>
-      <if test="updaterId != null" >
+      <if test="updaterId != null">
         #{updaterId,jdbcType=INTEGER},
       </if>
-      <if test="updateTime != null" >
+      <if test="updateTime != null">
         #{updateTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="pdText1 != null" >
-        #{pdText1,jdbcType=VARCHAR},
-      </if>
-      <if test="pdText2 != null" >
-        #{pdText2,jdbcType=VARCHAR},
+      <if test="pd_text1 != null">
+        #{pd_text1,jdbcType=VARCHAR},
       </if>
-      <if test="pdText3 != null" >
-        #{pdText3,jdbcType=VARCHAR},
+      <if test="pd_text2 != null">
+        #{pd_text2,jdbcType=VARCHAR},
       </if>
-      <if test="pdText4 != null" >
-        #{pdText4,jdbcType=VARCHAR},
+      <if test="pd_text3 != null">
+        #{pd_text3,jdbcType=VARCHAR},
       </if>
-      <if test="pdText5 != null" >
-        #{pdText5,jdbcType=VARCHAR},
+      <if test="pd_text4 != null">
+        #{pd_text4,jdbcType=VARCHAR},
       </if>
-      <if test="pdYqty != null" >
-        #{pdYqty,jdbcType=DOUBLE},
+      <if test="pd_text5 != null">
+        #{pd_text5,jdbcType=VARCHAR},
       </if>
     </trim>
   </insert>
+
+
+
   <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail" >
     update purchasedetail
     <set >
@@ -334,38 +332,11 @@
     </set>
     where PD_ID = #{id,jdbcType=INTEGER}
   </update>
-  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail" >
-    update purchasedetail
-    set PD_PUID = #{pdPuid,jdbcType=INTEGER},
-    PD_CODE = #{pdCode,jdbcType=VARCHAR},
-    PD_DETNO = #{pdDetno,jdbcType=INTEGER},
-    PD_PRODID = #{pdProdid,jdbcType=INTEGER},
-    PD_PRODCODE = #{pdProdcode,jdbcType=VARCHAR},
-    PD_UNIT = #{pdUnit,jdbcType=VARCHAR},
-    PD_QTY = #{pdQty,jdbcType=DOUBLE},
-    PD_PRICE = #{pdPrice,jdbcType=DOUBLE},
-    PD_TOTAL = #{pdTotal,jdbcType=DOUBLE},
-    PD_TAXTOTAL = #{pdTaxtotal,jdbcType=DOUBLE},
-    PD_ACCEPTQTY = #{pdAcceptqty,jdbcType=DOUBLE},
-    PD_DELIVERY = #{pdDelivery,jdbcType=DOUBLE},
-    PD_SALECODE = #{pdSalecode,jdbcType=VARCHAR},
-    PD_SALEDETNO = #{pdSaledetno,jdbcType=INTEGER},
-    PD_SDID = #{pdSdid,jdbcType=INTEGER},
-    companyId = #{companyId,jdbcType=INTEGER},
-    updaterId = #{updaterId,jdbcType=INTEGER},
-    updateTime = #{updateTime,jdbcType=TIMESTAMP},
-    pd_text1 = #{pdText1,jdbcType=VARCHAR},
-    pd_text2 = #{pdText2,jdbcType=VARCHAR},
-    pd_text3 = #{pdText3,jdbcType=VARCHAR},
-    pd_text4 = #{pdText4,jdbcType=VARCHAR},
-    pd_text5 = #{pdText5,jdbcType=VARCHAR},
-    pd_yqty = #{pdYqty,jdbcType=DOUBLE}
-    where PD_ID = #{id,jdbcType=INTEGER}
-  </update>
+
   <insert id="batchInsert" parameterType="java.util.List" >
     insert into purchasedetail ( PD_PUID, PD_CODE,
     PD_DETNO, PD_PRODID, PD_PRODCODE,
-    PD_UNIT, PD_QTY, PD_PRICE,
+    PD_UNIT, PD_QTY, PD_PRICE,PD_TAXPRICE,
     PD_TOTAL,PD_TAXRATE, PD_TAXTOTAL, PD_ACCEPTQTY,
     PD_DELIVERY, PD_SALECODE, PD_SALEDETNO,
     PD_SDID, companyId, updaterId,
@@ -377,7 +348,7 @@
       (
       #{item.pd_puid,jdbcType=INTEGER}, #{item.pd_code,jdbcType=VARCHAR},
       #{item.pd_detno,jdbcType=INTEGER}, #{item.pd_prodid,jdbcType=INTEGER}, #{item.pd_prodcode,jdbcType=VARCHAR},
-      #{item.pd_unit,jdbcType=VARCHAR}, #{item.pd_qty,jdbcType=DOUBLE}, #{item.pd_price,jdbcType=DOUBLE},
+      #{item.pd_unit,jdbcType=VARCHAR}, #{item.pd_qty,jdbcType=DOUBLE}, #{item.pd_price,jdbcType=DOUBLE},#{item.pd_taxprice,jdbcType=DOUBLE},
       #{item.pd_total,jdbcType=DOUBLE},#{item.pd_taxrate,jdbcType=DOUBLE}, #{item.pd_taxtotal,jdbcType=DOUBLE}, #{item.pd_acceptqty,jdbcType=DOUBLE},
       #{item.pd_delivery,jdbcType=DOUBLE}, #{item.pd_salecode,jdbcType=VARCHAR}, #{item.pd_saledetno,jdbcType=INTEGER},
       #{item.pd_sdid,jdbcType=INTEGER}, #{item.companyId,jdbcType=INTEGER}, #{item.updaterId,jdbcType=INTEGER},
@@ -398,6 +369,7 @@
       PD_UNIT = #{item.pd_unit},
       PD_QTY = #{item.pd_qty},
       PD_PRICE = #{item.pd_price},
+      PD_TAXPRICE = #{item.pd_taxprice},
       PD_TOTAL = #{item.pd_total},
       PD_TAXRATE = #{item.pd_taxrate},
       PD_TAXTOTAL = #{item.pd_taxtotal},
@@ -428,12 +400,25 @@
   </select>
 
   <update id="updatePurchaseYqty" parameterType="integer" >
-update purchasedetail
-set pd_yqty=ifnull((select sum(IFNULL(pd_inqty,0)-IFNULL(pd_outqty,0))
-from prodiodetail
-where ((pd_piclass='采购验退单'  and pd_status=99 ) or pd_piclass='采购验收单') and IFNULL(pd_orderid,0)=purchasedetail.pd_id),0)
-where pd_puid=#{pu_id}
+    update purchasedetail
+    set pd_yqty=ifnull((select sum(IFNULL(pd_inqty,0)-IFNULL(pd_outqty,0))
+    from prodiodetail
+    where ((pd_piclass='采购验退单'  and pd_status=99 ) or pd_piclass='采购验收单') and IFNULL(pd_orderid,0)=purchasedetail.pd_id),0)
+    where pd_puid=#{pu_id}
   </update>
 
 
+  <update id="calcPurchase" parameterType="long" >
+    update purchasedetail set pd_taxprice = ifnull(PD_PRICE,0)/(1+ifnull(pd_taxrate,0)/100) where pd_puid = #{pu_id,jdbcType=INTEGER};
+    update purchasedetail set pd_total = ifnull(PD_PRICE,0)*ifnull(pd_qty,0),pd_taxtotal = pd_taxprice*ifnull(pd_qty,0) where pd_puid = #{pu_id,jdbcType=INTEGER};
+    update purchase set pu_total = (select sum(pd_total) from purchasedetail where pd_puid = #{pi_id,jdbcType=INTEGER} ) where pu_id = #{pu_id,jdbcType=INTEGER};
+    update purchase set PU_TAXTOTAL = (select sum(pd_taxtotal) from purchasedetail where pd_puid = #{pi_id,jdbcType=INTEGER} ) where pu_id = #{pu_id,jdbcType=INTEGER};
+  </update>
+
+
+
+
+
+
+
 </mapper>

+ 1 - 1
applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdIODetailDTO.java

@@ -88,6 +88,6 @@ public class ProdIODetailDTO implements Serializable {
 
     private Long pd_ioid;
 
-    private ProductDTO product;
+    private ProductDTO productDTO;
 
 }

+ 2 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/config/WebConfig.java

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.sale.config;
 
+import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -31,6 +32,7 @@ public class WebConfig extends WebMvcConfigurationSupport{
     public MappingJackson2HttpMessageConverter MappingJacksonHttpMessageConverter(){
         MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
         ObjectMapper objectMapper = new ObjectMapper();
+        objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
         objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
         converter.setObjectMapper(objectMapper);
         return converter;

+ 2 - 2
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/ProdInOutController.java

@@ -149,8 +149,8 @@ public class ProdInOutController {
 
     @PostMapping("/turnProdIn/{id}")
     public Result turnProdin(@PathVariable("id") Long id){
-        prodInOutService.turnProdin(id);
-        return Result.success();
+        DocBaseDTO baseDTO  = prodInOutService.turnProdin(id);
+        return Result.success(baseDTO);
     };
 
     @PostMapping("/close/{id}")

+ 25 - 1
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/SaleController.java

@@ -159,10 +159,34 @@ public class SaleController {
 
     @PostMapping("/turnProdOut/{id}")
     public Result turnOut(@PathVariable("id") Long id) {
-        saleService.turnOut(id);
+        DocBaseDTO baseDTO = saleService.turnOut(id);
+        return Result.success(baseDTO);
+    }
+
+    /**
+     * 出入库单批量关闭
+     *
+     * @param baseDTOs
+     * @return
+     */
+    @PostMapping("/batchClose")
+    public Result batchClose(@RequestBody BatchDealBaseDTO baseDTOs) {
+        saleService.batchClose(baseDTOs);
         return Result.success();
     }
 
+    /**
+     * 出入库单批量开启
+     *
+     * @param baseDTOs
+     * @return
+     */
+    @PostMapping("/batchOpen")
+    public Result batchOpen(@RequestBody BatchDealBaseDTO baseDTOs) {
+       saleService.batchOpen(baseDTOs);
+       return Result.success();
+    }
+
     @GetMapping("/test")
     public String test() {
         return "配置构建success-1";

+ 1 - 1
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/ProdInOutService.java

@@ -118,5 +118,5 @@ public interface ProdInOutService extends CommonBaseService<ProdInOutMapper, Pro
      * 出库单转退货单
      * @param id
      */
-    Result turnProdin(Long id);
+    DocBaseDTO turnProdin(Long id);
 }

+ 5 - 1
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/SaleService.java

@@ -39,5 +39,9 @@ public interface SaleService {
 
     void open(long id);
 
-    void turnOut(Long id);
+    DocBaseDTO turnOut(Long id);
+
+    void batchClose(BatchDealBaseDTO baseDTOs);
+
+    void batchOpen(BatchDealBaseDTO baseDTOs);
 }

+ 16 - 5
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/ProdInOutServiceImpl.java

@@ -126,6 +126,10 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             if (insertDetails.size()>0) {
                 prodIODetailMapper.batchInsert(insertDetails);
             }
+
+            ProdInOut prodInOutNow = checkAndReturnOrder(pi_id);
+            //更新明细金额等
+            setTotal(prodInOutNow);
             baseDTO = getBaseDTOById(pi_id,pi_class,pi_inoutno);
             //日志记录
             messageLogService.save(baseDTO);
@@ -139,6 +143,9 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             detail.setPd_piid(pi_id);
             detail.setPd_inoutno(pi_inoutno);
             detail.setPd_piclass(prodInOut.getPi_class());
+            detail.setCompanyId(companyId);
+            detail.setCreateTime(new Date());
+            detail.setPd_yqty(0.0);
             if (StringUtils.isEmpty(detail.getId()) || "0".equals(detail.getId().toString())) {
                 insertDetails.add(detail);
             } else {
@@ -363,7 +370,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
     }
 
     @Override
-    public Result turnProdin(Long id) {
+    public DocBaseDTO turnProdin(Long id) {
         Integer count=0;
         double pdOutqty=0;
         double pdYqty=0;
@@ -389,7 +396,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         }
         //判断可转数
         if (count==0) {
-            return Result.error(ExceptionCode.TURNINNUM_NOT_EXIST);
+            throw  new BizException(ExceptionCode.TURNINNUM_NOT_EXIST);
         }
         //插入销售退货单主表
         ProdInOut targetPi = new ProdInOut();
@@ -455,7 +462,11 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
                 prodIODetailMapper.updateByPrimaryKeySelective(sourcePid);
             }
         }
-        return Result.success();
+
+        //日志记录
+        DocBaseDTO baseDTO = new DocBaseDTO(pi_id, piInoutno, BillCodeSeq.SALEIN.getCaller());
+        //messageLogService.customizeLog(baseDTO, Operation.);
+        return baseDTO;
 
     }
 
@@ -548,7 +559,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         Integer count = "0".equals(String.valueOf(id)) ? prodInOutMapper.validateCodeWhenInsert(code,pi_class) :
                 prodInOutMapper.validateCodeWhenUpdate(code, id);
         String caller ="";
-        if(pi_class.equals("销售出货单")){
+        if(pi_class.equals("出货单")){
             caller = BillCodeSeq.SALEOUT.getCaller();
         }else {//销售退货单
             caller = BillCodeSeq.SALEIN.getCaller();
@@ -580,7 +591,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
     private void setTotal(ProdInOut prodInOut ) {
         String pi_class = prodInOut.getPi_class();
         Long id = prodInOut.getId();
-        if(BillCodeSeq.SALEOUT.getName().equals(pi_class)){//销售出货单
+        if(BillCodeSeq.SALEOUT.getName().equals(pi_class)){//出货单
             //更新明细
             prodIODetailMapper.updatePDSaleOut(id);
             //更新主表

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

@@ -9,6 +9,7 @@ import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.commons.exception.BizExceptionCode;
 import com.usoftchina.saas.commons.po.BillCodeSeq;
+import com.usoftchina.saas.commons.po.Operation;
 import com.usoftchina.saas.commons.po.Status;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.exception.BizException;
@@ -116,6 +117,8 @@ public class SaleServiceImpl implements SaleService{
         sale.setCreateTime(new Date());
         sale.setSa_recorderid(userId);
         sale.setSa_recorder("test");
+        sale.setSa_sendstatus(Status.UNTURNOUT.getDisplay());
+        sale.setSa_sendstatuscode(Status.UNTURNOUT.name());
 
         //编号校验
         sa_code = pushMaxnubmer(sa_code, sa_id);
@@ -132,6 +135,7 @@ public class SaleServiceImpl implements SaleService{
                 detail.setSd_said(sa_id);
                 detail.setSd_code(sa_code);
                 detail.setSd_yqty(0.0);
+                detail.setCompanyId(companyId);
                 insertDetails.add(detail);
             }
             //插入从表
@@ -383,7 +387,7 @@ public class SaleServiceImpl implements SaleService{
 
     @Override
     @Transactional
-    public void turnOut(Long id) {
+    public DocBaseDTO turnOut(Long id) {
         Integer count = 0;
         double pdQty = 0;
         double pdYqty = 0;
@@ -453,6 +457,7 @@ public class SaleServiceImpl implements SaleService{
             prodIODetail.setPd_sdid(saleDetail.getId());
             prodIODetail.setPd_prodid(saleDetail.getSd_prodid());
             prodIODetail.setPd_prodcode(saleDetail.getSd_prodcode());
+            prodIODetail.setPd_taxrate(saleDetail.getSd_taxrate());
             //公司id
             prodIODetail.setCompanyId(companyId);
             //本次转单数
@@ -468,6 +473,37 @@ public class SaleServiceImpl implements SaleService{
         sale.setSa_sendstatuscode(Status.TURNOUT.name());
         //更新存在字段
          saleMapper.updateByPrimaryKeySelective(sale);
+         //日志记录
+         DocBaseDTO baseDTO = new DocBaseDTO(pi_id, pi_inoutno, BillCodeSeq.SALEOUT.getCaller());
+         //messageLogService.customizeLog(baseDTO, Operation.);
+         return baseDTO;
+    }
+
+    @Override
+    public void batchClose(BatchDealBaseDTO baseDTOs) {
+        if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
+                baseDTOs.getBaseDTOs().size() == 0) {
+            return;
+        }
+        for (DocBaseDTO baseDTO : baseDTOs.getBaseDTOs()) {
+            if (!StringUtils.isEmpty(baseDTO.getId())) {
+                close(baseDTO.getId());
+            }
+        }
+    }
+
+    @Override
+    public void batchOpen(BatchDealBaseDTO baseDTOs) {
+        if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
+                baseDTOs.getBaseDTOs().size() == 0) {
+            return;
+        }
+        for (DocBaseDTO baseDTO : baseDTOs.getBaseDTOs()) {
+            if (!StringUtils.isEmpty(baseDTO.getId())) {
+                open(baseDTO.getId());
+            }
+        }
+
     }
 
     //更新最新销售总额

+ 8 - 8
applications/sale/sale-server/src/main/resources/mapper/ProdIODetailMapper.xml

@@ -746,13 +746,13 @@ update prodiodetail a
           and pd_piid=#{id}  GROUP BY pd_ioid ) b
           where IFNULL(b.pd_ioid ,0)= a.pd_id
      ),0)
-where a.pd_id in (select pd_ioid from prodiodetail where pd_piid=#{id} and pi_class='销售出货单')
+where a.pd_id in (select pd_ioid from prodiodetail where pd_piid=#{id} and pd_piclass='出货单')
   </update>
   <update id="updateSaleYqty" parameterType="long">
 
     update saledetail a set a.sd_yqty =IFNULL( ( select b.pd_outqty from (
     select pd_sdid,sum(pd_outqty) pd_outqty from prodiodetail left join
-    prodinout on pd_piid = pi_id where pd_piclass='销售出货单' and pi_said=#{id}
+    prodinout on pd_piid = pi_id where pd_piclass='出货单' and pi_said=#{id}
     GROUP BY pd_sdid) b where IFNULL(b.pd_sdid ,0) = a.sd_id ),0) where a.sd_said =#{id}
   </update>
 
@@ -763,16 +763,16 @@ where a.pd_id in (select pd_ioid from prodiodetail where pd_piid=#{id} and pi_cl
 
   <update id="updatePDSaleIN" parameterType="long">
    update prodiodetail set
-   pd_total=IFNULL(pd_inqty,0)*IFNULL(pd_sendprice,0),
-   pd_netprice = IFNULL(pd_sendprice,0)/(1+IFNULL(pd_taxrate,0)/100),
-   pd_nettotal = (IFNULL(pd_sendprice,0)/(1+IFNULL(pd_taxrate,0)/100))*IFNULL(pd_inqty,0)
+   pd_total=round(IFNULL(pd_inqty,0)*IFNULL(pd_sendprice,0),2),
+   pd_netprice = round(IFNULL(pd_sendprice,0)/(1+IFNULL(pd_taxrate,0)/100),2),
+   pd_nettotal = round((IFNULL(pd_sendprice,0)/(1+IFNULL(pd_taxrate,0)/100))*IFNULL(pd_inqty,0),2)
    where pd_piid=#{id}
   </update>
   <update id="updatePDSaleOut" parameterType="long">
     update prodiodetail set
-    pd_total=IFNULL(pd_outqty,0)*IFNULL(pd_sendprice,0),
-    pd_netprice = IFNULL(pd_sendprice,0)/(1+IFNULL(pd_taxrate,0)/100),
-    pd_nettotal = (IFNULL(pd_sendprice,0)/(1+IFNULL(pd_taxrate,0)/100))*IFNULL(pd_outqty,0)
+    pd_total=round(IFNULL(pd_outqty,0)*IFNULL(pd_sendprice,0),2),
+    pd_netprice = round(IFNULL(pd_sendprice,0)/(1+IFNULL(pd_taxrate,0)/100),0),
+    pd_nettotal = round((IFNULL(pd_sendprice,0)/(1+IFNULL(pd_taxrate,0)/100))*IFNULL(pd_outqty,0),0)
     where pd_piid=#{id}
   </update>
 </mapper>

+ 2 - 1
applications/sale/sale-server/src/main/resources/mapper/SaleListMapper.xml

@@ -51,7 +51,8 @@
     </resultMap>
 
     <select id="selectPurchaseListByCondition" resultMap="BaseResultMap">
-        select  *  from sale left join saledetail on sa_id=sd_said
+        select  *  from sale left join saledetail on sa_id=sd_said left join product
+        on sd_prodid = pr_id and sale.companyId = product.companyid
         <where>
             <if test="con != null">
                 ${con}

+ 2 - 0
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/config/WebConfig.java

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.storage.config;
 
+import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -31,6 +32,7 @@ public class WebConfig extends WebMvcConfigurationSupport{
     public MappingJackson2HttpMessageConverter MappingJacksonHttpMessageConverter(){
         MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
         ObjectMapper objectMapper = new ObjectMapper();
+        objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
         objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
         converter.setObjectMapper(objectMapper);
         return converter;

+ 5 - 4
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/controller/ProdInOutController.java

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
  * Created by zdw
  * 2018-10-17 11:41.
  */
+@CrossOrigin
 @RestController
 @RequestMapping("/prodinout")
 public class ProdInOutController {
@@ -130,8 +131,8 @@ public class ProdInOutController {
      */
     @PostMapping("/batchAudit")
     public Result batchAudit(@RequestBody BatchDealBaseDTO baseDTOs) {
-        prodInOutService.batchAudit(baseDTOs);
-        return Result.success();
+        String res = prodInOutService.batchAudit(baseDTOs);
+        return Result.success(res);
     }
 
     /**
@@ -142,8 +143,8 @@ public class ProdInOutController {
      */
     @PostMapping("/batchUnAudit")
     public Result batchUnAudit(@RequestBody BatchDealBaseDTO baseDTOs) {
-        prodInOutService.batchUnAudit(baseDTOs);
-        return Result.success();
+        String res = prodInOutService.batchUnAudit(baseDTOs);
+        return Result.success(res);
     }
 
     /**

+ 4 - 0
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/mapper/ProdIODetailMapper.java

@@ -30,4 +30,8 @@ public interface ProdIODetailMapper extends CommonBaseMapper<ProdIODetail> {
     List<ProdIODetail> selectByFK(Long id);
 
     void deleteByFK(Long id);
+
+    void calcProdIn(Long pi_id);
+
+    void calcProdOut(Long pi_id);
 }

+ 2 - 2
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/ProdInOutService.java

@@ -47,7 +47,7 @@ public interface ProdInOutService extends CommonBaseService<ProdInOutMapper, Pro
      */
     DocBaseDTO audit(ProdInOutFormDTO formData);
 
-    void batchAudit(BatchDealBaseDTO baseDTOs);
+    String batchAudit(BatchDealBaseDTO baseDTOs);
 
     /**
      * 反审核出入库单
@@ -55,7 +55,7 @@ public interface ProdInOutService extends CommonBaseService<ProdInOutMapper, Pro
      */
     void unAudit(Long id);
 
-    void batchUnAudit(BatchDealBaseDTO baseDTOs);
+    String batchUnAudit(BatchDealBaseDTO baseDTOs);
 
     void deleteItem(Long id);
 

+ 56 - 37
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/ProdInoutServiceImpl.java → applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/ProdInOutServiceImpl.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.storage.service.impl;
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
@@ -34,7 +35,7 @@ import org.springframework.util.StringUtils;
 import java.util.*;
 
 @Service
-public class ProdInoutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper, ProdInOut> implements ProdInOutService {
+public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper, ProdInOut> implements ProdInOutService {
 
     @Autowired
     private ProdIODetailMapper prodIODetailMapper;
@@ -75,7 +76,7 @@ public class ProdInoutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         if (null == con) {
             con = "1=1";
         }
-        if (null == req || StringUtils.isEmpty(req.getMode()) || "Main".equals(req.getMode())) {
+        if (null == req || StringUtils.isEmpty(req.getMode()) || "MAIN".equals(req.getMode())) {
             list = prodInOutListMapper.selectProdInOutListByCondition(con,companyId);
         } else {
             list = prodInOutListMapper.selectProdInOutBycondition(con,companyId);
@@ -155,6 +156,8 @@ public class ProdInoutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             }
 
             baseDTO = getBaseDTOById(pi_id,pi_class,pi_inoutno);
+            //计算金额,未税单价,未税金额等
+            calcProdInout(pi_id,pi_class);
             //日志记录
             messageLogService.save(baseDTO);
             return baseDTO;
@@ -185,10 +188,10 @@ public class ProdInoutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             prodIODetailMapper.batchUpdate(updateDetails);
         }
         baseDTO = getBaseDTOById(pi_id,pi_class,pi_inoutno);
-        //更新已转数
+        //计算金额,未税单价,未税金额等
+        calcProdInout(pi_id,pi_class);
         //日志记录
         messageLogService.update(baseDTO);
-
         return baseDTO;
     }
 
@@ -220,95 +223,101 @@ public class ProdInoutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         DocBaseDTO baseDTO = new DocBaseDTO();
         if (null != formData) {
             id = formData.getMain().getId();
-            if (StringUtils.isEmpty(id)) {
+            if (StringUtils.isEmpty(id)|| "0".equals(String.valueOf(id))) {
                 baseDTO = saveFormData(formData);
                 id = baseDTO.getId();
             }
-            String res = singleAudit(formData.getMain());
-            if(res!=null){
-                new BizException(501,res);
-            }
+            singleAudit(formData.getMain());
         }
         baseDTO.setId(id);
         return baseDTO;
     }
 
-    private String singleAudit(ProdInOutDTO prodInOutDTO) {
+    private void singleAudit(ProdInOutDTO prodInOutDTO) {
         String pi_class= prodInOutDTO.getPi_class();
         Map<String, Object> map = new HashMap<String, Object>();
         map.put("inoutNo",prodInOutDTO.getPi_inoutno() );
         map.put("class", pi_class);
         map.put("commitid",BaseContextHolder.getUserId());
-        map.put("companyid",BaseContextHolder.getCompanyId());
+        map.put("companyId",BaseContextHolder.getCompanyId());
         map.put("result","");
-        warehouseApi.post(map);
-        Object result =  map.get("result");
-        if(result!=null){
-            return result.toString();
+        Result res = warehouseApi.post(map);
+        Object result =  res.getData();
+        if(!StringUtils.isEmpty(result)){
+            throw new BizException(BizExceptionCode.SALEOUT_POST_ERROR.getCode(),result.toString());
         }else{
             //记录日志
             DocBaseDTO docBaseDTO = getBaseDTOById(prodInOutDTO.getId(),pi_class,prodInOutDTO.getPi_inoutno());
             //日志
             messageLogService.audit(docBaseDTO);
-            return "";
         }
     }
 
     @Override
-    public void batchAudit(BatchDealBaseDTO baseDTOs) {
+    public String  batchAudit(BatchDealBaseDTO baseDTOs) {
         if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
                 baseDTOs.getBaseDTOs().size() == 0) {
-            return;
+            return "没有可审核单据。";
         }
+        StringBuffer errorMsg = new StringBuffer();
         for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
-            Long id =  base.getId();
-            ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
-            ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
-            singleAudit(prodInOutDTO);
+            try {
+                Long id =  base.getId();
+                ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
+                ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
+                singleAudit(prodInOutDTO);
+            } catch (Exception e){
+                errorMsg.append("编号:" + base.getCode() + "处理失败," + e.getMessage());
+            }
         }
+        return errorMsg.toString();
     }
 
     @Override
     public void unAudit(Long id) {
         ProdInOut prodInOut =checkAndReturnOrder(id);
         ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut, ProdInOutDTO.class);
-        String res =  singleUnAudit(prodInOutDTO);
-
+        singleUnAudit(prodInOutDTO);
     }
 
-    private String singleUnAudit(ProdInOutDTO prodInOutDTO) {
+    private void singleUnAudit(ProdInOutDTO prodInOutDTO) {
         String pi_class= prodInOutDTO.getPi_class();
         Map<String, Object> map = new HashMap<String, Object>();
         map.put("inoutNo",prodInOutDTO.getPi_inoutno() );
         map.put("class", pi_class);
         map.put("commitid",BaseContextHolder.getUserId());
-        map.put("companyid",BaseContextHolder.getCompanyId());
+        map.put("companyId",BaseContextHolder.getCompanyId());
         map.put("result","");
-        warehouseApi.unPost(map);
-        Object result =  map.get("result");
-        if(result!=null){
-            return result.toString();
+        Result res = warehouseApi.unPost(map);
+        Object result =  res.getData();
+        if(!StringUtils.isEmpty(result)){
+            throw new BizException(BizExceptionCode.SALEOUT_POST_ERROR.getCode(),result.toString());
         }else{
             //记录日志
             DocBaseDTO docBaseDTO = getBaseDTOById(prodInOutDTO.getId(),pi_class,prodInOutDTO.getPi_inoutno());
             //日志
             messageLogService.unAudit(docBaseDTO);
-            return "";
         }
     }
 
     @Override
-    public void batchUnAudit(BatchDealBaseDTO baseDTOs) {
+    public String batchUnAudit(BatchDealBaseDTO baseDTOs) {
         if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
                 baseDTOs.getBaseDTOs().size() == 0) {
-            return;
+            return "无可反审核单据。";
         }
+        StringBuffer errorMsg = new StringBuffer();
         for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
-            Long id =  base.getId();
-            ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
-            ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
-            singleUnAudit(prodInOutDTO);
+            try {
+                Long id =  base.getId();
+                ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
+                ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
+                singleUnAudit(prodInOutDTO);
+            }catch (Exception e) {
+                errorMsg.append("编号:" + base.getCode() + "处理失败," + e.getMessage());
+            }
         }
+        return errorMsg.toString();
     }
 
     @Override
@@ -455,4 +464,14 @@ public class ProdInoutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         }
         return prodInOut;
     }
+
+    private void calcProdInout(Long pi_id, String pi_class) {
+        Integer id = pi_id.intValue();
+        if ("其它入库单".equals(pi_class)) {
+            prodIODetailMapper.calcProdIn(pi_id);
+        } else if ("其它出库单".equals(pi_class)) {
+            prodIODetailMapper.calcProdOut(pi_id);
+        }
+    }
+
 }

+ 1 - 1
applications/storage/storage-server/src/main/resources/application.yml

@@ -9,7 +9,7 @@ spring:
       password: select111***
   datasource:
     driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://192.168.253.12:3306/saas_biz?characterEncoding=utf-8&useSSL=false
+    url: jdbc:mysql://192.168.253.12:3306/saas_biz?characterEncoding=utf-8&useSSL=false&allowMultiQueries=true
     username: root
     password: select111***
     hikari:

+ 18 - 5
applications/storage/storage-server/src/main/resources/mapper/ProdIODetailMapper.xml

@@ -721,11 +721,10 @@
   </update>
 
   <update id="updatePurchaseYqty" parameterType="java.lang.Integer">
-
-update prodiodetail a
-set a.pd_yqty =ifnull((select  b.pd_outqty  from  (select pd_ioid,sum(pd_outqty) pd_outqty from  prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='采购验退单'
-and pi_puid=#{id,jdbcType=INTEGER}  GROUP BY pd_ioid) b where ifnull(b.pd_ioid ,0)= a.pd_id ),0)
-where a.pd_piid = (select pi_id from prodinout where pi_puid=#{id,jdbcType=INTEGER} and pi_class='采购验收单')
+  update prodiodetail a
+  set a.pd_yqty =ifnull((select  b.pd_outqty  from  (select pd_ioid,sum(pd_outqty) pd_outqty from  prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='采购验退单'
+  and pi_puid=#{id,jdbcType=INTEGER}  GROUP BY pd_ioid) b where ifnull(b.pd_ioid ,0)= a.pd_id ),0)
+  where a.pd_piid = (select pi_id from prodinout where pi_puid=#{id,jdbcType=INTEGER} and pi_class='采购验收单')
   </update>
 
 
@@ -739,4 +738,18 @@ where a.pd_piid = (select pi_id from prodinout where pi_puid=#{id,jdbcType=INTEG
     where pd_piid = #{id,jdbcType=INTEGER}
   </delete>
 
+  <update id="calcProdIn">
+    update prodiodetail set pd_netprice = ifnull(pd_orderprice,0)/(1+ifnull(pd_taxrate,0)/100) where pd_piid = #{pi_id,jdbcType=INTEGER};
+    update prodiodetail set pd_total = ifnull(pd_orderprice,0)*ifnull(pd_inqty,0),pd_nettotal = pd_netprice*ifnull(pd_inqty,0) where pd_piid = #{pi_id,jdbcType=INTEGER};
+    update prodinout set pi_total = (select sum(pd_total) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ) where pi_id = #{pi_id,jdbcType=INTEGER};
+    update prodinout set pi_nettotal = (select sum(pd_nettotal) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ) where pi_id = #{pi_id,jdbcType=INTEGER};
+  </update>
+
+  <update id="calcProdOut">
+    update prodiodetail set pd_netprice = ifnull(pd_orderprice,0)/(1+ifnull(pd_taxrate,0)/100) where pd_piid = #{pi_id,jdbcType=INTEGER};
+    update prodiodetail set pd_total = ifnull(pd_orderprice,0)*ifnull(pd_outqty,0),pd_nettotal = pd_netprice*ifnull(pd_outqty,0) where pd_piid = #{pi_id,jdbcType=INTEGER};
+    update prodinout set pi_total = (select sum(pd_total) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ) where pi_id = #{pi_id,jdbcType=INTEGER};
+    update prodinout set pi_nettotal = (select sum(pd_nettotal) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ) where pi_id = #{pi_id,jdbcType=INTEGER};
+  </update>
+
 </mapper>

+ 7 - 0
applications/storage/storage-server/src/test/com/usoftchina/saas/storage/mapper/ProdIODetailMapperTest.java

@@ -80,4 +80,11 @@ public class ProdIODetailMapperTest {
     public void selectByFK() throws Exception {
     }
 
+    @Test
+    public void calcProdIn() throws Exception {
+//        prodIODetailMapper.calcProdIn(486);
+
+    }
+
+
 }

+ 13 - 14
base-servers/auth/auth-dto/src/main/java/com/usoftchina/saas/auth/dto/AuthDTO.java

@@ -1,9 +1,8 @@
 package com.usoftchina.saas.auth.dto;
 
-import com.usoftchina.saas.account.dto.CompanyBaseDTO;
+import com.usoftchina.saas.account.dto.AccountDTO;
 
 import java.io.Serializable;
-import java.util.List;
 
 /**
  * @author yingp
@@ -11,37 +10,37 @@ import java.util.List;
  */
 public class AuthDTO implements Serializable{
     private TokenDTO token;
-    private List<CompanyBaseDTO> companies;
+    private AccountDTO account;
 
     public AuthDTO() {
     }
 
-    public AuthDTO(TokenDTO token, List<CompanyBaseDTO> companies) {
+    public AuthDTO(TokenDTO token, AccountDTO account) {
         this.token = token;
-        this.companies = companies;
+        this.account = account;
     }
 
-    public TokenDTO getToken() {
-        return token;
+    public AccountDTO getAccount() {
+        return account;
     }
 
-    public void setToken(TokenDTO token) {
-        this.token = token;
+    public void setAccount(AccountDTO account) {
+        this.account = account;
     }
 
-    public List<CompanyBaseDTO> getCompanies() {
-        return companies;
+    public TokenDTO getToken() {
+        return token;
     }
 
-    public void setCompanies(List<CompanyBaseDTO> companies) {
-        this.companies = companies;
+    public void setToken(TokenDTO token) {
+        this.token = token;
     }
 
     @Override
     public String toString() {
         return "AuthDTO{" +
                 "token=" + token +
-                ", companies=" + companies +
+                ", account=" + account +
                 '}';
     }
 }

+ 1 - 1
base-servers/auth/auth-server/src/main/java/com/usoftchina/saas/auth/controller/AuthController.java

@@ -62,7 +62,7 @@ public class AuthController {
             JwtInfo info = new JwtInfo(appId, companyId, accountDTO.getId(), accountDTO.getUsername());
             TokenVO tokenVO = JwtHelper.generateToken(info, privateKeyPath, expire);
             TokenDTO tokenDTO = BeanMapper.map(tokenVO, TokenDTO.class);
-            return Result.success(new AuthDTO(tokenDTO, accountDTO.getCompanies()));
+            return Result.success(new AuthDTO(tokenDTO, accountDTO));
         }
         return Result.error(result.getCode(), result.getMessage());
     }

+ 13 - 2
frontend/saas-web/Readme.md

@@ -91,10 +91,13 @@ viewModel: view.core.form.FormPanelModel
 | --- | --- | --- | --- |
 | storeModel | grid model | √ | "saas.model.purchase.purchasedetail" |
 | detnoColumn | 序号列,配置该项后无需再columns定义序号列 | √ | "pud_detno" |
-| columns[i].ignore | 是否忽略,为真时在调用保存方法时不会取到该列值 | x | true |
 | deleteDetailUrl | 删除明细接口 | √ | "/api/purchase/purchase/deleteItem" |
+| columns[i].ignore | 是否忽略,为真时在调用保存方法时不会取到该列值 | x | true |
+| columns[i].allowBlank | 是否必填列 | x | true |
+| columns[i].isValid | 自定义校验规则,传入value,返回boolean | x | function(v) { return v > 10; } |
+| columns[i].defaultValue | 默认值,只对设置了dataIndex的column生效 | x | 40 |
 - 需要根据columns在models文件夹下添加storeModel对应的Model
-
+- allowBlan和isValid的校验只会校验dirty数据
 ---
 
 ## 查询列表配置
@@ -156,5 +159,13 @@ deleteDetailUrl 配置调整 formpanel.form->formpanel.detailGridField
 
 主从表从表配置detnoColumn属性说明变更
 
+- 2018-10-31 11:50:22
+
+从表必填配置说明allowBlamk、isValid
+
+- 2018-10-31 18:00:55
+
+从表默认值配置说明
+
 
 

+ 2 - 2
frontend/saas-web/app/model/purchase/purchasedetail.js

@@ -5,8 +5,8 @@ Ext.define('saas.model.purchase.Purchasedetail', {
         { name: 'pd_detno', type: 'int' },
         { name: 'id', type: 'int' },
         { name: 'pd_prodcode', type: 'string' },
-        { name: 'pd_qty', type: 'int' },
-        { name: 'pd_yqty', type: 'int' },
+        { name: 'pd_qty', type: 'float' },
+        { name: 'pd_yqty', type: 'float' },
         { name: 'pd_price', type: 'float' },
         { name: 'pd_taxrate', type: 'float' },
         { name: 'pd_total', type: 'float' },

+ 1 - 1
frontend/saas-web/app/model/sale/ProdIODetail.js

@@ -37,5 +37,5 @@ Ext.define('saas.model.sale.ProdIODetail', {
         { name: 'pd_ioid', type: 'int' },
     ],
     //一对一映射
-    associations: [{ type: 'hasOne', model: 'saas.model.document.Product', associationKey: 'product'}]
+    associations: [{ type: 'hasOne', model: 'saas.model.document.Product', associationKey: 'productDTO'}]
 });

+ 1 - 1
frontend/saas-web/app/model/sale/Saledetail.js

@@ -15,5 +15,5 @@ Ext.define('saas.model.sale.Saledetail', {
         { name: 'sd_pucode', type: 'string' }
     ],
     //一对一映射
-    associations: [{ type: 'hasOne', model: 'saas.model.document.Product', associationKey: 'product'}]
+    associations: [{ type: 'hasOne', model: 'saas.model.document.Product', associationKey: 'productDTO'}]
 });

+ 57 - 11
frontend/saas-web/app/util/FormUtil.js

@@ -37,7 +37,9 @@ Ext.define('saas.util.FormUtil', {
                     Ext.Array.each(items, function(item) {
 
                         if(item.xtype == 'datefield') {
-                            item.format = 'Y-m-d H:i:s'
+                            Ext.applyIf(item, {
+                                format: 'Y-m-d'
+                            });
                         }
 
                         if(item.xtype == 'numberfield') {
@@ -63,24 +65,36 @@ Ext.define('saas.util.FormUtil', {
                                 return c.dataIndex && !c.ignore;
                             }).map(function(c) {
                                 return c.dataIndex
-                            });
+                            }),
+                            defaultValueColumns = {};
 
                             Ext.Array.each(columns, function(c) {
 
+                                if(c.dataIndex && c.defaultValue) {
+                                    defaultValueColumns[c.dataIndex] = c.defaultValue;
+                                }
 
                                 // 不可锁定
                                 Ext.applyIf(c, {
-                                    lockable: false
+                                    lockable: false,
+                                    width: 120
                                 });
 
                                 //必填
-                                if(c.logic=='necessaryField'){
+                                Ext.applyIf(c, {
+                                    allowBlank: true
+                                });
+                                if(!c.allowBlank){
                                     c.cls = 'x-grid-necessary';
                                 }
 
                                 if(c.xtype == 'datecolumn') {
-                                    Ext.apply(c.xtype, {
-                                        format: 'Y-m-d H:i:s'
+                                    Ext.applyIf(c, {
+                                        format: 'Y-m-d'
+                                    });
+                                }else if(c.xtype == 'numbercolumn') {
+                                    Ext.applyIf(c, {
+                                        align: 'end'
                                     });
                                 }
                                 
@@ -99,6 +113,11 @@ Ext.define('saas.util.FormUtil', {
                                 }
                             });
 
+                            columns.push({
+                                flex: 1,
+                                allowBlank: true
+                            });
+
                             cnames.push(item.detnoColumn);
 
                             formModel.set('detail' + index + '.detailBindFields', cnames);
@@ -107,7 +126,17 @@ Ext.define('saas.util.FormUtil', {
                             };     
                             formModel.set('detail' + index + '.detailStore', Ext.create('Ext.data.Store', {
                                 model:item.storeModel,
-                                data: []
+                                data: [],
+                                listeners: {
+                                    add: function(store, records, index, eOpts) {
+                                        Ext.Array.each(records, function(r) {
+                                            for(k in defaultValueColumns) {
+                                                r.set(k, defaultValueColumns[k]);
+                                            }
+                                            r.commit();
+                                        });
+                                    }
+                                }
                             }));
 
                             form.detailCount++;
@@ -178,11 +207,28 @@ Ext.define('saas.util.FormUtil', {
                     var viewModel = form.getViewModel();
                     var detailGrids = form.query('detailGridField');
 
-                    Ext.Array.each(detailGrids, function(grid) {
-                        grid.add10EmptyRow();
-                    });
                     if(code){
-                        viewModel.set(form._codeField,code);
+                        var o = {};
+                        o[form._codeField] = code;
+
+                        var formData = {
+                            main: o
+                        };
+                        Ext.Array.each(detailGrids, function(grid, index) {
+                            var detno = 0;
+                            var detnoColumn = grid.detnoColumn;
+                            var datas = [];
+                            
+                            Ext.Array.each(new Array(3), function() {
+                                detno += 1;
+                                var data = {};
+                                data[detnoColumn] = detno;
+                                datas.push(data);
+                            })
+                            formData['detail' + index] = datas;
+                        });
+
+                        form.setFormData(formData);
                     }
                 }
             }).catch(function() {

+ 2 - 2
frontend/saas-web/app/view/core/base/BasePanelController.js

@@ -102,12 +102,12 @@ Ext.define('saas.view.core.base.BasePanelController', {
     getConditionValue: function(xtype, value) {
         var conditionValue;
         if(xtype == 'datefield') {
-            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d h:i:s');
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
         }else if(xtype == 'condatefield') {
             var from = value.from,
             to = value.to;
 
-            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d h:i:s') + ',' + Ext.Date.format(new Date(to), 'Y-m-d h:i:s');
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d 00:00:00') + ',' + Ext.Date.format(new Date(to), 'Y-m-d 23:59:59');
         }else if(xtype == 'combobox' || xtype == 'combo') {
             conditionValue = '\'' + value + '\'';
         }else if(xtype == 'multicombo') {

+ 5 - 19
frontend/saas-web/app/view/core/base/GridPanel.js

@@ -80,6 +80,7 @@ Ext.define('saas.view.core.base.GridPanel', {
                         text: '导入',
                         handler: me.onImport,
                         menu: {
+                            cls:'x-query-menu',
                             width: 80,
                             items: [{
                                 text:'导出',
@@ -100,6 +101,7 @@ Ext.define('saas.view.core.base.GridPanel', {
                             me.onVastDeal(form._batchCloseUrl,'CLOSE');
                         },
                         menu: {
+                            cls:'x-query-menu',
                             width: 80,
                             items: [{
                                 text:'启用',
@@ -128,11 +130,7 @@ Ext.define('saas.view.core.base.GridPanel', {
                     xtype: 'pagingtoolbar',
                     dock: 'bottom',
                     displayInfo: true,
-                    emptyMsg: "暂无数据",
-                    store: me.store,
-                    displayMsg: '显示{0}到{1}条数据,共有{2}条',
-                    beforePageText: "当前第",
-                    afterPageText: "页,共{0}页"
+                    store: me.store
                 }]
             });
         }
@@ -197,26 +195,14 @@ Ext.define('saas.view.core.base.GridPanel', {
             }
         }
     },
-
-    getCondition: function(f,conditionExpression){
-        var condition = '';
-        if((f.xtype == 'checkbox' || f.xtype == 'radio')&&f.logic){
-            
-        }else if(f.xtype=='textfield'&&f.value!=''){
-            condition=conditionExpression.replace(new RegExp("\\{0}","g"), f.value);
-        }
-        if(condition.length>0){
-            condition+= ' AND ';
-        }
-        return condition;
-    },
-
+    
     insertFirstColumn:function(columns){
         var me=this;
         if(columns.length>0 && columns[0].xtype!='actioncolumn'){
             return Ext.Array.insert(columns,0,[{
                 xtype:'actioncolumn',
                 width:70,
+                dataIndex:'actioncolumn',
                 text:'操作',
                 items: [{
                     tooltip: '编辑',

+ 14 - 9
frontend/saas-web/app/view/core/dbfind/DbfindGridPanel.js

@@ -32,7 +32,14 @@ Ext.define('saas.view.core.dbfind.DbfindGridPanel', {
                     beforeload: function (store, op) {
                         var condition = me.condition;
                         if (Ext.isEmpty(condition)) {
-                            condition = '';
+                            condition = [];
+                        }
+                        //添加默认条件
+                        if(me.ownerCt.trigger.defaultCondition) {
+                            condition.push({
+                                type: 'condition',
+                                value: me.ownerCt.trigger.defaultCondition
+                            });
                         }
                         Ext.apply(store.proxy.extraParams, {
                             number: op._page,
@@ -73,11 +80,7 @@ Ext.define('saas.view.core.dbfind.DbfindGridPanel', {
                     xtype: 'pagingtoolbar',
                     dock: 'bottom',
                     displayInfo: true,
-                    emptyMsg: "暂无数据",
-                    store: me.store,
-                    displayMsg: '显示{0}到{1}条数据,共有{2}条',
-                    beforePageText: "当前第",
-                    afterPageText: "页,共{0}页"
+                    store: me.store
                 }]
             });
         }
@@ -92,11 +95,13 @@ Ext.define('saas.view.core.dbfind.DbfindGridPanel', {
                 if(me.belong=='grid'){
                     for (let index = 0; index < dbfinds.length; index++) {
                         var item = dbfinds[index];
-                        var rec = me.dbfindtrigger.column.ownerCt.ownerCt.selModel.getLastSelected();
+                        var mainGrid = me.dbfindtrigger.column.ownerCt.ownerCt;
+                        var rec = mainGrid.selModel.getLastSelected();
                         if(rec){
                             var nowRec = me.dbfindtrigger.column.ownerCt.ownerCt.store.getData().getByKey(rec.id);
                             nowRec.set(item.to,record.get(item.from));
                             //me.column.getEditor().setValue(record.get(item.from));
+                            mainGrid.up('detailGridField').fireEvent('edit');
                         }
                     }
                 }else if(me.belong=='form'){
@@ -199,12 +204,12 @@ Ext.define('saas.view.core.dbfind.DbfindGridPanel', {
     getConditionValue: function(xtype, value) {
         var conditionValue;
         if(xtype == 'datefield') {
-            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d h:i:s');
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
         }else if(xtype == 'condatefield') {
             var from = value.from,
             to = value.to;
 
-            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d h:i:s') + ',' + Ext.Date.format(new Date(to), 'Y-m-d h:i:s');
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d 00:00:00') + ',' + Ext.Date.format(new Date(to), 'Y-m-d 23:59:59');
         }else if(xtype == 'combobox' || xtype == 'combo') {
             conditionValue = '\'' + value + '\'';
         }else if(xtype == 'multicombo') {

+ 1 - 1
frontend/saas-web/app/view/core/dbfind/DbfindTrigger.js

@@ -18,7 +18,7 @@ Ext.define('saas.view.core.dbfind.DbfindTrigger', {
                 'value':me.value
             }]
         });
-        this.callParent();
+        me.callParent();
     },
     //输入值之后进行模糊查询
     doQuery: function(queryString, forceAll, rawQuery) {

+ 22 - 12
frontend/saas-web/app/view/core/dbfind/MultiDbfindGridPanel.js

@@ -23,7 +23,7 @@ Ext.define('saas.view.core.dbfind.MultiDbfindGridPanel', {
                     var selectRecordArr = selModel.view.ownerCt.selectRecordArr;
                     var index = -1;
                     index = selectRecordArr.findIndex(function(f){
-                        return f.id==record.id
+                        return f.id==id
                     });
                     if(index>-1){
                         selectRecordArr.splice(index,1);
@@ -60,12 +60,19 @@ Ext.define('saas.view.core.dbfind.MultiDbfindGridPanel', {
                     beforeload: function (store, op) {
                         var condition = me.condition;
                         if (Ext.isEmpty(condition)) {
-                            condition = " 1=1 ";
+                            condition = [];
+                        }
+                        //添加默认条件
+                        if(me.ownerCt.trigger.defaultCondition) {
+                            condition.push({
+                                type: 'condition',
+                                value: me.ownerCt.trigger.defaultCondition
+                            });
                         }
                         Ext.apply(store.proxy.extraParams, {
                             number: op._page,
                             size: store.pageSize,
-                            keyword: condition
+                            condition: JSON.stringify(condition)
                         });
                     }
                 }
@@ -105,20 +112,27 @@ Ext.define('saas.view.core.dbfind.MultiDbfindGridPanel', {
                             var selectRecordArr = grid.selectRecordArr;
                             var dbfinds = grid.dbfinds;
                             //点开放大镜的行
-                            var rec = grid.dbfindtrigger.column.ownerCt.ownerCt.selModel.getLastSelected();
                             var mainGrid = grid.dbfindtrigger.column.ownerCt.ownerCt;
+                            var rec = mainGrid.selModel.getLastSelected();
                             Ext.Array.each(selectRecordArr,function(record,index) {
                                 Ext.Array.each(dbfinds,function(dbfind) {
                                     if(rec){
-                                        var nowRec = grid.dbfindtrigger.column.ownerCt.ownerCt.store.getData().getByKey(rec.id);
+                                        var nowRec = mainGrid.store.getData().getByKey(rec.id);
                                         nowRec.set(dbfind.to,record.get(dbfind.from));
                                     }
                                 });
                                 var index = mainGrid.store.data.items.findIndex(function(f){
-                                    return f.id==rec.id
+                                    return f.id==(rec&&rec.id?rec.id:0)
                                 });
                                 rec = mainGrid.store.data.getAt(index+1);
+                                if(!rec&&index!=selectRecordArr.length-1){//添加下一行
+                                    var data = {};
+                                    data[mainGrid.ownerCt.detnoColumn] = index + 2;
+                                    mainGrid.store.insert(index+1, data);
+                                    rec = mainGrid.store.data.getAt(index+1);
+                                }
                             });
+                            mainGrid.up('detailGridField').fireEvent('edit');
                             grid.ownerCt.close();
                         }
                     }])
@@ -126,11 +140,7 @@ Ext.define('saas.view.core.dbfind.MultiDbfindGridPanel', {
                     xtype: 'pagingtoolbar',
                     dock: 'bottom',
                     displayInfo: true,
-                    emptyMsg: "暂无数据",
                     store: me.store,
-                    displayMsg: '显示{0}到{1}条数据,共有{2}条',
-                    beforePageText: "当前第",
-                    afterPageText: "页,共{0}页",
                     items:[{
                         xtype:'checkbox',
                         id:'showSelectRecord',
@@ -335,12 +345,12 @@ Ext.define('saas.view.core.dbfind.MultiDbfindGridPanel', {
     getConditionValue: function(xtype, value) {
         var conditionValue;
         if(xtype == 'datefield') {
-            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d h:i:s');
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
         }else if(xtype == 'condatefield') {
             var from = value.from,
             to = value.to;
 
-            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d h:i:s') + ',' + Ext.Date.format(new Date(to), 'Y-m-d h:i:s');
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d 00:00:00') + ',' + Ext.Date.format(new Date(to), 'Y-m-d 23:59:59');
         }else if(xtype == 'combobox' || xtype == 'combo') {
             conditionValue = '\'' + value + '\'';
         }else if(xtype == 'multicombo') {

+ 1 - 1
frontend/saas-web/app/view/core/dbfind/MultiDbfindTrigger.js

@@ -103,7 +103,7 @@ Ext.define('saas.view.core.dbfind.MultiDbfindTrigger', {
         //判断dbfindtrigger归属
         f.judge(f);
         var panel = f.up('core-tab-panel'),panelEl;
-        if(f.ownerCt.ownerCt.id.indexOf('window-')>-1){
+        if(!f.column&&f.ownerCt.ownerCt.id.indexOf('window-')>-1){
             panelEl = f.ownerCt.ownerCt.getEl();
         }else{
             panelEl = panel.getEl()

+ 2 - 0
frontend/saas-web/app/view/core/form/ConDateField.js

@@ -53,6 +53,7 @@ Ext.define('saas.view.core.form.ConDateField', {
             xtype: 'datefield',
             name: me.name + '_from',
             format: 'Y-m-d',
+            formatText: '',
             allowBlank: allowBlank,
             flex: 1,
             fieldStyle: me.fieldStyle,
@@ -86,6 +87,7 @@ Ext.define('saas.view.core.form.ConDateField', {
             name: me.name + '_to',
             allowBlank: allowBlank,
             format: 'Y-m-d',
+            formatText: '',
             flex: 1,
             fieldStyle: me.fieldStyle,
             listeners: {

+ 80 - 22
frontend/saas-web/app/view/core/form/FormPanel.js

@@ -37,8 +37,19 @@ Ext.define('saas.view.core.form.FormPanel', {
     remoteConfig: true, // 是否需要从远端读取form配置
     toolBtns: [], // 自定义按钮
 
+    auditTexts: {
+        auditCode: 'AUDITED',
+        auditText: '已审核',
+        unAuditCode: 'UNAUDITED',
+        unAuditText: '未审核',
+        auditBtnText: '审核',
+        unAuditBtnText: '反审核',
+    },
+
     initComponent: function () {
-        var me = this;
+        var me = this,
+        auditTexts = me.auditTexts;
+
         me.initViewModel();
         me.FormUtil.setItems(me);
 
@@ -74,18 +85,21 @@ Ext.define('saas.view.core.form.FormPanel', {
                     }
                 }, {
                     xtype: 'tbtext',
-                    html: '已审核',
+                    // html: '已审核',
+                    html: auditTexts.auditText,
                     cls: 'x-audited',
                     hidden: true,
                     bind: {
-                        hidden: '{!(' + me._statusCodeField + ' == "AUDITED")}'
+                        // hidden: '{!(' + me._statusCodeField + ' == "AUDITED")}'
+                        hidden: '{!(' + me._statusCodeField + ' == "' + auditTexts.auditCode + '")}'
                     }
                 }, {
                     xtype: 'button',
                     cls: 'x-codeeditor-btn',
                     bind: {
                         iconCls: 'fa {base.codeEditable ? "fa-check-circle" : "fa-edit"}',
-                        hidden: '{(' + me._statusCodeField + ' == "AUDITED")}'
+                        // hidden: '{(' + me._statusCodeField + ' == "AUDITED")}'
+                        hidden: '{(' + me._statusCodeField + ' == "' + auditTexts.auditCode + '")}'
                     },
                     handler: 'codeEditorClick'
                 }, '->'].concat(me.toolBtns.map(function (btn) {
@@ -95,42 +109,72 @@ Ext.define('saas.view.core.form.FormPanel', {
                     cls: 'x-formpanel-btn-orange',
                     xtype: 'button',
                     text: '新增',
+                    bind: {
+                        hidden: '{!id}'
+                    },
                     handler: 'add'
                 }, {
                     xtype: 'button',
                     text: '保存',
                     handler: 'onSave',
-                    formBind: true
+                    bind: {
+                        // disabled: '{!base.valid || '+ me._statusCodeField + ' == "AUDITED" || ' + me._statusCodeField + ' == "OPEN"}'
+                        disabled: '{!base.valid || '+ me._statusCodeField + ' == "' + auditTexts.auditCode + '"}'
+                    }
                 }, {
                     xtype: 'button',
                     text: '删除',
                     bind: {
-                        hidden: '{deleteHidden}'
+                        hidden: '{deleteHidden || ' + me._statusCodeField + '=="' + auditTexts.auditCode + '"}'
                     },
                     handler: 'delete'
                 }, {
                     xtype: 'button',
                     bind: {
                         text: '{auditBtnText}',
+                        disabled: '{!base.valid}',
                         hidden:'{!showAuditBtn}'
                     },
                     handler: "auditBtnClick",
 
                 }]))
-            }]
+            }],
+            listeners: {
+                validitychange: function() {
+                    me.isValid();
+                }
+            },
         });
         me.callParent(arguments);
     },
 
+    isValid: function() {
+        var me = this;
+        var viewModel = me.getViewModel();
+        var valid = me.getForm().isValid();
+        var detailGrids = me.query('detailGridField');
+
+        for(var i = 0; i < detailGrids.length; i++) {
+            var g = detailGrids[i];
+            if(!g.isValid()) {
+                valid = false;
+                break;
+            }
+        }
+        viewModel.set('base.valid', valid);
+        return valid;
+    },
+
     /**
      * 一些初始化viewModel的方法
      */
     initViewModel: function () {
         var me = this,
-            codeField = me._codeField,
-            statusField = me._statusField,
-            statusCodeField = me._statusCodeField,
-            viewModel = me.getViewModel();
+        codeField = me._codeField,
+        statusField = me._statusField,
+        statusCodeField = me._statusCodeField,
+        viewModel = me.getViewModel(),
+        auditTexts = me.auditTexts;
 
         viewModel.set(codeField, '');
         viewModel.set('createTime', Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
@@ -141,23 +185,28 @@ Ext.define('saas.view.core.form.FormPanel', {
             o['bindEditable'] = {
                 bind: '{' + statusCodeField + '}',
                 get: function(value) {
-                    viewModel.set(statusField, value == 'AUDITED' ? '已审核' : '未审核');
-                    viewModel.set('auditBtnText', value == 'AUDITED' ? '反审核' : '审核');
-                    me.setEditable(value != 'AUDITED');
+                    // viewModel.set(statusField, value == 'AUDITED' ? '已审核' : '未审核');
+                    viewModel.set(statusField, value == auditTexts.auditCode ? auditTexts.auditText : auditTexts.unAuditText);
+                    // viewModel.set('auditBtnText', value == 'AUDITED' ? '反审核' : '审核');
+                    viewModel.set('auditBtnText', value == auditTexts.auditCode ? auditTexts.unAuditBtnText : auditTexts.auditBtnText);
+                    // me.setEditable(value != 'AUDITED');
+                    me.setEditable(value != auditTexts.auditCode);
                     return value;
                 }
             };
             viewModel.setFormulas(o);
-            viewModel.set(statusCodeField, "UNAUDITED");
+            // viewModel.set(statusCodeField, "UNAUDITED");
+            viewModel.set(statusCodeField, auditTexts.unAuditCode);
         } else {
-            viewModel.set('auditBtnText', "审核");
+            // viewModel.set('auditBtnText', "审核");
+            viewModel.set('auditBtnText', auditTexts.auditBtnText);
         }
     },
 
     addItems: function (items) {
         var me = this;
         me.setBindFields(items);
-        return this.add(items);
+        return me.add(items);
     },
 
     /**
@@ -207,10 +256,10 @@ Ext.define('saas.view.core.form.FormPanel', {
 
     setFormData: function (formData) {
         var me = this,
-            main = formData.main,
-            detailCount = me.detailCount,
-            viewModel = me.getViewModel(),
-            viewData = viewModel.getData();
+        main = formData.main,
+        detailCount = me.detailCount,
+        viewModel = me.getViewModel(),
+        viewData = viewModel.getData();
 
         viewModel.setData(main);
 
@@ -220,9 +269,12 @@ Ext.define('saas.view.core.form.FormPanel', {
                 store = detail.detailStore;
 
             if (detailData) {
-                store.loadData(detailData);
+                store.removeAll();
+                store.add(detailData);
             }
         }
+
+        me.isValid();
     },
 
     /**
@@ -241,6 +293,12 @@ Ext.define('saas.view.core.form.FormPanel', {
                 defaultValue = item.defaultValue;
 
             if (xtype == 'detailGridField') {
+                item.listeners = item.listeners || {};
+                item.listeners.validChange = function() {
+                    console.log('validChange');
+                    me.isValid();
+                }
+
                 return;
             }
 

+ 32 - 12
frontend/saas-web/app/view/core/form/FormPanelController.js

@@ -17,8 +17,8 @@ Ext.define('saas.view.core.form.FormPanelController', {
 
     add: function(){
         var form = this.getView();
-        var id = form.xtype + '_add';
-        openTab(form.xtype,'新增' + form._title,id);
+        var id = form.xtype + '-add';
+        openTab(form.xtype,'新增' + form._title, id);
     },
     
     delete: function(){
@@ -51,12 +51,14 @@ Ext.define('saas.view.core.form.FormPanelController', {
         var me = this,
         form = this.getView();
 
-        if(form.getForm().wasDirty==false){
-            showToast('未修改数据,请修改后保存');
+        var valid = form.isValid();
+        if(!valid) {
+            showToast('表单校验有误,请检查');
             return false;
         }
-        if(form.getForm().wasValid==false){
-            showToast('表单校验有误,请检查');
+
+        if(form.getForm().wasDirty==false){
+            showToast('未修改数据,请修改后保存');
             return false;
         }
         //form里面数据
@@ -93,9 +95,16 @@ Ext.define('saas.view.core.form.FormPanelController', {
         })
         .then(function(localJson) {
             if(localJson.success){
-                form.initId = localJson.data.id;
+                var id = localJson.data.id;
+                var code = localJson.data.code;
+                form.initId = id;
                 form.FormUtil.loadData(form);
                 showToast('保存成功');
+
+                var newId = form.xtype + '-' + id;
+                var newTitle = form._title + '(' + code + ')';
+
+                refreshTabTitle(newId, newTitle);
             }
         })
         .catch(function(res) {
@@ -110,15 +119,18 @@ Ext.define('saas.view.core.form.FormPanelController', {
         detailCount = form.detailCount,
         viewModel = me.getViewModel(),
         modelData = viewModel.getData();
+
+        var valid = form.isValid();
+
+        if(!valid) {
+            showToast('表单校验有误,请检查');
+            return false;
+        }
         
         if(form.getForm().wasDirty==false){
             showToast('未修改数据,请修改后保存');
             return false;
         }
-        if(form.getForm().wasValid==false){
-            showToast('表单校验有误,请检查');
-            return false;
-        }
         //form里面数据
         var formData = form.getFormData();
         var params = {
@@ -144,7 +156,15 @@ Ext.define('saas.view.core.form.FormPanelController', {
             if(localJson.success){
                 // 未保存直接审核会返回id
                 if(localJson.data) {
-                    form.initId = localJson.data.id;
+                    var id = localJson.data.id;
+                    var code = localJson.data.code;
+                    
+                    form.initId = id;
+
+                    var newId = form.xtype + '-' + id;
+                    var newTitle = form._title + '(' + code + ')';
+
+                    refreshTabTitle(newId, newTitle);
                 }
                 form.FormUtil.loadData(form);
                 form.setEditable(false);

+ 1 - 0
frontend/saas-web/app/view/core/form/FormPanelModel.js

@@ -6,6 +6,7 @@ Ext.define('saas.view.core.form.FormPanelModel', {
         id: 0,
         base: {
             bindFields: [], // 绑定字段
+            valid: true, // 单据是否合法
             editable: true, // 单据是否可编辑
             codeEditable: false, // 单据编号是否可编辑
         },

+ 85 - 11
frontend/saas-web/app/view/core/form/field/DetailGridField.js

@@ -26,6 +26,7 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
     showIndex: true,
     configUrl: '',
     editable: true,
+    allowEmpty: true, // 校验时只校验dirty数据
 
     initComponent: function() {
         var me = this;
@@ -40,15 +41,29 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
         };
 
         Ext.apply(me, {
-            viewConfig: {
+            normalViewConfig: {
                 deferEmptyText: false,
                 emptyText: '无数据'
             },
+            lockedGridConfig: {
+                // scrollable: {
+                //     x: false,
+                //     y: true
+                // }
+            },
             lockedViewConfig: {
+                // scrollable: false,
+                scrollable: {
+                    x: false,
+                    y: true
+                },
                 deferEmptyText: false,
                 emptyText: '<div style="width: 100%; text-align: center; cursor: pointer; color: green;" class="fa fa-plus" title="新增行" onclick="addRows(\'' + me.id + '\')"></div>',
             },
             listeners: {
+                edit: function() {
+                    this.fireEvent('validChange');
+                },
                 itemmouseenter: function(view, record, item, index, e, eOpts) {
                     if(!view.up('detailGridField').editable) {
                         return;
@@ -82,7 +97,8 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
                     }else if(target.classList.contains('fa-plus')) {
                         me.addDetail(detno);
                     }
-                }
+                },
+                scope: me
             }
         });
         me.callParent(arguments);
@@ -100,6 +116,7 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
             xtype : "numbercolumn",
             align : 'center',
             format:'0',
+            allowBlank: true,
             summaryType: 'count',
             locked:true,
             lockable: false,
@@ -115,11 +132,6 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
             },
         };
 
-        Ext.Array.each(columns, function(c) {
-            Ext.applyIf(c, {
-                allowBlank: true
-            });
-        });
         if (detnoField) {
             Ext.apply(me, { columns: [indexColumn].concat(columns) });
         }
@@ -193,6 +205,7 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
         var data = {};
         data[detnoColumn] = detno + 1;
         store.insert(store.indexOf(selectedRecord) + 1, data);
+        me.fireEvent('validChange');
     },
 
     deleteDetail: function(v) {
@@ -229,6 +242,7 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
         }else{
             store.remove(selectedRecord);
         }
+        me.fireEvent('validChange');
     },
 
     swapUp: function() {
@@ -280,6 +294,7 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
             //聚焦目标行
             me.selModel.select(to);
         }
+        me.fireEvent('validChange');
     },
     setGridDisabled: function(able) {
         var me = this,
@@ -294,19 +309,78 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
             }
         });
     },
+
+    /**
+     * 判断grid数据是否合法
+     */
     isValid: function() {
         var me = this,
-        columns = me.columns;
+        allowEmpty = me.allowEmpty;
+        columns = me.columns,
+        data = allowEmpty ? me.getDirtyData() : me.getAllData(),
+        valid = allowEmpty;
 
         // 判断列必填
-        Ext.Array.each(columns, function(c) {
+        a:
+        for(var i = 0; i < columns.length; i++) {
+            var c = columns[i];
+            var cname = c.dataIndex;
             var allowBlank = c.allowBlank;
-            if(!allowBlank) {
-                
+            var isValid = c.isValid;
+            
+            b:
+            for(var j = 0; j < data.length; j++) {
+                valid = true;
+                var d = data[j];
+                var value = d[cname];
+
+                if(typeof isValid == 'function') {
+                    if(!isValid(value)) {
+                        valid = false;
+                        break a;
+                    }
+                }
+                if(!allowBlank) {
+                    if(!value) {
+                        valid = false;
+                        break a;
+                    }
+                }
+            }
+        }
+
+        return valid;
+    },
+
+    /**
+     * 获得所有数据
+     */
+    getAllData: function() {
+        var me = this,
+        store = me.getStore(),
+        storeData = store.getData().items,
+        allData = [];
+
+        Ext.Array.each(storeData, function(item){
+            var d = Object.assign({}, item.data);
+
+            if((typeof d.id) != "number" && d.id.indexOf('-')>-1){
+                d.id = 0;
             }
+            for(k in d) {
+                if(Ext.isDate(d[k])) {
+                    d[k] = Ext.Date.format(d[k], 'Y-m-d H:i:s');
+                }
+            }
+            allData.push(d);
         });
+
+        return allData;
     },
 
+    /**
+     * 获得已修改的数据
+     */
     getDirtyData: function() {
         var me = this,
         store = me.getStore(),

+ 22 - 1
frontend/saas-web/app/view/core/form/field/DetailGridField.scss

@@ -1,9 +1,30 @@
 .x-detailgridfield {
 
     .x-grid-view {
-        
+
         .x-grid-empty {
             padding: 8px 10px;
         }
     }
+}
+
+.x-column-header{
+    text-align: center !important;
+    border-width: 1px;
+}
+.x-column-header .x-column-header-text {
+    font: "microsoft yahei";
+    text-align: center;
+    font-size:14px;
+    font-weight: 500;
+}
+.x-grid-necessary .x-column-header-text:before{
+    content: '*';
+    font-size: 130%;
+    color: #ff0000;
+    width: 5px;
+    height: 5px;
+    margin-top: 4px;
+    margin-left: -10px;
+    position: absolute;
 }

+ 7 - 7
frontend/saas-web/app/view/core/query/QueryGridPanel.js

@@ -122,6 +122,7 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
                     xtype: 'button',
                     handler: me.onAudit,
                     menu: {
+                        cls:'x-query-menu',
                         items: [{
                             text:'反审核',
                             handler:function(){
@@ -138,6 +139,7 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
                     text: '打印',
                     handler: me.onPrint,
                     menu: {
+                        cls:'x-query-menu',
                         width: 80,
                         items: [{
                             text:'设置',
@@ -155,6 +157,7 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
                     text: '导入',
                     handler: me.onImport,
                     menu: {
+                        cls:'x-query-menu',
                         width: 80,
                         items: [{
                             text:'导出',
@@ -172,6 +175,7 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
                     text: '关闭',
                     handler: me.onCloseOrder,
                     menu: {
+                        cls:'x-query-menu',
                         width: 80,
                         items: [{
                             text:'启用',
@@ -193,11 +197,7 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
                 xtype: 'pagingtoolbar',
                 dock: 'bottom',
                 displayInfo: true,
-                emptyMsg: "暂无数据",
-                store: me.store,
-                displayMsg: '显示{0}-{1}条,共{2}条',
-                beforePageText: "第",
-                afterPageText: "页,共{0}页"
+                store: me.store
             }]
         });
         me.callParent(arguments);
@@ -207,8 +207,8 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
             var grid = tableView.up('grid'),
             idValue = record.get(grid.idField),
             codeValue = record.get(grid.codeField),
-            id = grid.xtype + idValue;
-            openTab(grid.addXtype,grid.addTitle+"("+codeValue+")",id, {
+            id = grid.addXtype + '-' + idValue;
+            openTab(grid.addXtype, grid.addTitle+"("+codeValue+")", id, {
                 initId: idValue
             });
         }

+ 2 - 2
frontend/saas-web/app/view/core/query/QueryPanel.js

@@ -222,12 +222,12 @@ Ext.define('saas.view.core.query.QueryPanel', {
     getConditionValue: function(xtype, value) {
         var conditionValue;
         if(xtype == 'datefield') {
-            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d h:i:s');
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
         }else if(xtype == 'condatefield') {
             var from = value.from,
             to = value.to;
 
-            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d h:i:s') + ',' + Ext.Date.format(new Date(to), 'Y-m-d h:i:s');
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d 00:00:00') + ',' + Ext.Date.format(new Date(to), 'Y-m-d 23:59:59');
         }else if(xtype == 'combobox' || xtype == 'combo') {
             conditionValue = '\'' + value + '\'';
         }else if(xtype == 'multicombo') {

+ 1 - 1
frontend/saas-web/app/view/core/query/QueryPanelController.js

@@ -36,7 +36,7 @@ Ext.define('saas.view.core.query.QueryPanelController', {
         var me = this,
         queryPanel = me.getView(),
         gridPanel = queryPanel.down('core-query-querygridpanel'),
-        id = gridPanel.addXtype + '_add';
+        id = gridPanel.addXtype + '-add';
         openTab(gridPanel.addXtype,'新增'+gridPanel.addTitle,id)
     },
     onReSetClick:function(btn){

+ 1 - 1
frontend/saas-web/app/view/document/bom/FormController.js

@@ -28,10 +28,10 @@ Ext.define('saas.view.document.bom.FormController', {
         })
         .then(function(localJson) {
             if(localJson.success){
-                showToast('启用成功');
                 form.initId = localJson.data.id;
                 form.FormUtil.loadData(form);
                 viewModel.set('base.editable', false);
+                showToast('启用成功');
             }
         })
         .catch(function(res) {

+ 20 - 65
frontend/saas-web/app/view/document/bom/FormPanel.js

@@ -24,55 +24,38 @@ Ext.define('saas.view.document.bom.FormPanel', {
         xtype: 'hidden',
         name: 'id',
         fieldLabel: 'id',
-        allowBlank: true,
-        columnWidth: 0.25
     },{
         xtype: 'hidden',
         name: 'bo_motherid',
-        fieldLabel: '母件id',
-        allowBlank: true,
-        columnWidth: 0.25
+        fieldLabel: '母件id'
     },{
         xtype: 'textfield',
         name: 'bo_mothername',
         fieldLabel: 'BOM名称',
-        allowBlank: false,
-        columnWidth: 0.25
+        allowBlank: false
     },{
         xtype: 'textfield',
         name: 'bo_mothercode',
         fieldLabel: 'BOM编号',
-        allowBlank: true,
-        columnWidth: 0.25
+        allowBlank: true
     },{
         xtype: 'textfield',
         name: 'bo_status',
-        fieldLabel: 'BOM状态',
-        allowBlank: true,
-        columnWidth: 0.25
+        fieldLabel: 'BOM状态'
     },{
         xtype: 'hidden',
         name: 'bo_statuscode',
-        fieldLabel: '状态码',
-        allowBlank: true,
-        columnWidth: 0.25
+        fieldLabel: '状态码'
     },{
-        format : "Y-m-d",
         xtype : "datefield", 
         name : "createTime", 
-        fieldLabel : "创建时间", 
-        allowBlank : true, 
-        columnWidth : 0.25
+        fieldLabel : "创建时间"
     },{  
-        format : "Y-m-d",
         xtype : "datefield", 
         name : "updateTime", 
-        fieldLabel : "更新时间", 
-        allowBlank : true, 
-        columnWidth : 0.25
+        fieldLabel : "更新时间"
     }, {
         xtype : "detailGridField", 
-        detnoColumn:  'bd_detno',
         storeModel:'saas.model.document.bomdetail',
         deleteDetailUrl:'/api/document/bom/deleteDetail/',
         columns : [
@@ -85,7 +68,7 @@ Ext.define('saas.view.document.bom.FormPanel', {
             {
                 text : "关联ID", 
                 dataIndex : "bd_bomid", 
-                width : 0, 
+                width : 120, 
                 xtype : "numbercolumn"
             },
             {
@@ -94,9 +77,7 @@ Ext.define('saas.view.document.bom.FormPanel', {
                     xtype : "textfield"
                 },
                 dataIndex : "bd_soncode", 
-                width : 120.0, 
-                xtype : "", 
-                items : null
+                width : 120.0
             },
             {
                 text : "单位", 
@@ -104,9 +85,7 @@ Ext.define('saas.view.document.bom.FormPanel', {
                     xtype : "textfield"
                 },
                 dataIndex : "bd_unit", 
-                width : 120.0, 
-                xtype : "", 
-                items : null
+                width : 120.0
             },
             {
                 text : "单位用量", 
@@ -114,9 +93,7 @@ Ext.define('saas.view.document.bom.FormPanel', {
                     xtype : "textfield"
                 },
                 dataIndex : "bd_baseqty", 
-                width : 120.0, 
-                xtype : "", 
-                items : null
+                width : 120.0
             },
             {
                 text : "替代料", 
@@ -124,39 +101,17 @@ Ext.define('saas.view.document.bom.FormPanel', {
                     xtype : "textfield"
                 },
                 dataIndex : "bd_replace", 
-                width : 120.0, 
-                xtype : "", 
-                items : null
+                width : 120.0
             }]
     }],
 
-    /**
-     * 一些初始化viewModel的方法
-     */
-    initViewModel: function() {
-        var me = this,
-        codeField = me._codeField,
-        statusField = me._statusField,
-        statusCodeField = me._statusCodeField,
-        viewModel = me.getViewModel();
-        
-        viewModel.set(codeField, '');
-        viewModel.set('createTime', new Date());
-        viewModel.set('updateTime', new Date());
+    auditTexts: {
+        auditCode: 'OPEN',
+        auditText: '已开启',
+        unAuditCode: 'CLOSE',
+        unAuditText: '已关闭',
+        auditBtnText: '启用',
+        unAuditBtnText: '禁用',
+    },
 
-        if(statusCodeField) {
-            var o = {};
-            o['auditBtnText'] = {
-                bind: '{' + statusCodeField + '}',
-                get: function(value) {
-                    viewModel.set(statusField, value == 'OPEN' ? '已开启' : '已关闭');
-                    return value == 'OPEN' ? '禁用' : '启用'
-                }
-            };
-            viewModel.setFormulas(o);
-            viewModel.set(statusCodeField, "OPEN");
-        }else {
-            viewModel.set('auditBtnText', "禁用");
-        }
-    }
 });

+ 1 - 1
frontend/saas-web/app/view/document/customer/FormController.js

@@ -51,10 +51,10 @@ Ext.define('saas.view.document.customer.FormController', {
         })
         .then(function(localJson) {
             if(localJson.success){
-                showToast('禁用成功');
                 form.initId = localJson.data.id;
                 form.FormUtil.loadData(form);
                 viewModel.set('base.editable', false);
+                showToast('禁用成功');
             }
         })
         .catch(function(res) {

+ 8 - 35
frontend/saas-web/app/view/document/customer/FormPanel.js

@@ -77,14 +77,12 @@ Ext.define('saas.view.document.customer.FormPanel', {
             this.dialog.show();
         }
     },{
-        format : "Y-m-d",
         xtype : "datefield", 
         name : "createTime", 
         fieldLabel : "创建时间", 
         allowBlank : true, 
         columnWidth : 0.25
     },{
-        format : "Y-m-d", 
         xtype : "datefield", 
         name : "cu_begindate", 
         fieldLabel : "期初日期", 
@@ -132,7 +130,6 @@ Ext.define('saas.view.document.customer.FormPanel', {
         allowBlank : true, 
         columnWidth : 0.25
     },{  
-        format : "Y-m-d",
         xtype : "datefield", 
         name : "updateTime", 
         fieldLabel : "更新时间", 
@@ -141,7 +138,6 @@ Ext.define('saas.view.document.customer.FormPanel', {
     }, {
         height: 169,
         xtype : "detailGridField", 
-        detnoColumn:  'cc_detno',
         storeModel:'saas.model.document.customercontact',
         deleteDetailUrl:'/api/document/customer/deletecontact/',
         columns : [
@@ -233,7 +229,6 @@ Ext.define('saas.view.document.customer.FormPanel', {
     } ,{
         height: 169,
         xtype : "detailGridField", 
-        detnoColumn:  'ca_detno',
         storeModel:'saas.model.document.customeraddress',
         deleteDetailUrl:'/api/document/customer/deleteaddress/',
         columns : [
@@ -320,34 +315,12 @@ Ext.define('saas.view.document.customer.FormPanel', {
                 }
             }]
     }],
-
-    /**
-     * 一些初始化viewModel的方法
-     */
-    initViewModel: function() {
-        var me = this,
-        codeField = me._codeField,
-        statusField = me._statusField,
-        statusCodeField = me._statusCodeField,
-        viewModel = me.getViewModel();
-        
-        viewModel.set(codeField, '');
-        viewModel.set('createTime', new Date());
-        viewModel.set('updateTime', new Date());
-
-        if(statusCodeField) {
-            var o = {};
-            o['auditBtnText'] = {
-                bind: '{' + statusCodeField + '}',
-                get: function(value) {
-                    viewModel.set(statusField, value == 'OPEN' ? '已开启' : '已关闭');
-                    return value == 'OPEN' ? '禁用' : '启用'
-                }
-            };
-            viewModel.setFormulas(o);
-            viewModel.set(statusCodeField, "OPEN");
-        }else {
-            viewModel.set('auditBtnText', "禁用");
-        }
-    }
+    auditTexts: {
+        auditCode: 'OPEN',
+        auditText: '已开启',
+        unAuditCode: 'CLOSE',
+        unAuditText: '已关闭',
+        auditBtnText: '启用',
+        unAuditBtnText: '禁用',
+    },
 });

+ 49 - 5
frontend/saas-web/app/view/document/kind/ChildForm.js

@@ -35,7 +35,7 @@ Ext.define('KitchenSink.view.binding.ChildForm', {
                 xtype:'textfield',
                 name:'ck_name',
                 allowBlank:false,
-                fieldLabel:'类型'
+                fieldLabel:'客户类型'
             }]
         },
         vendorkind:{
@@ -46,7 +46,7 @@ Ext.define('KitchenSink.view.binding.ChildForm', {
                 xtype:'textfield',
                 name:'vk_name',
                 allowBlank:false,
-                fieldLabel:'类型'
+                fieldLabel:'供应商类型'
             }]
         },
         productkind:{
@@ -57,7 +57,7 @@ Ext.define('KitchenSink.view.binding.ChildForm', {
                 xtype:'textfield',
                 name:'pt_name',
                 allowBlank:false,
-                fieldLabel:'类型'
+                fieldLabel:'物料类型'
             }]
         },
         bankinformation:{
@@ -94,7 +94,7 @@ Ext.define('KitchenSink.view.binding.ChildForm', {
                 xtype:'textfield',
                 name:'pb_name',
                 allowBlank:false,
-                fieldLabel:'类型'
+                fieldLabel:'物料品牌'
             }]
         },  
         productunit:{
@@ -156,6 +156,47 @@ Ext.define('KitchenSink.view.binding.ChildForm', {
                 name: 'wh_statuscode',
                 value:'OPEN'
             }]
+        },
+        maxnumbers:{
+            items:[{
+                xtype:'hidden',
+                name:'id'
+            },{
+                xtype:'textfield',
+                fieldLabel: '单据Caller',
+                name: 'mn_caller',
+                allowBlank:false
+            },{
+                xtype:'textfield',
+                fieldLabel: '单据前缀',
+                name: 'mn_leadcode',
+                allowBlank:false
+            },{
+                xtype:'combo',
+                fieldLabel: '单据规则',
+                name: 'mn_rule',
+                displayField : "display", 
+                editable:false,
+                hideTrigger : false, 
+                maxLength : 100.0, 
+                minValue : null, 
+                positiveNum : false, 
+                queryMode : "local", 
+                valueField : "value", 
+                store:{
+                    fields: ['display', 'value'],
+                    data : [
+                        {"display":"年月日", "value":'yyyymmdd'},
+                        {"display":"年月", "value":'yyyymm'}
+                    ]
+                }
+            },{
+                xtype:'numberfield',
+                hideTrigger : true, 
+                fieldLabel: '流水长度',
+                name: 'mn_number',
+                allowBlank:false
+            }]
         }
     },
     setFormItems:function() {
@@ -197,6 +238,7 @@ Ext.define('KitchenSink.view.binding.ChildForm', {
                 var dataField = form.down('[name='+name+']');
                 if(dataField&&dataField.value){
                     params[name] = dataField.value;
+                    params._value = dataField.value;
                 }
             }
         });
@@ -216,7 +258,9 @@ Ext.define('KitchenSink.view.binding.ChildForm', {
                     grid.store.load();
                 }
                 if(combo){
-                    combo.store.load();
+                    combo.store.load(function() {
+                        combo.setValue(params._value);
+                    });
                 }
                 form.ownerCt.close();
             }

+ 35 - 5
frontend/saas-web/app/view/document/kind/Kind.js

@@ -24,16 +24,20 @@ Ext.define('saas.view.document.kind.Kind', {
         bind:'{segmented}',
         items: [{
             text: '客户',
-            value: 'customerkind'
+            value: 'customerkind',
+            typeText:'客户类型'
         }, {
             text: '供应商',
-            value: 'vendorkind'
+            value: 'vendorkind',
+            typeText:'供应商类型'
         }, {
             text: '商品',
-            value: 'productkind'
+            value: 'productkind',
+            typeText:'商品类型'
         }, {
             text: '收支',
-            value: 'inoutkind'
+            value: 'inoutkind',
+            typeText:'收支类型'
         }],
         listeners: {
             toggle: 'onKindToggle'
@@ -167,6 +171,33 @@ Ext.define('saas.view.document.kind.Kind', {
             reqUrl: '/api/document/address/save',
             delUrl: '/api/document/address/delete'
         },
+        maxnumbers:{
+            columns: [{
+                text : "单据caller", 
+                width : 200.0, 
+                dataIndex : "mn_caller", 
+                xtype : "", 
+            }, 
+            {
+                text : "单据前缀", 
+                dataIndex : "mn_leadcode", 
+                width : 120.0, 
+                xtype : "", 
+            }, 
+            {
+                text : "单据规则", 
+                dataIndex : "mn_rule", 
+                width : 220.0, 
+                xtype : "", 
+            },{
+                text : "流水长度", 
+                dataIndex : "mn_number", 
+                width : 120.0, 
+                xtype : "", 
+            }],
+            keyField:'id',
+            reqUrl:'http://192.168.253.31:8920/number/save'
+        },
         warehouse:{
             columns: [{
                 text: '仓库编号',
@@ -187,7 +218,6 @@ Ext.define('saas.view.document.kind.Kind', {
                 xtype: 'actioncolumn',
                 align : 'center',
                 items: [{
-                    icon:'/api/resource/images/16/lock_bg.png',
                     tooltip: '锁定',
                     iconCls:'',
                     getClass: function(v, meta, rec) {

+ 3 - 2
frontend/saas-web/app/view/document/kind/KindController.js

@@ -32,7 +32,7 @@ Ext.define('saas.view.document.kind.KindController', {
        var columns=me.insertActionColumn(etc.columns);
         grid.reconfigure(store, columns);
         if(store) store.reload();
-        vm.set('title', button.text);
+        vm.set('title', button.typeText);
     },
     onAdd:function(){
         var me=this,
@@ -48,6 +48,7 @@ Ext.define('saas.view.document.kind.KindController', {
         if(columns.length>0 && columns[0].xtype!='actioncolumn'){
             return Ext.Array.insert(columns,0,[{
                 xtype:'actioncolumn',
+                text:'操作',
                 items: [{
                     tooltip: '编辑',
                     iconCls: 'x-fa fa-pencil fa-fw',
@@ -99,7 +100,7 @@ Ext.define('saas.view.document.kind.KindController', {
             autoScroll:true,
             xtype: 'document-kind-childwin',
             bind: {
-                title: record ? '修改{title}类型' : '新增{title}类型'
+                title: record ? '修改{title}' : '新增{title}'
             },
             dataKind:dataKind,
             belong:this.getView().etc[dataKind],

+ 2 - 2
frontend/saas-web/app/view/document/kind/KindModel.js

@@ -5,7 +5,7 @@ Ext.define('saas.view.document.kind.KindModel', {
     extend: 'Ext.app.ViewModel',
     alias: 'viewmodel.document-kind',
     data: {
-        title: '客户'
+        title: '客户类型'
     },
     stores: {
         customerkind: {
@@ -234,7 +234,7 @@ Ext.define('saas.view.document.kind.KindModel', {
                 }
             }
         },
-        productunit: {
+        productunit: {    
             fields:[
                 {name: 'id', type: 'int'},
                 {name: 'pu_name',  type: 'string'}

+ 6 - 1
frontend/saas-web/app/view/document/other/Address.js

@@ -19,7 +19,12 @@ Ext.define('saas.view.document.other.Address', {
         listeners: {
             click: 'onRefresh'
         }
-    }]
+    }],
+    listeners:{
+        afterrender:function(p){
+            p.getViewModel().setData({title:'采购地址'});
+        }
+    }
 })
 
 

+ 6 - 1
frontend/saas-web/app/view/document/other/BankInformation.js

@@ -19,7 +19,12 @@ Ext.define('saas.view.document.other.BankInformation', {
         listeners: {
             click: 'onRefresh'
         }
-    }]
+    }],
+    listeners:{
+        afterrender:function(p){
+            p.getViewModel().setData({title:'资金账户'});
+        }
+    }
 })
 
 

+ 6 - 1
frontend/saas-web/app/view/document/other/ProductBrand.js

@@ -19,7 +19,12 @@ Ext.define('saas.view.document.other.ProductBrand', {
         listeners: {
             click: 'onRefresh'
         }
-    }]
+    }],
+    listeners:{
+        afterrender:function(p){
+            p.getViewModel().setData({title:'物料品牌'});
+        }
+    }
 })
 
 

+ 6 - 1
frontend/saas-web/app/view/document/other/ProductUnit.js

@@ -19,7 +19,12 @@ Ext.define('saas.view.document.other.ProductUnit', {
         listeners: {
             click: 'onRefresh'
         }
-    }]
+    }],
+    listeners:{
+        afterrender:function(p){
+            p.getViewModel().setData({title:'物料单位'});
+        }
+    }
 })
 
 

+ 8 - 1
frontend/saas-web/app/view/document/other/Warehouse.js

@@ -3,6 +3,8 @@ Ext.define('saas.view.document.other.Warehouse', {
     xtype: 'other-warehouse',
     autoScroll: true,
     layout:'fit',
+    _openUrl:'/api/document/warehouse/open',
+    _closeUrl:'/api/document/warehouse/close',
     defaultType:'warehouse',
     tbar: ['->',{
         xtype:'button',
@@ -16,5 +18,10 @@ Ext.define('saas.view.document.other.Warehouse', {
         listeners: {
             click: 'onRefresh'
         }
-    }]
+    }],
+    listeners:{
+        afterrender:function(p){
+            p.getViewModel().setData({title:'仓库'});
+        }
+    }
 })

+ 3 - 3
frontend/saas-web/app/view/document/product/FormController.js

@@ -65,7 +65,7 @@ Ext.define('saas.view.document.product.FormController', {
 
                 }
             },
-            //从表单选放大镜赋值关系 以及 tpl模板
+            // 仓库编号
             'dbfindtrigger[name=pr_whcode]':{
                 beforerender:function(f){
                     Ext.apply(f,{
@@ -146,10 +146,10 @@ Ext.define('saas.view.document.product.FormController', {
         })
         .then(function(localJson) {
             if(localJson.success){
-                showToast('启用成功');
                 form.initId = localJson.data.id;
                 form.FormUtil.loadData(form);
                 viewModel.set('base.editable', false);
+                showToast('启用成功');
             }
         })
         .catch(function(res) {
@@ -169,10 +169,10 @@ Ext.define('saas.view.document.product.FormController', {
         })
         .then(function(localJson) {
             if(localJson.success){
-                showToast('禁用成功');
                 form.initId = localJson.data.id;
                 form.FormUtil.loadData(form);
                 viewModel.set('base.editable', false);
+                showToast('禁用成功');
             }
         })
         .catch(function(res) {

+ 9 - 32
frontend/saas-web/app/view/document/product/FormPanel.js

@@ -64,7 +64,7 @@ Ext.define('saas.view.document.product.FormPanel', {
             this.dialog = form.getController().getView().add({
                 xtype: 'document-kind-childwin',
                 bind: {
-                    title: '新增供应商类型'
+                    title: '新增物料类型'
                 },
                 dataKind:'productkind',
                 belong:document.etc['productkind'],
@@ -162,14 +162,12 @@ Ext.define('saas.view.document.product.FormPanel', {
         allowBlank : true, 
         columnWidth : 0.25
     },{
-        format : "Y-m-d",
         xtype : "datefield", 
         name : "createTime", 
         fieldLabel : "创建时间", 
         allowBlank : true, 
         columnWidth : 0.25
     },{  
-        format : "Y-m-d",
         xtype : "datefield", 
         name : "updateTime", 
         fieldLabel : "更新时间", 
@@ -177,33 +175,12 @@ Ext.define('saas.view.document.product.FormPanel', {
         columnWidth : 0.25
     }],
 
-    /**
-     * 一些初始化viewModel的方法
-     */
-    initViewModel: function() {
-        var me = this,
-        codeField = me._codeField,
-        statusField = me._statusField,
-        statusCodeField = me._statusCodeField,
-        viewModel = me.getViewModel();
-        
-        viewModel.set(codeField, '');
-        viewModel.set('createTime', new Date());
-        viewModel.set('updateTime', new Date());
-
-        if(statusCodeField) {
-            var o = {};
-            o['auditBtnText'] = {
-                bind: '{' + statusCodeField + '}',
-                get: function(value) {
-                    viewModel.set(statusField, value == 'OPEN' ? '已开启' : '已关闭');
-                    return value == 'OPEN' ? '禁用' : '启用'
-                }
-            };
-            viewModel.setFormulas(o);
-            viewModel.set(statusCodeField, "OPEN");
-        }else {
-            viewModel.set('auditBtnText', "禁用");
-        }
-    }
+    auditTexts: {
+        auditCode: 'OPEN',
+        auditText: '已开启',
+        unAuditCode: 'CLOSE',
+        unAuditText: '已关闭',
+        auditBtnText: '启用',
+        unAuditBtnText: '禁用',
+    },
 });

Some files were not shown because too many files changed in this diff