Forráskód Böngészése

修改客户资料和供应商资料期初月份的应收/应付结转后不允许再修改期初应收/期初应付

zhoudw 7 éve
szülő
commit
8f3055912f

+ 1 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomerMapper.java

@@ -26,4 +26,5 @@ public interface CustomerMapper extends CommonBaseMapper<Customer> {
 
     int validNameAndCodeWhenUpdate(Customer record);
 
+    int validFinish(@Param("id") Long id,@Param("companyId") Long companyId);
 }

+ 2 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorMapper.java

@@ -26,4 +26,6 @@ public interface VendorMapper extends CommonBaseMapper<Vendor> {
     int getCountByCode(@Param("code") String code, @Param("companyId") Long companyId);
 
     int getCountByName(@Param("name") String name, @Param("companyId") Long companyId);
+
+    int validFinish(@Param("id") Long id,@Param("companyId") Long companyId);
 }

+ 10 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerServiceImpl.java

@@ -178,6 +178,16 @@ public class CustomerServiceImpl extends CommonBaseServiceImpl<CustomerMapper, C
             throw new BizException(500, "客户名称或编号重复");
         }
 
+        //检查期初日期是否已结转
+        count = getMapper().validFinish(cu_id,companyId);
+        if (count>0) {
+            Customer cutpl = getMapper().selectByPrimaryKey(cu_id);
+            //期初应收
+            customer.setCu_beginaramount(cutpl.getCu_beginaramount());
+            //期初预收
+            customer.setCu_beginprerecamount(cutpl.getCu_beginprerecamount());
+        }
+
         //更新操作
         getMapper().updateByPrimaryKeySelective(customer);
         //添加从表传输对象

+ 11 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/VendorServiceImpl.java

@@ -138,6 +138,7 @@ public class VendorServiceImpl extends CommonBaseServiceImpl<VendorMapper, Vendo
             messageLogService.save(generateMsgObj(mainId, code));
         }else{
             code = main.getVe_code();
+            Long mainId = main.getId();
             Vendor oldVendor = getMapper().selectByPrimaryKey(main.getId());
             int count = getMapper().getCountByCode(code, companyId);
             if (!code.equals(oldVendor.getVe_code())){
@@ -152,6 +153,16 @@ public class VendorServiceImpl extends CommonBaseServiceImpl<VendorMapper, Vendo
                 }
             }
 
+            //检查期初日期是否已结转
+            count = getMapper().validFinish(mainId,companyId);
+            if (count>0) {
+                Vendor vendortpl = getMapper().selectByPrimaryKey(mainId);
+                //期初应收
+                main.setVe_beginapamount(vendortpl.getVe_beginapamount());
+                //期初预收
+                main.setVe_beginprepayamount(vendortpl.getVe_beginprepayamount());
+            }
+
             getMapper().updateByPrimaryKeySelective(main);
             if (items.size() > 0) {
                 List<Vendorcontact> updateItems = new ArrayList<Vendorcontact>();

+ 7 - 0
applications/document/document-server/src/main/resources/mapper/CustomerMapper.xml

@@ -386,4 +386,11 @@
     where cu_id = #{id,jdbcType=INTEGER}
   </select>
 
+  <select id="validFinish" parameterType="long" resultType="int">
+  select count(1) from periodsdetail where pd_status=99 and pd_detno=(select DATE_FORMAT(cu_begindate,'%Y%m') from customer where cu_id =#{id})
+  and companyId =#{companyId};
+  </select>
+
+
+
 </mapper>

+ 6 - 0
applications/document/document-server/src/main/resources/mapper/VendorMapper.xml

@@ -471,5 +471,11 @@
     <select id="getCountByName" resultType="int">
         SELECT COUNT(*) FROM VENDOR WHERE COMPANYID = #{companyId} AND VE_NAME=#{name}
     </select>
+
+    <select id="validFinish" parameterType="long" resultType="int">
+        select count(1) from periodsdetail where pd_status=99 and pd_detno=(select DATE_FORMAT(ve_begindate,'%Y%m') from vendor where ve_id =#{id})
+        and companyId =#{companyId};
+    </select>
+
 </mapper>