**1、增加本地化语言**
项目下找到 Localization / xxxxx-zh-CN.xml

**2、增加权限常量**
项目下 Providers / xxxPermissionsNames.cs
~~~
public const string ProductionPlan_aa = "Pages.ProductionPlan.aa";
~~~
**3、增加权限**
项目下 Providers / xxxAuthorizationProvider.cs

~~~
var aa = pProductionPlan.CreateChildPermission(CPSProductionPlanPermissionsNames.ProductionPlan_aa, L("aa"), permissionType: PermissionType.MES);
~~~
**4、增加菜单显示**
项目下 Providers / xxxxNavigationProvider.cs

~~~
context.Manager.MainMenu
.AddItem(new MenuItemDefinition(
CPSProductionPlanNavigationNames.Common.ProductionPlan,
L("ProductionPlan"),
icon: "fa fa-calendar-check-o",
requiredPermissionName: CPSProductionPlanPermissionsNames.ProductionPlan
)
// 菜单
.AddItem(new MenuItemDefinition(
CPSProductionPlanNavigationNames.MES.MOManagement,
L("aa"),
icon: "fa fa-file-text-o",
url:"aa",
requiredPermissionName: CPSProductionPlanPermissionsNames.ProductionPlan_aa
))
);
~~~
**5、添加后台接口文件**
IaaAppService.c
~~~
using Abp.Application.Services;
using Abp.Application.Services.Dto;
using JuQent.CPS.Modules.ProductionPlan.Dto;
using JuQent.CPS.Modules.ProductionPlan.SubModules.MES.WIP.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JuQent.CPS.Modules.ProductionPlan.SubModules.MES.WIP
{
public interface IaaAppService : IApplicationService
{
/// <summary>
/// 获取批次、派工工单分页列表信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<PagedResultDto<SimulationReportDto>> GetSimulationReportPage(SimulationReportInput input);
/// <summary>
/// 获取批次、派工工单列表信息 (暂定100行)
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<List<SimulationReportDto>> GetSimulationReportList(SimulationReportInput input);
/// <summary>
/// 获取派工工单详情
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<SimulationReportDto> GetSimulationReport(SimulationReportInput input);
}
}
~~~
aaAppService.cs
~~~
using Abp.Application.Services.Dto;
using Abp.Domain.Repositories;
using JuQent.CPS.Domain;
using JuQent.CPS.Modules.ProductionPlan.Dto;
using JuQent.CPS.Modules.ProductionPlan.SubModules.MES.WIP.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Abp.Linq.Extensions;
using System.Data;
using System.Data.Entity;
using Abp.Extensions;
using System.Linq.Dynamic;
using Abp.AutoMapper;
using Abp.UI;
namespace JuQent.CPS.Modules.ProductionPlan.SubModules.MES.WIP
{
/// <summary>
/// 派工工单、批次号表
/// 主要用于单表查询
/// 只放一两个 IRepository 这样速度会快些
/// </summary>
public class aaAppService : CPSProductionPlanServiceBase, IaaAppService
{
public IRepository<SimulationReport, long> _simulationReportRepository { get; set; }
public async Task<SimulationReportDto> GetSimulationReport(SimulationReportInput input)
{
IQueryable<SimulationReport> nQuery = GetQuery(input);
SimulationReport simulationReport = nQuery.FirstOrDefault();
if (simulationReport == null) {
throw new UserFriendlyException("没有找到对象!");
}
return simulationReport.MapTo<SimulationReportDto>();
}
public async Task<List<SimulationReportDto>> GetSimulationReportList(SimulationReportInput input)
{
IQueryable<SimulationReport> nQuery = GetQuery(input);
List<SimulationReport> list = nQuery
.OrderByDescending(t=>t.LastModificationTime)
.Take(100)
.ToList();
if (list == null)
{
throw new UserFriendlyException("没有找到对象!");
}
return list.MapTo<List<SimulationReportDto>>();
}
public async Task<PagedResultDto<SimulationReportDto>> GetSimulationReportPage(SimulationReportInput input)
{
IQueryable<SimulationReport> nQuery = GetQuery(input);
var nCount = await nQuery.CountAsync();
input.Sorting = input.Sorting.IsNullOrEmpty() ? "LastModificationTime" : input.Sorting;
var results = await nQuery
.AsNoTracking()
.OrderBy(input.Sorting)
.PageBy(input)
.ToListAsync();
return new PagedResultDto<SimulationReportDto>(nCount, results.MapTo<List<SimulationReportDto>>());
}
private IQueryable<SimulationReport> GetQuery(SimulationReportInput input)
{
var nQuery = from m in _simulationReportRepository.GetAll()
select m;
nQuery = nQuery.WhereIf(!input.MoCode.IsEmptyOrNull(),t=>t.MOCode.StartsWith(input.MoCode));
nQuery = nQuery.WhereIf(!input.LotNumber.IsEmptyOrNull(), t => t.LotNumber.StartsWith(input.LotNumber));
nQuery = nQuery.WhereIf(!input.RCard.IsEmptyOrNull(), t => t.RCard.StartsWith(input.RCard));
nQuery = nQuery.WhereIf(!input.ItemCode.IsEmptyOrNull(), t => t.ItemCode.StartsWith(input.ItemCode));
nQuery = nQuery.WhereIf(!input.ProcessCode.IsEmptyOrNull(), t => t.ProcessCode.StartsWith(input.ProcessCode));
nQuery = nQuery.WhereIf(!input.ProcessName.IsEmptyOrNull(), t => t.ProcessName.StartsWith(input.ProcessName));
nQuery = nQuery.WhereIf(!input.ProductionLineCode.IsEmptyOrNull(), t => t.ProductionLineCode.StartsWith(input.ProductionLineCode));
nQuery = nQuery.WhereIf(!input.EquipCode.IsEmptyOrNull(), t => t.EquipCode.StartsWith(input.EquipCode));
//nQuery = nQuery.WhereIf(input.CreationStartDate != default(DateTime) && input.CreationEndDate != default(DateTime), t => t.MO.CreationTime >= input.CreationStartDate && t.MO.CreationTime <= input.CreationEndDate);
//nQuery = nQuery.WhereIf(input.DownStartDate != default(DateTime) && input.DownEndDate != default(DateTime), t => t.MO.MODownDate != null && t.MO.MODownDate >= input.DownStartDate && t.MO.MODownDate <= input.DownEndDate);
return nQuery;
}
}
}
~~~
**6、菜单添加文件关联**
routes.js 文件中添加
~~~
$stateProvider.state('aa', {//权限
url: '/aa',
templateUrl: '/App/ProductionPlan/views/MES/aa/index.cshtml',
controller: "productionPlan.views.aa.index",
resolve: {
deps: [
"$ocLazyLoad",
function ($ocLazyLoad) {
return $ocLazyLoad.load({
serie: true,
insertBefore: "#ng_load_plugins_before",
files: [
"/App/common/views/common/selectModal.js?v=" + $.CPS.vtime,
"/App/ProductionPlan/views/MES/aa/index.js?v=" + $.CPS.vtime,
]
});
}
]
}
});
~~~
**7、添加 html页面**
路径 /App/ProductionPlan/views/MES/aa/index.cshtml
~~~
@using JuQent.CPS.Localization
<div ng-controller="productionPlan.views.aa.index as vm" ng-init="vm.init();">
<!--Query Area-->
<div class="row margin-top-10">
<div class="col-md-12">
<div class="panel-heading margin-bottom-10 padding-bottom-0" style="padding-top:15px;">
<div class="form-body">
<form class="form-horizontal form-widgets" id="queryForm">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label class="control-label col-md-4">批次号</label>
<div class="col-md-8">
<input type="text" id="lotNumber" class="form-control" ng-model="vm.requestParams.lotNumber" />
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="control-label col-md-4">@Ls("CPSProductionPlan", "MoCode")</label>
<div class="col-md-8">
<input type="text" id="moCode" class="form-control" ng-model="vm.requestParams.moCode" />
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="control-label col-md-4">物料编码</label>
<div class="col-md-8">
<input type="text" id="materialCode" class="form-control" ng-model="vm.requestParams.materialCode" />
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label class="control-label col-md-4">流转码</label>
<div class="col-md-8">
<input type="text" id="rCard" class="form-control" ng-model="vm.requestParams.rCard" />
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="control-label col-md-4">工序号</label>
<div class="col-md-8">
<input type="text" id="processCode" class="form-control" ng-model="vm.requestParams.processCode" />
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!--ToolBar Area-->
<div class="row">
<div class="col-md-12">
<div class="table-toolbar margin-bottom-10">
<div class="row light">
<div class="col-xs-6 text-left">
</div>
<div class="col-xs-6 text-right">
<button id="reset" class="btn btn-sm blue" ng-click="vm.resetConditions();"><i class="fa fa-eraser"></i>@Ls("CPSProductionPlan", "ResetCondition")</button>
<button id="reflesh" class="btn btn-sm blue" ng-click="vm.reflesh();"><i class="fa fa-search"></i> @Ls("CPSProductionPlan", "Refresh")</button>
</div>
</div>
</div>
</div>
</div>
<!--Grid Ara-->
<div class="row">
<div class="col-md-12">
<div id="MyGrid" kendo-grid k-options="vm.GridOptions"></div>
</div>
</div>
<!--Context Menu-->
<div class="context-menu">
<ul class="dropdown-menu">
</ul>
</div>
</div>
~~~
**8、添加js**
路径 : /App/ProductionPlan/views/MES/aa/index.js
~~~
angular.module('app').controller('productionPlan.views.aa.index', [
'$scope', '$uibModal', 'abp.services.productionplan.aa',
function ($scope, $uibModal, aaService) {
var vm = this;
$scope.$on('$viewContentLoaded', function () {
App.initAjax();
});
//Variables
vm.loading = false;
vm.dataItem = null;
vm.requestParams = {
moCode: '',
lotNumber: '',
rCard: '',
processCode: '',
materialCode:''
};
vm.permissions = {
};
//Init DataGrid
vm.filterMethod = function (e) {
var filterGroup = new $.CPS.filter.Group();
if (filterGroup.Rules.length > 0 || filterGroup.Groups.length > 0) {
return filterGroup;
}
return null;
};
vm.fieldReplaceMethod = function (field) {
var replacedStr = "";
switch (field) {
default:
replacedStr = field;
}
return replacedStr;
};
vm.extraParamsMethod = function (e) {
var parameter = {
mOCode: vm.requestParams.moCode,
lotNumber: vm.requestParams.lotNumber,
rCard: vm.requestParams.rCard,
processCode: vm.requestParams.processCode,
itemCode: vm.requestParams.materialCode,
};
return $.extend({}, parameter)
}
vm.dataBoundMethod = function (e) {
//Add button click event
$(".gAction").on("click", function (e) {
e.stopPropagation();
//clicked button
var obj = $(this);
//获取菜单列表数据
var uid = obj.closest("tr").attr("data-uid");
vm.dataItem = $('#MyGrid').data('kendoGrid').dataSource.getByUid(uid);
//强制刷新菜单列表
$scope.$apply();
//console.dir(vm.dataItem);
//显示菜单列表
obj.contextmenu('show', e);
});
_resizeGrid($("#MyGrid")); //GridVIewID 是列表控件id
};
vm.getColumns = function () {
var columns = [
{
title: '批次号',
field: 'lotNumber',
width: 120,
filterable: true,
sortable: true,
headerAttributes: { style: "text-align: center;" },
attributes: { style: 'text-align: center;' },
}, {
title: '最后修改时间',
field: 'lastModificationTime',
width: 150,
filterable: false,
sortable: false,
headerAttributes: { style: "text-align: center;" },
attributes: { style: 'text-align: center;' },
template: function (dataItem) {
if (!dataItem.lastModificationTime) {
return "";
}
return moment(dataItem.lastModificationTime).format('YYYY-MM-DD HH:mm:ss');
}
}
];
//columns.shift();
return columns;
};
//Functions
vm.resetConditions = function () {
//Clear AutoComplete
vm.requestParams.moCode = '';
//Clear grid Sorting and Filters
vm.kendoGrid.resetConditions();
};
vm.reflesh = function () {
vm.kendoGrid.reloadGrid();
};
//Init Functions
vm.moFieldReplaceMethod = function (field) {
var replacedStr = '';
switch (field) {
case "moCode":
replacedStr = "MOCode";
break;
default:
replacedStr = field;
}
return replacedStr;
};
vm.kendoGrid = new $.CPS.kendo.DataGrid();
vm.initForms = function () {
//Init Grid
vm.GridOptions = vm.kendoGrid.init({
id: 'MyGrid',
checkbox:false,
readMethod: aaService.getSimulationReportPage,
filterMethod: vm.filterMethod,
fieldReplaceMethod: vm.fieldReplaceMethod,
extraParamsMethod: vm.extraParamsMethod,
dataBoundMethod: vm.dataBoundMethod,
model: {
fields: {
}
},
columns: vm.getColumns()
});
};
vm.init = function () {
vm.initForms();
};
var _resizeGrid = function (_grid) {
var dataArea = _grid.find(".k-grid-content");
var bottomArea = _grid.find(".k-grid-pager");
var newHeight = $(document.body).height() - _grid.offset().top;
var diff = _grid.innerHeight() - dataArea.innerHeight();
_grid.height(newHeight - bottomArea.innerHeight());
dataArea.height(newHeight - diff - bottomArea.innerHeight());
};
}
]);
~~~
- 命名规范
- baseService类规范
- 类创建规范
- 函数方法创建规范
- Linq规范
- API规范
- 注释规范
- EF数据迁移操作
- 常规更新
- __MigrationHistory 表没了的情况处理
- __MigrationHistory 数据记录被删
- __MigrationHistory 记录和本地更新文件不匹配
- migrate工具做数据迁移
- 同步服务
- 配置
- 错误
- ORA-03115: 不支持的网络数据类型或表示法
- MES平板常用代码
- 栏目说明
- 异步线程
- 委托(模拟触发事件)
- 添加菜单
- 添加按钮
- GridVIew列表使用
- 配置文件读写
- 弹窗提示
- 消息列表控件
- API网络接口配置
- 设置扫描枪钩子
- ScanerHook 的扫码勾子写法
- 当前全局变量
- 定时器,关闭当前窗口
- 单例模式窗口
- 配置参数
- 输入框回车事件
- 修改GridView 指定行背景颜色
- 调用窗口页面
- form窗体继承
- 控件焦点
- 串口
- 自动选择可用串口
- CPS常用代码
- 栏目说明
- 系统管理(基础模块)
- 基础数据(基础模块)
- 资料配置(基础模块)
- 质检管理
- 生产计划
- 库存交易单据(wms)
- Job 管理
- 设备管理
- 报表查询
- SMT查询
- EWI
- 消息推送服务
- 异步线程Task
- 创建权限
- 增删改查操作
- 修改
- 删除
- 添加
- 单个实体类查询
- 分页查询
- 列表查询
- 批量更新
- 发起HTTP请求
- 授权配置
- 文件上传(以excel导入为例)
- 获取当前目录的物理地址
- 使用GET的Query参数(http请求)
- 只传ID参数写法
- 关于前后端分离
- 前端
- 输入框自动大写
- 前端搜索列表页写法
- routes.js
- index.cshtml
- index.js
- 前端列表选择弹窗
- Grid高度自适应
- 弹窗提示
- 时间类型格式化
- 自动填充
- Grid控件多选处理
- 导出csv
- Grid锁定、冻结CheckBox
- 自定义弹出框写法
- 获取项目名词方法
- 获取当前路由信息
- 获取页面分页信息
- Grid 行详情写法
- EF 与 Dapper 同时使用方法
- EF查询扩展
- Dapper查询方式
- ISqlExecuter 查询方式
- 复杂业务处理方法(请求超时)
- 方法1:前端交互优化
- 方法2:后台任务
- 登录页面无法跳转,报错问题解决
- 重要接口
- 关于只传ID一个参数接口写法
- 添加一个单表查询、或简单页面
- 工序排序问题解决
- 数据库配置
- 工序序号排序
- 设置webconfig配置信息和使用
- 添加cookies
- 用户数据权限写法
- 字符串写法
- 日志打印
- 时间戳打印测试
- abp 依赖注入
- 编码转换
- TFS使用规范
- 申请授权
- 错误问题
- 平板提示“Object reference not ...”错误
- VS断点失效
- 对不起,在处理您的请求期间,产生了一个服务器内部错误
- 生成项目的时候没找到dll
- S2017 签名时出错: 未能对 bin\Debug\app.publish*.exe 签名。SignTool Error: No certificates were found
- CPS 提示“The build restored NuGet packages. Build the project again to include these packages in the build”
- 远程连接 报 CredSSP
- Linq 语句 “Unable to create a constant value of type 'System.Object'. ”
- 无法嵌入相互操作类
- Store update,insert,or delete statement affected
- 模块设计和打印功能
- 方式1:winform端标签模板
- 方式2:CPS网页标签模板
- 方式3:CPS打印Html网页内容
- index.cshtml
- index.js
- print.cshtml
- print.js
- CPS弹窗显示打印内容组件(JS)
- 打印代码
- AGV
- CPS端代码
- MES平板端代码
- 数据库表
- 区域类型
- EDI、WMS(U8反写)
- EDI数据库表
- WMS类型
- EDI类型
- CPS后台添加任务相关代码
- 采购到货
- 采购入库
- 领料出库(材料出库)
- 委外出库(材料出库)
- 生产工单出库(材料出库)
- 条码表
- 其他出库
- 销售出库
- 生产倒冲(材料出库)
- 执行任务(JuQuent.GoldServiceExportU8)
- 采购
- 产成品入库
- 材料出库
- SQL
- 规范语句模型
- 常用查询
- 优化案例
- Linq 转 string 输出
- 消息推送
- 基本架构
- 钉钉消息推送配置
- 微信消息推送配置
- 消息模板设置
- 接口
- 码云api
