Jelajahi Sumber

Merge branch 'master' of https://git.steerinfo.com/XTEMS/xt-ems-api

QuietShadow 3 tahun lalu
induk
melakukan
8ff2309f7a

+ 1 - 2
src/main/java/com/steerinfo/ems/emsgmpcjh/mapper/EmsGmPcJhMapper.xml

@@ -774,7 +774,7 @@
               </if>
                 and state in ('2','3')
             </where>
-       order by t1.id desc
+        order by t1.JH_TIME desc
   </select>
   <!--国贸计划查询-->
 <select id="getXsDdDate" parameterType="java.util.HashMap" resultType="Map">
@@ -849,7 +849,6 @@
         <if test="state != null and state != ''">
           and t.state in (${state})
         </if>
-
         and t.id like '%G-%'
       </where>
       order by t.jh_time desc,t.id asc

+ 19 - 0
src/main/java/com/steerinfo/ems/emsprodplanround/controller/EmsProdplanRoundController.java

@@ -420,4 +420,23 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
         return success(emsProdplanRounds);
     }
 
+    @ApiOperation(value="获取列表", notes="展开查询")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
+    })
+    //@RequiresPermissions("emsprodplanround:view")
+    @GetMapping(value = "/getTableDetailAsRadio")
+    public RESTfulResult getTableDetailAsRadio (@RequestParam HashMap<String, Object>  parmas,Integer pageNum, Integer pageSize){
+        if(parmas.get("id") != null && !parmas.get("id").toString().isEmpty()){
+            String id = parmas.get("id").toString();
+            if(!id.startsWith("'")){
+                id = "'" + id.replaceAll(",", "','").replaceAll(",", "','") + "'";
+            }
+            parmas.put("id", id);
+        }
+        PageList pageList = emsProdplanRoundService.getTableDetailAsRadioForPage(parmas, pageNum, pageSize);
+         return success(pageList);
+    }
+
 }

+ 3 - 0
src/main/java/com/steerinfo/ems/emsprodplanround/mapper/EmsProdplanRoundMapper.java

@@ -35,4 +35,7 @@ public interface EmsProdplanRoundMapper extends IBaseMapper<EmsProdplanRound, St
     Integer updateAuditState(EmsProdplanRound emsProdplanRound);
     //
     List<EmsProdplanRound> getRounds(EmsProdplanRound emsProdplanRound);
+    //展开查询
+    public List<EmsProdplanRound> getTableDetailAsRadio(HashMap<String, Object> parmas);
+
 }

+ 8 - 1
src/main/java/com/steerinfo/ems/emsprodplanround/mapper/EmsProdplanRoundMapper.xml

@@ -797,5 +797,12 @@
     from ems_prodplan_round
    where CHEMICAL_STANDARD not like '%null%'
   </select>
-
+   <select id="getTableDetailAsRadio" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+     <include refid="select"/>
+     <where>
+       <if test="id != null and id != '' ">
+         and PARENTID in (${id})
+       </if>
+     </where>
+   </select>
 </mapper>

+ 2 - 0
src/main/java/com/steerinfo/ems/emsprodplanround/service/IEmsProdplanRoundService.java

@@ -49,4 +49,6 @@ public interface IEmsProdplanRoundService extends IBaseService<EmsProdplanRound,
     Integer updateAuditState(EmsProdplanRound emsProdplanRound);
     //
     List<EmsProdplanRound> getRounds(EmsProdplanRound emsProdplanRound);
+    //
+    PageList<EmsProdplanRound>getTableDetailAsRadioForPage(HashMap<String, Object> hashMap, Integer pageNum, Integer pageSize);
 }

+ 15 - 0
src/main/java/com/steerinfo/ems/emsprodplanround/service/impl/EmsProdplanRoundServiceImpl.java

