Переглянути джерело

采购验收单转采购验退单

zhoudw 7 роки тому
батько
коміт
869ecf26ea
17 змінених файлів з 164 додано та 45 видалено
  1. 2 1
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/ProdIODetailDTO.java
  2. 1 0
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/ProdInOutDTO.java
  3. 1 1
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/ProdInOutListDTO.java
  4. 1 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchasedetailMapper.java
  5. 1 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/ProdIODetail.java
  6. 2 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/ProdInOut.java
  7. 3 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/ProdInOutList.java
  8. 20 13
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java
  9. 2 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  10. 32 16
      applications/purchase/purchase-server/src/main/resources/mapper/ProdIODetailMapper.xml
  11. 9 0
      applications/purchase/purchase-server/src/main/resources/mapper/ProdInOutListMapper.xml
  12. 37 8
      applications/purchase/purchase-server/src/main/resources/mapper/ProdInOutMapper.xml
  13. 2 2
      applications/purchase/purchase-server/src/main/resources/mapper/PurchasedetailMapper.xml
  14. 13 1
      frontend/saas-web/app/view/purchase/purchase/FormPanel.js
  15. 2 1
      frontend/saas-web/app/view/purchase/purchase/QueryPanel.js
  16. 24 0
      frontend/saas-web/app/view/purchase/purchaseIn/FormPanel.js
  17. 12 0
      frontend/saas-web/app/view/purchase/purchaseOut/FormPanel.js

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

@@ -78,8 +78,9 @@ public class ProdIODetailDTO extends CommonBaseEntity implements Serializable {
 
     private Integer pd_ym;
 
-    private Double pd_yqty;
+    private Integer pd_yqty;
 
     private String pd_remark;
 
+    private Long pd_ioid;
 }

+ 1 - 0
applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/ProdInOutDTO.java

@@ -69,6 +69,7 @@ public class ProdInOutDTO extends CommonBaseEntity implements Serializable {
 
     private String pi_address;
 
+    private Long pi_inid;
 
 
 }

+ 1 - 1
applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/ProdInOutListDTO.java

@@ -133,7 +133,7 @@ public class ProdInOutListDTO extends CommonBaseEntity implements Serializable {
 
     private Integer pd_ym;
 
-    private Double pd_yqty;
+    private Integer pd_yqty;
 
     private String pd_remark;
 

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

@@ -27,7 +27,7 @@ public interface PurchasedetailMapper extends CommonBaseMapper<Purchase> {
 
     List<PurchaseDetail> selectByFK(Long fk_i);
 
-    void updatePurchaseYqty(Long pd_piid);
+    void updatePurchaseYqty(Integer pu_id);
 
 
 }

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

@@ -77,5 +77,6 @@ public class ProdIODetail extends CommonBaseEntity implements Serializable {
 
     private String pd_remark;
 
+    private Long pd_ioid;
 
 }

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

@@ -62,4 +62,6 @@ public class ProdInOut extends CommonBaseEntity implements Serializable {
 
     private String pi_address;
 
+    private Long pi_inid;
+
 }

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

@@ -66,6 +66,8 @@ public class ProdInOutList extends CommonBaseEntity{
 
     private String pi_address;
 
+    private Long pi_inid;
+
     private Long pd_piid;
 
     private String pd_inoutno;
@@ -136,5 +138,6 @@ public class ProdInOutList extends CommonBaseEntity{
 
     private String pd_remark;
 
+    private Long pd_ioid;
 
 }

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

@@ -19,10 +19,7 @@ import com.usoftchina.saas.purchase.dto.ProdInOutDTO;
 import com.usoftchina.saas.purchase.dto.ProdInOutFormDTO;
 import com.usoftchina.saas.purchase.dto.ProdInOutReqDTO;
 import com.usoftchina.saas.purchase.mapper.*;
-import com.usoftchina.saas.purchase.po.ProdIODetail;
-import com.usoftchina.saas.purchase.po.ProdIODetailExample;
-import com.usoftchina.saas.purchase.po.ProdInOut;
-import com.usoftchina.saas.purchase.po.ProdInOutList;
+import com.usoftchina.saas.purchase.po.*;
 import com.usoftchina.saas.purchase.service.ProdInOutService;
 import com.usoftchina.saas.utils.BeanMapper;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -141,6 +138,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
                 detail.setPd_piid(pi_id);
                 detail.setPd_inoutno(pi_inoutno);
                 detail.setPd_piclass(prodInOut.getPi_class());
+                detail.setPd_yqty(0);
                 insertDetails.add(detail);
             }
             //插入从表
@@ -157,6 +155,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             ProdIODetail detail = BeanMapper.map(item, ProdIODetail.class);
             detail.setPd_piid(pi_id);
             detail.setPd_inoutno(pi_inoutno);
+            detail.setPd_piclass(prodInOut.getPi_class());
             if (StringUtils.isEmpty(detail.getId()) || "0".equals(detail.getId().toString())) {
                 insertDetails.add(detail);
             } else {
@@ -174,7 +173,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         saveDTO.setId(pi_id);
         //更新已转数
         if (!isbfaudit)
-            updateYqty(pi_id,prodInOut.getPi_class());
+            updateYqty(prodInOut);
         return saveDTO;
     }
 
@@ -196,7 +195,9 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             cta.andPd_piidEqualTo(prodInOut.getId().intValue());
             prodIODetailMapper.deleteByExample(prodIODetailExample);
             //更新已转数
-            updateYqty(id,prodInOut.getPi_class());
+//            updateYqty(prodInOut.getPi_puid(),prodInOut.getPi_class());
+            updateYqty(prodInOut);
+
        }
     }
 
