瀏覽代碼

datasource设置存栏数据增加后备母猪数据。

zhuoning 3 年之前
父節點
當前提交
8b00df28d1

+ 13 - 12
huimv-hy-production/huimv.hy.erp.datasource/src/main/java/com/huimv/production/datasource/dao/repo/TDeliveryRepo.java

@@ -196,7 +196,7 @@ public interface TDeliveryRepo extends JpaRepository<TDeliveryEntity, String>, J
             "and (TWeaning.hogpendID in( ?3))     " +
             "and TWeaning.FdateWeaning between  ?1 and  ?2)TBTQ)ZZ " +
             ") ncws")
-    List<Object[]> getPsy(String startDate,String endDate,String farmID);
+    List<Object[]> getPsy(String startDate, String endDate, String farmID);
 
     /**
      * @Method      : getReEstrusRate
@@ -271,7 +271,7 @@ public interface TDeliveryRepo extends JpaRepository<TDeliveryEntity, String>, J
                     "AND tmp_tblpz.FParityInt= tmp_tblfm.FParityInt  " +
                     "GROUP BY " +
                     "tmp_tblpz.HogpendID ")
-    List<Object[]> getReEstrusRate(String startDate,String endDate,String farmName);
+    List<Object[]> getReEstrusRate(String startDate, String endDate, String farmName);
 
     /**
      * @Method      : getParturitionRate
@@ -344,7 +344,7 @@ public interface TDeliveryRepo extends JpaRepository<TDeliveryEntity, String>, J
             "AND tmp_tblpz.FParityInt= tmp_tblfm.FParityInt  " +
             "GROUP BY " +
             "tmp_tblpz.HogpendID ")
-    List<Object[]> getParturitionRate(String startDate, String endDate,String farmName);
+    List<Object[]> getParturitionRate(String startDate, String endDate, String farmName);
     
     /**
      * @Method      : getStorage
@@ -448,7 +448,7 @@ public interface TDeliveryRepo extends JpaRepository<TDeliveryEntity, String>, J
             "td.HOGPENDID, " +
             "tdie.csamount, " +
             "tlose.csamount")
-    List<Object[]> getPigletInfo(String startDate, String endDate,String farmName);
+    List<Object[]> getPigletInfo(String startDate, String endDate, String farmName);
 
     /**
      * @Method      : getMateQuantity
@@ -498,7 +498,7 @@ public interface TDeliveryRepo extends JpaRepository<TDeliveryEntity, String>, J
             "  ) tmp_tblpzts   " +
             " GROUP BY  " +
             "  tmp_tblpzts.HogpendID ")
-    List<Object[]> getMateQuantity(String startDate, String endDate,String farmName);
+    List<Object[]> getMateQuantity(String startDate, String endDate, String farmName);
 
     /**
      * @Method      : getConceptionRate
@@ -542,7 +542,7 @@ public interface TDeliveryRepo extends JpaRepository<TDeliveryEntity, String>, J
             " group by tmp_tblpz.HogpendID) tmp_tblpzlc on tmp_tblpzlc.ZCID=tmp_tblpz.ZCID " +
             " left join TOrganizeCell on tmp_tblpz.ZCID=TOrganizeCell.FID " +
             " where TOrganizeCell.FNAME in(?3)")
-    List<Object[]> getConceptionRate(String startDate, String endDate,String farmName);
+    List<Object[]> getConceptionRate(String startDate, String endDate, String farmName);
 
     @Query(nativeQuery = true,value =" select   " +
             "  TOrganizeCell.FshortName 'ZCNAME',  " +
@@ -595,7 +595,7 @@ public interface TDeliveryRepo extends JpaRepository<TDeliveryEntity, String>, J
             "   " +
             " left join TOrganizeCell on tmp_tblpz.ZCID=TOrganizeCell.FID")
     // --0.83
-    List<Object[]> getConceptionRate_new(String startDate, String endDate,String farmName);
+    List<Object[]> getConceptionRate_new(String startDate, String endDate, String farmName);
 
 
     /**
@@ -938,10 +938,11 @@ public interface TDeliveryRepo extends JpaRepository<TDeliveryEntity, String>, J
     @Query(nativeQuery = true,value =
             "select TOrganizeCell.FSHORTNAME as 猪场\n" +
             ",ISNULL(sum(pig.母猪后备),0)+ISNULL(sum(pig.空怀),0)+ISNULL(sum(pig.妊娠),0)+ISNULL(sum(pig.哺乳),0) AS 母猪\n" +
-            ",ISNULL(sum(pig.公猪后备),0) +ISNULL(sum(pig.成年),0) AS 公猪,ISNULL(sum(pig.教槽),0) AS 仔猪,\n" +
-            "ISNULL(sum(pig.保育),0) AS 保育 ,ISNULL(sum(pig.育成),0) +ISNULL(sum(pig.育肥),0) AS 育肥,ISNULL(sum(pig.后备),0) AS 后备\n" +
+            ",ISNULL(sum(pig.公猪后备),0) +ISNULL(sum(pig.成年),0) AS 公猪,ISNULL(sum(pig.教槽),0) AS 仔猪\n" +
+            ",ISNULL(sum(pig.保育),0) AS 保育 ,ISNULL(sum(pig.育成),0) +ISNULL(sum(pig.育肥),0) AS 育肥,ISNULL(sum(pig.后备),0) AS 后备\n" +
             ",ISNULL(sum(pig.妊娠),0) AS 妊娠,ISNULL(sum(pig.哺乳),0) AS 哺乳,ISNULL(sum(pig.空怀),0) AS 空怀\n" +
-            "from\n" +
+            ",ISNULL(sum(pig.母猪后备),0) AS 母猪后备" +
+            " from \n" +
             "(select  \n" +
             "       tbl_tmp.猪场id,\n" +
             "       SUM(CASE WHEN tbl_tmp.状态 = '公猪后备' THEN tbl_tmp.数量 ELSE 0 END) AS 公猪后备,\n" +
@@ -1295,7 +1296,7 @@ public interface TDeliveryRepo extends JpaRepository<TDeliveryEntity, String>, J
             "left join TPigArchives on tbl.猪只编码 = TPigArchives.FNUMBER\n" +
             "where tbl.计划时间 >= getDate() \n" +
             "group by tbl.计划类型\n")
-    List<Object[]> getWorkPlan(Date startDate,Date endDate);
+    List<Object[]> getWorkPlan(Date startDate, Date endDate);
 
     @Query(nativeQuery = true,value ="select TOrganizeCell.FName ,tbl.计划类型,count(DISTINCT(tbl.计划名称)) as '计划数',SUM(tbl.猪只数量) as '猪只头数'\n" +
             "from(  \n" +
@@ -1366,7 +1367,7 @@ public interface TDeliveryRepo extends JpaRepository<TDeliveryEntity, String>, J
             "left join TPigArchives on tbl.猪只编码 = TPigArchives.FNUMBER\n" +
             "where tbl.计划时间 >= getDate() \n" +
             "group by tbl.计划类型,TOrganizeCell.FName ")
-    List<Object[]> getWorkPlan1(Date startDate,Date endDate);
+    List<Object[]> getWorkPlan1(Date startDate, Date endDate);
 
     //母猪和仔猪状态
     @Query(nativeQuery = true,value ="select TOrganizeCell.FSHORTNAME,SUM(case when FPIGSTATEE=5 and FCHANGEDAYS>=107 then 1 else 0 end) as '待分娩',\n" +

+ 4 - 0
huimv-hy-production/huimv.hy.erp.datasource/src/main/java/com/huimv/production/datasource/service/IEggService.java

@@ -0,0 +1,4 @@
+package com.huimv.production.datasource.service;
+
+public interface IEggService {
+}

+ 42 - 0
huimv-hy-production/huimv.hy.erp.datasource/src/main/java/com/huimv/production/datasource/service/impl/EggServiceImpl.java

@@ -0,0 +1,42 @@
+package com.huimv.production.datasource.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.huimv.production.datasource.service.IEggService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.biosafety.uface.controller
+ * @Description : TODO
+ * @Version : 1.0
+ * @Author : ZhuoNing
+ * @Create : 2020-12-25
+ **/
+@Service
+@Slf4j
+public class EggServiceImpl implements IEggService {
+
+    public void getWeightDetails(String date){
+//        log.info(" 开始日期(返情率) startDate:" + date);
+//        List<Object[]> reEstrusRateFieldList = tDeliveryRepo.getReEstrusRate(startDate, endDate, farmName);
+//        log.info(" 返情率查询数量:" + reEstrusRateFieldList.size());
+//        JSONArray resultJa = new JSONArray();
+//        for (Object[] fieldObj : reEstrusRateFieldList) {
+//            String farmVal = fieldObj[0].toString();
+////            String varietyVal = fieldObj[1].toString();
+//            String reEstrusRateVal = fieldObj[1].toString();
+//            JSONObject dataJo = new JSONObject();
+//            dataJo.put("farm", farmVal);
+////            dataJo.put("variety",varietyVal);
+//            dataJo.put("reestrus_rate", reEstrusRateVal);
+//            resultJa.add(dataJo);
+//        }
+//
+//        return resultJa.toJSONString();
+
+    }
+}