@@ -101,4 +101,19 @@ public class EmsProdplanRoundServiceImpl extends BaseServiceImpl<EmsProdplanRoun
     public List<EmsProdplanRound> getRounds(EmsProdplanRound emsProdplanRound) {
         return emsProdplanRoundMapper.getRounds(emsProdplanRound);
     }
+
+    @Override
+    public  PageList<EmsProdplanRound> getTableDetailAsRadioForPage(HashMap<String, Object> hashMap, Integer pageNum, Integer pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<EmsProdplanRound> datas = emsProdplanRoundMapper.getTableDetailAsRadio(hashMap);
+        PageList pageInfo = new PageList(datas);
+        return pageInfo;
+    }
+
+//    public List<EmsProdplanRound> getTableDetailAsRadiForPage(Map<String, Object> parameters, Integer pageNum, Integer pageSize) {
+//        PageHelper.startPage(pageNum, pageSize);
+//        List<T> rows =
+//        PageList pageInfo = new PageList(rows);
+//        return pageInfo;
+//    }
 }

+ 115 - 0
src/main/java/com/steerinfo/ems/emsprodplanyear/controller/EmsProdplanYearController.java

@@ -340,6 +340,121 @@ public class EmsProdplanYearController extends BaseRESTfulController {
             }
             // 因为一行数据由多条数据组成,所以这里为了确保数据准确性,应该再根据编号查询一次新的数据
             EmsProdplanYear emsProdplanYear = emsProdplanYearService.getById(model.getNo());
