基础主数据开

tags/yfai-mes-ext-v1.0
zhang.xw 1 year ago
parent 5578becfaa
commit dd2400800f

@ -152,7 +152,7 @@ public abstract class BaseMesController<T extends BaseBean> extends BaseControll
@ApiOperation(value = "查询信息带分页", notes = "组合查询,外带分页功能")
public ResultBean<T> queryByPager(T bean, Pager pager) {
try {
bean.setOrganizeCode("1154");
bean.setOrganizeCode(AuthUtilExt.getOrganizeCode());
ListPager<T> listPager = getBaseService().queryPager(bean, pager);
return ResultBean.success("操作成功")
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode())
@ -203,7 +203,7 @@ public abstract class BaseMesController<T extends BaseBean> extends BaseControll
try {
validateInsert(bean);
//新增初始化
bean.setOrganizeCode("1154");
bean.setOrganizeCode(AuthUtilExt.getOrganizeCode());
ConvertBean.serviceModelInitialize(bean, "zxw");
T t = (T) getBaseService().insert(bean);
afterInsert(t);
@ -221,7 +221,7 @@ public abstract class BaseMesController<T extends BaseBean> extends BaseControll
@ApiOperation(value = "修改信息", notes = "修改信息")
public ResultBean<T> update(@RequestBody T bean) {
try {
bean.setOrganizeCode("1154");
bean.setOrganizeCode(AuthUtilExt.getOrganizeCode());
validateUpdate(bean);
T t = getBaseService().update(bean);
afterUpdate(t);

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

@ -291,7 +291,44 @@ public class MesExtEnumUtil {
return this.description;
}
}
/**
*
*/
@JsonFormat(
shape = JsonFormat.Shape.OBJECT
)
public static enum SECOND_CATEGORY {
SECOND_CATEGORY_10(10, "物理设备"),
SECOND_CATEGORY_20(20, "虚拟设备");
private int value;
private String description;
private SECOND_CATEGORY(int value, String description) {
this.value = value;
this.description = description;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; ++i) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
public int getValue() {
return this.value;
}
public String getDescription() {
return this.description;
}
}
/**
* -
*/
@ -1207,6 +1244,203 @@ public class MesExtEnumUtil {
return this.description;
}
}
/**
* 线
*/
@JsonFormat(
shape = JsonFormat.Shape.OBJECT
)
public static enum LINE_TYPE {
LINE_TYPE_10(10, "排序产线"),
LINE_TYPE_20(20, "非排序产线");
private int value;
private String description;
private LINE_TYPE(int value, String description) {
this.value = value;
this.description = description;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; ++i) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
public int getValue() {
return this.value;
}
public String getDescription() {
return this.description;
}
}
/**
*
*/
@JsonFormat(
shape = JsonFormat.Shape.OBJECT
)
public static enum GENERATE_STATUS {
GENERATE_STATUS_10(10, "已发布"),
GENERATE_STATUS_20(20, "正在加工"),
GENERATE_STATUS_30(30, "未处理");
private int value;
private String description;
private GENERATE_STATUS(int value, String description) {
this.value = value;
this.description = description;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; ++i) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
public int getValue() {
return this.value;
}
public String getDescription() {
return this.description;
}
}
/**
*
*/
@JsonFormat(
shape = JsonFormat.Shape.OBJECT
)
public static enum CHECK_TYPE {
CHECK_TYPE_10(10, "无序"),
CHECK_TYPE_20(20, "柔性焊顺序"),
CHECK_TYPE_30(30, "零件号加工顺序"),
CHECK_TYPE_40(40, "工单顺序");
private int value;
private String description;
private CHECK_TYPE(int value, String description) {
this.value = value;
this.description = description;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; ++i) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
public int getValue() {
return this.value;
}
public String getDescription() {
return this.description;
}
}
/**
*
*/
@JsonFormat(
shape = JsonFormat.Shape.OBJECT
)
public static enum PUSH_TYPE {
PUSH_TYPE_10(10, "自动推送"),
PUSH_TYPE_20(20, "手动扫描");
private int value;
private String description;
private PUSH_TYPE(int value, String description) {
this.value = value;
this.description = description;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; ++i) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
public int getValue() {
return this.value;
}
public String getDescription() {
return this.description;
}
}
/**
*
*/
@JsonFormat(
shape = JsonFormat.Shape.OBJECT
)
public static enum SN_ENTER_TYPE {
SN_ENTER_TYPE_10(10, "扫描器带回车"),
SN_ENTER_TYPE_20(20, "条码带回车"),
SN_ENTER_TYPE_30(20, "条码自带回车");
private int value;
private String description;
private SN_ENTER_TYPE(int value, String description) {
this.value = value;
this.description = description;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; ++i) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
public int getValue() {
return this.value;
}
public String getDescription() {
return this.description;
}
}
}

Loading…
Cancel
Save