abp(net core)+easyui+efcore实现仓储管理系统目录

abp(net core)+easyui+efcore实现仓储管理系统——EasyUI前端页面框架 (十八)

abp(net core)+easyui+efcore实现仓储管理系统——ABP WebAPI与EasyUI结合增删改查之八(三十四)

在上一篇abp(net core)+easyui+efcore实现仓储管理系统——入库管理之四(四十)文章中我们已经定义了应用的接口,并在应用层实现了这些接口。接下来我们要在展示层来实现前端功能。

八 创建InStockController继承自TPLMSControllerBase

1. 在Visual Studio 2017的“解决方案资源管理器”中,右键单击在领域层“ABP.TPLMS.Web.Mvc”项目中的Controller目录。 选择“添加” > “新建项…”。如下图。

2. 在弹出对话框“添加新项-ABP.TPLMS.Web.Mvc”中选择“控制器类”,然后在名称输入框中输入“InStockController”,然后点击“添加”按钮。

3.在InStockController.cs文件中输入如下代码,通过构造函数注入对应用服务的依赖。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Abp.Runtime.Validation;
using Abp.Web.Models;
using ABP.TPLMS.Controllers;
using ABP.TPLMS.Entitys;
using ABP.TPLMS.Helpers;
using ABP.TPLMS.InStocks;
using ABP.TPLMS.InStocks.Dto;
using ABP.TPLMS.Models.InStock;
using Microsoft.AspNetCore.Mvc; namespace ABP.TPLMS.Web.Controllers
{ public class InStockController : TPLMSControllerBase
{ private readonly IInStockOrderAppService _inSOAppService;
private readonly IInStockOrderDetailAppService _inSODAppService; private const int MAX_COUNT = ;
public InStockController(IInStockOrderAppService InSOAppService,IInStockOrderDetailAppService InSODAppService)
{ _inSOAppService = InSOAppService;
_inSODAppService = InSODAppService; } public IActionResult Index()
{ return View();
} [DontWrapResult]
[HttpPost]
public string List()
{ var page = Request.Form["page"].ToString();
var size = Request.Form["rows"].ToString();
int pageIndex = page == null ? : int.Parse(page);
int pageSize = size == null ? : int.Parse(size);
PagedInStockResultRequestDto paged = new PagedInStockResultRequestDto(); paged.MaxResultCount = MAX_COUNT;
paged.SkipCount = ((pageIndex - ) < ? : pageIndex - ) * pageSize;
paged.BeginTime = DateTime.Now.AddMonths(-);
paged.EndTime = DateTime.Now.AddDays();
var query = _inSOAppService.GetAll(paged).GetAwaiter().GetResult();
var isoList = query.Items; int total = query.TotalCount;
var json = JsonEasyUI(isoList, total); return json;
} [DontWrapResult]
public string GetDetail(string no)
{ PagedInStockDetailResultRequestDto paged = new PagedInStockDetailResultRequestDto();
paged.MaxResultCount = MAX_COUNT;
paged.InStockNo = no; var podList = _inSODAppService.GetAll(paged).GetAwaiter().GetResult().Items; ; var json = JsonEasyUI(podList);
return json; } [HttpPost]
[DisableValidation]
public ActionResult Add(InStockOrderDto iso)
{ string result = "NO";
try
{ PagedInStockResultRequestDto condition = new PagedInStockResultRequestDto();
condition.No = iso.No; var isoExists = _inSOAppService.GetAll(condition).GetAwaiter().GetResult();
if (isoExists.TotalCount > )
{
return Content(result);
} CreateUpdateInStockOrderDto cuIso = ObjectMapper.Map<CreateUpdateInStockOrderDto>(iso);
// TODO: Add logic here var obj= _inSOAppService.Create(cuIso);
result = "OK"; }
catch(Exception ex)
{
result = "NO";
}
return Content(result);
} [HttpPost]
[DisableValidation]
public string Update(InStockOrderDto iso)
{ string result = "NO";
List<InStockOrderDetailDto> list = new List<InStockOrderDetailDto>(); try { string deleted = Request.Form["deleted"];
string inserted = Request.Form["inserted"];
string updated = Request.Form["updated"];
string head = Request.Form["postdata"];
if (!string.IsNullOrEmpty(head))
{ //把json字符串转换成对象
iso = JsonHelper.Instance.Deserialize<InStockOrderDto>(head); } if (!string.IsNullOrEmpty(deleted))
{ //把json字符串转换成对象
List<InStockOrderDetailDto> listDeleted = JsonHelper.Instance.Deserialize<List<InStockOrderDetailDto>>(deleted); //TODO 下面就可以根据转换后的对象进行相应的操作了 if (listDeleted != null && listDeleted.Count > )
{ list.AddRange(listDeleted.ToArray());
}
} if (!string.IsNullOrEmpty(inserted))
{
//把json字符串转换成对象 List<InStockOrderDetailDto> listInserted = JsonHelper.Instance.Deserialize<List<InStockOrderDetailDto>>(inserted); if (listInserted != null && listInserted.Count > )
{ list.AddRange(listInserted.ToArray());
}
} if (!string.IsNullOrEmpty(updated))
{
//把json字符串转换成对象
List<InStockOrderDetailDto> listUpdated = JsonHelper.Instance.Deserialize<List<InStockOrderDetailDto>>(updated); if (listUpdated != null && listUpdated.Count > )
{
list.AddRange(listUpdated.ToArray()); }
} if (iso == null)
{
return "没有表头!";
}
// TODO: Add update logic here
iso.InStockOrderDetail = list;
result = _inSOAppService.Save(iso); }
catch
{
} if (result == "OK")
{
return "更新成功!";
}
else
return "更新失败!"; } [HttpPost]
[DisableValidation]
public ActionResult ImportCargo(CargoModel cargos)
{
string result = "NO";
try
{ // TODO: 导入货物信息
result = _inSOAppService.ImportCargo(cargos.Ids, cargos.No); }
catch
{ }
return Content(result);
} [HttpPost]
[DontWrapResult]
public ActionResult Delete(string ids)
{ string result = "NO";
try
{
// TODO: Add Delete logic here
bool flag = _inSOAppService.DeleteById(ids);
if (flag)
{
result = "OK";
}
}
catch
{
}
return Content(result); }
}
}

