|
|
@ -1,5 +1,6 @@
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.controller.base;
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.controller.base;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.constant.MesCommonConstant;
|
|
|
|
import cn.estsh.i3plus.mes.api.iservice.base.IProdOrgService;
|
|
|
|
import cn.estsh.i3plus.mes.api.iservice.base.IProdOrgService;
|
|
|
|
import cn.estsh.i3plus.mes.api.iservice.busi.IEquipmentService;
|
|
|
|
import cn.estsh.i3plus.mes.api.iservice.busi.IEquipmentService;
|
|
|
|
import cn.estsh.i3plus.mes.apiservice.util.MesCommConstWords;
|
|
|
|
import cn.estsh.i3plus.mes.apiservice.util.MesCommConstWords;
|
|
|
@ -16,7 +17,7 @@ import cn.estsh.i3plus.pojo.mes.bean.MesArea;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipment;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipment;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCenter;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCenter;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.ProdOrgModel;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.ProdOrgExtModel;
|
|
|
|
import cn.estsh.impp.framework.base.controller.MesBaseController;
|
|
|
|
import cn.estsh.impp.framework.base.controller.MesBaseController;
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
@ -42,7 +43,7 @@ import java.util.List;
|
|
|
|
**/
|
|
|
|
**/
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
|
@Api("MES组织模型")
|
|
|
|
@Api("MES组织模型")
|
|
|
|
@RequestMapping(CommonConstWords.BASE_URL_MES + "/prod-org-new")
|
|
|
|
@RequestMapping(MesCommonConstant.MES_YANFEN + "/prod-org")
|
|
|
|
public class ExtProdOrgController extends MesBaseController {
|
|
|
|
public class ExtProdOrgController extends MesBaseController {
|
|
|
|
|
|
|
|
|
|
|
|
public static final Logger LOGGER = LoggerFactory.getLogger(ExtProdOrgController.class);
|
|
|
|
public static final Logger LOGGER = LoggerFactory.getLogger(ExtProdOrgController.class);
|
|
|
@ -68,43 +69,43 @@ public class ExtProdOrgController extends MesBaseController {
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/mes-prod/query")
|
|
|
|
@GetMapping(value = "/mes-prod/query")
|
|
|
|
@ApiOperation(value = "按条件分页查询MES组织模型数据")
|
|
|
|
@ApiOperation(value = "按条件分页查询MES组织模型数据")
|
|
|
|
public ResultBean queryMesProdOrgByPager(ProdOrgModel prodOrgModel, Pager pager) {
|
|
|
|
public ResultBean queryMesProdOrgByPager(ProdOrgExtModel ProdOrgExtModel, Pager pager) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
ListPager listPager = null;
|
|
|
|
ListPager listPager = null;
|
|
|
|
|
|
|
|
|
|
|
|
prodOrgModel.setOrganizeCode(AuthUtil.getOrganize().getOrganizeCode());
|
|
|
|
ProdOrgExtModel.setOrganizeCode(AuthUtil.getOrganize().getOrganizeCode());
|
|
|
|
//工厂
|
|
|
|
//工厂
|
|
|
|
if (MesEnumUtil.PROD_ORG_LEVEL.LEVEL_ONE.getValue() == prodOrgModel.getLevel()) {
|
|
|
|
if (MesEnumUtil.PROD_ORG_LEVEL.LEVEL_ONE.getValue() == ProdOrgExtModel.getLevel()) {
|
|
|
|
|
|
|
|
|
|
|
|
MesArea mesArea = new MesArea();
|
|
|
|
MesArea mesArea = new MesArea();
|
|
|
|
BeanUtils.copyProperties(prodOrgModel, mesArea);
|
|
|
|
BeanUtils.copyProperties(ProdOrgExtModel, mesArea);
|
|
|
|
|
|
|
|
|
|
|
|
listPager = prodOrgService.queryMesAreaByPager(mesArea, pager);
|
|
|
|
listPager = prodOrgService.queryMesAreaByPager(mesArea, pager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//生产线
|
|
|
|
//生产线
|
|
|
|
if (MesEnumUtil.PROD_ORG_LEVEL.LEVEL_TWO.getValue() == prodOrgModel.getLevel()) {
|
|
|
|
if (MesEnumUtil.PROD_ORG_LEVEL.LEVEL_TWO.getValue() == ProdOrgExtModel.getLevel()) {
|
|
|
|
|
|
|
|
|
|
|
|
MesWorkCenter workCenter = new MesWorkCenter();
|
|
|
|
MesWorkCenter workCenter = new MesWorkCenter();
|
|
|
|
BeanUtils.copyProperties(prodOrgModel, workCenter);
|
|
|
|
BeanUtils.copyProperties(ProdOrgExtModel, workCenter);
|
|
|
|
|
|
|
|
|
|
|
|
listPager = prodOrgService.queryWorkCenterByPager(workCenter, pager);
|
|
|
|
listPager = prodOrgService.queryWorkCenterByPager(workCenter, pager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//工位
|
|
|
|
//工位
|
|
|
|
if (MesEnumUtil.PROD_ORG_LEVEL.LEVEL_THREE.getValue() == prodOrgModel.getLevel()) {
|
|
|
|
if (MesEnumUtil.PROD_ORG_LEVEL.LEVEL_THREE.getValue() == ProdOrgExtModel.getLevel()) {
|
|
|
|
|
|
|
|
|
|
|
|
MesWorkCell workCell = new MesWorkCell();
|
|
|
|
MesWorkCell workCell = new MesWorkCell();
|
|
|
|
BeanUtils.copyProperties(prodOrgModel, workCell);
|
|
|
|
BeanUtils.copyProperties(ProdOrgExtModel, workCell);
|
|
|
|
|
|
|
|
|
|
|
|
listPager = prodOrgService.queryWorkCellByPager(workCell, pager);
|
|
|
|
listPager = prodOrgService.queryWorkCellByPager(workCell, pager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//工位下的设备
|
|
|
|
//工位下的设备
|
|
|
|
if (MesEnumUtil.PROD_ORG_LEVEL.LEVEL_FOUR.getValue() <= prodOrgModel.getLevel()) {
|
|
|
|
if (MesEnumUtil.PROD_ORG_LEVEL.LEVEL_FOUR.getValue() <= ProdOrgExtModel.getLevel()) {
|
|
|
|
|
|
|
|
|
|
|
|
MesEquipment equipment = new MesEquipment();
|
|
|
|
MesEquipment equipment = new MesEquipment();
|
|
|
|
//这是用到的参数有id 必须使用org.springframework.beans.BeanUtils
|
|
|
|
//这是用到的参数有id 必须使用org.springframework.beans.BeanUtils
|
|
|
|
//如果使用org.apache.commons.beanutils.BeanUtils当id为null会默认转化为0
|
|
|
|
//如果使用org.apache.commons.beanutils.BeanUtils当id为null会默认转化为0
|
|
|
|
BeanUtils.copyProperties(prodOrgModel, equipment);
|
|
|
|
BeanUtils.copyProperties(ProdOrgExtModel, equipment);
|
|
|
|
|
|
|
|
|
|
|
|
listPager = mesEquipmentService.queryMesEquipmentByPagerOrg(equipment, pager);
|
|
|
|
listPager = mesEquipmentService.queryMesEquipmentByPagerOrg(equipment, pager);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -125,13 +126,13 @@ public class ExtProdOrgController extends MesBaseController {
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping(value = "/mes-prod/insert")
|
|
|
|
@PostMapping(value = "/mes-prod/insert")
|
|
|
|
@ApiOperation(value = "新增mes组织模型信息(区域,生产线,工位)")
|
|
|
|
@ApiOperation(value = "新增mes组织模型信息(区域,生产线,工位)")
|
|
|
|
public ResultBean insertMesProdOrg(ProdOrgModel prodOrgModel) {
|
|
|
|
public ResultBean insertMesProdOrg(ProdOrgExtModel ProdOrgExtModel) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
prodOrgModel.setOrganizeCode(AuthUtil.getOrganize().getOrganizeCode());
|
|
|
|
ProdOrgExtModel.setOrganizeCode(AuthUtil.getOrganize().getOrganizeCode());
|
|
|
|
ConvertBean.serviceModelInitialize(prodOrgModel, AuthUtil.getSessionUser().getUserName());
|
|
|
|
ConvertBean.serviceModelInitialize(ProdOrgExtModel, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
|
|
|
|
|
|
|
prodOrgService.insertMesProdOrg(prodOrgModel);
|
|
|
|
prodOrgService.insertMesProdOrg(ProdOrgExtModel);
|
|
|
|
|
|
|
|
|
|
|
|
return ResultBean.success("添加成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
return ResultBean.success("添加成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|