Browse Source

Merge branch 'dev' of ssh://10.10.100.21/source/saas-platform into dev

hy 7 years ago
parent
commit
dbd032f029
100 changed files with 2658 additions and 241 deletions
  1. 1 1
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java
  2. 6 0
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/po/BillCodeSeq.java
  3. 2 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/ConfigsMapper.java
  4. 16 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/ConfigsServiceImpl.java
  5. 2 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/SystemRemindServiceImpl.java
  6. 3 0
      applications/commons/commons-server/src/main/resources/mapper/ConfigsMapper.xml
  7. 6 4
      applications/document/document-api/src/main/java/com/usoftchina/saas/document/api/VendorApi.java
  8. 2 0
      applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/CustomerDTO.java
  9. 2 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Customer.java
  10. 2 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Vendor.java
  11. 2 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/BankinformationMapper.java
  12. 20 5
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BankinformationServiceImpl.java
  13. 27 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java
  14. 3 3
      applications/document/document-server/src/main/resources/application.yml
  15. 6 1
      applications/document/document-server/src/main/resources/mapper/BankinformationMapper.xml
  16. 5 4
      applications/document/document-server/src/main/resources/mapper/CustomerMapper.xml
  17. 3 3
      applications/document/document-server/src/main/resources/mapper/VendorMapper.xml
  18. 40 0
      applications/money/money-dto/src/main/java/com/usoftchina/saas/money/dto/ApcheckDTO.java
  19. 3 0
      applications/money/money-dto/src/main/java/com/usoftchina/saas/money/dto/VerificationListDTO.java
  20. 36 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Fundtransfer.java
  21. 3 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/VerificationList.java
  22. 1 1
      applications/money/money-server/src/main/resources/application.yml
  23. 7 1
      applications/money/money-server/src/main/resources/mapper/FundtransferMapper.xml
  24. 1 1
      applications/money/money-server/src/main/resources/mapper/ProfitdetailMapper.xml
  25. 3 1
      applications/money/money-server/src/main/resources/mapper/VerificationListMapper.xml
  26. 3 3
      applications/money/money-server/src/main/resources/mapper/VerificationMapper.xml
  27. 35 0
      applications/purchase/purchase-api/src/main/java/com/usoftchina/saas/purchase/api/ProdInOutApi.java
  28. 2 1
      applications/purchase/purchase-api/src/main/java/com/usoftchina/saas/purchase/api/PurchaseApi.java
  29. 13 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/ProdInOutController.java
  30. 2 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/ProdInOut.java
  31. 7 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/ProdInOutService.java
  32. 49 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java
  33. 9 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  34. 3 3
      applications/purchase/purchase-server/src/main/resources/application.yml
  35. 3 0
      applications/purchase/purchase-server/src/main/resources/mapper/ProdInOutMapper.xml
  36. 3 3
      applications/sale/sale-server/src/main/resources/application.yml
  37. 0 28
      applications/transfers/mall-api/src/main/java/com/usoftchina/saas/inquiry/api/B2BPurchaseApi.java
  38. 4 1
      applications/transfers/mall-api/src/main/java/com/usoftchina/saas/inquiry/api/InquiryApi.java
  39. 72 0
      applications/transfers/mall-api/src/main/java/com/usoftchina/saas/inquiry/api/InquiryApiFallback.java
  40. 1 1
      applications/transfers/mall-api/src/main/java/com/usoftchina/saas/inquiry/api/SearchUUApi.java
  41. 55 0
      applications/transfers/mall-api/src/main/java/com/usoftchina/saas/inquiry/po/purchase/PurchaseDetailEnd.java
  42. 207 0
      applications/transfers/mall-api/src/main/java/com/usoftchina/saas/inquiry/po/purchase/PurchaseProdInOut.java
  43. 132 0
      applications/transfers/mall-api/src/main/java/com/usoftchina/saas/inquiry/po/purchase/PurchaseProdInOutDetail.java
  44. 1 1
      applications/transfers/mall-api/src/test/resources/application.yml
  45. 2 2
      applications/transfers/transfers-api/src/main/java/com/usoftchina/saas/transfers/api/SendMessageApi.java
  46. 0 19
      applications/transfers/transfers-api/src/main/java/com/usoftchina/saas/transfers/api/SendMessageApiFallBack.java
  47. 48 0
      applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/config/B2BConfig.java
  48. 12 4
      applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/controller/ApCheckController.java
  49. 6 0
      applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/controller/SaleDownController.java
  50. 2 0
      applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/mapper/ApcheckMapper.java
  51. 2 0
      applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/mapper/SaledownMapper.java
  52. 13 2
      applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/service/ReceiveService.java
  53. 11 0
      applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/service/impl/ApCheckServiceImpl.java
  54. 19 0
      applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/service/impl/SaleDownServiceImpl.java
  55. 1 1
      applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/Executable.java
  56. 65 0
      applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseEndTask.java
  57. 77 0
      applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseInResTask.java
  58. 73 4
      applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseInTask.java
  59. 76 0
      applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseOutResTask.java
  60. 67 4
      applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseOutTask.java
  61. 58 7
      applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseTask.java
  62. 35 0
      applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/utils/SendUtil.java
  63. 4 1
      applications/transfers/transfers-server/src/main/resources/application.yml
  64. 4 0
      applications/transfers/transfers-server/src/main/resources/mapper/ApcheckMapper.xml
  65. 4 0
      applications/transfers/transfers-server/src/main/resources/mapper/SaledownMapper.xml
  66. 94 0
      applications/transfers/transfers-server/src/test/java/com/usoftchina/saas/transfers/task/SendTaskTest.java
  67. 10 2
      base-servers/account/account-api/src/main/java/com/usoftchina/saas/account/api/AccountApi.java
  68. 11 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/AccountController.java
  69. 0 12
      frontend/saas-portal-web/src/components/conenter/home.vue
  70. 2 1
      frontend/saas-portal-web/static/css/main.css
  71. 14 0
      frontend/saas-web/app/model/report/Purchase.js
  72. 16 2
      frontend/saas-web/app/model/report/Sale.js
  73. 29 6
      frontend/saas-web/app/model/report/SaleProfit.js
  74. 1 1
      frontend/saas-web/app/view/core/base/BasePanel.js
  75. 6 1
      frontend/saas-web/app/view/core/dbfind/ConDbfindTrigger.js
  76. 4 4
      frontend/saas-web/app/view/core/form/FormPanel.js
  77. 6 2
      frontend/saas-web/app/view/core/form/FormPanelModel.js
  78. 3 3
      frontend/saas-web/app/view/core/report/ReportPanel.js
  79. 19 19
      frontend/saas-web/app/view/document/customer/FormPanel.js
  80. 164 0
      frontend/saas-web/app/view/document/uusetting/UUSetting.js
  81. 79 0
      frontend/saas-web/app/view/document/uusetting/UUSettingController.js
  82. 83 0
      frontend/saas-web/app/view/document/uusetting/UUSettingModel.js
  83. 459 0
      frontend/saas-web/app/view/document/uusetting/UUSettingWin.js
  84. 20 20
      frontend/saas-web/app/view/document/vendor/FormPanel.js
  85. 1 0
      frontend/saas-web/app/view/home/HomeController.js
  86. 7 7
      frontend/saas-web/app/view/money/fundtransfer/FormPanel.js
  87. 53 8
      frontend/saas-web/app/view/money/fundtransfer/QueryPanel.js
  88. 7 1
      frontend/saas-web/app/view/money/othreceipts/FormPanel.js
  89. 24 0
      frontend/saas-web/app/view/money/othreceipts/QueryPanel.js
  90. 7 1
      frontend/saas-web/app/view/money/othspendings/FormPanel.js
  91. 24 0
      frontend/saas-web/app/view/money/othspendings/QueryPanel.js
  92. 7 1
      frontend/saas-web/app/view/money/payBalance/FormPanel.js
  93. 1 1
      frontend/saas-web/app/view/money/payBalance/FormPanelController.js
  94. 24 0
      frontend/saas-web/app/view/money/payBalance/QueryPanel.js
  95. 7 1
      frontend/saas-web/app/view/money/recBalance/FormPanel.js
  96. 24 0
      frontend/saas-web/app/view/money/recBalance/QueryPanel.js
  97. 4 1
      frontend/saas-web/app/view/money/report/AccountDetails.js
  98. 1 1
      frontend/saas-web/app/view/money/report/TotalRecDetail.js
  99. 45 15
      frontend/saas-web/app/view/money/verification/FormPanel.js
  100. 20 20
      frontend/saas-web/app/view/money/verification/FormPanelController.js

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

@@ -83,7 +83,7 @@ public enum BizExceptionCode implements BaseExceptionCode {
     PURCHASE_DETAIL_OVERNUM(70001, "明细行数量超过来源采购验收单明细行数量"),
     PURCHASE_ORDER_HASAUDIT(70002, "存在已审核单据,单据编号:%s"),
     PURCHASE_ORDER_HASUNAUDIT(70003, "存在未审核单据,单据编号:%s"),
-    PURCHASE_ORDER_HASUPLOAD(70004, "采购单已上传B2B,不允许反审核"),
+    PURCHASE_ORDER_HASUPLOAD(70004, "已上传优软商务平台的采购订单不允许反审核,如交易信息发生变更请关闭该订单重新新增订单"),
 
 
     //销售

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

@@ -62,6 +62,12 @@ public enum  BillCodeSeq {
 
     BOM("BOM资料", "Bom"),
 
+    PURCHASEEND("采购单结案", "PURCHASEEND"),
+
+    PURCHASEINRES("采购验收单反过账","PURCHASEINRES"),
+
+    PURCHASEOUTRES("采购验退单反过账","PURCHASEINRES"),
+
     APCHECK("对账单", "APCHECK");
 
 

+ 2 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/ConfigsMapper.java

@@ -23,4 +23,6 @@ public interface ConfigsMapper {
     void updateCreator(@Param("userId") Long userId, @Param("userName") String userName, @Param("id") Long id);
 
     void updateByCodeSelective(Configs con);
+
+    int selectByCodeAndCompanyId(@Param("code") String code, @Param("companyId") Long companyId);
 }

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

@@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -109,6 +110,21 @@ public class ConfigsServiceImpl implements ConfigsService{
                 currencyDTO.setCr_name(con.getData());
                 currencyDTO.setCr_standard(1L);
                 currencyApi.setStandard(currencyDTO);
+            } else if("enableB2B".equals(con.getCode())){
+                int count = configsMapper.selectByCodeAndCompanyId(con.getCode(), BaseContextHolder.getCompanyId());
+                if (count == 0){
+                    //不存在,则插入
+                    Configs configs = new Configs();
+                    configs.setCode(con.getCode());
+                    configs.setDescription("启用B2B");
+                    configs.setData(con.getData());
+                    configs.setCompanyId(BaseContextHolder.getCompanyId());
+                    configs.setCreateTime(new Date());
+                    configs.setCreatorName(BaseContextHolder.getUserName());
+                    configs.setCreatorId(Integer.parseInt(String.valueOf(BaseContextHolder.getUserId())));
+                    configsMapper.insertSelective(configs);
+                    continue;
+                }
             }
             configsMapper.updateByCodeSelective(con);
         }

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

@@ -100,6 +100,8 @@ public class SystemRemindServiceImpl implements SystemRemindService {
                 accountApi.bindCompany(accountDTO.getId(), BaseContextHolder.getCompanyId());
                 //绑定角色
                 accountApi.bindRoles(accountDTO.getId(), addApplyDTO.getRoles());
+                //账户缓存清除
+                accountApi.clearCache(accountDTO.getId());
             }
         }
         //更新申请单状态

+ 3 - 0
applications/commons/commons-server/src/main/resources/mapper/ConfigsMapper.xml

@@ -180,5 +180,8 @@
     </set>
     where code = #{code,jdbcType=VARCHAR} and companyid = #{companyId}
   </update>
+  <select id="selectByCodeAndCompanyId" resultType="int">
+    SELECT COUNT(*) FROM CONFIGS WHERE CODE = #{code} AND COMPANYID = #{companyId}
+  </select>
 
 </mapper>

+ 6 - 4
applications/document/document-api/src/main/java/com/usoftchina/saas/document/api/VendorApi.java

@@ -3,9 +3,11 @@ package com.usoftchina.saas.document.api;
 import com.usoftchina.saas.auth.client.interceptor.ServiceFeignInterceptor;
 import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.document.dto.VendorDTO;
+import com.usoftchina.saas.document.dto.VendorListDTO;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
@@ -14,10 +16,10 @@ import java.util.List;
 public interface VendorApi {
 
     /**
-     * 查询Vendors
-     * @param condition
+     * 通过供应商ID查找  供应商主从表数据
+     * @param id
      * @return
      */
-    /*@GetMapping("/api/document/vendor/getVendorsByCondition")
-    public List<VendorDTO> getVendorsByCondition(@RequestParam(value = "page") PageRequest page, @RequestParam(value = "condition") String condition);*/
+    @GetMapping("/read/{id}")
+    Result<VendorListDTO> getDataById(@PathVariable("id") Long id);
 }

+ 2 - 0
applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/CustomerDTO.java

@@ -63,4 +63,6 @@ public class CustomerDTO extends CommonBaseDTO implements Serializable {
     private String cu_remark;
 
     private String cu_currency;
+
+    private Double cr_rate;
 }

+ 2 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Customer.java

@@ -59,4 +59,6 @@ public class Customer extends CommonBaseEntity implements Serializable {
     private String cu_remark;
 
     private String cu_currency;
+
+    private Double cr_rate;
 }

+ 2 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Vendor.java

@@ -117,4 +117,6 @@ public class Vendor extends CommonBaseEntity implements Serializable{
 
     private String ve_currency;
 
+    private Double cr_rate;
+
 }

+ 2 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/BankinformationMapper.java

@@ -38,4 +38,6 @@ public interface BankinformationMapper extends CommonBaseMapper<Bankinformation>
 
     int getBankNameSame(@Param("name") String name, @Param("companyId") Long company);
 
+    int getBankNameSameById(@Param("name") String name, @Param("id") Long id, @Param("companyId") Long company);
+
 }

+ 20 - 5
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BankinformationServiceImpl.java

@@ -53,11 +53,6 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
     @Transactional
     @Override
     public boolean save(Bankinformation bankinformation){
-        //判断账户名称是否存在
-        if (bankinformationMapper.getBankNameSame(bankinformation.getBk_bankname(), BaseContextHolder.getCompanyId()) > 0){
-            throw new BizException(BIZ_SAME.getCode(),BIZ_SAME.getMessage());
-        }
-
         bankinformation.setCompanyId(BaseContextHolder.getCompanyId());
         bankinformation.setBk_income(new Double(0));
         bankinformation.setBk_spending(new Double(0));
@@ -84,6 +79,16 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
             docBaseDTO.setName(BillCodeSeq.BANKINFORMATION.getCaller());
             messageLogService.save(docBaseDTO);
             Banksubledger banksubledger = this.changBanksubledger(bankinformation);
+
+            //判断账户名称是否存在
+            if (bankinformationMapper.getBankNameSame(bankinformation.getBk_bankname(), BaseContextHolder.getCompanyId()) > 1){
+                throw new BizException(BIZ_SAME.getCode(),BIZ_SAME.getMessage());
+            }else if (bankinformationMapper.getBankNameSame(bankinformation.getBk_bankname(), BaseContextHolder.getCompanyId()) == 1){
+                if (bankinformationMapper.getBankNameSameById(bankinformation.getBk_bankname(), docBaseDTO.getId(),
+                        BaseContextHolder.getCompanyId()) == 1){
+                    throw new BizException(BIZ_SAME.getCode(),BIZ_SAME.getMessage());
+                }
+            }
             banksubledgerMapper.insertSelective(banksubledger);
         }else {
             docBaseDTO = this.getBaseDTOById(bid);
@@ -108,6 +113,16 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
                 }
             }
 
+
+            //判断账户名称是否存在
+            if (bankinformationMapper.getBankNameSame(bankinformation.getBk_bankname(), BaseContextHolder.getCompanyId()) > 1){
+                throw new BizException(BIZ_SAME.getCode(),BIZ_SAME.getMessage());
+            }else if (bankinformationMapper.getBankNameSame(bankinformation.getBk_bankname(), BaseContextHolder.getCompanyId()) == 1){
+                if (bankinformationMapper.getBankNameSameById(bankinformation.getBk_bankname(), docBaseDTO.getId(),
+                        BaseContextHolder.getCompanyId()) == 1){
+                    throw new BizException(BIZ_SAME.getCode(),BIZ_SAME.getMessage());
+                }
+            }
 //            Long id = bankinformationMapper.selectBankId(bankinformation.getBk_bankcode(), BaseContextHolder.getCompanyId());
             if (bktion > 0){
                     bankinformationMapper.updateByPrimaryKeySelective(bankinformation);

+ 27 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java

@@ -161,6 +161,9 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
                 validEnableUpdateCode(product.getId());
             }
 
+            //上传至B2B
+            uploadChangeToB2B(product);
+
             //明细数据有更新/插入动作
             if (productDetailList.size() > 0){
                 //物料发生过除库存初始化外的出入库单时,不能新增,修改,删除
@@ -222,6 +225,21 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
         return docBaseDTO;
     }
 
