Browse Source

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

guq 7 years ago
parent
commit
08db7cfe22
20 changed files with 545 additions and 673 deletions
  1. 21 92
      applications/document/document-server/src/main/resources/mapper/CustomeraddressMapper.xml
  2. 15 56
      applications/document/document-server/src/main/resources/mapper/CustomercontactMapper.xml
  3. 1 5
      applications/document/document-server/src/main/resources/mapper/WarehouseMapper.xml
  4. 11 3
      applications/document/document-server/src/test/java/com/usoftchina/saas/document/mapper/CustomeraddressMapperTest.java
  5. 7 0
      applications/document/document-server/src/test/java/com/usoftchina/saas/document/mapper/CustomercontactMapperTest.java
  6. 6 3
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java
  7. 8 5
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  8. 54 239
      applications/purchase/purchase-server/src/main/resources/mapper/ProdIODetailMapper.xml
  9. 23 0
      applications/purchase/purchase-server/src/test/PurchaseTest.java
  10. 54 239
      applications/storage/storage-server/src/main/resources/mapper/ProdIODetailMapper.xml
  11. 2 3
      frontend/saas-web/app/model/document/bomdetail.js
  12. 1 1
      frontend/saas-web/app/view/core/base/BasePanelController.js
  13. 1 1
      frontend/saas-web/app/view/core/base/GridPanel.js
  14. 2 7
      frontend/saas-web/app/view/core/form/FormPanel.js
  15. 51 14
      frontend/saas-web/app/view/core/form/field/DetailGridField.js
  16. 42 4
      frontend/saas-web/app/view/document/bom/BasePanel.js
  17. 65 0
      frontend/saas-web/app/view/document/bom/FormController.js
  18. 17 0
      frontend/saas-web/app/view/document/bom/FormModel.js
  19. 162 0
      frontend/saas-web/app/view/document/bom/FormPanel.js
  20. 2 1
      frontend/saas-web/resources/json/navigation.json

+ 21 - 92
applications/document/document-server/src/main/resources/mapper/CustomeraddressMapper.xml

@@ -211,102 +211,31 @@
   </select>
 
   <insert id="batchInsert" parameterType="java.util.List" >
-    <foreach collection="list" item="item" index="index" open="" close="" separator=",">
-      insert into customeraddress
-      <trim prefix="(" suffix=")" suffixOverrides=",">
-
-        <if test="item.ca_cuid != null">
-          ca_cuid,
-        </if>
-        <if test="item.ca_detno != null">
-          ca_detno,
-        </if>
-        <if test="item.ca_person != null">
-          ca_person,
-        </if>
-        <if test="item.ca_phone != null">
-          ca_phone,
-        </if>
-        <if test="item.ca_default != null">
-          ca_default,
-        </if>
-        <if test="item.companyId != null">
-          companyid,
-        </if>
-        <if test="item.updaterId != null">
-          updaterid,
-        </if>
-        <if test="item.updateTime != null">
-          updatetime,
-        </if>
-        <if test="item.ca_text1 != null">
-          ca_text1,
-        </if>
-        <if test="item.ca_text2 != null">
-          ca_text2,
-        </if>
-        <if test="item.ca_text3 != null">
-          ca_text3,
-        </if>
-        <if test="item.ca_text4 != null">
-          ca_text4,
-        </if>
-        <if test="item.ca_text5 != null">
-          ca_text5,
-        </if>
-        <if test="item.ca_address != null">
-          ca_address,
-        </if>
-      </trim>
-      <trim prefix="values (" suffix=")" suffixOverrides=",">
 
-        <if test="item.ca_cuid != null">
-          #{item.ca_cuid,jdbcType=INTEGER},
-        </if>
-        <if test="item.ca_detno != null">
-          #{item.ca_detno,jdbcType=INTEGER},
-        </if>
-        <if test="item.ca_person != null">
-          #{item.ca_person,jdbcType=VARCHAR},
-        </if>
-        <if test="item.ca_phone != null">
-          #{item.ca_phone,jdbcType=INTEGER},
-        </if>
-        <if test="item.ca_default != null">
-          #{item.ca_default,jdbcType=INTEGER},
-        </if>
-        <if test="item.companyId != null">
-          #{item.companyId,jdbcType=INTEGER},
-        </if>
-        <if test="item.updaterId != null">
-          #{item.updaterId,jdbcType=INTEGER},
-        </if>
-        <if test="item.updateTime != null">
-          #{item.updateTime,jdbcType=TIMESTAMP},
-        </if>
-        <if test="item.ca_text1 != null">
-          #{item.ca_text1,jdbcType=VARCHAR},
-        </if>
-        <if test="item.ca_text2 != null">
-          #{item.ca_text2,jdbcType=VARCHAR},
-        </if>
-        <if test="item.ca_text3 != null">
-          #{item.ca_text3,jdbcType=VARCHAR},
-        </if>
-        <if test="item.ca_text4 != null">
-          #{item.ca_text4,jdbcType=VARCHAR},
-        </if>
-        <if test="item.ca_text5 != null">
-          #{item.ca_text5,jdbcType=VARCHAR},
-        </if>
-        <if test="item.ca_address != null">
-          #{item.ca_address,jdbcType=LONGVARCHAR},
-        </if>
-      </trim>
+    insert into customeraddress
+    (ca_cuid,ca_detno,ca_person,ca_address,ca_phone,
+    ca_default,companyid,updaterid,updatetime,ca_text1,
+    ca_text2,ca_text3,ca_text4,ca_text5) VALUES
+    <foreach collection="list" item="item" index="index" open="" close="" separator=",">
+      (
+      #{item.ca_cuid,jdbcType=INTEGER},
+      #{item.ca_detno,jdbcType=INTEGER},
+      #{item.ca_person,jdbcType=VARCHAR},
+      #{item.ca_address,jdbcType=LONGVARCHAR},
+      #{item.ca_phone,jdbcType=INTEGER},
+      #{item.ca_default,jdbcType=INTEGER},
+      #{item.companyId,jdbcType=INTEGER},
+      #{item.updaterId,jdbcType=INTEGER},
+      #{item.updateTime,jdbcType=TIMESTAMP},
+      #{item.ca_text1,jdbcType=VARCHAR},
+      #{item.ca_text2,jdbcType=VARCHAR},
+      #{item.ca_text3,jdbcType=VARCHAR},
+      #{item.ca_text4,jdbcType=VARCHAR},
+      #{item.ca_text5,jdbcType=VARCHAR}
+       )
     </foreach>
   </insert>
 
-
   <update id="batchUpdate" parameterType="com.usoftchina.saas.document.entities.Customeraddress" >
     <foreach collection="list" item="item" index="index" open="" close="" separator=";">
       update customeraddress

