Bladeren bron

1.水数据重新提交

QuietShadow 3 jaren geleden
bovenliggende
commit
26397610cf
16 gewijzigde bestanden met toevoegingen van 1857 en 129 verwijderingen
  1. 124 0
      src/main/java/com/steerinfo/ems/emswaterrealtime/controller/EmsWaterRealtimeController.java
  2. 26 0
      src/main/java/com/steerinfo/ems/emswaterrealtime/mapper/EmsWaterRealtimeMapper.java
  3. 676 0
      src/main/java/com/steerinfo/ems/emswaterrealtime/mapper/EmsWaterRealtimeMapper.xml
  4. 348 0
      src/main/java/com/steerinfo/ems/emswaterrealtime/model/EmsWaterRealtime.java
  5. 30 0
      src/main/java/com/steerinfo/ems/emswaterrealtime/service/IEmsWaterRealtimeService.java
  6. 172 0
      src/main/java/com/steerinfo/ems/emswaterrealtime/service/impl/EmsWaterRealtimeServiceImpl.java
  7. 106 0
      src/main/java/com/steerinfo/ems/ifmesemsswapfile/controller/IfMesEmsSwapfileController.java
  8. 14 6
      src/main/java/com/steerinfo/ems/ifmesemsswapfile/mapper/IfMesEmsSwapfileMapper.java
  9. 81 4
      src/main/java/com/steerinfo/ems/ifmesemsswapfile/mapper/IfMesEmsSwapfileMapper.xml
  10. 17 6
      src/main/java/com/steerinfo/ems/ifmesemsswapfile/model/IfMesEmsSwapfile.java
  11. 36 5
      src/main/java/com/steerinfo/ems/ifmesemsswapfile/service/IIfMesEmsSwapfileService.java
  12. 124 7
      src/main/java/com/steerinfo/ems/ifmesemsswapfile/service/impl/IfMesEmsSwapfileServiceImpl.java
  13. 6 2
      src/main/java/com/steerinfo/ems/trmworkprocmaterialvalue/mapper/TRmWorkprocMaterialValueMapper.xml
  14. 94 97
      src/main/java/com/steerinfo/ems/trmworkprocmaterialvalue/service/impl/TRmWorkprocMaterialValueServiceImpl.java
  15. 1 1
      src/main/java/com/steerinfo/ems/trmworkprocproductvalue/service/impl/TRmWorkprocProductValueServiceImpl.java
  16. 2 1
      src/main/java/com/steerinfo/ftp/uploadfile/utils/FtpFileUtil.java

+ 124 - 0
src/main/java/com/steerinfo/ems/emswaterrealtime/controller/EmsWaterRealtimeController.java

@@ -0,0 +1,124 @@
+package com.steerinfo.ems.emswaterrealtime.controller;
+
+import com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime;
+import com.steerinfo.ems.emswaterrealtime.service.IEmsWaterRealtimeService;
+import com.steerinfo.ems.trmcalpoint.service.ITRmCalpointService;
+import com.steerinfo.framework.controller.BaseRESTfulController;
+import com.steerinfo.framework.controller.RESTfulResult;
+import com.steerinfo.framework.service.pagehelper.PageList;
+import com.steerinfo.framework.utils.collection.ListUtils;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * EmsWaterRealtime RESTful接口:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2021-08-24 07:52
+ * 类描述
+ * 修订历史:
+ * 日期:2021-08-24
+ * 作者:generator
+ * 参考:
+ * 描述:EmsWaterRealtime RESTful接口
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+@RestController
+@RequestMapping("/${api.version}/emswaterrealtimes")
+public class EmsWaterRealtimeController extends BaseRESTfulController {
+
+    @Autowired
+    IEmsWaterRealtimeService emsWaterRealtimeService;
+
+    @ApiOperation(value="获取列表", notes="分页查询")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
+        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
+    })
+    //@RequiresPermissions("emswaterrealtime:view")
+    @GetMapping(value = "/")
+    public RESTfulResult list(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
+        PageList<EmsWaterRealtime> list = emsWaterRealtimeService.queryForPage(parmas, pageNum, pageSize);
+        return success(list);
+    }
+
+    @ApiOperation(value="获取列表", notes="分页模糊查询")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
+        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
+    })
+    //@RequiresPermissions("emswaterrealtime:view")
+    @GetMapping(value = "/like/")
+    public RESTfulResult listLike(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
+        PageList<EmsWaterRealtime> list = emsWaterRealtimeService.queryLikeForPage(parmas, pageNum, pageSize);
+        return success(list);
+    }
+    
+    @ApiOperation(value="创建", notes="根据EmsWaterRealtime对象创建")
+    @ApiImplicitParam(name = "emsWaterRealtime", value = "详细实体emsWaterRealtime", required = true, dataType = "EmsWaterRealtime")
+    //@RequiresPermissions("emswaterrealtime:create")
+    @PostMapping(value = "/")
+    public RESTfulResult add(@ModelAttribute EmsWaterRealtime model){
+        EmsWaterRealtime emsWaterRealtime = emsWaterRealtimeService.add(model);
+        return success(emsWaterRealtime);
+    }
+
+    @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
+    @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short")
+    //@RequiresPermissions("emswaterrealtime:view")
+    @GetMapping(value = "/{id}")
+    public RESTfulResult get(@PathVariable String id){
+        EmsWaterRealtime emsWaterRealtime = emsWaterRealtimeService.getById(id);
+        return success(emsWaterRealtime);
+    }
+
+    @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的emsWaterRealtime信息来更新详细信息")
+    @ApiImplicitParams({
+        @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short"),
+        @ApiImplicitParam(name = "emsWaterRealtime", value = "详细实体emsWaterRealtime", required = true, dataType = "EmsWaterRealtime")
+    })
+    //@RequiresPermissions("emswaterrealtime:update")
+    @PutMapping(value = "/{id}", produces  = "application/json;charset=UTF-8")
+    public RESTfulResult update(@PathVariable String id, @RequestBody EmsWaterRealtime model){
+        model.setId(id);
+        EmsWaterRealtime emsWaterRealtime = emsWaterRealtimeService.modify(model);
+        return success(emsWaterRealtime);
+    }
+
+    @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
+    @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
+    //@RequiresPermissions("emswaterrealtime:delete")
+    @DeleteMapping(value = "/{id}")//Short
+    public RESTfulResult delete(@PathVariable String id){
+    	List<String> list = Arrays.asList(id.split(","));
+    	if(ListUtils.isNotEmpty(list)) {
+	    	List<String> ids = ListUtils.convertList(list);
+			  emsWaterRealtimeService.delete(ids);
+    	}
+      return success();
+    }
+
+    @Autowired
+    ITRmCalpointService tRmCalpointService;
+
+
+    @ApiOperation(value="生成", notes="生成水数据")
+    //@RequiresPermissions("emswaterrealtime:delete")
+    @GetMapping(value = "/water")//Short
+    public int water(){
+        emsWaterRealtimeService.getWaterListByArmMeter();
+         emsWaterRealtimeService.dataGeneration();
+        //emsWaterRealtimeService.getcalpoint();
+        emsWaterRealtimeService.getWaterTenMinutes();
+
+        tRmCalpointService.statHourData();
+        return 1;
+    }
+}

+ 26 - 0
src/main/java/com/steerinfo/ems/emswaterrealtime/mapper/EmsWaterRealtimeMapper.java

@@ -0,0 +1,26 @@
+package com.steerinfo.ems.emswaterrealtime.mapper;
+
+import com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime;
+import com.steerinfo.ems.trmcalpoint.model.TRmCalpoint;
+import com.steerinfo.framework.mapper.IBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.HashMap;
+import java.util.List;
+
+@Mapper
+public interface EmsWaterRealtimeMapper extends IBaseMapper<EmsWaterRealtime, String> {
+
+    //@TargetDataSource(dataSourceKey = DataSourceKey.DB_OTHER)
+    List<EmsWaterRealtime> getWaterListByArmMeter();
+
+    List<TRmCalpoint> getcalpoint();
+
+    List<EmsWaterRealtime> getWaterTenMinutes();
+
+    int insertWaterTenMinutes(HashMap<String, Object> HashMap);
+
+    int updateWaterTenMinutes(HashMap<String, Object> HashMap);
+
+    int updateWaterMinutes(HashMap<String, Object> HashMap);
+}

+ 676 - 0
src/main/java/com/steerinfo/ems/emswaterrealtime/mapper/EmsWaterRealtimeMapper.xml