九、使用EasyUI创建入库单管理页面

1. 在Visual Studio 2017的“解决方案资源管理器”中,右键单击在领域层“ABP.TPLMS.Web.Mvc”项目中的Views目录。 选择“添加” > “新建文件夹”。并重命名为“InStock”。

2. 在Visual Studio 2017的“解决方案资源管理器”中,鼠标右键单击“InStock”文件夹,然后选择“添加” > “新建项…”。 在“添加新项-ABP.TPLMS.Web.Mvc”对话框中,选择“Razor视图”,并将名称命名为Index.cshmtl。如下图。

3. 在我们刚才创建的Index.cshmtl文件中,编写如下代码:

@using ABP.TPLMS.Web.Startup

@{

    ViewData["Title"] = PageNames.InStock;
} @section scripts{
<script src="~/view-resources/Views/InStock/Index.js" asp-append-version="true"></script> <script type="text/javascript">
$(function () { initable();
reloaded(); $('#box').tabs({
width: , //选项卡容器宽度
height: , //选项卡容器高度
onSelect: function (title, index) {
var rcv = $("#RcvUpdate").val();
if (title == "入库单明细") {
$("#rcv").val(rcv);
}
}
});
}); </script>
} <div data-options="region:'center'" style="overflow: hidden;">
<div id="containter" style="width: 1000px; height: auto; margin: 0px auto;">
<!--toolbar--> <div style="margin-bottom:1px;font-weight:bold;">
<a href="#" id="add" class="easyui-linkbutton" data-options="iconCls:'icon-add'" style="width:100px; height:30px; ">生成入库单</a>
<a href="#" id="del" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" style="width:100px; height:30px; ">删除</a>
<a href="#" id="edit" class="easyui-linkbutton" data-options="iconCls:'icon-edit'" style="width:100px; height:30px; ">修改</a>
<a href="#" id="submits" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" style="width:100px; height:30px; ">提交</a>
<a href="#" id="reload" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" style="width:100px; height:30px; ">刷新</a>
</div> <!--panel-->
<div data-options="region:'center',split:false" style="height:500px;"> <!--表格-->
<table id="dgINSO"></table>
</div>
</div>
</div>

4. 在Visual Studio 2017的“解决方案资源管理器”中,找到领域层“ABP.TPLMS.Web.Mvc”项目中的wwwroot目录下的view-resources目录。使用鼠标右键单击此目录,在弹出菜单中选择“添加” > “新建文件夹”。并重命名为“InStock”。

5. 在Visual Studio 2017的“解决方案资源管理器”中,鼠标右键单击“InStock”文件夹,然后选择“添加” > “新建项…”。 在“添加新项-ABP.TPLMS.Web.Mvc”对话框中,选择“javascript文件”,并将名称命名为Index.js。如下图。

6. 在Index.js文件中,我们写入如下代码。