@@ -257,8 +258,9 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
     public void deleteItem(Long id) {
         ProdIODetail prodIODetail = prodIODetailMapper.selectByPrimaryKey(id);
         prodIODetailMapper.deleteByPrimaryKey(id);
+        ProdInOut prodInOut = getMapper().selectByPrimaryKey(prodIODetail.getPd_piid());
         //更新已转数
-        updateYqty(prodIODetail.getPd_piid(),prodIODetail.getPd_piclass());
+        updateYqty(prodInOut);
     }
 
     @Override
@@ -271,12 +273,13 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         }
     }
 
-    private void updateYqty(Long pd_piid,String piclass) {
-        //更新已转数
-        if ("采购验收单".equals(piclass)){
-            purchasedetailMapper.updatePurchaseYqty(pd_piid);
-        }else if ("采购验退单".equals(piclass)){
+    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());
         }
 
 
@@ -312,17 +315,20 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         String piInoutno = "YT0001";
         targetPi.setPi_inoutno(piInoutno);
         targetPi.setPi_class("采购验退单");
+        targetPi.setPi_date(new Date());
         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_pucode(sourcePi.getPi_pucode());
+        targetPi.setPi_inid(sourcePi.getId());
+
         //设置公司id
         targetPi.setCompanyId(sourcePi.getCompanyId());
         //保存数据
         getMapper().insertSelective(targetPi);
         //插入验退单从表
-        long pi_id = sourcePi.getId();
+        long pi_id = targetPi.getId();
 
          for (int i = 0;i<sourcePids.size();i++){
              ProdIODetail sourcePid = sourcePids.get(i);
@@ -337,6 +343,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
              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());
 

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

@@ -121,6 +121,7 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
                 PurchaseDetail detail = BeanMapper.map(item, PurchaseDetail.class);
                 detail.setPd_puid(pu_id);
                 detail.setPd_code(pu_code);
+                detail.setPd_yqty(new Double(0));
                 insertDetails.add(detail);
             }
             //插入从表
@@ -288,7 +289,7 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         //检查转单状态
         String acceptstatus = purchase.getPu_acceptstatuscode();
 
