Browse Source

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

zhuth 7 years ago
parent
commit
bc29884814

+ 18 - 5
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/HomePageServiceImpl.java

@@ -1,7 +1,7 @@
 package com.usoftchina.saas.commons.service.impl;
 
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.JSONArray;
 import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.commons.mapper.HomePageMapper;
 import com.usoftchina.saas.commons.service.HomePageService;
@@ -43,25 +43,25 @@ public class HomePageServiceImpl implements HomePageService{
         Object json = null;
         if (null != sixMonths && sixMonths) {
             res = homePageMapper.getPurchaseDataInSixMonth(componyId);
-            json = parseJson(res);
+            json = parseJsonArray(res);
             return Result.success(json);
         }
         res = homePageMapper.getPurchaseDataNow(componyId);
-        json = parseJson(res);
+        json = parseJsonArray(res);
         return Result.success(json);
     }
 
     @Override
     public Result storageData() {
         Long componyId = BaseContextHolder.getCompanyId();
-        Object json = parseJson(homePageMapper.getStorageData(componyId));
+        Object json = parseJsonArray(homePageMapper.getStorageData(componyId));
         return Result.success(json);
     }
 
     @Override
     public Result payAndRecData() {
         Long componyId = BaseContextHolder.getCompanyId();
-        Object json = parseJson(homePageMapper.getPayAndRecData(componyId));
+        Object json = parseJsonArray(homePageMapper.getPayAndRecData(componyId));
         return Result.success(json);
     }
 
@@ -77,4 +77,17 @@ public class HomePageServiceImpl implements HomePageService{
         }
         return null;
     }
+
+    private Object parseJsonArray(String text) {
+        Object array = null;
+        if (null != text) {
+            try {
+                array = JSONArray.parse(text);
+            }catch (Exception e) {
+                e.printStackTrace();
+            }
+            return array;
+        }
+        return null;
+    }
 }

+ 16 - 16
applications/commons/commons-server/src/main/resources/mapper/HomePageMapper.xml

@@ -11,51 +11,51 @@
     </select>
 
     <select id="getPurchaseDataNow" parameterType="long" resultType="string">
-        select concat('{',GROUP_CONCAT(concat('"',si_vendname,'":',IFNULL(si_amount,0))),'}') from statsinfo
+        select concat('[',GROUP_CONCAT(concat('{"x":"',si_vendname,'","y":',IFNULL(si_amount,0),'}')),']')  from statsinfo
         where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='PURC' ORDER BY si_amount desc
     </select>
 
     <select id="getPurchaseDataInSixMonth" parameterType="long" resultType="string">
