增加http接口 pcn调用 用于将数据自动初始化到工位按钮表

tags/yfai-mes-ext-v2.4
王杰 6 months ago
parent 0c2edd3b55
commit 188284ab69

@ -256,6 +256,14 @@ public interface IProdExtOrgService {
@ApiOperation(value = "更新工位参数配置状态(启用、禁用)")
int updateMesWorkCellParamCfgStatusById(Long id, int status, String userName);
/**
*
* @param organizeCode
* @param id
*/
@ApiOperation(value = "新增工位按钮")
void insertWorkCellModuleByCfg(String organizeCode, String id);
/*************MES工位参数配置服务*****end***********/
}

@ -7,6 +7,7 @@ import cn.estsh.i3plus.ext.mes.api.busi.IEquipmentExtService;
import cn.estsh.i3plus.ext.mes.api.busi.IProdExtOrgService;
import cn.estsh.i3plus.ext.mes.apiservice.config.AuthUtilExt;
import cn.estsh.i3plus.ext.mes.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
import cn.estsh.i3plus.mes.apiservice.util.MesCommConstWords;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
@ -16,7 +17,10 @@ import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.MesEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
import cn.estsh.i3plus.pojo.mes.bean.*;
import cn.estsh.i3plus.pojo.mes.bean.MesArea;
import cn.estsh.i3plus.pojo.mes.bean.MesWcEquipment;
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell;
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCenter;
import cn.estsh.i3plus.pojo.mes.model.ProdOrgExtModel;
import cn.estsh.impp.framework.base.controller.MesBaseController;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
@ -30,9 +34,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @Description:
@ -388,4 +394,17 @@ public class ExtProdOrgController extends MesBaseController {
}
}
@PostMapping(value = "/work-cell-module/by-cfg/inset")
@ApiOperation(value = "根据配置新增工位按钮")
public ResultBean insertWorkCellModuleByCfg(@RequestBody Map<String, Object> params) {
try {
if (!CollectionUtils.isEmpty(params)) prodOrgService.insertWorkCellModuleByCfg((String) params.get(MesExtConstWords.ORGANIZE_CODE), (String) params.get(MesExtConstWords.ID));
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException busExcep) {
return ResultBean.fail(busExcep);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
}

@ -192,7 +192,7 @@ public class ProdExtOrgService implements IProdExtOrgService {
.build();
}
workCell.setGrade(prodOrgModel.getGrade());
insertWorkCellModule(workCell);
insertWorkCellModuleByCfg(workCell, workCell.getModifyUser());
return workCellRepository.insert(workCell);
}
return null;
@ -406,7 +406,7 @@ public class ProdExtOrgService implements IProdExtOrgService {
ConvertBean.serviceModelUpdate(workCell, AuthUtil.getSessionUser().getUserName());
insertWorkCellModule(workCell);
insertWorkCellModuleByCfg(workCell, workCell.getModifyUser());
return workCellRepository.save(workCell);
}
@ -595,7 +595,14 @@ public class ProdExtOrgService implements IProdExtOrgService {
new Object[]{status, userName, TimeTool.getNowTime(true)});
}
private void insertWorkCellModule(MesWorkCell workCell) {
@Override
public void insertWorkCellModuleByCfg(String organizeCode, String id) {
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(id)) return;
insertWorkCellModuleByCfg(workCellRepository.getById(Long.valueOf(id)), "系统");
}
private void insertWorkCellModuleByCfg(MesWorkCell workCell, String userInfo) {
if (null == workCell) return;
if (StringUtils.isEmpty(workCell.getGrade()) || workCell.getGrade().compareTo(MesExtEnumUtil.WORK_CELL_GRADE.SCAN.getValue()) != 0) return;
List<MesWorkCellModule> workCellModuleList = getWorkCellModuleButtonList(workCell.getOrganizeCode(), workCell.getWorkCenterCode(), workCell.getWorkCellCode());
if (!CollectionUtils.isEmpty(workCellModuleList)) return;
@ -606,6 +613,7 @@ public class ProdExtOrgService implements IProdExtOrgService {
MesWorkCellModule workCellModule = new MesWorkCellModule();
BeanUtils.copyProperties(workCell, workCellModule, MesExtConstWords.ID);
workCellModule.setModuleCode(workModule.getModuleCode());
ConvertBean.serviceModelInitialize(workCellModule, userInfo);
workCellModuleRepository.insert(workCellModule);
}
}

Loading…
Cancel
Save