-        if (acceptstatus.equals("TURNIN")){
+        if ("TURNIN".equals(acceptstatus)){
             return Result.error(ExceptionCode.TURNIN_EXIST);
         }
 

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

@@ -40,6 +40,7 @@
     <result column="pd_text5" jdbcType="VARCHAR" property="pd_text5" />
     <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" />
   </resultMap>
   <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.usoftchina.saas.purchase.po.ProdIODetail">
     <result column="pd_remark" jdbcType="LONGVARCHAR" property="pd_remark" />
@@ -107,7 +108,7 @@
     pd_prodcode, pd_unit, pd_inqty, pd_outqty, pd_orderprice, pd_sendprice, pd_price, 
     pd_total, pd_taxrate, pd_netprice, pd_nettotal, pd_whid, pd_whcode, pd_whname, pd_inwhid, 
     pd_inwhcode, pd_inwhname, pd_orderid, pd_sdid, pd_status, companyid, updaterid, updatetime, 
-    pd_text1, pd_text2, pd_text3, pd_text4, pd_text5, pd_ym, pd_yqty
+    pd_text1, pd_text2, pd_text3, pd_text4, pd_text5, pd_ym, pd_yqty,pd_ioid
   </sql>
   <sql id="Blob_Column_List">
     pd_remark
@@ -173,7 +174,7 @@
       pd_status, companyid, updaterid, 
       updatetime, pd_text1, pd_text2, 
       pd_text3, pd_text4, pd_text5, 
-      pd_ym, pd_yqty, pd_remark
+      pd_ym, pd_yqty, pd_remark,pd_ioid
       )
     values (#{pd_id,jdbcType=INTEGER}, #{pd_piid,jdbcType=INTEGER}, #{pd_inoutno,jdbcType=VARCHAR}, 
       #{pd_piclass,jdbcType=VARCHAR}, #{pd_pdno,jdbcType=INTEGER}, #{pd_ordercode,jdbcType=VARCHAR}, 
@@ -187,7 +188,8 @@
       #{pd_status,jdbcType=INTEGER}, #{companyid,jdbcType=INTEGER}, #{updaterid,jdbcType=INTEGER}, 
       #{updatetime,jdbcType=TIMESTAMP}, #{pd_text1,jdbcType=VARCHAR}, #{pd_text2,jdbcType=VARCHAR}, 
       #{pd_text3,jdbcType=VARCHAR}, #{pd_text4,jdbcType=VARCHAR}, #{pd_text5,jdbcType=VARCHAR}, 
-      #{pd_ym,jdbcType=INTEGER}, #{pd_yqty,jdbcType=INTEGER}, #{pd_remark,jdbcType=LONGVARCHAR}
+      #{pd_ym,jdbcType=INTEGER}, #{pd_yqty,jdbcType=INTEGER}, #{pd_remark,jdbcType=LONGVARCHAR},
+      #{pd_ioid,jdbcType=INTEGER}
       )
   </insert>
   <insert id="insertSelective" parameterType="com.usoftchina.saas.purchase.po.ProdIODetail">
@@ -311,6 +313,11 @@
       <if test="pd_remark != null">
         pd_remark,
       </if>
+      <if test="pd_ioid != null">
+        pd_ioid,
+      </if>
+
+
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
 
@@ -428,6 +435,9 @@
       <if test="pd_remark != null">
         #{pd_remark,jdbcType=LONGVARCHAR},
       </if>
+      <if test="pd_ioid != null">
+        #{pd_ioid,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.usoftchina.saas.purchase.po.ProdIODetailExample" resultType="java.lang.Long">
@@ -556,6 +566,10 @@
       <if test="record.pd_remark != null">
         pd_remark = #{record.pd_remark,jdbcType=LONGVARCHAR},
       </if>
