Bläddra i källkod

lrl -2021-12-01

lirl 3 år sedan
förälder
incheckning
0253464f1f

+ 111 - 0
src/main/java/com/steerinfo/ems/emsprodplanroundweight/controller/EmsProdplanRoundWeightController.java

@@ -0,0 +1,111 @@
+package com.steerinfo.ems.emsprodplanroundweight.controller;
+
+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 com.steerinfo.ems.emsprodplanroundweight.model.EmsProdplanRoundWeight;
+import com.steerinfo.ems.emsprodplanroundweight.service.IEmsProdplanRoundWeightService;
+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.text.ParseException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * EmsProdplanRoundWeight RESTful接口:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2021-12-01 04:14
+ * 类描述
+ * 修订历史:
+ * 日期:2021-12-01
+ * 作者:generator
+ * 参考:
+ * 描述:EmsProdplanRoundWeight RESTful接口
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+@RestController
+@RequestMapping("/${api.version}/emsprodplanroundweights")
+public class EmsProdplanRoundWeightController extends BaseRESTfulController {
+
+    @Autowired
+    IEmsProdplanRoundWeightService emsProdplanRoundWeightService;
+
+    @ApiOperation(value="获取列表", notes="分页查询")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
+        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
+    })
+    //@RequiresPermissions("emsprodplanroundweight:view")
+    @GetMapping(value = "/")
+    public RESTfulResult list(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
+        PageList<EmsProdplanRoundWeight> list = emsProdplanRoundWeightService.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("emsprodplanroundweight:view")
+    @GetMapping(value = "/like/")
+    public RESTfulResult listLike(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
+        PageList<EmsProdplanRoundWeight> list = emsProdplanRoundWeightService.queryLikeForPage(parmas, pageNum, pageSize);
+        return success(list);
+    }
+    
+    @ApiOperation(value="创建", notes="根据EmsProdplanRoundWeight对象创建")
+    @ApiImplicitParam(name = "emsProdplanRoundWeight", value = "详细实体emsProdplanRoundWeight", required = true, dataType = "EmsProdplanRoundWeight")
+    //@RequiresPermissions("emsprodplanroundweight:create")
+    @PostMapping(value = "/")
+    public RESTfulResult add(@ModelAttribute EmsProdplanRoundWeight model){
+        EmsProdplanRoundWeight emsProdplanRoundWeight = emsProdplanRoundWeightService.add(model);
+        return success(emsProdplanRoundWeight);
+    }
+
+    @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
+    @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
+    //@RequiresPermissions("emsprodplanroundweight:view")
+    @GetMapping(value = "/{id}")
+    public RESTfulResult get(@PathVariable String id){
+        EmsProdplanRoundWeight emsProdplanRoundWeight = emsProdplanRoundWeightService.getById(id);
+        return success(emsProdplanRoundWeight);
+    }
+
+    @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的emsProdplanRoundWeight信息来更新详细信息")
+    @ApiImplicitParams({
+        @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String"),
+        @ApiImplicitParam(name = "emsProdplanRoundWeight", value = "详细实体emsProdplanRoundWeight", required = true, dataType = "EmsProdplanRoundWeight")
+    })
+    //@RequiresPermissions("emsprodplanroundweight:update")
+    @PutMapping(value = "/{id}", produces  = "application/json;charset=UTF-8")
+    public RESTfulResult update(@PathVariable String id, @RequestBody EmsProdplanRoundWeight model){
+        model.setId(id);
+        EmsProdplanRoundWeight emsProdplanRoundWeight = emsProdplanRoundWeightService.modify(model);
+        return success(emsProdplanRoundWeight);
+    }
+
+    @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
+    @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
+    //@RequiresPermissions("emsprodplanroundweight:delete")
+    @DeleteMapping(value = "/{id}")//String
+    public RESTfulResult delete(@PathVariable String id){
+    	List<String> list = Arrays.asList(id.split(","));
+    	if(ListUtils.isNotEmpty(list)) {
+	    	List<String> ids = ListUtils.convertList(list);
+			  emsProdplanRoundWeightService.delete(ids);
+    	}
+      return success();
+    }
+    @GetMapping("/aaa")
+    public void aaa() throws ParseException {
+        emsProdplanRoundWeightService.getWeightForLg();
+    }
+}

+ 9 - 0
src/main/java/com/steerinfo/ems/emsprodplanroundweight/mapper/EmsProdplanRoundWeightMapper.java

