zhuth 7 years ago
parent
commit
e821ca52a4
46 changed files with 2584 additions and 900 deletions
  1. 10 12
      applications/commons/commons-api/src/main/java/com/usoftchina/saas/commons/api/MaxnumberService.java
  2. 4 0
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/ProdIODetailDTO.java
  3. 3 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/ProdIODetailMapper.java
  4. 3 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/ProdIODetail.java
  5. 29 50
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java
  6. 23 23
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  7. 396 45
      applications/purchase/purchase-server/src/main/resources/mapper/ProdIODetailMapper.xml
  8. 4 1
      framework/core/src/main/java/com/usoftchina/saas/exception/ExceptionCode.java
  9. 7 0
      frontend/saas-web/app/model/document/product.js
  10. 18 0
      frontend/saas-web/app/model/purchase/purchasedetail.js
  11. 2 14
      frontend/saas-web/app/util/FormUtil.js
  12. 4 4
      frontend/saas-web/app/util/QueryUtil.js
  13. 1 1
      frontend/saas-web/app/view/core/dbfind/DbfindGridPanel.js
  14. 10 7
      frontend/saas-web/app/view/core/dbfind/DbfindTrigger.js
  15. 2 7
      frontend/saas-web/app/view/core/form/FormPanelController.js
  16. 38 40
      frontend/saas-web/app/view/core/query/QueryGridPanel.js
  17. 192 8
      frontend/saas-web/app/view/core/query/QueryPanel.js
  18. 4 3
      frontend/saas-web/app/view/core/query/QueryPanelController.js
  19. 5 0
      frontend/saas-web/app/view/core/query/QueryPanelModel.js
  20. 1 1
      frontend/saas-web/app/view/document/kind/ChildForm.js
  21. 3 2
      frontend/saas-web/app/view/document/kind/Kind.js
  22. 19 1
      frontend/saas-web/app/view/document/kind/KindController.js
  23. 1 1
      frontend/saas-web/app/view/document/kind/KindModel.js
  24. 0 552
      frontend/saas-web/app/view/main/MainModel.js
  25. 230 104
      frontend/saas-web/app/view/main/Navigation.js
  26. 2 2
      frontend/saas-web/app/view/purchase/purchase/FormController.js
  27. 18 9
      frontend/saas-web/app/view/purchase/purchase/FormPanel.js
  28. 1 0
      frontend/saas-web/app/view/purchase/purchase/QueryPanelController.js
  29. 10 4
      frontend/saas-web/app/view/purchase/purchaseIn/FormController.js
  30. 8 1
      frontend/saas-web/app/view/purchase/purchaseIn/FormPanel.js
  31. 2 2
      frontend/saas-web/app/view/purchase/purchaseOut/FormController.js
  32. 10 0
      frontend/saas-web/app/view/purchase/purchaseOut/FormPanel.js
  33. 158 0
      frontend/saas-web/app/view/sale/sale/FormController.js
  34. 5 0
      frontend/saas-web/app/view/sale/sale/FormModel.js
  35. 270 0
      frontend/saas-web/app/view/sale/sale/FormPanel.js
  36. 206 0
      frontend/saas-web/app/view/sale/sale/QueryPanel.js
  37. 116 0
      frontend/saas-web/app/view/sale/sale/QueryPanelController.js
  38. 5 0
      frontend/saas-web/app/view/sale/sale/QueryPanelModel.js
  39. 158 0
      frontend/saas-web/app/view/sale/saleIn/FormController.js
  40. 5 0
      frontend/saas-web/app/view/sale/saleIn/FormModel.js
  41. 267 0
      frontend/saas-web/app/view/sale/saleIn/FormPanel.js
  42. 206 0
      frontend/saas-web/app/view/sale/saleIn/QueryPanel.js
  43. 116 0
      frontend/saas-web/app/view/sale/saleIn/QueryPanelController.js
  44. 5 0
      frontend/saas-web/app/view/sale/saleIn/QueryPanelModel.js
  45. 5 5
      frontend/saas-web/app/view/test/order/FormPanel.js
  46. 2 0
      frontend/saas-web/overrides/i18n.js

+ 10 - 12
applications/commons/commons-api/src/main/java/com/usoftchina/saas/commons/api/MaxnumberService.java

@@ -1,14 +1,10 @@
 package com.usoftchina.saas.commons.api;
-import com.usoftchina.saas.base.Result;
 
+import com.usoftchina.saas.base.Result;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestParam;
-/**
-* @Description: 编号接口
-* @Author: guq
-* @Date: 2018/10/20
-*/
+
 @FeignClient("commons-server")
 public interface MaxnumberService {
     /**
@@ -21,13 +17,15 @@ public interface MaxnumberService {
     @PostMapping("/number/pushMaxnubmer")
     public String pushMaxnubmer(@RequestParam("count") Integer count,@RequestParam("code") String code,
                                 @RequestParam("caller") String caller);
+
     /**
-    * @Description 获取单号
-    * @Param: [caller, update]
-    * @return: com.usoftchina.saas.base.Result
-    * @Author: guq
-    * @Date: 2018/10/22
-    */
+     * @Description 获取单号
+     * @Param: [caller, update]
+     * @return: com.usoftchina.saas.base.Result
+     * @Author: guq
+     * @Date: 2018/10/22
+     */
     @PostMapping("/getMaxnumber")
     public Result getMaxnumber(@RequestParam("caller") String caller, @RequestParam("update") boolean update);
+
 }

+ 4 - 0
applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/ProdIODetailDTO.java

@@ -1,6 +1,7 @@
 package com.usoftchina.saas.purchase.dto;
 
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import com.usoftchina.saas.document.entities.Product;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -83,4 +84,7 @@ public class ProdIODetailDTO extends CommonBaseEntity implements Serializable {
     private String pd_remark;
 
     private Long pd_ioid;
+
+    private Product product;
+
 }

+ 3 - 1
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/ProdIODetailMapper.java

@@ -40,5 +40,7 @@ public interface ProdIODetailMapper extends CommonBaseMapper<ProdIODetail> {
 
     void batchUpdate(List<ProdIODetail> list);
 
-    void updatePurchaseYqty(Long id);
+    void updatePurchaseYqty(Integer id);
+
+    List<ProdIODetail> selectByFK(Long id);
 }

+ 3 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/ProdIODetail.java

@@ -1,6 +1,7 @@
 package com.usoftchina.saas.purchase.po;
 
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import com.usoftchina.saas.document.entities.Product;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -79,4 +80,6 @@ public class ProdIODetail extends CommonBaseEntity implements Serializable {
 
     private Long pd_ioid;
 
+    private Product product;
+
 }

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

@@ -74,10 +74,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
               list = prodInOutListMapper.selectProdInOutListByCondition(req);
         } else {
               list = prodInOutListMapper.selectProdInOutBycondition(req);
-
         }
         return list;
-
     }
 
 
@@ -89,12 +87,9 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         //将prodInOut实体对象转化为传输对象
         ProdInOutDTO main = BeanMapper.map(prodInOut,ProdInOutDTO.class);
         //查询从表
-        ProdIODetailExample prodIODetailExample = new ProdIODetailExample();
-        ProdIODetailExample.Criteria cta = prodIODetailExample.createCriteria();
-        cta.andPd_piidEqualTo(id.intValue());
-        List<ProdIODetail> prodIODetails =prodIODetailMapper.selectByExample(prodIODetailExample);
-        List<ProdIODetailDTO> items = BeanMapper.mapList(prodIODetails,ProdIODetailDTO.class);
 
+        List<ProdIODetail> prodIODetails =prodIODetailMapper.selectByFK(id);
+        List<ProdIODetailDTO> items = BeanMapper.mapList(prodIODetails,ProdIODetailDTO.class);
         prodInOutFormDTO.setMain(main);
         prodInOutFormDTO.setItems(items);
         return prodInOutFormDTO;
@@ -123,6 +118,9 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         prodInOut.setCompanyId(companyId);
         prodInOut.setCreatorId(userId);
         prodInOut.setCreateTime(new Date());
+        prodInOut.setPi_date(new Date());
+        prodInOut.setPi_puid(main.getPi_puid());
+        prodInOut.setPi_pucode(main.getPi_pucode());
         //编号获取
         pi_inoutno = pushMaxnubmer(pi_inoutno, pi_id);
         prodInOut.setPi_inoutno(pi_inoutno);
@@ -185,10 +183,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
     private void singleDelete(Long id) {
         if (null != id) {
             ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
-
             //删除主键
             getMapper().deleteByPrimaryKey(prodInOut.getId());
-
             //删除从表
             ProdIODetailExample prodIODetailExample = new ProdIODetailExample();
             ProdIODetailExample.Criteria cta = prodIODetailExample.createCriteria();
@@ -197,7 +193,6 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             //更新已转数
 //            updateYqty(prodInOut.getPi_puid(),prodInOut.getPi_class());
             updateYqty(prodInOut);
-
        }
     }
 
@@ -246,11 +241,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         Object result =  map.get("result");
         System.out.println("result");
         //记录日志
-
-
         if (!StringUtils.isEmpty(result))
             throw new BizException(500, "存在已审核单据,单据编号:" + result);
-
     }
 
 
@@ -274,29 +266,20 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
     }
 
     private void updateYqty(ProdInOut prodInOut) {
-
         //更新已转数
         if ("采购验收单".equals(prodInOut.getPi_class())){
             purchasedetailMapper.updatePurchaseYqty(prodInOut.getPi_puid());
         }else if ("采购验退单".equals(prodInOut.getPi_class())){
-            prodIODetailMapper.updatePurchaseYqty(prodInOut.getPi_inid());
+            prodIODetailMapper.updatePurchaseYqty(prodInOut.getPi_puid());
         }
-
-
     }
 
     @Override
     public Result turnProdOut(Long id) {
         ProdInOut sourcePi = getMapper().selectByPrimaryKey(id);
-
         Integer count=0;
         double pdInqty=0, pdYqty=0;
-
-        ProdIODetailExample prodIODetailExample = new ProdIODetailExample();
-        ProdIODetailExample.Criteria cta = prodIODetailExample.createCriteria();
-        cta.andPd_piidEqualTo(id.intValue());
-        List<ProdIODetail> sourcePids =prodIODetailMapper.selectByExample(prodIODetailExample);
-
+        List<ProdIODetail> sourcePids =prodIODetailMapper.selectByFK(id);
         //检查从表
         for (ProdIODetail prodIODetail : sourcePids) {
             pdInqty = prodIODetail.getPd_inqty();
@@ -319,7 +302,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         targetPi.setPi_recorddate(new Date());
         targetPi.setPi_vendcode(sourcePi.getPi_vendcode());
         targetPi.setPi_vendname(sourcePi.getPi_vendname());
-        targetPi.setPi_puid(sourcePi.getId().intValue());
+        targetPi.setPi_puid(sourcePi.getPi_puid());
         targetPi.setPi_pucode(sourcePi.getPi_pucode());
         targetPi.setPi_inid(sourcePi.getId());
 
@@ -329,35 +312,31 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         getMapper().insertSelective(targetPi);
         //插入验退单从表
         long pi_id = targetPi.getId();
-
          for (int i = 0;i<sourcePids.size();i++){
              ProdIODetail sourcePid = sourcePids.get(i);
              ProdIODetail targetPid = new ProdIODetail();
-             targetPid.setPd_piid(pi_id);
-             targetPid.setPd_inoutno(piInoutno);
-             targetPid.setPd_piclass("采购验退单");
-             targetPid.setPd_pdno(i);
-             targetPid.setPd_orderid(sourcePid.getPd_orderid());
-             targetPid.setPd_ordercode(sourcePid.getPd_ordercode());
-             targetPid.setPd_orderdetno(sourcePid.getPd_orderdetno());
-             targetPid.setPd_orderprice(sourcePid.getPd_orderprice());
-             targetPid.setPd_prodid(sourcePid.getPd_prodid());
-             targetPid.setPd_prodcode(sourcePid.getPd_prodcode());
-             targetPid.setPd_ioid(sourcePid.getId());
-             //公司id
-             targetPid.setCompanyId(sourcePid.getCompanyId());
-
-             //本次转单数
-             targetPid.setPd_outqty(sourcePid.getPd_inqty()-sourcePid.getPd_yqty());
-             prodIODetailMapper.insertSelective(targetPid);
-
-             //更新已转数
-             sourcePid.setPd_yqty(sourcePid.getPd_inqty());
-
-             prodIODetailMapper.updateByPrimaryKeySelective(sourcePid);
-
+             if(sourcePid.getPd_inqty()-sourcePid.getPd_yqty()>0){
+                 targetPid.setPd_piid(pi_id);
+                 targetPid.setPd_inoutno(piInoutno);
+                 targetPid.setPd_piclass("采购验退单");
+                 targetPid.setPd_pdno(i);
+                 targetPid.setPd_orderid(sourcePid.getPd_orderid());
+                 targetPid.setPd_ordercode(sourcePid.getPd_ordercode());
+                 targetPid.setPd_orderdetno(sourcePid.getPd_orderdetno());
+                 targetPid.setPd_orderprice(sourcePid.getPd_orderprice());
+                 targetPid.setPd_prodid(sourcePid.getPd_prodid());
+                 targetPid.setPd_prodcode(sourcePid.getPd_prodcode());
+                 targetPid.setPd_ioid(sourcePid.getId());
+                 //公司id
+                 targetPid.setCompanyId(sourcePid.getCompanyId());
+                 //本次转单数
+                 targetPid.setPd_outqty(sourcePid.getPd_inqty()-sourcePid.getPd_yqty());
+                 prodIODetailMapper.insertSelective(targetPid);
+                 //更新已转数
+                 sourcePid.setPd_yqty(sourcePid.getPd_inqty());
+                 prodIODetailMapper.updateByPrimaryKeySelective(sourcePid);
+             }
          }
-
         return Result.success();
     }
 

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

@@ -307,6 +307,9 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         if ("TURNIN".equals(acceptstatus)){
             return Result.error(ExceptionCode.TURNIN_EXIST);
         }
+        if ("CLOSED".equals(acceptstatus)){
+            return Result.error(ExceptionCode.CLOSED_EXIST);
+        }
 
         List<PurchaseDetail> purchaseDetails = purchasedetailMapper.selectByFK(id);
 
@@ -349,30 +352,27 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         for (int i=0;i<purchaseDetails.size();i++){
             PurchaseDetail purchaseDetail =purchaseDetails.get(i);
             ProdIODetail prodIODetail = new ProdIODetail();
-            prodIODetail.setPd_piid(pi_id);
-            prodIODetail.setPd_inoutno(piInoutno);
-            prodIODetail.setPd_piclass("采购验收单");
-            prodIODetail.setPd_pdno(i);
-            prodIODetail.setPd_orderid(purchaseDetail.getId().intValue());
-            prodIODetail.setPd_ordercode(purchase.getPu_code());
-            prodIODetail.setPd_orderdetno(purchaseDetail.getPd_detno());
-            prodIODetail.setPd_orderprice(purchaseDetail.getPd_price());
-            prodIODetail.setPd_prodid(purchaseDetail.getPd_prodid());
-            prodIODetail.setPd_prodcode(purchaseDetail.getPd_prodcode());
-            //公司id
-            prodIODetail.setCompanyId(purchaseDetail.getCompanyId());
-
-            //本次转单数
-            prodIODetail.setPd_inqty((int) (purchaseDetail.getPd_qty()-purchaseDetail.getPd_yqty()));
-            prodIODetailMapper.insertSelective(prodIODetail);
-
-            //更新已转数
-            purchaseDetail.setPd_yqty(purchaseDetail.getPd_qty());
-//            getMapper().updateByPrimaryKeySelective(purchase);
-            purchasedetailMapper.updateByPrimaryKeySelective(purchaseDetail);
-
+            if ((int) (purchaseDetail.getPd_qty()-purchaseDetail.getPd_yqty())>0){
+                prodIODetail.setPd_piid(pi_id);
+                prodIODetail.setPd_inoutno(piInoutno);
+                prodIODetail.setPd_piclass("采购验收单");
+                prodIODetail.setPd_pdno(i);
+                prodIODetail.setPd_orderid(purchaseDetail.getId().intValue());
+                prodIODetail.setPd_ordercode(purchase.getPu_code());
+                prodIODetail.setPd_orderdetno(purchaseDetail.getPd_detno());
+                prodIODetail.setPd_orderprice(purchaseDetail.getPd_price());
+                prodIODetail.setPd_prodid(purchaseDetail.getPd_prodid());
+                prodIODetail.setPd_prodcode(purchaseDetail.getPd_prodcode());
+                //公司id
+                prodIODetail.setCompanyId(purchaseDetail.getCompanyId());
+                //本次转单数
+                prodIODetail.setPd_inqty((int) (purchaseDetail.getPd_qty()-purchaseDetail.getPd_yqty()));
+                prodIODetailMapper.insertSelective(prodIODetail);
+                //更新已转数
+                purchaseDetail.setPd_yqty(purchaseDetail.getPd_qty());
+                purchasedetailMapper.updateByPrimaryKeySelective(purchaseDetail);
+            }
         }
-
         //更新主表入库状态
         purchase.setPu_acceptstatus("已入库");
         purchase.setPu_acceptstatuscode("TURNIN");

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

@@ -41,6 +41,36 @@
     <result column="pd_ym" jdbcType="INTEGER" property="pd_ym" />
     <result column="pd_yqty" jdbcType="INTEGER" property="pd_yqty" />
     <result column="pd_ioid" jdbcType="INTEGER" property="pd_ioid" />
+    <association property="product" javaType="com.usoftchina.saas.document.entities.Product">
+      <id column="pr_id" property="id"/>
+      <result column="pr_code" property="pr_code"/>
+      <result column="pr_detail" property="pr_detail"/>
+      <result column="pr_spec" property="pr_spec"/>
+      <result column="pr_unit" property="pr_unit"/>
+      <result column="pr_kind" property="pr_kind"/>
+      <result column="pr_orispeccode" property="pr_orispeccode"/>
+      <result column="pr_whid" property="pr_whid"/>
+      <result column="pr_whcode" property="pr_whcode"/>
+      <result column="pr_whname" property="pr_whname"/>
+      <result column="pr_zxbzs" property="pr_zxbzs"/>
+      <result column="pr_leadtime" property="pr_leadtime"/>
+      <result column="pr_brand" property="pr_brand"/>
+      <result column="pr_standardprice" property="pr_standardprice"/>
+      <result column="pr_purcprice" property="pr_purcprice"/>
+      <result column="pr_saleprice" property="pr_saleprice"/>
+      <result column="pr_vendid" property="pr_vendid"/>
+      <result column="pr_vendname" property="pr_vendname"/>
+      <result column="pr_vendcode" property="pr_vendcode"/>
+      <result column="pr_docdate" property="pr_docdate"/>
+      <result column="pr_recordmanid" property="pr_recordmanid"/>
+      <result column="pr_recordman" property="pr_recordman"/>
+      <result column="pr_status" property="pr_status"/>
+      <result column="pr_statuscode" property="pr_statuscode"/>
+      <result column="pr_text1" property="pr_text1"/>
+      <result column="pr_text2" property="pr_text2"/>
+      <result column="pr_text3" property="pr_text3"/>
+      <result column="pr_text4" property="pr_text4"/>
+    </association>
   </resultMap>
   <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.usoftchina.saas.purchase.po.ProdIODetail">
     <result column="pd_remark" jdbcType="LONGVARCHAR" property="pd_remark" />
@@ -131,11 +161,8 @@
   </select>
   <select id="selectByExample" parameterType="com.usoftchina.saas.purchase.po.ProdIODetailExample" resultMap="BaseResultMap">
     select
-    <if test="distinct">
-      distinct
-    </if>
-    <include refid="Base_Column_List" />
-    from prodiodetail
+        *
+    from prodiodetail a left join product b on a.pd_prodid = b.pr_id and a.companyid = b.companyid
     <if test="_parameter != null">
       <include refid="Example_Where_Clause" />
     </if>
@@ -198,7 +225,6 @@
     </selectKey>
     insert into prodiodetail
     <trim prefix="(" suffix=")" suffixOverrides=",">
-
       <if test="pd_piid != null">
         pd_piid,
       </if>
@@ -316,11 +342,8 @@
       <if test="pd_ioid != null">
         pd_ioid,
       </if>
-
-
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
-
       <if test="pd_piid != null">
         #{pd_piid,jdbcType=INTEGER},
       </if>
@@ -901,58 +924,386 @@
       )
     </foreach>
   </insert>
