소스 검색

lrl -- 2021-09-17

lirl 3 년 전
부모
커밋
7ea4a93823

+ 1 - 1
pom.xml

@@ -214,7 +214,7 @@
 <!--				  <password>123456</password>-->
 <!--				  <targetPackage>com.steerinfo.ems</targetPackage>-->
 <!--				  <tables>-->
-<!--					<param>EMS_WATER_REALTIME</param>-->
+<!--					<param>EMS_GM_PC_JH</param>-->
 <!--				  </tables>-->
 <!--				</configuration>-->
 <!--				<executions>-->

+ 0 - 1
src/main/java/com/steerinfo/auth/shiro/realm/OssServiceClient.java

@@ -12,7 +12,6 @@ import com.steerinfo.framework.controller.RESTfulResult;
 public interface OssServiceClient {
 
 	@RequestMapping(value="/v1/sysusers/{id}", method=RequestMethod.GET)
-
     public RESTfulResult getUser(@PathVariable("id") String id);
 	
 	@RequestMapping(value="/v1/sysusers/user/token/", method=RequestMethod.GET)

+ 2 - 0
src/main/java/com/steerinfo/ems/dispatchplog/service/impl/DispatchPLogServiceImpl.java

@@ -1,5 +1,7 @@
 package com.steerinfo.ems.dispatchplog.service.impl;
 
+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 com.steerinfo.ems.dispatchplog.model.DispatchPLog;

+ 2 - 2
src/main/java/com/steerinfo/ems/emsprodplanmonth/mapper/EmsProdplanMonthMapper.xml

@@ -73,8 +73,8 @@
       <if test="state != null and state != ''">
         and STATE = #{state}
       </if>
-      <if test="may !=null">
-       and  trunc(MAY) = to_date(#{may},'yyyy-mm')
+      <if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
+       and  MAY  between  to_date(#{startTime},'yyyy-mm') and to_date(#{endTime},'yyyy-mm')
       </if>
     </where>
     ORDER  BY SQNO

+ 85 - 41
src/main/java/com/steerinfo/ems/emsprodplanround/controller/EmsProdplanRoundController.java

@@ -1,6 +1,8 @@
 package com.steerinfo.ems.emsprodplanround.controller;
 
 import com.steerinfo.auth.utils.JwtUtil;
+import com.steerinfo.ems.emsgmpcjh.mapper.EmsGmPcJhMapper;
+import com.steerinfo.ems.emsgmpcjh.model.EmsGmPcJh;
 import com.steerinfo.ems.emsprodplanmonth.mapper.EmsProdplanMonthMapper;
 import com.steerinfo.ems.emsprodplanmonth.model.EmsProdplanMonth;
 import com.steerinfo.ems.emsprodplanmonth.service.IEmsProdplanMonthService;
@@ -14,8 +16,10 @@ import com.steerinfo.ems.emsprodplanround.service.IEmsProdplanRoundService;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import lombok.val;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.apache.tools.ant.taskdefs.Get;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
@@ -44,7 +48,7 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
     @Autowired
     IEmsProdplanRoundService emsProdplanRoundService;
     @Autowired
-    EmsProdplanMonthMapper emsProdplanMonthMapper;
+    EmsGmPcJhMapper emsGmPcJhMapper;
     @Autowired
     EmsProdplanRoundMapper emsProdplanRoundMapper;
     @Autowired
@@ -76,35 +80,35 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
     @ApiOperation(value="创建", notes="根据EmsProdplanRound对象创建")
     @ApiImplicitParam(name = "emsProdplanRound", value = "详细实体emsProdplanRound", required = true, dataType = "EmsProdplanRound")
     @PostMapping(value = "/")
-    public RESTfulResult add(@RequestBody EmsProdplanRound model){
+    public RESTfulResult add(@RequestBody EmsProdplanRound [] models){
         String userId = JwtUtil.getUseridByToken();
-        if(model.getWorkprocType() == null||model.getWorkprocType().equals("") || model.getMay() == null || model.getMay().equals("")){
-            return  failed(null,"工序或者时间为空");
-        }
-        HashMap<String,Object> map =  new HashMap();
-        String strDateFormat = "yyyy-MM";
-        SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
-        map.put("workprocid",model.getWorkprocType());
-        map.put("may",sdf.format(model.getMay()));
-        EmsProdplanMonth emsProdplanMonth = emsProdplanMonthMapper.getBymayAndWorkprocid(map);
-        if(emsProdplanMonth == null){
-            return  failed(null,"该工序无法找到"+sdf.format(model.getMay())+"月数据");
-        }
-        map.put("parentid",emsProdplanMonth.getId());
-        EmsProdplanRound getbeyondWeight = emsProdplanRoundService.getbeyondWeight(map);
-        model.setParentid(emsProdplanMonth.getId());
-        model.setSqno(emsProdplanMonth.getSqno());
-        model.setPlanWeight(model.getPlanWeight());
-        model.setMsgFlag("I");
-        model.setReadFlag("N");
-        model.setPlanWeight(model.getPlanWeight());
-        model.setState("0");
-        model.setCreatetime(new Date());
-        model.setCreateman(userId);
-        model.setWorkprocType(map.get("workprocid").toString());
-        EmsProdplanRound emsProdplanRound = emsProdplanRoundService.add(model);
-        if(getbeyondWeight.getPlanWeight().compareTo(emsProdplanMonth.getWeightMonth()) == 1){
-            return success(null,"新增成功,但是轮次计划重量已超出!!!");
+        String maxid = null;
+        for (EmsProdplanRound model : models) {
+            EmsGmPcJh emsGmPcJh = emsGmPcJhMapper.selectByPrimaryKey(model.getParentid());
+            if(emsGmPcJh.getState().equals("0")){
+                return failed("排产计划编号为"+emsGmPcJh.getId()+"做了取消下发操作,无法做新增操作");
+            }
+            if(model.getWorkprocType() == null || model.getWorkprocType().equals("")){
+                return  failed(null,"工序或者时间为空");
+            }
+            if (model.getParentid().substring(0,1).equals("G")){
+                maxid = emsProdplanRoundService.getMaxidAsGm(model);
+            }
+            else {
+                maxid = emsProdplanRoundService.getMaxidAsSC(model);
+            }
+            model.setId(maxid);
+            model.setPlanWeight(model.getPlanWeight());
+            model.setMsgFlag("I");
+            model.setReadFlag("N");
+            model.setState("0");
+            model.setCreatetime(new Date());
+            model.setCreateman(userId);
+            model.setWorkprocType(model.getWorkprocType());
+            emsProdplanRoundService.add(model);
+            emsGmPcJh.setState("2");
+            emsGmPcJh.setReceiveTime(new Date());
+            emsGmPcJhMapper.updateByPrimaryKeySelective(emsGmPcJh);
         }
         return success();
     }
@@ -150,8 +154,8 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
     })
     //@RequiresPermissions("emsprodplanround:update")
 
-    @PutMapping(value = "/{id}", produces  = "application/json;charset=UTF-8")
-    public RESTfulResult update(@PathVariable String id, @RequestBody EmsProdplanRound[] models){
+    @PutMapping(value = "batchUpdate", produces  = "application/json;charset=UTF-8")
+    public RESTfulResult update(@RequestBody EmsProdplanRound[] models){
         String userId = JwtUtil.getUseridByToken();
         for (int i = 0; i < models.length; i++) {
             EmsProdplanRound  model = models[i];
@@ -196,10 +200,10 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
             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);
+        EmsGmPcJh emsGmPcJh = emsGmPcJhMapper.selectByPrimaryKey(monthid);
+        emsGmPcJh.setKxfWeight(emsGmPcJh.getPlanWeight().subtract(emsGmPcJh.getYxfWeight().add(sumPlanWeight.getPlanWeight())));
+        emsGmPcJh.setYxfWeight(emsGmPcJh.getYxfWeight().add(sumPlanWeight.getPlanWeight()));
+        emsGmPcJhMapper.updateByPrimaryKey(emsGmPcJh);
         return  success();
     }
     @ApiOperation(value="取消下发", notes="根据models修改对象")
@@ -226,11 +230,11 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
             emsProdplanRoundMapper.updateByPrimaryKey(model);
         }
         EmsProdplanRound sumPlanWeight = emsProdplanRoundService.getSumPlanWeight(id);
-        EmsProdplanMonth emsProdplanMonth = emsProdplanMonthMapper.selectByPrimaryKey(monthid);
+        EmsGmPcJh emsGmPcJh = emsGmPcJhMapper.selectByPrimaryKey(monthid);
         // 取消下发操作
-        emsProdplanMonth.setKxf_weight(emsProdplanMonth.getKxf_weight().add(sumPlanWeight.getPlanWeight()));
-        emsProdplanMonth.setYxf_weight(emsProdplanMonth.getYxf_weight().subtract(sumPlanWeight.getPlanWeight()));
-        emsProdplanMonthMapper.updateByPrimaryKey(emsProdplanMonth);
+        emsGmPcJh.setKxfWeight(emsGmPcJh.getKxfWeight().add(sumPlanWeight.getPlanWeight()));
+        emsGmPcJh.setYxfWeight(emsGmPcJh.getYxfWeight().subtract(sumPlanWeight.getPlanWeight()));
+        emsGmPcJhMapper.updateByPrimaryKey(emsGmPcJh);
         return  success();
     }
 
@@ -240,14 +244,54 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
     public RESTfulResult delete(@RequestBody EmsProdplanRound [] models){
         for (int i = 0; i < models.length; i++) {
             EmsProdplanRound model = models[i];
-            if(model.getState().equals("1") || model.getState().equals("2")){
-                return  failed(null,"数据已下发或者被接收,无法删除");
+            if (model.getState().equals("1") || model.getState().equals("2")) {
+                return failed(null, "数据已下发或者被接收,无法删除");
             }
             emsProdplanRoundMapper.deleteByPrimaryKey(model.getId());
+            deleteNbjh(model);
         }
         return  success();
     }
 
+    @ApiOperation(value="获取详细信息", notes="根据url获取长度*宽度")
+    @GetMapping(value = "getlengthTimesWidth")
+    public RESTfulResult getlengthTimesWidth(){
+        List<EmsProdplanRound> emsProdplanRounds = emsProdplanRoundService.getlengthTimesWidth();
+        return success(emsProdplanRounds);
+    }
 
+    @ApiOperation(value="获取详细信息", notes="根据url获取断面")
+    @GetMapping(value = "getiateralArea")
+    public RESTfulResult getiateralArea(){
+        List<EmsProdplanRound> emsProdplanRounds = emsProdplanRoundService.getiateralArea();
+        return success(emsProdplanRounds);
+    }
+
+    @ApiOperation(value="获取详细信息", notes="根据url获取截取面积")
+    @GetMapping(value = "getdimension")
+    public RESTfulResult getdimension(){
+        List<EmsProdplanRound> emsProdplanRounds = emsProdplanRoundService.getdimension();
+        return success(emsProdplanRounds);
+    }
+
+    @ApiOperation(value="获取详细信息", notes="根据url获取断面")
+    @GetMapping(value = "getsurfaceStandard")
+    public RESTfulResult getsurfaceStandard(){
+        List<EmsProdplanRound> emsProdplanRounds = emsProdplanRoundService.getsurfaceStandard();
+        return success(emsProdplanRounds);
+    }
 
+    //如果是内部计划 则判断有没有轮次计划 做删除操作
+    public void deleteNbjh(EmsProdplanRound emsProdplanRound) {
+        if (emsProdplanRound.getId().substring(0,1).equals("N")) {
+            if (emsProdplanRound.getParentid() != null || !emsProdplanRound.getParentid().equals("")) {
+                Map<String,Object> map =  new HashMap();
+                map.put("parentid",emsProdplanRound.getParentid());
+                List list = emsProdplanRoundMapper.selectByParameters(map);
+                if (list.size()<1) {
+                    emsGmPcJhMapper.deleteByPrimaryKey(emsProdplanRound.getParentid());
+                }
+            }
+        }
+    }
 }

+ 13 - 2
src/main/java/com/steerinfo/ems/emsprodplanround/mapper/EmsProdplanRoundMapper.java

@@ -2,7 +2,7 @@ package com.steerinfo.ems.emsprodplanround.mapper;
 
 import com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound;
 import com.steerinfo.framework.mapper.IBaseMapper;
-import java.math.*;
+
 import java.util.HashMap;
 import java.util.List;
 
@@ -12,6 +12,17 @@ import org.apache.ibatis.annotations.Mapper;
 public interface EmsProdplanRoundMapper extends IBaseMapper<EmsProdplanRound, String> {
 
     EmsProdplanRound getbeyondWeight(HashMap<String,Object> parmas);
-
     EmsProdplanRound getSumPlanWeight(List ids);
+    //获取编号
+    String getMaxidAsGm(EmsProdplanRound emsProdplanRound);
+    //获取编号
+    String getMaxidAsSC(EmsProdplanRound emsProdplanRound);
+    //获取宽度*长度
+    List<EmsProdplanRound> getlengthTimesWidth();
+    //获取断面
+    List<EmsProdplanRound> getiateralArea();
+    //获取断面
+    List<EmsProdplanRound> getdimension();
+    //获取表面质量标准
+    List<EmsProdplanRound> getsurfaceStandard();
 }

+ 39 - 2
src/main/java/com/steerinfo/ems/emsprodplanround/mapper/EmsProdplanRoundMapper.xml

@@ -57,7 +57,7 @@
         and ID = #{id}
       </if>
       <if test="may != null">
-        and  trunc(MAY) = to_date(#{may},'yyyy-mm')
+        and  trunc(MAY) = to_date(#{may},'yyyy-mm-dd')
       </if>
       <if test="sqno != null and sqno != ''">
         and SQNO = #{sqno}
@@ -125,6 +125,7 @@
       <if test="parentid != null and parentid != '' ">
         and PARENTID = #{parentid}
       </if>
+      ORDER BY CREATETIME DESC
     </where>
   </sql>
   <sql id="whereLike">
@@ -701,7 +702,7 @@
         and t.parentid = #{parentid}
        </if>
        <if test="may != null ">
-         and   trunc(t.may) = to_date(#{may},'yyyy-mm')
+         and   trunc(t.may) = to_date(#{may},'yyyy-mm-dd')
        </if>
      </where>
   </select>
@@ -711,4 +712,40 @@
        #{id}
      </foreach>
   </select>
+  <select id="getMaxidAsGm" parameterType="com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound" resultType="java.lang.String">
+      select #{parentid} || '-' || to_char(nvl(max(substr(ID, 18, 2) + 1), 1),'fm00') as id
+      from ems_prodplan_round
+      where
+      parentid = #{parentid}
+      AND ID like
+      '%'||(SELECT  'G-' || substr(#{parentid}, 3) FROM dual)||'%'
+  </select>
+  <select id="getMaxidAsSC" parameterType="com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound" resultType="java.lang.String">
+    SELECT 'N-' || substr(#{parentid}, 3) ||'-'||
+         to_char(nvl(max(substr(ID, 18, 2) + 1), 1),'fm00') AS ID
+    FROM ems_prodplan_round
+    where
+    ID LIKE
+    '%'||(SELECT  'N-' || substr(#{parentid}, 3) FROM dual )||'%'
+  </select>
+  <select id="getlengthTimesWidth" resultMap="BaseResultMap">
+       select distinct LENGTH_TIMES_WIDTH from ems_prodplan_round
+           where LENGTH_TIMES_WIDTH not like '%null%'
+  </select>
+  <!---->
+  <select id="getiateralArea" resultMap="BaseResultMap">
+    select distinct IATERAL_AREA from ems_prodplan_round
+           where IATERAL_AREA not like '%null%'
+  </select>
+  <!---->
+  <select id="getdimension" resultMap="BaseResultMap">
+    select distinct dimension from ems_prodplan_round
+           where dimension not like '%null%'
+  </select>
+  <!---->
+  <select id="getsurfaceStandard" resultMap="BaseResultMap">
+    select distinct SURFACE_STANDARD
+             from ems_prodplan_round
+            where SURFACE_STANDARD not like '%null%'
+  </select>
 </mapper>

+ 12 - 3
src/main/java/com/steerinfo/ems/emsprodplanround/model/EmsProdplanRound.java

@@ -20,7 +20,7 @@ public class EmsProdplanRound implements IBasePO<String> {
      * 月份(MAY,TIMESTAMP,7)
      */
     @ApiModelProperty(value="月份",required=false)
-    @JSONField(format = "yyyy-MM")
+    @JSONField(format = "yyyy-MM-dd")
     private Date may;
 
     /**
@@ -143,6 +143,15 @@ public class EmsProdplanRound implements IBasePO<String> {
     @ApiModelProperty(value="I:Insert;U:Update;D:Delete ",required=true)
     private String msgFlag;
 
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    private String type;
     /**
      * N:未读;Y已读(READ_FLAG,VARCHAR,20)
      */
@@ -155,10 +164,10 @@ public class EmsProdplanRound implements IBasePO<String> {
     public String getParentid() {
         return parentid;
     }
-    @ApiModelProperty(value = "高度乘以宽度",required = true)
+    @ApiModelProperty(value = "断面",required = true)
 
     private String iateralArea;
-    @ApiModelProperty(value = "断面",required = true)
+    @ApiModelProperty(value = "长度*宽度",required = true)
 
     private String lengthTimesWidth;
     @ApiModelProperty(value = "截面尺寸",required = true)

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

@@ -24,4 +24,17 @@ public interface IEmsProdplanRoundService extends IBaseService<EmsProdplanRound,
     EmsProdplanRound getbeyondWeight(HashMap<String,Object> parmas);
 
     EmsProdplanRound getSumPlanWeight(List ids);
+
+    //获取编号
+    String getMaxidAsGm(EmsProdplanRound emsProdplanRound);
+    //获取编号
+    String getMaxidAsSC(EmsProdplanRound emsProdplanRound);
+    //获取宽度*长度
+    List<EmsProdplanRound> getlengthTimesWidth();
+    //获取断面
+    List<EmsProdplanRound> getiateralArea();
+    //获取断面
+    List<EmsProdplanRound> getdimension();
+    //获取表面质量标准
+    List<EmsProdplanRound>getsurfaceStandard();
 }

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

@@ -45,4 +45,34 @@ public class EmsProdplanRoundServiceImpl extends BaseServiceImpl<EmsProdplanRoun
     public EmsProdplanRound getSumPlanWeight(List ids) {
         return emsProdplanRoundMapper.getSumPlanWeight(ids);
     }
+
+    @Override
+    public String getMaxidAsGm(EmsProdplanRound emsProdplanRound) {
+        return emsProdplanRoundMapper.getMaxidAsGm(emsProdplanRound);
+    }
+
+    @Override
+    public String getMaxidAsSC(EmsProdplanRound emsProdplanRound) {
+        return emsProdplanRoundMapper.getMaxidAsSC(emsProdplanRound);
+    }
+
+    @Override
+    public List<EmsProdplanRound> getlengthTimesWidth() {
+        return emsProdplanRoundMapper.getlengthTimesWidth();
+    }
+
+    @Override
+    public List<EmsProdplanRound> getiateralArea() {
+        return emsProdplanRoundMapper.getiateralArea();
+    }
+
+    @Override
+    public List<EmsProdplanRound> getdimension() {
+        return emsProdplanRoundMapper.getdimension();
+    }
+
+    @Override
+    public List<EmsProdplanRound> getsurfaceStandard() {
+        return emsProdplanRoundMapper.getsurfaceStandard();
+    }
 }

+ 1 - 1
src/main/java/com/steerinfo/ems/tcm0325/controller/TCm0325Controller.java

@@ -97,7 +97,7 @@ public class TCm0325Controller extends BaseRESTfulController {
     @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
     @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
     //@RequiresPermissions("trmunit:delete")
-    @DeleteMapping(produces  = "application/json;charset=UTF-8")
+    @DeleteMapping( produces  = "application/json;charset=UTF-8")//String
     public RESTfulResult delete(@RequestBody TCm0325[] models){
         for (TCm0325 model : models) {
             tCm0325Mapper.deleteByPrimaryKey(model.getPowercode());

+ 0 - 1
src/main/java/com/steerinfo/feigen/model/LgWeight.java

@@ -10,7 +10,6 @@ public class LgWeight {
     public String getId() {
         return id;
     }
-
     public void setId(String id) {
         this.id = id == null ? null : id.trim();
     }

+ 1 - 1
src/main/java/com/steerinfo/feigen/service/BfhydFeigenService.java

@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
 
 import java.util.List;
 
-@FeignClient(value = "xt-ems-datasource")
+@FeignClient(value = "xt-ems-datasource",url = "192.168.3.145:8888")
 @Component
 public interface BfhydFeigenService {
     @GetMapping("v1/bfhyds/getAll")

+ 1 - 2
src/main/java/com/steerinfo/feigen/service/LgWeightFeigenService.java

@@ -12,10 +12,9 @@ import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
-@FeignClient(value = "xt-ems-datasource")
+@FeignClient(value = "xt-ems-datasource",url = "172.16.90.238:8888")
 @Component
 public interface LgWeightFeigenService {
-
     @GetMapping("v1/lgweight/queryWeightByTime")
     public List<LgWeight> QueryWeightByTime();
 

+ 7 - 7
src/main/resources/bootstrap.yml

@@ -9,12 +9,12 @@ spring:
     sampler:
       #默认值为0.1f,现在为了测试设置100%采集
       percentage: 1.0
-  cloud:
-    config:
-      fail-fast: true
-      discovery:
-        enabled: true
-        service-id: config-server
+#  cloud:
+#    config:
+#      fail-fast: true
+#      discovery:
+#        enabled: true
+#        service-id: config-server
     bus:
       trace:
        enabled: true
@@ -26,7 +26,7 @@ server:
 eureka:
   client:
     serviceUrl:
-      defaultZone: http://root:root@${EUREKA_HOST:localhost}:${EUREKA_PORT:8009}/eureka/
+      defaultZone: http://root:root@${EUREKA_HOST:172.16.90.238}:${EUREKA_PORT:8086}/eureka/
     metadata-map:
       cluster: ribbon
   instance: