Browse Source

Merge branch 'dev' of ssh://10.10.100.21/source/saas-platform into dev

zhuth 7 years ago
parent
commit
d882f8ab31
16 changed files with 65 additions and 55 deletions
  1. 0 9
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/dto/ListReqDTO.java
  2. 0 2
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/CommonMapper.java
  3. 3 1
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/EndProductMapper.java
  4. 1 4
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/CommonServiceImpl.java
  5. 6 2
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/EndProductServiceImpl.java
  6. 0 3
      applications/commons/commons-server/src/main/resources/mapper/CommonMapper.xml
  7. 6 2
      applications/commons/commons-server/src/main/resources/mapper/EndProductMapper.xml
  8. 2 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductMapper.java
  9. 6 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java
  10. 15 0
      applications/document/document-server/src/main/resources/mapper/ProductMapper.xml
  11. 1 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/CustomerCheckViewMapper.java
  12. 1 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/VendorAcountViewMapper.java
  13. 11 10
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/MoneyReportServiceImpl.java
  14. 6 7
      applications/money/money-server/src/main/resources/mapper/CustomerCheckViewMapper.xml
  15. 6 7
      applications/money/money-server/src/main/resources/mapper/VendorAcountViewMapper.xml
  16. 1 5
      frontend/saas-web/app/view/stock/appropriationInOut/QueryPanel.js

+ 0 - 9
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/dto/ListReqDTO.java