+
+  <insert id="batchInsert1" parameterType="java.util.List" >
+    <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=INTEGER},
+        </if>
+        <if test="item.pd_outqty != null">
+          #{item.pd_outqty,jdbcType=INTEGER},
+        </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=INTEGER},
+        </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>
+
+    </foreach>
+  </insert>
+
+
+
+
+
+
+
+
+
   <update id="batchUpdate" parameterType="com.usoftchina.saas.purchase.po.ProdIODetail" >
     <foreach collection="list" item="item" index="index" open="" close="" separator=";">
       update prodiodetail <set>
-      pd_piid = #{item.pd_piid},
-      pd_inoutno = #{item.pd_inoutno},
-      pd_piclass = #{item.pd_piclass},
-      pd_pdno = #{item.pd_pdno},
-      pd_ordercode = #{item.pd_orderdetno},
-      pd_orderdetno = #{item.pd_unit},
-      pd_prodid = #{item.pd_prodid},
-      pd_prodcode = #{item.pd_prodcode},
-      pd_unit = #{item.pd_unit},
-      pd_inqty = #{item.pd_inqty},
-      pd_outqty = #{item.pd_outqty},
-      pd_orderprice = #{item.pd_orderprice},
-      pd_sendprice = #{item.pd_sendprice},
-      pd_price = #{item.pd_price},
-      pd_total = #{item.pd_total},
-      pd_taxrate= #{item.pd_taxrate},
-      pd_netprice= #{item.pd_netprice},
-      pd_nettotal= #{item.pd_nettotal},
-      pd_whid= #{item.pd_whid},
-      pd_whcode= #{item.pd_whcode},
-      pd_whname= #{item.pd_whname},
-      pd_inwhid= #{item.pd_inwhid},
-      pd_inwhcode= #{item.pd_inwhcode},
-      pd_inwhname= #{item.pd_inwhname},
-      pd_orderid= #{item.pd_orderid},
-      pd_sdid= #{item.pd_sdid},
-      pd_status= #{item.pd_status},
-      pd_remark= #{item.pd_remark},
-      companyId = #{item.companyId},
-      updaterId = #{item.updaterId},
-      updateTime = #{item.updateTime},
+      <if test="item.pd_piid !=null">
+        pd_piid = #{item.pd_piid},
+      </if>
+      <if test="item.pd_inoutno !=null">
+        pd_inoutno = #{item.pd_inoutno},
+      </if>
+      <if test="item.pd_piclass !=null">
+        pd_piclass = #{item.pd_piclass},
+      </if>
+      <if test="item.pd_pdno !=null">
+        pd_pdno = #{item.pd_pdno},
+      </if>
+      <if test="item.pd_ordercode !=null">
+        pd_ordercode = #{item.pd_ordercode},
+      </if>
+      <if test="item.pd_orderdetno !=null">
+        pd_orderdetno = #{item.pd_orderdetno},
+      </if>
+      <if test="item.pd_prodid !=null">
+        pd_prodid = #{item.pd_prodid},
+      </if>
+      <if test="item.pd_prodcode !=null">
+        pd_prodcode = #{item.pd_prodcode},
+      </if>
+      <if test="item.pd_unit !=null">
+        pd_unit = #{item.pd_unit},
+      </if>
+      <if test="item.pd_inqty !=null">
+        pd_inqty = #{item.pd_inqty},
+      </if>
+      <if test="item.pd_outqty !=null">
+        pd_outqty = #{item.pd_outqty},
+      </if>
+      <if test="item.pd_orderprice !=null">
+        pd_orderprice = #{item.pd_orderprice},
+      </if>
+      <if test="item.pd_sendprice !=null">
+        pd_sendprice = #{item.pd_sendprice},
+      </if>
+      <if test="item.pd_price !=null">
+        pd_price = #{item.pd_price},
+      </if>
+      <if test="item.pd_total !=null">
+        pd_total = #{item.pd_total},
+      </if>
+      <if test="item.pd_taxrate !=null">
+        pd_taxrate = #{item.pd_taxrate},
+      </if>
+      <if test="item.pd_netprice !=null">
+        pd_netprice = #{item.pd_netprice},
+      </if>
+      <if test="item.pd_nettotal !=null">
+        pd_nettotal = #{item.pd_nettotal},
+      </if>
+      <if test="item.pd_whid !=null">
+        pd_whid = #{item.pd_whid},
+      </if>
+      <if test="item.pd_whcode !=null">
+        pd_whcode = #{item.pd_whcode},
+      </if>
+      <if test="item.pd_whname !=null">
+        pd_whname = #{item.pd_whname},
+      </if>
+      <if test="item.pd_inwhid !=null">
+        pd_inwhid = #{item.pd_inwhid},
+      </if>
+      <if test="item.pd_inwhcode !=null">
+        pd_inwhcode = #{item.pd_inwhcode},
+      </if>
+      <if test="item.pd_inwhname !=null">
+        pd_inwhname = #{item.pd_inwhname},
+      </if>
+      <if test="item.pd_orderid !=null">
+        pd_orderid = #{item.pd_orderid},
+      </if>
+      <if test="item.pd_sdid !=null">
+        pd_sdid = #{item.pd_sdid},
+      </if>
+      <if test="item.pd_status !=null">
+        pd_status = #{item.pd_status},
+      </if>
+      <if test="item.pd_remark !=null">
+        pd_remark = #{item.pd_remark},
+      </if>
+      <if test="item.companyId!=null">
+        companyId = #{item.companyId},
+      </if>
+      <if test="item.updaterId!=null">
+        updaterId = #{item.updaterId},
+      </if>
+      <if test="item.updateTime!=null">
+        updateTime = #{item.updateTime},
+      </if>
       pd_text1 = #{item.pd_text1},
       pd_text2 = #{item.pd_text2},
       pd_text3 = #{item.pd_text3},
       pd_text4 = #{item.pd_text4},
       pd_text5 = #{item.pd_text5},
-      pd_ym = #{item.pd_ym},
-      pd_yqty = #{item.pd_yqty}
+      <if test="item.pd_ym!=null">
+        pd_ym = #{item.pd_ym},
+      </if>
+      <if test="item.pd_yqty!=null">
+        pd_yqty = #{item.pd_yqty},
+      </if>
     </set>
       where PD_ID = #{item.id,jdbcType=INTEGER}
     </foreach>
   </update>
 
-  <update id="updatePurchaseYqty" parameterType="java.lang.Long">
+  <update id="updatePurchaseYqty" parameterType="java.lang.Integer">
 
 update prodiodetail a
-set a.pd_yqty =ifnull((select  b.pd_outqty  from  (select pd_outqty,pd_ioid from prodiodetail where pd_piclass='采购验退单') b where ifnull(b.pd_ioid ,0)= a.pd_id ),0)
-where a.pd_piid = #{id,jdbcType=INTEGER}
+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>
 
 
+  <select id="selectByFK" parameterType="long" resultMap="BaseResultMap">
+    select * from prodiodetail a left join product b on b.pr_id= a.pd_prodid and a.companyid = b.companyid
+    where pd_piid=#{id} order by pd_pdno
+  </select>
+
+
+
 </mapper>

+ 4 - 1
framework/core/src/main/java/com/usoftchina/saas/exception/ExceptionCode.java

@@ -43,7 +43,10 @@ public enum ExceptionCode implements BaseExceptionCode {
     FILE_FOLDER_NULL(55502, "文件夹为空"),
 
     TURNIN_EXIST(60000,"已入库"),
-    TURNINNUM_NOT_EXIST(60001,"无可转数")
+    TURNINNUM_NOT_EXIST(60001,"无可转数"),
+
+    CLOSED_EXIST(60002,"已关闭")
+
     ;
 
     private int code;

+ 7 - 0
frontend/saas-web/app/model/document/product.js

@@ -0,0 +1,7 @@
+Ext.define('saas.model.document.product', {
+    extend: 'saas.model.Base',
+    fields: [
+        { name: 'pr_detail', type: 'string' },
+        { name: 'pr_unit', type: 'string' }
+    ]
+});

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

@@ -0,0 +1,18 @@
+Ext.define('saas.model.purchase.purchasedetail', {
+    extend: 'saas.model.Base',
+
+    fields: [
+        { name: 'pd_detno', type: 'int' },
+        { name: 'id', type: 'int' },
+        { name: 'pd_prodcode', type: 'string' },
+        { name: 'pd_qty', type: 'int' },
+        { name: 'pd_yqty', type: 'int' },
+        { name: 'pd_price', type: 'float' },
+        { name: 'pd_taxrate', type: 'float' },
+        { name: 'pd_total', type: 'float' },
+        { name: 'pd_delivery', type: 'date' },
+        { name: 'pd_taxtotal', type: 'float' }
+    ],
+    //一对一映射
+    associations: [{ type: 'hasOne', model: 'saas.model.document.product', associationKey: 'product'}]
+});

+ 2 - 14
frontend/saas-web/app/util/FormUtil.js

@@ -69,23 +69,11 @@ Ext.define('saas.util.FormUtil', {
                             formModel.set('_detailBindFields', cnames);
                             item.bind = {
                                 store: '{_detailStore}'
-                            };       
+                            };     
                             formModel.set('_detailStore', Ext.create('Ext.data.Store', {
-                                fields: item.columns ? item.columns.filter(function(c) {
-                                    return !!c.dataIndex;
-                                }).map(function(c) {
-                                    var type = "string";
-                                    if(c.xtype!=""){
-                                        if(c.xtype=="numbercolumn"){
-                                            type = "float"
-                                        }
-                                    }
-                                    return {name: c.dataIndex,type:type};
-                                }) : [],
+                                model:item.storeModel,
                                 data: []
                             }));
-
-
                         }
                     });
                 }