@@ -0,0 +1,676 @@
+<?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.steerinfo.ems.emswaterrealtime.mapper.EmsWaterRealtimeMapper">
+  <resultMap id="BaseResultMap" type="com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime">
+    <id column="MeterId" jdbcType="DECIMAL" property="meterid" />
+    <result column="PhoneNo" jdbcType="VARCHAR" property="phoneno" />
+    <result column="AddressCode" jdbcType="VARCHAR" property="addresscode" />
+    <result column="M_UserType" jdbcType="VARCHAR" property="mUsertype" />
+    <result column="M_Type" jdbcType="VARCHAR" property="mType" />
+    <result column="M_Name" jdbcType="VARCHAR" property="mName" />
+    <result column="M_DoorNo" jdbcType="VARCHAR" property="mDoorno" />
+    <result column="M_PipeDn" jdbcType="VARCHAR" property="mPipedn" />
+    <result column="M_Material" jdbcType="VARCHAR" property="mMaterial" />
+    <result column="M_Ratio" jdbcType="VARCHAR" property="mRatio" />
+    <result column="CreateTime" jdbcType="TIMESTAMP" property="createtime" />
+    <result column="ForValue" jdbcType="DECIMAL" property="forvalue" />
+    <result column="RevValue" jdbcType="DECIMAL" property="revvalue" />
+    <result column="PressValue" jdbcType="DECIMAL" property="pressvalue" />
+    <result column="RealValue" jdbcType="DECIMAL" property="realvalue" />
+    <result column="SumValue" jdbcType="DECIMAL" property="sumvalue" />
+    <result column="CelVal" jdbcType="DECIMAL" property="celval" />
+    <result column="NetVal" jdbcType="DECIMAL" property="netval" />
+    <result column="IsStat" jdbcType="CHAR" property="isstat" />
+    <result column="DeviceId" jdbcType="VARCHAR" property="deviceid" />
+    <result column="ReadTime" jdbcType="TIMESTAMP" property="readtime" />
+  </resultMap>
+  <sql id="columns">
+    MeterId, PhoneNo, AddressCode, M_UserType, M_Type, M_Name, M_DoorNo, M_PipeDn, M_Material, 
+    M_Ratio, CreateTime, ForValue, RevValue, PressValue, RealValue, SumValue, CelVal, 
+    NetVal, IsStat, DeviceId, ReadTime
+  </sql>
+  <sql id="columns_alias">
+    t.MeterId, t.PhoneNo, t.AddressCode, t.M_UserType, t.M_Type, t.M_Name, t.M_DoorNo, 
+    t.M_PipeDn, t.M_Material, t.M_Ratio, t.CreateTime, t.ForValue, t.RevValue, t.PressValue, 
+    t.RealValue, t.SumValue, t.CelVal, t.NetVal, t.IsStat, t.DeviceId, t.ReadTime
+  </sql>
+  <sql id="select">
+    SELECT <include refid="columns"/> FROM EMS_WATER_REALTIME
+  </sql>
+  <sql id="select_alias">
+    SELECT <include refid="columns_alias"/> FROM EMS_WATER_REALTIME t
+  </sql>
+  <sql id="where">
+    <where> 
+      <if test="meterid != null">
+        and MeterId = #{meterid}
+      </if>
+      <if test="phoneno != null and phoneno != ''">
+        and PhoneNo = #{phoneno}
+      </if>
+      <if test="addresscode != null and addresscode != ''">
+        and AddressCode = #{addresscode}
+      </if>
+      <if test="mUsertype != null and mUsertype != ''">
+        and M_UserType = #{mUsertype}
+      </if>
+      <if test="mType != null and mType != ''">
+        and M_Type = #{mType}
+      </if>
+      <if test="mName != null and mName != ''">
+        and M_Name = #{mName}
+      </if>
+      <if test="mDoorno != null and mDoorno != ''">
+        and M_DoorNo = #{mDoorno}
+      </if>
+      <if test="mPipedn != null and mPipedn != ''">
+        and M_PipeDn = #{mPipedn}
+      </if>
+      <if test="mMaterial != null and mMaterial != ''">
+        and M_Material = #{mMaterial}
+      </if>
+      <if test="mRatio != null and mRatio != ''">
+        and M_Ratio = #{mRatio}
+      </if>
+      <if test="createtime != null">
+        and TO_CHAR(CreateTime,'yyyy-MM-dd') = #{createtime}
+      </if>
+      <if test="forvalue != null">
+        and ForValue = #{forvalue}
+      </if>
+      <if test="revvalue != null">
+        and RevValue = #{revvalue}
+      </if>
+      <if test="pressvalue != null">
+        and PressValue = #{pressvalue}
+      </if>
+      <if test="realvalue != null">
+        and RealValue = #{realvalue}
+      </if>
+      <if test="sumvalue != null">
+        and SumValue = #{sumvalue}
+      </if>
+      <if test="celval != null">
+        and CelVal = #{celval}
+      </if>
+      <if test="netval != null">
+        and NetVal = #{netval}
+      </if>
+      <if test="isstat != null">
+        and IsStat = #{isstat}
+      </if>
+      <if test="deviceid != null and deviceid != ''">
+        and DeviceId = #{deviceid}
+      </if>
+      <if test="readtime != null">
+        and TO_CHAR(ReadTime,'yyyy-MM-dd') = #{readtime}
+      </if>
+    </where>
+  </sql>
+  <sql id="whereLike">
+    <where> 
+      <if test="meterid != null">
+        and MeterId = #{meterid}
+      </if>
+      <if test="phoneno != null and phoneno != ''">
+        and PhoneNo LIKE '%${phoneno}%'
+      </if>
+      <if test="addresscode != null and addresscode != ''">
+        and AddressCode LIKE '%${addresscode}%'
+      </if>
+      <if test="mUsertype != null and mUsertype != ''">
+        and M_UserType LIKE '%${mUsertype}%'
+      </if>
+      <if test="mType != null and mType != ''">
+        and M_Type LIKE '%${mType}%'
+      </if>
+      <if test="mName != null and mName != ''">
+        and M_Name LIKE '%${mName}%'
+      </if>
+      <if test="mDoorno != null and mDoorno != ''">
+        and M_DoorNo LIKE '%${mDoorno}%'
+      </if>
+      <if test="mPipedn != null and mPipedn != ''">
+        and M_PipeDn LIKE '%${mPipedn}%'
+      </if>
+      <if test="mMaterial != null and mMaterial != ''">
+        and M_Material LIKE '%${mMaterial}%'
+      </if>
+      <if test="mRatio != null and mRatio != ''">
+        and M_Ratio LIKE '%${mRatio}%'
+      </if>
+      <if test="createtime != null">
+        and TO_CHAR(CreateTime,'yyyy-MM-dd') = #{createtime}
+      </if>
+      <if test="forvalue != null">
+        and ForValue = #{forvalue}
+      </if>
+      <if test="revvalue != null">
+        and RevValue = #{revvalue}
+      </if>
+      <if test="pressvalue != null">
+        and PressValue = #{pressvalue}
+      </if>
+      <if test="realvalue != null">
+        and RealValue = #{realvalue}
+      </if>
+      <if test="sumvalue != null">
+        and SumValue = #{sumvalue}
+      </if>
+      <if test="celval != null">
+        and CelVal = #{celval}
+      </if>
+      <if test="netval != null">
+        and NetVal = #{netval}
+      </if>
+      <if test="isstat != null">
+        and IsStat = #{isstat}
+      </if>
+      <if test="deviceid != null and deviceid != ''">
+        and DeviceId LIKE '%${deviceid}%'
+      </if>
+      <if test="readtime != null">
+        and TO_CHAR(ReadTime,'yyyy-MM-dd') = #{readtime}
+      </if>
+    </where>
+  </sql>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from EMS_WATER_REALTIME
+    where MeterId = #{meterid,jdbcType=DECIMAL}
+  </delete>
+  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+    delete from EMS_WATER_REALTIME
+    where 1!=1 
+      <if test="phoneno != null and phoneno != ''">
+        or PhoneNo = #{phoneno}
+      </if>
+      <if test="addresscode != null and addresscode != ''">
+        or AddressCode = #{addresscode}
+      </if>
+      <if test="mUsertype != null and mUsertype != ''">
+        or M_UserType = #{mUsertype}
+      </if>
+      <if test="mType != null and mType != ''">
+        or M_Type = #{mType}
+      </if>
+      <if test="mName != null and mName != ''">
+        or M_Name = #{mName}
+      </if>
+      <if test="mDoorno != null and mDoorno != ''">
+        or M_DoorNo = #{mDoorno}
+      </if>
+      <if test="mPipedn != null and mPipedn != ''">
+        or M_PipeDn = #{mPipedn}
+      </if>
+      <if test="mMaterial != null and mMaterial != ''">
+        or M_Material = #{mMaterial}
+      </if>
+      <if test="mRatio != null and mRatio != ''">
+        or M_Ratio = #{mRatio}
+      </if>
+      <if test="createtime != null">
+        or TO_CHAR(CreateTime,'yyyy-MM-dd') = '#{createtime}'
+      </if>
+      <if test="forvalue != null">
+        or ForValue = #{forvalue}
+      </if>
+      <if test="revvalue != null">
+        or RevValue = #{revvalue}
+      </if>
+      <if test="pressvalue != null">
+        or PressValue = #{pressvalue}
+      </if>
+      <if test="realvalue != null">
+        or RealValue = #{realvalue}
+      </if>
+      <if test="sumvalue != null">
+        or SumValue = #{sumvalue}
+      </if>
+      <if test="celval != null">
+        or CelVal = #{celval}
+      </if>
+      <if test="netval != null">
+        or NetVal = #{netval}
+      </if>
+      <if test="isstat != null">
+        or IsStat = #{isstat}
+      </if>
+      <if test="deviceid != null and deviceid != ''">
+        or DeviceId = #{deviceid}
+      </if>
+      <if test="readtime != null">
+        or TO_CHAR(ReadTime,'yyyy-MM-dd') = '#{readtime}'
+      </if>
+  </delete>
+  <insert id="insert" parameterType="com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime">
+    insert into EMS_WATER_REALTIME (MeterId, PhoneNo, AddressCode, 
+      M_UserType, M_Type, M_Name, 
+      M_DoorNo, M_PipeDn, M_Material, 
+      M_Ratio, CreateTime, ForValue,
+      RevValue, PressValue, RealValue, 
+      SumValue, CelVal, NetVal, 
+      IsStat, DeviceId, ReadTime
+      )
+    values (#{meterid,jdbcType=DECIMAL}, #{phoneno,jdbcType=VARCHAR}, #{addresscode,jdbcType=VARCHAR}, 
+      #{mUsertype,jdbcType=VARCHAR}, #{mType,jdbcType=VARCHAR}, #{mName,jdbcType=VARCHAR}, 
+      #{mDoorno,jdbcType=VARCHAR}, #{mPipedn,jdbcType=VARCHAR}, #{mMaterial,jdbcType=VARCHAR}, 
+      #{mRatio,jdbcType=VARCHAR},
+    to_date (substr( #{createtime,jdbcType=TIME}, 0, INSTR( #{createtime,jdbcType=TIME}, '.', 1, 1 )-1), 'YYYY-MM-DD HH24:MI:SS' ),
+    #{forvalue,jdbcType=DECIMAL},
+      #{revvalue,jdbcType=DECIMAL}, #{pressvalue,jdbcType=DECIMAL}, #{realvalue,jdbcType=DECIMAL}, 
+      #{sumvalue,jdbcType=DECIMAL}, #{celval,jdbcType=DECIMAL}, #{netval,jdbcType=DECIMAL}, 
+      #{isstat,jdbcType=CHAR}, #{deviceid,jdbcType=VARCHAR}, to_date ( #{readtime,jdbcType=TIME} , 'YYYY-MM-DD HH24:MI:SS' )
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime">
+    insert into EMS_WATER_REALTIME
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="meterid != null">
+        MeterId,
+      </if>
+      <if test="phoneno != null">
+        PhoneNo,
+      </if>
+      <if test="addresscode != null">
+        AddressCode,
+      </if>
+      <if test="mUsertype != null">
+        M_UserType,
+      </if>
+      <if test="mType != null">
+        M_Type,
+      </if>
+      <if test="mName != null">
+        M_Name,
+      </if>
+      <if test="mDoorno != null">
+        M_DoorNo,
+      </if>
+      <if test="mPipedn != null">
+        M_PipeDn,
+      </if>
+      <if test="mMaterial != null">
+        M_Material,
+      </if>
+      <if test="mRatio != null">
+        M_Ratio,
+      </if>
+      <if test="createtime != null">
+        CreateTime,
+      </if>
+      <if test="forvalue != null">
+        ForValue,
+      </if>
+      <if test="revvalue != null">
+        RevValue,
+      </if>
+      <if test="pressvalue != null">
+        PressValue,
+      </if>
+      <if test="realvalue != null">
+        RealValue,
+      </if>
+      <if test="sumvalue != null">
+        SumValue,
+      </if>
+      <if test="celval != null">
+        CelVal,
+      </if>
+      <if test="netval != null">
+        NetVal,
+      </if>
+      <if test="isstat != null">
+        IsStat,
+      </if>
+      <if test="deviceid != null">
+        DeviceId,
+      </if>
+      <if test="readtime != null">
+        ReadTime,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="meterid != null">
+        #{meterid,jdbcType=DECIMAL},
+      </if>
+      <if test="phoneno != null">
+        #{phoneno,jdbcType=VARCHAR},
+      </if>
+      <if test="addresscode != null">
+        #{addresscode,jdbcType=VARCHAR},
+      </if>
+      <if test="mUsertype != null">
+        #{mUsertype,jdbcType=VARCHAR},
+      </if>
+      <if test="mType != null">
+        #{mType,jdbcType=VARCHAR},
+      </if>
+      <if test="mName != null">
+        #{mName,jdbcType=VARCHAR},
+      </if>
+      <if test="mDoorno != null">
+        #{mDoorno,jdbcType=VARCHAR},
+      </if>
+      <if test="mPipedn != null">
+        #{mPipedn,jdbcType=VARCHAR},
+      </if>
+      <if test="mMaterial != null">
+        #{mMaterial,jdbcType=VARCHAR},
+      </if>
+      <if test="mRatio != null">
+        #{mRatio,jdbcType=VARCHAR},
+      </if>
+      <if test="createtime != null">
+        #{createtime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="forvalue != null">
+        #{forvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="revvalue != null">
+        #{revvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="pressvalue != null">
+        #{pressvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="realvalue != null">
+        #{realvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="sumvalue != null">
+        #{sumvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="celval != null">
+        #{celval,jdbcType=DECIMAL},
+      </if>
+      <if test="netval != null">
+        #{netval,jdbcType=DECIMAL},
+      </if>
+      <if test="isstat != null">
+        #{isstat,jdbcType=CHAR},
+      </if>
+      <if test="deviceid != null">
+        #{deviceid,jdbcType=VARCHAR},
+      </if>
+      <if test="readtime != null">
+        #{readtime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime">
+    update EMS_WATER_REALTIME
+    set PhoneNo = #{phoneno,jdbcType=VARCHAR},
+      AddressCode = #{addresscode,jdbcType=VARCHAR},
+      M_UserType = #{mUsertype,jdbcType=VARCHAR},
+      M_Type = #{mType,jdbcType=VARCHAR},
+      M_Name = #{mName,jdbcType=VARCHAR},
+      M_DoorNo = #{mDoorno,jdbcType=VARCHAR},
+      M_PipeDn = #{mPipedn,jdbcType=VARCHAR},
+      M_Material = #{mMaterial,jdbcType=VARCHAR},
+      M_Ratio = #{mRatio,jdbcType=VARCHAR},
+      CreateTime = to_date (substr( #{createtime,jdbcType=TIME}, 0, INSTR( #{createtime,jdbcType=TIME}, '.', 1, 1 )-1), 'YYYY-MM-DD HH24:MI:SS' ),
+      ForValue = #{forvalue,jdbcType=DECIMAL},
+      RevValue = #{revvalue,jdbcType=DECIMAL},
+      PressValue = #{pressvalue,jdbcType=DECIMAL},
+      RealValue = #{realvalue,jdbcType=DECIMAL},
+      SumValue = #{sumvalue,jdbcType=DECIMAL},
+      CelVal = #{celval,jdbcType=DECIMAL},
+      NetVal = #{netval,jdbcType=DECIMAL},
+      IsStat = #{isstat,jdbcType=CHAR},
+      DeviceId = #{deviceid,jdbcType=VARCHAR},
+      ReadTime = to_date (#{readtime,jdbcType=TIME}, 'YYYY-MM-DD HH24:MI:SS' )
+    where MeterId = #{meterid,jdbcType=DECIMAL}
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime">
+    update EMS_WATER_REALTIME
+    <set>
+      <if test="phoneno != null">
+        PhoneNo = #{phoneno,jdbcType=VARCHAR},
+      </if>
+      <if test="addresscode != null">
+        AddressCode = #{addresscode,jdbcType=VARCHAR},
+      </if>
+      <if test="mUsertype != null">
+        M_UserType = #{mUsertype,jdbcType=VARCHAR},
+      </if>
+      <if test="mType != null">
+        M_Type = #{mType,jdbcType=VARCHAR},
+      </if>
+      <if test="mName != null">
+        M_Name = #{mName,jdbcType=VARCHAR},
+      </if>
+      <if test="mDoorno != null">
+        M_DoorNo = #{mDoorno,jdbcType=VARCHAR},
+      </if>
+      <if test="mPipedn != null">
+        M_PipeDn = #{mPipedn,jdbcType=VARCHAR},
+      </if>
+      <if test="mMaterial != null">
+        M_Material = #{mMaterial,jdbcType=VARCHAR},
+      </if>
+      <if test="mRatio != null">
+        M_Ratio = #{mRatio,jdbcType=VARCHAR},
+      </if>
+      <if test="createtime != null">
+        CreateTime = #{createtime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="forvalue != null">
+        ForValue = #{forvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="revvalue != null">
+        RevValue = #{revvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="pressvalue != null">
+        PressValue = #{pressvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="realvalue != null">
+        RealValue = #{realvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="sumvalue != null">
+        SumValue = #{sumvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="celval != null">
+        CelVal = #{celval,jdbcType=DECIMAL},
+      </if>
+      <if test="netval != null">
+        NetVal = #{netval,jdbcType=DECIMAL},
+      </if>
+      <if test="isstat != null">
+        IsStat = #{isstat,jdbcType=CHAR},
+      </if>
+      <if test="deviceid != null">
+        DeviceId = #{deviceid,jdbcType=VARCHAR},
+      </if>
+      <if test="readtime != null">
+        ReadTime = #{readtime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where MeterId = #{meterid,jdbcType=DECIMAL}
+  </update>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    <include refid="select"/>
+    where MeterId = #{meterid,jdbcType=DECIMAL}
+  </select>
+  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    <include refid="select"/>
+    <include refid="where"/>
+  </select>
+  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    <include refid="select"/>
+    <include refid="whereLike"/>
+  </select>
+  <insert id="batchInsert" parameterType="java.util.List">
+    insert into EMS_WATER_REALTIME 
+      (MeterId, 
+      PhoneNo, AddressCode, M_UserType, 
+      M_Type, M_Name, M_DoorNo, 
+      M_PipeDn, M_Material, M_Ratio, 
+      CreateTime, ForValue, RevValue, 
+      PressValue, RealValue, SumValue, 
+      CelVal, NetVal, IsStat, 
+      DeviceId, ReadTime)
+    ( <foreach collection="list" item="item" separator="union all"> 
+   select  
+      #{item.meterid,jdbcType=DECIMAL}, 
+      #{item.phoneno,jdbcType=VARCHAR}, #{item.addresscode,jdbcType=VARCHAR}, #{item.mUsertype,jdbcType=VARCHAR}, 
+      #{item.mType,jdbcType=VARCHAR}, #{item.mName,jdbcType=VARCHAR}, #{item.mDoorno,jdbcType=VARCHAR}, 
+      #{item.mPipedn,jdbcType=VARCHAR}, #{item.mMaterial,jdbcType=VARCHAR}, #{item.mRatio,jdbcType=VARCHAR}, 
+      #{item.createtime,jdbcType=TIMESTAMP}, #{item.forvalue,jdbcType=DECIMAL}, #{item.revvalue,jdbcType=DECIMAL}, 
+      #{item.pressvalue,jdbcType=DECIMAL}, #{item.realvalue,jdbcType=DECIMAL}, #{item.sumvalue,jdbcType=DECIMAL}, 
+      #{item.celval,jdbcType=DECIMAL}, #{item.netval,jdbcType=DECIMAL}, #{item.isstat,jdbcType=CHAR}, 
+      #{item.deviceid,jdbcType=VARCHAR}, #{item.readtime,jdbcType=TIMESTAMP} from dual  
+   </foreach> )
+  </insert>
+  <update id="batchUpdate" parameterType="java.util.List">
+     update EMS_WATER_REALTIME
+     set
+       MeterId=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.meterid,jdbcType=DECIMAL}
+       </foreach>
+       ,PhoneNo=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.phoneno,jdbcType=VARCHAR}
+       </foreach>
+       ,AddressCode=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.addresscode,jdbcType=VARCHAR}
+       </foreach>
+       ,M_UserType=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.mUsertype,jdbcType=VARCHAR}
+       </foreach>
+       ,M_Type=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.mType,jdbcType=VARCHAR}
+       </foreach>
+       ,M_Name=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.mName,jdbcType=VARCHAR}
+       </foreach>
+       ,M_DoorNo=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.mDoorno,jdbcType=VARCHAR}
+       </foreach>
+       ,M_PipeDn=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.mPipedn,jdbcType=VARCHAR}
+       </foreach>
+       ,M_Material=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.mMaterial,jdbcType=VARCHAR}
+       </foreach>
+       ,M_Ratio=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.mRatio,jdbcType=VARCHAR}
+       </foreach>
+       ,CreateTime=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.createtime,jdbcType=TIMESTAMP}
+       </foreach>
+       ,ForValue=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.forvalue,jdbcType=DECIMAL}
+       </foreach>
+       ,RevValue=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.revvalue,jdbcType=DECIMAL}
+       </foreach>
+       ,PressValue=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.pressvalue,jdbcType=DECIMAL}
+       </foreach>
+       ,RealValue=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.realvalue,jdbcType=DECIMAL}
+       </foreach>
+       ,SumValue=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.sumvalue,jdbcType=DECIMAL}
+       </foreach>
+       ,CelVal=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.celval,jdbcType=DECIMAL}
+       </foreach>
+       ,NetVal=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.netval,jdbcType=DECIMAL}
+       </foreach>
+       ,IsStat=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.isstat,jdbcType=CHAR}
+       </foreach>
+       ,DeviceId=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.deviceid,jdbcType=VARCHAR}
+       </foreach>
+       ,ReadTime=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.readtime,jdbcType=TIMESTAMP}
+       </foreach>
+     where MeterId in 
+     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+    #{item.meterid,jdbcType=DECIMAL}
+     </foreach> 
+  </update>
+  <delete id="batchDelete" parameterType="java.util.List">
+    delete from EMS_WATER_REALTIME
+    where MeterId in 
+    <foreach collection="list" item="id" open="(" close=")" separator=",">
+      #{id}
+    </foreach>
+  </delete>
+  <!-- 友情提示!!!-->
+  <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+      <select id="getWaterListByArmMeter" resultMap="BaseResultMap">
+        SELECT MeterId, PhoneNo, AddressCode, M_UserType, M_Type
+             , M_Name, M_DoorNo, M_PipeDn, M_Material, M_Ratio, CreateTime
+             , ForValue, RevValue, PressValue, RealValue, SumValue, CelVal
+             , NetVal, IsStat, DeviceId FROM ARM_Meter WITH (NOLOCK) where CreateTime >= '2021-08-01'
+<!--        FROM Meter_Base.dbo.ARM_Meter-->
+    </select>
+  <select id="getcalpoint"
+          resultType="com.steerinfo.ems.trmcalpoint.model.TRmCalpoint">
+    SELECT * FROM T_RM_CALPOINT WHERE ITEMID  not in
+    (SELECT t.ITEMID FROM T_RM_CALPOINT t JOIN FORMULA f ON t.ITEMID =f.CODE)
+  </select>
+  <select id="getWaterTenMinutes" resultMap="BaseResultMap">
+    SELECT w.FORVALUE AS SUMVALUE,
+<!--(w.FORVALUE - w.REVVALUE) -->
+    c.BTYPE2 AS M_TYPE,  c.SOURCE_TYPE AS M_MATERIAL
+    FROM T_RM_LOCATION l
+    JOIN T_RM_CALPOINT c ON l.ID = c.LOCATEID
+    AND c.ENERGYTYPEID = 'W' AND c.ITEMTYPE='AUTO'
+    LEFT JOIN EMS_WATER_REALTIME w ON l.BCODE = w.ADDRESSCODE
+    ORDER BY TO_NUMBER(regexp_substr(l.ID,'[0-9.]+'))
+  </select>
+  <insert id="insertWaterTenMinutes" parameterType="java.util.HashMap">
+    INSERT INTO EMS_WATER_TIMING(TMSTMP, TIM,
+    YZGXS_YSX, YLT_ZWATER_ACC2, BWFDZ_CYS_ZYLLJ, LG1_SCXINS_ACC2, SJ2_YRXINS_ACC,
+    SJ2_YRXINS_ACC2, JH1_GLXINS_ACC, YLT_HQXINS_ACC, YJ_SC_FOLW1, YSJ_CYS_TO_LG,
+    ESJ_CYS_TO_LG, YSJ_CYS_ACC, ESJ_CYS_ACC, BWFDZ_CYWATER_ACC, EJH_XS_HQ_JLS_ACC) VALUES
+    (to_date (#{clock1,jdbcType=TIME}, 'YYYY-MM-DD HH24:MI:SS' ),
+    to_date (#{clock2,jdbcType=TIME}, 'YYYY-MM-DD HH24:MI:SS' ),
+    0.00, 0.00, 0.00, 0.00, 0.00,
+    0.00, 0.00, 0.00, 0.00, 0.00,
+    0.00, 0.00, 0.00, 0.00, 0.00
+    )
+  </insert>
+  <update id="updateWaterTenMinutes" parameterType="java.util.HashMap">
+    update EMS_WATER_TIMING
+    <set>
+      <if test="clock2 != null and clock2 != ''">
+        TIM = to_date (#{clock2,jdbcType=TIME}, 'YYYY-MM-DD HH24:MI:SS' )
+      </if>
+      ${sql}
+    </set>
+    where TMSTMP =to_date (#{clock1,jdbcType=TIME}, 'YYYY-MM-DD HH24:MI:SS' )
+  </update>
+  <update id="updateWaterMinutes" parameterType="java.util.HashMap">
+    update ${table}
+    <set>
+      <if test="clock != null and clock2 != ''">
+        TMSTMP = to_date (#{clock,jdbcType=TIME}, 'YYYY-MM-DD HH24:MI:SS' )
+      </if>
+      ${sql}
+    </set>
+  </update>
+</mapper>

+ 348 - 0
src/main/java/com/steerinfo/ems/emswaterrealtime/model/EmsWaterRealtime.java

@@ -0,0 +1,348 @@
+package com.steerinfo.ems.emswaterrealtime.model;
+
+import com.steerinfo.framework.model.IBasePO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+
+@ApiModel(value="null")
+public class EmsWaterRealtime implements IBasePO<String> {
+    /**
+     * 表主键(MeterId,DECIMAL,0)
+     */
+    @ApiModelProperty(value="表主键",required=true)
+    private String meterid;
+
+    /**
+     * SIM卡号(PhoneNo,VARCHAR,11)
+     */
+    @ApiModelProperty(value="SIM卡号",required=true)
+    private String phoneno;
+
+    /**
+     * 地址编码(AddressCode,VARCHAR,10)
+     */
+    @ApiModelProperty(value="地址编码",required=true)
+    private String addresscode;
+
+    /**
+     * 用水类型(M_UserType,VARCHAR,20)
+     */
+    @ApiModelProperty(value="用水类型",required=true)
+    private String mUsertype;
+
+    /**
+     * 站点类型(M_Type,VARCHAR,50)
+     */
+    @ApiModelProperty(value="站点类型",required=false)
+    private String mType;
+
+    /**
+     * 站点名称(M_Name,VARCHAR,50)
+     */
+    @ApiModelProperty(value="站点名称",required=false)
+    private String mName;
+
+    /**
+     * 户号(M_DoorNo,VARCHAR,20)
+     */
+    @ApiModelProperty(value="户号",required=false)
+    private String mDoorno;
+
+    /**
+     * 管径大小(M_PipeDn,VARCHAR,20)
+     */
+    @ApiModelProperty(value="管径大小",required=false)
+    private String mPipedn;
+
+    /**
+     * 管线材质(M_Material,VARCHAR,20)
+     */
+    @ApiModelProperty(value="管线材质",required=false)
+    private String mMaterial;
+
+    /**
+     * 变比(M_Ratio,VARCHAR,5)
+     */
+    @ApiModelProperty(value="变比",required=false)
+    private String mRatio;
+
+    /**
+     * 刷新时间(CreateTime,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="刷新时间",required=false)
+    private String createtime;
+
+    /**
+     * 正向读数(ForValue,DECIMAL,9)
+     */
+    @ApiModelProperty(value="正向读数",required=false)
+    private BigDecimal forvalue;
+
+    /**
+     * 反向读数(RevValue,DECIMAL,9)
+     */
+    @ApiModelProperty(value="反向读数",required=false)
+    private BigDecimal revvalue;
+
+    /**
+     * 管道压力(PressValue,DECIMAL,9)
+     */
+    @ApiModelProperty(value="管道压力",required=false)
+    private BigDecimal pressvalue;
+
+    /**
+     * 瞬时流量(RealValue,DECIMAL,9)
+     */
+    @ApiModelProperty(value="瞬时流量",required=false)
+    private BigDecimal realvalue;
+
+    /**
+     * 累计流量(SumValue,DECIMAL,9)
+     */
+    @ApiModelProperty(value="累计流量",required=false)
+    private BigDecimal sumvalue;
+
+    /**
+     * 电池电压(CelVal,DECIMAL,5)
+     */
+    @ApiModelProperty(value="电池电压",required=false)
+    private BigDecimal celval;
+
+    /**
+     * 网络信号(NetVal,DECIMAL,38)
+     */
+    @ApiModelProperty(value="网络信号",required=false)
+    private BigDecimal netval;
+
+    /**
+     * 状态标识(IsStat,CHAR,1)
+     */
+    @ApiModelProperty(value="状态标识",required=false)
+    private String isstat;
+
+    /**
+     * 设备id(DeviceId,VARCHAR,20)
+     */
+    @ApiModelProperty(value="设备id",required=false)
+    private String deviceid;
+
+    /**
+     * 读取时间(ReadTime,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="读取时间",required=false)
+    private String readtime;
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public String getId() {
+        return this.meterid;
+    }
+
+    @Override
+    public void setId(String meterid) {
+        this.meterid = meterid;
+    }
+
+    public String getMeterid() {
+        return meterid;
+    }
+
+    public void setMeterid(String meterid) {
+        this.meterid = meterid;
+    }
+
+    public String getPhoneno() {
+        return phoneno;
+    }
+
+    public void setPhoneno(String phoneno) {
+        this.phoneno = phoneno == null ? null : phoneno.trim();
+    }
+
+    public String getAddresscode() {
+        return addresscode;
+    }
+
+    public void setAddresscode(String addresscode) {
+        this.addresscode = addresscode == null ? null : addresscode.trim();
+    }
+
+    public String getmUsertype() {
+        return mUsertype;
+    }
+
+    public void setmUsertype(String mUsertype) {
+        this.mUsertype = mUsertype == null ? null : mUsertype.trim();
+    }
+
+    public String getmType() {
+        return mType;
+    }
+
+    public void setmType(String mType) {
+        this.mType = mType == null ? null : mType.trim();
+    }
+
+    public String getmName() {
+        return mName;
+    }
+
+    public void setmName(String mName) {
+        this.mName = mName == null ? null : mName.trim();
+    }
+
+    public String getmDoorno() {
+        return mDoorno;
+    }
+
+    public void setmDoorno(String mDoorno) {
+        this.mDoorno = mDoorno == null ? null : mDoorno.trim();
+    }
+
+    public String getmPipedn() {
+        return mPipedn;
+    }
+
+    public void setmPipedn(String mPipedn) {
+        this.mPipedn = mPipedn == null ? null : mPipedn.trim();
+    }
+
+    public String getmMaterial() {
+        return mMaterial;
+    }
+
+    public void setmMaterial(String mMaterial) {
+        this.mMaterial = mMaterial == null ? null : mMaterial.trim();
+    }
+
+    public String getmRatio() {
+        return mRatio;
+    }
+
+    public void setmRatio(String mRatio) {
+        this.mRatio = mRatio == null ? null : mRatio.trim();
+    }
+
+    public String getCreatetime() {
+        return createtime;
+    }
+
+    public void setCreatetime(String createtime) {
+        this.createtime = createtime;
+    }
+
+    public BigDecimal getForvalue() {
+        return forvalue;
+    }
+
+    public void setForvalue(BigDecimal forvalue) {
+        this.forvalue = forvalue;
+    }
+
+    public BigDecimal getRevvalue() {
+        return revvalue;
+    }
+
+    public void setRevvalue(BigDecimal revvalue) {
+        this.revvalue = revvalue;
+    }
+
+    public BigDecimal getPressvalue() {
+        return pressvalue;
+    }
+
+    public void setPressvalue(BigDecimal pressvalue) {
+        this.pressvalue = pressvalue;
+    }
+
+    public BigDecimal getRealvalue() {
+        return realvalue;
+    }
+
+    public void setRealvalue(BigDecimal realvalue) {
+        this.realvalue = realvalue;
+    }
+
+    public BigDecimal getSumvalue() {
+        return sumvalue;
+    }
+
+    public void setSumvalue(BigDecimal sumvalue) {
+        this.sumvalue = sumvalue;
+    }
+
+    public BigDecimal getCelval() {
+        return celval;
+    }
+
+    public void setCelval(BigDecimal celval) {
+        this.celval = celval;
+    }
+
+    public BigDecimal getNetval() {
+        return netval;
+    }
+
+    public void setNetval(BigDecimal netval) {
+        this.netval = netval;
+    }
+
+    public String getIsstat() {
+        return isstat;
+    }
+
+    public void setIsstat(String isstat) {
+        this.isstat = isstat == null ? null : isstat.trim();
+    }
+
+    public String getDeviceid() {
+        return deviceid;
+    }
+
+    public void setDeviceid(String deviceid) {
+        this.deviceid = deviceid == null ? null : deviceid.trim();
+    }
+
+    public String getReadtime() {
+        return readtime;
+    }
+
+    public void setReadtime(String readtime) {
+        this.readtime = readtime;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", meterid=").append(meterid);
+        sb.append(", phoneno=").append(phoneno);
+        sb.append(", addresscode=").append(addresscode);
+        sb.append(", mUsertype=").append(mUsertype);
+        sb.append(", mType=").append(mType);
+        sb.append(", mName=").append(mName);
+        sb.append(", mDoorno=").append(mDoorno);
+        sb.append(", mPipedn=").append(mPipedn);
+        sb.append(", mMaterial=").append(mMaterial);
+        sb.append(", mRatio=").append(mRatio);
+        sb.append(", createtime=").append(createtime);
+        sb.append(", forvalue=").append(forvalue);
+        sb.append(", revvalue=").append(revvalue);
+        sb.append(", pressvalue=").append(pressvalue);
+        sb.append(", realvalue=").append(realvalue);
+        sb.append(", sumvalue=").append(sumvalue);
+        sb.append(", celval=").append(celval);
+        sb.append(", netval=").append(netval);
+        sb.append(", isstat=").append(isstat);
+        sb.append(", deviceid=").append(deviceid);
+        sb.append(", readtime=").append(readtime);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 30 - 0
src/main/java/com/steerinfo/ems/emswaterrealtime/service/IEmsWaterRealtimeService.java

@@ -0,0 +1,30 @@
+package com.steerinfo.ems.emswaterrealtime.service;
+
+import com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime;
+import com.steerinfo.framework.service.IBaseService;
+
+import java.util.List;
+
+/**
+ * EmsWaterRealtime服务接口:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2021-08-24 07:52
+ * 类描述
+ * 修订历史:
+ * 日期:2021-08-24
+ * 作者:generator
+ * 参考:
+ * 描述:EmsWaterRealtime服务接口
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+public interface IEmsWaterRealtimeService extends IBaseService<EmsWaterRealtime, String>{
+
+    List<EmsWaterRealtime> getWaterListByArmMeter();
+
+   int dataGeneration();
+
+    void getcalpoint();
+
+    void getWaterTenMinutes();
+}

+ 172 - 0
src/main/java/com/steerinfo/ems/emswaterrealtime/service/impl/EmsWaterRealtimeServiceImpl.java

@@ -0,0 +1,172 @@
+package com.steerinfo.ems.emswaterrealtime.service.impl;
+
+import com.steerinfo.auth.utils.JwtUtil;
+import com.steerinfo.ems.Utils.DateUtils;
+import com.steerinfo.ems.emswaterrealtime.mapper.EmsWaterRealtimeMapper;
+import com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime;
+import com.steerinfo.ems.emswaterrealtime.service.IEmsWaterRealtimeService;
+import com.steerinfo.ems.formula.model.Formula;
+import com.steerinfo.ems.formula.service.IFormulaService;
+import com.steerinfo.ems.ifmesemsswapfile.service.impl.IfMesEmsSwapfileServiceImpl;
+import com.steerinfo.ems.trmcalpoint.model.TRmCalpoint;
+import com.steerinfo.framework.datasource.DataSourceKey;
+import com.steerinfo.framework.datasource.TargetDataSource;
+import com.steerinfo.framework.mapper.IBaseMapper;
+import com.steerinfo.framework.service.impl.BaseServiceImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * EmsWaterRealtime服务实现:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2021-08-24 07:52
+ * 类描述
+ * 修订历史:
+ * 日期:2021-08-24
+ * 作者:generator
+ * 参考:
+ * 描述:EmsWaterRealtime服务实现
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+@Service(value = "emsWaterRealtimeService")
+public class EmsWaterRealtimeServiceImpl extends BaseServiceImpl<EmsWaterRealtime, String> implements IEmsWaterRealtimeService {
+
+    private static final Logger logger = LoggerFactory.getLogger(IfMesEmsSwapfileServiceImpl.class);
+
+    @Autowired
+    private EmsWaterRealtimeMapper emsWaterRealtimeMapper;
+
+    @Override
+    protected IBaseMapper<EmsWaterRealtime, String> getMapper() {
+        return emsWaterRealtimeMapper;
+    }
+
+    List<EmsWaterRealtime> emsWaterRealtimeList;
+
+    @Override
+    @TargetDataSource(dataSourceKey = DataSourceKey.DB_OTHER)
+    public List<EmsWaterRealtime> getWaterListByArmMeter() {
+           // emsWaterRealtimeMapper.selectByPrimaryKey("1");//.getWaterListByArmMeter();
+        //List<EmsWaterRealtime>
+                emsWaterRealtimeList = emsWaterRealtimeMapper.getWaterListByArmMeter();
+        return emsWaterRealtimeList;
+    }
+
+    @Override
+    public int dataGeneration() {
+
+        int addSize = 0;
+        int updateSize = 0;
+        try {
+            EmsWaterRealtime model;
+            // emsWaterRealtimeMapper.selectByPrimaryKey("1");//.getWaterListByArmMeter();
+            //List<EmsWaterRealtime> emsWaterRealtimeList = getWaterListByArmMeter();
+            for (EmsWaterRealtime emsWaterRealtime : emsWaterRealtimeList){
+                emsWaterRealtime.setReadtime(DateUtils.dateStr(new Date(),"yyyy-MM-dd hh:mm:ss"));
+                model = emsWaterRealtimeMapper.selectByPrimaryKey(emsWaterRealtime.getMeterid());
+                if(model !=null){
+                    emsWaterRealtimeMapper.updateByPrimaryKey(emsWaterRealtime);
+                    updateSize+=1;
+                    continue;
+                }else {
+                    addSize+= emsWaterRealtimeMapper.insert(emsWaterRealtime);
+                }
+            }
+            String clock = DateUtils.dateStr(new Date(),"yyyy-MM-dd hh:mm:ss");
+            HashMap<String,Object> hashMap = new HashMap<String,Object>();
+            hashMap.put("clock",clock);
+            List<EmsWaterRealtime> emsWaterRealtimeList = emsWaterRealtimeMapper.getWaterTenMinutes();
+            StringBuffer sub = new StringBuffer();
+            String table="EMS_WATER";
+            for (EmsWaterRealtime emsWaterRealtime : emsWaterRealtimeList){
+                String[] tens = emsWaterRealtime.getmMaterial().split("\\.");
+                String tag = tens[1];
+                //多个表生成数据就填加table;
+                table = tens[0];
+                String sql = ","+tag + " = " + "'" + emsWaterRealtime.getSumvalue() + "'";
+                sub.append(sql);
+            }
+            hashMap.put("table",table);
+            hashMap.put("sql",sub.toString());
+            updateSize += emsWaterRealtimeMapper.updateWaterMinutes(hashMap);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+        }
+        logger.info("本次总共新增水数据条数:" + addSize);
+        logger.info("本次总共更新水数据条数:" + updateSize);
+        return addSize+updateSize;
+    }
+
+
+    @Override
+    public void getWaterTenMinutes() {
+        int addSize = 0;
+        int updateSize = 0;
+        int i = 0;
+        try {
+            EmsWaterRealtime model;
+            // emsWaterRealtimeMapper.selectByPrimaryKey("1");//.getWaterListByArmMeter();
+            String clock1 = DateUtils.dateStr(new Date(),"yyyy-MM-dd hh:mm:ss");
+            String clock2 = DateUtils.dateStr(new Date(),"yyyy-MM-dd hh:mm:ss");
+            HashMap<String,Object> hashMap = new HashMap<String,Object>();
+            hashMap.put("clock1",clock1);
+            hashMap.put("clock2",clock2);
+            addSize += emsWaterRealtimeMapper.insertWaterTenMinutes(hashMap);
+            List<EmsWaterRealtime> emsWaterRealtimeList = emsWaterRealtimeMapper.getWaterTenMinutes();
+            StringBuffer sub = new StringBuffer();
+            String table="EMS_WATER_TIMING";
+            for (EmsWaterRealtime emsWaterRealtime : emsWaterRealtimeList){
+                i++;
+                String[] tens = emsWaterRealtime.getmType().split("\\.");
+                String tag = tens[1];
+                //多个表生成数据就填加table;
+                table = tens[0];
+                String sql = ","+tag + " = " + "'" + emsWaterRealtime.getSumvalue() + "'";
+                sub.append(sql);
+            }
+            clock2 = DateUtils.dateStr(new Date(),"yyyy-MM-dd hh:mm:ss");
+            hashMap.put("table",table);
+            hashMap.put("clock2",clock2);
+            hashMap.put("sql",sub.toString());
+            updateSize += emsWaterRealtimeMapper.updateWaterTenMinutes(hashMap);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+        }
+        logger.info("本次总共新增水数据条数:" + addSize);
+        logger.info("本次总共更新水数据条数:" + updateSize);
+        //return addSize+updateSize;
+    }
+
+    @Autowired
+    IFormulaService formulaService;
+
+    @Override
+    public void getcalpoint() {
+        List<TRmCalpoint> tRmCalpoints = emsWaterRealtimeMapper.getcalpoint();
+        for(TRmCalpoint model : tRmCalpoints){
+            Formula formula = new Formula();
+            formula.setCode(model.getItemid());
+            String itemdesc = model.getItemdesc(); // 项目描述
+            formula.setDescription(itemdesc!=null && !itemdesc.trim().isEmpty() ? itemdesc : model.getTagAlias());
+            // formula.setClock(DateUtils.getCurrentTime("yyyyMM"));
+            formula.setClock("202001");
+            formula.setIsavailable("1");
+            formula.setRevisetime(DateUtils.getCurrentTime("yyyy-MM-dd HH:mm:ss"));
+            formula.setTablename("T_RM_CALPOINT_VALUE");
+            formula.setSourcecode("R(T_RM_CALPOINT_VALUE," + model.getItemid() + ")");
+            formula.setRevisor(JwtUtil.getUseridByToken());
+
+            formulaService.add(formula);
+        }
+
+    }
+}

+ 106 - 0
src/main/java/com/steerinfo/ems/ifmesemsswapfile/controller/IfMesEmsSwapfileController.java

@@ -5,6 +5,8 @@ import java.util.HashMap;
 
 import com.steerinfo.ems.ifmesemsswapfile.model.IfMesEmsSwapfile;
 import com.steerinfo.ems.ifmesemsswapfile.service.IIfMesEmsSwapfileService;
+import com.steerinfo.ems.trmworkprocmaterialvalue.service.ITRmWorkprocMaterialValueService;
+import com.steerinfo.ems.trmworkprocproductvalue.service.ITRmWorkprocProductValueService;
 import com.steerinfo.framework.controller.BaseRESTfulController;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageList;
@@ -25,6 +27,11 @@ import org.springframework.web.bind.annotation.RestController;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.Map;
 
 @RestController
 @RequestMapping("/${api.version}/ifmesemsswapfile")
@@ -71,4 +78,103 @@ public class IfMesEmsSwapfileController extends BaseRESTfulController {
         return success();
     }
 
+    @ApiOperation(value="获取列表", notes="分页模糊查询")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
+    })
+    //@RequiresPermissions("tpmcaseact:view")
+    @GetMapping(value = "/queryList/")
+    public RESTfulResult queryList(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
+        if(parmas.containsKey("workprocid") && parmas.get("workprocid") != null && !"".equals(parmas.get("workprocid").toString())){
+            PageList<Map<String, Object>> list = ifMesEmsSwapfileService.getQueryList(parmas, pageNum, pageSize);
+            return success(list);
+        }
+        return failed(null, "菜单工序id为空,请联系管理员");
+    }
+
+    @ApiOperation(value="获取列表", notes="分页模糊查询")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
+    })
+    @GetMapping(value = "/queryProductAndMaterial/")
+    public RESTfulResult queryProductAndMaterial(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
+        if(parmas.containsKey("workprocid") && parmas.get("workprocid") != null && !"".equals(parmas.get("workprocid").toString())){
+            if(parmas.containsKey("type") && parmas.get("type") != null && !"".equals(parmas.get("type").toString())) {
+                Object type = parmas.get("type");
+                if ("1".equals(type)) {
+                    parmas.put("table_name","T_RM_WORKPROC_MATERIAL");
+                    parmas.put("table_name2","T_RM_WORKPROC_MATERIAL_VALUE");
+                    parmas.put("listing","MATERIALID");
+                } else if ("2".equals(type)) {
+                    parmas.put("table_name","T_RM_WORKPROC_PRODUCT");
+                    parmas.put("table_name2","T_RM_WORKPROC_PRODUCT_VALUE");
+                    parmas.put("listing","PRODUCTID");
+                } else {
+                    return failed(null, "数据类型有误");
+                }
+                PageList<Map<String, Object>> list = ifMesEmsSwapfileService.queryProductAndMaterial(parmas, pageNum, pageSize);
+                return success(list);
+            }
+            return failed(null,"请选择数据类型");
+        }
+        return failed(null, "菜单工序id为空,请联系管理员");
+    }
+
+    @ApiOperation(value="批量更新详细信息", notes="根据传过来的parmas数组信息来更新详细信息")
+    @ApiImplicitParam(name = "parmas", value = "详细实体usageData", required = true, dataType = "usageData")
+    @PutMapping(value = "/updateProductAndMaterial", produces  = "application/json;charset=UTF-8")
+    public RESTfulResult updateProductAndMaterial(@RequestBody HashMap[] parmas) {
+
+        for (int i = 0; i < parmas.length; i++) {
+            HashMap parma = parmas[i];
+            Object type = parma.get("type");
+            if (parma.containsKey("type") && parma.get("type") != null && !"".equals(parma.get("type").toString())) {
+                if ("1".equals(type)) {
+                    parma.put("table_name", "T_RM_WORKPROC_MATERIAL_VALUE");
+                } else if ("2".equals(type)) {
+                    parma.put("table_name", "T_RM_WORKPROC_PRODUCT_VALUE");
+                } else {
+                    return failed(null, "数据类型有误");
+                }
+                if (!parma.containsKey("itemid") || parma.get("itemid") == null || "".equals(parma.get("itemid").toString())) {
+                    return failed(null, "缺少参数itemid");
+                }
+                if (!parma.containsKey("clock") || parma.get("clock") == null || "".equals(parma.get("clock").toString())) {
+                    return failed(null, "缺少参数clock");
+                }
+                if (!parma.containsKey("timegranid") || parma.get("timegranid") == null || "".equals(parma.get("timegranid").toString())) {
+                    return failed(null, "缺少参数timegranid");
+                }
+                if (!parma.containsKey("actualvalue") || parma.get("actualvalue") == null || "".equals(parma.get("actualvalue").toString())) {
+                    return failed(null, "缺少参数actualvalue");
+                }
+                if (!parma.containsKey("correctvalue") || parma.get("correctvalue") == null || "".equals(parma.get("correctvalue").toString())) {
+                    return failed(null, "缺少参数correctvalue");
+                }
+                if (!parma.containsKey("apportvalue") || parma.get("apportvalue") == null || "".equals(parma.get("apportvalue").toString())) {
+                    return failed(null, "缺少参数apportvalue");
+                }
+                parma.put("upman", JwtUtil.getUseridByToken());
+                parma.put("uptime", DateUtils.getCurrentTimetoDate("yyyy-MM-dd HH:mm:ss"));
+                ifMesEmsSwapfileService.updateProductAndMaterial(parma);
+            }
+        }
+        return success();
+    }
+    @Autowired
+    ITRmWorkprocProductValueService tRmWorkprocProductValueService;
+
+    @Autowired
+    ITRmWorkprocMaterialValueService tRmWorkprocMaterialValueService;
+
+    @ApiOperation(value="从T_RM_PRODUCT,T_RM_MATERIAL生成模板数据", notes="从生成投入产出数据模板")
+    @GetMapping(value = "/generateProductAndMaterial")
+    public RESTfulResult generateProductAndMaterial(@ModelAttribute IfMesEmsSwapfile model){
+        String s = ifMesEmsSwapfileService.generateProductAndMaterial();
+        tRmWorkprocProductValueService.synchronousData();
+        tRmWorkprocMaterialValueService.synchronousData();
+        return success(s);
+    }
 }

+ 14 - 6
src/main/java/com/steerinfo/ems/ifmesemsswapfile/mapper/IfMesEmsSwapfileMapper.java

@@ -1,19 +1,27 @@
 package com.steerinfo.ems.ifmesemsswapfile.mapper;
 
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Set;
-
 import com.steerinfo.ems.ifmesemsswapfile.model.IfMesEmsSwapfile;
 import com.steerinfo.framework.mapper.IBaseMapper;
-import com.steerinfo.framework.service.pagehelper.PageList;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 @Mapper
 public interface IfMesEmsSwapfileMapper extends IBaseMapper<IfMesEmsSwapfile, String> {
     int insert(IfMesEmsSwapfile model);
+
     int updateStatus(HashMap<String, Object> model);
+
     List<IfMesEmsSwapfile> selectNewMaterial(HashMap<String, Object> model);
+
     BigDecimal getSUM(HashMap<String, Object> model);
+
+    List<Map<String, Object>> getQueryList(HashMap<String, Object> parmas);
+
+    List<Map<String, Object>> queryProductAndMaterial(HashMap<String, Object> parmas);
+
+    int updateProductAndMaterial(HashMap<String, Object> parmas);
 }

+ 81 - 4
src/main/java/com/steerinfo/ems/ifmesemsswapfile/mapper/IfMesEmsSwapfileMapper.xml

@@ -15,9 +15,10 @@
     <result column="CREATETIME" jdbcType="DATE" property="createtime" />
     <result column="STATUS" jdbcType="VARCHAR" property="status" />
     <result column="SENDTIME" jdbcType="DATE" property="sendtime" />
+    <result column="MEMO" jdbcType="DATE" property="memo" />
   </resultMap>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
-    select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME
+    select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME,MEMO
     from IF_MES_EMS_SWAPFILE
     where FID = #{id,jdbcType=VARCHAR}
   </select>
@@ -67,7 +68,7 @@
   </delete>
   
   <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
-    select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME
+    select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME,MEMO
       from IF_MES_EMS_SWAPFILE
     <where>
         <if test="fid != null and fid != ''">
@@ -113,7 +114,7 @@
   </select>
 
   <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
-    select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME
+    select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME,MEMO
       from IF_MES_EMS_SWAPFILE
     <where>
         <if test="fid != null and fid != ''">
@@ -159,7 +160,7 @@
   </select>
 
   <select id="selectNewMaterial" parameterType="java.util.HashMap" resultMap="BaseResultMap">
-    select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME
+    select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME,MEMO
       from IF_MES_EMS_SWAPFILE
       where TYPE = #{type,jdbcType=VARCHAR}
         and STATUS in ('0','9')
@@ -293,4 +294,80 @@
     </trim>
   </insert>
 
+  <select id="getQueryList" parameterType="java.util.HashMap" resultType = "Map">
+      SELECT s.FID, s.TYPE, s.WORKS, s.PRODLINE, CASE WHEN s.TYPE = 1 THEN m.WORKPROCID WHEN s.TYPE = 2 THEN p.WORKPROCID END AS WORKPROCID, s.PRODATE, s.ORDERNO, s.MATERIALCODE, s.MATERIALNAME, s.UNIT, s.QTY, s.CREATETIME, s.STATUS, s.SENDTIME, s.MEMO
+      FROM IF_MES_EMS_SWAPFILE s
+      LEFT JOIN T_RM_WORKPROC_PRODUCT p ON s.MATERIALCODE = p.MES_MATERIALCODE
+      LEFT JOIN T_RM_WORKPROC_MATERIAL m ON s.MATERIALCODE = m.MES_MATERIALCODE
+      WHERE (m.WORKPROCID IN (${workProcids}) OR p.WORKPROCID IN (${workProcids}))
+      <if test="prodate != null and prodate != ''">
+      AND s.PRODATE >= to_date(#{prodate}, 'yyyy-mm-dd')
+      </if>
+      <if test="prodate2 != null and prodate2 != ''">
+          AND s.PRODATE &lt;= to_date(#{prodate2}, 'yyyy-mm-dd')
+      </if>
+      <if test="workproc != null and workproc != ''">
+          AND (p.WORKPROCID LIKE '%${workproc}%' OR m.WORKPROCID LIKE '%${workproc}%')
+      </if>
+      <if test="materialname != null and materialname != ''">
+          AND s.MATERIALNAME LIKE '%${materialname}%'
+      </if>
+      <if test="materialcode != null and materialcode != ''">
+          AND s.MATERIALCODE LIKE '%${materialcode}%'
+      </if>
+      <if test="prodline != null and prodline != ''">
+          AND s.PRODLINE LIKE '%${prodline}%'
+      </if>
+      <if test="type != null and type != ''">
+          AND s.TYPE LIKE '%${type}%'
+      </if>
+      ORDER BY s.PRODATE
+  </select>
+
+    <select id="queryProductAndMaterial" parameterType="java.util.HashMap" resultType = "Map">
+        SELECT A.ITEMID, A.CLOCK, A.TIMEGRANID, A.ACTUALVALUE, A.CORRECTVALUE
+             , A.APPORTVALUE, A.BZ, A.USERID, A.UPDATETIME, A.UPMAN
+             , A.UPTIME, B.WORKPROCID, B.MES_MATERIALCODE, B.UNITID, B.${listing} AS MATERIALNAME
+        FROM ${table_name2} A
+        LEFT JOIN ${table_name} B ON A.ITEMID = B.ITEMID
+        WHERE B.WORKPROCID IN (${workProcids})
+        <if test="clock != null and clock != ''">
+            AND A.CLOCK >= #{clock}
+        </if>
+        <if test="clock2 != null and clock2 != ''">
+            AND A.CLOCK &lt;= #{clock2}
+        </if>
+        AND B.ITEMTYPE = 'R'
+        AND B.USEFLAG = '1'
+        AND B.ISFINANCEDATA = '1'
+        <if test="workproc != null and workproc != ''">
+            AND B.WORKPROCID IN (${workProcs})
+        </if>
+        <if test="materialcode != null and materialcode != ''">
+            AND B.MES_MATERIALCODE LIKE '%${materialcode}%'
+        </if>
+        <if test="itemid != null and itemid != ''">
+            AND A.ITEMID LIKE '%${itemid}%'
+        </if>
+        <if test="itemtype !=null and itemtype!='' ">
+            AND B.ITEMTYPE = #{itemtype}
+        </if>
+        <if test="materialname !=null and materialname!='' ">
+           AND B.${listing} = #{materialname}
+        </if>
+        ORDER BY A.CLOCK,B.SEQNO
+    </select>
+
+    <update id="updateProductAndMaterial" parameterType="java.util.HashMap">
+        UPDATE ${table_name}
+        SET APPORTVALUE = #{apportvalue},
+        CORRECTVALUE = #{correctvalue},
+        BZ = #{bz},
+        UPMAN = #{upman},
+        UPTIME = #{uptime}
+        WHERE ITEMID = #{itemid}
+        AND CLOCK = #{clock}
+        AND TIMEGRANID = #{timegranid}
+        AND ACTUALVALUE = #{actualvalue}
+    </update>
 </mapper>

+ 17 - 6
src/main/java/com/steerinfo/ems/ifmesemsswapfile/model/IfMesEmsSwapfile.java

@@ -1,14 +1,11 @@
 package com.steerinfo.ems.ifmesemsswapfile.model;
 
-import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
-
+import com.alibaba.fastjson.JSONObject;
+import com.steerinfo.ems.Utils.DateUtils;
 import com.steerinfo.framework.model.IBasePO;
-
 import io.swagger.annotations.ApiModelProperty;
 
-import com.alibaba.fastjson.JSONObject;
-import com.steerinfo.ems.Utils.DateUtils;
+import java.math.BigDecimal;
 
 public class IfMesEmsSwapfile implements IBasePO<String> {
 
@@ -92,6 +89,12 @@ public class IfMesEmsSwapfile implements IBasePO<String> {
     @ApiModelProperty(value="读取时间",required=false)
     private String sendtime;
 
+    /**
+     * 读取时间(SENDTIME,DATE,7)
+     */
+    @ApiModelProperty(value="备注",required=false)
+    private String memo;
+
     public String getFid() {
         return fid;
     }
@@ -183,6 +186,13 @@ public class IfMesEmsSwapfile implements IBasePO<String> {
         this.sendtime = sendtime == null ? null : sendtime;
     }
 
+    public String getMemo() {
+        return memo;
+    }
+    public void setMemo(String memo) {
+        this.memo = memo == null ? null : memo;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -202,6 +212,7 @@ public class IfMesEmsSwapfile implements IBasePO<String> {
         sb.append(", createtime=").append(createtime);
         sb.append(", status=").append(status);
         sb.append(", sendtime=").append(sendtime);
+        sb.append(", memo=").append(memo);
         sb.append("]");
         return sb.toString();
     }

+ 36 - 5
src/main/java/com/steerinfo/ems/ifmesemsswapfile/service/IIfMesEmsSwapfileService.java

@@ -1,13 +1,14 @@
 package com.steerinfo.ems.ifmesemsswapfile.service;
 
+import com.steerinfo.ems.ifmesemsswapfile.model.IfMesEmsSwapfile;
+import com.steerinfo.framework.service.IBaseService;
+import com.steerinfo.framework.service.pagehelper.PageList;
+
 import java.math.BigDecimal;
-import java.text.ParseException;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
-
-import com.steerinfo.ems.ifmesemsswapfile.model.IfMesEmsSwapfile;
-import com.steerinfo.framework.service.IBaseService;
+import java.util.Map;
 
 
 public interface IIfMesEmsSwapfileService extends IBaseService<IfMesEmsSwapfile, String>{
@@ -49,6 +50,36 @@ public interface IIfMesEmsSwapfileService extends IBaseService<IfMesEmsSwapfile,
 	 */
 	public  void  getLgDateProd();
 
-	public  void  getLgDateProd2 () throws ParseException;
+	/**
+	 * 查询所有数据
+	 *
+	 * @param parmas
+	 * @param pageNum
+	 * @param pageSize
+	 * @return
+	 */
+	PageList<Map<String, Object>> getQueryList(HashMap<String, Object> parmas, Integer pageNum, Integer pageSize);
+
+	/**
+	 * 查询投入产出数据
+	 *
+	 * @param parmas
+	 * @param pageNum
+	 * @param pageSize
+	 * @return
+	 */
+	PageList<Map<String, Object>> queryProductAndMaterial(HashMap<String, Object> parmas, Integer pageNum, Integer pageSize);
+
+	/**
+	 * 修改投入产出数据
+	 * @param parmas 参数
+	 * @return
+	 */
+	int updateProductAndMaterial(HashMap<String, Object> parmas);
 
+	/**
+	 * 生成投入产出数据模板
+	 * @return
+	 */
+	String generateProductAndMaterial();
 }

+ 124 - 7
src/main/java/com/steerinfo/ems/ifmesemsswapfile/service/impl/IfMesEmsSwapfileServiceImpl.java

@@ -1,16 +1,30 @@
 package com.steerinfo.ems.ifmesemsswapfile.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.steerinfo.ems.Utils.DateUtils;
+import com.steerinfo.ems.Utils.HttpRequestMes;
 import com.steerinfo.ems.ifmesemsswapfile.mapper.IfMesEmsSwapfileMapper;
 import com.steerinfo.ems.ifmesemsswapfile.model.IfMesEmsSwapfile;
 import com.steerinfo.ems.ifmesemsswapfile.service.IIfMesEmsSwapfileService;
-import com.steerinfo.ems.Utils.HttpRequestMes;
+import com.steerinfo.ems.trmmaterial.model.TRmMaterial;
+import com.steerinfo.ems.trmmaterial.service.ITRmMaterialService;
+import com.steerinfo.ems.trmproduct.model.TRmProduct;
+import com.steerinfo.ems.trmproduct.service.ITRmProductService;
+import com.steerinfo.ems.trmworkprocmaterial.model.TRmWorkprocMaterial;
+import com.steerinfo.ems.trmworkprocmaterial.service.ITRmWorkprocMaterialService;
+import com.steerinfo.ems.trmworkprocproduct.model.TRmWorkprocProduct;
+import com.steerinfo.ems.trmworkprocproduct.service.ITRmWorkprocProductService;
 import com.steerinfo.feigen.model.LgWeight;
 import com.steerinfo.feigen.service.LgWeightFeigenService;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import com.steerinfo.framework.service.impl.BaseServiceImpl;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
+import com.steerinfo.framework.service.pagehelper.PageHelper;
+import com.steerinfo.framework.service.pagehelper.PageList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.text.ParseException;
@@ -32,6 +46,18 @@ public class IfMesEmsSwapfileServiceImpl extends BaseServiceImpl<IfMesEmsSwapfil
     @Autowired
 	private LgWeightFeigenService lgWeightFeigenService;
 
+	@Autowired
+	ITRmMaterialService tRmMaterialService;
+
+	@Autowired
+	ITRmProductService tRmProductService;
+
+	@Autowired
+	ITRmWorkprocMaterialService tRmWorkprocMaterialService;
+
+	@Autowired
+	ITRmWorkprocProductService tRmWorkprocProductService;
+
     @Override
     protected IBaseMapper<IfMesEmsSwapfile, String> getMapper() {
         return ifmesemsswapfilemapper;
@@ -64,7 +90,7 @@ public class IfMesEmsSwapfileServiceImpl extends BaseServiceImpl<IfMesEmsSwapfil
 						// 原数据
 						String fid = jo.getString("fid");
 						IfMesEmsSwapfile ime = ifmesemsswapfilemapper.selectByPrimaryKey(fid);
-						if(ime != null){
+						if(ime!=null){
 							ifmesemsswapfilemapper.updateByPrimaryKey(model);
 							updateSize +=1;
 							logger.info("修改数据:" + jo.toJSONString());
@@ -79,7 +105,7 @@ public class IfMesEmsSwapfileServiceImpl extends BaseServiceImpl<IfMesEmsSwapfil
 						}
 						HttpRequestMes.httpRequestMes(url, "post", "[{\"id\":\"" + jo.getString("fid") + "\",\"status\":\"1\"}]");
 					}
-					     logger.info("结束一次投入产出数据同步。");
+					logger.info("结束一次投入产出数据同步。");
 				} else {
 					break;
 				}
@@ -128,7 +154,7 @@ public class IfMesEmsSwapfileServiceImpl extends BaseServiceImpl<IfMesEmsSwapfil
 					model.setMaterialcode(jo3.getString("materialcode"));
 					model.setMaterialname(jo3.getString("materialname"));
 					model.setOrderno(jo3.getString("orderno"));
-					model.setProdate(jo3.getString("prodate") != null ? jo3.getString("prodate").substring(0, 19):"");
+					model.setProdate(jo3.getString("prodate")!=null?jo3.getString("prodate").substring(0, 19):"");
 					model.setProdline(jo3.getString("prodline"));
 					model.setQty(jo3.getBigDecimal("qty"));
 					model.setSendtime(jo3.getString("sendtime")!=null?jo3.getString("sendtime").substring(0, 19):"");
@@ -200,6 +226,97 @@ public class IfMesEmsSwapfileServiceImpl extends BaseServiceImpl<IfMesEmsSwapfil
 			}
 		}
 		System.out.println("接收成功...");
+	@Override
+	public PageList<Map<String, Object>> getQueryList(HashMap<String, Object> parmas, Integer pageNum, Integer pageSize) {
+		PageHelper.startPage(pageNum, pageSize);
+		//Calendar cal = Calendar.getInstance();
+		//cal.add(Calendar.HOUR_OF_DAY, 1);
+		//cal.add(Calendar.DAY_OF_YEAR, -1);
+		//String clock = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());
+		//parmas.put("clockt", clock); // 可以修改的clock
+		//parmas.put("clocktm", clock.substring(0, 7)); // 可以修改的clock(月)
+		if(parmas.get("workprocid")!=null && !parmas.get("workprocid").toString().isEmpty()){
+			String workProcids = parmas.get("workprocid").toString();
+			workProcids = "'" + workProcids.replaceAll(",", "','").replaceAll(",", "','") + "'";
+			parmas.put("workProcids", workProcids);
+		}
+		List<Map<String, Object>> rows = ifmesemsswapfilemapper.getQueryList(parmas);
+		PageList<Map<String, Object>> pageInfo = new PageList<Map<String, Object>>(rows);
+		return pageInfo;
+	}
+	@Override
+	public PageList<Map<String, Object>> queryProductAndMaterial(HashMap<String, Object> parmas, Integer pageNum, Integer pageSize) {
+		PageHelper.startPage(pageNum, pageSize);
+		if(parmas.get("workprocid")!=null && !parmas.get("workprocid").toString().isEmpty()){
+			String workProcids = parmas.get("workprocid").toString();
+			workProcids = "'" + workProcids.replaceAll(",", "','").replaceAll(",", "','") + "'";
+			parmas.put("workProcids", workProcids);
+		}
+		if(parmas.get("workproc")!=null && !parmas.get("workproc").toString().isEmpty()){
+			String workProcs = parmas.get("workproc").toString();
+			workProcs = "'" + workProcs.replaceAll(",", "','").replaceAll(",", "','") + "'";
+			parmas.put("workProcs", workProcs);
+		}
+		List<Map<String, Object>> rows = ifmesemsswapfilemapper.queryProductAndMaterial(parmas);
+		PageList<Map<String, Object>> pageInfo = new PageList<Map<String, Object>>(rows);
+		return pageInfo;
+	}
+
+	@Override
+	public int updateProductAndMaterial(HashMap<String, Object> parmas) {
+		return ifmesemsswapfilemapper.updateProductAndMaterial(parmas);
 	}
-}
 
+	@Override
+	public String generateProductAndMaterial() {
+		HashMap hashMap = new HashMap<String, String>();
+		List<TRmProduct> tRmProducts = tRmProductService.query(hashMap);
+		List<TRmMaterial> trmMaterials = tRmMaterialService.query(hashMap);
+		List<TRmWorkprocProduct> tRmWorkprocProducts = tRmWorkprocProductService.query(hashMap);
+		List<TRmWorkprocMaterial> tRmWorkprocMaterials = tRmWorkprocMaterialService.query(hashMap);
+		IfMesEmsSwapfile model = new IfMesEmsSwapfile();
+		IfMesEmsSwapfile ifMesEmsSwapfile;
+		String materialName;
+		int addSize = 0;
+		for (TRmWorkprocProduct tRmWorkprocProduct : tRmWorkprocProducts) {
+			ifMesEmsSwapfile = ifmesemsswapfilemapper.selectByPrimaryKey(tRmWorkprocProduct.getProductid()+tRmWorkprocProduct.getMesProdline()+DateUtils.dateStr(new Date(),"yyyyMMdd"));
+			if(ifMesEmsSwapfile == null)
+			{
+				materialName = tRmProductService.getById(tRmWorkprocProduct.getProductid()).getName();
+				model.setType("2");
+				model.setWorks(tRmWorkprocProduct.getWorkprocid());
+				model.setProdline(tRmWorkprocProduct.getMesProdline());
+				model.setProdate(DateUtils.dateStr(new Date(),"yyyy-MM-dd"));
+				model.setMaterialname(materialName);
+				model.setMaterialcode(tRmWorkprocProduct.getMesMaterialcode());
+				model.setUnit(tRmWorkprocProduct.getUnitid());
+				model.setQty(new BigDecimal(0));
+				// DateUtils.dateStr(new Date(),"yyyy-MM-dd hh-mm-ss")
+				model.setCreatetime(DateUtils.dateStr(new Date(),"yyyy-MM-dd hh-mm-ss"));
+				model.setStatus("0");
+				model.setFid(tRmWorkprocProduct.getProductid()+tRmWorkprocProduct.getMesProdline()+DateUtils.dateStr(new Date(),"yyyyMMdd"));
+				addSize += ifmesemsswapfilemapper.insert(model);
+			}
+		}
+		for (TRmWorkprocMaterial tRmWorkprocMaterial : tRmWorkprocMaterials) {
+			ifMesEmsSwapfile = ifmesemsswapfilemapper.selectByPrimaryKey(tRmWorkprocMaterial.getMaterialid()+tRmWorkprocMaterial.getMesProdline()+DateUtils.dateStr(new Date(),"yyyyMMdd"));
+			if(ifMesEmsSwapfile == null)
+			{
+				materialName = tRmMaterialService.getById(tRmWorkprocMaterial.getMaterialid()).getName();
+				model.setType("1");
+				model.setWorks(tRmWorkprocMaterial.getWorkprocid());
+				model.setProdline(tRmWorkprocMaterial.getMesProdline());
+				model.setProdate(DateUtils.dateStr(new Date(),"yyyy-MM-dd"));
+				model.setMaterialname(materialName);
+				model.setMaterialcode(tRmWorkprocMaterial.getMesMaterialcode());
+				model.setUnit(tRmWorkprocMaterial.getUnitid());
+				model.setQty(new BigDecimal(0));
+				model.setCreatetime(DateUtils.dateStr(new Date(),"yyyy-MM-dd hh-mm-ss"));
+				model.setStatus("0");
+				model.setFid(tRmWorkprocMaterial.getMaterialid()+tRmWorkprocMaterial.getMesProdline()+DateUtils.dateStr(new Date(),"yyyyMMdd"));
+				addSize += ifmesemsswapfilemapper.insert(model);
+			}
+		}
+		return "本次共生成" + addSize + "条";
+	}
+}

+ 6 - 2
src/main/java/com/steerinfo/ems/trmworkprocmaterialvalue/mapper/TRmWorkprocMaterialValueMapper.xml

@@ -174,7 +174,9 @@
         APPORTVALUE,
         UCVALUE,
         SUMUCVALUE,
-        BZ
+        BZ,
+        USERID,
+        UPDATETIME
       )
       VALUES
         (
@@ -189,7 +191,9 @@
           #{qty,jdbcType=DECIMAL},
           0,
           0,
-          'MES' || '-' || to_char(SYSDATE,'yyyy/MM/dd HH24:mi:ss') || ' fid:' || #{fid,jdbcType=VARCHAR}
+          'MES' || '-' || to_char(SYSDATE,'yyyy/MM/dd HH24:mi:ss') || ' fid:' || #{fid,jdbcType=VARCHAR},
+          #{userid,jdbcType=VARCHAR},
+          #{updatetime,jdbcType=VARCHAR}
         )
   </insert>
 

+ 94 - 97
src/main/java/com/steerinfo/ems/trmworkprocmaterialvalue/service/impl/TRmWorkprocMaterialValueServiceImpl.java

@@ -1,40 +1,35 @@
 package com.steerinfo.ems.trmworkprocmaterialvalue.service.impl;
 
-import com.steerinfo.ems.formula.model.Formula;
-import com.steerinfo.ems.formula.service.IFormulaService;
-import com.steerinfo.ems.trmworkprocmaterial.model.TRmWorkprocMaterial;
-import com.steerinfo.ems.trmworkprocproductvalue.service.ITRmWorkprocProductValueService;
-import com.steerinfo.framework.mapper.IBaseMapper;
-import com.steerinfo.framework.service.impl.BaseServiceImpl;
-import com.steerinfo.framework.service.pagehelper.PageHelper;
-import com.steerinfo.framework.service.pagehelper.PageList;
-import com.steerinfo.ems.trmworkprocmaterialvalue.model.TRmWorkprocMaterialValue;
-import com.steerinfo.ems.trmworkprocmaterialvalue.mapper.TRmWorkprocMaterialValueMapper;
-import com.steerinfo.ems.trmworkprocmaterialvalue.service.ITRmWorkprocMaterialValueService;
-import com.steerinfo.auth.utils.JwtUtil;
 import com.steerinfo.ems.Utils.BigDecimalUtil;
 import com.steerinfo.ems.Utils.DateUtils;
-import com.steerinfo.ems.common.DateTypeEnum;
+import com.steerinfo.ems.formula.model.Formula;
+import com.steerinfo.ems.formula.service.IFormulaService;
 import com.steerinfo.ems.ifmesemsswapfile.model.IfMesEmsSwapfile;
 import com.steerinfo.ems.ifmesemsswapfile.service.IIfMesEmsSwapfileService;
 import com.steerinfo.ems.trmmaterial.mapper.TRmMaterialMapper;
 import com.steerinfo.ems.trmmaterial.model.TRmMaterial;
 import com.steerinfo.ems.trmmaterial.service.ITRmMaterialService;
-import com.steerinfo.ems.trmworkproc.model.TRmWorkproc;
 import com.steerinfo.ems.trmworkproc.service.ITRmWorkprocService;
+import com.steerinfo.ems.trmworkprocmaterial.model.TRmWorkprocMaterial;
 import com.steerinfo.ems.trmworkprocmaterial.service.ITRmWorkprocMaterialService;
+import com.steerinfo.ems.trmworkprocmaterialvalue.mapper.TRmWorkprocMaterialValueMapper;
+import com.steerinfo.ems.trmworkprocmaterialvalue.model.TRmWorkprocMaterialValue;
+import com.steerinfo.ems.trmworkprocmaterialvalue.service.ITRmWorkprocMaterialValueService;
+import com.steerinfo.ems.trmworkprocproductvalue.service.ITRmWorkprocProductValueService;
+import com.steerinfo.framework.mapper.IBaseMapper;
+import com.steerinfo.framework.service.impl.BaseServiceImpl;
+import com.steerinfo.framework.service.pagehelper.PageHelper;
+import com.steerinfo.framework.service.pagehelper.PageList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.util.*;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.transaction.annotation.Transactional;
-
 /**
  * TRmWorkprocMaterialValue服务实现:
  * @author generator
@@ -202,82 +197,82 @@ public class TRmWorkprocMaterialValueServiceImpl extends BaseServiceImpl<TRmWork
 					}
 					String itemid = "";
 					String wid = "";
-//					if (mline.endsWith("GX1")) { // 一高线-ZY9102
-//						// MES工序与EMS工序没有关联,这里防止修改工序后造成数据错误,增加一次判断,下同
-//						TRmWorkproc tw = tRmWorkprocService.getById("ZY9102");
-//						if(tw!=null && tw.getName().equalsIgnoreCase("一高线")){
-//							wid = "ZY9102";
-//							itemid = wid + mid + "R";
-//						}
-//					} else if (mline.endsWith("GX3")) { // 三高线-ZY9103
-//						// MES工序与EMS工序没有关联,这里防止修改工序后造成数据错误,增加一次判断,下同
-//						TRmWorkproc tw = tRmWorkprocService.getById("ZY9103");
-//						if(tw!=null && tw.getName().equalsIgnoreCase("三高线")){
-//							wid = "ZY9103";
-//							itemid = wid + mid + "R";
-//						}
-//					} else if (mline.endsWith("GX2")) { // 二高线-ZY9201
-//						// MES工序与EMS工序没有关联,这里防止修改工序后造成数据错误,增加一次判断,下同
-//						TRmWorkproc tw = tRmWorkprocService.getById("ZY9201");
-//						if(tw!=null && tw.getName().equalsIgnoreCase("二高线")){
-//							wid = "ZY9201";
-//							itemid = wid + mid + "R";
-//						}
-//					} else if(mline.endsWith("GX4") || mline.endsWith("GX5")) { // 四五高线
-//						TRmWorkproc tw = tRmWorkprocService.getById("ZY9202");
-//						if(tw!=null && tw.getName().equalsIgnoreCase("四五高线")){
-//							wid = "ZY9202";
-//							itemid = wid + mid + "R";
-//						}
-//					} else if(mline.endsWith("QT1")) { // 一球团-ZY6100
-//						TRmWorkproc tw = tRmWorkprocService.getById("ZY6100");
-//						if(tw!=null && tw.getName().equalsIgnoreCase("一球团")){
-//							wid = "ZY6100";
-//							itemid = wid + mid + "R";
-//						}
-//					} else if(mline.endsWith("QT2")) { // 二球团-ZY6200
-//						TRmWorkproc tw = tRmWorkprocService.getById("ZY6200");
-//						if(tw!=null && tw.getName().equalsIgnoreCase("二球团")){
-//							wid = "ZY6200";
-//							itemid = wid + mid + "R";
-//						}
-//					} else if(mline.endsWith("BC1")) { // 一棒材-ZY9101
-//						wid = "ZY9101";
-//						TRmWorkproc tw = tRmWorkprocService.getById(wid);
-//						if(tw!=null && tw.getName().equalsIgnoreCase("棒材线")){
-//							itemid = wid + mid + "R";
-//						}
-//					} else if(mline.endsWith("GL3")) { // 二炼铁2#1280高炉-ZY7202
-//						wid = "ZY7202";
-//						TRmWorkproc tw = tRmWorkprocService.getById(wid);
-//						if(tw!=null && tw.getName().equalsIgnoreCase("二炼铁2#1280高炉")){
-//							itemid = wid + mid + "R";
-//						}
-//					} else if(mline.endsWith("JH1")) { // 一焦化-ZY4100
-//						wid = "ZY4100";
-//						TRmWorkproc tw = tRmWorkprocService.getById(wid);
-//						if(tw!=null && tw.getName().equalsIgnoreCase("一焦化")){
-//							itemid = wid + mid + "R";
-//						}
-//					} else if(mline.endsWith("JH2")) { // 二焦化-ZY4200
-//						wid = "ZY4200";
-//						TRmWorkproc tw = tRmWorkprocService.getById(wid);
-//						if(tw!=null && tw.getName().equalsIgnoreCase("二焦化")){
-//							itemid = wid + mid + "R";
-//						}
-//					} else if(mline.endsWith("LG1")) { // 一炼钢 - ZY8100
-//						wid = "ZY8100";
-//						TRmWorkproc tw = tRmWorkprocService.getById(wid);
-//						if(tw!=null && tw.getName().equalsIgnoreCase("一炼钢")){
-//							itemid = wid + mid + "R";
-//						}
-//					} else if(mline.endsWith("LG2")) { // 二炼钢-ZY8200
-//						wid = "ZY8200";
-//						TRmWorkproc tw = tRmWorkprocService.getById(wid);
-//						if(tw!=null && tw.getName().equalsIgnoreCase("二炼钢")){
-//							itemid = wid + mid + "R";
-//						}
-//					}
+					//if (mline.endsWith("GX1")) { // 一高线-ZY9102
+					//	// MES工序与EMS工序没有关联,这里防止修改工序后造成数据错误,增加一次判断,下同
+					//	TRmWorkproc tw = tRmWorkprocService.getById("ZY9102");
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("一高线")){
+					//		wid = "ZY9102";
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if (mline.endsWith("GX3")) { // 三高线-ZY9103
+					//	// MES工序与EMS工序没有关联,这里防止修改工序后造成数据错误,增加一次判断,下同
+					//	TRmWorkproc tw = tRmWorkprocService.getById("ZY9103");
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("三高线")){
+					//		wid = "ZY9103";
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if (mline.endsWith("GX2")) { // 二高线-ZY9201
+					//	// MES工序与EMS工序没有关联,这里防止修改工序后造成数据错误,增加一次判断,下同
+					//	TRmWorkproc tw = tRmWorkprocService.getById("ZY9201");
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("二高线")){
+					//		wid = "ZY9201";
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("GX4") || mline.endsWith("GX5")) { // 四五高线
+					//	TRmWorkproc tw = tRmWorkprocService.getById("ZY9202");
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("四五高线")){
+					//		wid = "ZY9202";
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("QT1")) { // 一球团-ZY6100
+					//	TRmWorkproc tw = tRmWorkprocService.getById("ZY6100");
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("一球团")){
+					//		wid = "ZY6100";
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("QT2")) { // 二球团-ZY6200
+					//	TRmWorkproc tw = tRmWorkprocService.getById("ZY6200");
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("二球团")){
+					//		wid = "ZY6200";
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("BC1")) { // 一棒材-ZY9101
+					//	wid = "ZY9101";
+					//	TRmWorkproc tw = tRmWorkprocService.getById(wid);
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("棒材线")){
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("GL3")) { // 二炼铁2#1280高炉-ZY7202
+					//	wid = "ZY7202";
+					//	TRmWorkproc tw = tRmWorkprocService.getById(wid);
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("二炼铁2#1280高炉")){
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("JH1")) { // 一焦化-ZY4100
+					//	wid = "ZY4100";
+					//	TRmWorkproc tw = tRmWorkprocService.getById(wid);
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("一焦化")){
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("JH2")) { // 二焦化-ZY4200
+					//	wid = "ZY4200";
+					//	TRmWorkproc tw = tRmWorkprocService.getById(wid);
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("二焦化")){
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("LG1")) { // 一炼钢 - ZY8100
+					//	wid = "ZY8100";
+					//	TRmWorkproc tw = tRmWorkprocService.getById(wid);
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("一炼钢")){
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("LG2")) { // 二炼钢-ZY8200
+					//	wid = "ZY8200";
+					//	TRmWorkproc tw = tRmWorkprocService.getById(wid);
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("二炼钢")){
+					//		itemid = wid + mid + "R";
+					//	}
+					//}
 					if(!itemid.isEmpty() && !mid.isEmpty()){
 						twm = tRmWorkprocMaterialService.getById(itemid);
 						if(twm!=null){
@@ -326,7 +321,7 @@ public class TRmWorkprocMaterialValueServiceImpl extends BaseServiceImpl<TRmWork
 				} else {
 					twm = relationItem.get(0);
 				}
-                // code = "1" 是由公式生成的项,放弃添加 0不需要  1需要
+                // code = "1" 是由公式生成的项,放弃添加
                 if (twm.getCode()!=null && twm.getCode().equals("1")) {
                     abandon++;
                     logger.info("[放弃添加]" + DateUtils.dateStr(new Date(), "yyyy-MM-dd HH:mm:ss") + " :IF_MES_EMS_SWAPFILE中 FID 为 " + swapfile.getFid() + " 的数据项被配置成由公式自动生成,所以放弃添加。( MES物料编码:" + swapfile.getMaterialcode() + " ,MES物料名称:" + swapfile.getMaterialname() + " ,MES产线编码:" + swapfile.getProdline() + " )");
@@ -339,6 +334,8 @@ public class TRmWorkprocMaterialValueServiceImpl extends BaseServiceImpl<TRmWork
                     insertObj.put("itemid", twm.getItemid());
                     insertObj.put("qty", swapfile.getQty());
                     insertObj.put("fid", swapfile.getFid());
+					insertObj.put("userid", "系统");
+					insertObj.put("updatetime", DateUtils.dateStr(new Date(), "yyyy-MM-dd HH:mm:ss"));
                     try {
                         int upSize = tRmWorkprocMaterialValueMapper.updateValue(insertObj);
                         if (upSize == 0) {

+ 1 - 1
src/main/java/com/steerinfo/ems/trmworkprocproductvalue/service/impl/TRmWorkprocProductValueServiceImpl.java

@@ -367,7 +367,7 @@ public class TRmWorkprocProductValueServiceImpl extends BaseServiceImpl<TRmWorkp
 					insertObj.put("itemtype", "R");
 					insertObj.put("qty", swapfile.getQty());
 					insertObj.put("fid", swapfile.getFid());
-					insertObj.put("userid", "1");
+					insertObj.put("userid", "系统");
 					insertObj.put("updatetime", DateUtils.dateStr(new Date(), "yyyy-MM-dd HH:mm:ss"));
 					try {
 						int upSize = tRmWorkprocProductValueMapper.updateValue(insertObj);

+ 2 - 1
src/main/java/com/steerinfo/ftp/uploadfile/utils/FtpFileUtil.java

@@ -390,7 +390,8 @@ public class FtpFileUtil {
              try {
                 //建立连接
                  ftpClient = new FTPClient();
-                 ftpClient.setControlEncoding("GBK");
+                 ftpClient.setControlEncoding("GBK");//windows default服务器gbk
+                 ftpClient.setControlEncoding("UTF-8");//linux default UTF-8
                  ftpClient.enterLocalPassiveMode();
                  ftpClient.connect(FTP_ADDRESS, FTP_PORT);
                  ftpClient.login(FTP_USERNAME, FTP_PASSWORD);