|
@@ -1,8 +1,12 @@
|
|
|
package com.steerinfo.ems.emsprodplanround.controller;
|
|
|
|
|
|
import com.steerinfo.auth.utils.JwtUtil;
|
|
|
+import com.steerinfo.ems.Utils.DateUtils;
|
|
|
import com.steerinfo.ems.emsgmpcjh.mapper.EmsGmPcJhMapper;
|
|
|
import com.steerinfo.ems.emsgmpcjh.model.EmsGmPcJh;
|
|
|
+import com.steerinfo.ems.emslog.mapper.EmsLogMapper;
|
|
|
+import com.steerinfo.ems.emslog.model.EmsLog;
|
|
|
+import com.steerinfo.ems.emslog.service.IEmsLogService;
|
|
|
import com.steerinfo.ems.emsprodplanmonth.mapper.EmsProdplanMonthMapper;
|
|
|
import com.steerinfo.ems.emsprodplanmonth.model.EmsProdplanMonth;
|
|
|
import com.steerinfo.ems.emsprodplanmonth.service.IEmsProdplanMonthService;
|
|
@@ -15,6 +19,7 @@ import com.steerinfo.framework.service.pagehelper.PageList;
|
|
|
import com.steerinfo.framework.utils.collection.ListUtils;
|
|
|
import com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound;
|
|
|
import com.steerinfo.ems.emsprodplanround.service.IEmsProdplanRoundService;
|
|
|
+import com.steerinfo.framework.utils.misc.IdGenerator;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -56,6 +61,10 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
|
|
|
EmsProdplanRoundMapper emsProdplanRoundMapper;
|
|
|
@Autowired
|
|
|
IEmsProdplanMonthService emsProdplanMonthService;
|
|
|
+ @Autowired
|
|
|
+ IEmsLogService emsLogService;
|
|
|
+ @Autowired
|
|
|
+ IdGenerator idGenerator;
|
|
|
@ApiOperation(value="获取列表", notes="分页查询")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
|
|
@@ -87,18 +96,23 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
|
|
|
String userId = JwtUtil.getUseridByToken();
|
|
|
String maxid = null;
|
|
|
for (EmsProdplanRound model : models) {
|
|
|
+ if (model.getParentid() == null ){
|
|
|
+ return failed(null,"请点击选择左边计划!!!");
|
|
|
+ }
|
|
|
EmsGmPcJh emsGmPcJh = emsGmPcJhMapper.selectByPrimaryKey(model.getParentid());
|
|
|
if(emsGmPcJh.getState().equals("0")){
|
|
|
- return failed("排产计划编号为"+emsGmPcJh.getId()+"做了取消下发操作,无法做新增操作");
|
|
|
+ return failed(null,"排产计划编号为"+emsGmPcJh.getId()+"做了取消下发操作,无法做新增操作");
|
|
|
}
|
|
|
if(model.getWorkprocType() == null || model.getWorkprocType().equals("")){
|
|
|
return failed(null,"工序或者时间为空");
|
|
|
}
|
|
|
if (model.getParentid().substring(0,1).equals("G")){
|
|
|
maxid = emsProdplanRoundService.getMaxidAsGm(model);
|
|
|
+ model.setAscription("0");
|
|
|
}
|
|
|
else {
|
|
|
maxid = emsProdplanRoundService.getMaxidAsSC(model);
|
|
|
+ model.setAscription("1");
|
|
|
}
|
|
|
model.setId(maxid);
|
|
|
model.setPlanWeight(model.getPlanWeight());
|
|
@@ -172,6 +186,32 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
|
|
|
return success();
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的emsProdplanRound信息来更新详细信息")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "emsProdplanRound", value = "详细实体emsProdplanRound", required = true, dataType = "EmsProdplanRound")
|
|
|
+ })
|
|
|
+ //@RequiresPermissions("emsprodplanround:update")
|
|
|
+ @PutMapping(value = "ForcedUpdate", produces = "application/json;charset=UTF-8")
|
|
|
+ public RESTfulResult ForcedUpdate(@RequestBody EmsProdplanRound[] models) {
|
|
|
+ String userId = JwtUtil.getUseridByToken();
|
|
|
+ EmsLog emsLog = new EmsLog();
|
|
|
+ for (int i = 0; i < models.length; i++) {
|
|
|
+ EmsProdplanRound model = models[i];
|
|
|
+ model.setUpdateman(userId);
|
|
|
+ model.setUpdatetime(new Date());
|
|
|
+ String str = "{修改前的数据为:"+emsProdplanRoundMapper.selectByPrimaryKey(model.getId())+"修改后的数据为:"+model+"}";
|
|
|
+ emsProdplanRoundMapper.updateByPrimaryKey(model);
|
|
|
+ emsLog.setCode(str);
|
|
|
+ emsLog.setOperator(userId);
|
|
|
+ emsLog.setUpdatetable("ems_prodplan_round");
|
|
|
+ emsLog.setOperatortime(new Date());
|
|
|
+ emsLog.setId(idGenerator.getNextStr());
|
|
|
+ emsLogService.add(emsLog);
|
|
|
+ }
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value="删除", notes="根据url的id来指定删除对象")
|
|
|
@ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
|
|
|
//@RequiresPermissions("emsprodplanround:delete")
|
|
@@ -288,19 +328,6 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
|
|
|
}
|
|
|
|
|
|
public void updateNbjh(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());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //如果是外部计划 则判断有没有轮次计划 做修改操作
|
|
|
- if (emsProdplanRound.getId().substring(0,1).equals("G")) {
|
|
|
if (emsProdplanRound.getParentid() != null || !emsProdplanRound.getParentid().equals("")) {
|
|
|
Map<String,Object> map = new HashMap();
|
|
|
map.put("parentid",emsProdplanRound.getParentid());
|
|
@@ -311,7 +338,6 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
|
|
|
emsGmPcJhMapper.updateByPrimaryKeySelective(emsGmPcJh);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -388,4 +414,10 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
|
|
|
}
|
|
|
return failed();
|
|
|
}
|
|
|
+ @GetMapping("getstdchem")
|
|
|
+ public RESTfulResult getstdchem(){
|
|
|
+ List<EmsProdplanRound> emsProdplanRounds = emsProdplanRoundService.getchemicalStandard();
|
|
|
+ return success(emsProdplanRounds);
|
|
|
+ }
|
|
|
+
|
|
|
}
|