-    select concat('{',d1,',',d2,',',d3,',',d4,',',d5,',',d6,'}') from (
-(select concat('"',DATE_FORMAT(now(),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d1 from   statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='PURC' ORDER BY si_amount desc) data_1,
+    select concat('[',d1,',',d2,',',d3,',',d4,',',d5,',',d6,']') from (
+(select concat('{"x":',DATE_FORMAT(now(),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d1 from   statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='PURC' ORDER BY si_amount desc) data_1,
 
-(select concat('"',DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d2 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_2,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d2 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_2,
 
 
-(select concat('"',DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d3 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_3,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d3 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_3,
 
 
-(select concat('"',DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d4 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc) data_4,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d4 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc) data_4,
 
 
-(select concat('"',DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d5 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_5,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d5 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_5,
 
-(select concat('"',DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d6 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_6)
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d6 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_6)
  </select>
 
 
     <select id="getStorageData" parameterType="long" resultType="string">
-      select concat('{',d1,',',d2,',',d3,',',d4,',',d5,',',d6,'}') from (
+      select concat('[',d1,',',d2,',',d3,',',d4,',',d5,',',d6,']') from (
 
-(select concat('"',DATE_FORMAT(now(),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d1 from   statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc) data_1,
+(select concat('{"x":',DATE_FORMAT(now(),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d1 from   statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc) data_1,
 
-(select concat('"',DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d2 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_2,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d2 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_2,
 
 
-(select concat('"',DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d3 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_3,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d3 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_3,
 
 
-(select concat('"',DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d4 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc) data_4,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d4 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc) data_4,
 
 
-(select concat('"',DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d5 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_5,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d5 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_5,
 
-(select concat('"',DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d6 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_6);
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d6 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_6);
     </select>
 
 
     <select id="getPayAndRecData" parameterType="long" resultType="string">
-     select concat('{"支出":',ifnull(si_amount_pay,'0'),',"收入":',ifnull(si_amount_rec,'0'),'}') from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='FUND'
+     select concat('[{"x":"支出","y":',ifnull(si_amount_pay,'0'),'},{"x":"收入","y":',ifnull(si_amount_rec,'0'),'}]') from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='FUND'
     </select>
 
 

+ 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>
 

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

@@ -38,6 +38,7 @@
     <result column="pd_text3" jdbcType="VARCHAR" property="pd_text3" />
     <result column="pd_text4" jdbcType="VARCHAR" property="pd_text4" />
     <result column="pd_text5" jdbcType="VARCHAR" property="pd_text5" />
+    <result column="pd_remark" jdbcType="VARCHAR" property="pd_remark" />
     <result column="pd_ym" jdbcType="INTEGER" property="pd_ym" />
     <result column="pd_yqty" jdbcType="DOUBLE" property="pd_yqty" />
     <result column="pd_ioid" jdbcType="INTEGER" property="pd_ioid" />
@@ -603,8 +604,9 @@
       #{item.pd_text5,jdbcType=VARCHAR},
       #{item.pd_ym,jdbcType=INTEGER},
       #{item.pd_yqty,jdbcType=DOUBLE},
-      #{item.pd_remark,jdbcType=LONGVARCHAR},
-      #{item.pd_ioid,jdbcType=INTEGER})
+      #{item.pd_ioid,jdbcType=INTEGER},
+      #{item.pd_remark,jdbcType=LONGVARCHAR}
+      )
     </foreach>
   </insert>
 

+ 4 - 2
applications/storage/storage-server/src/main/resources/mapper/ProdIODetailMapper.xml

@@ -38,6 +38,7 @@
     <result column="pd_text3" jdbcType="VARCHAR" property="pd_text3" />
     <result column="pd_text4" jdbcType="VARCHAR" property="pd_text4" />
     <result column="pd_text5" jdbcType="VARCHAR" property="pd_text5" />
+    <result column="pd_remark" jdbcType="VARCHAR" property="pd_remark" />
     <result column="pd_ym" jdbcType="INTEGER" property="pd_ym" />
     <result column="pd_yqty" jdbcType="DOUBLE" property="pd_yqty" />
     <result column="pd_ioid" jdbcType="INTEGER" property="pd_ioid" />
@@ -603,8 +604,9 @@
       #{item.pd_text5,jdbcType=VARCHAR},
       #{item.pd_ym,jdbcType=INTEGER},
       #{item.pd_yqty,jdbcType=DOUBLE},
-      #{item.pd_remark,jdbcType=LONGVARCHAR},
-      #{item.pd_ioid,jdbcType=INTEGER})
+      #{item.pd_ioid,jdbcType=INTEGER},
+      #{item.pd_remark,jdbcType=LONGVARCHAR}
+      )
     </foreach>
   </insert>
 

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

@@ -357,7 +357,18 @@ Ext.define('saas.view.purchase.purchaseIn.FormPanel', {
         name : "pi_auditdate", 
         fieldLabel : "审核日期",
         readOnly:true
-    }]
+    }],
+    beforeAudit:function(){
+        var me = this,
+        viewModel = me.getViewModel(),
+        store = viewModel.get('detail0').detailStore;
+        store.each(function(item){
+            if(item.data.pd_price==0){
+                showToast(item.data.pd_pdno+'行'+item.data.pd_prodcode+'物料单价为0');
+            }
+        });
+        return true;
+    }
 
 
 

+ 0 - 11
frontend/saas-web/app/view/stock/make/FormPanelController.js

@@ -358,17 +358,6 @@ Ext.define('saas.view.stock.make.FormPanelController', {
 
                 }
             },
-
-
-
-
-
-
-
-
-
-
-
             //从表多选放大镜赋值关系 以及 tpl模板
             'multidbfindtrigger[name=pd_prodcode]':{
                 beforerender:function(f){

+ 1 - 1
frontend/saas-web/app/view/stock/otherIn/FormPanel.js

@@ -277,7 +277,7 @@ Ext.define('saas.view.stock.otherIn.FormPanel', {
                 }
             },{
                 text : "备注", 
-                dataIndex : "pd_text1",
+                dataIndex : "pd_remark",
                 width : 250, 
                 items : null,
                 editor : {

+ 1 - 1
frontend/saas-web/app/view/stock/otherOut/FormPanel.js

@@ -273,7 +273,7 @@ Ext.define('saas.view.stock.otherOut.FormPanel', {
                 }
             },{
                 text : "备注", 
-                dataIndex : "pd_text1",
+                dataIndex : "pd_remark",
                 width : 250, 
                 items : null,
                 editor : {