+ 4 - 4
frontend/saas-web/app/util/QueryUtil.js

@@ -25,15 +25,15 @@ Ext.define('saas.util.QueryUtil', {
             }
         }
         if(Mode=="MAIN"){
-            grid._Mode = Mode;
-            grid.reconfigure(grid.store, grid._baseColumn);
+            grid.Mode = Mode;
+            grid.reconfigure(grid.store, grid.baseColumn);
             grid.store.loadPage(1);
         }else{
             //若明细字段含明细字段注意切换数据源 grid.reconfigure(store, columns);
             //关联viewName = 关联viewName+"-RelativeGrid" selModel
             //grid.selModel = '';
-            grid._Mode = Mode;
-            grid.reconfigure(grid.store, grid._relativeColumn);
+            grid.Mode = Mode;
+            grid.reconfigure(grid.store, grid.relativeColumn);
             grid.store.loadPage(1);
         }
     },

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

@@ -1,7 +1,6 @@
 Ext.define('saas.view.core.dbfind.DbfindGridPanel', {
     extend: 'Ext.grid.Panel',
     xtype: 'dbfindgridpanel',
-    GridUtil: Ext.create('saas.util.GridUtil'),
     BaseUtil: Ext.create('saas.util.BaseUtil'),
     dataUrl: '',
     dbSearchFields: [],
@@ -105,6 +104,7 @@ Ext.define('saas.view.core.dbfind.DbfindGridPanel', {
         },
         itemClick: function(view,record) {
             var me = this;
+            debugger;
             var dbfinds = me.dbfinds;
             if(dbfinds&&dbfinds.length>0){
                 if(me.belong=='grid'){

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

@@ -6,8 +6,6 @@ Ext.define('saas.view.core.dbfind.DbfindTrigger', {
     displayField: 'dispaly',
     valueField: 'value',
     triggerCls: 'x-form-search-trigger',
-    GridUtil: Ext.create('saas.util.GridUtil'),
-    BaseUtil: Ext.create('saas.util.BaseUtil'),
     minChars:1, // 设置用户输入字符多少时触发查询
     tpl: '',
     enableKeyEvents:true,
@@ -99,20 +97,25 @@ Ext.define('saas.view.core.dbfind.DbfindTrigger', {
     },
     onTriggerClick:function(f){
         //判断dbfindtrigger归属
-        var form = f.judge(f);//form
-        var win = form.getController().getView().add(Ext.create('Ext.window.Window', {   
+        // var form = f.judge(f);//form
+        var panel = f.up('core-tab-panel');
+        var panelEl = panel.getEl();
+        var box = panelEl.getBox();
+        var height = box.height;
+        var width = box.width;
+        var win = panel.add(Ext.create('Ext.window.Window', {   
             trigger:f,
             belong:f.ownerCt,  
             modal:true,
-            height: '80%',
-            width: '80%',
+            height: height * 0.8,
+            width: width * 0.8,
             title: '查找',
             scrollable: true,
             bodyPadding: 10,
             constrain: true,
             closable: true,
             layout:'fit',
-            renderTo:Ext.getCmp('main-tab-panel').getActiveTab().getEl(),
+            renderTo:panel.getEl(),
             items:[{
                 xtype:'dbfindgridpanel',
                 columns: f.dbColumns,

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

@@ -42,13 +42,8 @@ Ext.define('saas.view.core.form.FormPanelController', {
         var code = form.getForm().findField(form._codeField);
         if(id&&id.value!=0){
             me.BaseUtil.request({
-                url: form._deleteUrl,
-                params:{
-                    id:id.value,
-                    code:code.value,
-                    namne:form.caller
-                },
-                method: 'POST',
+                url: form._deleteUrl+id.value,
+                method: 'GET',
             })
             .then(function(res) {
                 var localJson = new Ext.decode(res.responseText);

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

@@ -7,19 +7,21 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
     GridUtil: Ext.create('saas.util.GridUtil'),
     BaseUtil: Ext.create('saas.util.BaseUtil'),
     //字段属性
-    _baseColumn: [],
-    _relativeColumn: [],
-    _idField:'',
-    _codeField:'',
-    _title:'',
-    _addXtype:'',
-    _baseVastUrl:'',
+    baseColumn: [],
+    relativeColumn: [],
+
+    idField:'',
+    codeField:'',
+    addTitle:'',
+    addXtype:'',
+    baseVastUrl:'',
+    queryMode: 'MAIN',
+    defaultCondition: '',
 
     //基础属性
     border: 1,
     anchor: '100% 70%',
     loadMask: true,
-    frame: true,
     showIndex: true,
     columnWidth: 1.0,
     showRowNum: true,
@@ -31,12 +33,12 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
         Ext.apply(me, {
             store: Ext.create('Ext.data.Store', {
                 fields: me.getFields(),
-                autoLoad: true,
+                autoLoad: false,
                 pageSize: 15,
                 data: [],
                 proxy: {
                     type: 'ajax',
-                    url: me._baseVastUrl+'list',
+                    url: me.baseVastUrl+'list',
                     actionMethods: {
                         read: 'GET'
                     },
@@ -48,29 +50,22 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
                 },
                 listeners: {
                     beforeload: function (store, op) {
-                        var condition = '',
-                        queryForm = me.ownerCt.down('form'),
-                        condition = me.QueryUtil.getFormCondition(queryForm),
-                        mode = me._Mode,
-                        defaultCondition = me._defaultCondition;
-                        if(defaultCondition){
-                            if (Ext.isEmpty(condition)) {
-                                condition = defaultCondition + ' and '+condition;
-                            }else{
-                                condition = defaultCondition;
-                            }
-                        }
-                        if (Ext.isEmpty(condition)) {
-                            condition = " 1=1 ";
-                        }
-                        if(!mode){
-                            mode='MAIN';
+                        var queryPanel = me.up('core-query-querypanel'),
+                        condition = queryPanel.getConditions(),
+                        defaultCondition = me.defaultCondition,
+                        mode = queryPanel.getQueryMode();
+
+                        if(defaultCondition) {
+                            condition.push({
+                                type: 'condition',
+                                value: defaultCondition
+                            });
                         }
                         Ext.apply(store.proxy.extraParams, {
                             number: op._page,
                             size: store.pageSize,
                             mode:mode,
-                            keyword: condition
+                            condition: JSON.stringify(condition)
                         });
     
                     }
@@ -79,6 +74,9 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
             dockedItems: [{
                 xtype: 'toolbar',
                 dock: 'top',
+                style: {
+                    borderTop: 'none'
+                },
                 defaults: { // defaults 将会应用所有的子组件上,而不是父容器
                     listeners: {
                         'mouseover':function(){
@@ -185,15 +183,15 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
         itemdblClick: function (tableView, record, item, index, e, eOpts) {
             var grid = tableView.up('grid'),
                 mainTab = Ext.getCmp('main-tab-panel'),
-                idValue = record.get(grid._idField),
-                codeValue = record.get(grid._codeField),
+                idValue = record.get(grid.idField),
+                codeValue = record.get(grid.codeField),
                 id = grid.xtype + idValue;
                 existingItem = mainTab.down('[id=' + id + ']');
             if (!existingItem) {
                 var form = {
-                    xtype:grid._addXtype,
+                    xtype:grid.addXtype,
                     id,
-                    title:grid._title+"("+codeValue+")",
+                    title:grid.addTitle+"("+codeValue+")",
                     initId:idValue
                 };
                 mainTab.setActiveTab(mainTab.add(form));
@@ -215,9 +213,9 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
             existingItem = mainTab.down('[id=' + id + ']');
         if (!existingItem) {
             var form = {
-                xtype:grid._addXtype,
+                xtype:grid.addXtype,
                 id,
-                title:'新增'+grid._title
+                title:'新增'+grid.addTitle
             };
             mainTab.setActiveTab(mainTab.add(form));
         }
@@ -256,7 +254,7 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
         if(data&&data.length>0){
             var params = JSON.stringify({baseDTOs:data});
             me.BaseUtil.request({
-                    url: me._baseVastUrl+type,
+                    url: me.baseVastUrl+type,
                     params: params,
                     method: 'POST',
                     async:false
@@ -281,13 +279,13 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
             items = me.selModel.getSelection(),
             data = new Array() ;
             Ext.each(items, function(item, index){
-                if(!Ext.isEmpty(item.data[me._idField])&&!Ext.isEmpty(item.data[me._codeField])){
+                if(!Ext.isEmpty(item.data[me.idField])&&!Ext.isEmpty(item.data[me.codeField])){
                     var o = new Object();
-                    if(me._idField){
-                        o['id'] = item.data[me._idField];
+                    if(me.idField){
+                        o['id'] = item.data[me.idField];
                     }
-                    if(me._codeField){
-                        o['code'] = item.data[me._codeField];
+                    if(me.codeField){
+                        o['code'] = item.data[me.codeField];
                     }
                     data.push(o);
                 }

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

@@ -7,7 +7,10 @@ Ext.define('saas.view.core.query.QueryPanel', {
 
     layout: 'anchor',
     autoScroll: true,
+    border: 1,
+    bodyPadding: 5,
     margin: '0',
+    
     items: [{
         anchor: '100% 30%',
         reference: 'queryform',
@@ -20,36 +23,217 @@ Ext.define('saas.view.core.query.QueryPanel', {
 
     initComponent: function () {
         var me = this;
-        me.setQueryItems(me.queryFormItems);
+        me.setQueryFormItems();
         me.setQuertGridConfigs();
         me.callParent(arguments);
     },
 
     getQueryForm: function () {
         var me = this,
-            refs = me.getReferences();
+        queryForm = me.items[0];
 
-        return refs['queryform'];
+        return queryForm;
     },
 
     getQueryGrid: function () {
         var me = this,
-            refs = me.getReferences();
+        queryGrid = me.items[1];
 
-        return refs['querygrid'];
+        return queryGrid;
     },
 
-    setQueryItems: function (items) {
+    /**
+     * 解析查询字段并处理一些初始化配置
+     */
+    setQueryFormItems: function () {
         var me = this,
-        queryForm = me.items[0];
+        items = me.queryFormItems,
+        queryForm = me.getQueryForm(),
+        viewModel = me.getViewModel();
+
+        Ext.Array.each(items, function(item) {
+            var bind = item.bind,
+            name = item.name,
+            ignore = item.ignore,
+            defaultValue = item.defaultValue,
+            showDetail = item.showDetail,
+            shwoDetailFunc = item.shwoDetailFunc;
+
+            // 设置model绑定
+            if(!ignore) {
+                if(bind) {
+                    if(!Ext.isString(bind)) {
+                        bind = name;
+                        Ext.apply(bind, {
+                            value: '{form.' + bind + '}'
+                        });
+                    }else {
+                        bind = bind.replace(/[{|}]/g, '');
+                        item.bind = '{form.' + bind + '}';
+                    }
+                }else {
+                    bind = name;
+                    item.bind = '{form.' + bind + '}';
+                }
+                // 设置默认值
+                if(defaultValue) {
+                    viewModel.set('form.' + bind, defaultValue);
+                }
+                // 设置关联列表
+                if(showDetail) {
+                    var fields = viewModel.get('showDetailFields');
+                    fields.push(bind);
+                    viewModel.set('showDetailFields', fields);
+                }
+            }
+        });
+
         queryForm.items = items;
     },
 
     setQuertGridConfigs: function() {
         var me = this,
         queryGrid = me.items[1];
-        me.queryGridConfig['columns']=me.queryGridConfig._baseColumn || [];
+        me.queryGridConfig['columns']=me.queryGridConfig.baseColumn || [];
         Ext.apply(queryGrid,me.queryGridConfig);
+    },
+
+    /**
+     * 获得过滤条件
+     */
+    getConditions: function() {
+        var me = this,
+        formItems = me.queryFormItems,
+        viewModel = me.getViewModel(),
+        viewModelData = viewModel.getData(),
+        bindItems = viewModelData['form'],
+        condition,
+        conditions = [];
+
+        for(k in bindItems) {
+            var item = Ext.Array.findBy(formItems, function(i) {
+                return i.name == k;
+            });
+            var field = item.name,
+            func = item.getCondition,
+            value = bindItems[k],
+            condition;
+
+            if(typeof func == 'function') {
+                condition = {
+                    type: 'condition',
+                    value: func(value)
+                }
+            }else {
+                var xtype = item.xtype || 'textfield',
+                type = item.fieldType || me.getDefaultFieldType(xtype),
+                operation = item.operation || me.getDefaultFieldOperation(type),
+                conditionValue = me.getConditionValue(xtype, value);
+    
+                if(!conditionValue) {
+                    continue;
+                }
+                condition = {
+                    type: type,
+                    field: field,
+                    operation: operation,
+                    value: conditionValue
+                }
+            }
+            conditions.push(condition);
+        }
+
+        return conditions;
+    },
+
+    getDefaultFieldType: function(xtype) {
+        var type;
+
+        if(Ext.Array.contains(['numberfield'], xtype)) {
+            type = 'number';
+        }else if(Ext.Array.contains(['datefield', 'condatefield'], xtype)) {
+            type = 'date';
+        }else if(Ext.Array.contains(['combobox', 'multicombo', 'combo', 'radiofield', 'radio'], xtype)) {
+            type = 'enum';
+        }else {
+            type = 'string';
+        }
+
+        return type;
+    },
+
+    getDefaultFieldOperation: function(type) {
+        var operation;
+
+        if(type == 'string') {
+            operation = 'like';
+        }else if(type == 'number') {
+            operation = '=';
+        }else if(type == 'date') {
+            operation = '=';
+        }else if(type == 'enum') {
+            operation = 'in';
+        }
+
+        return operation;
+    },
+
+    /**
+     * 处理部分字段值
+     */
+    getConditionValue: function(xtype, value) {
+        var conditionValue;
+        if(xtype == 'datefield') {
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d h:i:s');
+        }else if(xtype == 'condatefield') {
+            var from = value.from,
+            to = value.to;
+
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d h:i:s') + ',' + Ext.Date.format(new Date(to), 'Y-m-d h:i:s');
+        }else if(xtype == 'multicombo') {
+            conditionValue = value.map(function(v) {
+                return '\'' + v.value + '\'';
+            }).join(',');
+        }else {
+            conditionValue = value;
+        }
+
+        return conditionValue;
+    },
+
+    /**
+     * 获得是否是关联列表模式
+     */
+    getQueryMode: function() {
+        var me = this,
+        formItems = me.queryFormItems,
+        viewModel = me.getViewModel(),
+        viewModelData = viewModel.getData(),
+        formData = viewModelData['form'],
+        showDetailFields = viewModelData['showDetailFields'],
+        detailModel;
+
+        detailModel = !!Ext.Array.findBy(showDetailFields, function(name) {
+            var item = Ext.Array.findBy(formItems, function(i) {
+                var b = i.bind, bname;
+                if(!Ext.isString(b)) {
+                    bname = b.value.replace(/[{|}]/g, '').split('.')[1];
+                }else {
+                    bname = b.replace(/[{|}]/g, '').split('.')[1];
+                }
+                return bname == name;
+            });
+            if(!item) {
+                return false;
+            }
+            var isShowDetail = item.isShowDetail || function(value) {
+                return !!value;
+            }
+            var value = formData[name];
+            return isShowDetail(value);
+        });
+
+        return detailModel ? 'DETAIL' : 'MAIN';
     }
 
 });

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

@@ -28,8 +28,9 @@ Ext.define('saas.view.core.query.QueryPanelController', {
     },
     onQuery: function (btn) {
         var me = this,
-        queryForm = btn.ownerCt.ownerCt,
-        grid = queryForm.ownerCt.down('grid');
-        grid.QueryUtil.turnRelativeGrid(grid,queryForm);
+        queryPanel = me.getView(),
+        queryGrid = queryPanel.down('core-query-querygridpanel');
+
+        queryGrid.store.loadPage(1);
     }
 });

+ 5 - 0
frontend/saas-web/app/view/core/query/QueryPanelModel.js

@@ -1,4 +1,9 @@
 Ext.define('saas.view.core.query.QueryPanelModel', {
     extend: 'Ext.app.ViewModel',
     alias: 'viewmodel.core-query-querypanel',
+
+    data: {
+        form: {}, // 查询字段记录
+        showDetailFields: [], // 关联列表切换字段
+    }
 });

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

@@ -43,7 +43,7 @@ Ext.define('KitchenSink.view.binding.ChildForm', {
         vendorkind:{
             items:[{
                 xtype:'hidden',
-                name:'vk_id'
+                name:'id'
             },{
                 xtype:'textfield',
                 name:'vk_name',

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

@@ -83,9 +83,10 @@ Ext.define('saas.view.document.kind.Kind', {
                 dataIndex: 'vk_name',
                 flex: 1
             }],
-            keyField:'vk_id',
+            keyField:'id',
             dataField:'vk_name',
-            reqUrl:'http://192.168.253.41:9480/api/document/vendorkind/save'
+            reqUrl:'http://192.168.253.41:9480/api/document/vendorkind/save',
+            delUrl:'http://192.168.253.41:9480/api/document/vendorkind/delete'
         },
         productkind:{
             columns: [{

+ 19 - 1
frontend/saas-web/app/view/document/kind/KindController.js

@@ -4,6 +4,9 @@
 Ext.define('saas.view.document.kind.KindController', {
     extend: 'Ext.app.ViewController',
     alias: 'controller.document-kind',
+    //工具类
+    FormUtil: Ext.create('saas.util.FormUtil'),
+    BaseUtil: Ext.create('saas.util.BaseUtil'),
     loadDefualt:function(grid){
         var me=this,
             view = me.getView(),
@@ -70,7 +73,22 @@ Ext.define('saas.view.document.kind.KindController', {
             dataKind=me.getViewModel().getData()['dataKind'].value;
         rec = grid.getStore().getAt(row);
         var keyV=rec.get(view.etc[dataKind].keyField);
-        alert('删除ID:'+keyV);
+        //删除接口
+        this.BaseUtil.request({
+            url: view.etc[dataKind].delUrl,
+            params: {id:keyV},
+            method: 'POST'
+        })
+        .then(function(res) {
+            var localJson = new Ext.decode(res.responseText);
+            if(localJson.success){
+                Ext.Msg.alert('提示','删除成功');
+                grid.store.load();
+            }
+        })
+        .catch(function() {
+            Ext.Msg.alert('提示','删除失败');
+        });
     },
     createDialog: function(dataKind,record) {
         var view = this.getView();var me=this;

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

@@ -26,7 +26,7 @@ Ext.define('saas.view.document.kind.KindModel', {
         },
         vendorkind:{
             fields:[
-                {name: 'vk_id', type: 'int'},
+                {name: 'id', type: 'int'},
                 {name: 'vk_name',  type: 'string'}
             ],
             proxy: {

+ 0 - 552
frontend/saas-web/app/view/main/MainModel.js

@@ -8,557 +8,5 @@ Ext.define('saas.view.main.MainModel', {
 
     data: {
         
-    },
-
-    stores: {
-        navItems: {
-            type: 'tree',
-            root: {
-                expanded: true,
-                children: [
-                    {
-                        id: 'gh',
-                        text: '购货',
-                        iconCls: 'x-fa fa-shopping-basket',
-                        children: [
-                            {
-                                id: 'cgdj',
-                                text: '采购单据',
-                                children: [
-                                    {
-                                        id: 'purchaseOrder',
-                                        text: '采购单(维护界面)',
-                                        viewType:'purchase-purchase-formpanel',
-                                        leaf: true
-                                    },{
-                                        id: 'purchaseQuery',
-                                        text: '采购单查询',
-                                        viewType:'purchase-purchase-querypanel',
-                                        leaf: true
-                                    },{
-                                        id: 'purchaseInOrder',
-                                        text: '采购验收单(维护界面)',
-                                        viewType:'purchase-purchaseIn-formpanel',
-                                        leaf: true
-                                    },{
-                                        id: 'purchaseInQuery',
-                                        text: '采购验收单查询',
-                                        viewType:'purchase-purchaseIn-querypanel',
-                                        leaf: true
-                                    },{
-                                        id: 'purchaseOutOrder',
-                                        text: '采购验退单(维护界面)',
-                                        viewType:'purchase-purchaseOut-formpanel',
-                                        leaf: true
-                                    },{
-                                        id: 'purchaseOutQuery',
-                                        text: '采购验退单查询',
-                                        viewType:'purchase-purchaseOut-querypanel',
-                                        leaf: true
-                                    },
-                                    {
-                                        id: 'form1',
-                                        text: '测试-采购单明细界面',
-                                        viewType: 'test-order-formpanel',
-                                        leaf: true
-                                    }, {
-                                        id: 'myform',
-                                        text: '测试-明细界面',
-                                        viewType: 'test-myform-formpanel',
-                                        leaf: true
-                                    },
-                                    {
-                                        id: 'myquerytest',
-                                        text: '测试-采购单查询界面',
-                                        viewType: 'test-query-querypanel',
-                                        leaf: true
-                                    },
-                                    {
-                                        id: 'ghdd',
-                                        text: '购货订单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        id: 'ghd',
-                                        text: '购货单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        id: 'ghthd',
-                                        text: '购货退货单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        id: 'yxdgkb',
-                                        text: '以销定购看板',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        id: 'znbh',
-                                        text: '智能补货',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    }
-                                ]
-                            },
-                            {
-                                text: '采购报表',
-                                children: [
-                                    {
-                                        text: '采购订单跟踪表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '采购明细表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '采购汇总表(按商品)',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '采购汇总表(按供应商)',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '采购付款一览表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    }
-                                ]
-                            }
-                        ]
-                    },
-                    {
-                        text: '销货',
-                        iconCls: 'x-fa fa-shopping-cart',
-                        children: [
-                            {
-                                text: '销售单据',
-                                children: [
-                                    {
-                                        text: '销货订单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '销货单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '销货退货单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '原始单据',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '销售开票',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    }
-                                ]
-                            },
-                            {
-                                text: '销售报表',
-                                children: [
-                                    {
-                                        text: '销售订单跟踪表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '销售明细表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '销售汇总表(按商品)',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '销售汇总表(按客户)',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '销售汇总表(按销售人员)',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '销售收款一览表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '往来单位欠款表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '销售利润表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '销售排行表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    }
-                                ]
-                            }
-                        ]
-                    },
-                    {
-                        text: '仓库',
-                        iconCls: 'x-fa fa-archive',
-                        children: [
-                            {
-                                text: '仓库单据',
-                                children: [
-                                    {
-                                        text: '调拨单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '盘点',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '盘点记录',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '序列号盘点',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '其他入库单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '其他出库单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '成本调整单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '组装单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '拆卸单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    }
-                                ]
-                            },
-                            {
-                                text: '仓库报表',
-                                children: [
-                                    {
-                                        text: '商品库存余额表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '商品收发明细表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '商品收发汇总表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '序列号跟踪表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '序列号状态表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '批次保质期清单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '批次跟踪表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    }
-                                ]
-                            }
-                        ]
-                    },
-                    {
-                        text: '资金',
-                        iconCls: 'x-fa fa-credit-card',
-                        children: [
-                            {
-                                text: '资金单据',
-                                children: [
-                                    {
-                                        text: '收款单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '付款单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '核销单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '其他收入单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '其他支出单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '采购销售费用清单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '资金转账单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    }
-                                ]
-                            },
-                            {
-                                text: '资金报表',
-                                children: [
-                                    {
-                                        text: '现金银行报表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '应收账款明细表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '应付账款明细表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '客户对账单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '供应商对账单',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '其他收支明细表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '利润表',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    }
-                                ]
-                            }
-                        ]
-                    },
-                    {
-                        text: '资料',
-                        iconCls: 'x-fa fa-book',
-                        children: [
-                            {
-                                text: '基础资料',
-                                children: [
-                                    {
-                                        text: '客户资料',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '供应商管理',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '商品管理',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '仓库管理',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '职员管理',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '账户管理',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '发货地址管理',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '新手导航',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    }
-                                ]
-                            },
-                            {
-                                text: '辅助资料',
-                                children: [
-                                    {
-                                        text: '客户类别',
-                                        viewType: 'document-kind',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '供应商类别',
-                                        viewType: 'document-kind',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '商品类别',
-                                        viewType: 'document-kind',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '支出类别',
-                                        viewType: 'document-kind',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '收入类别',
-                                        viewType: 'document-kind',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '计量单位',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '结算方式',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '辅助属性',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '客户物料编码',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    },
-                                    {
-                                        text: '单据编码规则',
-                                        viewType: 'mainlist',
-                                        leaf: true
-                                    }
-                                ]
-                            }
-                        ]
-                    },
-                    {
-                        text: '设置',
-                        iconCls: 'x-fa fa-cog',
-                        children: [
-                            {
-                                text: '系统参数',
-                                viewType: 'mainlist',
-                                leaf: true
-                            },
-                            {
-                                text: '权限设置',
-                                viewType: 'mainlist',
-                                leaf: true
-                            },
-                            {
-                                text: '操作日志',
-                                viewType: 'mainlist',
-                                leaf: true
-                            },
-                            {
-                                text: '套打模板',
-                                viewType: 'mainlist',
-                                leaf: true
-                            },
-                            {
-                                text: '备份与恢复',
-                                viewType: 'mainlist',
-                                leaf: true
-                            },
-                            {
-                                text: '结账/反结账',
-                                viewType: 'mainlist',
-                                leaf: true
-                            },
-                            {
-                                text: '重算成本',
-                                viewType: 'mainlist',
-                                leaf: true
-                            },
-                            {
-                                text: '增值服务',
-                                viewType: 'mainlist',
-                                leaf: true
-                            }
-                        ]
-                    }
-                ]
-            }
-        }
     }
 });

+ 230 - 104
frontend/saas-web/app/view/main/Navigation.js

@@ -8,10 +8,10 @@ Ext.define('saas.view.main.Navigation', {
     navCollapsed: false,
     cls: 'x-navpanel',
 
-    initComponent: function() {
+    initComponent: function () {
         var me = this;
         var view = new Ext.DataView({
-            store : Ext.create('Ext.data.Store', {
+            store: Ext.create('Ext.data.Store', {
                 fields: ['text', 'iconCls'],
                 data: [{
                     text: '采购',
@@ -19,49 +19,176 @@ Ext.define('saas.view.main.Navigation', {
                     items: [{
                         text: '制单',
                         items: [{
-                            id: 'purchase',
-                            text: '采购单',
-                            addType:'purchase-purchase-formpanel',
-                            viewType: 'purchase-purchase-querypanel'
+                                id: 'purchase',
+                                text: '采购单',
+                                addType: 'purchase-purchase-formpanel',
+                                viewType: 'purchase-purchase-querypanel'
+                            }, {
+                                id: 'purchaseIn',
+                                text: '采购验收单',
+                                addType: 'purchase-purchaseIn-formpanel',
+                                viewType: 'purchase-purchaseIn-querypanel'
+                            }, {
+                                id: 'purchaseOut',
+                                text: '采购验退单',
+                                addType: 'purchase-purchaseOut-formpanel',
+                                viewType: 'purchase-purchaseOut-querypanel'
+                            }, {
+                                id: 'inquiry',
+                                text: '采购询价单',
+                                formType: 'purchase-inquiry-formpanel',
+                                queryType: 'purchase-inquiry-querypanel'
+                            }
+                            // ,{
+                            //     id: 'form1',
+                            //     text: '测试-采购单明细界面',
+                            //     formType: 'test-order-formpanel'
+                            // }, {
+                            //     id: 'myform',
+                            //     text: '测试-明细界面',
+                            //     formType: 'test-myform-formpanel'
+                            // }, {
+                            //     id: 'myquerytest',
+                            //     text: '测试-采购单查询界面',
+                            //     queryType: 'test-query-querypanel',
+                            // }
+                        ]
+                    }, {
+                        text: '报表',
+                        items: [{
+                            text: '采购明细表'
                         }, {
-                            id: 'purchaseIn',
-                            text: '采购验收单',
-                            addType:'purchase-purchaseIn-formpanel',
-                            viewType: 'purchase-purchaseIn-querypanel'
-                        },{
-                            id: 'purchaseOut',
-                            text: '采购验退单',
-                            addType:'purchase-purchaseOut-formpanel',
-                            viewType: 'purchase-purchaseOut-querypanel'
-                        },{
-                            id: 'form1',
-                            text: '测试-采购单明细界面',
-                            addType: 'test-order-formpanel'
+                            text: '采购付款一览表'
+                        }]
+                    }]
+                }, {
+                    text: '销售',
+                    iconCls: 'x-fa fa-shopping-cart',
+                    items: [{
+                        text: '制单',
+                        items: [{
+                            id: 'sale',
+                            text: '销售订单',
+                            formType: 'sale-sale-formpanel',
+                            queryType: 'sale-sale-querypanel'
+                        }, {
+                            id: 'saleOut',
+                            text: '销售出货单',
+                            formType: 'sale-saleOut-formpanel',
+                            queryType: 'sale-saleOut-querypanel'
                         }, {
-                            id: 'myform',
-                            text: '测试-明细界面',
-                            addType: 'test-myform-formpanel'
+                            id: 'saleIn',
+                            text: '销售退货单',
+                            formType: 'sale-saleIn-formpanel',
+                            queryType: 'sale-saleIn-querypanel'
                         }, {
-                            id: 'myquerytest',
-                            text: '测试-采购单查询界面',
-                            viewType: 'test-query-querypanel',
+                            id: 'saleToPur',
+                            text: '以销定购',
+                            formType: 'sale-saleToPur-formpanel',
+                            queryType: 'sale-saleToPur-querypanel'
                         }]
                     }, {
                         text: '报表',
                         items: [{
-                            text: '采购明细表'
+                            text: '销售明细表'
                         }, {
-                            text: '采购付款一览表'
+                            text: '销售收款一览表'
+                        }, {
+                            text: '销售利润表'
                         }]
                     }]
-                },{
+                }, {
+                    text: '库存',
+                    iconCls: 'x-fa fa-shopping-cart',
+                    items: [{
+                        text: '制单',
+                        items: [{
+                            id: 'appropriationInOut',
+                            text: '调拨单',
+                            formType: 'stock-appropriationInOut-formpanel',
+                            queryType: 'stock-appropriationInOut-querypanel'
+                        }, {
+                            id: 'make',
+                            text: '制造单',
+                            formType: 'stock-make-formpanel',
+                            queryType: 'stock-make-querypanel'
+                        }, {
+                            id: 'otherIn',
+                            text: '其它入库单',
+                            formType: 'stock-otherIn-formpanel',
+                            queryType: 'stock-otherIn-querypanel'
+                        }, {
+                            id: 'otherOut',
+                            text: '其它出库单',
+                            formType: 'stock-otherOut-formpanel',
+                            queryType: 'stock-otherOut-querypanel'
+                        }, {
+                            id: 'inventory',
+                            text: '盘点单',
+                            formType: 'stock-inventory-formpanel',
+                            queryType: 'stock-inventory-querypanel'
+                        }]
+                    }, {
+                        text: '报表',
+                        items: [{
+                            text: '物料出入库明细表'
+                        }, {
+                            text: '物料收发汇总表'
+                        }, {
+                            text: '物料库存数量金额表'
+                        }]
+                    }]
+                }, {
+                    text: '资金',
+                    iconCls: 'x-fa fa-shopping-cart',
+                    items: [{
+                        text: '制单',
+                        items: [{
+                            id: 'payBalance',
+                            text: '付款单',
+                            formType: 'money-payBalance-formpanel',
+                            queryType: 'money-payBalance-querypanel'
+                        }, {
+                            id: 'recBbalance',
+                            text: '收款单',
+                            formType: 'money-recBbalance-formpanel',
+                            queryType: 'money-recBbalance-querypanel'
+                        }, {
+                            id: 'verification',
+                            text: '核销单',
+                            formType: 'money-verification-formpanel',
+                            queryType: 'money-verification-querypanel'
+                        }, {
+                            id: 'othReceipts',
+                            text: '其它收支单',
+                            formType: 'money-othReceipts-formpanel',
+                            queryType: 'money-othReceipts-querypanel'
+                        }, {
+                            id: 'fundTransfer',
+                            text: '资金转存',
+                            formType: 'money-fundTransfer-formpanel',
+                            queryType: 'money-fundTransfer-querypanel'
+                        }]
+                    }, {
+                        text: '报表',
+                        items: [{
+                            text: '供应商对账单'
+                        }, {
+                            text: '应付账款明细表'
+                        }, {
+                            text: '客户对账单'
+                        }, {
+                            text: '应收款明细表'
+                        }, {
+                            text: '资金账户余额表'
+                        }]
+                    }]
+                }, {
                     text: '资料',
                     iconCls: 'x-fa fa-book',
-                    items: [
-                        {
+                    items: [{
                             text: '基础资料',
-                            items: [
-                                {
+                            items: [{
                                     text: '客户资料',
                                     viewType: 'mainlist',
                                     leaf: true
@@ -105,8 +232,7 @@ Ext.define('saas.view.main.Navigation', {
                         },
                         {
                             text: '辅助资料',
-                            items: [
-                                {
+                            items: [{
                                     text: '客户类别',
                                     viewType: 'document-kind',
                                     leaf: true
@@ -161,22 +287,22 @@ Ext.define('saas.view.main.Navigation', {
                     ]
                 }]
             }),
-            tpl : new Ext.XTemplate('<ul class="x-navlist">',
+            tpl: new Ext.XTemplate('<ul class="x-navlist">',
                 '<tpl for=".">',
                 '<li class="x-navitem">',
-                    '<div class="x-navitem-body">',
-                        '<div class="nav-inner-wrap" style="margin-left: 0px;">',
-                        '<div class="nav-inner-icon {iconCls}"></div>',
-                        '<div class="nav-inner-text">{text}</div>',
-                    '</div>',
+                '<div class="x-navitem-body">',
+                '<div class="nav-inner-wrap" style="margin-left: 0px;">',
+                '<div class="nav-inner-icon {iconCls}"></div>',
+                '<div class="nav-inner-text">{text}</div>',
+                '</div>',
                 '</li>',
                 '</tpl>',
-            '</ul>'),
+                '</ul>'),
             trackOver: true,
-            overItemCls : 'x-navitem-over',
-            selectedClass : 'x-navitem-selected',
-            singleSelect : true,
-            itemSelector : '.x-navitem',
+            overItemCls: 'x-navitem-over',
+            selectedClass: 'x-navitem-selected',
+            singleSelect: true,
+            itemSelector: '.x-navitem',
             listeners: {
                 itemmouseenter: me.showNavMenu,
                 itemmouseleave: me.hideNavMenu,
@@ -193,81 +319,81 @@ Ext.define('saas.view.main.Navigation', {
         me.callParent();
     },
 
-    clickNavMenu: function(view, record, item, index, e, eOpts) {
+    clickNavMenu: function (view, record, item, index, e, eOpts) {
         var me = this;
         this.showNavMenu(view, record, item, index, e, eOpts);
     },
 
-    showNavMenu: function(view, record, item, index, e, eOpts) {
+    showNavMenu: function (view, record, item, index, e, eOpts) {
         var recData = record.data,
-        menuItems = recData.items || [],
-        itemBox = item.getBoundingClientRect(),
-        pos = [itemBox.left + itemBox.width, itemBox.top],
-        id = recData.id,
-        menuId = 'navMenu-' + id,
-        menu = Ext.getCmp(menuId);
+            menuItems = recData.items || [],
+            itemBox = item.getBoundingClientRect(),
+            pos = [itemBox.left + itemBox.width, itemBox.top],
+            id = recData.id,
+            menuId = 'navMenu-' + id,
+            menu = Ext.getCmp(menuId);
 
-        if(!menu) {
+        if (!menu) {
             var view = new Ext.DataView({
-                store : Ext.create('Ext.data.Store', {
-                   fields: ['id', 'text', 'addType', 'viewType'],
-                   data: menuItems
+                store: Ext.create('Ext.data.Store', {
+                    fields: ['id', 'text', 'addType', 'viewType'],
+                    data: menuItems
                 }),
                 tpl: new Ext.XTemplate('<div class="x-navitem-menu">',
                     '<div class="nav-menu-body">',
-                        '<tpl for=".">',
-                        '<div class="menu">',
-                            '<h3 class="menu-title">{text}</h3>',
-                            '<div class="menu-content">',
-                                '<tpl for="items">',
-                                '<div class="menuitem">',
-                                    '<div class="item-text" title="{text}" data-id="{id}" data-text="{text}" data-type="query" data-viewType="{viewType}">',
-                                        '{text}',
-                                    '</div>',
-                                    '<tpl if="{addType}">',
-                                    '<div class="item-icon" data-id="{id}" data-text="{text}" data-type="form" data-viewType="{addType}">新增</div>',
-                                    '</tpl>',
-                                '</div>',
-                                '</tpl>',
-                            '</div>',
-                        '</div>',
-                        '</tpl>',
+                    '<tpl for=".">',
+                    '<div class="menu">',
+                    '<h3 class="menu-title">{text}</h3>',
+                    '<div class="menu-content">',
+                    '<tpl for="items">',
+                    '<div class="menuitem">',
+                    '<div class="item-text" title="{text}" data-id="{id}" data-text="{text}" data-type="query" data-viewType="{viewType}">',
+                    '{text}',
+                    '</div>',
+                    '<tpl if="{addType}">',
+                    '<div class="item-icon" data-id="{id}" data-text="{text}" data-type="form" data-viewType="{addType}">新增</div>',
+                    '</tpl>',
+                    '</div>',
+                    '</tpl>',
                     '</div>',
-                '</div>'),
+                    '</div>',
+                    '</tpl>',
+                    '</div>',
+                    '</div>'),
                 trackOver: true,
-                overItemCls : 'menuitem-over',
-                selectedClass : 'menuitem-selected',
-                singleSelect : true,
-                itemSelector : 'menu',
+                overItemCls: 'menuitem-over',
+                selectedClass: 'menuitem-selected',
+                singleSelect: true,
+                itemSelector: 'menu',
                 listeners: {
-                    boxready: function(view, width, height, eOpts) {
+                    boxready: function (view, width, height, eOpts) {
                         var menu = view.up('menu'),
-                        menuView = view.el.dom.getElementsByClassName('x-navitem-menu')[0],
-                        menuBox = menuView.getBoundingClientRect(),
-                        menuViewWidth = menuBox.width,
-                        menuViewHeight = menuBox.height,
-                        menuItem = menuView.getElementsByClassName('menuitem');
-                        
+                            menuView = view.el.dom.getElementsByClassName('x-navitem-menu')[0],
+                            menuBox = menuView.getBoundingClientRect(),
+                            menuViewWidth = menuBox.width,
+                            menuViewHeight = menuBox.height,
+                            menuItem = menuView.getElementsByClassName('menuitem');
+
                         menu.setWidth(menuViewWidth);
                         menu.setHeight(menuViewHeight);
                         menu.updateLayout();
 
-                        view.el.dom.addEventListener('mouseleave', function(e) {
+                        view.el.dom.addEventListener('mouseleave', function (e) {
                             var ex = e.clientX,
-                            ey = e.clientY,
-                            box = menuView.getBoundingClientRect();
+                                ey = e.clientY,
+                                box = menuView.getBoundingClientRect();
 
-                            if(ey <= box.top || ex >= (box.left + box.width) || ey >= (box.top + box.height) || (ex <= box.left && ey >= (box.top + 64))) {
+                            if (ey <= box.top || ex >= (box.left + box.width) || ey >= (box.top + box.height) || (ex <= box.left && ey >= (box.top + 64))) {
                                 menu.hide();
                             }
                         });
 
-                        Ext.Array.each(menuItem, function(mi) {
+                        Ext.Array.each(menuItem, function (mi) {
                             var menuItemText = mi.getElementsByClassName('item-text');
                             var menuItemIcon = mi.getElementsByClassName('item-icon');
 
-                            Ext.Array.each(menuItemText, function(item) {
-                                item.addEventListener('click', function(e) {
+                            Ext.Array.each(menuItemText, function (item) {
+                                item.addEventListener('click', function (e) {
                                     var target = e.target,
                                     dataset = target.dataset,
                                     viewType = dataset.viewtype,
@@ -282,8 +408,8 @@ Ext.define('saas.view.main.Navigation', {
                                     menu.hide();
                                 });
                             });
-                            Ext.Array.each(menuItemIcon, function(item) {
-                                item.addEventListener('click', function(e) {
+                            Ext.Array.each(menuItemIcon, function (item) {
+                                item.addEventListener('click', function (e) {
                                     var target = e.target,
                                     dataset = target.dataset,
                                     viewType = dataset.viewtype,
@@ -315,17 +441,17 @@ Ext.define('saas.view.main.Navigation', {
         menu.showAt(pos);
     },
 
-    hideNavMenu: function(view, record, item, index, e, eOpts) {
+    hideNavMenu: function (view, record, item, index, e, eOpts) {
         var recData = record.data,
-        cx = e.browserEvent.clientX,
-        cy = e.browserEvent.clientY,
-        itemBox = item.getBoundingClientRect(),
-        id = recData.id,
-        menuId = 'navMenu-' + id,
-        menu = Ext.getCmp(menuId);
+            cx = e.browserEvent.clientX,
+            cy = e.browserEvent.clientY,
+            itemBox = item.getBoundingClientRect(),
+            id = recData.id,
+            menuId = 'navMenu-' + id,
+            menu = Ext.getCmp(menuId);
 
-        if(cx <= itemBox.left || cy <= itemBox.top || cy >= (itemBox.top + itemBox.height)) {
-            if(menu) {
+        if (cx <= itemBox.left || cy <= itemBox.top || cy >= (itemBox.top + itemBox.height)) {
+            if (menu) {
                 menu.hide();
             }
         }

+ 2 - 2
frontend/saas-web/app/view/purchase/purchase/FormController.js

@@ -14,7 +14,7 @@ Ext.define('saas.view.purchase.purchase.FormController', {
             'dbfindtrigger[name=pu_vendcode]':{
                 beforerender:function(f){
                     Ext.apply(f,{
-                        dataUrl:'http://192.168.253.41:9480/api/document/vendor/getVendorsByCondition',
+                        dataUrl:'http://192.168.0.181:8570/api/document/vendor/getVendorsByCondition',
                         dbfinds:[{
                             from:'ve_code',to:'pu_vendcode'
                         },{
@@ -66,7 +66,7 @@ Ext.define('saas.view.purchase.purchase.FormController', {
                 beforerender:function(f){
                     Ext.apply(f,{
                         conditionCode:'pr_code',
-                        dataUrl:'http://192.168.253.41:9480/api/document/product/getProductsByCondition',
+                        dataUrl:'http://192.168.0.181:8570/api/document/product/getProductsByCondition',
                         dbfinds:[{
                             from:'pr_code',to:'pd_prodcode'
                         }],

+ 18 - 9
frontend/saas-web/app/view/purchase/purchase/FormPanel.js

@@ -5,6 +5,8 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
     controller: 'purchase-purchase-formcontroller',
     viewModel: 'purchase-purchase-formmodel',
     
+    caller:'Purchase',
+    
      //字段属性
      _title:'采购单',
      _idField: 'id',
@@ -13,17 +15,17 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
      _statusCodeField: 'pu_statuscode',
      _detnoColumn:  'pd_detno',
      _relationColumn: 'pd_puid',
-     _readUrl:'http://localhost:8800/purchase/read/',
-     _saveUrl:'http://localhost:8800/purchase/save',
-     _auditUrl:'http://localhost:8800/purchase/audit',
-     _deleteUrl:'http://localhost:8800/purchase/delete/',
-     _deleteDetailUrl:'http://localhost:8800/purchase/deleteItem/',
-     _turnInUrl:'http://localhost:8800/purchase/turnProdin/',
+     _readUrl:'http://192.168.0.181:8560/api/purchase/purchase/read/',
+     _saveUrl:'http://192.168.0.181:8560/api/purchase/purchase/save',
+     _auditUrl:'http://192.168.0.181:8560/api/purchase/purchase/audit',
+     _deleteUrl:'http://192.168.0.181:8560/api/purchase/purchase/delete/',
+     _deleteDetailUrl:'http://192.168.0.181:8560/api/purchase/purchase/deleteItem/',
+     _turnInUrl:'http://192.168.253.228:8800/purchase/turnProdin/',
      initId:0,
  
      toolBtns: [{
          xtype: 'button',
-         text: '转验收单按钮',
+         text: '转采购验收单',
          handler: 'turnIn'
      }],
 
@@ -109,6 +111,7 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
     }, {
         name : "detailGridField", 
         xtype : "detailGridField", 
+        storeModel:'saas.model.purchase.purchasedetail',
         columns : [
             {
                 text : "序号", 
@@ -149,12 +152,18 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
             {
                 text : "名称", 
                 dataIndex : "pr_detail",
-                ignore:true
+                ignore:true,
+                renderer: function (v, m, r) {
+                    return r.data["product"]?r.data["product"][m.column.dataIndex]:'';
+                }
             },
             {
                 text : "规格", 
                 dataIndex : "pr_spec",
-                ignore:true
+                ignore:true,
+                renderer: function (v, m, r) {
+                    return r.data["product"]?r.data["product"][m.column.dataIndex]:'';
+                }
             },
             {
                 text : "数量", 

+ 1 - 0
frontend/saas-web/app/view/purchase/purchase/QueryPanelController.js

@@ -63,6 +63,7 @@ Ext.define('saas.view.purchase.purchase.QueryPanelController', {
                         dataUrl:'http://192.168.253.41:9480/api/document/product/getProductsByCondition',
                         dbfinds:[{
                             from:'pr_code',to:'pd_prodcode',
+                        }, {
                             from:'pr_detail',to:'pr_detail'
                         }],
                         dbtpls:[{

+ 10 - 4
frontend/saas-web/app/view/purchase/purchaseIn/FormController.js

@@ -14,7 +14,7 @@ Ext.define('saas.view.purchase.purchaseIn.FormController', {
             'dbfindtrigger[name=pu_vendcode]':{
                 beforerender:function(f){
                     Ext.apply(f,{
-                        dataUrl:'http://192.168.253.41:9480/api/document/vendor/getVendorsByCondition',
+                        dataUrl:'http://192.168.0.181:8570/api/document/vendor/getVendorsByCondition',
                         dbfinds:[{
                             from:'ve_code',to:'pu_vendcode'
                         },{
@@ -66,11 +66,17 @@ Ext.define('saas.view.purchase.purchaseIn.FormController', {
                 beforerender:function(f){
                     Ext.apply(f,{
                         conditionCode:'pr_code',
-                        dataUrl:'http://192.168.253.41:9480/api/document/product/getProductsByCondition',
+                        dataUrl:'http://192.168.0.181:8570/api/document/product/getProductsByCondition',
                         dbfinds:[{
-                            from:'pr_code',to:'pd_prodcode',
+                            from:'pr_id',to:'pd_prodid'                          
+                        },{
+                            from:'pr_code',to:'pd_prodcode'                          
+                        },{
+                            from:'pr_detail',to:'pr_detail'
+                        },{
                             from:'pr_unit',to:'pd_unit'
-                        }],
+                        }
+                    ],
                         dbtpls:[{
                             field:'pr_code',width:100
                         },{

+ 8 - 1
frontend/saas-web/app/view/purchase/purchaseIn/FormPanel.js

@@ -4,7 +4,9 @@ Ext.define('saas.view.purchase.purchaseIn.FormPanel', {
 
     controller: 'purchase-purchaseIn-formcontroller',
     viewModel: 'purchase-purchaseIn-formmodel',
+    caller:'PurchaseIn',
     
+     //字段属性
     _title:'采购验收单',
     _idField: 'id',
     _codeField: 'pi_inoutno',
@@ -23,7 +25,7 @@ Ext.define('saas.view.purchase.purchaseIn.FormPanel', {
 
     toolBtns: [{
         xtype: 'button',
-        text: '转验退单按钮',
+        text: '转采购验退单',
         handler: 'turnOut'
     }],
 
@@ -119,6 +121,11 @@ Ext.define('saas.view.purchase.purchaseIn.FormPanel', {
                 text : "id", 
                 dataIndex : "id", 
                 xtype : "numbercolumn"
+            },{
+                text : "物料id", 
+                dataIndex : "pd_prodid", 
+                xtype : "numbercolumn",
+                hidden:true
             },
             {
                 text : "物料编号", 

+ 2 - 2
frontend/saas-web/app/view/purchase/purchaseOut/FormController.js

@@ -14,7 +14,7 @@ Ext.define('saas.view.purchase.purchaseOut.FormController', {
             'dbfindtrigger[name=pu_vendcode]':{
                 beforerender:function(f){
                     Ext.apply(f,{
-                        dataUrl:'http://192.168.253.41:9480/api/document/vendor/getVendorsByCondition',
+                        dataUrl:'http://192.168.0.181:8570/api/document/vendor/getVendorsByCondition',
                         dbfinds:[{
                             from:'ve_code',to:'pu_vendcode'
                         },{
@@ -66,7 +66,7 @@ Ext.define('saas.view.purchase.purchaseOut.FormController', {
                 beforerender:function(f){
                     Ext.apply(f,{
                         conditionCode:'pr_code',
-                        dataUrl:'http://192.168.253.41:9480/api/document/product/getProductsByCondition',
+                        dataUrl:'http://192.168.0.181:8570/api/document/product/getProductsByCondition',
                         dbfinds:[{
                             from:'pr_code',to:'pd_prodcode',
                             from:'pr_unit',to:'pd_unit'

+ 10 - 0
frontend/saas-web/app/view/purchase/purchaseOut/FormPanel.js

@@ -5,6 +5,9 @@ Ext.define('saas.view.purchase.purchaseOut.FormPanel', {
     controller: 'purchase-purchaseOut-formcontroller',
     viewModel: 'purchase-purchaseOut-formmodel',
     
+    caller:'PurchaseOut',
+    
+    //字段属性
     _title:'采购验退单',
     _idField: 'id',
     _codeField: 'pi_inoutno',
@@ -81,6 +84,13 @@ Ext.define('saas.view.purchase.purchaseOut.FormPanel', {
         readOnly: true,
         columnWidth : 0.25
     }, {
+        xtype : "textfield", 
+        name : "pi_puid", 
+        bind : "{pi_puid}", 
+        fieldLabel : "采购单id", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    },{
         xtype : "textfield", 
         name : "pi_pucode", 
         bind : "{pi_pucode}", 

+ 158 - 0
frontend/saas-web/app/view/sale/sale/FormController.js

@@ -0,0 +1,158 @@
+Ext.define('saas.view.sale.sale.FormController', {
+    extend: 'saas.view.core.form.FormPanelController',
+    alias: 'controller.sale-sale-formcontroller',
+    init: function (form) {
+        var me = this;
+        this.control({
+            /**放大镜新增demo*/
+            "field[name=combo]":{
+                beforerender:function(f){
+                    f.addHandler=me.addCombo;
+                }
+            },
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=sa_custcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        dataUrl:'http://192.168.0.181:8570/api/document/customer/getCustomerByCondition',
+                        dbfinds:[{
+                            from:'cu_id',to:'sa_custid'
+                        },{
+                            from:'cu_code',to:'sa_custcode'
+                        },{
+                            from:'cu_name',to:'sa_custname'
+                        }],
+                        dbtpls:[{
+                            field:'cu_code',width:100
+                        },{
+                            field:'cu_name',width:100
+                        }],
+                        dbColumns:[{
+                            conditionCode:'cu_id',
+                            "text": "客户ID",
+                            "flex": 0,
+                            "dataIndex": "cu_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            conditionCode:'cu_code',
+                            "text": "客户编号",
+                            "flex": 1,
+                            "dataIndex": "cu_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'cu_name',
+                            "text": "客户名称",
+                            "flex": 1,
+                            "dataIndex": "cu_name",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'cu_type',
+                            "text": "客户类型",
+                            "flex": 0,
+                            "dataIndex": "cu_type",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            },
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=pd_prodcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        conditionCode:'pr_code',
+                        dataUrl:'http://192.168.0.181:8570/api/document/product/getProductsByCondition',
+                        dbfinds:[{
+                            from:'pr_code',to:'sd_prodcode'
+                        }],
+                        dbtpls:[{
+                            field:'pr_code',width:100
+                        },{
+                            field:'pr_detail',width:100
+                        }],
+                        dbColumns:[{
+                            "text": "物料ID",
+                            "flex": 0,
+                            "dataIndex": "pr_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            "text": "物料编号",
+                            "flex": 1,
+                            "dataIndex": "pr_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料名称",
+                            "flex": 1,
+                            "dataIndex": "pr_detail",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料规格",
+                            "flex": 0,
+                            "dataIndex": "pr_spec",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            }
+        });
+
+    },
+    addCombo:function(){
+        var combo=this.ownerCmp;
+        Ext.create('Ext.window.Window',{
+            layout:'vbox',
+            bodyPadding: 15,
+            width:500,
+            items:[{
+                fieldLabel:'实际值',
+                xtype:'textfield'
+            },{
+                fieldLabel:'显示值',
+                xtype:'textfield'
+            }],
+            buttons:[{
+                text:'确认',
+                handler:function(b){
+                    combo.setValue('ok');
+                    b.up('window').close();
+                }
+            }],
+            renderTo:this.ownerCmp.ownerCt.getEl()
+        }).show();
+
+    },
+
+    turnOut: function() {
+        var me = this,
+        form = me.getView(),
+        id = form.getForm().findField(form._idField);
+        form.BaseUtil.request({
+            url: form._turnOutUrl+id.value,
+            method: 'GET',
+        })
+        .then(function(res) {
+            var localJson = new Ext.decode(res.responseText);
+            if(localJson.success){
+                Ext.Msg.alert('提示','转单成功');
+            }
+        })
+        .catch(function() {
+            Ext.Msg.alert('提示','转单失败');
+        });
+     }
+});

+ 5 - 0
frontend/saas-web/app/view/sale/sale/FormModel.js

@@ -0,0 +1,5 @@
+Ext.define('saas.view.sale.sale.FormModel', {
+    extend: 'saas.view.core.form.FormPanelModel',
+    alias: 'viewmodel.sale-sale-formmodel',
+
+});

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

@@ -0,0 +1,270 @@
+Ext.define('saas.view.sale.sale.FormPanel', {
+    extend: 'saas.view.core.form.FormPanel',
+    xtype: 'sale-sale-formpanel',
+
+    controller: 'sale-sale-formcontroller',
+    viewModel: 'sale-sale-formmodel',
+    
+    caller:'Sale',
+    
+     //字段属性
+     _title:'销售订单',
+     _idField: 'id',
+     _codeField: 'sa_code',
+     _statusField: 'sa_status',
+     _statusCodeField: 'sa_statuscode',
+     _detnoColumn:  'sd_detno',
+     _relationColumn: 'sd_puid',
+     _readUrl:'',
+     _saveUrl:'',
+     _auditUrl:'',
+     _deleteUrl:'',
+     _deleteDetailUrl:'',
+     _turnInUrl:'',
+     _turnOutUrl:'',
+     initId:0,
+ 
+     toolBtns: [{
+         xtype: 'button',
+         text: '转出货单',
+         handler: 'turnIn'
+     }],
+
+    defaultItems: [{
+        xtype: 'hidden',
+        name: 'id',
+        bind: '{id}',
+        fieldLabel: 'id',
+        allowBlank: true,
+        columnWidth: 0
+    }, {
+        xtype : 'hidden', 
+        name : 'sa_cudid', 
+        bind : '{sa_cudid}', 
+        fieldLabel : '客户ID', 
+        allowBlank : true, 
+        columnWidth : 0
+    }, {
+        xtype : 'textfield', 
+        name : 'sa_code', 
+        bind : '{sa_code}', 
+        fieldLabel : '销售单号', 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : 'hidden', 
+        name : 'sa_cucode', 
+        bind : '{sa_cucode}', 
+        fieldLabel : '客户编号', 
+        allowBlank : true, 
+        columnWidth : 0, 
+    }, {
+        xtype : "dbfindtrigger", 
+        name : "sa_cuname", 
+        bind : "{sa_cuname}", 
+        fieldLabel : "客户名称", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    },{
+        xtype : "datefield", 
+        name : "sa_recorddate", 
+        bind : "{sa_recorddate}", 
+        fieldLabel : "订单日期", 
+        allowBlank : false, 
+        columnWidth : 0.25
+    }, {
+        xtype : "textfield", 
+        name : "sa_recorder", 
+        bind : "{sa_recorder}", 
+        fieldLabel : "录入人", 
+        allowBlank : true, 
+        readOnly:true,
+        columnWidth : 0.25
+    }, {
+        xtype : "textfield", 
+        name : "sa_total", 
+        bind : "{sa_total}", 
+        fieldLabel : "单据金额", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    },{
+        xtype : 'textfield', 
+        name : 'sa_sendstatus', 
+        bind : '{sa_sendstatus}', 
+        fieldLabel : '出货状态', 
+        allowBlank : true, 
+        readOnly:true,
+        columnWidth : 0.25
+     }
+     //, {
+    //     xtype : "textfield", 
+    //     name : "sa_toplace", 
+    //     bind : "{sa_toplace}", 
+    //     fieldLabel : "交货地址", 
+    //     allowBlank : true, 
+    //     columnWidth : 0.5
+    // }
+    // , {
+    //     xtype : "textfield", 
+    //     name : "sa_remark", 
+    //     bind : "{sa_remark}", 
+    //     fieldLabel : "备注", 
+    //     allowBlank : true, 
+    //     columnWidth : 1
+    // }
+    ,{
+        name : "detailGridField", 
+        xtype : "detailGridField", 
+        columnWidth : 1,
+        columns : [
+            {
+                text : "序号", 
+                dataIndex : "sd_detno", 
+                width : 100, 
+                xtype : "numbercolumn",
+                align : 'center',
+                format:'0',
+                summaryType: 'count',
+                summaryRenderer: function(value, summaryData, dataIndex) {
+                    return Ext.String.format('合计: {0}条', value);
+                },
+            }, {
+                text : "id", 
+                dataIndex : "id", 
+                xtype : "numbercolumn"
+            },
+            {
+                text : "物料编号", 
+                width : 200.0, 
+                dataIndex : "sd_prodcode", 
+                xtype : "", 
+                items : null,
+                editor : {
+                    displayField : "display", 
+                    editable : true, 
+                    format : "", 
+                    hideTrigger : false, 
+                    maxLength : 100.0, 
+                    minValue : null, 
+                    positiveNum : false, 
+                    queryMode : "local", 
+                    store : null, 
+                    valueField : "value", 
+                    xtype : "dbfindtrigger"
+                }
+            },
+            {
+                text : "名称", 
+                dataIndex : "pr_detail",
+                ignore:true
+            },
+            {
+                text : "规格", 
+                dataIndex : "pr_spec",
+                ignore:true
+            },
+            {
+                text : "数量", 
+                dataIndex : "sd_qty", 
+                editor : {
+                    xtype : "numberfield"
+                },
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                format:'0',
+                items : null,
+                summaryType: 'sum'
+            },
+            {
+                text : "单价", 
+                editor : {
+                    xtype : "numberfield"
+                },
+                format:'0,000.00',
+                dataIndex : "sd_price", 
+                width : 120.0, 
+                xtype : "numbercolumn",
+                items : null,
+                summaryType: 'sum'
+            }, 
+            {
+                text : "税率", 
+                editor : {
+                    xtype : "numberfield"
+                },
+                dataIndex : "sd_taxrate", 
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                items : null
+            },
+            {
+                text : "含税金额", 
+                dataIndex : "sd_total", 
+                width : 120.0, 
+                xtype : "numbercolumn"
+            }, 
+            {
+                text : "未税金额", 
+                dataIndex : "sd_nettotal", 
+                xtype : "numbercolumn"
+            },{
+                text : "交货日期", 
+                dataIndex : "sd_delivery", 
+                flex : 1.0, 
+                xtype:'datecolumn',
+                format : "Y-m-d H:i:s", 
+                editor : {
+                    xtype : "datefield",
+                    editable : true, 
+                    format : "Y-m-d H:i:s", 
+                    hideTrigger : false
+                }
+            },
+            {
+                text : "已转数", 
+                dataIndex : "sd_yqty", 
+                editor : {
+                    xtype : "numberfield"
+                },
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                format:'0',
+                items : null,
+                summaryType: 'sum'
+            },
+        ]
+    }, {
+        format : "Y-m-d", 
+        xtype : "datefield", 
+        name : "createTime", 
+        bind : "{createTime}", 
+        fieldLabel : "创建时间", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "datefield", 
+        name : "updateTime", 
+        bind : "{updateTime}", 
+        fieldLabel : "更新时间", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "textfield", 
+        readOnly : true, 
+        editable : false, 
+        name : "sa_status", 
+        bind : "{sa_status}", 
+        fieldLabel : "单据状态", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "hidden", 
+        readOnly : true, 
+        editable : false, 
+        name : "sa_statuscode", 
+        bind : "{sa_statuscode}", 
+        fieldLabel : "单据状态码", 
+        allowBlank : true, 
+        columnWidth : 0.0
+    }]
+});

+ 206 - 0
frontend/saas-web/app/view/sale/sale/QueryPanel.js

@@ -0,0 +1,206 @@
+Ext.define('saas.view.sale.sale.QueryPanel', {
+    extend: 'saas.view.core.query.QueryPanel',
+    xtype: 'sale-sale-querypanel',
+
+    controller: 'sale-sale-querypanel',
+    viewModel: 'sale-sale-querypanel',
+    viewName: 'sale-sale-formpanel',
+    _idField: 'sa_id',
+    _codeField: 'sa_code',
+    queryFormItems: [{
+        xtype: 'hidden',
+        name: 'sa_id',
+        bind: '{sa_id}',
+        fieldLabel: 'ID',
+        allowBlank: true,
+        columnWidth: 0
+    }, {
+        xtype: 'textfield',
+        name: 'sa_code',
+        bind: '{sa_code}',
+        fieldLabel: '单据编号',
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: 'condatefield',
+        name: 'sa_recorddate',
+        bind: '{sa_recorddate}',
+        fieldLabel: '单据日期',
+        allowBlank: true,
+        columnWidth: 0.5
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'sa_custcode',
+        bind: '{sa_custcode}',
+        fieldLabel: '客户编号',
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: 'textfield',
+        name: 'sa_custname',
+        bind: '{sa_custname}',
+        fieldLabel: '客户名称',
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'pd_prodcode#pd_prodcode',
+        bind: '{pd_prodcode}',
+        fieldLabel: '物料编号',
+        fieldMode: 'DETAIL',
+        queryType: 'VAG',
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: 'textfield',
+        name: 'pr_detail',
+        bind: '{pr_detail}',
+        fieldLabel: '物料名称',
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: 'combobox',
+        name: 'sa_statuscode',
+        bind: '{sa_statuscode}',
+        fieldLabel: '审核状态',
+        allowBlank: true,
+        columnWidth: 0.25,
+        queryMode: 'local',
+        displayField: 'sa_status',
+        valueField: 'sa_statuscode',
+        editable:false,
+        store: Ext.create('Ext.data.ArrayStore', {
+        fields: ['sa_statuscode', 'sa_status'],
+        data: [
+            ["$ALL", "全部"],
+            ["AUDITED", "已审核"],
+            ["UNAUDITED", "未审核"]
+        ]
+        })
+    }, {
+        xtype: 'multicombo',
+        name: 'sa_sendstatuscode',
+        bind: '{sa_sendstatuscode}',
+        fieldLabel: '出库状态',
+        allowBlank: true,
+        columnWidth: 0.25,
+        datas: [
+            ["TURNOUT", "已出库"],
+            ["UNTURNOUT", "未出库"],
+            ["PARTOUT", "部分出库"]
+        ]
+    }],
+    moreQueryFormItems: [{
+        xtype: 'textfield',
+        name: 'pu_buyername',
+        bind: '{pu_buyername}',
+        fieldLabel: '采购员',
+        allowBlank: true
+    }],
+    queryGridConfig: {
+        _idField: 'sa_id',
+        _codeField: 'sa_code',
+        _title: '销售订单',
+        _defaultCondition:'',
+        _addXtype: 'sale-sale-formpanel',
+        _baseVastUrl: 'http://192.168.0.181:8560/api/sale/sale/',
+        _baseColumn: [{
+            text: '序号',
+            width: 80,
+            xtype: 'rownumberer'
+        }, {
+            text: 'id',
+            dataIndex: 'sa_id',
+            width: 100,
+            xtype: 'numbercolumn'
+        }, {
+            text: '单据编号',
+            dataIndex: 'sa_code',
+            width: 120
+        }, {
+            text: '单据状态',
+            dataIndex: 'sa_status',
+            width: 120
+        }, {
+            text: '单据日期',
+            dataIndex: 'sa_recorddate',
+            xtype: 'datecolumn',
+            width: 200
+        }, {
+            text: '客户名称',
+            dataIndex: 'sa_cuname',
+            width: 120
+        }, {
+            text: '金额',
+            dataIndex: 'sa_total',
+            xtype: 'numbercolumn',
+            width: 120
+        }],
+        _relativeColumn: [{
+            text: '序号',
+            width: 80,
+            xtype: 'rownumberer'
+        }, {
+            text: 'id',
+            dataIndex: 'sa_id',
+            width: 100,
+            xtype: 'numbercolumn'
+        }, {
+            text: '单据编号',
+            dataIndex: 'sa_code',
+            width: 120
+        }, {
+            text: '单据状态',
+            dataIndex: 'sa_status',
+            width: 120
+        }, {
+            text: '下单日期',
+            dataIndex: 'sa_recorddate',
+            xtype: 'datecolumn',
+            width: 200
+        }, {
+            text: '客户名称',
+            dataIndex: 'sa_cuname',
+            width: 120
+        }, {
+            text: '明细序号',
+            dataIndex: 'sd_detno',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '物料编号',
+            dataIndex: 'sd_prodcode',
+            width: 120
+        }, {
+            text: '数量',
+            dataIndex: 'sd_qty',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '单价',
+            dataIndex: 'sd_price',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '已转数',
+            dataIndex: 'sd_ytqy',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '已出货数',
+            dataIndex: 'sd_sendqty',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '已审核采购单数',
+            dataIndex: 'sd_pdqty',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '备注',
+            dataIndex: 'sd_remark',
+            width: 250,
+            flex: 1
+        }]
+    }
+});

+ 116 - 0
frontend/saas-web/app/view/sale/sale/QueryPanelController.js

@@ -0,0 +1,116 @@
+Ext.define('saas.view.sale.sale.QueryPanelController', {
+    extend: 'saas.view.core.query.QueryPanelController',
+    alias: 'controller.sale-sale-querypanel',
+    init: function (form) {
+        var me = this;
+        this.control({
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=sa_custcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        dataUrl:'http://192.168.0.181:8570/api/document/customer/getCustomerByCondition',
+                        dbfinds:[{
+                            from:'cu_id',to:'sa_custid'
+                        },{
+                            from:'cu_code',to:'sa_custcode'
+                        },{
+                            from:'cu_name',to:'sa_custname'
+                        }],
+                        dbtpls:[{
+                            field:'cu_code',width:100
+                        },{
+                            field:'cu_name',width:100
+                        }],
+                        dbColumns:[{
+                            conditionCode:'cu_id',
+                            "text": "客户ID",
+                            "flex": 0,
+                            "dataIndex": "cu_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            conditionCode:'cu_code',
+                            "text": "客户编号",
+                            "flex": 1,
+                            "dataIndex": "cu_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'cu_name',
+                            "text": "客户名称",
+                            "flex": 1,
+                            "dataIndex": "cu_name",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'cu_type',
+                            "text": "客户类型",
+                            "flex": 0,
+                            "dataIndex": "cu_type",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            },
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=pd_prodcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        conditionCode:'pr_code',
+                        dataUrl:'http://192.168.253.41:9480/api/document/product/getProductsByCondition',
+                        dbfinds:[{
+                            from:'pr_code',to:'sd_prodcode'
+                        }],
+                        dbtpls:[{
+                            field:'pr_code',width:100
+                        },{
+                            field:'pr_detail',width:100
+                        }],
+                        dbColumns:[{
+                            "text": "物料ID",
+                            "flex": 0,
+                            "dataIndex": "pr_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            "text": "物料编号",
+                            "flex": 1,
+                            "dataIndex": "pr_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料名称",
+                            "flex": 1,
+                            "dataIndex": "pr_detail",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料规格",
+                            "flex": 0,
+                            "dataIndex": "pr_spec",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料单位",
+                            "flex": 0,
+                            "dataIndex": "pr_unit",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            }
+        });
+
+    }
+});

+ 5 - 0
frontend/saas-web/app/view/sale/sale/QueryPanelModel.js

@@ -0,0 +1,5 @@
+Ext.define('saas.view.sale.sale.QueryPanelModel', {
+    extend: 'saas.view.core.query.QueryPanelModel',
+    alias: 'viewmodel.sale-sale-querypanel'
+
+});

+ 158 - 0
frontend/saas-web/app/view/sale/saleIn/FormController.js

@@ -0,0 +1,158 @@
+Ext.define('saas.view.sale.sale.FormController', {
+    extend: 'saas.view.core.form.FormPanelController',
+    alias: 'controller.sale-sale-formcontroller',
+    init: function (form) {
+        var me = this;
+        this.control({
+            /**放大镜新增demo*/
+            "field[name=combo]":{
+                beforerender:function(f){
+                    f.addHandler=me.addCombo;
+                }
+            },
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=sa_custcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        dataUrl:'http://192.168.0.181:8570/api/document/customer/getCustomerByCondition',
+                        dbfinds:[{
+                            from:'cu_id',to:'sa_custid'
+                        },{
+                            from:'cu_code',to:'sa_custcode'
+                        },{
+                            from:'cu_name',to:'sa_custname'
+                        }],
+                        dbtpls:[{
+                            field:'cu_code',width:100
+                        },{
+                            field:'cu_name',width:100
+                        }],
+                        dbColumns:[{
+                            conditionCode:'cu_id',
+                            "text": "客户ID",
+                            "flex": 0,
+                            "dataIndex": "cu_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            conditionCode:'cu_code',
+                            "text": "客户编号",
+                            "flex": 1,
+                            "dataIndex": "cu_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'cu_name',
+                            "text": "客户名称",
+                            "flex": 1,
+                            "dataIndex": "cu_name",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'cu_type',
+                            "text": "客户类型",
+                            "flex": 0,
+                            "dataIndex": "cu_type",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            },
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=pd_prodcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        conditionCode:'pr_code',
+                        dataUrl:'http://192.168.0.181:8570/api/document/product/getProductsByCondition',
+                        dbfinds:[{
+                            from:'pr_code',to:'sd_prodcode'
+                        }],
+                        dbtpls:[{
+                            field:'pr_code',width:100
+                        },{
+                            field:'pr_detail',width:100
+                        }],
+                        dbColumns:[{
+                            "text": "物料ID",
+                            "flex": 0,
+                            "dataIndex": "pr_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            "text": "物料编号",
+                            "flex": 1,
+                            "dataIndex": "pr_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料名称",
+                            "flex": 1,
+                            "dataIndex": "pr_detail",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料规格",
+                            "flex": 0,
+                            "dataIndex": "pr_spec",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            }
+        });
+
+    },
+    addCombo:function(){
+        var combo=this.ownerCmp;
+        Ext.create('Ext.window.Window',{
+            layout:'vbox',
+            bodyPadding: 15,
+            width:500,
+            items:[{
+                fieldLabel:'实际值',
+                xtype:'textfield'
+            },{
+                fieldLabel:'显示值',
+                xtype:'textfield'
+            }],
+            buttons:[{
+                text:'确认',
+                handler:function(b){
+                    combo.setValue('ok');
+                    b.up('window').close();
+                }
+            }],
+            renderTo:this.ownerCmp.ownerCt.getEl()
+        }).show();
+
+    },
+
+    turnOut: function() {
+        var me = this,
+        form = me.getView(),
+        id = form.getForm().findField(form._idField);
+        form.BaseUtil.request({
+            url: form._turnOutUrl+id.value,
+            method: 'GET',
+        })
+        .then(function(res) {
+            var localJson = new Ext.decode(res.responseText);
+            if(localJson.success){
+                Ext.Msg.alert('提示','转单成功');
+            }
+        })
+        .catch(function() {
+            Ext.Msg.alert('提示','转单失败');
+        });
+     }
+});

+ 5 - 0
frontend/saas-web/app/view/sale/saleIn/FormModel.js

@@ -0,0 +1,5 @@
+Ext.define('saas.view.sale.sale.FormModel', {
+    extend: 'saas.view.core.form.FormPanelModel',
+    alias: 'viewmodel.sale-sale-formmodel',
+
+});

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

@@ -0,0 +1,267 @@
+Ext.define('saas.view.sale.sale.FormPanel', {
+    extend: 'saas.view.core.form.FormPanel',
+    xtype: 'sale-sale-formpanel',
+
+    controller: 'sale-sale-formcontroller',
+    viewModel: 'sale-sale-formmodel',
+    
+    caller:'Sale',
+    
+     //字段属性
+     _title:'销售订单',
+     _idField: 'id',
+     _codeField: 'sa_code',
+     _statusField: 'sa_status',
+     _statusCodeField: 'sa_statuscode',
+     _detnoColumn:  'sd_detno',
+     _relationColumn: 'sd_puid',
+     _readUrl:'',
+     _saveUrl:'',
+     _auditUrl:'',
+     _deleteUrl:'',
+     _deleteDetailUrl:'',
+     _turnInUrl:'',
+     _turnOutUrl:'',
+     initId:0,
+ 
+     toolBtns: [{
+         xtype: 'button',
+         text: '转出货单',
+         handler: 'turnIn'
+     }],
+
+    defaultItems: [{
+        xtype: 'hidden',
+        name: 'id',
+        bind: '{id}',
+        fieldLabel: 'id',
+        allowBlank: true,
+        columnWidth: 0
+    }, {
+        xtype : "textfield", 
+        name : "sa_code", 
+        bind : "{sa_code}", 
+        fieldLabel : "销售单号", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "hidden", 
+        name : "sa_cudid", 
+        bind : "{sa_cudid}", 
+        fieldLabel : "客户ID", 
+        allowBlank : true, 
+        columnWidth : 0.0
+    }, {
+        xtype : "textfield", 
+        name : "sa_cucode", 
+        bind : "{sa_cucode}", 
+        fieldLabel : "客户编号", 
+        hidden:true,
+        allowBlank : true, 
+        columnWidth : 0, 
+    }, {
+        xtype : "dbfindtrigger", 
+        name : "sa_cuname", 
+        bind : "{sa_cuname}", 
+        fieldLabel : "客户名称", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    },{
+        xtype : "datefield", 
+        name : "sa_recorddate", 
+        bind : "{sa_recorddate}", 
+        fieldLabel : "订单日期", 
+        allowBlank : false, 
+        columnWidth : 0.25
+    }, {
+        xtype : "textfield", 
+        name : "sa_recorder", 
+        bind : "{sa_recorder}", 
+        fieldLabel : "录入人", 
+        allowBlank : true, 
+        readOnly:true,
+        columnWidth : 0.0
+    }, {
+        xtype : "textfield", 
+        name : "sa_toplace", 
+        bind : "{sa_toplace}", 
+        fieldLabel : "交货地址", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "textfield", 
+        name : "sa_total", 
+        bind : "{sa_total}", 
+        fieldLabel : "单据金额", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "textfield", 
+        name : "sa_remark", 
+        bind : "{sa_remark}", 
+        fieldLabel : "备注", 
+        allowBlank : true, 
+        columnWidth : 1
+    },{
+        xtype : "textfield", 
+        name : "sa_sendstatus", 
+        bind : "{sa_sendstatus}", 
+        fieldLabel : "出货状态", 
+        allowBlank : true, 
+        readOnly:true,
+        columnWidth : 0
+    }, {
+        name : "detailGridField", 
+        xtype : "detailGridField", 
+        columns : [
+            {
+                text : "序号", 
+                dataIndex : "sd_detno", 
+                width : 100, 
+                xtype : "numbercolumn",
+                align : 'center',
+                format:'0',
+                summaryType: 'count',
+                summaryRenderer: function(value, summaryData, dataIndex) {
+                    return Ext.String.format('合计: {0}条', value);
+                },
+            }, {
+                text : "id", 
+                dataIndex : "id", 
+                xtype : "numbercolumn"
+            },
+            {
+                text : "物料编号", 
+                width : 200.0, 
+                dataIndex : "sd_prodcode", 
+                xtype : "", 
+                items : null,
+                editor : {
+                    displayField : "display", 
+                    editable : true, 
+                    format : "", 
+                    hideTrigger : false, 
+                    maxLength : 100.0, 
+                    minValue : null, 
+                    positiveNum : false, 
+                    queryMode : "local", 
+                    store : null, 
+                    valueField : "value", 
+                    xtype : "dbfindtrigger"
+                }
+            },
+            {
+                text : "名称", 
+                dataIndex : "pr_detail",
+                ignore:true
+            },
+            {
+                text : "规格", 
+                dataIndex : "pr_spec",
+                ignore:true
+            },
+            {
+                text : "数量", 
+                dataIndex : "sd_qty", 
+                editor : {
+                    xtype : "numberfield"
+                },
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                format:'0',
+                items : null,
+                summaryType: 'sum'
+            },
+            {
+                text : "单价", 
+                editor : {
+                    xtype : "numberfield"
+                },
+                format:'0,000.00',
+                dataIndex : "sd_price", 
+                width : 120.0, 
+                xtype : "numbercolumn",
+                items : null,
+                summaryType: 'sum'
+            }, 
+            {
+                text : "税率", 
+                editor : {
+                    xtype : "numberfield"
+                },
+                dataIndex : "sd_taxrate", 
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                items : null
+            },
+            {
+                text : "含税金额", 
+                dataIndex : "sd_total", 
+                width : 120.0, 
+                xtype : "numbercolumn"
+            }, 
+            {
+                text : "未税金额", 
+                dataIndex : "sd_nettotal", 
+                xtype : "numbercolumn"
+            },{
+                text : "交货日期", 
+                dataIndex : "sd_delivery", 
+                flex : 1.0, 
+                xtype:'datecolumn',
+                format : "Y-m-d H:i:s", 
+                editor : {
+                    xtype : "datefield",
+                    editable : true, 
+                    format : "Y-m-d H:i:s", 
+                    hideTrigger : false
+                }
+            },
+            {
+                text : "已转数", 
+                dataIndex : "sd_yqty", 
+                editor : {
+                    xtype : "numberfield"
+                },
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                format:'0',
+                items : null,
+                summaryType: 'sum'
+            },
+        ]
+    }, {
+        format : "Y-m-d", 
+        xtype : "datefield", 
+        name : "createTime", 
+        bind : "{createTime}", 
+        fieldLabel : "创建时间", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "datefield", 
+        name : "updateTime", 
+        bind : "{updateTime}", 
+        fieldLabel : "更新时间", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "textfield", 
+        readOnly : true, 
+        editable : false, 
+        name : "sa_status", 
+        bind : "{sa_status}", 
+        fieldLabel : "单据状态", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "hidden", 
+        readOnly : true, 
+        editable : false, 
+        name : "sa_statuscode", 
+        bind : "{sa_statuscode}", 
+        fieldLabel : "单据状态码", 
+        allowBlank : true, 
+        columnWidth : 0.0
+    }]
+});

+ 206 - 0
frontend/saas-web/app/view/sale/saleIn/QueryPanel.js

@@ -0,0 +1,206 @@
+Ext.define('saas.view.sale.sale.QueryPanel', {
+    extend: 'saas.view.core.query.QueryPanel',
+    xtype: 'sale-sale-querypanel',
+
+    controller: 'sale-sale-querypanel',
+    viewModel: 'sale-sale-querypanel',
+    viewName: 'sale-sale-formpanel',
+    _idField: 'sa_id',
+    _codeField: 'sa_code',
+    queryFormItems: [{
+        xtype: 'hidden',
+        name: 'sa_id',
+        bind: '{sa_id}',
+        fieldLabel: 'ID',
+        allowBlank: true,
+        columnWidth: 0
+    }, {
+        xtype: 'textfield',
+        name: 'sa_code',
+        bind: '{sa_code}',
+        fieldLabel: '单据编号',
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: 'condatefield',
+        name: 'sa_recorddate',
+        bind: '{sa_recorddate}',
+        fieldLabel: '单据日期',
+        allowBlank: true,
+        columnWidth: 0.5
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'sa_custcode',
+        bind: '{sa_custcode}',
+        fieldLabel: '客户编号',
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: 'textfield',
+        name: 'sa_custname',
+        bind: '{sa_custname}',
+        fieldLabel: '客户名称',
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'pd_prodcode#pd_prodcode',
+        bind: '{pd_prodcode}',
+        fieldLabel: '物料编号',
+        fieldMode: 'DETAIL',
+        queryType: 'VAG',
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: 'textfield',
+        name: 'pr_detail',
+        bind: '{pr_detail}',
+        fieldLabel: '物料名称',
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: 'combobox',
+        name: 'sa_statuscode',
+        bind: '{sa_statuscode}',
+        fieldLabel: '审核状态',
+        allowBlank: true,
+        columnWidth: 0.25,
+        queryMode: 'local',
+        displayField: 'sa_status',
+        valueField: 'sa_statuscode',
+        editable:false,
+        store: Ext.create('Ext.data.ArrayStore', {
+        fields: ['sa_statuscode', 'sa_status'],
+        data: [
+            ["$ALL", "全部"],
+            ["AUDITED", "已审核"],
+            ["UNAUDITED", "未审核"]
+        ]
+        })
+    }, {
+        xtype: 'multicombo',
+        name: 'sa_sendstatuscode',
+        bind: '{sa_sendstatuscode}',
+        fieldLabel: '出库状态',
+        allowBlank: true,
+        columnWidth: 0.25,
+        datas: [
+            ["TURNOUT", "已出库"],
+            ["UNTURNOUT", "未出库"],
+            ["PARTOUT", "部分出库"]
+        ]
+    }],
+    moreQueryFormItems: [{
+        xtype: 'textfield',
+        name: 'pu_buyername',
+        bind: '{pu_buyername}',
+        fieldLabel: '采购员',
+        allowBlank: true
+    }],
+    queryGridConfig: {
+        _idField: 'sa_id',
+        _codeField: 'sa_code',
+        _title: '销售订单',
+        _defaultCondition:'',
+        _addXtype: 'sale-sale-formpanel',
+        _baseVastUrl: 'http://192.168.0.181:8560/api/sale/sale/',
+        _baseColumn: [{
+            text: '序号',
+            width: 80,
+            xtype: 'rownumberer'
+        }, {
+            text: 'id',
+            dataIndex: 'sa_id',
+            width: 100,
+            xtype: 'numbercolumn'
+        }, {
+            text: '单据编号',
+            dataIndex: 'sa_code',
+            width: 120
+        }, {
+            text: '单据状态',
+            dataIndex: 'sa_status',
+            width: 120
+        }, {
+            text: '单据日期',
+            dataIndex: 'sa_recorddate',
+            xtype: 'datecolumn',
+            width: 200
+        }, {
+            text: '客户名称',
+            dataIndex: 'sa_cuname',
+            width: 120
+        }, {
+            text: '金额',
+            dataIndex: 'sa_total',
+            xtype: 'numbercolumn',
+            width: 120
+        }],
+        _relativeColumn: [{
+            text: '序号',
+            width: 80,
+            xtype: 'rownumberer'
+        }, {
+            text: 'id',
+            dataIndex: 'sa_id',
+            width: 100,
+            xtype: 'numbercolumn'
+        }, {
+            text: '单据编号',
+            dataIndex: 'sa_code',
+            width: 120
+        }, {
+            text: '单据状态',
+            dataIndex: 'sa_status',
+            width: 120
+        }, {
+            text: '下单日期',
+            dataIndex: 'sa_recorddate',
+            xtype: 'datecolumn',
+            width: 200
+        }, {
+            text: '客户名称',
+            dataIndex: 'sa_cuname',
+            width: 120
+        }, {
+            text: '明细序号',
+            dataIndex: 'sd_detno',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '物料编号',
+            dataIndex: 'sd_prodcode',
+            width: 120
+        }, {
+            text: '数量',
+            dataIndex: 'sd_qty',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '单价',
+            dataIndex: 'sd_price',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '已转数',
+            dataIndex: 'sd_ytqy',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '已出货数',
+            dataIndex: 'sd_sendqty',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '已审核采购单数',
+            dataIndex: 'sd_pdqty',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '备注',
+            dataIndex: 'sd_remark',
+            width: 250,
+            flex: 1
+        }]
+    }
+});

+ 116 - 0
frontend/saas-web/app/view/sale/saleIn/QueryPanelController.js

@@ -0,0 +1,116 @@
+Ext.define('saas.view.sale.sale.QueryPanelController', {
+    extend: 'saas.view.core.query.QueryPanelController',
+    alias: 'controller.sale-sale-querypanel',
+    init: function (form) {
+        var me = this;
+        this.control({
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=sa_custcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        dataUrl:'http://192.168.0.181:8570/api/document/customer/getCustomerByCondition',
+                        dbfinds:[{
+                            from:'cu_id',to:'sa_custid'
+                        },{
+                            from:'cu_code',to:'sa_custcode'
+                        },{
+                            from:'cu_name',to:'sa_custname'
+                        }],
+                        dbtpls:[{
+                            field:'cu_code',width:100
+                        },{
+                            field:'cu_name',width:100
+                        }],
+                        dbColumns:[{
+                            conditionCode:'cu_id',
+                            "text": "客户ID",
+                            "flex": 0,
+                            "dataIndex": "cu_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            conditionCode:'cu_code',
+                            "text": "客户编号",
+                            "flex": 1,
+                            "dataIndex": "cu_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'cu_name',
+                            "text": "客户名称",
+                            "flex": 1,
+                            "dataIndex": "cu_name",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'cu_type',
+                            "text": "客户类型",
+                            "flex": 0,
+                            "dataIndex": "cu_type",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            },
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=pd_prodcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        conditionCode:'pr_code',
+                        dataUrl:'http://192.168.253.41:9480/api/document/product/getProductsByCondition',
+                        dbfinds:[{
+                            from:'pr_code',to:'sd_prodcode'
+                        }],
+                        dbtpls:[{
+                            field:'pr_code',width:100
+                        },{
+                            field:'pr_detail',width:100
+                        }],
+                        dbColumns:[{
+                            "text": "物料ID",
+                            "flex": 0,
+                            "dataIndex": "pr_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            "text": "物料编号",
+                            "flex": 1,
+                            "dataIndex": "pr_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料名称",
+                            "flex": 1,
+                            "dataIndex": "pr_detail",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料规格",
+                            "flex": 0,
+                            "dataIndex": "pr_spec",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            "text": "物料单位",
+                            "flex": 0,
+                            "dataIndex": "pr_unit",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            }
+        });
+
+    }
+});

+ 5 - 0
frontend/saas-web/app/view/sale/saleIn/QueryPanelModel.js

@@ -0,0 +1,5 @@
+Ext.define('saas.view.sale.sale.QueryPanelModel', {
+    extend: 'saas.view.core.query.QueryPanelModel',
+    alias: 'viewmodel.sale-sale-querypanel'
+
+});

+ 5 - 5
frontend/saas-web/app/view/test/order/FormPanel.js

@@ -15,11 +15,11 @@ Ext.define('saas.view.test.order.FormPanel', {
     _statusCodeField: 'pu_statuscode',
     _detnoColumn:  'pd_detno',
     _relationColumn: 'pd_puid',
-    _readUrl:'http://192.168.253.58:8800/purchase/read/',
-    _saveUrl:'http://192.168.253.58:8800/purchase/save',
-    _auditUrl:'http://192.168.253.58:8800/purchase/audit',
-    _deleteUrl:'http://192.168.253.58:8800/purchase/delete/',
-    _deleteDetailUrl:'http://192.168.253.58:8800/purchase/deleteItem/',
+    _readUrl:'http://192.168.253.228:8800/purchase/read/',
+    _saveUrl:'http://192.168.253.228:8800/purchase/save',
+    _auditUrl:'http://192.168.253.228:8800/purchase/audit',
+    _deleteUrl:'http://192.168.253.228:8800/purchase/delete/',
+    _deleteDetailUrl:'http://192.168.253.228:8800/purchase/deleteItem/',
     initId:0,
 
     toolBtns: [{

+ 2 - 0
frontend/saas-web/overrides/i18n.js

@@ -1,3 +1,5 @@
+var basePath = '';
+
 function openTab(xtype, title, id) {
     var mainTab = Ext.getCmp('main-tab-panel');
     var panel = Ext.getCmp(id);