+    /**
+     * 物料规格/型号/品牌三者任何一个发生变化时,将物料的B2B上传状态更新为 "待上传",
+     * 用户在下一次点击上传产品库时一起上传至B2B
+     * @param product
+     */
+    private void uploadChangeToB2B(Product product) {
+        if (ConfigsCache.current().enableB2B()){
+            Product oldProduct = getMapper().selectByPrimaryKey(product.getId());
+            if (!oldProduct.getPr_spec().equals(product.getPr_spec()) || !oldProduct.getPr_orispeccode().equals(product.getPr_orispeccode())
+                || !oldProduct.getPr_brand().equals(product.getPr_brand())){
+                updateB2BStatus(String.valueOf(product.getId()), "待上传");
+            }
+        }
+    }
+
     /**
      * 校验明细仓库是否重复
      * @param productDetailList
@@ -756,8 +774,17 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
     public void uploadToB2B() {
         boolean enable = ConfigsCache.current().enableB2B();
         if (enable) {
+            //生成消息
             MessageInfo messageInfo = new MessageInfo(BaseContextHolder.getUserId(), BillCodeSeq.PRODUCT.name(), "", BaseContextHolder.getCompanyId());
             sendMessageApi.sendMsg(messageInfo);
+            //更新状态为  上传中
+            List<ProductUploadDTO> productUploadDTOList = getMapper().selectUploadProdByCompanyId(BaseContextHolder.getCompanyId());
+            StringBuilder sb = new StringBuilder();
+            Iterator<ProductUploadDTO> it = productUploadDTOList.iterator();
+            while (it.hasNext()){
+                sb.append(it.next().getPr_id() + ",");
+            }
+            updateB2BStatus(sb.substring(0, sb.length() - 1), "上传中");
         }else {
             throw new BizException(BizExceptionCode.BIZ_ENABLE_B2B);
         }

+ 3 - 3
applications/document/document-server/src/main/resources/application.yml

@@ -75,8 +75,8 @@ mybatis:
 auth:
   public-key: auth/pub.key
 ribbon:
-  ReadTimeout: 5000
-  ConnectTimeout: 5000
+  ReadTimeout: 10000
+  ConnectTimeout: 10000
 feign:
   hystrix:
     enabled: true
@@ -96,4 +96,4 @@ b2b:
     inquiry: https://test-inquiry.uuzcc.cn
     Component: https://test-mall.uuzcc.cn
     product: http://test-product.uuzcc.cn
-    uu: https://test-b2b.uuzcc.cn
+    common: https://test-b2b.uuzcc.cn

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

@@ -24,6 +24,7 @@
     <result column="bk_spending" property="bk_spending" jdbcType="DOUBLE" />
     <result column="bk_income" property="bk_income" jdbcType="DOUBLE" />
     <result column="bk_currency" property="bk_currency" jdbcType="VARCHAR" />
+    <result column="cr_rate" property="cr_rate" jdbcType="DOUBLE" />
   </resultMap>
   <resultMap id="ResultMapWithBLOBs" type="com.usoftchina.saas.document.entities.Bankinformation" extends="BaseResultMap" >
     <result column="bk_remark" property="bk_remark" jdbcType="LONGVARCHAR" />
@@ -318,7 +319,7 @@
 
   <select id="selectBankinformationBycondition" resultMap="BaseResultMap">
     select
-    <include refid="Base_Column_List" />
+    <include refid="Base_Column_List" /> ,cr_rate
     from bankinformation
     left join currencys on currencys.companyId = Bankinformation.companyid and cr_name = bk_currency
     <where>
@@ -370,4 +371,8 @@
   <select id="getBankNameSame" resultType="int">
     select count(*) from bankinformation where bk_bankname = #{name} and companyId =#{companyId}
   </select>
+
+  <select id="getBankNameSameById" resultType="int">
+    select count(*) from bankinformation where bk_bankname = #{name} and bk_id != #{id} and companyId =#{companyId}
+  </select>
 </mapper>

+ 5 - 4
applications/document/document-server/src/main/resources/mapper/CustomerMapper.xml

@@ -32,18 +32,19 @@
     <result column="cu_preamount" jdbcType="DOUBLE" property="cu_preamount" />
     <result column="cu_remark" jdbcType="VARCHAR" property="cu_remark" />
     <result column="cu_currency" jdbcType="VARCHAR" property="cu_currency" />
+    <result column="cr_rate" jdbcType="DOUBLE" property="cr_rate" />
   </resultMap>
   <sql id="Base_Column_List">
     cu_id, cu_code,cu_shortname, cu_name, cu_uu, cu_type, cu_begindate, cu_beginaramount, cu_beginprerecamount,
     cu_promisedays, cu_taxrate, cu_sellerid, cu_sellercode, cu_sellername, cu_credit, 
-    cu_status, cu_statuscode, companyid,
-    updaterid, updatetime, cu_text1, cu_text2, cu_text3, cu_text4, cu_text5, cu_leftamount, 
-    cu_recamount,cu_preamount,cu_remark,cu_currency
+    cu_status, cu_statuscode, customer.companyid companyid,
+    customer.updaterid updaterid, customer.updatetime updatetime, cu_text1, cu_text2, cu_text3, cu_text4, cu_text5, cu_leftamount,
+    cu_recamount,cu_preamount,cu_remark,cu_currency,cr_rate
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     select
     <include refid="Base_Column_List" />
-    from customer
+    from customer left join currencys on cr_name = cu_currency and customer.companyId = currencys.companyId
     where cu_id = #{cu_id,jdbcType=INTEGER}
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">

+ 3 - 3
applications/document/document-server/src/main/resources/mapper/VendorMapper.xml

@@ -118,14 +118,14 @@
     <sql id="Base_Column_List" >
         ve_id, ve_code, ve_shortname,ve_name, ve_uu, ve_type, ve_begindate, ve_beginapamount, ve_beginprepayamount,
         ve_promisedays, ve_taxrate, ve_nsrzh, ve_bankaccount, ve_bankcode, ve_status, ve_statuscode,
-        companyId, updaterId, updateTime, ve_text1,
+        vendor.companyId companyId, vendor.updaterId updaterId, vendor.updateTime updateTime, ve_text1,
         ve_text2, ve_text3, ve_text4, ve_text5, ve_payamount, ve_leftamount, ve_beginym, ve_preamount,ve_remark,
-        ve_buyerid,ve_buyercode,ve_buyername,ve_address,ve_currency
+        ve_buyerid,ve_buyercode,ve_buyername,ve_address,ve_currency,cr_rate
     </sql>
     <select id="selectByPrimaryKey" resultMap="VendorResultMapper" parameterType="java.lang.Long" >
         select
         <include refid="Base_Column_List" />
-        from vendor
+        from vendor left join currencys on cr_name = ve_currency and vendor.companyId = currencys.companyId
         where ve_id = #{id}
     </select>
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >

+ 40 - 0
applications/money/money-dto/src/main/java/com/usoftchina/saas/money/dto/ApcheckDTO.java

@@ -1,5 +1,7 @@
 package com.usoftchina.saas.money.dto;
 
+import io.swagger.annotations.ApiModelProperty;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -9,36 +11,52 @@ import java.util.Date;
  **/
 public class ApcheckDTO implements Serializable {
 
+    @ApiModelProperty(value = "平台来源Id")
     private Long ac_b2bid;//平台来源Id
 
+    @ApiModelProperty(value = "对账日期")
     private Date ac_date;//对账日期
 
+    @ApiModelProperty(value = "应付日期")
     private Date ac_apdate;//应付日期
 
+    @ApiModelProperty(value = "对账起始日期")
     private Date ac_fromdate;//对账起始日期
 
+    @ApiModelProperty(value = "对账截至日期")
     private Date ac_todate;//对账截至日期
 
+    @ApiModelProperty(value = "供应商uu")
     private Long ac_venduu;//供应商uu
 
+    @ApiModelProperty(value = "币别")
     private String ac_currency;//币别
 
+    @ApiModelProperty(value = "汇率")
     private Double ac_rate;//汇率
 
+    @ApiModelProperty(value = "对账金额")
     private Double ac_checkamount;//对账金额
 
+    @ApiModelProperty(value = "备注")
     private String ac_remark;//备注
 
+    @ApiModelProperty(value = "本期应付金额")
     private Double ac_thisamount;//本期应付金额
 
+    @ApiModelProperty(value = "本期未对账")
     private Double ac_thisuncheck;//本期未对账
 
+    @ApiModelProperty(value = "本期已付")
     private Double ac_thispay;//本期已付
 
+    @ApiModelProperty(value = "本期发货")
     private Double ac_thissend;//本期发货
 
+    @ApiModelProperty(value = "本期已对账")
     private Double ac_thischeck;//本期已对账
 
+    @ApiModelProperty(value = "应付总额")
     private Double ac_payamont;//应付总额
 
     public Long getAc_b2bid() {
@@ -168,4 +186,26 @@ public class ApcheckDTO implements Serializable {
     public void setAc_payamont(Double ac_payamont) {
         this.ac_payamont = ac_payamont;
     }
+
+    @Override
+    public String toString() {
+        return "ApcheckDTO{" +
+                "ac_b2bid=" + ac_b2bid +
+                ", ac_date=" + ac_date +
+                ", ac_apdate=" + ac_apdate +
+                ", ac_fromdate=" + ac_fromdate +
+                ", ac_todate=" + ac_todate +
+                ", ac_venduu=" + ac_venduu +
+                ", ac_currency='" + ac_currency + '\'' +
+                ", ac_rate=" + ac_rate +
+                ", ac_checkamount=" + ac_checkamount +
+                ", ac_remark='" + ac_remark + '\'' +
+                ", ac_thisamount=" + ac_thisamount +
+                ", ac_thisuncheck=" + ac_thisuncheck +
+                ", ac_thispay=" + ac_thispay +
+                ", ac_thissend=" + ac_thissend +
+                ", ac_thischeck=" + ac_thischeck +
+                ", ac_payamont=" + ac_payamont +
+                '}';
+    }
 }

+ 3 - 0
applications/money/money-dto/src/main/java/com/usoftchina/saas/money/dto/VerificationListDTO.java

@@ -128,4 +128,7 @@ public class VerificationListDTO implements Serializable {
     private String vcd_text4;
 
     private String vcd_text5;
+    private String vc_currency;
+
+    private Double vc_rate;
 }

+ 36 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Fundtransfer.java

@@ -44,6 +44,42 @@ public class Fundtransfer extends CommonBaseEntity implements Serializable {
 
     private Date ft_auditdate;
 
+    private String ftd_currency;
+    private String ftd_incurrency;
+    private Double ftd_innowbalance;
+    private Double ftd_rate;
+
+    public String getFtd_currency() {
+        return ftd_currency;
+    }
+
+    public void setFtd_currency(String ftd_currency) {
+        this.ftd_currency = ftd_currency;
+    }
+
+    public String getFtd_incurrency() {
+        return ftd_incurrency;
+    }
+
+    public void setFtd_incurrency(String ftd_incurrency) {
+        this.ftd_incurrency = ftd_incurrency;
+    }
+
+    public Double getFtd_innowbalance() {
+        return ftd_innowbalance;
+    }
+
+    public void setFtd_innowbalance(Double ftd_innowbalance) {
+        this.ftd_innowbalance = ftd_innowbalance;
+    }
+
+    public Double getFtd_rate() {
+        return ftd_rate;
+    }
+
+    public void setFtd_rate(Double ftd_rate) {
+        this.ftd_rate = ftd_rate;
+    }
 
     public String getFtd_remark() {
         return ftd_remark;

+ 3 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/VerificationList.java

@@ -96,6 +96,9 @@ public class VerificationList extends CommonBaseEntity implements Serializable {
     private String vd_text4;
 
     private String vd_text5;
+    private String vc_currency;
+
+    private Double vc_rate;
 //
 //    private Integer vcd_id;
 //

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

@@ -82,4 +82,4 @@ b2b:
     inquiry: https://test-inquiry.uuzcc.cn
     Component: https://test-mall.uuzcc.cn
     product: http://test-product.uuzcc.cn
-    uu: https://test-b2b.uuzcc.cn
+    common: https://test-b2b.uuzcc.cn

+ 7 - 1
applications/money/money-server/src/main/resources/mapper/FundtransferMapper.xml

@@ -27,6 +27,11 @@
     <result column="ft_auditman" property="ft_auditman" jdbcType="VARCHAR" />
     <result column="ft_auditdate" property="ft_auditdate" jdbcType="TIMESTAMP" />
     <result column="createTime" property="createTime" jdbcType="TIMESTAMP" />
+
+    <result column="ftd_currency" property="ftd_currency" jdbcType="VARCHAR" />
+    <result column="ftd_incurrency" property="ftd_incurrency" jdbcType="VARCHAR" />
+    <result column="ftd_innowbalance" property="ftd_innowbalance" jdbcType="DOUBLE" />
+    <result column="ftd_rate" property="ftd_rate" jdbcType="DOUBLE" />
   </resultMap>
   <sql id="Base_Column_List" >
     ft_id, ft_code, ft_date, ft_status, ft_statuscode,
@@ -35,7 +40,8 @@
     ft_auditman, ft_auditdate
   </sql>
   <sql id="Detail_Column_List" >
-    ftd_bankname,ftd_inbankname,ftd_nowbalance,ftd_paymethod,ftd_paycode,ftd_remark
+    ftd_bankname,ftd_inbankname,ftd_nowbalance,ftd_paymethod,ftd_paycode,ftd_remark,ftd_currency,
+    ftd_incurrency,ftd_innowbalance,ftd_rate
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
     select 

+ 1 - 1
applications/money/money-server/src/main/resources/mapper/ProfitdetailMapper.xml

@@ -98,7 +98,7 @@ prodinout.companyid= prodiodetail.companyid
 		pi_custname,
 		cu_type,
 		cu_sellername,
-		SUM( (IFNULL( pd_sendprice, 0 ) * ( IFNULL( pd_outqty, 0 ) - IFNULL( pd_inqty, 0 ) )) * ifnull(cr_rate,1) ) AS saamount,,
+		SUM( (IFNULL( pd_sendprice, 0 ) * ( IFNULL( pd_outqty, 0 ) - IFNULL( pd_inqty, 0 ) )) * ifnull(cr_rate,1) ) AS saamount,
 		SUM(
 		IFNULL(pd_netprice,0) * (IFNULL(pd_outqty,0) - IFNULL(pd_inqty,0))
 		) AS netamount,

+ 3 - 1
applications/money/money-server/src/main/resources/mapper/VerificationListMapper.xml

@@ -40,11 +40,13 @@
         <result column="vd_amount" property="vd_amount" jdbcType="DOUBLE" />
         <result column="vd_nowbalance" property="vd_nowbalance" jdbcType="DOUBLE" />
         <result column="vd_remark" property="vd_remark" jdbcType="VARCHAR" />
+        <result column="vc_rate" property="vc_rate" jdbcType="DOUBLE" />
+        <result column="vc_currency" property="vc_currency" jdbcType="VARCHAR" />
 
     </resultMap>
     <sql id="Base_Column_List">
     vc_id, vc_code, vc_kind, vc_date, vc_vendid, vc_vendcode ,vc_custcode ,vc_custid ,vc_amount1,
-    vc_status,vc_statuscode,vc_vendname,vc_custname
+    vc_status,vc_statuscode,vc_vendname,vc_custname,vc_currency,vc_rate
   </sql>
     <select id="selectVerificationListByCondition"  resultMap="BaseResultMap">
         select

+ 3 - 3
applications/money/money-server/src/main/resources/mapper/VerificationMapper.xml

@@ -346,12 +346,12 @@
       <if test="createTime != null" >
         #{createTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="vc_rate != null" >
-        #{vc_rate,jdbcType=DOUBLE},
-      </if>
       <if test="vc_currency != null" >
         #{vc_currency,jdbcType=VARCHAR},
       </if>
+      <if test="vc_rate != null" >
+        #{vc_rate,jdbcType=DOUBLE},
+      </if>
     </trim>
     <selectKey resultType="Long" keyProperty="id" order="AFTER">
       SELECT LAST_INSERT_ID()

+ 35 - 0
applications/purchase/purchase-api/src/main/java/com/usoftchina/saas/purchase/api/ProdInOutApi.java

@@ -0,0 +1,35 @@
+package com.usoftchina.saas.purchase.api;
+
+import com.usoftchina.saas.auth.client.interceptor.ServiceFeignInterceptor;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.purchase.dto.ProdInOutFormDTO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+/**
+ * @Author chenwei
+ * @Date 2019/01/16
+ */
+@FeignClient(name = "purchase-server", configuration = ServiceFeignInterceptor.class)
+public interface ProdInOutApi {
+
+    /**
+     * 获取出入库单表单
+     *
+     * @return
+     */
+    @GetMapping("/prodinout/read/{id}")
+    Result<ProdInOutFormDTO> getProdFormData(@PathVariable("id") Long id);
+
+    /**
+     * 更新采购出入库单B2B上传状态
+     * @param id
+     * @param status
+     * @return
+     */
+    @PostMapping("/prodinout/b2bStatus/update")
+    Result updateB2BStatus(@RequestParam("id") Long id, @RequestParam("status") String status);
+}

+ 2 - 1
applications/purchase/purchase-api/src/main/java/com/usoftchina/saas/purchase/api/PurchaseApi.java

@@ -3,6 +3,7 @@ package com.usoftchina.saas.purchase.api;
 import com.usoftchina.saas.auth.client.interceptor.ServiceFeignInterceptor;
 import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.purchase.dto.ProdInOutFormDTO;
 import com.usoftchina.saas.purchase.dto.PurchaseFormDTO;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.*;
@@ -26,6 +27,6 @@ public interface PurchaseApi {
      * @param status
      * @return
      */
-    @PostMapping("/b2bStatus/update")
+    @PostMapping("/purchase/b2bStatus/update")
     Result updateB2BStatus(@RequestParam("id") Long id, @RequestParam("status") String status);
 }

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

@@ -213,6 +213,18 @@ public class ProdInOutController {
     @GetMapping("/homepageList")
     public Result homepageList(PageRequest page, ListReqDTO req){
         PageInfo pageInfo = prodInOutService.homepageList(page, req);
-         return Result.success(pageInfo);
+        return Result.success(pageInfo);
+    }
+
+    /**
+     * 更新B2B上传状态
+     * @param id
+     * @param status
+     * @return
+     */
+    @PostMapping("/b2bStatus/update")
+    public Result updateB2BStatus(@RequestParam("id") Long id, @RequestParam("status") String status){
+        prodInOutService.updateB2BStatus(id, status);
+        return Result.success();
     }
 }

+ 2 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/ProdInOut.java

@@ -92,4 +92,6 @@ public class ProdInOut extends CommonBaseEntity implements Serializable {
     private String pi_seller;
 
     private Double pi_rate;
+
+    private String b2bStatus;
 }

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

@@ -85,4 +85,11 @@ public interface ProdInOutService extends CommonBaseService<ProdInOutMapper, Pro
     void getDefaultWarehouseByProduct(Long pi_id);
 
     PageInfo homepageList(PageRequest page, ListReqDTO req);
+
+    /**
+     * 更新B2B上传状态
+     * @param id
+     * @param status
+     */
+    void updateB2BStatus(Long id, String status);
 }

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

@@ -7,6 +7,7 @@ import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.CommonService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.cache.ConfigsCache;
 import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
@@ -28,6 +29,8 @@ import com.usoftchina.saas.purchase.po.ProdIODetail;
 import com.usoftchina.saas.purchase.po.ProdInOut;
 import com.usoftchina.saas.purchase.po.ProdInOutList;
 import com.usoftchina.saas.purchase.service.ProdInOutService;
+import com.usoftchina.saas.transfers.api.SendMessageApi;
+import com.usoftchina.saas.transfers.dto.MessageInfo;
 import com.usoftchina.saas.utils.BeanMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -60,6 +63,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
     private MaxnumberService maxnumberService;
     @Autowired
     private CommonService commonService;
+    @Autowired
+    private SendMessageApi sendMessageApi;
 
     @Override
     public PageInfo homepageList(@PageDefault(size = 10) PageRequest page, ListReqDTO req) {
@@ -76,6 +81,14 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         return pageInfo;
     }
 
+    @Override
+    public void updateB2BStatus(Long id, String status) {
+        ProdInOut prodInOut = new ProdInOut();
+        prodInOut.setId(id);
+        prodInOut.setB2bStatus(status);
+        getMapper().updateByPrimaryKeySelective(prodInOut);
+    }
+
     @Override
     public PageInfo<ProdInOutList> getListData(PageRequest page, ListReqDTO req) {
         //设置默认分页
@@ -303,6 +316,24 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             DocBaseDTO docBaseDTO = getBaseDTOById(prodInOutDTO.getId(),pi_class,prodInOutDTO.getPi_inoutno());
             //日志
             messageLogService.audit(docBaseDTO);
+            //上传到B2B
+            uploadToB2B(prodInOutDTO);
+        }
+    }
+
+    /**
+     * 采购验收/验退过账后上传至B2B
+     * @param prodInOutDTO
+     */
+    private void uploadToB2B(ProdInOutDTO prodInOutDTO) {
+        if (ConfigsCache.current().enableB2B()){
+            MessageInfo messageInfo = null;
+            if ("采购验收单".equals(prodInOutDTO.getPi_class())){
+                messageInfo = new MessageInfo(BaseContextHolder.getUserId(), BillCodeSeq.PURCHASEIN.name(), String.valueOf(prodInOutDTO.getId()), BaseContextHolder.getCompanyId());
+            } else if ("采购验退单".equals(prodInOutDTO.getPi_class())){
+                messageInfo = new MessageInfo(BaseContextHolder.getUserId(), BillCodeSeq.PURCHASEOUT.name(), String.valueOf(prodInOutDTO.getId()), BaseContextHolder.getCompanyId());
+            }
+            sendMessageApi.sendMsg(messageInfo);
         }
     }
 
@@ -356,6 +387,24 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             DocBaseDTO docBaseDTO = getBaseDTOById(prodInOutDTO.getId(),pi_class,prodInOutDTO.getPi_inoutno());
             //日志
             messageLogService.unAudit(docBaseDTO);
+            //上传至B2B
+            uploadResToB2B(prodInOutDTO);
+        }
+    }
+
+    /**
+     * 采购验收/验退反过账上传至B2B
+     * @param prodInOutDTO
+     */
+    private void uploadResToB2B(ProdInOutDTO prodInOutDTO) {
+        if (ConfigsCache.current().enableB2B()){
+            MessageInfo messageInfo = null;
+            if ("采购验收单".equals(prodInOutDTO.getPi_class())){
+                messageInfo = new MessageInfo(BaseContextHolder.getUserId(), BillCodeSeq.PURCHASEINRES.name(), String.valueOf(prodInOutDTO.getId()), BaseContextHolder.getCompanyId());
+            } else if ("采购验退单".equals(prodInOutDTO.getPi_class())){
+                messageInfo = new MessageInfo(BaseContextHolder.getUserId(), BillCodeSeq.PURCHASEOUTRES.name(), String.valueOf(prodInOutDTO.getId()), BaseContextHolder.getCompanyId());
+            }
+            sendMessageApi.sendMsg(messageInfo);
         }
     }
 

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

@@ -401,6 +401,10 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         DocBaseDTO docBaseDTO = getBaseDTOById(id);
         //日志
         messageLogService.close(docBaseDTO);
+        if (ConfigsCache.current().enableB2B()){
+            MessageInfo messageInfo = new MessageInfo(BaseContextHolder.getUserId(), BillCodeSeq.PURCHASEEND.name(), String.valueOf(id), BaseContextHolder.getCompanyId());
+            sendMessageApi.sendMsg(messageInfo);
+        }
         return docBaseDTO;
     }
 
@@ -464,6 +468,11 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
             docBaseDTO = getBaseDTOById(id);
             //日志
             messageLogService.open(docBaseDTO);
