guq 7 жил өмнө
parent
commit
f1ae67a2e9

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

@@ -172,7 +172,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         //更新明细金额等
         setTotal(prodInOutNow);
         //日志
-       messageLogService.update(baseDTO);
+        messageLogService.update(baseDTO);
         return baseDTO;
 
     }
@@ -415,7 +415,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         targetPi.setPi_recordmanid(BaseContextHolder.getUserId());
         targetPi.setPi_recorddate(new Date());
         targetPi.setPi_recordman("TESTADMIN");
-
+        targetPi.setPi_ioid(id);
         targetPi.setPi_inoutno(piInoutno);
         targetPi.setPi_class(BillCodeSeq.SALEIN.getName());
         targetPi.setPi_date(new Date());
@@ -623,14 +623,14 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             if(prodInOut.getPi_said()!=null) {
                 prodIODetailMapper.updateSaleYqty(prodInOut.getPi_said());
             }
-        }else{//销售退货单z
+        }else{//销售退货单
             //更新明细
             prodIODetailMapper.updatePDSaleIN(id);
             //更新主表
             prodInOutMapper.updatePiTotal(id);
             //出货单已转数
-            if(prodInOut.getPi_said()!=null){
-                prodIODetailMapper.updateSaleOutYqty(prodInOut.getPi_said());
+            if(prodInOut.getPi_ioid()!= null) {
+                prodIODetailMapper.updateSaleOutYqty(prodInOut.getPi_ioid());
             }
         }
     }

+ 6 - 11
applications/sale/sale-server/src/main/resources/mapper/ProdIODetailMapper.xml

@@ -739,18 +739,13 @@
   </update>
 
   <update id="updateSaleOutYqty" parameterType="long">
-update prodiodetail a
-  set a.pd_yqty =ifnull((select  b.pd_inqty  from  (
+   update prodiodetail a
+   set a.pd_yqty =ifnull(
+	 (select  b.pd_inqty  from  (
 	select pd_ioid,sum(pd_inqty) pd_inqty from  prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='销售退货单'
-  and pi_said=#{id}  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_said=#{id} and pi_class='出货单');
-  </update>
-  <update id="updateSaleYqty" parameterType="long">
-
-    update saledetail a set a.sd_yqty =IFNULL( ( select b.pd_outqty from (
-    select pd_sdid,sum(pd_outqty) pd_outqty from prodiodetail left join
-    prodinout on pd_piid = pi_id where pd_piclass='出货单' and pi_said=#{id}
-    GROUP BY pd_sdid) b where IFNULL(b.pd_sdid ,0) = a.sd_id ),0) where a.sd_said =#{id}
+  and pi_ioid=#{id}  GROUP BY pd_ioid) b where ifnull(b.pd_ioid ,0)= a.pd_id ),
+	0)
+  where a.pd_piid =#{id}
   </update>
 
   <select id="selectByFK" parameterType="long" resultMap="BaseResultMap">

+ 2 - 0
applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/ProdInOut.java

@@ -70,4 +70,6 @@ public class ProdInOut extends CommonBaseEntity implements Serializable {
     private String pi_auditman;
 
     private String pi_remark;
+
+    private Long pi_ioid;
 }