Browse Source

lrl -2021-12-22

lirl 3 năm trước cách đây
mục cha
commit
34a4caa618

+ 129 - 106
src/main/java/com/steerinfo/ems/emsprodplanyear/controller/EmsProdplanYearController.java

@@ -196,15 +196,17 @@ public class EmsProdplanYearController extends BaseRESTfulController {
                     break;
                 case "JJF" :
                     sumWeight = model.getWeight().intValue();
-                    if(model.getLine().equals("AT2011")) {
+                    if(model.getLine().equals("AT3009")) {
                         productid = "粗苯";
+                        workProcid = "AT2011";
                     }
                     if (model.getLine().equals("AT3024")){
                         productid="焦油";
-                        model.setLine("AT2011");
+                        workProcid = "AT2011";//model.setLine("AT2011");
                     }
                     if(model.getLine().equals("AT3010")){
                         productid="硫铵";
+                        workProcid = "AT3010";
                     }
                     unit="008";
                     //workProcid = "AT1007";
@@ -346,66 +348,69 @@ 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" :
+            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="方坯";
+                    if (model.getLine().equals("AT2007-1")){
+                        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")){
@@ -417,50 +422,68 @@ public class EmsProdplanYearController extends BaseRESTfulController {
 //                    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);
-//                    }
-//                }
-//            }
+                    sumWeight = model.getWeight().intValue();
+                    if(model.getLine().equals("AT3009")) {
+                        productid = "粗苯";
+                        workProcid = "AT2011";
+                    }
+                    if (model.getLine().equals("AT3024")){
+                        productid="焦油";
+                        workProcid = "AT2011";
+                    }
+                    if(model.getLine().equals("AT3010")){
+                        productid="硫铵";
+                        workProcid = "AT3010";
+                    }
+                    unit="008";
+                    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")&&monModel.getProductid().equals("方坯")) || 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);
+                    } else  {
+                        monModel.setId(monList.get(0).getId());
+                        emsProdplanMonthService.modify(monModel);
+                    }
+                }
+            }
             emsProdplanYear.setWeight(model.getWeight());
             emsProdplanYear.setWeight1(model.getWeight1());
             emsProdplanYear.setWeight2(model.getWeight2());

+ 1 - 0
src/main/java/com/steerinfo/ems/emsprodplanyear/mapper/EmsProdplanYearMapper.xml

@@ -303,6 +303,7 @@
       <if test="xgr != null">
         XGR = #{xgr,jdbcType=VARCHAR},
       </if>
+      <if test=""></if>
       <if test="xgsj != null">
         XGSJ = #{xgsj,jdbcType=TIMESTAMP},
       </if>

+ 49 - 46
src/main/java/com/steerinfo/ems/trmcalpointvalue/mapper/TRmCalpointValueMapper.xml

@@ -680,51 +680,54 @@
     </select>
   <select id="getDataForBb" resultMap="BaseResultMap">
     select t.*, t2.itemname
-  from (select to_char(dates,'yyyy-mm-dd') as clock, itemid, APPORTVALUE, MINTVALUE, MENDVALUE
-          from EMS_ZY_DAY unpivot((APPORTVALUE, MINTVALUE, MENDVALUE)
-          for itemid in((O2_1_CL_NUM,
-                         O2_1_CL_QC,
-                         O2_1_CL_QM) as
-                         'DL502P00120001',
-                         (O2_2_GCYL_NUM,
-                          O2_2_GCYL_QC,
-                          O2_2_GCYL_QM) as
-                          'DL502P00170001',
-                          (N2_2_CL_NUM,
-                           N2_2_CL_QC,
-                           N2_2_CL_QM) as
-                          'DL486P00220001',
-                           (N2_2_GCYL_NUM,
-                           N2_2_GCYL_QC,
-                           N2_2_GCYL_QM) as
-                          'DL486P00270001',
-                           (N2_2_TCYL_NUM,
-                            N2_2_TCYL_QC,
-                            N2_2_TCYL_QM) as
-                            'DL486P00270002',
-                            (N2_2_JJYL_NUM,
-                             N2_2_JJYL_QC,
-                             N2_2_JJYL_QM) as
-                             'DL486P00210001',
-                             (N2_2_4_GLYL_NUM,
-                             N2_2_4_GLYL_QC,
-                             N2_2_4_GLYL_QM) as
-                             'DL486P00270003',
-                             (AR_2_CL_NUM,
-                              AR_2_CL_QC,
-                              AR_2_CL_QM) as
-                              'DL486P00420001',
-                              (AR_2_GCYL_NUM,
-                              AR_2_GCYL_QC,
-                              AR_2_GCYL_QM) as
-                              'DL510P00410001',
-                              (AR_2_YDQH_NUM,
-                               AR_2_YDQH_QC,
-                              AR_2_YDQH_QM) as
-                              'DL486P00270004'))) t
-      left join t_rm_calpoint t2
-        on t.itemid = t2.itemid
-        where t.clock between to_char(sysdate-7,'yyyy-mm-dd') and to_char(sysdate,'yyyy-mm-dd')
-        order by t.clock
+  from (select to_char(dates, 'yyyy-mm-dd') as clock,
+               itemid,
+               APPORTVALUE,
+               MINTVALUE,
+               MENDVALUE
+          from EMS_ZY_DAY unpivot((APPORTVALUE, MINTVALUE, MENDVALUE) for itemid in((O2_2_CL_NUM,
+                                                                                     O2_2_CL_QC,
+                                                                                     O2_2_CL_QM) as
+                                                                                    'DL502P00120001',
+                                                                                    (O2_2_GCYL_NUM,
+                                                                                     O2_2_GCYL_QC,
+                                                                                     O2_2_GCYL_QM) as
+                                                                                    'DL502P00170001',
+                                                                                    (N2_2_CL_NUM,
+                                                                                     N2_2_CL_QC,
+                                                                                     N2_2_CL_QM) as
+                                                                                    'DL486P00220001',
+                                                                                    (N2_2_GCYL_NUM,
+                                                                                     N2_2_GCYL_QC,
+                                                                                     N2_2_GCYL_QM) as
+                                                                                    'DL486P00270001',
+                                                                                    (N2_2_TCYL_NUM,
+                                                                                     N2_2_TCYL_QC,
+                                                                                     N2_2_TCYL_QM) as
+                                                                                    'DL486P00270002',
+                                                                                    (N2_2_JJYL_NUM,
+                                                                                     N2_2_JJYL_QC,
+                                                                                     N2_2_JJYL_QM) as
+                                                                                    'DL486P00210001',
+                                                                                    (N2_2_4_GLYL_NUM,
+                                                                                     N2_2_4_GLYL_QC,
+                                                                                     N2_2_4_GLYL_QM) as
+                                                                                    'DL486P00270003',
+                                                                                    (AR_2_CL_NUM,
+                                                                                     AR_2_CL_QC,
+                                                                                     AR_2_CL_QM) as
+                                                                                    'DL486P00420001',
+                                                                                    (AR_2_GCYL_NUM,
+                                                                                     AR_2_GCYL_QC,
+                                                                                     AR_2_GCYL_QM) as
+                                                                                    'DL510P00410001',
+                                                                                    (AR_2_YDQH_NUM,
+                                                                                     AR_2_YDQH_QC,
+                                                                                     AR_2_YDQH_QM) as
+                                                                                    'DL486P00270004'))) t
+  left join t_rm_calpoint t2
+    on t.itemid = t2.itemid
+ where t.clock between to_char(sysdate - 6, 'yyyy-mm-dd') and
+       to_char(sysdate -1, 'yyyy-mm-dd')
   </select>
 </mapper>