+            //启用B2B,采购单结案反结案状态上传
+            if (ConfigsCache.current().enableB2B()){
+                MessageInfo messageInfo = new MessageInfo(BaseContextHolder.getUserId(), BillCodeSeq.PURCHASEEND.name(), String.valueOf(id), BaseContextHolder.getCompanyId());
+                sendMessageApi.sendMsg(messageInfo);
+            }
             return docBaseDTO;
         }
         return docBaseDTO;

+ 3 - 3
applications/purchase/purchase-server/src/main/resources/application.yml

@@ -75,8 +75,8 @@ mybatis:
 auth:
   public-key: auth/pub.key
 ribbon:
-  ReadTimeout: 5000
-  ConnectTimeout: 5000
+  ReadTimeout: 10000
+  ConnectTimeout: 10000
 feign:
   hystrix:
     enabled: true
@@ -94,4 +94,4 @@ b2b:
     inquiry: https://test-inquiry.uuzcc.cn
     Component: https://test-mall.uuzcc.cn
     product: http://test-product.uuzcc.cn
-    uu: https://test-b2b.uuzcc.cn
+    common: https://test-b2b.uuzcc.cn

+ 3 - 0
applications/purchase/purchase-server/src/main/resources/mapper/ProdInOutMapper.xml

@@ -461,6 +461,9 @@
       <if test="pi_rate != null">
         pi_rate = #{pi_rate,jdbcType=VARCHAR},
       </if>
+      <if test="b2bStatus != null">
+        b2bStatus = #{b2bStatus,jdbcType=VARCHAR},
+      </if>
     </set>
     where pi_id = #{id,jdbcType=INTEGER}
   </update>

+ 3 - 3
applications/sale/sale-server/src/main/resources/application.yml

@@ -75,8 +75,8 @@ mybatis:
 auth:
   public-key: auth/pub.key
 ribbon:
-  ReadTimeout: 5000
-  ConnectTimeout: 5000
+  ReadTimeout: 10000
+  ConnectTimeout: 10000
 feign:
   hystrix:
     enabled: true
@@ -94,4 +94,4 @@ b2b:
     inquiry: https://test-inquiry.uuzcc.cn
     Component: https://test-mall.uuzcc.cn
     product: http://test-product.uuzcc.cn
-    uu: https://test-b2b.uuzcc.cn
+    common: https://test-b2b.uuzcc.cn

+ 0 - 28
applications/transfers/mall-api/src/main/java/com/usoftchina/saas/inquiry/api/B2BPurchaseApi.java

@@ -1,28 +0,0 @@
-package com.usoftchina.saas.inquiry.api;
-
-import com.usoftchina.saas.inquiry.po.purchase.SavePurchaseListResp;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-
-@FeignClient(url = "${b2b.baseUrl.uu}", name = "b2b-server")
-@RequestMapping("/erp/purchase")
-public interface B2BPurchaseApi {
-    /**
-     * 上传采购单
-     * @param data
-     * @return
-     */
-    @RequestMapping(method = RequestMethod.POST)
-    SavePurchaseListResp savePurchase(@RequestParam("data") String data);
-
-    /**
-     * 结案、反结案采购单后,传到平台
-     * @param data
-     */
-    @PostMapping("/end")
-    void updatePurchaseDetailEnd(@RequestParam("data") String data);
-
-}

+ 4 - 1
applications/transfers/mall-api/src/main/java/com/usoftchina/saas/inquiry/api/InquiryApi.java

@@ -1,11 +1,14 @@
 package com.usoftchina.saas.inquiry.api;
 
+import com.usoftchina.saas.exception.BizException;
+import com.usoftchina.saas.exception.ExceptionCode;
 import com.usoftchina.saas.inquiry.po.inquiry.*;
 import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.stereotype.Component;
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.*;
 
