Browse Source

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

rainco 7 years ago
parent
commit
81ee5043b8

+ 4 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/ProdInOutMapper.java

@@ -24,4 +24,8 @@ public interface ProdInOutMapper extends CommonBaseMapper<ProdInOut> {
     Integer validateCodeWhenUpdate(@Param("pi_inoutno") String pi_inoutno, @Param("id") Long id,@Param("companyId") Long companyId);
 
     String selectCodeById(Long id);
+
+    int checkQtyFromPurchase(String pu_code);
+
+    int checkQtyFromProdIn(String pu_code);
 }

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

@@ -192,6 +192,13 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         if (updateDetails.size()>0) {
             prodIODetailMapper.batchUpdate(updateDetails);
         }
+
+        //检查更新后数据是否
+        String pu_code = prodInOut.getPi_pucode();
+        if (!StringUtils.isEmpty(pu_code)){
+            checkUpdateQty(pu_code,pi_class);
+        }
+
         baseDTO = getBaseDTOById(pi_id,pi_class,pi_inoutno);
         //计算金额,未税单价,未税金额等
         calcProdInout(pi_id,pi_class);
@@ -202,6 +209,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         return baseDTO;
     }
 
+
     @Override
     @Transactional
     public void delete(Long id) {
@@ -358,6 +366,22 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         }
     }
 
+    private void checkUpdateQty(String pu_code, String pi_class) {
+        int count = 0;
+        if ("采购验收单".equals(pi_class)) {
+            count = getMapper().checkQtyFromPurchase(pu_code);
+            if (count>0){
+                throw new BizException(500, "明细行数量超过来源采购单明细行数量");
+            }
+        } else if ("采购验退单".equals(pi_class)) {
+            count = getMapper().checkQtyFromProdIn(pu_code);
+            if (count>0){
+                throw new BizException(500, "明细行数量超过来源采购验收单明细行数量");
+            }
+        }
+
+    }
+
 
 
     public void updateYqty(ProdInOut prodInOut) {

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

@@ -435,8 +435,16 @@
     select pi_inoutno from prodinout where pi_id=#{id}
   </select>
 
+  <select id="checkQtyFromPurchase" resultType="int" parameterType="string">
+  select count(1) from(
+  select sum(pd_inqty) nowqty,(select pd_qty from purchasedetail where pd_id = pd_orderid) totalqty   from prodiodetail   where pd_ordercode=#{pu_code}
+  GROUP BY pd_orderid) t  where t.nowqty>t.totalqty
+  </select>
 
-
-
+  <select id="checkQtyFromProdIn" resultType="int" parameterType="string">
+  select count(1) from(
+  select sum(b.pd_outqty) nowqty,(select a.pd_inqty from prodiodetail a where a.pd_id = b.pd_ioid and a.pd_piclass='采购验收单') totalqty from prodiodetail b where b.pd_ordercode=#{pu_code} and b.pd_piclass='采购验退单'
+  GROUP BY b.pd_ioid) t where t.nowqty>t.totalqty
+  </select>
 
 </mapper>

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

@@ -21,7 +21,6 @@ Ext.define('saas.view.core.form.FormPanel', {
     initId: 0,
     layout: 'column',
     autoScroll: true,
-    border: 1,
     bodyPadding: 5,
 
     fieldDefaults: {
@@ -94,9 +93,6 @@ Ext.define('saas.view.core.form.FormPanel', {
             dockedItems: [{
                 xtype: 'toolbar',
                 dock: 'top',
-                style: {
-                    'border-bottom': '1px solid #35baf6 !important'
-                },
                 items: me.getToolBarItems(),
             }],
             listeners: {
@@ -331,23 +327,24 @@ Ext.define('saas.view.core.form.FormPanel', {
                 return;
             }
 
-            // 设置model绑定
-            if (!ignore) {
-                if (bind) {
-                    if (!Ext.isString(bind)) {
-                        Ext.apply(bind, {
-                            value: '{' + name + '}'
-                        });
-                    } else {
-                        item.bind = '{' + name + '}';
-                    }
+            if (bind) {
+                if (!Ext.isString(bind)) {
+                    Ext.apply(bind, {
+                        value: '{' + name + '}'
+                    });
                 } else {
                     item.bind = '{' + name + '}';
                 }
-                // 设置默认值
-                if (defaultValue) {
-                    viewModel.set(name, defaultValue);
-                }
+            } else {
+                item.bind = '{' + name + '}';
+            }
+            // 设置默认值
+            if (defaultValue) {
+                viewModel.set(name, defaultValue);
+            }
+
+            // 设置model绑定
+            if (!ignore) {
                 if(!Ext.Array.contains(bindFields, name)) {
                     bindFields.push(name);
                 }