@@ -0,0 +1,9 @@
+package com.steerinfo.ems.emsprodplanroundweight.mapper;
+
+import com.steerinfo.framework.mapper.IBaseMapper;
+import com.steerinfo.ems.emsprodplanroundweight.model.EmsProdplanRoundWeight;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface EmsProdplanRoundWeightMapper extends IBaseMapper<EmsProdplanRoundWeight, String> {
+}

+ 264 - 0
src/main/java/com/steerinfo/ems/emsprodplanroundweight/mapper/EmsProdplanRoundWeightMapper.xml

@@ -0,0 +1,264 @@
+<?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.emsprodplanroundweight.mapper.EmsProdplanRoundWeightMapper">
+  <resultMap id="BaseResultMap" type="com.steerinfo.ems.emsprodplanroundweight.model.EmsProdplanRoundWeight">
+    <id column="FID" jdbcType="VARCHAR" property="fid" />
+    <result column="PRODATE" jdbcType="VARCHAR" property="prodate" />
+    <result column="MATERIALCODE" jdbcType="VARCHAR" property="materialcode" />
+    <result column="MATERIALNAME" jdbcType="VARCHAR" property="materialname" />
+    <result column="QTY" jdbcType="DECIMAL" property="qty" />
+    <result column="UNIT" jdbcType="VARCHAR" property="unit" />
+    <result column="LC_ID" jdbcType="VARCHAR" property="lcId" />
+  </resultMap>
+  <sql id="columns">
+    FID, PRODATE, MATERIALCODE, MATERIALNAME, QTY, UNIT, LC_ID
+  </sql>
+  <sql id="columns_alias">
+    t.FID, t.PRODATE, t.MATERIALCODE, t.MATERIALNAME, t.QTY, t.UNIT, t.LC_ID
+  </sql>
+  <sql id="select">
+    SELECT <include refid="columns"/> FROM EMS_PRODPLAN_ROUND_WEIGHT
+  </sql>
+  <sql id="select_alias">
+    SELECT <include refid="columns_alias"/> FROM EMS_PRODPLAN_ROUND_WEIGHT t
+  </sql>
+  <sql id="where">
+    <where> 
+      <if test="fid != null and fid != ''">
+        and FID = #{fid}
+      </if>
+      <if test="prodate != null and prodate != ''">
+        and PRODATE = #{prodate}
+      </if>
+      <if test="materialcode != null and materialcode != ''">
+        and MATERIALCODE = #{materialcode}
+      </if>
+      <if test="materialname != null and materialname != ''">
+        and MATERIALNAME = #{materialname}
+      </if>
+      <if test="qty != null">
+        and QTY = #{qty}
+      </if>
+      <if test="unit != null and unit != ''">
+        and UNIT = #{unit}
+      </if>
+      <if test="lcId != null and lcId != ''">
+        and LC_ID = #{lcId}
+      </if>
+    </where>
+  </sql>
+  <sql id="whereLike">
+    <where> 
+      <if test="fid != null and fid != ''">
+        and FID LIKE '%${fid}%'
+      </if>
+      <if test="prodate != null and prodate != ''">
+        and PRODATE LIKE '%${prodate}%'
+      </if>
+      <if test="materialcode != null and materialcode != ''">
+        and MATERIALCODE LIKE '%${materialcode}%'
+      </if>
+      <if test="materialname != null and materialname != ''">
+        and MATERIALNAME LIKE '%${materialname}%'
+      </if>
+      <if test="qty != null">
+        and QTY = #{qty}
+      </if>
+      <if test="unit != null and unit != ''">
+        and UNIT LIKE '%${unit}%'
+      </if>
+      <if test="lcId != null and lcId != ''">
+        and LC_ID LIKE '%${lcId}%'
+      </if>
+    </where>
+  </sql>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from EMS_PRODPLAN_ROUND_WEIGHT
+    where FID = #{fid,jdbcType=VARCHAR}
+  </delete>
+  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+    delete from EMS_PRODPLAN_ROUND_WEIGHT
+    where 1!=1 
+      <if test="prodate != null and prodate != ''">
+        or PRODATE = #{prodate}
+      </if>
+      <if test="materialcode != null and materialcode != ''">
+        or MATERIALCODE = #{materialcode}
+      </if>
+      <if test="materialname != null and materialname != ''">
+        or MATERIALNAME = #{materialname}
+      </if>
+      <if test="qty != null">
+        or QTY = #{qty}
+      </if>
+      <if test="unit != null and unit != ''">
+        or UNIT = #{unit}
+      </if>
+      <if test="lcId != null and lcId != ''">
+        or LC_ID = #{lcId}
+      </if>
+  </delete>
+  <insert id="insert" parameterType="com.steerinfo.ems.emsprodplanroundweight.model.EmsProdplanRoundWeight">
+    insert into EMS_PRODPLAN_ROUND_WEIGHT (FID, PRODATE, MATERIALCODE, 
+      MATERIALNAME, QTY, UNIT, 
+      LC_ID)
+    values (#{fid,jdbcType=VARCHAR}, #{prodate,jdbcType=VARCHAR}, #{materialcode,jdbcType=VARCHAR}, 
+      #{materialname,jdbcType=VARCHAR}, #{qty,jdbcType=DECIMAL}, #{unit,jdbcType=VARCHAR}, 
+      #{lcId,jdbcType=VARCHAR})
+  </insert>
+  <insert id="insertSelective" parameterType="com.steerinfo.ems.emsprodplanroundweight.model.EmsProdplanRoundWeight">
+    insert into EMS_PRODPLAN_ROUND_WEIGHT
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="fid != null">
+        FID,
+      </if>
+      <if test="prodate != null">
+        PRODATE,
+      </if>
+      <if test="materialcode != null">
+        MATERIALCODE,
+      </if>
+      <if test="materialname != null">
+        MATERIALNAME,
+      </if>
+      <if test="qty != null">
+        QTY,
+      </if>
+      <if test="unit != null">
+        UNIT,
+      </if>
+      <if test="lcId != null">
+        LC_ID,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="fid != null">
+        #{fid,jdbcType=VARCHAR},
+      </if>
+      <if test="prodate != null">
+        #{prodate,jdbcType=VARCHAR},
+      </if>
+      <if test="materialcode != null">
+        #{materialcode,jdbcType=VARCHAR},
+      </if>
+      <if test="materialname != null">
+        #{materialname,jdbcType=VARCHAR},
+      </if>
+      <if test="qty != null">
+        #{qty,jdbcType=DECIMAL},
+      </if>
+      <if test="unit != null">
+        #{unit,jdbcType=VARCHAR},
+      </if>
+      <if test="lcId != null">
+        #{lcId,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.emsprodplanroundweight.model.EmsProdplanRoundWeight">
+    update EMS_PRODPLAN_ROUND_WEIGHT
+    set PRODATE = #{prodate,jdbcType=VARCHAR},
+      MATERIALCODE = #{materialcode,jdbcType=VARCHAR},
+      MATERIALNAME = #{materialname,jdbcType=VARCHAR},
+      QTY = #{qty,jdbcType=DECIMAL},
+      UNIT = #{unit,jdbcType=VARCHAR},
+      LC_ID = #{lcId,jdbcType=VARCHAR}
+    where FID = #{fid,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.emsprodplanroundweight.model.EmsProdplanRoundWeight">
+    update EMS_PRODPLAN_ROUND_WEIGHT
+    <set>
+      <if test="prodate != null">
+        PRODATE = #{prodate,jdbcType=VARCHAR},
+      </if>
+      <if test="materialcode != null">
+        MATERIALCODE = #{materialcode,jdbcType=VARCHAR},
+      </if>
+      <if test="materialname != null">
+        MATERIALNAME = #{materialname,jdbcType=VARCHAR},
+      </if>
+      <if test="qty != null">
+        QTY = #{qty,jdbcType=DECIMAL},
+      </if>
+      <if test="unit != null">
+        UNIT = #{unit,jdbcType=VARCHAR},
+      </if>
+      <if test="lcId != null">
+        LC_ID = #{lcId,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where FID = #{fid,jdbcType=VARCHAR}
+  </update>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    <include refid="select"/>
+    where FID = #{fid,jdbcType=VARCHAR}
+  </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_PRODPLAN_ROUND_WEIGHT 
+      (FID, 
+      PRODATE, MATERIALCODE, MATERIALNAME, 
+      QTY, UNIT, LC_ID
+      )
+    ( <foreach collection="list" item="item" separator="union all"> 
+   select  
+      #{item.fid,jdbcType=VARCHAR}, 
+      #{item.prodate,jdbcType=VARCHAR}, #{item.materialcode,jdbcType=VARCHAR}, #{item.materialname,jdbcType=VARCHAR}, 
+      #{item.qty,jdbcType=DECIMAL}, #{item.unit,jdbcType=VARCHAR}, #{item.lcId,jdbcType=VARCHAR}
+       from dual  
+   </foreach> )
+  </insert>
+  <update id="batchUpdate" parameterType="java.util.List">
+     update EMS_PRODPLAN_ROUND_WEIGHT
+     set
+       FID=
+       <foreach collection="list" item="item" index="index" separator=" " open="case FID" close="end">
+          when #{item.fid,jdbcType=VARCHAR} then #{item.fid,jdbcType=VARCHAR}
+       </foreach>
+       ,PRODATE=
+       <foreach collection="list" item="item" index="index" separator=" " open="case FID" close="end">
+          when #{item.fid,jdbcType=VARCHAR} then #{item.prodate,jdbcType=VARCHAR}
+       </foreach>
+       ,MATERIALCODE=
+       <foreach collection="list" item="item" index="index" separator=" " open="case FID" close="end">
+          when #{item.fid,jdbcType=VARCHAR} then #{item.materialcode,jdbcType=VARCHAR}
+       </foreach>
+       ,MATERIALNAME=
+       <foreach collection="list" item="item" index="index" separator=" " open="case FID" close="end">
+          when #{item.fid,jdbcType=VARCHAR} then #{item.materialname,jdbcType=VARCHAR}
+       </foreach>
+       ,QTY=
+       <foreach collection="list" item="item" index="index" separator=" " open="case FID" close="end">
+          when #{item.fid,jdbcType=VARCHAR} then #{item.qty,jdbcType=DECIMAL}
+       </foreach>
+       ,UNIT=
+       <foreach collection="list" item="item" index="index" separator=" " open="case FID" close="end">
+          when #{item.fid,jdbcType=VARCHAR} then #{item.unit,jdbcType=VARCHAR}
+       </foreach>
+       ,LC_ID=
+       <foreach collection="list" item="item" index="index" separator=" " open="case FID" close="end">
+          when #{item.fid,jdbcType=VARCHAR} then #{item.lcId,jdbcType=VARCHAR}
+       </foreach>
+     where FID in 
+     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+    #{item.fid,jdbcType=VARCHAR}
+     </foreach> 
+  </update>
+  <delete id="batchDelete" parameterType="java.util.List">
+    delete from EMS_PRODPLAN_ROUND_WEIGHT
+    where FID in 
+    <foreach collection="list" item="id" open="(" close=")" separator=",">
+      #{id}
+    </foreach>
+  </delete>
+  <!-- 友情提示!!!-->
+  <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+  
+</mapper>

+ 138 - 0
src/main/java/com/steerinfo/ems/emsprodplanroundweight/model/EmsProdplanRoundWeight.java

@@ -0,0 +1,138 @@
+package com.steerinfo.ems.emsprodplanroundweight.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 EmsProdplanRoundWeight implements IBasePO<String> {
+    /**
+     * ID(FID,VARCHAR,100)
+     */
+    @ApiModelProperty(value="ID",required=true)
+    private String fid;
+
+    /**
+     * 时间(PRODATE,VARCHAR,100)
+     */
+    @ApiModelProperty(value="时间",required=false)
+    private String prodate;
+
+    /**
+     * 物料编码(MATERIALCODE,VARCHAR,100)
+     */
+    @ApiModelProperty(value="物料编码",required=false)
+    private String materialcode;
+
+    /**
+     * 物料名称(MATERIALNAME,VARCHAR,100)
+     */
+    @ApiModelProperty(value="物料名称",required=false)
+    private String materialname;
+
+    /**
+     * 完工量(QTY,DECIMAL,0)
+     */
+    @ApiModelProperty(value="完工量",required=false)
+    private BigDecimal qty;
+
+    /**
+     * 单位(UNIT,VARCHAR,2)
+     */
+    @ApiModelProperty(value="单位",required=false)
+    private String unit;
+
+    /**
+     * 轮次id(LC_ID,VARCHAR,100)
+     */
+    @ApiModelProperty(value="轮次id",required=false)
+    private String lcId;
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public String getId() {
+        return this.fid;
+    }
+
+    @Override
+    public void setId(String fid) {
+        this.fid = fid == null ? null : fid.trim();
+    }
+
+    public String getFid() {
+        return fid;
+    }
+
+    public void setFid(String fid) {
+        this.fid = fid == null ? null : fid.trim();
+    }
+
+    public String getProdate() {
+        return prodate;
+    }
+
+    public void setProdate(String prodate) {
+        this.prodate = prodate == null ? null : prodate.trim();
+    }
+
+    public String getMaterialcode() {
+        return materialcode;
+    }
+
+    public void setMaterialcode(String materialcode) {
+        this.materialcode = materialcode == null ? null : materialcode.trim();
+    }
+
+    public String getMaterialname() {
+        return materialname;
+    }
+
+    public void setMaterialname(String materialname) {
+        this.materialname = materialname == null ? null : materialname.trim();
+    }
+
+    public BigDecimal getQty() {
+        return qty;
+    }
+
+    public void setQty(BigDecimal qty) {
+        this.qty = qty;
+    }
+
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit == null ? null : unit.trim();
+    }
+
+    public String getLcId() {
+        return lcId;
+    }
+
+    public void setLcId(String lcId) {
+        this.lcId = lcId == null ? null : lcId.trim();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", fid=").append(fid);
+        sb.append(", prodate=").append(prodate);
+        sb.append(", materialcode=").append(materialcode);
+        sb.append(", materialname=").append(materialname);
+        sb.append(", qty=").append(qty);
+        sb.append(", unit=").append(unit);
+        sb.append(", lcId=").append(lcId);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 24 - 0
src/main/java/com/steerinfo/ems/emsprodplanroundweight/service/IEmsProdplanRoundWeightService.java

@@ -0,0 +1,24 @@
+package com.steerinfo.ems.emsprodplanroundweight.service;
+
+import com.steerinfo.framework.service.IBaseService;
+import com.steerinfo.ems.emsprodplanroundweight.model.EmsProdplanRoundWeight;
+
+import java.text.ParseException;
+
+/**
+ * EmsProdplanRoundWeight服务接口:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2021-12-01 04:14
+ * 类描述
+ * 修订历史:
+ * 日期:2021-12-01
+ * 作者:generator
+ * 参考:
+ * 描述:EmsProdplanRoundWeight服务接口
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+public interface IEmsProdplanRoundWeightService extends IBaseService<EmsProdplanRoundWeight, String>{
+    public void getWeightForLg() throws ParseException;
+
+}

+ 76 - 0
src/main/java/com/steerinfo/ems/emsprodplanroundweight/service/impl/EmsProdplanRoundWeightServiceImpl.java

@@ -0,0 +1,76 @@
+package com.steerinfo.ems.emsprodplanroundweight.service.impl;
+
+import com.steerinfo.ems.Utils.DateUtils;
+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.steerinfo.ems.emsprodplanroundweight.model.EmsProdplanRoundWeight;
+import com.steerinfo.ems.emsprodplanroundweight.mapper.EmsProdplanRoundWeightMapper;
+import com.steerinfo.ems.emsprodplanroundweight.service.IEmsProdplanRoundWeightService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * EmsProdplanRoundWeight服务实现:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2021-12-01 04:14
+ * 类描述
+ * 修订历史:
+ * 日期:2021-12-01
+ * 作者:generator
+ * 参考:
+ * 描述:EmsProdplanRoundWeight服务实现
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+@Service(value = "emsProdplanRoundWeightService")
+public class EmsProdplanRoundWeightServiceImpl extends BaseServiceImpl<EmsProdplanRoundWeight, String> implements IEmsProdplanRoundWeightService {
+
+    @Autowired
+    private EmsProdplanRoundWeightMapper emsProdplanRoundWeightMapper;
+    @Autowired
+    private LgWeightFeigenService lgWeightFeigenService;
+
+    @Override
+    protected IBaseMapper<EmsProdplanRoundWeight, String> getMapper() {
+        return emsProdplanRoundWeightMapper;
+    }
+
+    //获取炼钢计划的重量
+    public void getWeightForLg() throws ParseException {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        Date dt = sdf.parse(DateUtils.dateStr(new Date(), "yyyy-MM-dd"));
+        Calendar rightNow = Calendar.getInstance();
+        rightNow.setTime(dt);
+        rightNow.add(Calendar.DAY_OF_MONTH, -7);
+        Date dt1 = rightNow.getTime();
+        String reStr = sdf.format(dt1);
+        List<LgWeight> lgWeights = lgWeightFeigenService.QueryWeightforRound(reStr, DateUtils.dateStr(new Date(), "yyyy-MM-dd"));
+        lgWeights.forEach(item -> {
+            EmsProdplanRoundWeight model = new EmsProdplanRoundWeight();
+            model.setFid(item.getFid());
+            model.setLcId(item.getRoundid());
+            model.setQty(item.getWeight());
+            model.setMaterialcode(item.getMaterialcode());
+            model.setMaterialname(item.getMaterialname());
+            model.setProdate(model.getProdate());
+            model.setUnit(model.getUnit());
+            EmsProdplanRoundWeight emsProdplanRoundWeight = emsProdplanRoundWeightMapper.selectByPrimaryKey(model.getFid());
+            if(emsProdplanRoundWeight !=  null){
+                emsProdplanRoundWeightMapper.updateByPrimaryKeySelective(emsProdplanRoundWeight);
+            }
+            else {
+                emsProdplanRoundWeightMapper.insert(model);
+            }
+        });
+
+    }
+}