+//            Calendar c = Calendar.getInstance();
+//            int dayMax = 0;
+//            try {
+//                dayMax = emsProdplanYearService.getDaysOfMonth(emsProdplanYear.getYearmonth());
+//            } catch (ParseException e) {
+//                e.printStackTrace();
+//            }
+//            Integer sumWeight = 0;
+//            EmsProdplanMonth maxSqno =  emsProdplanMonthService.getMaxSqno();
+//            String unit = "008";
+//            String productid = "";
+//            String workProcid = "";
+//            switch (model.getParentid()) {
+//                case "LG":
+//                    sumWeight = model.getWeight().intValue();
+//                    productid="钢坯";
+//                    unit="008";
+//                    workProcid = "AT2004";
+//                    break;
+//                case "LT":
+//                    sumWeight = model.getWeight().intValue();
+//                    productid="生铁";
+//                    unit="008";
+//                    break;
+//                case "SJ":
+//                    sumWeight = model.getWeight().intValue();
+//                    productid="烧结矿";
+//                    unit="008";
+//                    break;
+//                case "ZG" :
+//                    sumWeight = model.getWeight().intValue();
+//                    productid="线材";
+//                    if(model.getLine().equals("AT2007")) {
+//                        productid="H型钢";
+//                    }
+//                    unit="008";
+//                    break;
+//                case "FDC" :
+//                    sumWeight = model.getWeight().intValue();
+//                    productid="发电量";
+//                    unit="006";
+//                    break;
+//                case "JCS" :
+//                    sumWeight = model.getWeight().intValue();
+//                    productid="白灰";
+//                    unit="008";
+//                    break;
+//                case "JCW" :
+//                    sumWeight = model.getWeight().intValue();
+//                    productid="矿渣粉";
+//                    unit="008";
+//                    workProcid = model.getProductid();
+//                    break;
+//                case "JJZ" :
+//                    sumWeight = model.getWeight1().intValue() + model.getWeight2().intValue();
+//                    productid="焦炭";
+//                    unit="008";
+//                    workProcid = "AT1007";
+//                    break;
+//                case "JJF" :
+//                    sumWeight = model.getWeight().intValue();
+//                    productid="焦油";
+//                    if(model.getLine().equals("AT3009")){
+//                        productid="粗苯";
+//                    }
+//                    if(model.getLine().equals("AT3010")){
+//                        productid="硫铵";
+//                    }
+//                    unit="008";
+//                    //workProcid = "AT1007";
+//                    break;
+//                default: break;
+//            }
+//            int[] avgWeight = emsProdplanYearService.avgWeight(sumWeight,dayMax);
+//            for (int k = 0;k < dayMax;k++) {
+//                EmsProdplanMonth monModel = new EmsProdplanMonth();
+//                c.setTime(model.getYearmonth());
+//                c.add(Calendar.DATE, k);
+//                monModel.setMay(c.getTime());
+//                monModel.setUnit(unit);
+//                monModel.setProductid(productid);
+//                monModel.setWeightMonth(model.getWeight());
+//                if (workProcid.equals("")) {
+//                    monModel.setWorkprocid(model.getLine());
+//                } else {
+//                    monModel.setWorkprocid(workProcid);
+//                    monModel.setWeightMonth(BigDecimal.valueOf(sumWeight));
+//                }
+//                monModel.setWeightDay(BigDecimal.valueOf(avgWeight[k]));
+//                monModel.setKxf_weight(BigDecimal.valueOf(avgWeight[k]));
+//                monModel.setYxf_weight(BigDecimal.valueOf(0));
+//                monModel.setJxdays("0");
+//                monModel.setMemo("根据年计划,系统自动生成。");
+//                monModel.setCreateman("系统");
+//                monModel.setCreatetime(new Date());
+//                monModel.setSqno(maxSqno.getSqno()+k);
+//                Map monMap = new HashMap();
+//                monMap.put("may",new SimpleDateFormat("yyyy-MM-dd").format(monModel.getMay()));
+//                monMap.put("workprocid","'"+monModel.getWorkprocid()+"'");
+//                monMap.put("productid",monModel.getProductid());
+//                monMap.put("startTime",new SimpleDateFormat("yyyy-MM-dd").format(monModel.getMay()));
+//                monMap.put("endTime",new SimpleDateFormat("yyyy-MM-dd").format(monModel.getMay()));
+//                List<EmsProdplanMonth> monList = emsProdplanMonthMapper.selectByParameters(monMap);
+//                if(monList.size()<=0){
+//                    EmsProdplanMonth emsProdplanMonth = emsProdplanMonthService.add(monModel);
+//                } else {
+//                    if(model.getParentid().equals("LG") || model.getParentid().equals("JJZ")) {
+//                        monModel.setKxf_weight(monList.get(0).getKxf_weight().add(monModel.getKxf_weight()));
+//                        monModel.setWeightMonth(monList.get(0).getWeightMonth().add(monModel.getWeightMonth()));
+//                        monModel.setWeightDay(monList.get(0).getWeightDay().add(monModel.getWeightDay()));
+//                        monModel.setId(monList.get(0).getId());
+//                        emsProdplanMonthService.modify(monModel);
+//                    }
+//                }
+//            }
             emsProdplanYear.setWeight(model.getWeight());
             emsProdplanYear.setWeight1(model.getWeight1());
             emsProdplanYear.setWeight2(model.getWeight2());

+ 2 - 2
src/main/java/com/steerinfo/ems/foldthevalues/controller/FoldTheValuesController.java

@@ -115,8 +115,8 @@ public class FoldTheValuesController extends BaseRESTfulController {
     @GetMapping("/aaa")
     public RESTfulResult getdate() throws ScriptException, ParseException {
 //        foldTheValuesService.getDate();
-//        foldTheValuesService.getMonthDate();
-        foldTheValuesService.getDataForwl();
+         //foldTheValuesService.getMonthData();
+           //foldTheValuesService.getDataForwl();
         //foldTheValuesService.insertNewDate();
         return  success();
     }

+ 5 - 0
src/main/java/com/steerinfo/ems/foldthevalues/mapper/FoldTheValuesMapper.java

@@ -55,4 +55,9 @@ public interface FoldTheValuesMapper extends IBaseMapper<FoldTheValues, String>
      */
     List<FoldTheValues> getDateForwl(HashMap<String,Object> hashMap);
 
+    /**
+     * 获取这个月的平均值项
+     */
+    public String getavgDate(HashMap<String,Object> hashMap);
+
 }