@@ -21,15 +21,6 @@ public class ListReqDTO implements Serializable {
 
     private String calculateFields;
 
-    private String ym;
-
-    public String getYm() {
-        return ym;
-    }
-
-    public void setYm(String ym) {
-        this.ym = ym;
-    }
 
     //将列拼成查询语句,直接查询出数据的格式为json
     public String getCalculateFieldsSql() {

+ 0 - 2
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/CommonMapper.java

@@ -4,8 +4,6 @@ import org.apache.ibatis.annotations.Param;
 
 public interface CommonMapper {
 
-    int getCountBaseSet(@Param("companyId") Long companyId);
-
     int getCountWarehouse(@Param("companyId") Long companyId);
 
     int getCountProduct(@Param("companyId") Long companyId);

+ 3 - 1
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/EndProductMapper.java

@@ -10,7 +10,7 @@ public interface EndProductMapper {
 
     void endProduct(Map<String, Object> map);
 
-    void endFund(Map<String, Object> map);
+    void end(Map<String, Object> map);
 
     String selectPeriod(@Param("companyId") Long companyId);
 
@@ -20,6 +20,8 @@ public interface EndProductMapper {
 
     void updatePeriodStatus(@Param("status") Long status,@Param("period") String period, @Param("companyId") Long companyId);
 
+    void updateRe(@Param("ym") String ym, @Param("companyId") Long companyId);
+
     int checkPay(Long companyId);
     int checkRec(Long companyId);
     void deleteSub(Long companyId);

+ 1 - 4
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/CommonServiceImpl.java

@@ -23,10 +23,7 @@ public class CommonServiceImpl implements CommonService {
         InitStatusDTO result = new InitStatusDTO();
         int count = 0;
         Long companyId = BaseContextHolder.getCompanyId();
-        count = commonMapper.getCountBaseSet(companyId);
-        if (count > 0){
-            result.setBaseSet(true);
-        }
+        result.setBaseSet(true);
         count = commonMapper.getCountWarehouse(companyId);
         if (count > 0){
             result.setWarehouse(true);

+ 6 - 2
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/EndProductServiceImpl.java

@@ -16,6 +16,7 @@ import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 
 import java.util.HashMap;
@@ -55,6 +56,7 @@ public class EndProductServiceImpl implements EndProductService {
         return map;
     }
 
+    @Transactional
     @Override
     public String endAccount() {
         String period = endProductMapper.selectPeriod(BaseContextHolder.getCompanyId());
@@ -63,14 +65,15 @@ public class EndProductServiceImpl implements EndProductService {
         map.put("yearMonth", period);
         map.put("companyId", BaseContextHolder.getCompanyId());
         map.put("result", null);
-        endProductMapper.endProduct(map);
-        endProductMapper.endFund(map);
+//        endProductMapper.endProduct(map);
+        endProductMapper.end(map);
         endProductMapper.updatePeriodStatus(99L, period, BaseContextHolder.getCompanyId());
         DocBaseDTO docBaseDTO = generateMsgObj(Long.parseLong(period));
         messageLogService.customizeLog(docBaseDTO, Operation.ENDPRODUCT);
         return String.valueOf(map.get("result"));
     }
 
+    @Transactional
     @Override
     public void unEndAccount() {
         int payc = endProductMapper.checkPay(BaseContextHolder.getCompanyId());
@@ -84,6 +87,7 @@ public class EndProductServiceImpl implements EndProductService {
         if (StringUtils.isEmpty(period)){
             throw new BizException(BizExceptionCode.BIZ_UNENDPRODUCT);
         }else{
+            endProductMapper.updateRe(period, BaseContextHolder.getCompanyId());
             endProductMapper.updatePeriodStatus(0L, period, BaseContextHolder.getCompanyId());
             messageLogService.customizeLog(generateMsgObj(Long.parseLong(period)), Operation.UNENDPRODUCT);
         }

+ 0 - 3
applications/commons/commons-server/src/main/resources/mapper/CommonMapper.xml

@@ -1,9 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.usoftchina.saas.commons.mapper.CommonMapper" >
-    <select id="getCountBaseSet" resultType="int">
-        SELECT COUNT(*) FROM ENTERPRISE WHERE COMPANYID = #{companyId}
-    </select>
     <select id="getCountWarehouse" resultType="int">
         SELECT COUNT(*) FROM WAREHOUSE WHERE COMPANYID=#{companyId} AND WH_STATUSCODE = 'OPEN'
     </select>

+ 6 - 2
applications/commons/commons-server/src/main/resources/mapper/EndProductMapper.xml

@@ -29,14 +29,18 @@
         CALL SP_ENDPRODUCT(?, ?, ?)
     </select>
 
-    <select id="endFund" parameterMap="spParamMap" statementType="CALLABLE">
-        CALL SP_ENDFUND(?, ?, ?)
+    <select id="end" parameterMap="spParamMap" statementType="CALLABLE">
+        CALL SP_END(?, ?, ?)
     </select>
 
     <update id="updatePeriodStatus" >
         update periodsdetail set pd_status=#{status} where pd_detno=#{period} and companyId=#{companyId}
     </update>
 
+    <update id="updateRe" >
+        UPDATE receivablesdetail SET RD_STATUS=0 WHERE date_format(rd_date, '%Y%m')=#{ym} AND companyid=#{companyId};
+    </update>
+
     <select id="checkPay" parameterType="java.lang.Long" resultType="java.lang.Integer">
         select count(1) from vendor where (ve_id,companyid) in (select pb_vendid,companyid from (
         select pbd_ym,pb_vendid,paybalance.companyid from paybalance,paybalancedetail where pb_id=pbd_pbid and pbd_slkind='期初余额'

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

@@ -50,4 +50,6 @@ public interface ProductMapper extends CommonBaseMapper<Product> {
     boolean deleteProdIODetailByCode(@Param("code") String code, @Param("companyId") Long companyId);
 
     Long selectIdByCode(@Param("code") String code, @Param("companyId") Long companyId);
+
+    List<ProductReserveCostDTO> selectReserveCostByIgnoreWarehouse(@Param("con") String con, @Param("companyId") Long companyId);
 }

+ 6 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java

@@ -617,7 +617,12 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
         if(condition == null){
             condition = "1=1";
         }
-        return getMapper().selectReserveCost(condition, companyId);
+        if ("DETAIL".equals(listReqDTO.getMode())) {
+            return getMapper().selectReserveCost(condition, companyId);
+        } else {
+            return getMapper().selectReserveCostByIgnoreWarehouse(condition, companyId);
+        }
+
     }
 
     private List<ProductDTO> getList(ListReqDTO listReqDTO){

+ 15 - 0
applications/document/document-server/src/main/resources/mapper/ProductMapper.xml

@@ -476,6 +476,21 @@
         </where>
         ORDER BY PR_ID DESC
     </select>
+    <select id="selectReserveCostByIgnoreWarehouse" resultMap="ProdReserveCostResultMap">
+        select pr_code,pr_spec,pr_detail,pr_unit,sum(pw_onhand) pw_onhand,sum(pw_amount) pw_amount
+        from productWH tab left join Product on pw_prodcode=pr_code left join warehouse on pw_whid=wh_id
+        <where>
+            <if test="con!=null">
+                ${con}
+            </if>
+            <if test="companyId!=null">
+                and tab.companyId=#{companyId} and Product.companyId=#{companyId} and warehouse.companyId=#{companyId}
+                and pw_onhand!=0
+            </if>
+        </where>
+        group by pr_code,pr_spec,pr_detail,pr_unit,pr_id
+        ORDER BY PR_ID DESC
+    </select>
     <select id="getCountFromPurc" resultType="int">
         SELECT COUNT(*) FROM PURCHASEDETAIL
         WHERE PD_PRODID = #{id} AND COMPANYID=#{companyId}

+ 1 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/CustomerCheckViewMapper.java

@@ -10,6 +10,6 @@ import java.util.List;
 public interface CustomerCheckViewMapper {
     List<CustomerCheckView> selectByCondition(@Param("con") String con, @Param("companyId") Long companyId);
     String selectCalculateFields(@Param("fields") String fields, @Param("con") String con, @Param("companyId") Long companyId);
-    VendOrCustAdd selectCustAdd(@Param("sl_custid") Integer sl_vendid, @Param("sl_ym") Integer sl_ym, @Param("companyId") Long companyId);
+    VendOrCustAdd selectCustAdd(@Param("sl_custid") Integer sl_custid, @Param("cons") String cons, @Param("companyId") Long companyId);
     Integer getId(@Param("code") String code, @Param("companyId") Long companyId);
 }

+ 1 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/VendorAcountViewMapper.java

@@ -9,6 +9,6 @@ import java.util.List;
 public interface VendorAcountViewMapper {
     List<VendorAcountView> selectByCondition(@Param("con")String con, @Param("companyId")Long companyId);
     String selectCalculateFields(@Param("fields") String fields, @Param("con") String con, @Param("companyId") Long companyId);
-    VendOrCustAdd selectVendAdd(@Param("sl_vendid") Integer sl_vendid, @Param("sl_ym") Integer sl_ym, @Param("companyId") Long companyId);
+    VendOrCustAdd selectVendAdd(@Param("sl_vendid") Integer sl_vendid, @Param("cons") String cons, @Param("companyId") Long companyId);
     Integer getId(@Param("code") String code, @Param("companyId") Long companyId);
 }

+ 11 - 10
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/MoneyReportServiceImpl.java

@@ -91,6 +91,7 @@ public class MoneyReportServiceImpl implements MoneyReportService {
         List list = null;
         Long companyId = BaseContextHolder.getCompanyId();
         String con = req.getFinalCondition();
+        String cons = this.getDate(con);
         String calculateFieldsSql = req.getCalculateFieldsSql();
         JSONArray arr = null;
         if (null == con) {
@@ -103,14 +104,12 @@ public class MoneyReportServiceImpl implements MoneyReportService {
             list = vendorAcountViewMapper.selectByCondition(con, companyId);
             if (list.size() >0) {
                 VendorAcountView vendorAcountView = (VendorAcountView) list.get(0);
+                //取时间
+
                 Integer vid = new Integer(0);
                 vid = vendorAcountViewMapper.getId(vendorAcountView.getPi_vendcode(), Long.valueOf(vendorAcountView.getCompanyId()));
-                Integer ym = Integer.valueOf(req.getYm());
-                VendOrCustAdd vendOrCustAdd = vendorAcountViewMapper.selectVendAdd(vid, ym, Long.valueOf(vendorAcountView.getCompanyId()));
+                VendOrCustAdd vendOrCustAdd = vendorAcountViewMapper.selectVendAdd(vid, cons, Long.valueOf(vendorAcountView.getCompanyId()));
                 if (vendOrCustAdd != null) {
-                    vendOrCustAdd.setNowbalance((vendOrCustAdd.getBeginamount() == null ? new Double(0) : vendOrCustAdd.getBeginamount())
-                            + (vendOrCustAdd.getNowamount() == null ? new Double(0) : vendOrCustAdd.getNowamount())
-                            - (vendOrCustAdd.getNowpay() == null ? new Double(0) : vendOrCustAdd.getNowpay()));
                     //封装成list
                     Map<String, Double> map1 = new HashMap<>();
                     map1.put("beginamount", vendOrCustAdd.getBeginamount());
@@ -154,12 +153,8 @@ public class MoneyReportServiceImpl implements MoneyReportService {
                 Integer vid = new Integer(0);
 
                 vid = customerCheckViewMapper.getId(customerCheckView.getPi_custcode(), Long.valueOf(customerCheckView.getCompanyId()));
-                Integer ym = Integer.valueOf(req.getYm());
-                VendOrCustAdd vendOrCustAdd = customerCheckViewMapper.selectCustAdd(vid, ym, Long.valueOf(customerCheckView.getCompanyId()));
+                VendOrCustAdd vendOrCustAdd = customerCheckViewMapper.selectCustAdd(vid, cons, Long.valueOf(customerCheckView.getCompanyId()));
                 if (vendOrCustAdd != null) {
-                    vendOrCustAdd.setNowbalance((vendOrCustAdd.getBeginamount() == null ? new Double(0) : vendOrCustAdd.getBeginamount())
-                            + (vendOrCustAdd.getNowamount() == null ? new Double(0) : vendOrCustAdd.getNowamount())
-                            - (vendOrCustAdd.getNowpay() == null ? new Double(0) : vendOrCustAdd.getNowpay()));
                     //封装成list
                     Map<String, Double> map1 = new HashMap<>();
                     map1.put("beginamount", vendOrCustAdd.getBeginamount());
@@ -200,4 +195,10 @@ public class MoneyReportServiceImpl implements MoneyReportService {
         }
         return map;
     }
+
+    public String getDate(String cons){
+        String date = cons.substring(8, 64);
+        System.out.println("date:" + date);
+        return date;
+    }
 }

+ 6 - 7
applications/money/money-server/src/main/resources/mapper/CustomerCheckViewMapper.xml

@@ -52,13 +52,12 @@
         <result column="nowpay" property="beginamount" jdbcType="DOUBLE" />
     </resultMap>
     <select id="selectCustAdd" resultMap="BaseAddMap">
-    select distinct a.sl_orderamount as beginamount, b.sl_orderamount as nowamount, c.sl_orderamount as nowpay FROM
-(select sl_orderamount,sl_custid,sl_ym, companyid from subledger where sl_kind = '期初余额') a
-left join (select sum(sl_orderamount) sl_orderamount,sl_custid,sl_ym from subledger where sl_kind = '出货单' or sl_kind = '销售退货单'
-group by sl_custid,sl_ym) b on a.sl_custid=b.sl_custid
-left join (select sum(sl_orderamount) sl_orderamount,sl_custid,sl_ym from subledger where sl_kind = '收款单' or sl_kind = '其他收入单'
-group by sl_custid,sl_ym) c on a.sl_custid=c.sl_custid
- where a.sl_custid=#{sl_custid,jdbcType=INTEGER} and a.sl_ym=#{sl_ym, jdbcType=INTEGER} and a.companyid = #{companyId}
+    select a.sl_orderamount as beginamount, b.nowamount, b.nowpay,(a.sl_orderamount +b.nowamount-b.nowpay) as nowbalance FROM
+    (select sl_orderamount,sl_custid,sl_date, companyid from subledger where sl_kind = '期初余额') a
+    left join (select sum(sl_amount) as nowamount,sum(sl_preamount) as nowpay,sl_custid,sl_date from subledger where sl_kind !='期初余额'
+    group by sl_custid,sl_date) b
+    on a.sl_custid=b.sl_custid
+    where a.sl_custid=#{sl_custid} and a.sl_date ${cons} and a.companyid = #{companyId} limit 1
   </select>
 
     <select id="getId" resultType="java.lang.Integer">

+ 6 - 7
applications/money/money-server/src/main/resources/mapper/VendorAcountViewMapper.xml

@@ -55,13 +55,12 @@
     <result column="nowpay" property="beginamount" jdbcType="DOUBLE" />
   </resultMap>
   <select id="selectVendAdd" resultMap="BaseAddMap">
-    select distinct a.sl_orderamount as beginamount, b.sl_orderamount as nowamount, c.sl_orderamount as nowpay FROM
-(select sl_orderamount,sl_vendid,sl_ym, companyid from subledger where sl_kind = '期初余额') a
-left join (select sum(sl_orderamount) sl_orderamount,sl_vendid,sl_ym from subledger where sl_kind = '采购验收单' or sl_kind = '采购验退单'
-group by sl_vendid,sl_ym) b on a.sl_vendid=b.sl_vendid
-left join (select sum(sl_orderamount) sl_orderamount,sl_vendid,sl_ym from subledger where sl_kind = '付款单' or sl_kind = '其他支出单'
-group by sl_vendid,sl_ym) c on a.sl_vendid=c.sl_vendid
- where a.sl_vendid=#{sl_vendid,jdbcType=INTEGER} and a.sl_ym=#{sl_ym, jdbcType=INTEGER} and a.companyid = #{companyId}
+    select a.sl_orderamount as beginamount, b.nowamount, b.nowpay,(a.sl_orderamount +b.nowamount-b.nowpay) as nowbalance FROM
+    (select sl_orderamount,sl_vendid,sl_date, companyid from subledger where sl_kind = '期初余额') a
+    left join (select sum(sl_amount) as nowamount,sum(sl_preamount) as nowpay,sl_vendid,sl_date from subledger where sl_kind !='期初余额'
+    group by sl_vendid,sl_date) b
+    on a.sl_vendid=b.sl_vendid
+    where a.sl_vendid=#{sl_vendid} and a.sl_date ${cons} and a.companyid = #{companyId} limit 1
   </select>
 
   <select id="getId" resultType="java.lang.Integer">

+ 1 - 5
frontend/saas-web/app/view/stock/appropriationInOut/QueryPanel.js

@@ -184,11 +184,7 @@ Ext.define('saas.view.stock.appropriationInOut.QueryPanel', {
                 dataIndex: 'pr_detail',
                 width: 200
             },{
-                text: '型号',
-                dataIndex: 'pr_orispeccode',
-                width: 150
-            },{
-                text: '规格',
+                text: '型号规格',
                 dataIndex: 'pr_spec',
                 width: 150
             },{