+      <if test="record.pd_ioid != null">
+        pd_ioid = #{record.pd_ioid,jdbcType=INTEGER},
+      </if>
+
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -601,7 +615,8 @@
       pd_text5 = #{record.pd_text5,jdbcType=VARCHAR},
       pd_ym = #{record.pd_ym,jdbcType=INTEGER},
       pd_yqty = #{record.pd_yqty,jdbcType=INTEGER},
-      pd_remark = #{record.pd_remark,jdbcType=LONGVARCHAR}
+      pd_remark = #{record.pd_remark,jdbcType=LONGVARCHAR},
+      pd_ioid = #{record.pd_ioid,jdbcType=INTEGER}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -645,7 +660,8 @@
       pd_text4 = #{record.pd_text4,jdbcType=VARCHAR},
       pd_text5 = #{record.pd_text5,jdbcType=VARCHAR},
       pd_ym = #{record.pd_ym,jdbcType=INTEGER},
-      pd_yqty = #{record.pd_yqty,jdbcType=INTEGER}
+      pd_yqty = #{record.pd_yqty,jdbcType=INTEGER},
+      pd_ioid = #{record.pd_ioid,jdbcType=INTEGER}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -767,6 +783,9 @@
       <if test="pd_remark != null">
         pd_remark = #{pd_remark,jdbcType=LONGVARCHAR},
       </if>
+      <if test="pd_ioid != null">
+        pd_ioid = #{pd_ioid,jdbcType=LONGVARCHAR},
+      </if>
     </set>
     where pd_id = #{id,jdbcType=INTEGER}
   </update>
@@ -809,7 +828,8 @@
       pd_text5 = #{pd_text5,jdbcType=VARCHAR},
       pd_ym = #{pd_ym,jdbcType=INTEGER},
       pd_yqty = #{pd_yqty,jdbcType=INTEGER},
-      pd_remark = #{pd_remark,jdbcType=LONGVARCHAR}
+      pd_remark = #{pd_remark,jdbcType=LONGVARCHAR},
+      pd_ioid = #{pd_ioid,jdbcType=INTEGER}
     where pd_id = #{pd_id,jdbcType=INTEGER}
   </update>
   <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.purchase.po.ProdIODetail">
@@ -850,7 +870,8 @@
       pd_text4 = #{pd_text4,jdbcType=VARCHAR},
       pd_text5 = #{pd_text5,jdbcType=VARCHAR},
       pd_ym = #{pd_ym,jdbcType=INTEGER},
-      pd_yqty = #{pd_yqty,jdbcType=INTEGER}
+      pd_yqty = #{pd_yqty,jdbcType=INTEGER},
+      pd_ioid = #{pd_ioid,jdbcType=INTEGER}
     where pd_id = #{pd_id,jdbcType=INTEGER}
   </update>
 
@@ -927,15 +948,10 @@
   </update>
 
   <update id="updatePurchaseYqty" parameterType="java.lang.Long">
-    update purchasedetail
-    join
-    (select b.yqty,b.pd_orderid FROM
-    (select pd_orderid from prodiodetail where pd_piid = #{id,jdbcType=INTEGER}) a
-    left join
-    (select sum(pd_inqty)-sum(pd_outqty) yqty,pd_orderid from prodiodetail  left join  prodinout on pd_piid = pi_id  where pi_statuscode='AUDITED'
-    GROUP BY pd_orderid) b on a.pd_orderid = b.pd_orderid) c
-    on pd_id = c.pd_orderid
-    set PD_YQTY = c.yqty
+
+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}
   </update>
 
 

+ 9 - 0
applications/purchase/purchase-server/src/main/resources/mapper/ProdInOutListMapper.xml

@@ -24,6 +24,13 @@
     <result column="pi_statuscode" jdbcType="VARCHAR" property="pi_statuscode" />
     <result column="pi_printstatus" jdbcType="VARCHAR" property="pi_printstatus" />
     <result column="pi_printstatuscode" jdbcType="VARCHAR" property="pi_printstatuscode" />