+ 13 - 0
src/main/java/com/steerinfo/ems/foldthevalues/mapper/FoldTheValuesMapper.xml

@@ -483,4 +483,17 @@ select t2.*
             where
             t.materialno in ('X005', 'X018', 'X010'))
   </select>
+  <select id="getavgDate" parameterType="java.util.HashMap" resultType="String">
+    select  listagg(t.ESTIMATEDVALUE,',') as avg  from
+    (select distinct t.estimatedvalue
+          from FOLD_THE_VALUES t
+          <where>
+            <if test="startTime != null and startTime != '' and endTime != null and endTime !=''">
+              and t.clock between #{startTime} and #{endTime}
+            </if>
+            <if test="materialno != null and materialno != ''">
+              and t.materialno = #{materialno}
+            </if>
+          </where>) t
+  </select>
 </mapper>

+ 40 - 39
src/main/java/com/steerinfo/ems/foldthevalues/service/impl/FoldTheValuesServiceImpl.java

@@ -140,12 +140,13 @@ public class FoldTheValuesServiceImpl extends BaseServiceImpl<FoldTheValues, Str
                 foldTheValue.setCode(df.format(jse.eval(foldTheValues.getEstimatedvalue()+"/"+days+"*0.03412/100")).toString());
             }
             if(foldTheValues.getMaterialsource().equals("机焦厂")){
-                foldTheValue.setCode(df.format(jse.eval("(29727 + (10 - "+foldTheValues.getEstimatedvalue()+") * 334) / 29307.6")).toString());
+                foldTheValue.setCode(df.format(jse.eval("(29727+(10-"+foldTheValues.getEstimatedvalue()+"/"+days+")*334)/29307.6")));
             }
             foldTheValue.setIsavailable("0");
             foldTheValue.setUnitid("032");
-            foldTheValue.setDescription("低热值");
-            foldTheValue.setBz("取本月热值检测结果平均值进行热值换算");
+            foldTheValue.setDescription("灰分");
+            hashMap.put("materialno",foldTheValues.getMaterialno());
+            foldTheValue.setBz("取本月热值检测结果平均值("+foldTheValuesMapper.getavgDate(hashMap)+")进行热值换算");
             foldTheValue.setMaterialno(foldTheValues.getMaterialno());
             foldTheValue.setMaterialsource(foldTheValues.getMaterialsource());
             foldTheValue.setTimegranid("MONTH");
@@ -170,7 +171,7 @@ public class FoldTheValuesServiceImpl extends BaseServiceImpl<FoldTheValues, Str
         String clock  = DateUtils.dateStr(calendar.getTime(),"yyyy-MM-dd");
         HashMap<String,Object> hashMap =  new HashMap<>();
           hashMap.put("clock",clock);
-        List<FoldTheValues> dateForwl = foldTheValuesMapper.getDateForwl(null);
+        List<FoldTheValues> dateForwl = foldTheValuesMapper.getDateForwl(hashMap);
         FoldTheValues foldTheValue =  new FoldTheValues();
         for (FoldTheValues foldTheValues : dateForwl) {
             foldTheValue.setId(foldTheValues.getId());
@@ -181,44 +182,44 @@ public class FoldTheValuesServiceImpl extends BaseServiceImpl<FoldTheValues, Str
             foldTheValue.setEstimatedvalue(foldTheValues.getEstimatedvalue());
             foldTheValue.setTimegranid("DAY");
             foldTheValue.setUnitid("032");
-            foldTheValue.setDescription("低热值");
+            foldTheValue.setDescription("灰分");
             foldTheValue.setBz("采用当天热值进行换算,当天无检测结果,则取最近热值进行换算");
             foldTheValuesMapper.insert(foldTheValue);
         }
         
     }