+ 15 - 56
applications/document/document-server/src/main/resources/mapper/CustomercontactMapper.xml

@@ -196,72 +196,31 @@
   </select>
 
   <insert id="batchInsert" parameterType="java.util.List" >
+    insert into customercontact (cc_cuid, cc_detno,
+    cc_name, cc_tel, cc_qq,
+    cc_email, companyid, updaterid,
+    updatetime, cc_text1, cc_text2,
+    cc_text3, cc_text4, cc_text5,cc_default
+    )
+    values
     <foreach collection="list" item="item" index="index" open="" close="" separator=",">
-      insert into customercontact
-      <trim prefix="(" suffix=")" suffixOverrides=",">
-        <if test="item.cc_cuid != null">
-          cc_cuid,
-        </if>
-        <if test="item.cc_detno != null">
-          cc_detno,
-        </if>
-        <if test="item.cc_name != null">
-          cc_name,
-        </if>
-        <if test="item.cc_tel != null">
-          cc_tel,
-        </if>
-        <if test="item.cc_qq != null">
-          cc_qq,
-        </if>
-        <if test="item.cc_email != null">
-          cc_email,
-        </if>
-        <if test="item.companyId != null">
-          companyid,
-        </if>
-        <if test="item.updaterId != null">
-          updaterid,
-        </if>
-        <if test="item.updateTime != null">
-          updatetime,
-        </if>
-        <if test="item.cc_default != null">
-          cc_default,
-        </if>
-      </trim>
-      <trim prefix="values (" suffix=")" suffixOverrides=",">
-        <if test="item.cc_cuid != null">
+      (
           #{item.cc_cuid,jdbcType=INTEGER},
-        </if>
-        <if test="item.cc_detno != null">
           #{item.cc_detno,jdbcType=INTEGER},
-        </if>
-        <if test="item.cc_name != null">
           #{item.cc_name,jdbcType=VARCHAR},
-        </if>
-        <if test="item.cc_tel != null">
           #{item.cc_tel,jdbcType=INTEGER},
-        </if>
-        <if test="item.cc_qq != null">
           #{item.cc_qq,jdbcType=VARCHAR},
-        </if>
-        <if test="item.cc_email != null">
           #{item.cc_email,jdbcType=VARCHAR},
-        </if>
-        <if test="item.companyId != null">
           #{item.companyId,jdbcType=INTEGER},
-        </if>
-        <if test="item.updaterId != null">
           #{item.updaterId,jdbcType=INTEGER},
-        </if>
-        <if test="item.updateTime != null">
           #{item.updateTime,jdbcType=TIMESTAMP},
-        </if>
-        <if test="item.cc_default != null">
-          #{item.cc_default,jdbcType=INTEGER},
-        </if>
-      </trim>
+          #{item.cc_text1,jdbcType=VARCHAR},
+          #{item.cc_text2,jdbcType=VARCHAR},
+          #{item.cc_text3,jdbcType=VARCHAR},
+          #{item.cc_text4,jdbcType=VARCHAR},
+          #{item.cc_text5,jdbcType=VARCHAR},
+          #{item.cc_default,jdbcType=INTEGER}
+      )
     </foreach>
   </insert>
 

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

@@ -309,10 +309,6 @@
         where wh_id = #{id}
     </update>
 
-    <select id="selectAll" resultMap="WarehouseResultMapper">
-        SELECT * FROM WAREHOUSE WHERE companyId = #{companyId}
-    </select>
-
     <select id="validateCodeWhenInsert" resultType="int">
         select count(*) from WAREHOUSE where WH_CODE = #{code} and companyId =#{companyId}
     </select>
@@ -330,7 +326,7 @@
                 and  companyid = #{companyId}
             </if>
         </where>
-        order by cu_id
+        order by wh_id
     </select>
 
 

+ 11 - 3
applications/document/document-server/src/test/java/com/usoftchina/saas/document/mapper/CustomeraddressMapperTest.java