-@FeignClient(url = "${b2b.baseUrl.inquiry}", name = "inquiry-server")
+@FeignClient(url = "${b2b.baseUrl.inquiry}", name = "inquiry-server"/*, fallback = InquiryApiFallback.class*/)
 @RequestMapping("/inquiry")
 public interface InquiryApi {
 

+ 72 - 0
applications/transfers/mall-api/src/main/java/com/usoftchina/saas/inquiry/api/InquiryApiFallback.java

@@ -0,0 +1,72 @@
+/*
+package com.usoftchina.saas.inquiry.api;
+
+import com.usoftchina.saas.exception.BizException;
+import com.usoftchina.saas.exception.ExceptionCode;
+import com.usoftchina.saas.inquiry.po.inquiry.*;
+import org.springframework.stereotype.Component;
+import org.springframework.ui.ModelMap;
+
+*/
+/**
+ * @Author chenwei
+ * @Date 2019/01/16
+ *//*
+
+@Component
+public class InquiryApiFallback implements InquiryApi {
+
+    @Override
+    public IPage<PurcInquiryItemInfo> getInquiry(int pageNumber, int pageSize, String keyword, int isLogin) {
+        //throw new BizException(ExceptionCode.SYSTEM_BUSY);
+        return null;
+    }
+
+    @Override
+    public IPage<InquiryEnRemind> findEnRemind(Long useruu, Long enuu, int pageNumber, int pageSize, Integer enableOffer, String keyword, Integer quoted, Long fromDate, Long endDate) {
+        //throw new BizException(ExceptionCode.SYSTEM_BUSY);
+        return null;
+    }
+
+    @Override
+    public IPage<InquiryRemind> findRemindByUserInfo(Long useruu, Long enuu, int pageNumber, int pageSize, Integer enableOffer, String keyword, Integer quoted, Long fromDate, Long endDate) {
+        //throw new BizException(ExceptionCode.SYSTEM_BUSY);
+        return null;
+    }
+
+    @Override
+    public ModelMap saveQuote(PublicInquiryItem publicInquiryItem) {
+        //throw new BizException(ExceptionCode.SYSTEM_BUSY);
+        return null;
+    }
+
+    @Override
+    public PurcInquiry saveInquiry(PurcInquiry inquiry) {
+        //throw new BizException(ExceptionCode.SYSTEM_BUSY);
+        return null;
+    }
+
+    @Override
+    public IPage<PurcInquiryItemInfo> getInquiryList(Long enUU, Integer overdue, int pageNumber, int pageSize, String state, Long fromDate, String keyword, Long endDate) {
+        //throw new BizException(ExceptionCode.SYSTEM_BUSY);
+        return null;
+    }
+
+    @Override
+    public IPage<PurcInquiryItemInfo> findQuotationsByPage(String state, Long enUU, int pageNumber, int pageSize, Long fromDate, String keyword, Integer overdue, Long endDate) {
+        //throw new BizException(ExceptionCode.SYSTEM_BUSY);
+        return null;
+    }
+
+    @Override
+    public void adoptQuote(Long id, Short status, Long enuu, Long useruu) {
+        //throw new BizException(ExceptionCode.SYSTEM_BUSY);
+    }
+
+    @Override
+    public void refuseQuote(Long id, Short status, Long enuu, Long useruu, String refusereason) {
+        //throw new BizException(ExceptionCode.SYSTEM_BUSY);
+    }
+
+}
+*/

+ 1 - 1
applications/transfers/mall-api/src/main/java/com/usoftchina/saas/inquiry/api/SearchUUApi.java

@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.Map;
 
-@FeignClient(url = "${b2b.baseUrl.uu}", name = "b2b-server")
+@FeignClient(url = "${b2b.baseUrl.common}", name = "b2b-server")
 @RequestMapping("/public")
 public interface SearchUUApi {
     /**

+ 55 - 0
applications/transfers/mall-api/src/main/java/com/usoftchina/saas/inquiry/po/purchase/PurchaseDetailEnd.java

@@ -0,0 +1,55 @@
+package com.usoftchina.saas.inquiry.po.purchase;
+
+/**
+ * @Author chenwei
+ * @Date 2019/01/15
+ */
+public class PurchaseDetailEnd {
+
+    private String pd_code;
+    private short pd_detno;
+    private short pd_ended;
+    private Integer pd_id;
+
+    public String getPd_code() {
+        return pd_code;
+    }
+
+    public void setPd_code(String pd_code) {
+        this.pd_code = pd_code;
+    }
+
+    public short getPd_detno() {
+        return pd_detno;
+    }
+
+    public void setPd_detno(short pd_detno) {
+        this.pd_detno = pd_detno;
+    }
+
+    public short getPd_ended() {
+        return pd_ended;
+    }
+
+    public void setPd_ended(short pd_ended) {
+        this.pd_ended = pd_ended;
+    }
+
+    public Integer getPd_id() {
+        return pd_id;
+    }
+
+    public void setPd_id(Integer pd_id) {
+        this.pd_id = pd_id;
+    }
+
+    public PurchaseDetailEnd() {
+    }
+
+    public PurchaseDetailEnd(String pd_code, short pd_detno, short pd_ended, Integer pd_id) {
+        this.pd_code = pd_code;
+        this.pd_detno = pd_detno;
+        this.pd_ended = pd_ended;
+        this.pd_id = pd_id;
+    }
+}

+ 207 - 0
applications/transfers/mall-api/src/main/java/com/usoftchina/saas/inquiry/po/purchase/PurchaseProdInOut.java

@@ -0,0 +1,207 @@
+package com.usoftchina.saas.inquiry.po.purchase;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Author chenwei
+ * @Date 2019/01/16
+ */
+public class PurchaseProdInOut implements Serializable {
+
+    /**
+     * erp出入库单据的id
+     */
+    private Long pi_id;
+
+    /**
+     * erp出入库单据单号
+     */
+    private String pi_inoutno;
+
+    /**
+     * 供应商UU
+     */
+    private Long pi_vendoruu;
+
+    /**
+     * 币别
+     */
+    private String pi_currency;
+
+    /**
+     * 汇率
+     */
+    private Float pi_rate;
+
+    /**
+     * 付款方式
+     */
+    private String pi_payment;
+
+    /**
+     * 运输方式
+     */
+    private String pi_transport;
+
+    /**
+     * 备注
+     */
+    private String pi_remark;
+
+    /**
+     * 过账人
+     */
+    private String pi_inoutman;
+
+    /**
+     * 过账日期
+     */
+    private Date pi_date;
+
+    /**
+     * 送货单号
+     */
+    private String pi_sendcode;
+
+    /**
+     * 应付供应商名
+     */
+    private String pi_receivename;
+
+    /**
+     * 应付供应商编号
+     */
+    private String pi_receivecode;
+
+    /**
+     * 明细
+     */
+    private List<PurchaseProdInOutDetail> details;
+
+    /**
+     * b2bId
+     */
+    private Long pi_b2b_id;
+
+    public Long getPi_id() {
+        return pi_id;
+    }
+
+    public void setPi_id(Long pi_id) {
+        this.pi_id = pi_id;
+    }
+
+    public String getPi_inoutno() {
+        return pi_inoutno;
+    }
+
+    public void setPi_inoutno(String pi_inoutno) {
+        this.pi_inoutno = pi_inoutno;
+    }
+
+    public Long getPi_vendoruu() {
+        return pi_vendoruu;
+    }
+
+    public void setPi_vendoruu(Long pi_vendoruu) {
+        this.pi_vendoruu = pi_vendoruu;
+    }
+
+    public String getPi_currency() {
+        return pi_currency;
+    }
+
+    public void setPi_currency(String pi_currency) {
+        this.pi_currency = pi_currency;
+    }
+
+    public Float getPi_rate() {
+        return pi_rate;
+    }
+
+    public void setPi_rate(Float pi_rate) {
+        this.pi_rate = pi_rate;
+    }
+
+    public String getPi_payment() {
+        return pi_payment;
+    }
+
+    public void setPi_payment(String pi_payment) {
+        this.pi_payment = pi_payment;
+    }
+
+    public String getPi_transport() {
+        return pi_transport;
+    }
+
+    public void setPi_transport(String pi_transport) {
+        this.pi_transport = pi_transport;
+    }
+
+    public String getPi_remark() {
+        return pi_remark;
+    }
+
+    public void setPi_remark(String pi_remark) {
+        this.pi_remark = pi_remark;
+    }
+
+    public String getPi_inoutman() {
+        return pi_inoutman;
+    }
+
+    public void setPi_inoutman(String pi_inoutman) {
+        this.pi_inoutman = pi_inoutman;
+    }
+
+    public Date getPi_date() {
+        return pi_date;
+    }
+
+    public void setPi_date(Date pi_date) {
+        this.pi_date = pi_date;
+    }
+
+    public String getPi_sendcode() {
+        return pi_sendcode;
+    }
+
+    public void setPi_sendcode(String pi_sendcode) {
+        this.pi_sendcode = pi_sendcode;
+    }
+
+    public String getPi_receivename() {
+        return pi_receivename;
+    }
+
+    public void setPi_receivename(String pi_receivename) {
+        this.pi_receivename = pi_receivename;
+    }
+
+    public String getPi_receivecode() {
+        return pi_receivecode;
+    }
+
+    public void setPi_receivecode(String pi_receivecode) {
+        this.pi_receivecode = pi_receivecode;
+    }
+
+    public List<PurchaseProdInOutDetail> getDetails() {
+        return details;
+    }
+
+    public void setDetails(List<PurchaseProdInOutDetail> details) {
+        this.details = details;
+    }
+
+    public Long getPi_b2b_id() {
+        return pi_b2b_id;
+    }
+
+    public void setPi_b2b_id(Long pi_b2b_id) {
+        this.pi_b2b_id = pi_b2b_id;
+    }
+}

+ 132 - 0
applications/transfers/mall-api/src/main/java/com/usoftchina/saas/inquiry/po/purchase/PurchaseProdInOutDetail.java

@@ -0,0 +1,132 @@
+package com.usoftchina.saas.inquiry.po.purchase;
+
+import java.io.Serializable;
+
+/**
+ * @Author chenwei
+ * @Date 2019/01/16
+ */
+public class PurchaseProdInOutDetail implements Serializable {
+
+    private Long pd_id;//id
+    private Short pd_detno;//明细行序号
+    private String pd_ordercode;//采购单编号
+    private Short pd_orderdetno;//采购单明细行号
+    private Double pd_inqty;//入库数量
+    private Double pd_outqty;//出库数量
+    private Double pd_orderprice;//采购成本
+    private Double pd_taxrate;//税率
+    private String pd_batchcode;//批号
+    private String pd_remark;//备注
+    private String pd_prodcode;//物料编号
+    private String pd_whname;//仓库名称
+
+    /**
+     * 平台送货单明细id
+     */
+    private Long b2b_si_id;
+
+    public Long getPd_id() {
+        return pd_id;
+    }
+
+    public void setPd_id(Long pd_id) {
+        this.pd_id = pd_id;
+    }
+
+    public Short getPd_detno() {
+        return pd_detno;
+    }
+
+    public void setPd_detno(Short pd_detno) {
+        this.pd_detno = pd_detno;
+    }
+
+    public String getPd_ordercode() {
+        return pd_ordercode;
+    }
+
+    public void setPd_ordercode(String pd_ordercode) {
+        this.pd_ordercode = pd_ordercode;
+    }
+
+    public Short getPd_orderdetno() {
+        return pd_orderdetno;
+    }
+
+    public void setPd_orderdetno(Short pd_orderdetno) {
+        this.pd_orderdetno = pd_orderdetno;
+    }
+
+    public Double getPd_inqty() {
+        return pd_inqty;
+    }
+
+    public void setPd_inqty(Double pd_inqty) {
+        this.pd_inqty = pd_inqty;
+    }
+
+    public Double getPd_outqty() {
+        return pd_outqty;
+    }
+
+    public void setPd_outqty(Double pd_outqty) {
+        this.pd_outqty = pd_outqty;
+    }
+
+    public Double getPd_orderprice() {
+        return pd_orderprice;
+    }
+
+    public void setPd_orderprice(Double pd_orderprice) {
+        this.pd_orderprice = pd_orderprice;
+    }
+
+    public Double getPd_taxrate() {
+        return pd_taxrate;
+    }
+
+    public void setPd_taxrate(Double pd_taxrate) {
+        this.pd_taxrate = pd_taxrate;
+    }
+
+    public String getPd_batchcode() {
+        return pd_batchcode;
+    }
+
+    public void setPd_batchcode(String pd_batchcode) {
+        this.pd_batchcode = pd_batchcode;
+    }
+
+    public String getPd_remark() {
+        return pd_remark;
+    }
+
+    public void setPd_remark(String pd_remark) {
+        this.pd_remark = pd_remark;
+    }
+
+    public String getPd_prodcode() {
+        return pd_prodcode;
+    }
+
+    public void setPd_prodcode(String pd_prodcode) {
+        this.pd_prodcode = pd_prodcode;
+    }
+
+    public String getPd_whname() {
+        return pd_whname;
+    }
+
+    public void setPd_whname(String pd_whname) {
+        this.pd_whname = pd_whname;
+    }
+
+    public Long getB2b_si_id() {
+        return b2b_si_id;
+    }
+
+    public void setB2b_si_id(Long b2b_si_id) {
+        this.b2b_si_id = b2b_si_id;
+    }
+}

+ 1 - 1
applications/transfers/mall-api/src/test/resources/application.yml

@@ -3,4 +3,4 @@ b2b:
     inquiry: https://test-inquiry.uuzcc.cn
     Component: https://test-mall.uuzcc.cn
     product: http://test-product.uuzcc.cn
-    uu: https://test-b2b.uuzcc.cn
+    common: https://test-b2b.uuzcc.cn

+ 2 - 2
applications/transfers/transfers-api/src/main/java/com/usoftchina/saas/transfers/api/SendMessageApi.java

@@ -7,7 +7,7 @@ import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 
-@FeignClient(name = "transfers-server" , fallback = SendMessageApiFallBack.class)
+@FeignClient(name = "transfers-server" , fallback = SendMessageApi.SendMessageApiFallBack.class)
 public interface SendMessageApi {
 
     @PostMapping("/send/Message")
@@ -17,7 +17,7 @@ public interface SendMessageApi {
     class SendMessageApiFallBack implements SendMessageApi {
         @Override
         public Result sendMsg(MessageInfo info) {
-            return null;
+            return Result.error("网络异常,请稍后重试!");
         }
     }
 }

+ 0 - 19
applications/transfers/transfers-api/src/main/java/com/usoftchina/saas/transfers/api/SendMessageApiFallBack.java

@@ -1,19 +0,0 @@
-package com.usoftchina.saas.transfers.api;
-
-import com.usoftchina.saas.base.Result;
-import com.usoftchina.saas.transfers.dto.MessageInfo;
-import org.springframework.stereotype.Component;
-import org.springframework.web.bind.annotation.RequestBody;
-
-/**
- * @author: guq
- * @create: 2019-01-09 13:50
- **/
-@Component
-public class SendMessageApiFallBack implements SendMessageApi {
-
-    @Override
-    public Result sendMsg(@RequestBody MessageInfo info) {
-        return Result.error("网络异常,请稍后重试!");
-    }
-}

+ 48 - 0
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/config/B2BConfig.java

@@ -0,0 +1,48 @@
+package com.usoftchina.saas.transfers.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * @Author chenwei
+ * @Date 2019/01/15
+ */
+@ConfigurationProperties(prefix = "b2b.baseUrl")
+public class B2BConfig {
+
+    private String inquiry;
+    private String Component;
+    private String product;
+    private String common;
+
+    public String getInquiry() {
+        return inquiry;
+    }
+
+    public void setInquiry(String inquiry) {
+        this.inquiry = inquiry;
+    }
+
+    public String getComponent() {
+        return Component;
+    }
+
+    public void setComponent(String component) {
+        Component = component;
+    }
+
+    public String getProduct() {
+        return product;
+    }
+
+    public void setProduct(String product) {
+        this.product = product;
+    }
+
+    public String getCommon() {
+        return common;
+    }
+
+    public void setCommon(String common) {
+        this.common = common;
+    }
+}

+ 12 - 4
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/controller/ApCheckController.java

@@ -4,16 +4,16 @@ import com.usoftchina.saas.auth.client.annotation.IgnoreAuth;
 import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.commons.exception.BizExceptionCode;
 import com.usoftchina.saas.exception.BizException;
+import com.usoftchina.saas.money.dto.ApcheckDTO;
 import com.usoftchina.saas.money.dto.ApcheckFormDTO;
 import com.usoftchina.saas.transfers.auth.annotation.IgnoreOpenApiAuth;
 import com.usoftchina.saas.transfers.service.ApCheckService;
 import com.usoftchina.saas.utils.JsonUtils;
 import com.usoftchina.saas.utils.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 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.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
@@ -27,12 +27,14 @@ import java.util.List;
 @IgnoreAuth
 @RestController
 @RequestMapping("/b2b/apcheck")
+@Api(value = "ApcheckController", description = "对账单下载接口")
 public class ApCheckController {
 
 
     @Autowired
     private ApCheckService apcheckService;
 
+    @ApiOperation(value = "对账单下载")
     @PostMapping("/save")
     public Result saveApcheck(@RequestParam("data") String data) throws UnsupportedEncodingException {
         if (StringUtils.isEmpty(data)) {
@@ -43,4 +45,10 @@ public class ApCheckController {
         String ids = apcheckService.save(forms);
         return Result.success(ids);
     }
+
+    @PostMapping("/test")
+    @ApiOperation(value = "测试")
+    public void test(@RequestBody ApcheckDTO apcheckDTO) {
+        System.out.println(apcheckDTO);
+    }
 }

+ 6 - 0
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/controller/SaleDownController.java

@@ -10,6 +10,8 @@ import com.usoftchina.saas.transfers.auth.annotation.IgnoreOpenApiAuth;
 import com.usoftchina.saas.transfers.service.SaleDownService;
 import com.usoftchina.saas.utils.JsonUtils;
 import com.usoftchina.saas.utils.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -26,6 +28,7 @@ import java.util.List;
 @IgnoreAuth
 @RestController
 @RequestMapping("/b2b/saledown")
+@Api(value = "SaleDownController", description = "客户订单下载、更新")
 public class SaleDownController {
 
     @Autowired
@@ -35,6 +38,7 @@ public class SaleDownController {
      *从b2b下载客户采购单
      * @return
      */
+    @ApiOperation(value = "客户订单下载")
     @PostMapping("/save")
     public Result<String> saveSaleDown(@RequestParam("data") String data) throws UnsupportedEncodingException {
         if (StringUtils.isEmpty(data)) {
@@ -50,6 +54,7 @@ public class SaleDownController {
      *从b2b更新为结案
      * @return
      */
+    @ApiOperation(value = "结案更新")
     @PostMapping("/close")
     public Result<String> closeSaleDown(@RequestParam("data") String data) throws UnsupportedEncodingException {
         if (StringUtils.isEmpty(data)) {
@@ -64,6 +69,7 @@ public class SaleDownController {
      *从b2b更新为结案
      * @return
      */
+    @ApiOperation(value = "反结案更新")
     @PostMapping("/resClose")
     public Result<String> resCloseSaleDown(@RequestParam("data") String data) throws UnsupportedEncodingException {
         if (StringUtils.isEmpty(data)) {

+ 2 - 0
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/mapper/ApcheckMapper.java

@@ -17,4 +17,6 @@ public interface ApcheckMapper {
     void batchInsert(List<ApcheckDetail> details);
 
     Vendor getVendorByuu(@Param("uu") Long uu, @Param("companyid") Long companyid);
+
+    Integer count(Long id);
 }

+ 2 - 0
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/mapper/SaledownMapper.java

@@ -28,4 +28,6 @@ public interface SaledownMapper {
     void batchUpdateResClose(@Param("data") String data, @Param("companyid") Long companyid);
 
     Customer getCustomer(@Param("uu") Long uu, @Param("companyid") Long companyid);
+
+    Integer count(Long id);
 }

+ 13 - 2
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/service/ReceiveService.java

@@ -59,15 +59,26 @@ public class ReceiveService {
                case PURCHASE:       //采购单上传
                    task = new SendPurchaseTask();
                    break;
-               case PURCHASEIN:
+               case PURCHASEIN:     //采购验收单过账
                    task = new SendPurchaseInTask();
                    break;
-               case PURCHASEOUT:
+               case PURCHASEINRES:     //采购验收单反过账
+                   task = new SendPurchaseInResTask();
+                   break;
+               case PURCHASEOUT:    //采购延退单过账
                    task = new SendPurchaseOutTask();
                    break;
+               case PURCHASEOUTRES:     //采购验收单反过账
+                   task = new SendPurchaseOutResTask();
+                   break;
                case PRODUCT:        //物料库上传
                    task = new SendProductTask();
                    break;
+               case PURCHASEEND:    //采购单结案
+                   task = new SendPurchaseEndTask();
+                   break;
+               default:
+                   break;
            }
 
            task.execute(info);

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

@@ -11,6 +11,7 @@ import com.usoftchina.saas.transfers.mapper.ApcheckMapper;
 import com.usoftchina.saas.transfers.service.ApCheckService;
 import com.usoftchina.saas.utils.BeanMapper;
 import com.usoftchina.saas.utils.CollectionUtils;
+import com.usoftchina.saas.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -41,6 +42,16 @@ public class ApCheckServiceImpl implements ApCheckService{
         for (ApcheckFormDTO form : forms) {
             Apcheck main = BeanMapper.map(form.getMain(), Apcheck.class);
             List<ApcheckDetail> details = BeanMapper.mapList(form.getItems(), ApcheckDetail.class);
+            //检测单据是否存在
+            if (StringUtils.isEmpty(main.getAc_b2bid())) {
+                continue;
+            }
+            Integer count = apcheckMapper.count(main.getAc_b2bid());
+            if (count > 0) {
+                ids.append(main.getAc_b2bid());
+                ids.append(",");
+                continue;
+            }
 
             //供应商获取
             Vendor vendor = apcheckMapper.getVendorByuu(main.getAc_venduu(), companyId);

+ 19 - 0
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/service/impl/SaleDownServiceImpl.java

@@ -56,6 +56,16 @@ public class SaleDownServiceImpl implements SaleDownService{
             SaleDown main = BeanMapper.map(form.getMain(), SaleDown.class);
             List<SaleDownDetail> details = BeanMapper.mapList(form.getItems(), SaleDownDetail.class);
             List<SaleDownDetail> insertDetail = new ArrayList<>();
+            //检测单据是否存在
+            if (StringUtils.isEmpty(main.getB2b_pu_id())) {
+                continue;
+            }
+            Integer count = saledownMapper.count(main.getB2b_pu_id());
+            if (count > 0) {
+                ids.append(main.getB2b_pu_id());
+                ids.append(",");
+                continue;
+            }
             //添加业务员
             Result<AccountDTO> emp = accountApi.getAccountByUu(main.getSa_selleruu());
             if (!emp.isSuccess()) {
@@ -109,16 +119,25 @@ public class SaleDownServiceImpl implements SaleDownService{
 
     @Override
     public void closeSaleDown(String data) {
+        data = getIds(data);
         Long companyId = TransfersContextHodler.getB2bCompanyId();
         saledownMapper.batchUpdateClose(data, companyId);
     }
 
     @Override
     public void resCloseSaleDown(String data) {
+        data = getIds(data);
         Long companyId = TransfersContextHodler.getB2bCompanyId();
         saledownMapper.batchUpdateResClose(data, companyId);
     }
 
+    private String getIds(String str) {
+        if (str.startsWith("[")) {
+            return str.substring(1, str.length() - 1);
+        } else {
+            return str;
+        }
+    }
    /* public String getMaxnumber(BillCodeSeq bill) {
         String code = maxnumberService.getMaxnumber(bill.getCaller(), false).getData();
         DocBaseDTO base = new DocBaseDTO(0l, code, bill.getName());

+ 1 - 1
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/Executable.java

@@ -20,5 +20,5 @@ public abstract class Executable {
     /**
      * 执行任务
      */
-    public abstract void execute(MessageInfo messageInfo);
+    public abstract void execute(MessageInfo messageInfo) throws Exception;
 }

+ 65 - 0
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseEndTask.java

@@ -0,0 +1,65 @@
+package com.usoftchina.saas.transfers.task;
+
+import com.usoftchina.saas.account.api.CompanyApi;
+import com.usoftchina.saas.inquiry.po.purchase.PurchaseDetailEnd;
+import com.usoftchina.saas.purchase.api.PurchaseApi;
+import com.usoftchina.saas.purchase.dto.PurchaseDetailDTO;
+import com.usoftchina.saas.purchase.dto.PurchaseFormDTO;
+import com.usoftchina.saas.transfers.dto.MessageInfo;
+import com.usoftchina.saas.transfers.utils.SendUtil;
+import com.usoftchina.saas.utils.CollectionUtils;
+import com.usoftchina.saas.utils.JsonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 采购单结案/反结案
+ * @Author chenwei
+ * @Date 2019/01/15
+ */
+public class SendPurchaseEndTask extends Executable {
+
+    @Autowired
+    private PurchaseApi purchaseApi;
+    @Autowired
+    private CompanyApi companyApi;
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(SendPurchaseEndTask.class);
+    private final String purchaseEndUrl = "/erp/purchase/end";
+
+    @Override
+    public void execute(MessageInfo messageInfo) throws Exception {
+        String accessSecretKey = companyApi.getCompanyById(messageInfo.getCompanyId()).getData().getAccessKey();
+        PurchaseFormDTO purchaseFormDTO = purchaseApi.getFormData(Long.parseLong(messageInfo.getBizId())).getData();
+        short endStatus = 0;
+        //结案、反结案
+        if("CLOSE".equals(purchaseFormDTO.getMain().getPu_statuscode())) {
+            endStatus = 1;     //结案
+        } else {
+            endStatus = 0;     //反结案
+        }
+        List<PurchaseDetailDTO> purchaseDetailDTOList = purchaseFormDTO.getItems();
+        List<PurchaseDetailEnd> purchaseDetailEndList = new ArrayList<PurchaseDetailEnd>();
+        if (!CollectionUtils.isEmpty(purchaseDetailDTOList)) {
+            //构造需要发送的数据
+            for (PurchaseDetailDTO purchaseDetailDTO : purchaseDetailDTOList) {
+                PurchaseDetailEnd purchaseDetailEnd = new PurchaseDetailEnd(purchaseDetailDTO.getPd_code(),
+                        new BigDecimal(purchaseDetailDTO.getPd_detno()).shortValue(), endStatus,
+                        new BigDecimal(purchaseDetailDTO.getId()).intValue());
+                purchaseDetailEndList.add(purchaseDetailEnd);
+            }
+            //发送给b2b
+            boolean success = SendUtil.sendToB2B(purchaseEndUrl, JsonUtils.toJsonString(purchaseDetailEndList), accessSecretKey);
+            if (success) {
+                purchaseApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
+            }
+        }
+
+    }
+
+}

+ 77 - 0
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseInResTask.java

@@ -0,0 +1,77 @@
+package com.usoftchina.saas.transfers.task;
+
+import com.usoftchina.saas.account.api.CompanyApi;
+import com.usoftchina.saas.account.dto.CompanyDTO;
+import com.usoftchina.saas.inquiry.po.purchase.PurchaseProdInOut;
+import com.usoftchina.saas.inquiry.po.purchase.PurchaseProdInOutDetail;
+import com.usoftchina.saas.purchase.api.ProdInOutApi;
+import com.usoftchina.saas.purchase.dto.ProdIODetailDTO;
+import com.usoftchina.saas.purchase.dto.ProdInOutDTO;
+import com.usoftchina.saas.purchase.dto.ProdInOutFormDTO;
+import com.usoftchina.saas.transfers.config.B2BConfig;
+import com.usoftchina.saas.transfers.dto.MessageInfo;
+import com.usoftchina.saas.transfers.utils.SendUtil;
+import com.usoftchina.saas.utils.BeanMapper;
+import com.usoftchina.saas.utils.JsonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 采购验收单反过账
+ * @Author chenwei
+ * @Date 2019/01/16
+ */
+public class SendPurchaseInResTask extends Executable {
+
+    @Autowired
+    private CompanyApi companyApi;
+    @Autowired
+    private ProdInOutApi prodInOutApi;
+    @Autowired
+    private B2BConfig b2bConfig;
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(SendProductTask.class);
+    private final String prodInUrl = "/erp/purchase/prodInOut/nonPosting";
+
+    @Override
+    public void execute(MessageInfo messageInfo) throws Exception {
+        CompanyDTO companyDTO = companyApi.getCompanyById(messageInfo.getCompanyId()).getData();
+
+        ProdInOutFormDTO prodInOutFormDTO = prodInOutApi.getProdFormData(Long.parseLong(messageInfo.getBizId())).getData();
+        ProdInOutDTO prodInOutDTO = prodInOutFormDTO.getMain();
+        PurchaseProdInOut b2bPurchaseProdInOut = BeanMapper.map(prodInOutDTO, PurchaseProdInOut.class);
+        convertToPronInOut(prodInOutDTO, b2bPurchaseProdInOut);
+        LOGGER.info("ProdInOutDTO={}, PurchaseProdInOut={}", JsonUtils.toJsonString(prodInOutDTO), JsonUtils.toJsonString(b2bPurchaseProdInOut));
+
+        List<PurchaseProdInOutDetail> b2bPurchaseProdInOutDetailList = BeanMapper.mapList(prodInOutFormDTO.getItems(), PurchaseProdInOutDetail.class);
+        convertToPronInOutDetail(prodInOutFormDTO.getItems(), b2bPurchaseProdInOutDetailList);
+        b2bPurchaseProdInOut.setDetails(b2bPurchaseProdInOutDetailList);
+        LOGGER.info("ProdIODetailDTOList={}, b2bPurchaseProdInOutDetailList={}", JsonUtils.toJsonString(prodInOutFormDTO.getItems()), JsonUtils.toJsonString(b2bPurchaseProdInOutDetailList));
+
+        boolean success = SendUtil.sendToB2B(b2bConfig.getCommon() + prodInUrl, JsonUtils.toJsonString(b2bPurchaseProdInOut), companyDTO.getAccessKey());
+        if (success) {
+            LOGGER.info("采购验收单(反过账)上传成功, id={}", messageInfo.getBizId());
+            prodInOutApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
+        }
+    }
+
+    private void convertToPronInOut(ProdInOutDTO prodInOutDTO, PurchaseProdInOut b2bPurchaseProdInOut) {
+        b2bPurchaseProdInOut.setPi_rate(new BigDecimal(prodInOutDTO.getPi_rate()).floatValue());
+        b2bPurchaseProdInOut.setPi_inoutman(prodInOutDTO.getPi_auditman());
+        b2bPurchaseProdInOut.setPi_id(prodInOutDTO.getId());
+    }
+
+    private void convertToPronInOutDetail(List<ProdIODetailDTO> items, List<PurchaseProdInOutDetail> b2bPurchaseProdInOutDetailList){
+        for (int i = 0; i < items.size(); i++) {
+            ProdIODetailDTO prodIODetailDTO = items.get(i);
+            PurchaseProdInOutDetail b2bPurchaseProdInOutDetail = b2bPurchaseProdInOutDetailList.get(i);
+            b2bPurchaseProdInOutDetail.setPd_id(prodIODetailDTO.getId());
+            b2bPurchaseProdInOutDetail.setPd_detno(new BigDecimal(prodIODetailDTO.getPd_pdno()).shortValue());
+        }
+    }
+
+}

+ 73 - 4
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseInTask.java

@@ -1,14 +1,83 @@
 package com.usoftchina.saas.transfers.task;
 
+import com.usoftchina.saas.account.api.AccountApi;
+import com.usoftchina.saas.account.api.CompanyApi;
+import com.usoftchina.saas.account.dto.AccountDTO;
+import com.usoftchina.saas.account.dto.CompanyDTO;
+import com.usoftchina.saas.inquiry.po.purchase.PurchaseProdInOut;
+import com.usoftchina.saas.inquiry.po.purchase.PurchaseProdInOutDetail;
+import com.usoftchina.saas.purchase.api.ProdInOutApi;
+import com.usoftchina.saas.purchase.dto.ProdIODetailDTO;
+import com.usoftchina.saas.purchase.dto.ProdInOutDTO;
+import com.usoftchina.saas.purchase.dto.ProdInOutFormDTO;
+import com.usoftchina.saas.transfers.config.B2BConfig;
 import com.usoftchina.saas.transfers.dto.MessageInfo;
+import com.usoftchina.saas.transfers.utils.SendUtil;
+import com.usoftchina.saas.utils.BeanMapper;
+import com.usoftchina.saas.utils.JsonUtils;
+import com.usoftchina.saas.utils.http.HttpUtil;
+import com.usoftchina.saas.utils.http.HttpUtil.Response;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
- * @author: guq
- * @create: 2019-01-08 13:53
+ * 采购验收单上传
+ * @author: chenwei
+ * @create: 2019-01-016 16:53
  **/
 public class SendPurchaseInTask extends Executable{
+
+    @Autowired
+    private CompanyApi companyApi;
+    @Autowired
+    private ProdInOutApi prodInOutApi;
+    @Autowired
+    private B2BConfig b2bConfig;
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(SendProductTask.class);
+    private final String prodInUrl = "/erp/purchase/prodInOut";
+
     @Override
-    public void execute(MessageInfo messageInfo) {
-        //TODO
+    public void execute(MessageInfo messageInfo) throws Exception {
+        CompanyDTO companyDTO = companyApi.getCompanyById(messageInfo.getCompanyId()).getData();
+
+        ProdInOutFormDTO prodInOutFormDTO = prodInOutApi.getProdFormData(Long.parseLong(messageInfo.getBizId())).getData();
+        ProdInOutDTO prodInOutDTO = prodInOutFormDTO.getMain();
+        PurchaseProdInOut b2bPurchaseProdInOut = BeanMapper.map(prodInOutDTO, PurchaseProdInOut.class);
+        convertToPronInOut(prodInOutDTO, b2bPurchaseProdInOut);
+        LOGGER.info("ProdInOutDTO={}, PurchaseProdInOut={}", JsonUtils.toJsonString(prodInOutDTO), JsonUtils.toJsonString(b2bPurchaseProdInOut));
+
+        List<PurchaseProdInOutDetail> b2bPurchaseProdInOutDetailList = BeanMapper.mapList(prodInOutFormDTO.getItems(), PurchaseProdInOutDetail.class);
+        convertToPronInOutDetail(prodInOutFormDTO.getItems(), b2bPurchaseProdInOutDetailList);
+        b2bPurchaseProdInOut.setDetails(b2bPurchaseProdInOutDetailList);
+        LOGGER.info("ProdIODetailDTOList={}, b2bPurchaseProdInOutDetailList={}", JsonUtils.toJsonString(prodInOutFormDTO.getItems()), JsonUtils.toJsonString(b2bPurchaseProdInOutDetailList));
+
+        boolean success = SendUtil.sendToB2B(b2bConfig.getCommon() + prodInUrl, JsonUtils.toJsonString(b2bPurchaseProdInOut), companyDTO.getAccessKey());
+        if (success) {
+            LOGGER.info("采购验收单上传成功, id={}", messageInfo.getBizId());
+            prodInOutApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
+        }
+    }
+
+    private void convertToPronInOut(ProdInOutDTO prodInOutDTO, PurchaseProdInOut b2bPurchaseProdInOut) {
+        b2bPurchaseProdInOut.setPi_rate(new BigDecimal(prodInOutDTO.getPi_rate()).floatValue());
+        b2bPurchaseProdInOut.setPi_inoutman(prodInOutDTO.getPi_auditman());
+        b2bPurchaseProdInOut.setPi_id(prodInOutDTO.getId());
     }
+
+    private void convertToPronInOutDetail(List<ProdIODetailDTO> items, List<PurchaseProdInOutDetail> b2bPurchaseProdInOutDetailList){
+        for (int i = 0; i < items.size(); i++) {
+            ProdIODetailDTO prodIODetailDTO = items.get(i);
+            PurchaseProdInOutDetail b2bPurchaseProdInOutDetail = b2bPurchaseProdInOutDetailList.get(i);
+            b2bPurchaseProdInOutDetail.setPd_id(prodIODetailDTO.getId());
+            b2bPurchaseProdInOutDetail.setPd_detno(new BigDecimal(prodIODetailDTO.getPd_pdno()).shortValue());
+        }
+    }
+
 }

+ 76 - 0
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseOutResTask.java

@@ -0,0 +1,76 @@
+package com.usoftchina.saas.transfers.task;
+
+import com.usoftchina.saas.account.api.CompanyApi;
+import com.usoftchina.saas.account.dto.CompanyDTO;
+import com.usoftchina.saas.inquiry.po.purchase.PurchaseProdInOut;
+import com.usoftchina.saas.inquiry.po.purchase.PurchaseProdInOutDetail;
+import com.usoftchina.saas.purchase.api.ProdInOutApi;
+import com.usoftchina.saas.purchase.dto.ProdIODetailDTO;
+import com.usoftchina.saas.purchase.dto.ProdInOutDTO;
+import com.usoftchina.saas.purchase.dto.ProdInOutFormDTO;
+import com.usoftchina.saas.transfers.config.B2BConfig;
+import com.usoftchina.saas.transfers.dto.MessageInfo;
+import com.usoftchina.saas.transfers.utils.SendUtil;
+import com.usoftchina.saas.utils.BeanMapper;
+import com.usoftchina.saas.utils.JsonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 采购延退单反过账
+ * @Author chenwei
+ * @Date 2019/01/16
+ */
+public class SendPurchaseOutResTask extends Executable {
+    @Autowired
+    private CompanyApi companyApi;
+    @Autowired
+    private ProdInOutApi prodInOutApi;
+    @Autowired
+    private B2BConfig b2bConfig;
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(SendProductTask.class);
+    private final String prodOutUrl = "/erp/purchase/prodReturn/nonPosting";
+
+
+    @Override
+    public void execute(MessageInfo messageInfo) throws Exception {
+        CompanyDTO companyDTO = companyApi.getCompanyById(messageInfo.getCompanyId()).getData();
+
+        ProdInOutFormDTO prodInOutFormDTO = prodInOutApi.getProdFormData(Long.parseLong(messageInfo.getBizId())).getData();
+        ProdInOutDTO prodInOutDTO = prodInOutFormDTO.getMain();
+        PurchaseProdInOut b2bPurchaseProdInOut = BeanMapper.map(prodInOutDTO, PurchaseProdInOut.class);
+        convertToPronInOut(prodInOutDTO, b2bPurchaseProdInOut);
+        LOGGER.info("ProdInOutDTO={}, PurchaseProdInOut={}", JsonUtils.toJsonString(prodInOutDTO), JsonUtils.toJsonString(b2bPurchaseProdInOut));
+
+        List<PurchaseProdInOutDetail> b2bPurchaseProdInOutDetailList = BeanMapper.mapList(prodInOutFormDTO.getItems(), PurchaseProdInOutDetail.class);
+        convertToPronInOutDetail(prodInOutFormDTO.getItems(), b2bPurchaseProdInOutDetailList);
+        b2bPurchaseProdInOut.setDetails(b2bPurchaseProdInOutDetailList);
+        LOGGER.info("ProdIODetailDTOList={}, b2bPurchaseProdInOutDetailList={}", JsonUtils.toJsonString(prodInOutFormDTO.getItems()), JsonUtils.toJsonString(b2bPurchaseProdInOutDetailList));
+
+        boolean success = SendUtil.sendToB2B(b2bConfig.getCommon() + prodOutUrl, JsonUtils.toJsonString(b2bPurchaseProdInOut), companyDTO.getAccessKey());
+        if (success) {
+            LOGGER.info("采购验退单(反过账)上传成功, id={}", messageInfo.getBizId());
+            prodInOutApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
+        }
+    }
+
+    private void convertToPronInOut(ProdInOutDTO prodInOutDTO, PurchaseProdInOut b2bPurchaseProdInOut) {
+        b2bPurchaseProdInOut.setPi_rate(new BigDecimal(prodInOutDTO.getPi_rate()).floatValue());
+        b2bPurchaseProdInOut.setPi_inoutman(prodInOutDTO.getPi_auditman());
+        b2bPurchaseProdInOut.setPi_id(prodInOutDTO.getId());
+    }
+
+    private void convertToPronInOutDetail(List<ProdIODetailDTO> items, List<PurchaseProdInOutDetail> b2bPurchaseProdInOutDetailList){
+        for (int i = 0; i < items.size(); i++) {
+            ProdIODetailDTO prodIODetailDTO = items.get(i);
+            PurchaseProdInOutDetail b2bPurchaseProdInOutDetail = b2bPurchaseProdInOutDetailList.get(i);
+            b2bPurchaseProdInOutDetail.setPd_id(prodIODetailDTO.getId());
+            b2bPurchaseProdInOutDetail.setPd_detno(new BigDecimal(prodIODetailDTO.getPd_pdno()).shortValue());
+        }
+    }
+}

+ 67 - 4
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseOutTask.java

@@ -1,14 +1,77 @@
 package com.usoftchina.saas.transfers.task;
 
+import com.usoftchina.saas.account.api.CompanyApi;
+import com.usoftchina.saas.account.dto.CompanyDTO;
+import com.usoftchina.saas.inquiry.po.purchase.PurchaseProdInOut;
+import com.usoftchina.saas.inquiry.po.purchase.PurchaseProdInOutDetail;
+import com.usoftchina.saas.purchase.api.ProdInOutApi;
+import com.usoftchina.saas.purchase.dto.ProdIODetailDTO;
+import com.usoftchina.saas.purchase.dto.ProdInOutDTO;
+import com.usoftchina.saas.purchase.dto.ProdInOutFormDTO;
+import com.usoftchina.saas.transfers.config.B2BConfig;
 import com.usoftchina.saas.transfers.dto.MessageInfo;
+import com.usoftchina.saas.transfers.utils.SendUtil;
+import com.usoftchina.saas.utils.BeanMapper;
+import com.usoftchina.saas.utils.JsonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.math.BigDecimal;
+import java.util.List;
 
 /**
- * @author: guq
- * @create: 2019-01-08 13:53
+ * 采购延退单上传
+ * @author: chewnei
+ * @create: 2019-01-016 18:53
  **/
 public class SendPurchaseOutTask extends Executable{
+
+    @Autowired
+    private CompanyApi companyApi;
+    @Autowired
+    private ProdInOutApi prodInOutApi;
+    @Autowired
+    private B2BConfig b2bConfig;
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(SendProductTask.class);
+    private final String prodOutUrl = "/erp/purchase/prodReturn";
+
+
     @Override
-    public void execute(MessageInfo messageInfo) {
-        //TODO
+    public void execute(MessageInfo messageInfo) throws Exception {
+        CompanyDTO companyDTO = companyApi.getCompanyById(messageInfo.getCompanyId()).getData();
+
+        ProdInOutFormDTO prodInOutFormDTO = prodInOutApi.getProdFormData(Long.parseLong(messageInfo.getBizId())).getData();
+        ProdInOutDTO prodInOutDTO = prodInOutFormDTO.getMain();
+        PurchaseProdInOut b2bPurchaseProdInOut = BeanMapper.map(prodInOutDTO, PurchaseProdInOut.class);
+        convertToPronInOut(prodInOutDTO, b2bPurchaseProdInOut);
+        LOGGER.info("ProdInOutDTO={}, PurchaseProdInOut={}", JsonUtils.toJsonString(prodInOutDTO), JsonUtils.toJsonString(b2bPurchaseProdInOut));
+
+        List<PurchaseProdInOutDetail> b2bPurchaseProdInOutDetailList = BeanMapper.mapList(prodInOutFormDTO.getItems(), PurchaseProdInOutDetail.class);
+        convertToPronInOutDetail(prodInOutFormDTO.getItems(), b2bPurchaseProdInOutDetailList);
+        b2bPurchaseProdInOut.setDetails(b2bPurchaseProdInOutDetailList);
+        LOGGER.info("ProdIODetailDTOList={}, b2bPurchaseProdInOutDetailList={}", JsonUtils.toJsonString(prodInOutFormDTO.getItems()), JsonUtils.toJsonString(b2bPurchaseProdInOutDetailList));
+
+        boolean success = SendUtil.sendToB2B(b2bConfig.getCommon() + prodOutUrl, JsonUtils.toJsonString(b2bPurchaseProdInOut), companyDTO.getAccessKey());
+        if (success) {
+            LOGGER.info("采购验退单上传成功, id={}", messageInfo.getBizId());
+            prodInOutApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
+        }
+    }
+
+    private void convertToPronInOut(ProdInOutDTO prodInOutDTO, PurchaseProdInOut b2bPurchaseProdInOut) {
+        b2bPurchaseProdInOut.setPi_rate(new BigDecimal(prodInOutDTO.getPi_rate()).floatValue());
+        b2bPurchaseProdInOut.setPi_inoutman(prodInOutDTO.getPi_auditman());
+        b2bPurchaseProdInOut.setPi_id(prodInOutDTO.getId());
+    }
+
+    private void convertToPronInOutDetail(List<ProdIODetailDTO> items, List<PurchaseProdInOutDetail> b2bPurchaseProdInOutDetailList){
+        for (int i = 0; i < items.size(); i++) {
+            ProdIODetailDTO prodIODetailDTO = items.get(i);
+            PurchaseProdInOutDetail b2bPurchaseProdInOutDetail = b2bPurchaseProdInOutDetailList.get(i);
+            b2bPurchaseProdInOutDetail.setPd_id(prodIODetailDTO.getId());
+            b2bPurchaseProdInOutDetail.setPd_detno(new BigDecimal(prodIODetailDTO.getPd_pdno()).shortValue());
+        }
     }
 }

+ 58 - 7
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseTask.java

@@ -1,20 +1,29 @@
 package com.usoftchina.saas.transfers.task;
 
+import com.usoftchina.saas.account.api.AccountApi;
 import com.usoftchina.saas.account.api.CompanyApi;
-import com.usoftchina.saas.inquiry.api.B2BPurchaseApi;
+import com.usoftchina.saas.account.dto.AccountDTO;
+import com.usoftchina.saas.account.dto.CompanyDTO;
+import com.usoftchina.saas.document.api.VendorApi;
+import com.usoftchina.saas.document.dto.VendorListDTO;
 import com.usoftchina.saas.inquiry.po.purchase.Purchase;
 import com.usoftchina.saas.inquiry.po.purchase.PurchaseDetail;
 import com.usoftchina.saas.purchase.api.PurchaseApi;
 import com.usoftchina.saas.purchase.dto.PurchaseDTO;
+import com.usoftchina.saas.purchase.dto.PurchaseDetailDTO;
 import com.usoftchina.saas.purchase.dto.PurchaseFormDTO;
+import com.usoftchina.saas.transfers.config.B2BConfig;
 import com.usoftchina.saas.transfers.dto.MessageInfo;
+import com.usoftchina.saas.transfers.utils.SendUtil;
 import com.usoftchina.saas.utils.BeanMapper;
 import com.usoftchina.saas.utils.JsonUtils;
 import com.usoftchina.saas.utils.ObjectUtils;
+import com.usoftchina.saas.utils.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -26,28 +35,70 @@ public class SendPurchaseTask extends Executable {
     @Autowired
     private CompanyApi companyApi;
     @Autowired
+    private AccountApi accountApi;
+    @Autowired
     private PurchaseApi purchaseApi;
     @Autowired
-    private B2BPurchaseApi b2BPurchaseApi;
+    private VendorApi vendorApi;
+    @Autowired
+    private B2BConfig b2bConfig;
 
     private static final Logger LOGGER = LoggerFactory.getLogger(SendProductTask.class);
+    private final String purchaseUrl = "/erp/purchase";
 
     @Override
-    public void execute(MessageInfo messageInfo) {
+    public void execute(MessageInfo messageInfo) throws Exception {
+        CompanyDTO companyDTO = companyApi.getCompanyById(messageInfo.getCompanyId()).getData();
+        AccountDTO accountDTO = accountApi.getAccountById(messageInfo.getUserId()).getData();
         PurchaseFormDTO purchaseFormDTO = purchaseApi.getFormData(Long.parseLong(messageInfo.getBizId())).getData();
         if (!ObjectUtils.isEmpty(purchaseFormDTO)){
             //采购单主表数据
             PurchaseDTO purchaseDTO = purchaseFormDTO.getMain();
             Purchase b2bPurchase = BeanMapper.map(purchaseDTO, Purchase.class);
-            //b2bPurchase.setVe_uu(0L);
+            convertPurchase(purchaseDTO, b2bPurchase, accountDTO, messageInfo.getCompanyId());
+            LOGGER.info("purchaseDTO={}, b2bPurchase={}", JsonUtils.toJsonString(purchaseDTO), JsonUtils.toJsonString(b2bPurchase));
             //采购单明细表数据
             List<PurchaseDetail> b2bPurchaseDetailList = BeanMapper.mapList(purchaseFormDTO.getItems(), PurchaseDetail.class);
+            convertPurchaseDetail(purchaseFormDTO.getItems(), b2bPurchaseDetailList);
+            LOGGER.info("PurchaseDetailDTO={}, b2bPurchaseDetailList={}", JsonUtils.toJsonString(purchaseFormDTO.getItems()), JsonUtils.toJsonString(b2bPurchaseDetailList));
+
             b2bPurchase.setPurchaseDetails(b2bPurchaseDetailList);
 
-            /*SavePurchaseListResp savePurchaseListResp = */
-            b2BPurchaseApi.savePurchase(JsonUtils.toJsonString(b2bPurchase));
-            purchaseApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
+            boolean success = SendUtil.sendToB2B(b2bConfig.getCommon() + purchaseUrl, JsonUtils.toJsonString(b2bPurchase), companyDTO.getAccessKey());
+            if (success) {
+                purchaseApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
+            }
+        }
+
+    }
+
+    private void convertPurchase(PurchaseDTO purchaseDTO, Purchase b2bPurchase, AccountDTO accountDTO, Long companyId) {
+        //人员信息
+        b2bPurchase.setEm_email(accountDTO.getEmail());
+        b2bPurchase.setEm_mobile(accountDTO.getMobile());
+        b2bPurchase.setEm_name(accountDTO.getRealname());
+        b2bPurchase.setEm_uu(accountDTO.getUu());
+        VendorListDTO vendorListDTO = vendorApi.getDataById(new BigDecimal(purchaseDTO.getPu_vendid()).longValue()).getData();
+        if (!ObjectUtils.isEmpty(vendorListDTO)){
+            String uu = vendorListDTO.getMain().getVe_uu();
+            if (!StringUtils.isEmpty(uu)){
+                b2bPurchase.setVe_uu(Long.parseLong(uu));
+            }
         }
+        b2bPurchase.setPu_rate(new BigDecimal(purchaseDTO.getPu_rate()).floatValue());
+        b2bPurchase.setPu_remark(purchaseDTO.getPu_remark());
+        b2bPurchase.setPu_auditman(purchaseDTO.getPu_auditman());
+        b2bPurchase.setPu_recordman(purchaseDTO.getCreatorName());
+        b2bPurchase.setPu_shipaddresscode(purchaseDTO.getPu_shipaddresscode());
+        b2bPurchase.setPu_id(purchaseDTO.getId());
+    }
 
+    private void convertPurchaseDetail(List<PurchaseDetailDTO> items, List<PurchaseDetail> b2bPurchaseDetailList){
+        for (int i = 0; i < items.size(); i++) {
+            PurchaseDetailDTO purchaseDetailDTO = items.get(i);
+            PurchaseDetail b2bPurchaseDetail = b2bPurchaseDetailList.get(i);
+            b2bPurchaseDetail.setPd_detno(new BigDecimal(purchaseDetailDTO.getPd_detno()).shortValue());
+        }
     }
+
 }

+ 35 - 0
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/utils/SendUtil.java

@@ -0,0 +1,35 @@
+package com.usoftchina.saas.transfers.utils;
+
+import com.usoftchina.saas.utils.JsonUtils;
+import com.usoftchina.saas.utils.http.HttpUtil;
+import com.usoftchina.saas.utils.http.HttpUtil.Response;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Description 发送请求至B2B工具类
+ * @Author chenwei
+ * @Date 2019/01/16
+ */
+public class SendUtil {
+
+    /**
+     *  发送请求给B2B
+     * @param url         URL
+     * @param data        要发送的数据
+     * @param accessSecretKey       企业秘钥
+     * @return
+     * @throws Exception
+     */
+    public static boolean sendToB2B(String url, String data, String accessSecretKey) throws Exception {
+        Map<String, String> params = new HashMap<String, String>();
+        params.put("data", JsonUtils.toJsonString(data));
+        Response response = HttpUtil.sendPostRequest(url, params, true, accessSecretKey);
+        if (response.getStatusCode() == 200){
+            return true;
+        }
+        return false;
+    }
+
+}

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

@@ -41,6 +41,9 @@ spring:
     port: 6379
   profiles:
     active: dev
+  jackson:
+    date-format: yyyy-MM-dd HH:mm:ss
+    time-zone: GMT+8
 management:
   endpoints:
     web:
@@ -92,4 +95,4 @@ b2b:
     inquiry: https://test-inquiry.uuzcc.cn
     Component: https://test-mall.uuzcc.cn
     product: http://test-product.uuzcc.cn
-    uu: https://test-b2b.uuzcc.cn
+    common: https://test-b2b.uuzcc.cn

+ 4 - 0
applications/transfers/transfers-server/src/main/resources/mapper/ApcheckMapper.xml

@@ -315,4 +315,8 @@
   <select id="getVendorByuu" resultMap="vendorMap">
     select * from vendor where ve_uu=#{uu} and companyid=#{companyid}
   </select>
+
+  <select id="count" parameterType="long" resultType="int">
+    select count(1) from apcheck where ac_b2bid=#{id}
+  </select>
 </mapper>

+ 4 - 0
applications/transfers/transfers-server/src/main/resources/mapper/SaledownMapper.xml

@@ -462,4 +462,8 @@
     <result column="cu_remark" jdbcType="VARCHAR" property="cu_remark" />
     <result column="cu_currency" jdbcType="VARCHAR" property="cu_currency" />
   </resultMap>
+
+  <select id="count" parameterType="long" resultType="int">
+    select count(1) from saledown where B2b_pu_id = #{id}
+  </select>
 </mapper>

+ 94 - 0
applications/transfers/transfers-server/src/test/java/com/usoftchina/saas/transfers/task/SendTaskTest.java

@@ -0,0 +1,94 @@
+package com.usoftchina.saas.transfers.task;
+
+import com.usoftchina.saas.account.api.AccountApi;
+import com.usoftchina.saas.account.api.CompanyApi;
+import com.usoftchina.saas.account.dto.AccountDTO;
+import com.usoftchina.saas.account.dto.CompanyDTO;
+import com.usoftchina.saas.inquiry.po.purchase.Purchase;
+import com.usoftchina.saas.inquiry.po.purchase.PurchaseDetail;
+import com.usoftchina.saas.purchase.api.PurchaseApi;
+import com.usoftchina.saas.purchase.dto.PurchaseDTO;
+import com.usoftchina.saas.purchase.dto.PurchaseDetailDTO;
+import com.usoftchina.saas.purchase.dto.PurchaseFormDTO;
+import com.usoftchina.saas.utils.BeanMapper;
+import com.usoftchina.saas.utils.JsonUtils;
+import com.usoftchina.saas.utils.ObjectUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @Author chenwei
+ * @Date 2019/01/16
+ */
+@SpringBootTest
+@RunWith(SpringJUnit4ClassRunner.class)
+@EnableAutoConfiguration
+public class SendTaskTest {
+
+    @Autowired
+    private PurchaseApi purchaseApi;
+    @Autowired
+    private AccountApi accountApi;
+    @Autowired
+    private CompanyApi companyApi;
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(SendTaskTest.class);
+
+    @Test
+    public void testA_purchaseTask(){
+
+        AccountDTO accountDTO = accountApi.getAccountById(67L).getData();
+        PurchaseFormDTO purchaseFormDTO = purchaseApi.getFormData(169L).getData();
+        if (!ObjectUtils.isEmpty(purchaseFormDTO)){
+            //采购单主表数据
+            PurchaseDTO purchaseDTO = purchaseFormDTO.getMain();
+            Purchase b2bPurchase = BeanMapper.map(purchaseDTO, Purchase.class);
+            convertPurchase(purchaseDTO, b2bPurchase, accountDTO);
+            LOGGER.info("purchaseDTO={}, b2bPurchase={}", JsonUtils.toJsonString(purchaseDTO), JsonUtils.toJsonString(b2bPurchase));
+
+            //采购单明细表数据
+            List<PurchaseDetail> b2bPurchaseDetailList = BeanMapper.mapList(purchaseFormDTO.getItems(), PurchaseDetail.class);
+            convertPurchaseDetail(purchaseFormDTO.getItems(), b2bPurchaseDetailList);
+            b2bPurchase.setPurchaseDetails(b2bPurchaseDetailList);
+
+            LOGGER.info("PurchaseDetailDTO={}, b2bPurchaseDetailList={}", JsonUtils.toJsonString(purchaseFormDTO.getItems()), JsonUtils.toJsonString(b2bPurchaseDetailList));
+
+        }
+    }
+
+    private void convertPurchase(PurchaseDTO purchaseDTO, Purchase b2bPurchase, AccountDTO accountDTO) {
+        //人员信息
+        b2bPurchase.setEm_email(accountDTO.getEmail());
+        b2bPurchase.setEm_mobile(accountDTO.getMobile());
+        b2bPurchase.setEm_name(accountDTO.getRealname());
+        b2bPurchase.setEm_uu(accountDTO.getUu());
+
+        CompanyDTO companyDTO = companyApi.getCompanyById(1L).getData();
+        b2bPurchase.setPu_cop(companyDTO.getName());
+        //b2bPurchase.setVe_uu(ObjectUtils.getLongValue(purchaseDTO.getPu_venduu()));
+        b2bPurchase.setPu_rate(new BigDecimal(purchaseDTO.getPu_rate()).floatValue());
+        b2bPurchase.setPu_remark(purchaseDTO.getPu_remark());
+        b2bPurchase.setPu_auditman(purchaseDTO.getPu_auditman());
+        b2bPurchase.setPu_recordman(purchaseDTO.getCreatorName());
+        b2bPurchase.setPu_shipaddresscode(purchaseDTO.getPu_shipaddresscode());
+        b2bPurchase.setPu_id(purchaseDTO.getId());
+    }
+
+    private void convertPurchaseDetail(List<PurchaseDetailDTO> items, List<PurchaseDetail> b2bPurchaseDetailList){
+        for (int i = 0; i < items.size(); i++) {
+            PurchaseDetailDTO purchaseDetailDTO = items.get(i);
+            PurchaseDetail b2bPurchaseDetail = b2bPurchaseDetailList.get(i);
+            b2bPurchaseDetail.setPd_detno(new BigDecimal(purchaseDetailDTO.getPd_detno()).shortValue());
+        }
+    }
+
+}

+ 10 - 2
base-servers/account/account-api/src/main/java/com/usoftchina/saas/account/api/AccountApi.java

@@ -87,7 +87,7 @@ public interface AccountApi {
      * @param companyId
      * @return
      */
-    @PostMapping("/bind/company")
+    @PostMapping("/account/bind/company")
     Result bindCompany(@RequestParam("accountId") long accountId, @RequestParam("companyId") long companyId);
 
     /**
@@ -96,7 +96,7 @@ public interface AccountApi {
      * @param roleIds
      * @return
      */
-    @PostMapping("/bind/roles")
+    @PostMapping("/account/bind/roles")
     Result bindRoles(@RequestParam("accountId") Long accountId, @RequestParam("roleIds") String roleIds);
 
     /**
@@ -116,4 +116,12 @@ public interface AccountApi {
     */
     @PostMapping("/account/updatePassword")
     Result updatePassword(@RequestBody CookieInfo info);
+
+    /**
+     * 账户缓存清除
+     * @param id    账户ID
+     * @return
+     */
+    @GetMapping("/account/cache/clear/{id}")
+    Result clearCache(@PathVariable("id") Long id);
 }

+ 11 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/AccountController.java

@@ -491,6 +491,17 @@ public class AccountController {
         return Result.success();
     }
 
+    /**
+     * 清除指定账户的缓存
+     * @param id
+     * @return
+     */
+    @GetMapping("/cache/clear/{id}")
+    public Result clearCache(@PathVariable("id") Long id){
+        accountService.clearCache(id);
+        return Result.success();
+    }
+
     /**
      * 分享加入
      * @param shareAddDTO

+ 0 - 12
frontend/saas-portal-web/src/components/conenter/home.vue

@@ -371,9 +371,7 @@
           this.download()
           break;
       };
-      // document.documentElement.scrollTop = this.isfeature;
       window.addEventListener("scroll",this.handleFun);
-        // this.scrollH = Math.floor($('#feature').offset().top) - 260;
     },
     computed: {
       setTokenPage() {
@@ -395,7 +393,6 @@
     },
     methods: {
       handleFun(){
-        let top = $(document).scrollTop();
         let Y = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
         if ($('#feature').offset()) {
           // var scrollH = Math.floor($('#feature').offset().top) - 260;//500
@@ -611,7 +608,6 @@
           let featH = Math.floor($('#feature').offset().top) - 70;
           this.animate(featH);//690
         },10);
-        // console.log($(document).scrollTop())
       },
       //功能
       service2(){
@@ -623,7 +619,6 @@
       },
       // 下载
       download(){
-        // document.documentElement.scrollTop = 4190;
         // window.scrollTo(0,4190);
         clearInterval(this.timer);
         setTimeout(()=>{
@@ -644,12 +639,6 @@
             step = step > 0 ? Math.ceil(step) : Math.floor(step);
             leader = leader + step;
             $(document).scrollTop(leader);
-        //     document.documentElement.scrollTop++;
-        //     if(document.documentElement.scrollTop ){
-        //       document.documentElement.scrollTop = leader;
-        //   }else if(document.body.scrolltop){
-        //       document.body.scrolltop = leader;
-        //   }
             if (leader == target) {
                 clearInterval(this.timer);
             }
@@ -662,7 +651,6 @@
         } else {
           this.$store.commit('problemtrue')
         }
-        // this.isproblem = true
       }
     }
   }

+ 2 - 1
frontend/saas-portal-web/static/css/main.css

@@ -334,7 +334,8 @@ main > section {
     width: 14px;
     height: 14px;
     border-radius: 50%;
-    margin: 7px 8px 0 0;
+    margin-top: 1.2%;
+    margin-right: 1%;
 }
 .bz-right-conent li {
     border-bottom: 1px solid #E8ECEF;

+ 14 - 0
frontend/saas-web/app/model/report/Purchase.js

@@ -11,6 +11,13 @@ Ext.define('saas.model.report.Purchase', {
         { name: 'pd_taxprice', type: 'float' }, // 单价
         { name: 'pd_price', type: 'float' }, // 含税单价
         { name: 'pd_taxtotal', type: 'float' }, // 金额
+        { name: 'pd_taxtotal*pu_rate', type: 'float',
+            convert: function(v, rec) {
+                var t = (rec.get('pd_taxtotal') || 0.0) * (rec.get('pu_rate') || 1.0);
+                return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
+            },
+            depends: ['pu_rate', 'pd_taxtotal']
+         }, // 金额本位币
         { name: 'pd_taxrate', type: 'int' }, // 税率
         { name: 'pd_total-pd_taxtotal', type: 'float', // 税额
             convert: function(v, rec) {
@@ -20,6 +27,13 @@ Ext.define('saas.model.report.Purchase', {
             depends: ['pd_total', 'pd_taxtotal']
         },
         { name: 'pd_total', type: 'float' }, // 价税合计
+        { name: 'pd_total*pu_rate', type: 'float',
+            convert: function(v, rec) {
+                var t = (rec.get('pd_total') || 0.0) * (rec.get('pu_rate') || 1.0);
+                return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
+            },
+            depends: ['pu_rate', 'pd_total'] 
+        }, // 价税合计本位币
         { name: 'pd_pdacceptqty', type: 'float' }, // 收货数量
         { name: 'pu_currency', type:'string'},//币别
         { name: 'pu_rate', type:'float'},//汇率

+ 16 - 2
frontend/saas-web/app/model/report/Sale.js

@@ -18,7 +18,14 @@ Ext.define('saas.model.report.Sale', {
         { name: 'sd_price', type: 'float' },
         { name: 'sd_netprice', type: 'float' },
         { name: 'sd_price', type: 'float' },
-        { name: 'sd_nettotal', type: 'float' },
+        { name: 'sd_nettotal', type: 'float' },//金额
+        { name: 'sd_nettotal*sa_rate', type: 'float',
+            convert: function(v, rec) {
+                var t = (rec.get('sd_nettotal') || 0.0) * (rec.get('sa_rate') || 1.0);
+                return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
+            },
+            depends: ['sa_rate', 'sd_nettotal']
+         },//金额本位币
         { name: 'sd_taxrate', type: 'float' },
         { name: 'sd_total - sd_nettotal', type: 'float',
             convert: function(v, rec) {
@@ -27,7 +34,14 @@ Ext.define('saas.model.report.Sale', {
             },
             depends: ['sd_total', 'sd_nettotal']
         },
-        { name: 'sd_total', type: 'float' },
+        { name: 'sd_total', type: 'float' },//价税合计
+        { name: 'sd_total*sa_rate', type: 'float' ,
+            convert: function(v, rec) {
+                var t = (rec.get('sd_total') || 0.0) * (rec.get('sa_rate') || 1.0);
+                return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
+            },
+            depends: ['sd_total', 'sa_rate']
+        },//价税合计本位币
         { name: 'sd_pdsendqty', type: 'float' },
         { name: 'sa_currency', type: 'string' },//币别
         { name: 'sa_rate', type: 'float' },//税率

+ 29 - 6
frontend/saas-web/app/model/report/SaleProfit.js

@@ -15,9 +15,9 @@ Ext.define('saas.model.report.SaleProfit', {
         { name: 'pd_outqty', type: 'float' },
         { name: 'pr_unit', type: 'string' },
         { name: 'pd_netprice', type: 'float' },
-        { name: 'pd_sendprice', type: 'float' },
+        { name: 'pd_sendprice', type: 'float' },//含税单价
         { name: 'pd_nettotal', type: 'float' },
-        { name: 'pd_taxrate', type: 'int' },
+        { name: 'pd_taxrate', type: 'int' },//税率
         { name: 'pd_ordertotal-pd_nettotal', type: 'float',
             convert: function(v, rec) {
                 var t = (rec.get('pd_ordertotal') || 0.0) - (rec.get('pd_nettotal') || 0.0);
@@ -25,11 +25,34 @@ Ext.define('saas.model.report.SaleProfit', {
             },
             depends: ['pd_ordertotal', 'pd_nettotal']
         }, 
-        { name: 'pd_ordertotal', type: 'float' },
-        { name: 'pd_price', type: 'float' },
+        { name: 'pd_ordertotal', type: 'float' },//价税合计
+        { name: 'pd_ordertotal*pi_rate', type: 'float' ,
+            convert: function(v, rec) {
+                var t = (rec.get('pd_ordertotal') || 0.0) * (rec.get('pi_rate') || 1.0);
+                return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
+            },
+            depends: ['pd_ordertotal', 'pi_rate']
+        },//价税合计本位币
+        { name: 'pd_price', type: 'float' },//成本单价
         { name: 'pd_total', type: 'float' },
-        { name: 'pd_profit', type: 'float' },
-        { name: 'pd_profitpresent', type: 'float' },
+        { name: 'pd_profit', type: 'float' ,
+            convert: function(v, rec) {
+                var t = (((rec.get('pd_sendprice') || 0.0) * (rec.get('pi_rate') || 1.0) / (1 + (rec.get('pd_taxrate') || 0.0)/100 )) 
+                - (rec.get('pd_price') || 0.0) )*(rec.get('pd_outqty') || 0.0);
+                return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
+            },
+            depends: ['pd_sendprice', 'pi_rate','pd_taxrate','pd_price','pd_outqty']
+        },//毛利润(元) = ( (含税单价 * 汇率) / (1+税率%) - 成本单价 ) *  
+        { name: 'pd_profitpresent', type: 'float',
+            convert: function(v, rec) {
+                var t = (((rec.get('pd_sendprice') || 0.0) * (rec.get('pi_rate') || 1.0) / (1 + (rec.get('pd_taxrate') || 0.0)/100 )) 
+                - (rec.get('pd_price') || 0.0)) 
+                /
+                (((rec.get('pd_sendprice') || 0.0) * (rec.get('pi_rate') || 1.0) / (1 + (rec.get('pd_taxrate') || 0.0)/100 )));
+                return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
+            },
+            depends: ['pd_sendprice', 'pi_rate','pd_taxrate','pd_price']
+        },//毛利润率 = (含税单价*汇率/(1+税率%) - 成本单价) / (含税单价*汇率/(1+税率%))
         { name: 'pd_remark', type: 'string' },
         { name: 'pi_currency', type: 'string' },
         { name: 'pi_rate', type: 'float' }

+ 1 - 1
frontend/saas-web/app/view/core/base/BasePanel.js

@@ -50,7 +50,7 @@ Ext.define('saas.view.core.base.BasePanel', {
                 frame:false,
                 xtype: 'toolbar',
                 dock: 'top',
-                // layout: 'column',
+                layout: 'column',
                 style: {
                     margin: '0 0 12px 0',
                     padding: '10px 0 14px 8px',

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

@@ -69,13 +69,18 @@ Ext.define('saas.view.core.form.field.ConDbfindTrigger', {
             });
             field1.on('change', function(f) {
                 let field1 = me.items.items[1];
+                
                 if(f.dbValues) {
+                    f.ownerCt.dbValues = f.dbValues;
                     let value = f.dbValues[f.dbfinds[1].from];
                     field1.setValue(value);
                     field1.publishState('value', value);
+                }else {
+                    f.ownerCt.dbValues = {};
                 }
             });
-            field1.on('blur', function() {
+            field1.on('blur', function(f) {
+                f.ownerCt.dbValues = f.dbValues;
                 me.fireEvent('change', this)
             });
 

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

@@ -58,7 +58,7 @@ Ext.define('saas.view.core.form.FormPanel', {
             text: '新增',
             hidden: true,
             bind: {
-                hidden: '{!id}'
+                hidden: '{!showAddBtn || !id}'
             },
             handler: 'add'
         }, {
@@ -75,7 +75,7 @@ Ext.define('saas.view.core.form.FormPanel', {
             text: '保存',
             handler: 'onSave',
             bind: {
-                hidden: '{'+ me._statusCodeField + ' == "' + me.auditTexts.auditCode + '"}',
+                hidden: '{!showSaveBtn || '+ me._statusCodeField + ' == "' + me.auditTexts.auditCode + '"}',
                 // disabled: '{!base.valid || '+ me._statusCodeField + ' == "AUDITED" || ' + me._statusCodeField + ' == "OPEN"}'
                 disabled: '{!base.valid || '+ me._statusCodeField + ' == "' + me.auditTexts.auditCode + '"}'
             }
@@ -84,7 +84,7 @@ Ext.define('saas.view.core.form.FormPanel', {
             xtype: 'button',
             text: '删除',
             bind: {
-                hidden: '{deleteHidden || ' + me._statusCodeField + '=="' + me.auditTexts.auditCode + '"}'
+                hidden: '{!showDeleteBtn || deleteHidden || ' + me._statusCodeField + '=="' + me.auditTexts.auditCode + '"}'
             },
             handler: 'delete'
         }, {
@@ -127,7 +127,7 @@ Ext.define('saas.view.core.form.FormPanel', {
             target: 'main',
             handler: 'onSetting',
             bind: {
-                hidden: '{!isAdmin}'
+                hidden: '{!configurable || !isAdmin}'
             }
         }];
 

+ 6 - 2
frontend/saas-web/app/view/core/form/FormPanelModel.js

@@ -11,13 +11,17 @@ Ext.define('saas.view.core.form.FormPanelModel', {
             codeEditable: false, // 单据编号是否可编辑
         },
         auditBtnText: '审核', // 审核按钮默认text
+        showAddBtn: true, // 显示新增按钮
+        showSaveBtn: true, // 显示保存按钮
+        showDeleteBtn: true, // 显示删除按钮
         showCopyBtn: true, // 显示复制按钮
-        showPrintBtn: false, // 显示打印按钮
         showAuditBtn: true, // 显示审核、反审核按钮
+        showPrintBtn: false, // 显示打印按钮
+        configurable: true, // 显示界面设置按钮
+
         detailBindeFields: [], // 从表绑定列
         detailStore: null, // 从表store
 
-        configurable: true
     },
 
     formulas:{

+ 3 - 3
frontend/saas-web/app/view/core/report/ReportPanel.js

@@ -27,7 +27,7 @@ Ext.define('saas.view.core.report.ReportPanel', {
     exportAble: true,
     showMySummary: true,
     queryMode: 'DETAIL',
-
+   
     calculateProperty: 'data.calculate',
     rootProperty: 'data.list.list',
     totalProperty: 'data.list.total',
@@ -382,11 +382,11 @@ Ext.define('saas.view.core.report.ReportPanel', {
                     }
                 });
             }
-
+            
             if (c.summaryType) {
                 summarys.push({
                     field: c.dataIndex,
-                    operation: c.summaryType,
+                    operation: c._summaryType || c.summaryType,
                 });
                 me.initSummaryType(c);
             }

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

@@ -139,7 +139,7 @@ Ext.define('saas.view.document.customer.FormPanel', {
                 dbfinds: [{
                     from: 'cr_name', to: 'cu_currency'
                 }, {
-                    from: 'cr_rate', to: 'cu_taxrate'
+                    from: 'cr_rate', to: 'cr_rate'
                 }],
                 defaultValue: {
                     cu_currency: this.getViewModel().get('defaultCurrency'),
@@ -148,28 +148,28 @@ Ext.define('saas.view.document.customer.FormPanel', {
                 supFieldConfig: {
                     xtype: 'numberfield',
                     readOnly: false,
+                    ignore:true,
                     defaultReadOnly: false,
                     decimalPrecision: 6,
-                    vtype: 'positiveNumber'
+                    vtype: 'positiveNumber',
+                    listeners: {
+                        change: function(f, v) {
+                            var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency');
+                            f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency);
+                        }
+                    }
                 },
                 group: '交易信息',
-            // }, {
-            //     xtype: "currencyDbfindTrigger",
-            //     name: "cu_currency",
-            //     fieldLabel: "币别",
-            //     allowBlank: false,
-            //     columnWidth: 0.25,
-            //     group: '交易信息',
-            // }, {
-            //     xtype: "numberfield",
-            //     name: "cu_taxrate",
-            //     fieldLabel: "税率(%)",
-            //     allowBlank: false,
-            //     columnWidth: 0.25,
-            //     decimalPrecision: 6,
-            //     vtype: 'positiveNumber'
-            //     group: '交易信息',
-            },{
+            }, {
+                xtype: "numberfield",
+                name: "cu_taxrate",
+                fieldLabel: "税率(%)",
+                allowBlank: false,
+                columnWidth: 0.25,
+                minValue: 0,
+                maxValue: 100,
+                group: '交易信息',
+            }, {
                 xtype: "numberfield",
                 hideTrigger: true,
                 name: "cu_beginaramount",

+ 164 - 0
frontend/saas-web/app/view/document/uusetting/UUSetting.js

@@ -0,0 +1,164 @@
+Ext.define('saas.view.document.uusetting.UUSetting', {
+    extend: 'Ext.panel.Panel',
+    xtype: 'document-uusetting',
+    autoScroll: true,
+    layout:'fit',
+    controller:'document-uusetting',
+    viewModel: {
+        type: 'document-uusetting'
+    },
+    defaultType:'vendorkind',
+    requires: [
+        'Ext.button.Segmented'
+    ],
+    
+    etc:{
+        common: {
+            columns: [{
+                xtype:'actioncolumn',
+                text:'操作',
+                align: 'center',
+                items: [{
+                    xtype: 'button',
+                    tooltip: 'UU设置',
+                    iconCls: 'x-sa sa-setting',
+                    handler: 'onUUSetting'
+                }]
+            }]
+        },
+        vendorkind:{
+            columns: [{
+                text: '供应商编号',
+                dataIndex: 've_code',
+                width: 120
+            }, {
+                text: '供应商名称',
+                dataIndex: 've_name',
+                width: 120
+            }, {
+                text: '状态',
+                dataIndex: 've_status',
+                width: 80,
+                align: 'center'
+            }, {
+                text: '类型',
+                dataIndex: 've_type',
+                width: 100,
+                align: 'center'
+            }, {
+                text: '采购员',
+                dataIndex: 've_buyername',
+                width: 120,
+            }, {
+                text: '供应商UU',
+                dataIndex: 've_uu',
+                width: 120
+            }],
+        },
+        customerkind:{
+            columns: [{
+                text: '客户编号',
+                dataIndex: 'cu_code',
+                width: 120
+            }, {
+                text: '客户名称',
+                dataIndex: 'cu_name',
+                width: 120
+            }, {
+                text: '状态',
+                dataIndex: 'cu_status',
+                width: 80,
+                align: 'center'
+            }, {
+                text: '类型',
+                dataIndex: 'cu_type',
+                width: 100,
+                align: 'center'
+            }, {
+                text: '业务员',
+                dataIndex: 'cu_sellername',
+                width: 120,
+            }, {
+                text: '客户UU',
+                dataIndex: 'cu_uu',
+                width: 120
+            }],
+        }
+    },
+
+    initComponent: function() {
+        var me = this;
+
+        Ext.apply(me, {
+            dockedItems: [{
+                xtype: 'toolbar',
+                dock: 'top',
+                padding: '12 5 0 12',
+                items: [{
+                    xtype: 'segmentedbutton',
+                    reference: 'dataKind',
+                    value: 'vendorkind',
+                    name : 'segmentedbutton',
+                    items: [{
+                        name:'vendorkind',
+                        text: '供应商',
+                        value: 'vendorkind',
+                    }, {
+                        name:'customerkind',
+                        text: '客户',
+                        value: 'customerkind',
+                    }],
+                    listeners: {
+                        toggle: 'onToggle'
+                    }
+                }, '->', {
+                    xtype: 'textfield',
+                    emptyText: '输入编号/名称'
+                }, {
+                    xtype: 'button',
+                    text: '查询',
+                    handler: 'onQuery'
+                }]
+            }],
+            items:[{
+                xtype:'grid',
+                margin: 12,
+                flex: 1,
+                border: 1,
+                plugins: [{
+                    ptype: 'menuclipboard'
+                }],
+                dockedItems: [{
+                    xtype: 'pagingtoolbar',
+                    dock: 'bottom',
+                    cls:'x-basepanel-pagingtoolbar',
+                    displayInfo: true,
+                    bind: {
+                        store: '{vendorkind}',
+                    },
+                    items: [{
+                        iconCls: 'x-sa sa-setting',
+                        text: '列设置',
+                        handler: 'onColSetting',
+                        bind: {
+                            hidden: '{!configurable || !isAdmin}'
+                        }
+                    }]
+                }],
+                listeners:{
+                    boxready: 'onBoxReady',
+                    render:'loadDefualt'
+                }
+            }],
+        });
+
+        me.callParent(arguments);
+    },
+
+    refresh: function() {
+        var store = this.down('grid').store;
+        store.load();
+    }
+})
+
+

+ 79 - 0
frontend/saas-web/app/view/document/uusetting/UUSettingController.js

@@ -0,0 +1,79 @@
+Ext.define('saas.view.document.uusetting.UUSettingController', {
+    extend: 'Ext.app.ViewController',
+    alias: 'controller.document-uusetting',
+    
+    onBoxReady: function(grid) {
+        var me = this,
+        vm = me.getViewModel();
+
+        var gridBodyBox = grid.body.dom.getBoundingClientRect(),
+        gridBodyBoxHeight = gridBodyBox.height;
+        var pageSize = Math.floor(gridBodyBoxHeight / 33);
+
+        vm.getStore('vendorkind').setPageSize(pageSize);
+        vm.getStore('customerkind').setPageSize(pageSize);
+    },
+
+    loadDefualt:function(grid){
+        var me = this,
+        view = me.getView(),
+        vm = me.getViewModel(),
+        defaultKind = view.defaultType;
+        
+        var etc = view.etc;
+        var columns = etc[defaultKind].columns;
+        var store = vm.getStore(defaultKind);
+        store.load();
+        grid.reconfigure(store, Ext.Array.merge(columns, etc.common.columns));
+        grid.kind = defaultKind
+    },
+
+    onToggle: function(container, button, pressed) {
+        var me = this,
+        view = me.getView(),
+        vm = me.getViewModel(),
+        kind = button.value,
+        grid = view.down('grid');
+        
+        var etc = view.etc;
+        var columns = etc[kind].columns;
+        var store = vm.getStore(kind);
+        store.load();
+        grid.reconfigure(store, Ext.Array.merge(columns, etc.common.columns));
+        grid.kind = kind;
+    },
+
+    onQuery: function() {
+        console.log('onQuery');
+    },
+
+    onUUSetting: function(tableView, rowIdx, colIdx, btn, e, record, tr) {
+        var me = this;
+        var grid = tableView.up('grid');
+        var kind = grid.kind;
+        var config = {
+            kind: kind
+        };
+        if(kind == 'vendorkind') {
+            config.cname = record.get('ve_name');
+        }else {
+            config.cname = record.get('cu_name');
+        }
+        this.getViewModel().setData(record.data);
+        this.showUUSettingWin(config);
+    },
+
+    showUUSettingWin: function(config) {
+        var me = this,
+        view = me.getView();
+
+        var win = Ext.getCmp();
+        if(!win) {
+            win = Ext.create('saas.view.document.uusetting.UUSettingWin', Ext.Object.merge({
+                listView: view,
+            }, config));
+            view.add(win);
+        }
+        win.show();
+    }    
+});

+ 83 - 0
frontend/saas-web/app/view/document/uusetting/UUSettingModel.js

@@ -0,0 +1,83 @@
+Ext.define('saas.view.document.uusetting.UUSettingModel', {
+    extend: 'Ext.app.ViewModel',
+    alias: 'viewmodel.document-uusetting',
+    data: {
+        title: '客户类型'
+    },
+    stores: {
+        vendorkind:{
+            fields:['ve_code', 've_name', 've_status', 've_type', 've_buyername', 've_uu'],
+            proxy: {
+                type: 'ajax',
+                url: '/api/document/vendor/list',
+                actionMethods: {
+                    read: 'GET'
+                },
+                reader: {
+                    type: 'json',
+                    rootProperty: 'data.list',
+                    totalProperty: 'data.total'
+                },
+                listeners: {
+                    exception: function(proxy, response, operation, eOpts) {
+                        if(operation.success) {
+                            if(response.timedout) {
+                                saas.util.BaseUtil.showErrorToast('请求超时');
+                            }
+                        }else {
+                            console.error('exception: ', response);
+                            saas.util.BaseUtil.showErrorToast('查询失败:' + (response.responseJson?response.responseJson.message:'请求超时'));
+                        }
+                    }
+                }
+            },
+            pageSize: null,
+            autoLoad: false,
+            listeners: {
+                beforeload: function (store, op) {
+                    Ext.apply(store.proxy.extraParams, {
+                        number: store.exportNumber?store.exportNumber:op._page,
+                        size: store.exportPageSize?store.exportPageSize:store.pageSize,
+                    });
+                }
+            }
+        },
+        customerkind: {
+            fields:['cu_code', 'cu_name', 'cu_status', 'cu_type', 'cu_sellername', 'cu_uu'],
+            proxy: {
+                type: 'ajax',
+                url: '/api/document/customer/list',
+                actionMethods: {
+                    read: 'GET'
+                },
+                reader: {
+                    type: 'json',
+                    rootProperty: 'data.list',
+                    totalProperty: 'data.total'
+                },
+                listeners: {
+                    exception: function(proxy, response, operation, eOpts) {
+                        if(operation.success) {
+                            if(response.timedout) {
+                                saas.util.BaseUtil.showErrorToast('请求超时');
+                            }
+                        }else {
+                            console.error('exception: ', response);
+                            saas.util.BaseUtil.showErrorToast('查询失败:' + (response.responseJson?response.responseJson.message:'请求超时'));
+                        }
+                    }
+                }
+            },
+            pageSize: null,
+            autoLoad: false,
+            listeners: {
+                beforeload: function (store, op) {
+                    Ext.apply(store.proxy.extraParams, {
+                        number: store.exportNumber?store.exportNumber:op._page,
+                        size: store.exportPageSize?store.exportPageSize:store.pageSize,
+                    });
+                }
+            }
+        }
+    }
+});

+ 459 - 0
frontend/saas-web/app/view/document/uusetting/UUSettingWin.js

@@ -0,0 +1,459 @@
+Ext.define('saas.view.document.uusetting.UUSettingWin', {
+    extend: 'Ext.window.Window',
+    xtype: 'uusettingwin',
+
+    title: '设置企业UU',
+    width: 680,
+    cls: 'x-window-dbfind',
+    closlayout: 'fit',
+    modal: true,
+    resizable: false,
+    bodyPadding: 20,
+
+    etc: {
+        vendorkind: {
+            uuName: 've_uu',
+            getUUUrl: '/api/document/vendor/getVendorUU',
+            saveUrl: '/api/document/vendor/save',
+            formItems: [{
+                xtype: 'hidden',
+                name: 'id',
+                bind: '{id}',
+                fieldLabel: 'id'
+            }, {
+                xtype: 'textfield',
+                name: 've_code',
+                bind: '{ve_code}',
+                fieldLabel: '供应商编号'
+            }, {
+                xtype: 'textfield',
+                name: 've_name',
+                bind: '{ve_name}',
+                fieldLabel: '供应商名称',
+                hidden: false
+            }, {
+                xtype: 'textfield',
+                name: 've_shortname',
+                bind: '{ve_shortname}',
+                fieldLabel: '供应商简称'
+            }, {
+                xtype: 'hidden',
+                name: 've_status',
+                bind: '{ve_status}',
+                fieldLabel: '状态'
+            }, {
+                xtype: 'hidden',
+                name: 've_statuscode',
+                bind: '{ve_statuscode}',
+                fieldLabel: '状态码'
+            }, {
+                xtype: "textfield",
+                name: "ve_type",
+                bind: '{ve_type}',
+                fieldLabel: "供应商类型"
+            }, {
+                xtype: "datefield",
+                name: "ve_begindate",
+                format: 'Y-m-d H:i:s',
+                bind: '{ve_begindate}',
+                fieldLabel: "期初日期"
+            }, {
+                xtype: "textfield",
+                name: "ve_currency",
+                bind: '{ve_currency}',
+                fieldLabel: "币别"
+            }, {
+                xtype: "numberfield",
+                name: "ve_taxrate",
+                bind: '{ve_taxrate}',
+                fieldLabel: "税率(%)"
+            },{
+                xtype: "numberfield",
+                name: "ve_beginapamount",
+                bind: '{ve_beginapamount}',
+                fieldLabel: "期初应付(元)"
+            }, {
+                xtype: "numberfield",
+                hideTrigger: true,
+                name: "ve_beginprepayamount",
+                bind: '{ve_beginprepayamount}',
+                fieldLabel: "期初预付(元)"
+            }, {
+                xtype: "numberfield",
+                name: "ve_leftamount",
+                bind: '{ve_leftamount}',
+                fieldLabel: "应付余额(元)",
+            }, {
+                xtype: "numberfield",
+                name: "ve_promisedays",
+                bind: '{ve_promisedays}',
+                fieldLabel: "结算天数",
+            }, {
+                xtype: "textfield",
+                name: "ve_nsrzh",
+                bind: '{ve_nsrzh}',
+                fieldLabel: "纳税人识别号"
+            }, {
+                xtype: "textfield",
+                name: "ve_bankcode",
+                bind: '{ve_bankcode}',
+                fieldLabel: "开户银行"
+            }, {
+                xtype: "textfield",
+                name: "ve_bankaccount",
+                bind: '{ve_bankaccount}',
+                fieldLabel: "银行账户"
+            }, {
+                xtype: "hidden",
+                name: "ve_buyercode",
+                bind: '{ve_buyercode}',
+                fieldLabel: "采购员编号"
+            }, {
+                xtype: "textfield",
+                name: "ve_buyername",
+                bind: '{ve_buyername}',
+                fieldLabel: "采购员"
+            }, {
+                xtype: "hidden",
+                name: "ve_buyerid",
+                bind: '{ve_buyerid}',
+                fieldLabel: "采购员ID"
+            }, {
+                xtype: "textfield",
+                name: "ve_address",
+                bind: '{ve_address}',
+                fieldLabel: "公司地址"
+            }, {
+                fieldLabel: "备注",
+                xtype: 'textfield',
+                bind: '{ve_remark}',
+                name: "ve_remark"
+            }, {
+                xtype: "textfield",
+                name: "ve_text1",
+                bind: '{ve_text1}',
+                fieldLabel: "自定义字段1"
+            }, {
+                xtype: "textfield",
+                name: "ve_text2",
+                bind: '{ve_text2}',
+                fieldLabel: "自定义字段2"
+            }, {
+                xtype: "textfield",
+                name: "ve_text3",
+                bind: '{ve_text3}',
+                fieldLabel: "自定义字段3"
+            }, {
+                xtype: "textfield",
+                name: "ve_text4",
+                bind: '{ve_text4}',
+                fieldLabel: "自定义字段4"
+            }, {
+                xtype: "textfield",
+                name: "ve_text5",
+                bind: '{ve_text5}',
+                fieldLabel: "自定义字段5"
+            }, {
+                xtype: 'textfield',
+                fieldLabel: '企业UU',
+                name: 've_uu',
+                bind: '{ve_uu}',
+                hidden: false,
+                allowBlank: false,
+                readOnly: true,
+                beforeLabelTextTpl: "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>"
+            }]
+        },
+        customerkind: {
+            uuName: 'cu_uu',
+            getUUUrl: '/api/document/customer/getCustomerUU',
+            saveUrl: '/api/document/customer/save',
+            formItems: [{
+                xtype: 'hidden',
+                name: 'id',
+                bind: '{id}',
+                fieldLabel: 'id'
+            }, {
+                xtype: 'textfield',
+                name: 'cu_code',
+                bind: '{cu_code}',
+                fieldLabel: '客户编号'
+            }, {
+                xtype: 'textfield',
+                name: 'cu_name',
+                bind: '{cu_name}',
+                fieldLabel: '客户名称',
+                hidden: false
+            }, {
+                xtype: 'textfield',
+                name: 'cu_shortname',
+                bind: '{cu_shortname}',
+                fieldLabel: '客户简称'
+            }, {
+                xtype: "textfield",
+                name: "cu_type",
+                bind: '{cu_type}',
+                fieldLabel: "客户类型"
+            }, {
+                xtype: 'hidden',
+                name: 'cu_status',
+                bind: '{cu_status}',
+                fieldLabel: '状态'
+            }, {
+                xtype: 'hidden',
+                name: 'cu_statuscode',
+                bind: '{cu_statuscode}',
+                fieldLabel: '状态码'
+            }, {
+                xtype: "datefield",
+                name: "cu_begindate",
+                format: 'Y-m-d H:i:s',
+                bind: '{cu_begindate}',
+                fieldLabel: "期初日期"
+            }, {
+                xtype: "textfield",
+                name: "cu_currency",
+                bind: '{cu_currency}',
+                fieldLabel: "币别"
+            }, {
+                xtype: "numberfield",
+                name: "cu_taxrate",
+                bind: '{cu_taxrate}',
+                fieldLabel: "税率(%)"
+            },{
+                xtype: "numberfield",
+                hideTrigger: true,
+                name: "cu_beginaramount",
+                bind: '{cu_beginaramount}',
+                fieldLabel: "期初应收(元)"
+            }, {
+                xtype: "numberfield",
+                name: "cu_beginprerecamount",
+                bind: '{cu_beginprerecamount}',
+                fieldLabel: "期初预收(元)"
+            }, {
+                xtype: 'textfield',
+                name: "cu_leftamount",
+                bind: '{cu_leftamount}',
+                fieldLabel: "应收余额(元)"
+            }, {
+                xtype: "numberfield",
+                name: "cu_promisedays",
+                bind: '{cu_promisedays}',
+                fieldLabel: "结算天数"
+            }, {
+                xtype: "hidden",
+                name: "cu_sellerid",
+                bind: '{cu_sellerid}',
+                fieldLabel: "业务员id"
+            }, {
+                xtype: "hidden",
+                name: "cu_sellercode",
+                bind: '{cu_sellercode}',
+                fieldLabel: "业务员code"
+            }, {
+                xtype: "textfield",
+                name: "cu_sellername",
+                bind: '{cu_sellername}',
+                fieldLabel: "业务员"
+            }, {
+                xtype: "hidden",
+                name: "cu_nsrzh",
+                bind: '{cu_nsrzh}',
+                fieldLabel: "纳税人识别号"
+            }, {
+                xtype: "hidden",
+                name: "cu_bankaccount",
+                bind: '{cu_bankaccount}',
+                fieldLabel: "开户银行"
+            }, {
+                xtype: "hidden",
+                name: "cu_bankcode",
+                bind: '{cu_bankcode}',
+                fieldLabel: "银行账户"
+            }, {
+                xtype: 'textfield',
+                name: "cu_uu",
+                bind: '{cu_uu}',
+                fieldLabel: "企业UU",
+                hidden: false,
+                allowBlank: false,
+                readOnly: true,
+                beforeLabelTextTpl: "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>"
+            }, {
+                fieldLabel: "备注",
+                xtype: 'textfield',
+                name: "cu_remark",
+                bind: '{cu_remark}'
+            }, {
+                xtype: "textfield",
+                name: "cu_text1",
+                bind: '{cu_text1}',
+                fieldLabel: "自定义字段1"
+            }, {
+                xtype: "textfield",
+                name: "cu_text2",
+                bind: '{cu_text2}',
+                fieldLabel: "自定义字段2"
+            }, {
+                xtype: "textfield",
+                name: "cu_text3",
+                bind: '{cu_text3}',
+                fieldLabel: "自定义字段3"
+            }, {
+                xtype: "textfield",
+                name: "cu_text4",
+                bind: '{cu_text4}',
+                fieldLabel: "自定义字段4"
+            }, {
+                xtype: "textfield",
+                name: "cu_text5",
+                bind: '{cu_text5}',
+                fieldLabel: "自定义字段5"
+            }]
+        }
+    },
+
+    initComponent: function () {
+        var me = this;
+        var kind = me.kind;
+        me.uuName = me.etc[kind].uuName;
+        me.getUUUrl = me.etc[kind].getUUUrl;
+        me.saveUrl = me.etc[kind].saveUrl;
+        var items = Ext.Array.merge(me.etc[kind].formItems, [{
+            xtype: 'detailGridField',
+            detnoColumn: null,
+            minHeight: 145,
+            emptyRows: 3,
+            showCount: false,
+            width: 280,
+            editable: false,
+            emptyText: '<span style="color: red;">没有查找到匹配的企业,请确认该企业已注册优软商务平台</span>',
+            store: Ext.create('Ext.data.Store', {
+                fields: [{
+                    name: 'name',
+                    type: 'string'
+                }, {
+                    name: 'uu',
+                    type: 'string'
+                }],
+                data: []
+            }),
+            columns: [{
+                text: '企业名称',
+                dataIndex: 'name',
+            }, {
+                text: 'UU',
+                dataIndex: 'uu'
+            }, {
+                xtype:'actioncolumn',
+                text:'操作',
+                align: 'center',
+                items: [{
+                    xtype: 'button',
+                    tooltip: '选择此项填入',
+                    iconCls: 'x-sa sa-edit',
+                    handler: function(tableView, rowIdx, colIdx, btn, e, record, tr) {
+                        var form = tableView.up('form');
+                        var uuField = form.query('[name=' + me.uuName + ']')[0];
+                        uuField.setValue(record.data.uu);
+                    }
+                }]
+            }]
+        }]);
+        Ext.apply(me, {
+            items: [{
+                xtype: 'form',
+                layout: 'column',
+                fieldDefaults: {
+                    hidden: true,
+                    margin: '0 0 10 0',
+                    labelAlign: 'right',
+                    labelWidth: 90,
+                    columnWidth: 0.5,
+                },
+                items: items
+            }],
+            buttonAlign: 'center',
+            buttons: [{
+                text: '确定',
+                formBind: true,
+                handler: function () {
+                    var win = this.up('window'),
+                        form = win.down('form');
+
+                    var uuField = form.query('[name=' + win.uuName + ']')[0];
+                    if (form.isValid()) {
+                        var values = form.getValues();
+                        me.onSave(values);
+                    } else {
+                        saas.util.BaseUtil.showErrorToast('表单校验失败,请检查字段是否合法');
+                    }
+                }
+            }, {
+                text: '取消',
+                handler: function () {
+                    me.close();
+                }
+            }]
+        });
+        me.callParent(arguments);
+    },
+
+    listeners: {
+        boxready: function (win) {
+            win.setLoading(true);
+            var name = win.cname;
+            saas.util.BaseUtil.request({
+                url: win.getUUUrl,
+                method: 'GET',
+                params: {
+                    name: name
+                }
+            }).then(function (res) {
+                var resData = res.data;
+                var data = [];
+                if (!Ext.Object.isEmpty(resData) && resData[name]) {
+                    data.push({
+                        name: name,
+                        uu: resData[name].uu
+                    });
+                }
+                win.setLoading(false);
+                var grid = win.down('grid');
+                var store = grid.store;
+                store.loadData(data);
+            }).catch(function (e) {
+                win.setLoading(false);
+            });
+        }
+    },
+
+    onSave: function (values) {
+        var view = this;
+        var kind = view.kind;
+        var main = values;
+        var params = {
+            codeModified: false,
+            main: main,
+            items: [],
+            items1: [],
+            items2: []
+        };
+
+        view.setLoading(true);
+        saas.util.BaseUtil.request({
+            url: view.saveUrl,
+            params: JSON.stringify(params),
+            method: 'POST'
+        }).then(function (res) {
+            view.setLoading(false);
+            saas.util.BaseUtil.showSuccessToast('修改UU号成功');
+            view.close();
+            view.listView.refresh();
+        }).catch(function (e) {
+            view.setLoading(false);
+            saas.util.BaseUtil.showErrorToast('修改UU号失败: ' + e.message);
+        });
+    },
+});

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

@@ -145,7 +145,7 @@ Ext.define('saas.view.document.vendor.FormPanel', {
                 dbfinds: [{
                     from: 'cr_name', to: 've_currency'
                 }, {
-                    from: 'cr_rate', to: 've_taxrate'
+                    from: 'cr_rate', to: 'cr_rate'
                 }],
                 defaultValue: {
                     ve_currency: this.getViewModel().get('defaultCurrency'),
@@ -154,29 +154,29 @@ Ext.define('saas.view.document.vendor.FormPanel', {
                 supFieldConfig: {
                     xtype: 'numberfield',
                     readOnly: false,
+                    ignore:true,
                     defaultReadOnly: false,
                     decimalPrecision: 6,
-                    vtype: 'positiveNumber'
+                    vtype: 'positiveNumber',
+                    listeners: {
+                        change: function(f, v) {
+                            var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency');
+                            f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency);
+                        }
+                    }
                 },
                 group: '交易信息',
-            // },{
-            //     xtype: "currencyDbfindTrigger",
-            //     name: "ve_currency",
-            //     fieldLabel: "币别",
-            //     allowBlank: false,
-            //     columnWidth: 0.25,
-            //     group: '交易信息',
-            // }, {
-            //     xtype: "numberfield",
-            //     name: "ve_taxrate",
-            //     hideTrigger: true,
-            //     fieldLabel: "税率(%)",
-            //     allowBlank: false,
-            //     columnWidth: 0.25,
-            //     minValue: 0,
-            //     maxValue: 100,
-            //     group: '交易信息',
-            },{
+            }, {
+                xtype: "numberfield",
+                name: "ve_taxrate",
+                hideTrigger: true,
+                fieldLabel: "税率(%)",
+                allowBlank: false,
+                columnWidth: 0.25,
+                minValue: 0,
+                maxValue: 100,
+                group: '交易信息',
+            }, {
                 xtype: "numberfield",
                 hideTrigger: true,
                 name: "ve_beginapamount",

+ 1 - 0
frontend/saas-web/app/view/home/HomeController.js

@@ -73,6 +73,7 @@ Ext.define('saas.view.home.HomeController', {
                                 .then(function(localJson) {
                                     if(localJson.success){
                                         saas.util.BaseUtil.showSuccessToast('本位币设置成功');
+                                        Ext.getCmp('mainView').getViewModel().set('defaultCurrency', v);
                                         Ext.getCmp('x-defaultcurrency').close();
                                     }
                                 })

+ 7 - 7
frontend/saas-web/app/view/money/fundtransfer/FormPanel.js

@@ -159,6 +159,13 @@ Ext.define('saas.view.money.fundtransfer.FormPanel', {
                     text: "转存汇率",
                     dataIndex: "ftd_rate",
                     width: 150.0
+                }, {
+                    text: "结算号",
+                    dataIndex: "ftd_paycode",
+                    width: 150,
+                    editor: {
+                        xtype: ''
+                    }
                 }, {
                     text: "结算方式",
                     width: 110.0,
@@ -194,13 +201,6 @@ Ext.define('saas.view.money.fundtransfer.FormPanel', {
                             }]
                         })
                     }
-                }, {
-                    text: "结算号",
-                    dataIndex: "ftd_paycode",
-                    width: 150,
-                    editor: {
-                        xtype: ''
-                    }
                 }, {
                     text: "备注",
                     dataIndex: "ftd_remark",

+ 53 - 8
frontend/saas-web/app/view/money/fundtransfer/QueryPanel.js

@@ -97,26 +97,71 @@ Ext.define('saas.view.money.fundtransfer.QueryPanel', {
                     dataIndex: 'ftd_bankname',
                     width: 150
                 }, {
+                    text: "转出币别",
+                    dataIndex: "ftd_currency",
+                    align:'center'
+                }, {
+                    text: "转出金额(元)",
+                    xtype: 'numbercolumn',
+                    dataIndex: "ftd_nowbalance",
+                    allowBlank: false,
+                    width: 150.0,
+                    editor: {
+                        xtype: "numberfield",
+                        decimalPrecision: 2
+                    },
+                    renderer: function(v, m, r) {
+                        return saas.util.BaseUtil.numberFormat(v, 2, true);
+                    },
+                    summaryType: 'sum',
+                    summaryRenderer: function(v, d, f, m) {
+                        return saas.util.BaseUtil.numberFormat(v, 2, true);
+                    }
+                },{
                     text: '转入账户',
                     dataIndex: 'ftd_inbankname',
                     width: 150
                 }, {
-                    text: '金额(元)',
+                    text: "转入币别",
+                    dataIndex: "ftd_incurrency",
+                    align:'center'
+                }, {
+                    text: "转入金额(元)",
                     xtype: 'numbercolumn',
-                    dataIndex: 'ftd_nowbalance',
-                    width: 110,
+                    dataIndex: "ftd_innowbalance",
+                    allowBlank: false,
+                    width: 150.0,
+                    editor: {
+                        xtype: "numberfield",
+                        decimalPrecision: 2
+                    },
                     renderer: function(v, m, r) {
                         return saas.util.BaseUtil.numberFormat(v, 2, true);
                     },
+                    summaryType: 'sum',
+                    summaryRenderer: function(v, d, f, m) {
+                        return saas.util.BaseUtil.numberFormat(v, 2, true);
+                    }
+                },{
+                    text: '转存汇率(%)',
+                    xtype: 'numbercolumn',
+                    dataIndex: 'ftd_rate',
+                    width: 110,
+                    renderer: function(v, m, r) {
+                        return saas.util.BaseUtil.numberFormat(v, 6, true);
+                    },
                 }, {
+                        text: "结算号",
+                        dataIndex: "ftd_paycode",
+                        width: 150,
+                        editor: {
+                            xtype: ''
+                        }
+                },{
                     text: '结算方式',
                     dataIndex: 'ftd_paymethod',
                     width: 150
-                }, {
-                    text: '结算号',
-                    dataIndex: 'ftd_paycode',
-                    hidden: true
-                }, {
+                },  {
                     text: '审核状态',
                     dataIndex: 'ft_status',
                     align: 'center',

+ 7 - 1
frontend/saas-web/app/view/money/othreceipts/FormPanel.js

@@ -79,7 +79,13 @@ Ext.define('saas.view.money.othreceipts.FormPanel', {
                     readOnly: false,
                     defaultReadOnly: false,
                     decimalPrecision: 6,
-                    vtype: 'positiveNumber'
+                    vtype: 'positiveNumber',
+                    listeners: {
+                        change: function(f, v) {
+                            var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency');
+                            f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency);
+                        }
+                    }
                 },
                 // }, {
                 //     xtype: "currencyDbfindTrigger",

+ 24 - 0
frontend/saas-web/app/view/money/othreceipts/QueryPanel.js

@@ -127,6 +127,18 @@ Ext.define('saas.view.money.othreceipts.QueryPanel', {
                         return saas.util.BaseUtil.numberFormat(v, 2, true);
                     }
                 }, {
+                    text: '币别',
+                    dataIndex: 'or_currency',
+                    width: 120
+                } ,{
+                    text: '汇率(%)',
+                    dataIndex: 'or_rate',
+                    xtype: 'numbercolumn',
+                    width: 120,
+                    renderer: function(v, m, r) {
+                        return saas.util.BaseUtil.numberFormat(v, 6, false);
+                    },
+                } ,{
                     text: '单据状态',
                     align: 'center',
                     dataIndex: 'or_status',
@@ -166,6 +178,18 @@ Ext.define('saas.view.money.othreceipts.QueryPanel', {
                         return saas.util.BaseUtil.numberFormat(v, 2, true);
                     }
                 }, {
+                    text: '币别',
+                    dataIndex: 'or_currency',
+                    width: 120
+                } ,{
+                    text: '汇率(%)',
+                    dataIndex: 'or_rate',
+                    xtype: 'numbercolumn',
+                    width: 120,
+                    renderer: function(v, m, r) {
+                        return saas.util.BaseUtil.numberFormat(v, 6, false);
+                    },
+                } ,{
                     text: '单据状态',
                     align: 'center',
                     dataIndex: 'or_status',

+ 7 - 1
frontend/saas-web/app/view/money/othspendings/FormPanel.js

@@ -80,7 +80,13 @@ Ext.define('saas.view.money.othspendings.FormPanel', {
                     defaultReadOnly: false,
                     defaultValue: 1,
                     decimalPrecision: 6,
-                    vtype: 'positiveNumber'
+                    vtype: 'positiveNumber',
+                    listeners: {
+                        change: function(f, v) {
+                            var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency');
+                            f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency);
+                        }
+                    }
                 }
             // },{
             //     xtype: "currencyDbfindTrigger",

+ 24 - 0
frontend/saas-web/app/view/money/othspendings/QueryPanel.js

@@ -125,6 +125,18 @@ Ext.define('saas.view.money.othspendings.QueryPanel', {
                         return saas.util.BaseUtil.numberFormat(v, 2, true);
                     }
                 }, {
+                    text: '币别',
+                    dataIndex: 'os_currency',
+                    width: 120
+                } ,{
+                    text: '汇率(%)',
+                    dataIndex: 'os_rate',
+                    xtype: 'numbercolumn',
+                    width: 120,
+                    renderer: function(v, m, r) {
+                        return saas.util.BaseUtil.numberFormat(v, 6, false);
+                    },
+                } ,{
                     text: '单据状态',
                     align: 'center',
                     dataIndex: 'os_status',
@@ -165,6 +177,18 @@ Ext.define('saas.view.money.othspendings.QueryPanel', {
                         return saas.util.BaseUtil.numberFormat(v, 2, true);
                     }
                 }, {
+                    text: '币别',
+                    dataIndex: 'os_currency',
+                    width: 120
+                } ,{
+                    text: '汇率(%)',
+                    dataIndex: 'os_rate',
+                    xtype: 'numbercolumn',
+                    width: 120,
+                    renderer: function(v, m, r) {
+                        return saas.util.BaseUtil.numberFormat(v, 6, false);
+                    },
+                } ,{
                     text: '单据状态',
                     align: 'center',
                     dataIndex: 'os_status',

+ 7 - 1
frontend/saas-web/app/view/money/payBalance/FormPanel.js

@@ -72,7 +72,13 @@ Ext.define('saas.view.money.payBalance.FormPanel', {
                     readOnly: false,
                     defaultReadOnly: false,
                     decimalPrecision: 6,
-                    vtype: 'positiveNumber'
+                    vtype: 'positiveNumber',
+                    listeners: {
+                        change: function(f, v) {
+                            var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency');
+                            f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency);
+                        }
+                    }
                 }
             },{
                 xtype: "datefield",

+ 1 - 1
frontend/saas-web/app/view/money/payBalance/FormPanelController.js

@@ -99,7 +99,7 @@ Ext.define('saas.view.money.payBalance.FormPanelController', {
                         return false;
                     }
                     Ext.apply(f, {
-                        defaultCondition: "sl_vendid = "+pb_vendid+" and sl_currency ='"+pb_currency+"' AND sl_custid <> 0 AND (  sl_kind IN ( '采购验收单','采购验退单' ) OR ( sl_kind = '期初余额' AND sl_ym = (select min(pd_detno) from periodsdetail  where pd_status=0 and periodsdetail.companyid=subledger.companyid) ) "+
+                        defaultCondition: "sl_vendid = "+pb_vendid+" and sl_currency ='"+pb_currency+"' AND sl_custid = 0 AND (  sl_kind IN ( '采购验收单','采购验退单' ) OR ( sl_kind = '期初余额' AND sl_ym = (select min(pd_detno) from periodsdetail  where pd_status=0 and periodsdetail.companyid=subledger.companyid) ) "+
                         ") and sl_namount<>0 "
                     });
                 }

+ 24 - 0
frontend/saas-web/app/view/money/payBalance/QueryPanel.js

@@ -98,6 +98,18 @@ Ext.define('saas.view.money.paybalance.QueryPanel', {
                             return saas.util.BaseUtil.numberFormat(v, 2, true);
                         },
                     }, {
+                        text: '币别',
+                        dataIndex: 'pb_currency',
+                        width: 120
+                    } ,{
+                        text: '汇率(%)',
+                        dataIndex: 'pb_rate',
+                        xtype: 'numbercolumn',
+                        width: 120,
+                        renderer: function(v, m, r) {
+                            return saas.util.BaseUtil.numberFormat(v, 6, false);
+                        },
+                    } ,{
                         text: '付款人',
                         dataIndex: 'pb_manname',
                         width: 110
@@ -145,6 +157,18 @@ Ext.define('saas.view.money.paybalance.QueryPanel', {
                     renderer: function(v, m, r) {
                         return saas.util.BaseUtil.numberFormat(v, 2, true);
                     },
+                } ,{
+                    text: '币别',
+                    dataIndex: 'pb_currency',
+                    width: 120
+                } ,{
+                    text: '汇率(%)',
+                    dataIndex: 'pb_rate',
+                    xtype: 'numbercolumn',
+                    width: 120,
+                    renderer: function(v, m, r) {
+                        return saas.util.BaseUtil.numberFormat(v, 6, false);
+                    },
                 } ,{
                     text: '结算方式',
                     dataIndex: 'pd_paymethod',

+ 7 - 1
frontend/saas-web/app/view/money/recBalance/FormPanel.js

@@ -71,7 +71,13 @@ Ext.define('saas.view.money.recBalance.FormPanel', {
                     readOnly: false,
                     defaultReadOnly: false,
                     decimalPrecision: 6,
-                    vtype: 'positiveNumber'
+                    vtype: 'positiveNumber',
+                    listeners: {
+                        change: function(f, v) {
+                            var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency');
+                            f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency);
+                        }
+                    }
                 }
             },{
                 xtype: "datefield",

+ 24 - 0
frontend/saas-web/app/view/money/recBalance/QueryPanel.js

@@ -89,6 +89,18 @@ Ext.define('saas.view.money.recBalance.QueryPanel', {
                         return saas.util.BaseUtil.numberFormat(v, 2, true);
                     }
                 }, {
+                    text: '币别',
+                    dataIndex: 'rb_currency',
+                    width: 120
+                } ,{
+                    text: '汇率(%)',
+                    dataIndex: 'rb_rate',
+                    xtype: 'numbercolumn',
+                    width: 120,
+                    renderer: function(v, m, r) {
+                        return saas.util.BaseUtil.numberFormat(v, 6, false);
+                    },
+                } ,{
                     text: '收款人',
                     dataIndex: 'rb_manname',
                     width: 80
@@ -138,6 +150,18 @@ Ext.define('saas.view.money.recBalance.QueryPanel', {
                         return saas.util.BaseUtil.numberFormat(v, 2, true);
                     }
                 }, {
+                    text: '币别',
+                    dataIndex: 'rb_currency',
+                    width: 120
+                } ,{
+                    text: '汇率(%)',
+                    dataIndex: 'rb_rate',
+                    xtype: 'numbercolumn',
+                    width: 120,
+                    renderer: function(v, m, r) {
+                        return saas.util.BaseUtil.numberFormat(v, 6, false);
+                    },
+                } ,{
                     text: '结算方式',
                     dataIndex: 'rd_paymethod',
                     width: 120

+ 4 - 1
frontend/saas-web/app/view/money/report/AccountDetails.js

@@ -104,7 +104,10 @@ Ext.define('saas.view.money.report.AccountDetails', {
         text: '汇率',
         dataIndex: 'rate',
         xtype: 'numbercolumn',
-        width: 80
+        width: 80,
+        renderer: function(v, m, r) {
+            return saas.util.BaseUtil.numberFormat(v, 6, true);
+        }
     }, {
         dataIndex: '',
         flex: 1

+ 1 - 1
frontend/saas-web/app/view/money/report/TotalRecDetail.js

@@ -19,7 +19,7 @@ Ext.define('saas.view.money.report.TotalRecDetail', {
 
     searchItems: [{
         xtype: 'customerDbfindTrigger',
-        name: 'cm_custcode',
+        name: 'cm_custname',
         emptyText: '请输入客户名称',
         columnWidth: 0.25
     }, {

+ 45 - 15
frontend/saas-web/app/view/money/verification/FormPanel.js

@@ -510,6 +510,15 @@ Ext.define('saas.view.money.verification.FormPanel', {
                         listeners: {
                             change: 'clearDetails'
                         }
+                    }, {
+                        fieldLabel: '客户编号',
+                        xtype: 'hidden',
+                        name: 'vc_custcode',
+                    }, {
+                        fieldLabel: '客户名称',
+                        xtype: 'customerDbfindTrigger',
+                        name: 'vc_custname',
+                        allowBlank: false
                     }, {
                         xtype: 'condbfindtrigger',
                         fieldLabel: '币别汇率',
@@ -530,18 +539,15 @@ Ext.define('saas.view.money.verification.FormPanel', {
                             readOnly: false,
                             defaultReadOnly: false,
                             decimalPrecision: 6,
-                            vtype: 'positiveNumber'
+                            vtype: 'positiveNumber',
+                            listeners: {
+                                change: function(f, v) {
+                                    var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency');
+                                    f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency);
+                                }
+                            }
                         },
                     },  {
-                        fieldLabel: '客户编号',
-                        xtype: 'hidden',
-                        name: 'vc_custcode',
-                    }, {
-                        fieldLabel: '客户名称',
-                        xtype: 'customerDbfindTrigger',
-                        name: 'vc_custname',
-                        allowBlank: false
-                    }, {
                         fieldLabel: '日期',
                         xtype: 'datefield',
                         defaultValue: new Date(),
@@ -601,7 +607,13 @@ Ext.define('saas.view.money.verification.FormPanel', {
                             readOnly: false,
                             defaultReadOnly: false,
                             decimalPrecision: 6,
-                            vtype: 'positiveNumber'
+                            vtype: 'positiveNumber',
+                            listeners: {
+                                change: function(f, v) {
+                                    var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency');
+                                    f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency);
+                                }
+                            }
                         },
                     }, {
                         fieldLabel: '日期',
@@ -670,7 +682,7 @@ Ext.define('saas.view.money.verification.FormPanel', {
                         }, {
                             from: 've_name',
                             to: 'vc_vendname'
-                        }],
+                        }]
                     },  {
                         xtype: 'condbfindtrigger',
                         fieldLabel: '币别汇率',
@@ -691,7 +703,13 @@ Ext.define('saas.view.money.verification.FormPanel', {
                             readOnly: false,
                             defaultReadOnly: false,
                             decimalPrecision: 6,
-                            vtype: 'positiveNumber'
+                            vtype: 'positiveNumber',
+                            listeners: {
+                                change: function(f, v) {
+                                    var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency');
+                                    f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency);
+                                }
+                            }
                         },
                     }, {
                         fieldLabel: '日期',
@@ -769,7 +787,13 @@ Ext.define('saas.view.money.verification.FormPanel', {
                             readOnly: false,
                             defaultReadOnly: false,
                             decimalPrecision: 6,
-                            vtype: 'positiveNumber'
+                            vtype: 'positiveNumber',
+                            listeners: {
+                                change: function(f, v) {
+                                    var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency');
+                                    f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency);
+                                }
+                            }
                         },
                     }, {
                         fieldLabel: '日期',
@@ -847,7 +871,13 @@ Ext.define('saas.view.money.verification.FormPanel', {
                             readOnly: false,
                             defaultReadOnly: false,
                             decimalPrecision: 6,
-                            vtype: 'positiveNumber'
+                            vtype: 'positiveNumber',
+                            listeners: {
+                                change: function(f, v) {
+                                    var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency');
+                                    f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency);
+                                }
+                            }
                         },
                     },{
                         fieldLabel: '日期',

+ 20 - 20
frontend/saas-web/app/view/money/verification/FormPanelController.js

@@ -43,27 +43,27 @@ Ext.define('saas.view.money.verification.FormPanelController', {
                 }
             },
             // 供应商
-            'dbfindtrigger[name=vc_vendname]':{
+            'vendorDbfindTrigger[name=vc_vendname]':{
                 beforerender: function (f) {
-                    Ext.apply(f, {
-                        dbfinds: [{
-                            from: 'id',
-                            to: 'vc_vendid',
-                            ignore: true
-                        }, {
-                            from: 've_code',
-                            to: 'vc_vendcode'
-                        }, {
-                            from: 've_name',
-                            to: 'vc_vendname'
-                        },{
-                            from:'ve_currency',to:'vc_currency'
-                        },{
-                            from:'cr_rate',to:'vc_rate'
-                        }
-                        ],
-                    });
-
+                    if(!f.dbfinds){
+                        Ext.apply(f, {
+                            dbfinds: [{
+                                from: 'id',
+                                to: 'vc_vendid',
+                                ignore: true
+                            }, {
+                                from: 've_code',
+                                to: 'vc_vendcode'
+                            }, {
+                                from: 've_name',
+                                to: 'vc_vendname'
+                            },{
+                                from:'ve_currency',to:'vc_currency'
+                            },{
+                                from:'cr_rate',to:'vc_rate'
+                            }]
+                        });
+                    }
                 }
             },
             // 转入供应商

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