Browse Source

2021/07/22 -LRL

lirl 3 years ago
parent
commit
40a81e812a

+ 44 - 22
src/main/java/com/steerinfo/ems/emsprodplanround/controller/EmsProdplanRoundController.java

@@ -17,6 +17,7 @@ import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import java.text.SimpleDateFormat;
@@ -87,7 +88,7 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
         map.put("may",sdf.format(model.getMay()));
         EmsProdplanMonth emsProdplanMonth = emsProdplanMonthMapper.getBymayAndWorkprocid(map);
         if(emsProdplanMonth == null){
-            return  failed(null,"工序无法找到"+sdf.format(model.getMay())+"月数据");
+            return  failed(null,"工序无法找到"+sdf.format(model.getMay())+"月数据");
         }
         map.put("parentid",emsProdplanMonth.getId());
         EmsProdplanRound getbeyondWeight = emsProdplanRoundService.getbeyondWeight(map);
@@ -102,8 +103,8 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
         model.setCreateman(userId);
         model.setWorkprocType(map.get("workprocid").toString());
         EmsProdplanRound emsProdplanRound = emsProdplanRoundService.add(model);
-        if(getbeyondWeight.getPlanWeight()>emsProdplanMonth.getWeightMonth()){
-            return success(emsProdplanRound,"新增成功,但是轮次计划重量已超出!!!");
+        if(getbeyondWeight.getPlanWeight().compareTo(emsProdplanMonth.getWeightMonth()) == 1){
+            return success(null,"新增成功,但是轮次计划重量已超出!!!");
         }
         return success();
     }
@@ -176,46 +177,64 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
     	}
       return success();
     }
-    @ApiOperation(value="修改", notes="根据models修改对象")
+    @ApiOperation(value="下发", notes="根据models修改对象")
     @ApiImplicitParam(name = "emsProdplanRounds", value = "", required = true, dataType = "EmsProdplanRounds")
     @PostMapping(value = "/issue")
+    @Transactional
     public RESTfulResult issue(@RequestBody EmsProdplanRound [] models){
         List id = new ArrayList();
         String monthid = "";
-        String state  ="";
         for (int i = 0; i < models.length; i++) {
             EmsProdplanRound model = models[i];
             id.add(model.getId());
             monthid = model.getParentid();
             model.setIssuedTime(new Date());
-            model.getIsxf() ;
-            if(model.getIsxf().equals("1")){
-                model.setState("1");
+            if(model.getState().equals("1")){
+                return  failed(null,"存在已下发的计划,无法再次做下发");
             }
-            state = model.getIsxf();
+            model.setState("1");
+            emsProdplanRoundMapper.updateByPrimaryKey(model);
+        }
+        EmsProdplanRound sumPlanWeight = emsProdplanRoundService.getSumPlanWeight(id);
+        EmsProdplanMonth emsProdplanMonth = emsProdplanMonthMapper.selectByPrimaryKey(monthid);
+        emsProdplanMonth.setKxf_weight(emsProdplanMonth.getWeightMonth().subtract(emsProdplanMonth.getYxf_weight().add(sumPlanWeight.getPlanWeight())));
+        emsProdplanMonth.setYxf_weight(emsProdplanMonth.getYxf_weight().add(sumPlanWeight.getPlanWeight()));
+        emsProdplanMonthMapper.updateByPrimaryKey(emsProdplanMonth);
+        return  success();
+    }
+    @ApiOperation(value="取消下发", notes="根据models修改对象")
+    @ApiImplicitParam(name = "emsProdplanRounds", value = "", required = true, dataType = "EmsProdplanRounds")
+    @PostMapping(value = "/offissue")
+    @Transactional
+    public RESTfulResult offissue(@RequestBody EmsProdplanRound [] models){
+        List id = new ArrayList();
+        String monthid = "";
+        String state  ="";
+        for (int i = 0; i < models.length; i++) {
+            EmsProdplanRound model = models[i];
+            id.add(model.getId());
+            monthid = model.getParentid();
+            model.setIssuedTime(new Date());
             if(model.getState().equals("0")){
                 return  failed(null,"没有下发过的轮次计划无法做取消下发操作");
             }
-            if(model.getIsxf().equals("0")){
-                model.setState("0");
+            EmsProdplanRound emsProdplanRound = emsProdplanRoundMapper.selectByPrimaryKey(model.getId());
+            if(emsProdplanRound.getState().equals("2")){
+                return failed(null,"存在已经接收的计划,无法做取消下发操作,请重新刷新页面");
             }
+            model.setState("0");
             emsProdplanRoundMapper.updateByPrimaryKey(model);
         }
         EmsProdplanRound sumPlanWeight = emsProdplanRoundService.getSumPlanWeight(id);
         EmsProdplanMonth emsProdplanMonth = emsProdplanMonthMapper.selectByPrimaryKey(monthid);
-        if(state.equals("1")){
-            emsProdplanMonth.setKxf_weight(emsProdplanMonth.getWeightMonth()-(emsProdplanMonth.getYxf_weight()+sumPlanWeight.getPlanWeight()));
-            emsProdplanMonth.setYxf_weight(emsProdplanMonth.getYxf_weight()+sumPlanWeight.getPlanWeight());
-        }
-        else {
-            emsProdplanMonth.setKxf_weight(emsProdplanMonth.getKxf_weight()+sumPlanWeight.getPlanWeight());
-            emsProdplanMonth.setYxf_weight(emsProdplanMonth.getYxf_weight()-sumPlanWeight.getPlanWeight());
-        }
-            emsProdplanMonthMapper.updateByPrimaryKey(emsProdplanMonth);
-            return  success();
+        // 取消下发操作
+        emsProdplanMonth.setKxf_weight(emsProdplanMonth.getKxf_weight().add(sumPlanWeight.getPlanWeight()));
+        emsProdplanMonth.setYxf_weight(emsProdplanMonth.getYxf_weight().subtract(sumPlanWeight.getPlanWeight()));
+        emsProdplanMonthMapper.updateByPrimaryKey(emsProdplanMonth);
+        return  success();
     }
 
-    @ApiOperation(value="删除", notes="根据models删除对象")
+
     @ApiImplicitParam(name = "emsProdplanRounds", value = "", required = true, dataType = "EmsProdplanRounds")
     @PostMapping(value = "/delete")
     public RESTfulResult delete(@RequestBody EmsProdplanRound [] models){
@@ -228,4 +247,7 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
         }
         return  success();
     }
+
+
+
 }