//-----------------------系统管理-->入库单管理-----------------------------------------//
//刷新数据 function initable() {
$("#dgINSO").datagrid({
url: "/InStock/List",
//url:"api/services/app/instock/GetAllInStockOrders",
title: "入库单管理",
pagination: true,
pageSize: ,
pageList: [, , ],
fit: true,
fitColumns: false,
loadMsg: "正在加载入库单信息...", nowarp: false,
border: false, idField: "Id",
sortName: "Id",
sortOrder: "asc",
frozenColumns: [[//冻结列
{ field: "ck", checkbox: true, align: "left", width: } ]], columns: [[
{ title: "编号", field: "Id", width: , sortable: true },
{ title: "入库单号", field: "No", width: , sortable: true }, {title: "状态", field: "Status", width: },
{ title: '到货日期', field: 'ReceiveTime', width: , align: 'center' },
{ title: "货主", field: "OwnerCode", width: , sortable: true },
{ title: "预计到货时间", field: "PreDeliveryTime", width: , sortable: false }, { title: '客户', field: 'CustomerName', width: , align: 'center' }, { title: '收货人',field: 'Oper', width: , align: 'center' },
{ title: '审核人',field: 'Checker', width: , align: 'center' },
{ title: '件数', field: 'PackageNum', width: , align: 'center' },
{ title: '创建时间', field: 'CreationTime', width: , align: 'center' }
]]
});
} function reloaded() { //reload
$("#reload").click(function () {
//
$('#dgINSO').datagrid('reload'); });}

7. 在Visual Studio 2017中按F5运行应用程序。登录之后,点击“[入库管理]”菜单,我们可以看到货物管理列表页面。如下图。

abp(net core)+easyui+efcore实现仓储管理系统——入库管理之五(四十一)的更多相关文章

  1. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之六(四十二)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  2. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之七(四十三)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  3. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之八(四十四)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  4. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之四(四十)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  5. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之九(四十五)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  6. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之十(四十六)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  7. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之十一(四十七)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  8. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之十二(四十八)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  9. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之一(三十七)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

随机推荐

  1. python jQuery筛选器

    筛选器:$(this).next() 下一个    $(this).prev  上一个    $(this).parent()  父     $(this).children() 孩     $(th ...

  2. iOS中如何实现准确的倒计时程序 · 九十里

    iOS中倒计时程序,考虑线程暂停场景. iOS App进入后台时,GCD线程也会跟着暂停.当程序进入前台后,GCD线程恢复.因而倒计时程序需要考虑这一点,通过加入时间的比对来实现. + (void)c ...

  3. python ATM项目

    1.需求: 指定最大透支额度 可取款 定期还款(每月指定日期还款,如15号) 可存款 定期出账单 支持多用户登陆,用户间转帐 支持多用户 管理员可添加账户.指定用户额度.冻结用户等 购物车: 商品信息 ...

  4. linux系统文件被删的几种恢复方法

    参考链接:https://www.cnblogs.com/276815076/p/5703796.html 1.几种恢复方法,这里只是记录别的博客提到的方法,本人并未亲自验证. ext3用ext3gr ...

  5. ysoserial-调试分析总结篇(1)

    前言: ysoserial很强大,花时间好好研究研究其中的利用链对于了解java语言的一些特性很有帮助,也方便打好学习java安全的基础,刚学反序列化时就分析过commoncollections,但是 ...

  6. Ribbon进行服务调用/负载均衡以及请求重试配置

    Ribbon负载均衡 经过对Eureka的认识,及Eureka集群的搭建,已经基本可以入门Eureka的使用.之前对于服务调用者我们是直接获取注册列表后通过 get(0) 的方式来获取第一个注册信息. ...

  7. Jira字段配置最佳实践

    在我们创建Jira时,Jira上会填写各式各样的字段,不同的字段对于不同的角色人员,使用方式也是不同的,通过这篇文章,希望大家能够对Jira使用有更深刻的认识. 为什么需要严格规范? 易于开发,测试, ...

  8. 07.深入浅出 Spring Boot - 数据访问之Mybatis(附代码下载)

    MyBatis 在Spring Boot应用非常广,非常强大的一个半自动的ORM框架. 代码下载:https://github.com/Jackson0714/study-spring-boot.gi ...

  9. 7-19 计算有n个字符串中最长的字符串长度 (40 分)

    编写程序,用于计算有n(1<n<10)个字符串中最长的字符串的长度.前导空格不要计算在内! 输入格式: 在第一行中输入n,接下的每行输入一个字符串 输出格式: 在一行中输出最长的字符串的长 ...

  10. 手摸手教你在vue-cli里面使用vuex,以及vuex简介

    写在前面: 这篇文章是在vue-cli里面使用vuex的一个极简demo,附带一些vuex的简单介绍.有需要的朋友可以做一下参考,喜欢的可以点波赞,或者关注一下,希望可以帮到大家. 本文首发于我的个人 ...