@@ -47,9 +47,17 @@ public class CustomeraddressMapperTest {
     @Test
     public void batchInsert() throws Exception {
         List<Customeraddress> list = new ArrayList<>();
-        Customeraddress customeraddress = new Customeraddress();
-        customeraddress.setCa_address("地址1");
-        list.add(customeraddress);
+        Customeraddress customeraddress1 = new Customeraddress();
+        customeraddress1.setCa_address("地址1");
+
+        Customeraddress customeraddress2 = new Customeraddress();
+        customeraddress2.setCa_address("地址2");
+
+        list.add(customeraddress1);
+        list.add(customeraddress2);
+
+
+
         customeraddressMapper.batchInsert(list);
     }
 

+ 7 - 0
applications/document/document-server/src/test/java/com/usoftchina/saas/document/mapper/CustomercontactMapperTest.java

@@ -53,7 +53,14 @@ public class CustomercontactMapperTest {
         customercontact.setCc_name("zdw");
         customercontact.setCc_tel(1881);
 
+        Customercontact customercontact1 = new Customercontact();
+        customercontact1.setCc_cuid(new Long(1));
+        customercontact1.setCc_detno(1);
+        customercontact1.setCc_name("zdw");
+        customercontact1.setCc_tel(1881);
+
         insertDetail1.add(customercontact);
+        insertDetail1.add(customercontact1);
         customercontactMapper.batchInsert(insertDetail1);
     }
 

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

@@ -389,7 +389,10 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
          for (int i = 0;i<sourcePids.size();i++){
              ProdIODetail sourcePid = sourcePids.get(i);
              ProdIODetail targetPid = new ProdIODetail();
-             if(sourcePid.getPd_inqty()-sourcePid.getPd_yqty()>0){
+             pdInqty = sourcePid.getPd_inqty()==null?0:sourcePid.getPd_inqty();
+             pdYqty = sourcePid.getPd_yqty()==null?0:sourcePid.getPd_yqty();
+
+             if(pdInqty-pdYqty>0){
                  targetPid.setPd_piid(pi_id);
                  targetPid.setPd_inoutno(piInoutno);
                  targetPid.setPd_piclass(BillCodeSeq.PURCHASEOUT.getName());
@@ -404,10 +407,10 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
                  //公司id
                  targetPid.setCompanyId(sourcePid.getCompanyId());
                  //本次转单数
-                 targetPid.setPd_outqty(sourcePid.getPd_inqty()-sourcePid.getPd_yqty());
+                 targetPid.setPd_outqty(pdInqty-pdYqty);
                  prodIODetailMapper.insertSelective(targetPid);
                  //更新已转数
-                 sourcePid.setPd_yqty(sourcePid.getPd_inqty());
+                 sourcePid.setPd_yqty(pdInqty);
                  prodIODetailMapper.updateByPrimaryKeySelective(sourcePid);
              }
          }

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

@@ -340,8 +340,8 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
 
         //检查从表
         for (PurchaseDetail purchaseDetail : purchaseDetails) {
-            pdQty = purchaseDetail.getPd_qty();
-            pdYqty = purchaseDetail.getPd_yqty();
+            pdQty = purchaseDetail.getPd_qty()==null?0:purchaseDetail.getPd_qty();
+            pdYqty = purchaseDetail.getPd_yqty()==null?0:purchaseDetail.getPd_yqty();
             if (pdQty-pdYqty>0){
                 count++;
             }
@@ -377,7 +377,10 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         for (int i=0;i<purchaseDetails.size();i++){
             PurchaseDetail purchaseDetail =purchaseDetails.get(i);
             ProdIODetail prodIODetail = new ProdIODetail();
-            if ((int) (purchaseDetail.getPd_qty()-purchaseDetail.getPd_yqty())>0){
+            pdQty = purchaseDetail.getPd_qty()==null?0:purchaseDetail.getPd_qty();
+            pdYqty = purchaseDetail.getPd_yqty()==null?0:purchaseDetail.getPd_yqty();
+
+            if (pdQty-pdYqty>0){
                 prodIODetail.setPd_piid(pi_id);
                 prodIODetail.setPd_inoutno(piInoutno);
                 prodIODetail.setPd_piclass("采购验收单");
@@ -391,10 +394,10 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
                 //公司id
                 prodIODetail.setCompanyId(purchaseDetail.getCompanyId());
                 //本次转单数
-                prodIODetail.setPd_inqty((purchaseDetail.getPd_qty()-purchaseDetail.getPd_yqty()));
+                prodIODetail.setPd_inqty(pdQty-pdYqty);
                 prodIODetailMapper.insertSelective(prodIODetail);
                 //更新已转数
-                purchaseDetail.setPd_yqty(purchaseDetail.getPd_qty());
+                purchaseDetail.setPd_yqty(pdQty);
                 purchasedetailMapper.updateByPrimaryKeySelective(purchaseDetail);
             }
         }

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

@@ -550,246 +550,61 @@
     where pd_id = #{pd_id,jdbcType=INTEGER}
   </update>
   <insert id="batchInsert" parameterType="java.util.List" >
+    insert into prodiodetail (pd_piid, pd_inoutno,
+    pd_piclass, pd_pdno, pd_ordercode,
+    pd_orderdetno, pd_prodid, pd_prodcode,
+    pd_unit, pd_inqty, pd_outqty,
+    pd_orderprice, pd_sendprice, pd_price,
+    pd_total, pd_taxrate, pd_netprice,
+    pd_nettotal, pd_whid, pd_whcode,
+    pd_whname, pd_inwhid, pd_inwhcode,
+    pd_inwhname, pd_orderid, pd_sdid,
+    pd_status, companyid, updaterid,
+    updatetime, pd_text1, pd_text2,
+    pd_text3, pd_text4, pd_text5,
+    pd_ym, pd_yqty, pd_ioid,
+    pd_remark) VALUES
     <foreach collection="list" item="item" index="index" open="" close="" separator=",">
-      insert into prodiodetail
-      <trim prefix="(" suffix=")" suffixOverrides=",">
-        <if test="item.pd_piid != null">
-          pd_piid,
-        </if>
-        <if test="item.pd_inoutno != null">
-          pd_inoutno,
-        </if>
-        <if test="item.pd_piclass != null">
-          pd_piclass,
-        </if>
-        <if test="item.pd_pdno != null">
-          pd_pdno,
-        </if>
-        <if test="item.pd_ordercode != null">
-          pd_ordercode,
-        </if>
-        <if test="item.pd_orderdetno != null">
-          pd_orderdetno,
-        </if>
-        <if test="item.pd_prodid != null">
-          pd_prodid,
-        </if>
-        <if test="item.pd_prodcode != null">
-          pd_prodcode,
-        </if>
-        <if test="item.pd_unit != null">
-          pd_unit,
-        </if>
-        <if test="item.pd_inqty != null">
-          pd_inqty,
-        </if>
-        <if test="item.pd_outqty != null">
-          pd_outqty,
-        </if>
-        <if test="item.pd_orderprice != null">
-          pd_orderprice,
-        </if>
-        <if test="item.pd_sendprice != null">
-          pd_sendprice,
-        </if>
-        <if test="item.pd_price != null">
-          pd_price,
-        </if>
-        <if test="item.pd_total != null">
-          pd_total,
-        </if>
-        <if test="item.pd_taxrate != null">
-          pd_taxrate,
-        </if>
-        <if test="item.pd_netprice != null">
-          pd_netprice,
-        </if>
-        <if test="item.pd_nettotal != null">
-          pd_nettotal,
-        </if>
-        <if test="item.pd_whid != null">
-          pd_whid,
-        </if>
-        <if test="item.pd_whcode != null">
-          pd_whcode,
-        </if>
-        <if test="item.pd_whname != null">
-          pd_whname,
-        </if>
-        <if test="item.pd_inwhid != null">
-          pd_inwhid,
-        </if>
-        <if test="item.pd_inwhcode != null">
-          pd_inwhcode,
-        </if>
-        <if test="item.pd_inwhname != null">
-          pd_inwhname,
-        </if>
-        <if test="item.pd_orderid != null">
-          pd_orderid,
-        </if>
-        <if test="item.pd_sdid != null">
-          pd_sdid,
-        </if>
-        <if test="item.pd_status != null">
-          pd_status,
-        </if>
-        <if test="item.companyId != null">
-          companyid,
-        </if>
-        <if test="item.updaterId != null">
-          updaterid,
-        </if>
-        <if test="item.updateTime != null">
-          updatetime,
-        </if>
-        <if test="item.pd_text1 != null">
-          pd_text1,
-        </if>
-        <if test="item.pd_text2 != null">
-          pd_text2,
-        </if>
-        <if test="item.pd_text3 != null">
-          pd_text3,
-        </if>
-        <if test="item.pd_text4 != null">
-          pd_text4,
-        </if>
-        <if test="item.pd_text5 != null">
-          pd_text5,
-        </if>
-        <if test="item.pd_ym != null">
-          pd_ym,
-        </if>
-        <if test="item.pd_yqty != null">
-          pd_yqty,
-        </if>
-        <if test="item.pd_remark != null">
-          pd_remark,
-        </if>
-        <if test="item.pd_ioid != null">
-          pd_ioid,
-        </if>
-      </trim>
-      <trim prefix="values (" suffix=")" suffixOverrides=",">
-        <if test="item.pd_piid != null">
-          #{item.pd_piid,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_inoutno != null">
-          #{item.pd_inoutno,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_piclass != null">
-          #{item.pd_piclass,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_pdno != null">
-          #{item.pd_pdno,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_ordercode != null">
-          #{item.pd_ordercode,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_orderdetno != null">
-          #{item.pd_orderdetno,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_prodid != null">
-          #{item.pd_prodid,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_prodcode != null">
-          #{item.pd_prodcode,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_unit != null">
-          #{item.pd_unit,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_inqty != null">
-          #{item.pd_inqty,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_outqty != null">
-          #{item.pd_outqty,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_orderprice != null">
-          #{item.pd_orderprice,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_sendprice != null">
-          #{item.pd_sendprice,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_price != null">
-          #{item.pd_price,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_total != null">
-          #{item.pd_total,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_taxrate != null">
-          #{item.pd_taxrate,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_netprice != null">
-          #{item.pd_netprice,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_nettotal != null">
-          #{item.pd_nettotal,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_whid != null">
-          #{item.pd_whid,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_whcode != null">
-          #{item.pd_whcode,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_whname != null">
-          #{item.pd_whname,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_inwhid != null">
-          #{item.pd_inwhid,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_inwhcode != null">
-          #{item.pd_inwhcode,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_inwhname != null">
-          #{item.pd_inwhname,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_orderid != null">
-          #{item.pd_orderid,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_sdid != null">
-          #{item.pd_sdid,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_status != null">
-          #{item.pd_status,jdbcType=INTEGER},
-        </if>
-        <if test="item.companyId != null">
-          #{item.companyId,jdbcType=INTEGER},
-        </if>
-        <if test="item.updaterId != null">
-          #{item.updaterId,jdbcType=INTEGER},
-        </if>
-        <if test="item.updateTime != null">
-          #{item.updateTime,jdbcType=TIMESTAMP},
-        </if>
-        <if test="item.pd_text1 != null">
-          #{item.pd_text1,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_text2 != null">
-          #{item.pd_text2,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_text3 != null">
-          #{item.pd_text3,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_text4 != null">
-          #{item.pd_text4,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_text5 != null">
-          #{item.pd_text5,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_ym != null">
-          #{item.pd_ym,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_yqty != null">
-          #{item.pd_yqty,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_remark != null">
-          #{item.pd_remark,jdbcType=LONGVARCHAR},
-        </if>
-        <if test="item.pd_ioid != null">
-          #{item.pd_ioid,jdbcType=INTEGER},
-        </if>
-      </trim>
+      (
+      #{item.pd_piid,jdbcType=INTEGER},
+      #{item.pd_inoutno,jdbcType=VARCHAR},
+      #{item.pd_piclass,jdbcType=VARCHAR},
+      #{item.pd_pdno,jdbcType=INTEGER},
+      #{item.pd_ordercode,jdbcType=VARCHAR},
+      #{item.pd_orderdetno,jdbcType=INTEGER},
+      #{item.pd_prodid,jdbcType=INTEGER},
+      #{item.pd_prodcode,jdbcType=VARCHAR},
+      #{item.pd_unit,jdbcType=VARCHAR},
+      #{item.pd_inqty,jdbcType=DOUBLE},
+      #{item.pd_outqty,jdbcType=DOUBLE},
+      #{item.pd_orderprice,jdbcType=DOUBLE},
+      #{item.pd_sendprice,jdbcType=DOUBLE},
+      #{item.pd_price,jdbcType=DOUBLE},
+      #{item.pd_total,jdbcType=DOUBLE},
+      #{item.pd_taxrate,jdbcType=DOUBLE},
+      #{item.pd_netprice,jdbcType=DOUBLE},
+      #{item.pd_nettotal,jdbcType=DOUBLE},
+      #{item.pd_whid,jdbcType=INTEGER},
+      #{item.pd_whcode,jdbcType=VARCHAR},
+      #{item.pd_whname,jdbcType=VARCHAR},
+      #{item.pd_inwhid,jdbcType=INTEGER},
+      #{item.pd_inwhcode,jdbcType=VARCHAR},
+      #{item.pd_inwhname,jdbcType=VARCHAR},
+      #{item.pd_orderid,jdbcType=INTEGER},
+      #{item.pd_sdid,jdbcType=INTEGER},
+      #{item.pd_status,jdbcType=INTEGER},
+      #{item.companyId,jdbcType=INTEGER},
+      #{item.updaterId,jdbcType=INTEGER},
+      #{item.updateTime,jdbcType=TIMESTAMP},
+      #{item.pd_text1,jdbcType=VARCHAR},
+      #{item.pd_text2,jdbcType=VARCHAR},
+      #{item.pd_text3,jdbcType=VARCHAR},
+      #{item.pd_text4,jdbcType=VARCHAR},
+      #{item.pd_text5,jdbcType=VARCHAR},
+      #{item.pd_ym,jdbcType=INTEGER},
+      #{item.pd_yqty,jdbcType=DOUBLE},
+      #{item.pd_remark,jdbcType=LONGVARCHAR},
+      #{item.pd_ioid,jdbcType=INTEGER})
     </foreach>
   </insert>
 

+ 23 - 0
applications/purchase/purchase-server/src/test/PurchaseTest.java

@@ -1,4 +1,6 @@
 import com.usoftchina.saas.purchase.PurchaseApplication;
+import com.usoftchina.saas.purchase.mapper.ProdIODetailMapper;
+import com.usoftchina.saas.purchase.po.ProdIODetail;
 import com.usoftchina.saas.purchase.service.ProdInOutService;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -7,6 +9,9 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
+import java.util.ArrayList;
+import java.util.List;
+
 @RunWith(SpringJUnit4ClassRunner.class)
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = PurchaseApplication.class)
 @EnableAutoConfiguration
@@ -14,9 +19,27 @@ public class PurchaseTest {
 
     @Autowired
     private ProdInOutService prodInOutService;
+    @Autowired
+    private ProdIODetailMapper prodIODetailMapper;
+
 
     @Test
     public void test(){
+        List<ProdIODetail> list = new ArrayList<>();
+        ProdIODetail prodIODetail1 = new ProdIODetail();
+        prodIODetail1.setPd_piid(new Long(1));
+        prodIODetail1.setCompanyId(-1);
+        prodIODetail1.setPd_inoutno("test01");
+
+
+        ProdIODetail prodIODetail2 = new ProdIODetail();
+        prodIODetail2.setPd_piid(new Long(1));
+        prodIODetail2.setCompanyId(-1);
+        prodIODetail2.setPd_inoutno("test02");
+
+        list.add(prodIODetail1);
+        list.add(prodIODetail2);
 
+        prodIODetailMapper.batchInsert(list);
     }
 }

+ 54 - 239
applications/storage/storage-server/src/main/resources/mapper/ProdIODetailMapper.xml

@@ -550,246 +550,61 @@
     where pd_id = #{pd_id,jdbcType=INTEGER}
   </update>
   <insert id="batchInsert" parameterType="java.util.List" >
+    insert into prodiodetail (pd_piid, pd_inoutno,
+    pd_piclass, pd_pdno, pd_ordercode,
+    pd_orderdetno, pd_prodid, pd_prodcode,
+    pd_unit, pd_inqty, pd_outqty,
+    pd_orderprice, pd_sendprice, pd_price,
+    pd_total, pd_taxrate, pd_netprice,
+    pd_nettotal, pd_whid, pd_whcode,
+    pd_whname, pd_inwhid, pd_inwhcode,
+    pd_inwhname, pd_orderid, pd_sdid,
+    pd_status, companyid, updaterid,
+    updatetime, pd_text1, pd_text2,
+    pd_text3, pd_text4, pd_text5,
+    pd_ym, pd_yqty, pd_ioid,
+    pd_remark) VALUES
     <foreach collection="list" item="item" index="index" open="" close="" separator=",">
-      insert into prodiodetail
-      <trim prefix="(" suffix=")" suffixOverrides=",">
-        <if test="item.pd_piid != null">
-          pd_piid,
-        </if>
-        <if test="item.pd_inoutno != null">
-          pd_inoutno,
-        </if>
-        <if test="item.pd_piclass != null">
-          pd_piclass,
-        </if>
-        <if test="item.pd_pdno != null">
-          pd_pdno,
-        </if>
-        <if test="item.pd_ordercode != null">
-          pd_ordercode,
-        </if>
-        <if test="item.pd_orderdetno != null">
-          pd_orderdetno,
-        </if>
-        <if test="item.pd_prodid != null">
-          pd_prodid,
-        </if>
-        <if test="item.pd_prodcode != null">
-          pd_prodcode,
-        </if>
-        <if test="item.pd_unit != null">
-          pd_unit,
-        </if>
-        <if test="item.pd_inqty != null">
-          pd_inqty,
-        </if>
-        <if test="item.pd_outqty != null">
-          pd_outqty,
-        </if>
-        <if test="item.pd_orderprice != null">
-          pd_orderprice,
-        </if>
-        <if test="item.pd_sendprice != null">
-          pd_sendprice,
-        </if>
-        <if test="item.pd_price != null">
-          pd_price,
-        </if>
-        <if test="item.pd_total != null">
-          pd_total,
-        </if>
-        <if test="item.pd_taxrate != null">
-          pd_taxrate,
-        </if>
-        <if test="item.pd_netprice != null">
-          pd_netprice,
-        </if>
-        <if test="item.pd_nettotal != null">
-          pd_nettotal,
-        </if>
-        <if test="item.pd_whid != null">
-          pd_whid,
-        </if>
-        <if test="item.pd_whcode != null">
-          pd_whcode,
-        </if>
-        <if test="item.pd_whname != null">
-          pd_whname,
-        </if>
-        <if test="item.pd_inwhid != null">
-          pd_inwhid,
-        </if>
-        <if test="item.pd_inwhcode != null">
-          pd_inwhcode,
-        </if>
-        <if test="item.pd_inwhname != null">
-          pd_inwhname,
-        </if>
-        <if test="item.pd_orderid != null">
-          pd_orderid,
-        </if>
-        <if test="item.pd_sdid != null">
-          pd_sdid,
-        </if>
-        <if test="item.pd_status != null">
-          pd_status,
-        </if>
-        <if test="item.companyId != null">
-          companyid,
-        </if>
-        <if test="item.updaterId != null">
-          updaterid,
-        </if>
-        <if test="item.updateTime != null">
-          updatetime,
-        </if>
-        <if test="item.pd_text1 != null">
-          pd_text1,
-        </if>
-        <if test="item.pd_text2 != null">
-          pd_text2,
-        </if>
-        <if test="item.pd_text3 != null">
-          pd_text3,
-        </if>
-        <if test="item.pd_text4 != null">
-          pd_text4,
-        </if>
-        <if test="item.pd_text5 != null">
-          pd_text5,
-        </if>
-        <if test="item.pd_ym != null">
-          pd_ym,
-        </if>
-        <if test="item.pd_yqty != null">
-          pd_yqty,
-        </if>
-        <if test="item.pd_remark != null">
-          pd_remark,
-        </if>
-        <if test="item.pd_ioid != null">
-          pd_ioid,
-        </if>
-      </trim>
-      <trim prefix="values (" suffix=")" suffixOverrides=",">
-        <if test="item.pd_piid != null">
-          #{item.pd_piid,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_inoutno != null">
-          #{item.pd_inoutno,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_piclass != null">
-          #{item.pd_piclass,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_pdno != null">
-          #{item.pd_pdno,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_ordercode != null">
-          #{item.pd_ordercode,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_orderdetno != null">
-          #{item.pd_orderdetno,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_prodid != null">
-          #{item.pd_prodid,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_prodcode != null">
-          #{item.pd_prodcode,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_unit != null">
-          #{item.pd_unit,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_inqty != null">
-          #{item.pd_inqty,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_outqty != null">
-          #{item.pd_outqty,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_orderprice != null">
-          #{item.pd_orderprice,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_sendprice != null">
-          #{item.pd_sendprice,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_price != null">
-          #{item.pd_price,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_total != null">
-          #{item.pd_total,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_taxrate != null">
-          #{item.pd_taxrate,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_netprice != null">
-          #{item.pd_netprice,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_nettotal != null">
-          #{item.pd_nettotal,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_whid != null">
-          #{item.pd_whid,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_whcode != null">
-          #{item.pd_whcode,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_whname != null">
-          #{item.pd_whname,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_inwhid != null">
-          #{item.pd_inwhid,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_inwhcode != null">
-          #{item.pd_inwhcode,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_inwhname != null">
-          #{item.pd_inwhname,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_orderid != null">
-          #{item.pd_orderid,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_sdid != null">
-          #{item.pd_sdid,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_status != null">
-          #{item.pd_status,jdbcType=INTEGER},
-        </if>
-        <if test="item.companyId != null">
-          #{item.companyId,jdbcType=INTEGER},
-        </if>
-        <if test="item.updaterId != null">
-          #{item.updaterId,jdbcType=INTEGER},
-        </if>
-        <if test="item.updateTime != null">
-          #{item.updateTime,jdbcType=TIMESTAMP},
-        </if>
-        <if test="item.pd_text1 != null">
-          #{item.pd_text1,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_text2 != null">
-          #{item.pd_text2,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_text3 != null">
-          #{item.pd_text3,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_text4 != null">
-          #{item.pd_text4,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_text5 != null">
-          #{item.pd_text5,jdbcType=VARCHAR},
-        </if>
-        <if test="item.pd_ym != null">
-          #{item.pd_ym,jdbcType=INTEGER},
-        </if>
-        <if test="item.pd_yqty != null">
-          #{item.pd_yqty,jdbcType=DOUBLE},
-        </if>
-        <if test="item.pd_remark != null">
-          #{item.pd_remark,jdbcType=LONGVARCHAR},
-        </if>
-        <if test="item.pd_ioid != null">
-          #{item.pd_ioid,jdbcType=INTEGER},
-        </if>
-      </trim>
+      (
+      #{item.pd_piid,jdbcType=INTEGER},
+      #{item.pd_inoutno,jdbcType=VARCHAR},
+      #{item.pd_piclass,jdbcType=VARCHAR},
+      #{item.pd_pdno,jdbcType=INTEGER},
+      #{item.pd_ordercode,jdbcType=VARCHAR},
+      #{item.pd_orderdetno,jdbcType=INTEGER},
+      #{item.pd_prodid,jdbcType=INTEGER},
+      #{item.pd_prodcode,jdbcType=VARCHAR},
+      #{item.pd_unit,jdbcType=VARCHAR},
+      #{item.pd_inqty,jdbcType=DOUBLE},
+      #{item.pd_outqty,jdbcType=DOUBLE},
+      #{item.pd_orderprice,jdbcType=DOUBLE},
+      #{item.pd_sendprice,jdbcType=DOUBLE},
+      #{item.pd_price,jdbcType=DOUBLE},
+      #{item.pd_total,jdbcType=DOUBLE},
+      #{item.pd_taxrate,jdbcType=DOUBLE},
+      #{item.pd_netprice,jdbcType=DOUBLE},
+      #{item.pd_nettotal,jdbcType=DOUBLE},
+      #{item.pd_whid,jdbcType=INTEGER},
+      #{item.pd_whcode,jdbcType=VARCHAR},
+      #{item.pd_whname,jdbcType=VARCHAR},
+      #{item.pd_inwhid,jdbcType=INTEGER},
+      #{item.pd_inwhcode,jdbcType=VARCHAR},
+      #{item.pd_inwhname,jdbcType=VARCHAR},
+      #{item.pd_orderid,jdbcType=INTEGER},
+      #{item.pd_sdid,jdbcType=INTEGER},
+      #{item.pd_status,jdbcType=INTEGER},
+      #{item.companyId,jdbcType=INTEGER},
+      #{item.updaterId,jdbcType=INTEGER},
+      #{item.updateTime,jdbcType=TIMESTAMP},
+      #{item.pd_text1,jdbcType=VARCHAR},
+      #{item.pd_text2,jdbcType=VARCHAR},
+      #{item.pd_text3,jdbcType=VARCHAR},
+      #{item.pd_text4,jdbcType=VARCHAR},
+      #{item.pd_text5,jdbcType=VARCHAR},
+      #{item.pd_ym,jdbcType=INTEGER},
+      #{item.pd_yqty,jdbcType=DOUBLE},
+      #{item.pd_remark,jdbcType=LONGVARCHAR},
+      #{item.pd_ioid,jdbcType=INTEGER})
     </foreach>
   </insert>
 

+ 2 - 3
frontend/saas-web/app/model/document/bom.js → frontend/saas-web/app/model/document/bomdetail.js

@@ -1,13 +1,12 @@
-Ext.define('saas.model.document.bom', {
+Ext.define('saas.model.document.bomdetail', {
     extend: 'saas.model.Base',
     fields: [
         { name: 'id', type: 'int' },
-        { name: 'bd_id', type: 'int' },
         { name: 'bd_bomid', type: 'int' },
         { name: 'bd_detno', type: 'int' },
         { name: 'bd_sonid', type: 'int' },
         { name: 'bd_soncode', type: 'string' },
-        { name: 'bo_unit', type: 'string' },
+        { name: 'bd_unit', type: 'string' },
         { name: 'bd_baseqty', type: 'string' },
         { name: 'bd_replace', type: 'string' },
         { name: 'bd_remark', type: 'string' },

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

@@ -7,7 +7,7 @@ Ext.define('saas.view.core.base.BasePanelController', {
 
     query: function() {
         var form = this.view;
-        var grid = form.down('core-baseform-gridpanel');
+        var grid = form.down('core-base-gridpanel');
         grid.condition = '';
         var fields = form.searchField.map(f => f.name);
         var items = [];

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

@@ -153,11 +153,11 @@ Ext.define('saas.view.core.base.GridPanel', {
                 })
                 .then(function() {
                     showToast('操作成功');
+                    grid.store.load();
                 })
                 .catch(function(response) {
                     showToast('操作失败');
                 });
-                grid.store.load();
         }else{
             showToast('请勾选至少一条明细。');
         }

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

@@ -261,13 +261,8 @@ Ext.define('saas.view.core.form.FormPanel', {
         var detailGrids = me.query('detailGridField');
 
         Ext.Array.each(detailGrids, function(g) {
-            var columns = g.columns;
-            Ext.Array.each(columns, function(c) {
-                var e = c.getEditor();
-                if(e) {
-                    typeof e.setDisabled == 'function' && e.setDisabled(!able);
-                }
-            });
+
+            g.setGridDisabled(able);
         });
 
         Ext.Array.each(items, function(item) {

+ 51 - 14
frontend/saas-web/app/view/core/form/field/DetailGridField.js

@@ -25,6 +25,7 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
 
     showIndex: true,
     configUrl: '',
+    editable: true,
 
     initComponent: function() {
         var me = this;
@@ -33,7 +34,9 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
 
         addRows = function(id) {
             var grid = Ext.getCmp(id);
-            grid.addDetail(0);
+            if(grid.editable) {
+                grid.addDetail(0);
+            }
         };
 
         Ext.apply(me, {
@@ -46,8 +49,11 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
                 emptyText: '<div style="width: 100%; text-align: center; cursor: pointer; color: green;" class="fa fa-plus" title="新增行" onclick="addRows(\'' + me.id + '\')"></div>',
             },
             listeners: {
-                itemmouseenter: function(grid, record, item, index, e, eOpts) {
-                    var lockedItems = grid.el.dom.parentElement.parentElement.getElementsByClassName('x-grid-scrollbar-clipper-locked')[0].getElementsByClassName('x-grid-item');
+                itemmouseenter: function(view, record, item, index, e, eOpts) {
+                    if(!view.up('detailGridField').editable) {
+                        return;
+                    }
+                    var lockedItems = view.el.dom.parentElement.parentElement.getElementsByClassName('x-grid-scrollbar-clipper-locked')[0].getElementsByClassName('x-grid-item');
                     var currentLockedItem = lockedItems[index];
                     var textItem = currentLockedItem.getElementsByClassName('text')[0];
                     var iconsItem = currentLockedItem.getElementsByClassName('icons')[0];
@@ -55,8 +61,11 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
                     textItem.style.display = 'none';
                     iconsItem.style.display = 'flex';
                 },
-                itemmouseleave: function(grid, record, item, index, e, eOpts) {
-                    var lockedItems = grid.el.dom.parentElement.parentElement.getElementsByClassName('x-grid-scrollbar-clipper-locked')[0].getElementsByClassName('x-grid-item');
+                itemmouseleave: function(view, record, item, index, e, eOpts) {
+                    if(!view.up('detailGridField').editable) {
+                        return;
+                    }
+                    var lockedItems = view.el.dom.parentElement.parentElement.getElementsByClassName('x-grid-scrollbar-clipper-locked')[0].getElementsByClassName('x-grid-item');
                     var currentLockedItem = lockedItems[index];
                     var textItem = currentLockedItem.getElementsByClassName('text')[0];
                     var iconsItem = currentLockedItem.getElementsByClassName('icons')[0];
@@ -64,7 +73,7 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
                     textItem.style.display = 'block';
                     iconsItem.style.display = 'none';
                 },
-                cellclick: function(grid, td, cellIndex, record, tr, rowIndex, e, eOpts) {
+                cellclick: function(view, td, cellIndex, record, tr, rowIndex, e, eOpts) {
                     var target = e.target;
                     var detno = record.get(me.detnoColumn);
 
@@ -151,8 +160,12 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
     },
 
     addDetail: function(v) {
-        var me = this,
-        detnoColumn = me.detnoColumn,
+        var me = this;
+        var me = this;
+        if(!me.editable) {
+            return;
+        }
+        var detnoColumn = me.detnoColumn,
         store = me.getStore(),
         records = store.getData().items,
         selectedRecord = records.find(function(r) {
@@ -177,8 +190,11 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
     },
 
     deleteDetail: function(v) {
-        var me = this,
-        detnoColumn = me.detnoColumn,
+        var me = this;
+        if(!me.editable) {
+            return;
+        }
+        var detnoColumn = me.detnoColumn,
         store = me.getStore(),
         records = store.getData().items,
         selectedRecord = records.find(function(r) {
@@ -210,8 +226,12 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
     },
 
     swapUp: function() {
-        var me = this,
-        store = me.getStore(),
+        var me = this;
+        var me = this;
+        if(!me.editable) {
+            return;
+        }
+        var store = me.getStore(),
         record = me.selModel.lastSelected,
         selectedIdx = store.indexOf(record);
 
@@ -219,8 +239,12 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
     },
 
     swapDown: function() {
-        var me = this,
-        store = me.getStore(),
+        var me = this;
+        var me = this;
+        if(!me.editable) {
+            return;
+        }
+        var store = me.getStore(),
         record = me.selModel.lastSelected,
         selectedIdx = store.indexOf(record);
         
@@ -250,6 +274,19 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
             //聚焦目标行
             me.selModel.select(to);
         }
+    },
+    setGridDisabled: function(able) {
+        var me = this,
+        columns = me.columns;
+
+        me.editable = able;
+
+        Ext.Array.each(columns, function(c) {
+            var e = c.getEditor();
+            if(e) {
+                typeof e.setDisabled == 'function' && e.setDisabled(!able);
+            }
+        });
     }
 
 });

+ 42 - 4
frontend/saas-web/app/view/document/bom/BasePanel.js

@@ -5,12 +5,50 @@ Ext.define('saas.view.document.bom.BasePanel', {
     controller: 'document-bom-basepanel',
     viewModel: 'document-bom-basepanel',
 
+    searchField:[],
+
     //字段属性
+    _formXtype:'document-bom-formpanel',
     _title:'BOM资料',
-    _dataUrl:basePath + 'document/vendor/getVendorsByCondition',
-    _saveUrl:basePath + 'document/vendor/save',
-    _deleteUrl:basePath + 'document/vendor/delete',
-
+    // _dataUrl:basePath+'ducument/customer/list',
+    _batchOpenUrl:basePath+'document/bom/batchOpen',
+    _batchCloseUrl:basePath+'document/bom/batchClose',
+    _batchDeleteUrl:basePath+'document/bom/batchDelete',
 
+    gridConfig: {
+        idField: 'id',
+        codeField: 'bo_mothercode',
+        dataUrl: basePath+'document/bom/list',
+        columns : [{
+            text : "id", 
+            width : 0, 
+            dataIndex : "id", 
+            xtype : "numbercolumn",   
+        },{
+            text : "母件id", 
+            width : 0, 
+            dataIndex : "bo_motherid", 
+            xtype : "numbercolumn",   
+        },{
+            text : "母件编号", 
+            width : 200.0, 
+            dataIndex : "bo_mothercode", 
+        }, 
+        {
+            text : "母件名称", 
+            dataIndex : "bo_mothername", 
+            width : 120.0, 
+        }, 
+        {
+            text : "BOM状态", 
+            dataIndex : "bo_status", 
+            width : 120.0, 
+        }, 
+        {
+            text : "BOM版本", 
+            dataIndex : "bo_version", 
+            width : 120.0, 
+        }]
+    },
 
 });

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

@@ -0,0 +1,65 @@
+Ext.define('saas.view.document.bom.FormController', {
+    extend: 'saas.view.core.form.FormPanelController',
+    alias: 'controller.document-bom-formpanel',
+    
+    init: function (form) {
+        var me = this;
+        this.control({});
+    },
+
+    auditBtnClick: function() {
+        var me = this,
+        form = me.getView(),
+        statusCodeField = form._statusCodeField,
+        viewModel = me.getViewModel(),
+        status = viewModel.data[statusCodeField];
+        status == 'OPEN' ? me.unAudit() : me.audit();
+    },
+
+    audit: function(){
+        var me = this,
+        form = this.getView(),
+        viewModel = me.getViewModel();
+        
+        me.BaseUtil.request({
+            url: form._openUrl+'/'+viewModel.data.id,
+            params: '',
+            method: 'POST',
+        })
+        .then(function(localJson) {
+            if(localJson.success){
+                showToast('启用成功');
+                form.initId = localJson.data.id;
+                form.FormUtil.loadData(form);
+                viewModel.set('base.editable', false);
+            }
+        })
+        .catch(function(res) {
+            console.error(res);
+            showToast('启用失败: ' + res.message);
+        });
+    },
+    unAudit: function() {
+        var me = this,
+        form = this.getView(),
+        viewModel = me.getViewModel();
+        
+        me.BaseUtil.request({
+            url: form._closeUrl+'/'+viewModel.data.id,
+            params: '',
+            method: 'POST',
+        })
+        .then(function(localJson) {
+            if(localJson.success){
+                showToast('禁用成功');
+                form.initId = localJson.data.id;
+                form.FormUtil.loadData(form);
+                viewModel.set('base.editable', false);
+            }
+        })
+        .catch(function(res) {
+            console.log(res);
+            showToast('禁用失败: ' + res.message);
+        });
+    }
+});

+ 17 - 0
frontend/saas-web/app/view/document/bom/FormModel.js

@@ -0,0 +1,17 @@
+Ext.define('saas.view.document.bom.FormModel', {
+    extend: 'saas.view.core.form.FormPanelModel',
+    alias: 'viewmodel.document-bom-formpanel',
+
+    data: {
+        id: 0
+    },
+
+    formulas:{
+        showAuditBtn:{
+            bind:'{id}',
+            get:function(value){
+                return !value;
+            }
+        }
+    }
+});

+ 162 - 0
frontend/saas-web/app/view/document/bom/FormPanel.js

@@ -0,0 +1,162 @@
+Ext.define('saas.view.document.bom.FormPanel', {
+    extend: 'saas.view.core.form.FormPanel',
+    xtype: 'document-bom-formpanel',
+
+    controller: 'document-bom-formpanel',
+    viewModel: 'document-bom-formpanel',
+    
+    caller:'Bom',
+
+    //字段属性
+    _title:'客户资料',
+    _idField: 'id',
+    _codeField: 'bo_mothercode',
+    _statusField: 'bo_status',
+    _statusCodeField: 'bo_statuscode',
+    _readUrl:basePath+'document/bom/read/',
+    _saveUrl:basePath+'document/bom/save',
+    _openUrl:basePath+'document/bom/open',
+    _closeUrl:basePath+'document/bom/close',
+    _deleteUrl:basePath+'document/bom/delete/',
+    initId:0,
+
+    defaultItems: [{
+        xtype: 'hidden',
+        name: 'id',
+        fieldLabel: 'id',
+        allowBlank: true,
+        columnWidth: 0.25
+    },{
+        xtype: 'hidden',
+        name: 'bo_motherid',
+        fieldLabel: '母件id',
+        allowBlank: true,
+        columnWidth: 0.25
+    },{
+        xtype: 'textfield',
+        name: 'bo_mothername',
+        fieldLabel: 'BOM名称',
+        allowBlank: false,
+        columnWidth: 0.25
+    },{
+        xtype: 'textfield',
+        name: 'bo_mothercode',
+        fieldLabel: 'BOM编号',
+        allowBlank: true,
+        columnWidth: 0.25
+    },{
+        xtype: 'textfield',
+        name: 'bo_status',
+        fieldLabel: 'BOM状态',
+        allowBlank: true,
+        columnWidth: 0.25
+    },{
+        xtype: 'hidden',
+        name: 'bo_statuscode',
+        fieldLabel: '状态码',
+        allowBlank: true,
+        columnWidth: 0.25
+    },{
+        format : "Y-m-d",
+        xtype : "datefield", 
+        name : "createTime", 
+        fieldLabel : "创建时间", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    },{  
+        format : "Y-m-d",
+        xtype : "datefield", 
+        name : "updateTime", 
+        fieldLabel : "更新时间", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "detailGridField", 
+        detnoColumn:  'bd_detno',
+        storeModel:'saas.model.document.bomdetail',
+        deleteDetailUrl:basePath+'document/bom/deleteDetail/',
+        columns : [
+            {
+                text : "ID", 
+                dataIndex : "id", 
+                width : 0, 
+                xtype : "numbercolumn"
+            },
+            {
+                text : "关联ID", 
+                dataIndex : "bd_bomid", 
+                width : 0, 
+                xtype : "numbercolumn"
+            },
+            {
+                text : "子件编号", 
+                editor : {
+                    xtype : "textfield"
+                },
+                dataIndex : "bd_soncode", 
+                width : 120.0, 
+                xtype : "", 
+                items : null
+            },
+            {
+                text : "单位", 
+                editor : {
+                    xtype : "textfield"
+                },
+                dataIndex : "bd_unit", 
+                width : 120.0, 
+                xtype : "", 
+                items : null
+            },
+            {
+                text : "单位用量", 
+                editor : {
+                    xtype : "textfield"
+                },
+                dataIndex : "bd_baseqty", 
+                width : 120.0, 
+                xtype : "", 
+                items : null
+            },
+            {
+                text : "替代料", 
+                editor : {
+                    xtype : "textfield"
+                },
+                dataIndex : "bd_replace", 
+                width : 120.0, 
+                xtype : "", 
+                items : null
+            }]
+    }],
+
+    /**
+     * 一些初始化viewModel的方法
+     */
+    initViewModel: function() {
+        var me = this,
+        codeField = me._codeField,
+        statusField = me._statusField,
+        statusCodeField = me._statusCodeField,
+        viewModel = me.getViewModel();
+        
+        viewModel.set(codeField, '');
+        viewModel.set('createTime', new Date());
+        viewModel.set('updateTime', new Date());
+
+        if(statusCodeField) {
+            var o = {};
+            o['auditBtnText'] = {
+                bind: '{' + statusCodeField + '}',
+                get: function(value) {
+                    viewModel.set(statusField, value == 'OPEN' ? '启用' : '禁用');
+                    return value == 'OPEN' ? '禁用' : '启用'
+                }
+            };
+            viewModel.setFormulas(o);
+            viewModel.set(statusCodeField, "OPEN");
+        }else {
+            viewModel.set('auditBtnText', "禁用");
+        }
+    }
+});

+ 2 - 1
frontend/saas-web/resources/json/navigation.json

@@ -188,9 +188,10 @@
             "viewType": "other-storeinformation",
             "leaf": true
         }, {
+            "id":"document-bom-basepanel",
             "text": "BOM资料",
             "viewType": "document-bom-basepanel",
-            "addTyep": "document-bom-formpanel",
+            "addType": "document-bom-formpanel",
             "leaf": true
         }, {
             "id":"other-bankinformation",