+ 27 - 6
src/main/java/com/steerinfo/ems/emsprodplanround/mapper/EmsProdplanRoundMapper.xml

@@ -26,17 +26,24 @@
     <result column="MSG_FLAG" jdbcType="VARCHAR" property="msgFlag" />
     <result column="READ_FLAG" jdbcType="VARCHAR" property="readFlag" />
     <result column="PARENTID" jdbcType="VARCHAR" property="parentid"/>
+    <result column="IATERAL_AREA" jdbcType="VARCHAR" property="iateralArea"/>
+    <result column="LENGTH_TIMES_WIDTH" jdbcType="VARCHAR" property="lengthTimesWidth"/>
+    <result column="DIMENSION" jdbcType="VARCHAR" property="dimension"/>
+    <result column="STATUS" jdbcType="VARCHAR" property="status"/>
+    <result column="ERR_MSG" jdbcType="VARCHAR" property="err_msg"/>
+    <result column="GOINFO" jdbcType="VARCHAR" property="goinfo"/>
+    <result column="FETCH_PLAN_WEIGHT" jdbcType="DECIMAL" property="fetchPlanWeight"/>
   </resultMap>
   <sql id="columns">
     ID, MAY, SQNO, UNITID, DESCRIBE, STATE, GRADES, PLAN_WEIGHT, SPECIFICATIONS, LENGTHS, 
     CHEMICAL_STANDARD, SURFACE_STANDARD, MEMO, ISSUED_TIME, CREATEMAN, CREATETIME, UPDATEMAN, 