+    <result column="pi_text1" jdbcType="VARCHAR" property="pi_text1" />
+    <result column="pi_text2" jdbcType="VARCHAR" property="pi_text2" />
+    <result column="pi_text3" jdbcType="VARCHAR" property="pi_text3" />
+    <result column="pi_text4" jdbcType="VARCHAR" property="pi_text4" />
+    <result column="pi_text5" jdbcType="VARCHAR" property="pi_text5" />
+    <result column="pi_address" jdbcType="VARCHAR" property="pi_address" />
+    <result column="pi_inid" jdbcType="INTEGER" property="pi_inid" />
     <result column="pd_piid" jdbcType="INTEGER" property="pd_piid" />
     <result column="pd_inoutno" jdbcType="VARCHAR" property="pd_inoutno" />
     <result column="pd_piclass" jdbcType="VARCHAR" property="pd_piclass" />
@@ -61,6 +68,8 @@
     <result column="pd_text5" jdbcType="VARCHAR" property="pd_text5" />
     <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" />
+
   </resultMap>
 
 

+ 37 - 8
applications/purchase/purchase-server/src/main/resources/mapper/ProdInOutMapper.xml

@@ -32,6 +32,9 @@
     <result column="pi_text3" jdbcType="VARCHAR" property="pi_text3" />
     <result column="pi_text4" jdbcType="VARCHAR" property="pi_text4" />
     <result column="pi_text5" jdbcType="VARCHAR" property="pi_text5" />
+    <result column="pi_inid" jdbcType="INTEGER" property="pi_inid" />
+
+
   </resultMap>
   <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.usoftchina.saas.purchase.po.ProdInOut">
     <result column="pi_address" jdbcType="LONGVARCHAR" property="pi_address" />
@@ -98,7 +101,7 @@
     pi_id, pi_inoutno, pi_class, pi_date, pi_vendid, pi_vendcode, pi_vendname, pi_custid, 
     pi_custcode, pi_custname, pi_puid, pi_pucode, pi_said, pi_sacode, pi_total, pi_recordmanid, 
     pi_recordman, pi_recorddate, pi_status, pi_statuscode, pi_printstatus, pi_printstatuscode, 
-    companyid, updaterid, updatetime, pi_text1, pi_text2, pi_text3, pi_text4, pi_text5
+    companyid, updaterid, updatetime, pi_text1, pi_text2, pi_text3, pi_text4, pi_text5,pi_inid
   </sql>
   <sql id="Blob_Column_List">
     pi_address
@@ -161,8 +164,8 @@
       pi_status, pi_statuscode, pi_printstatus, 
       pi_printstatuscode, companyid, updaterid, 
       updatetime, pi_text1, pi_text2, 
