Эх сурвалжийг харах

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

zhuth 7 жил өмнө
parent
commit
a7c032e063
16 өөрчлөгдсөн 45 нэмэгдсэн , 26 устгасан
  1. 2 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java
  2. 4 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  3. 4 4
      applications/purchase/purchase-server/src/main/resources/mapper/ProdIODetailMapper.xml
  4. 2 2
      applications/purchase/purchase-server/src/main/resources/mapper/PurchasedetailMapper.xml
  5. 1 1
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdIODetailDTO.java
  6. 4 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/ProdInOutServiceImpl.java
  7. 1 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java
  8. 3 0
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/ProdInOutServiceImpl.java
  9. 1 1
      applications/storage/storage-server/src/main/resources/application.yml
  10. 8 9
      applications/storage/storage-server/src/main/resources/mapper/ProdIODetailMapper.xml
  11. 7 0
      applications/storage/storage-server/src/test/com/usoftchina/saas/storage/mapper/ProdIODetailMapperTest.java
  12. 1 1
      frontend/saas-web/app/model/sale/ProdIODetail.js
  13. 1 1
      frontend/saas-web/app/model/sale/Saledetail.js
  14. 2 2
      frontend/saas-web/app/view/sale/sale/FormPanel.js
  15. 2 2
      frontend/saas-web/app/view/sale/saleIn/FormPanel.js
  16. 2 2
      frontend/saas-web/app/view/sale/saleOut/FormPanel.js

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

@@ -161,6 +161,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             }
 
             baseDTO = getBaseDTOById(pi_id,pi_class,pi_inoutno);
+            //计算金额,未税单价,未税金额等
+            calcProdInout(pi_id,pi_class);
             //日志记录
             messageLogService.save(baseDTO);
             return baseDTO;

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

@@ -142,6 +142,8 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
                 purchasedetailMapper.batchInsert(insertDetails);
             }
             baseDTO = getBaseDTOById(pu_id);
+            //计算金额,未税单价,未税金额等
+            calcPurchase(pu_id);
             //日志记录
             messageLogService.save(baseDTO);
             return baseDTO;
@@ -171,9 +173,10 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
             purchasedetailMapper.batchUpdate(updateDetails);
         }
         baseDTO = getBaseDTOById(pu_id);
-        //日志
+
         //计算金额,未税单价,未税金额等
         calcPurchase(pu_id);
+        //日志
         messageLogService.save(baseDTO);
         return baseDTO;
     }

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

@@ -739,15 +739,15 @@
   </delete>
 
   <update id="calcProdIn">
-    update prodiodetail set pd_netprice = pd_orderprice/(1+pd_taxrate/100) where pd_piid = #{pi_id,jdbcType=INTEGER};
-    update prodiodetail set pd_total = pd_orderprice*pd_inqty,pd_nettotal = pd_netprice*pd_inqty where pd_piid = #{pi_id,jdbcType=INTEGER};
+    update prodiodetail set pd_netprice = ifnull(pd_orderprice,0)/(1+ifnull(pd_taxrate,0)/100) where pd_piid = #{pi_id,jdbcType=INTEGER};
+    update prodiodetail set pd_total = ifnull(pd_orderprice,0)*ifnull(pd_inqty,0),pd_nettotal = pd_netprice*ifnull(pd_inqty,0) where pd_piid = #{pi_id,jdbcType=INTEGER};
     update prodinout set pi_total = (select sum(pd_total) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ) where pi_id = #{pi_id,jdbcType=INTEGER};
     update prodinout set pi_nettotal = (select sum(pd_nettotal) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ) where pi_id = #{pi_id,jdbcType=INTEGER};
   </update>
 
   <update id="calcProdOut">
-    update prodiodetail set pd_netprice = pd_orderprice/(1+pd_taxrate/100) where pd_piid = #{pi_id,jdbcType=INTEGER};
-    update prodiodetail set pd_total = pd_orderprice*pd_outqty,pd_nettotal = pd_netprice*pd_outqty where pd_piid = #{pi_id,jdbcType=INTEGER};
+    update prodiodetail set pd_netprice = ifnull(pd_orderprice,0)/(1+ifnull(pd_taxrate,0)/100) where pd_piid = #{pi_id,jdbcType=INTEGER};
+    update prodiodetail set pd_total = ifnull(pd_orderprice,0)*ifnull(pd_outqty,0),pd_nettotal = pd_netprice*ifnull(pd_outqty,0) where pd_piid = #{pi_id,jdbcType=INTEGER};
     update prodinout set pi_total = (select sum(pd_total) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ) where pi_id = #{pi_id,jdbcType=INTEGER};
     update prodinout set pi_nettotal = (select sum(pd_nettotal) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ) where pi_id = #{pi_id,jdbcType=INTEGER};
   </update>

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

@@ -409,8 +409,8 @@
 
 
   <update id="calcPurchase" parameterType="long" >