-    UPDATETIME, TRANSPORT_TYPE, PURPOSE, WORKPROC_TYPE, MSG_FLAG, READ_FLAG,PARENTID
+    UPDATETIME, TRANSPORT_TYPE, PURPOSE, WORKPROC_TYPE, MSG_FLAG, READ_FLAG,PARENTID,IATERAL_AREA,LENGTH_TIMES_WIDTH,DIMENSION,STATUS,ERR_MSG,GOINFO,FETCH_PLAN_WEIGHT
   </sql>
   <sql id="columns_alias">
     t.ID, t.MAY, t.SQNO, t.UNITID, t.DESCRIBE, t.STATE, t.GRADES, t.PLAN_WEIGHT, t.SPECIFICATIONS, 
     t.LENGTHS, t.CHEMICAL_STANDARD, t.SURFACE_STANDARD, t.MEMO, t.ISSUED_TIME, t.CREATEMAN, 
     t.CREATETIME, t.UPDATEMAN, t.UPDATETIME, t.TRANSPORT_TYPE, t.PURPOSE, t.WORKPROC_TYPE, 
-    t.MSG_FLAG, t.READ_FLAG,t.PARENTID
+    t.MSG_FLAG, t.READ_FLAG,t.PARENTID,GOINFO,FETCH_PLAN_WEIGHT
   </sql>
   <sql id="select">
     SELECT <include refid="columns"/> FROM EMS_PRODPLAN_ROUND
@@ -274,8 +281,8 @@
       LENGTHS, CHEMICAL_STANDARD, SURFACE_STANDARD, 
       MEMO, ISSUED_TIME, CREATEMAN, 
       CREATETIME, UPDATEMAN, UPDATETIME, 
