Browse Source

修改采购,库存模块

zhoudw 7 years ago
parent
commit
04fd0774c1

+ 3 - 1
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java

@@ -56,7 +56,7 @@ public enum BizExceptionCode implements BaseExceptionCode {
     VENDOR_ISCLOSE(79505, "供应商已关闭"),
     PRODUCT_ISCLOSE(79506, "物料已关闭"),
     CUSTOMER_ISCLOSE(79507, "客户资料已关闭"),
-
+    REQUIREDFIELD_NULL(79508,"存在必填字段未空"),
 
     //采购 70000-71999
     PURCCHECKIN_POST_ERROR(70000,""),
@@ -65,6 +65,8 @@ public enum BizExceptionCode implements BaseExceptionCode {
     PURCHASE_ORDER_HASAUDIT(70002, "存在已审核单据,单据编号:%s"),
     PURCHASE_ORDER_HASUNAUDIT(70003, "存在未审核单据,单据编号:%s"),
 
+
+
     //销售
     SALE_ALL_TURNOUT(72000, "该销售单已全部转出货,无法转出货单"),
     SALE_CLOSE(72001, "单据已关闭,无法进行操作"),

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

@@ -38,4 +38,8 @@ public interface PurchaseMapper extends CommonBaseMapper<Purchase>{
     Integer validateProduct(@Param("id") Long id);
 
     void updateDelivery(@Param("id")Long id);
+
+    Integer checkPurchaseRequiredField(Long id);
+
+
 }

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

@@ -498,12 +498,18 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
     public Result singleAudit(Long id) {
         DocBaseDTO docBaseDTO = getBaseDTOById(id);
         Result result = Result.success(docBaseDTO);
+
         //检查供应商是否开启状态
         Integer count =0;
         count = purchaseMapper.validateVendor(id);
         if (count != 0) {
             throw new BizException(BizExceptionCode.VENDOR_ISCLOSE);
         }
+        //检验必填项
+        count = getMapper().checkPurchaseRequiredField(id);
+        if (count>0){
+            throw new BizException(BizExceptionCode.REQUIREDFIELD_NULL);
+        }
         //检查物料是否开启状态
         count = purchaseMapper.validateProduct(id);
         if (count != 0) {

+ 3 - 0
applications/purchase/purchase-server/src/main/resources/mapper/PurchaseMapper.xml

@@ -443,5 +443,8 @@
     update purchasedetail set PD_DELIVERY = (select PU_DELIVERY from purchase where pu_id=#{id}) where pd_puid=#{id} and PD_DELIVERY is null
   </update>
 
+  <select id="checkPurchaseRequiredField" resultType="int" parameterType="long">
+    select count(1) from purchase where pu_id = #{id} and (pu_vendid is null or pu_delivery is null or pu_shipaddresscode is null)
+  </select>
 
 </mapper>

+ 1 - 1
applications/storage/storage-server/src/main/resources/mapper/StockTakingMapper.xml

@@ -266,7 +266,7 @@
     count(a.st_prodid)
     from
     (select pd_prodid,pd_whid from prodiodetail left join prodinout on pd_piid = pi_id
-    where prodinout.companyId=#{companyId,jdbcType=INTEGER} and (pi_remark='盘盈单' or pi_remark='盘亏单')) b
+    where prodinout.companyId=#{companyId,jdbcType=INTEGER} and pi_statuscode!='AUDITED' and (pi_remark='盘盈单' or pi_remark='盘亏单')) b
     left join
     (select st_prodid,st_whid from stocktaking where companyId=#{companyId} ) a
     on a.st_prodid = b.pd_prodid and a.st_whid = b.pd_whid