-      pi_text3, pi_text4, pi_text5, 
-      pi_address)
+      pi_text3, pi_text4, pi_text5,
+      pi_address,pi_inid)
     values (#{pi_id,jdbcType=INTEGER}, #{pi_inoutno,jdbcType=VARCHAR}, #{pi_class,jdbcType=VARCHAR}, 
       #{pi_date,jdbcType=TIMESTAMP}, #{pi_vendid,jdbcType=INTEGER}, #{pi_vendcode,jdbcType=VARCHAR}, 
       #{pi_vendname,jdbcType=VARCHAR}, #{pi_custid,jdbcType=INTEGER}, #{pi_custcode,jdbcType=VARCHAR}, 
@@ -173,7 +176,7 @@
       #{pi_printstatuscode,jdbcType=VARCHAR}, #{companyid,jdbcType=INTEGER}, #{updaterid,jdbcType=INTEGER}, 
       #{updatetime,jdbcType=TIMESTAMP}, #{pi_text1,jdbcType=VARCHAR}, #{pi_text2,jdbcType=VARCHAR}, 
       #{pi_text3,jdbcType=VARCHAR}, #{pi_text4,jdbcType=VARCHAR}, #{pi_text5,jdbcType=VARCHAR}, 
-      #{pi_address,jdbcType=LONGVARCHAR})
+      #{pi_address,jdbcType=LONGVARCHAR}.#{pi_inid,jdbcType=INTEGER})
   </insert>
   <insert id="insertSelective" parameterType="com.usoftchina.saas.purchase.po.ProdInOut">
     <selectKey resultType="java.lang.Long" keyProperty="id">
@@ -272,6 +275,9 @@
       <if test="pi_address != null">
         pi_address,
       </if>
+      <if test="pi_inid != null">
+        pi_inid,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
 
@@ -365,6 +371,11 @@
       <if test="pi_address != null">
         #{pi_address,jdbcType=LONGVARCHAR},
       </if>
+      <if test="pi_inid != null">
+        #{pi_inid,jdbcType=INTEGER},
+      </if>
+
+
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.usoftchina.saas.purchase.po.ProdInOutExample" resultType="java.lang.Long">
@@ -469,6 +480,10 @@
       <if test="record.pi_address != null">
         pi_address = #{record.pi_address,jdbcType=LONGVARCHAR},
       </if>
+      <if test="record.pi_inid != null">
+        pi_address = #{record.pi_inid,jdbcType=INTEGER},
+      </if>
+
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -506,7 +521,10 @@
       pi_text3 = #{record.pi_text3,jdbcType=VARCHAR},
       pi_text4 = #{record.pi_text4,jdbcType=VARCHAR},
       pi_text5 = #{record.pi_text5,jdbcType=VARCHAR},
-      pi_address = #{record.pi_address,jdbcType=LONGVARCHAR}
+      pi_address = #{record.pi_address,jdbcType=LONGVARCHAR},
+      pi_inid = #{record.pi_inid,jdbcType=INTEGER}
+
+
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -542,7 +560,10 @@
       pi_text2 = #{record.pi_text2,jdbcType=VARCHAR},
       pi_text3 = #{record.pi_text3,jdbcType=VARCHAR},
       pi_text4 = #{record.pi_text4,jdbcType=VARCHAR},
-      pi_text5 = #{record.pi_text5,jdbcType=VARCHAR}
+      pi_text5 = #{record.pi_text5,jdbcType=VARCHAR},
+      pi_inid = #{record.pi_inid,jdbcType=INTEGER}
+
+
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -640,6 +661,11 @@
       <if test="pi_address != null">
         pi_address = #{pi_address,jdbcType=LONGVARCHAR},
       </if>
+      <if test="pi_inid != null">
+        pi_inid = #{pi_inid,jdbcType=INTEGER},
+      </if>
+
+
     </set>
     where pi_id = #{id,jdbcType=INTEGER}
   </update>
@@ -674,7 +700,9 @@
       pi_text3 = #{pi_text3,jdbcType=VARCHAR},
       pi_text4 = #{pi_text4,jdbcType=VARCHAR},
       pi_text5 = #{pi_text5,jdbcType=VARCHAR},
-      pi_address = #{pi_address,jdbcType=LONGVARCHAR}
+      pi_address = #{pi_address,jdbcType=LONGVARCHAR},
+      pi_inid = #{pi_inid,jdbcType=INTEGER}
+
     where pi_id = #{pi_id,jdbcType=INTEGER}
   </update>
   <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.purchase.po.ProdInOut">
@@ -707,7 +735,8 @@
       pi_text2 = #{pi_text2,jdbcType=VARCHAR},
       pi_text3 = #{pi_text3,jdbcType=VARCHAR},
       pi_text4 = #{pi_text4,jdbcType=VARCHAR},
-      pi_text5 = #{pi_text5,jdbcType=VARCHAR}
+      pi_text5 = #{pi_text5,jdbcType=VARCHAR},
+      pi_inid = #{pi_inid,jdbcType=INTEGER}
     where pi_id = #{id,jdbcType=INTEGER}
   </update>
 </mapper>

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

@@ -415,12 +415,12 @@
       where pd_puid=#{pu_id} order by pd_detno
   </select>
 
-  <update id="updatePurchaseYqty" parameterType="long" >
+  <update id="updatePurchaseYqty" parameterType="integer" >
 update purchasedetail
 set pd_yqty=ifnull((select sum(IFNULL(pd_inqty,0)-IFNULL(pd_outqty,0))
 from prodiodetail
 where ((pd_piclass='采购验退单'  and pd_status=99 ) or pd_piclass='采购验收单') and IFNULL(pd_orderid,0)=purchasedetail.pd_id),0)
-where exists (select 1 from prodiodetail where pd_piid=#{pd_piid,jdbcType=INTEGER} and IFNULL(prodiodetail.pd_orderid,0)=purchasedetail.pd_id)
+where pd_puid=#{pu_id}
   </update>
 
 

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

@@ -167,7 +167,19 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
                 format:'0',
                 items : null,
                 summaryType: 'sum'
-            }, 
+            },
+            {
+                text : "已转数", 
+                dataIndex : "pd_yqty", 
+                editor : {
+                    xtype : "numberfield"
+                },
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                format:'0',
+                items : null,
+                summaryType: 'sum'
+            },
             {
                 text : "单价", 
                 editor : {

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

@@ -116,8 +116,9 @@ Ext.define('saas.view.purchase.purchase.QueryPanel', {
         _idField: 'pu_id',
         _codeField: 'pu_code',
         _title: '采购单',
+        _defaultCondition:'',
         _addXtype: 'purchase-purchase-formpanel',
-        _baseVastUrl: 'http://192.168.253.58:8800/purchase/',
+        _baseVastUrl: 'http://localhost:8800/purchase/',
         _baseColumn: [{
             text: '序号',
             width: 80,

+ 24 - 0
frontend/saas-web/app/view/purchase/purchaseIn/FormPanel.js

@@ -87,6 +87,13 @@ Ext.define('saas.view.purchase.purchaseIn.FormPanel', {
         readOnly: true,
         columnWidth : 0.25
     }, {
+        xtype : "hidden", 
+        name : "pi_puid", 
+        bind : "{pi_puid}", 
+        fieldLabel : "采购单id", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    },{
         xtype : "textfield", 
         name : "pi_pucode", 
         bind : "{pi_pucode}", 
@@ -154,6 +161,17 @@ Ext.define('saas.view.purchase.purchaseIn.FormPanel', {
                 format:'0',
                 items : null,
                 summaryType: 'sum'
+            },            {
+                text : "已转数", 
+                dataIndex : "pd_yqty", 
+                editor : {
+                    xtype : "numberfield"
+                },
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                format:'0',
+                items : null,
+                summaryType: 'sum'
             }, 
             {
                 text : "仓库", 
@@ -198,6 +216,12 @@ Ext.define('saas.view.purchase.purchaseIn.FormPanel', {
                 dataIndex : "pd_nettotal", 
                 xtype : "numbercolumn"
             },
+            {
+                text : "采购单明细id", 
+                dataIndex : "pd_orderid", 
+                width : 120.0,
+                hidden:true
+            },
             {
                 text : "采购单号", 
                 dataIndex : "pd_ordercode", 

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

@@ -88,6 +88,13 @@ Ext.define('saas.view.purchase.purchaseOut.FormPanel', {
         allowBlank : true, 
         columnWidth : 0.25
     }, {
+        xtype : "hidden", 
+        name : "pi_inid", 
+        bind : "{pi_inid}", 
+        fieldLabel : "出入库单id", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    },{
         name : "detailGridField", 
         xtype : "detailGridField", 
         columns : [
@@ -201,6 +208,11 @@ Ext.define('saas.view.purchase.purchaseOut.FormPanel', {
                 dataIndex : "pd_orderdetno", 
                 xtype : "numbercolumn",
                 flex:1
+            }, {
+                text : "出入库明细id", 
+                dataIndex : "pd_ioid", 
+                width : 120.0,
+                hidden:true
             }
         ]
     }, {