+ 3 - 0
huimv-hy-production/huimv.hy.erp.datasource/src/main/java/com/huimv/production/datasource/service/impl/ErpDataServiceImpl.java

@@ -439,6 +439,9 @@ public class ErpDataServiceImpl implements IErpDataService {
             dataJo.put("br", stockObj[8]);
             //空怀
             dataJo.put("kh", stockObj[9]);
+            //空怀
+            dataJo.put("mzhb", stockObj[10]);
+//            System.out.println("dataJo>>"+dataJo.toJSONString());
         }
         return new Result(ResultCode.SUCCESS,stockJa);
     }

+ 51 - 0
huimv-hy-production/huimv.hy.erp.datasource/src/main/resources/application-egg.yml

@@ -0,0 +1,51 @@
+server:
+  port: 9100
+spring:
+  application:
+    name: huimv-hy-erp-datasource
+  datasource:
+    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
+#    url: jdbc:sqlserver://115.238.57.190:1433;DatabaseName=qlyz
+    url: jdbc:sqlserver://39.171.45.196:1433;DatabaseName=Weighing
+    username: sa
+    password: kd123456
+    maxActive: 20
+    initialSize: 1
+    maxWait: 60000
+    minIdle: 1
+    timeBetweenEvictionRunsMillis: 60000
+    minEvictableIdleTimeMillis: 300000
+    validationQuery: select 1
+    testWhileIdle: true
+    testOnBorrow: true
+    testOnReturn: true
+    poolPreparedStatements: true
+    maxOpenPreparedStatements: 20
+  jpa:
+    show-sql: true
+    properties:
+      hibernate:
+        default_schema: dbo
+    hibernate:
+      naming:
+        physical-strategy: com.huimv.production.datasource.configuration.UpperTableStrategy
+#    database-platform: com.huimv.production.datasource.configuration.SqlServerDialect # Error
+
+#  datasource:
+#    url: jdbc:sqlserver://localhost:1433;DatabaseName=test
+#    username: sa
+#    password: hm123456@
+#    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
+#  jpa:
+#    show-sql: true
+##    database: mysql
+#    database-platform: com.ford.configuration.SqlServerDialect
+#    open-in-view: true
+#    properties:
+#      hibernate:
+#        default_schema: dbo
+#        naming:
+#          physical-strategy: com.ford.configuration.UpperTableStrategy
+#    hibernate:
+#      ddl-auto: update
+

+ 1 - 1
huimv-hy-production/huimv.hy.erp.datasource/src/main/resources/application.properties

@@ -1,4 +1,4 @@
-spring.profiles.active=dev
+spring.profiles.active=egg
 
 apiService.client= 20210501