-    //获取折标值
-    public String getzbz(EmsCalorificValue emsCalorificValue) throws ScriptException {
-        ScriptEngine jse = new ScriptEngineManager().getEngineByName("JavaScript");
-        //首先获取公式
-        NjFormula njFormula = njFormulaMapper.getByMateralNo(emsCalorificValue.getMaterialno());
-        String formula = njFormula.getCode();
-        if (null == formula ){
-            return  null;
-        }
-        HashMap map =  new HashMap();
-        map.put("wtbh",emsCalorificValue.getWtbh());
-        if(formula.contains("CO") == true){
-            map.put("item","CO");
-            String value = emsCalorificValueMapper.getValue(map) == null ? "0.00" : emsCalorificValueMapper.getValue(map);
-            formula = formula.replace("CO", value);
-        }
-        if (formula.contains("H2") == true){
-            map.put("item","H2");
-            String value = emsCalorificValueMapper.getValue(map) == null ? "0.00" : emsCalorificValueMapper.getValue(map);
-            formula = formula.replace("H2", value);
-        }
-        if (formula.contains("CH4") == true){
-            map.put("item","CH4");
-            String value = emsCalorificValueMapper.getValue(map) == null ? "0.00" : emsCalorificValueMapper.getValue(map);
-            formula = formula.replace("CH4", value);
-        }
-        if (formula.contains("N2") == true){
-            map.put("item","N2");
-            String value = emsCalorificValueMapper.getValue(map) == null ? "0.00" :emsCalorificValueMapper.getValue(map);
-            formula = formula.replace("N2", value);
-        }
-        DecimalFormat df   = new DecimalFormat("0.00");
-        return  df.format(jse.eval(formula)).toString();
-    }
+//    //获取折标值 (该方法已经弃用)
+//    public String getzbz(EmsCalorificValue emsCalorificValue) throws ScriptException {
+//        ScriptEngine jse = new ScriptEngineManager().getEngineByName("JavaScript");
+//        //首先获取公式
+//        NjFormula njFormula = njFormulaMapper.getByMateralNo(emsCalorificValue.getMaterialno());
+//        String formula = njFormula.getCode();
+//        if (null == formula ){
+//            return  null;
+//        }
+//        HashMap map =  new HashMap();
+//        map.put("wtbh",emsCalorificValue.getWtbh());
+//        if(formula.contains("CO") == true){
+//            map.put("item","CO");
+//            String value = emsCalorificValueMapper.getValue(map) == null ? "0.00" : emsCalorificValueMapper.getValue(map);
+//            formula = formula.replace("CO", value);
+//        }
+//        if (formula.contains("H2") == true){
+//            map.put("item","H2");
+//            String value = emsCalorificValueMapper.getValue(map) == null ? "0.00" : emsCalorificValueMapper.getValue(map);
+//            formula = formula.replace("H2", value);
+//        }
+//        if (formula.contains("CH4") == true){
+//            map.put("item","CH4");
+//            String value = emsCalorificValueMapper.getValue(map) == null ? "0.00" : emsCalorificValueMapper.getValue(map);
+//            formula = formula.replace("CH4", value);
+//        }
+//        if (formula.contains("N2") == true){
+//            map.put("item","N2");
+//            String value = emsCalorificValueMapper.getValue(map) == null ? "0.00" :emsCalorificValueMapper.getValue(map);
+//            formula = formula.replace("N2", value);
+//        }
+//        DecimalFormat df   = new DecimalFormat("0.00");
+//        return  df.format(jse.eval(formula)).toString();
+//    }
 }

+ 1 - 1
src/main/java/com/steerinfo/task/SpringCronTask.java

@@ -309,7 +309,7 @@ public class SpringCronTask implements SchedulingConfigurer{
 					 dzMaterialSfService.dataGeneration();
 					 emsScqkLgService.dateGenerate();
 					logger.info("定时任务"+taskId+"执行时长:" + (System.currentTimeMillis() - start)/1000 + "秒");
-				} 
+				}
 				else if(taskId.equalsIgnoreCase("124")){
 					 long start = System.currentTimeMillis();
 					 try {