-    update purchasedetail set pd_taxprice = PD_PRICE/(1+pd_taxrate/100) where pd_puid = #{pu_id,jdbcType=INTEGER};
-    update purchasedetail set pd_total = PD_PRICE*pd_qty,pd_taxtotal = pd_taxprice*pd_qty where pd_puid = #{pu_id,jdbcType=INTEGER};
+    update purchasedetail set pd_taxprice = ifnull(PD_PRICE,0)/(1+ifnull(pd_taxrate,0)/100) where pd_puid = #{pu_id,jdbcType=INTEGER};
+    update purchasedetail set pd_total = ifnull(PD_PRICE,0)*ifnull(pd_qty,0),pd_taxtotal = pd_taxprice*ifnull(pd_qty,0) where pd_puid = #{pu_id,jdbcType=INTEGER};
     update purchase set pu_total = (select sum(pd_total) from purchasedetail where pd_puid = #{pi_id,jdbcType=INTEGER} ) where pu_id = #{pu_id,jdbcType=INTEGER};
     update purchase set PU_TAXTOTAL = (select sum(pd_taxtotal) from purchasedetail where pd_puid = #{pi_id,jdbcType=INTEGER} ) where pu_id = #{pu_id,jdbcType=INTEGER};
   </update>

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

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

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

@@ -126,6 +126,10 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             if (insertDetails.size()>0) {
                 prodIODetailMapper.batchInsert(insertDetails);
             }
+
+            ProdInOut prodInOutNow = checkAndReturnOrder(pi_id);
+            //更新明细金额等
+            setTotal(prodInOutNow);
             baseDTO = getBaseDTOById(pi_id,pi_class,pi_inoutno);
             //日志记录
             messageLogService.save(baseDTO);

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

@@ -135,6 +135,7 @@ public class SaleServiceImpl implements SaleService{
                 detail.setSd_said(sa_id);
                 detail.setSd_code(sa_code);
                 detail.setSd_yqty(0.0);
+                detail.setCompanyId(companyId);
                 insertDetails.add(detail);
             }
             //插入从表

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

@@ -156,6 +156,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             }
 
             baseDTO = getBaseDTOById(pi_id,pi_class,pi_inoutno);
+            //计算金额,未税单价,未税金额等
+            calcProdInout(pi_id,pi_class);
             //日志记录
             messageLogService.save(baseDTO);
             return baseDTO;
@@ -464,6 +466,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
     }
 
     private void calcProdInout(Long pi_id, String pi_class) {
+        Integer id = pi_id.intValue();
         if ("其它入库单".equals(pi_class)) {
             prodIODetailMapper.calcProdIn(pi_id);
         } else if ("其它出库单".equals(pi_class)) {

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

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

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

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

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

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

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

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

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

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

+ 2 - 2
frontend/saas-web/app/view/sale/sale/FormPanel.js

@@ -99,7 +99,7 @@ Ext.define('saas.view.sale.sale.FormPanel', {
                 ignore:true,
                 width : 150.0, 
                 renderer: function (v, m, r) {
-				    return r.data["product"]?r.data["product"][m.column.dataIndex]:v;
+				    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
 				}
             }, {
                 text : "规格", 
@@ -107,7 +107,7 @@ Ext.define('saas.view.sale.sale.FormPanel', {
                 ignore:true,
                 width : 150.0, 
                 renderer: function (v, m, r) {
-				    return r.data["product"]?r.data["product"][m.column.dataIndex]:v;
+				    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
 				}
             }, {
                 text : "数量", 

+ 2 - 2
frontend/saas-web/app/view/sale/saleIn/FormPanel.js

@@ -94,7 +94,7 @@ Ext.define('saas.view.sale.saleIn.FormPanel', {
                 ignore:true,
                 width : 150.0, 
                 renderer: function (v, m, r) {
-				    return r.data["product"]?r.data["product"][m.column.dataIndex]:v;
+				    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
 				}
             }, {
                 text : "规格", 
@@ -102,7 +102,7 @@ Ext.define('saas.view.sale.saleIn.FormPanel', {
                 ignore:true,
                 width : 150.0, 
                 renderer: function (v, m, r) {
-				    return r.data["product"]?r.data["product"][m.column.dataIndex]:v;
+				    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
                 }
             }, {
                 text : "数量", 

+ 2 - 2
frontend/saas-web/app/view/sale/saleOut/FormPanel.js

@@ -104,7 +104,7 @@ Ext.define('saas.view.sale.saleout.FormPanel', {
                 ignore:true,
                 width : 150.0, 
                 renderer: function (v, m, r) {
-				    return r.data["product"]?r.data["product"][m.column.dataIndex]:v;
+				    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
 				}
             }, {
                 text : "规格", 
@@ -112,7 +112,7 @@ Ext.define('saas.view.sale.saleout.FormPanel', {
                 ignore:true,
                 width : 150.0, 
                 renderer: function (v, m, r) {
-				    return r.data["product"]?r.data["product"][m.column.dataIndex]:v;
+				    return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
 				}
             },  {
                 text : "出货数量",