-      TRANSPORT_TYPE, PURPOSE, WORKPROC_TYPE, 
-      MSG_FLAG, READ_FLAG,PARENTID)
+      TRANSPORT_TYPE, PURPOSE, WORKPROC_TYPE,
+      MSG_FLAG, READ_FLAG,PARENTID,IATERAL_AREA,LENGTH_TIMES_WIDTH,DIMENSION,GOINFO)
     values (#{id,jdbcType=VARCHAR}, #{may,jdbcType=TIMESTAMP}, #{sqno,jdbcType=DECIMAL},
       #{unitid,jdbcType=VARCHAR}, #{describe,jdbcType=VARCHAR}, #{state,jdbcType=VARCHAR}, 
       #{grades,jdbcType=VARCHAR}, #{planWeight,jdbcType=DECIMAL}, #{specifications,jdbcType=VARCHAR}, 
@@ -283,7 +290,7 @@
       #{memo,jdbcType=VARCHAR}, #{issuedTime,jdbcType=TIMESTAMP}, #{createman,jdbcType=VARCHAR}, 
       #{createtime,jdbcType=TIMESTAMP}, #{updateman,jdbcType=VARCHAR}, #{updatetime,jdbcType=TIMESTAMP}, 
       #{transportType,jdbcType=VARCHAR}, #{purpose,jdbcType=VARCHAR}, #{workprocType,jdbcType=VARCHAR}, 
-      #{msgFlag,jdbcType=VARCHAR}, #{readFlag,jdbcType=VARCHAR},#{parentid,jdbcType=VARCHAR})
+      #{msgFlag,jdbcType=VARCHAR}, #{readFlag,jdbcType=VARCHAR},#{parentid,jdbcType=VARCHAR},#{iateralArea,jdbcType=VARCHAR},#{lengthTimesWidth,jdbcType=VARCHAR},#{dimension,jdbcType=VARCHAR},#{goinfo,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound">
     insert into EMS_PRODPLAN_ROUND
@@ -428,6 +435,12 @@
       <if test="readFlag != null">
         #{readFlag,jdbcType=VARCHAR},
       </if>
+      <if test="goinfo != null and goinfo ! = ''">
+        #{goinfo,jdbcType=VARCHAR}
+      </if>
+      <if test="fetchPlanWeight != null ">
+        #{fetchPlanWeight,jdbcType=DECIMAL}
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound">
@@ -451,7 +464,12 @@
       UPDATETIME = #{updatetime,jdbcType=TIMESTAMP},
       TRANSPORT_TYPE = #{transportType,jdbcType=VARCHAR},
       PURPOSE = #{purpose,jdbcType=VARCHAR},
-      WORKPROC_TYPE = #{workprocType,jdbcType=VARCHAR}
+      WORKPROC_TYPE = #{workprocType,jdbcType=VARCHAR},
+      PARENTID = #{parentid,jdbcType=VARCHAR},
+      IATERAL_AREA = #{iateralArea,jdbcType=VARCHAR},
+      LENGTH_TIMES_WIDTH = #{lengthTimesWidth,jdbcType=VARCHAR},
+      DIMENSION = #{dimension,jdbcType=VARCHAR},
+      GOINFO = #{goinfo,jdbcType=VARCHAR}
     where ID = #{id,jdbcType=VARCHAR}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound">
@@ -523,6 +541,9 @@
       <if test="readFlag != null">
         READ_FLAG = #{readFlag,jdbcType=VARCHAR},
       </if>
+      <if test="parentid != null and parentid != ''">
+       PARENTID = #{parentid,jdbcType=VARCHAR}
+      </if>
     </set>
     where ID = #{id,jdbcType=VARCHAR}
   </update>

+ 82 - 4
src/main/java/com/steerinfo/ems/emsprodplanround/model/EmsProdplanRound.java

@@ -4,6 +4,8 @@ import com.alibaba.fastjson.annotation.JSONField;
 import com.steerinfo.framework.model.IBasePO;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
 import java.util.Date;
 
 @ApiModel(value="轮次计划表")
@@ -55,7 +57,7 @@ public class EmsProdplanRound implements IBasePO<String> {
      * 计划量(PLAN_WEIGHT,DECIMAL,0)
      */
     @ApiModelProperty(value="计划量",required=false)
-    private Long planWeight;
+    private BigDecimal planWeight;
 
     /**
      * 规格(SPECIFICATIONS,VARCHAR,100)
@@ -153,6 +155,81 @@ public class EmsProdplanRound implements IBasePO<String> {
     public String getParentid() {
         return parentid;
     }
+    @ApiModelProperty(value = "高度乘以宽度",required = true)
+
+    private String iateralArea;
+    @ApiModelProperty(value = "断面",required = true)
+
+    private String lengthTimesWidth;
+    @ApiModelProperty(value = "截面尺寸",required = true)
+    private String dimension;
+
+    @ApiModelProperty(value = "处理状态",required = true)
+    private String status;
+
+    @ApiModelProperty(value = "错误信息",required = true)
+    private  String err_msg;
+
+    @ApiModelProperty(value = "去向", required =  true)
+    private String goinfo;
+    @ApiModelProperty
+    private BigDecimal  fetchPlanWeight;
+
+    public String getGoinfo() {
+        return goinfo;
+    }
+
+    public void setGoinfo(String goinfo) {
+        this.goinfo = goinfo;
+    }
+
+    public BigDecimal getFetchPlanWeight() {
+        return fetchPlanWeight;
+    }
+
+    public void setFetchPlanWeight(BigDecimal fetchPlanWeight) {
+        this.fetchPlanWeight = fetchPlanWeight;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getErr_msg() {
+        return err_msg;
+    }
+
+    public void setErr_msg(String err_msg) {
+        this.err_msg = err_msg;
+    }
+
+    public String getIateralArea() {
+        return iateralArea;
+    }
+
+    public void setIateralArea(String iateralArea) {
+        this.iateralArea = iateralArea;
+    }
+
+    public String getLengthTimesWidth() {
+        return lengthTimesWidth;
+    }
+
+    public void setLengthTimesWidth(String lengthTimesWidth) {
+        this.lengthTimesWidth = lengthTimesWidth;
+    }
+
+    public String getDimension() {
+        return dimension;
+    }
+
+    public void setDimension(String dimension) {
+        this.dimension = dimension;
+    }
 
     public void setParentid(String parentid) {
         this.parentid = parentid;
@@ -216,11 +293,12 @@ public class EmsProdplanRound implements IBasePO<String> {
         this.grades = grades == null ? null : grades.trim();
     }
 
-    public Long getPlanWeight() {
+
+    public BigDecimal getPlanWeight() {
         return planWeight;
     }
 
-    public void setPlanWeight(Long planWeight) {
+    public void setPlanWeight(BigDecimal planWeight) {
         this.planWeight = planWeight;
     }
 
@@ -237,7 +315,7 @@ public class EmsProdplanRound implements IBasePO<String> {
     }
 
     public void setLengths(String lengths) {
-        this.lengths = lengths == null ? null : lengths.trim();
+        this.lengths = lengths;
     }
 
     public String getChemicalStandard() {