abp(net core)+easyui+efcore实现仓储管理系统——供应商管理升级之上(六十三)

这篇具有很好参考价值的文章主要介绍了abp(net core)+easyui+efcore实现仓储管理系统——供应商管理升级之上(六十三)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

abp(net core)+easyui+efcore实现仓储管理系统目录
abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一)
abp(net core)+easyui+efcore实现仓储管理系统——解决方案介绍(二)
abp(net core)+easyui+efcore实现仓储管理系统——领域层创建实体(三)
 abp(net core)+easyui+efcore实现仓储管理系统——定义仓储并实现 (四)
abp(net core)+easyui+efcore实现仓储管理系统——创建应用服务(五)
abp(net core)+easyui+efcore实现仓储管理系统——使用 WEBAPI实现CURD (十一)
abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理一 (十九)
abp(net core)+easyui+efcore实现仓储管理系统——ABP WebAPI与EasyUI结合增删改查之一(二十七)
abp(net core)+easyui+efcore实现仓储管理系统——入库管理之一(三十七)
abp(net core)+easyui+efcore实现仓储管理系统——出库管理之一(四十九)
abp(net core)+easyui+efcore实现仓储管理系统——ABP升级7.3上(五十八)
 
 
    有了前面两篇关于升级的文章,组织管理和模块管理,并在升级过程中解决了一些升级中出现的问题。我们对供应商管理这个模块进行升级,这次的升级涉及到前端页面的一些问题。
 

1.在Visual Studio 2022的解决方案资源管理器中,选中“ABP.TPLMS.Web.Mvc”项目,然后单击鼠标右键,在弹出菜单中选中“设为启动项目”。按F5运行应用程序。

2.在浏览器将呈现登录页面,然后输入管理员用户名进行登录。浏览器跳转到首页面。如下图。

 abp(net core)+easyui+efcore实现仓储管理系统——供应商管理升级之上(六十三)

 

3.在主界面的菜单中,选择“Business->供应商管理”菜单项,浏览器立即报了一个错误。如下图。

abp(net core)+easyui+efcore实现仓储管理系统——供应商管理升级之上(六十三)

 

4.这是AutoMapper.Mapper方法造成的。这是由于在升级的时候,AutoMapper也升级了。由于NET模型映射器AutoMapper 9.0之后,官方宣称不再支持静态方法调用,之前直接升级编译报错无法使用。我简单的在代码的构造函数中使用注入方式,注入Mapper。现在实际运行时,发现这种方式,如果没有在startup.cs代码中预先注册,是无法使用的。原先的代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

using Abp.Application.Services.Dto;
using Abp.AspNetCore.Mvc.Authorization;
using Abp.Auditing;
using Abp.Runtime.Validation;
using ABP.TPLMS.Controllers;
using ABP.TPLMS.Suppliers;
using ABP.TPLMS.Suppliers.Dto;
using ABP.TPLMS.Web.Models.Supplier;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
 
// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
 
namespace ABP.TPLMS.Web.Controllers
{
    [AbpMvcAuthorize]
    [Audited]
    public class SupplierController : TPLMSControllerBase
    {
        const int MaxNum= 10;
        // GET: /<controller>/
        [DisableAuditing]
        public async Task<IActionResult> Index()
        {
 
            SupplierDto cuModule=null;

            var module = (await _supplierAppService.GetAllAsync(new PagedSupplierResultRequestDto { MaxResultCount = MaxNum })).Items; // Paging not implemented yet
            if (module.Count>0)
            {
                cuModule = module.First();
            }
           
            var model = new SupplierListViewModel
            {
                Supplier = cuModule,
                Suppliers=module
            };
          
            return View(model);
        }
 
        private readonly ISupplierAppService _supplierAppService;
        AutoMapper.Mapper m_map;

        public SupplierController(ISupplierAppService supplierAppService,AutoMapper.Mapper map)
        {
            _supplierAppService = supplierAppService;

            m_map = map;
        }

        public async Task<ActionResult> EditSupplierModal(int supplierId)
        {
           
            var module = await _supplierAppService.GetAsync(new EntityDto<int>(supplierId));
            CreateUpdateSupplierDto cuSupplier = m_map.Map<CreateUpdateSupplierDto>(module);

            var model = new EditSupplierModalViewModel
            {
                Supplier = cuSupplier
            };
            return View("_EditSupplierModal", model);
        }
    }
}

 

 5.幸好发现有一个ABP.ObjectMapper.Map方法可以使用,我们将代码修改为:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Abp.Application.Services.Dto;
using Abp.AspNetCore.Mvc.Authorization;
using Abp.Auditing;
using Abp.Runtime.Validation;
using ABP.TPLMS.Controllers;
using ABP.TPLMS.Suppliers;
using ABP.TPLMS.Suppliers.Dto;
using ABP.TPLMS.Web.Models.Supplier;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
 
// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
 
namespace ABP.TPLMS.Web.Controllers
{
    [AbpMvcAuthorize]
    [Audited]
    public class SupplierController : TPLMSControllerBase
    {
        const int MaxNum= 10;
        // GET: /<controller>/
        [DisableAuditing]
        public async Task<IActionResult> Index()
        {
 
            SupplierDto cuModule=null;

            var module = (await _supplierAppService.GetAllAsync(new PagedSupplierResultRequestDto { MaxResultCount = MaxNum })).Items; // Paging not implemented yet
            if (module.Count>0)
            {
                cuModule = module.First();
            }
           

            var model = new SupplierListViewModel
            {
                Supplier = cuModule,
                Suppliers=module
            };
          
            return View(model);
        }
 
        private readonly ISupplierAppService _supplierAppService;

        public SupplierController(ISupplierAppService supplierAppService)
        {
            _supplierAppService = supplierAppService;
           
        }

        public async Task<ActionResult> EditSupplierModal(int supplierId)
        {
            
            var module = await _supplierAppService.GetAsync(new EntityDto<int>(supplierId));

            CreateUpdateSupplierDto cuSupplier = ObjectMapper.Map<CreateUpdateSupplierDto>(module);
            var model = new EditSupplierModalViewModel
            {
                Supplier = cuSupplier
 
            };
           return View("_EditSupplierModal", model);

        }
}
}

 

6.在Visual Studio 2022的解决方案资源管理器,按F5运行应用程序。

7.在浏览器将呈现登录页面,然后输入管理员用户名进行登录。浏览器跳转到首页面,在主界面的菜单中,选择“Business->供应商管理”菜单项,浏览器中呈现一个供应商信息列表页面,我们发现此页面的顶部与右边的菜单部分缺失css,样式不好看。如下图。

abp(net core)+easyui+efcore实现仓储管理系统——供应商管理升级之上(六十三)

8. 在Visual Studio 2017的“解决方案资源管理器”中,右键单击在领域层“ABP.TPLMS.Web.Mvc”项目中的Views\Supplier目录。 找到Index.cshmtl文件,修改顶部的代码与按钮的代码。具体代码如下:

 

@using ABP.TPLMS.Web.Startup
@model ABP.TPLMS.Web.Models.Supplier.SupplierListViewModel
 

@{
    ViewData["Title"] = PageNames.Supplier;
}

@section scripts
    {
    <script src="~/view-resources/Views/Supplier/Index.js" asp-append-version="true"></script>

}
<section class="content-header">
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-6">
                <h1>@L("Supplier")</h1>
            </div>
            <div class="col-sm-4 text-sm-right">
                <a id="RefreshButton" href="javascript:void(0);"><i class="fas fa-redo-alt"></i></a>
            </div>
            <div class="col-sm-2">
                <button type="button" class="btn btn-primary btn-circle waves-effect waves-circle waves-float pull-right"
data-toggle="modal" data-target="#SupplierCreateModal"> <i class="fa fa-plus-square">Add</i> </button> </div> </div> </div> </section> <div class="row clearfix"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <div class="card"> <div class="body table-responsive"> <table class="table"> <thead> <tr> <th> @Html.DisplayNameFor(model => model.Supplier.Code) </th> <th> @Html.DisplayNameFor(model => model.Supplier.Name) </th> <th> @Html.DisplayNameFor(model => model.Supplier.LinkName) </th> <th> @Html.DisplayNameFor(model => model.Supplier.Mobile) </th> <th> @Html.DisplayNameFor(model => model.Supplier.Address) </th> <th> @Html.DisplayNameFor(model => model.Supplier.Tel) </th> <th> @Html.DisplayNameFor(model => model.Supplier.Status) </th> <th></th> </tr> </thead> <tbody> @foreach (var item in Model.Suppliers) { <tr> <td> @Html.DisplayFor(modelItem => item.Code) </td> <td> @Html.DisplayFor(modelItem => item.Name) </td> <td> @Html.DisplayFor(modelItem => item.LinkName) </td> <td> @Html.DisplayFor(modelItem => item.Mobile) </td> <td> @Html.DisplayFor(modelItem => item.Address) </td> <td> @Html.DisplayFor(modelItem => item.Tel) </td> <td> @Html.DisplayFor(modelItem => item.Status) </td> <td > <a href="#" class="btn btn-sm bg-secondary edit-supplier" data-supplier-id="@item.Id"
data-toggle
="modal" data-target="#SupplierEditModal"><i class="fas fa-pencil-alt"></i>@L("Edit")</a> <a href="#" class="btn btn-sm bg-danger delete-supplier" data-supplier-id="@item.Id"
data-supplier-name
="@item.Name"><i class="fas fa-trash"></i>@L("Delete")</a> </td> </tr> } </tbody> </table> </div> </div> </div> </div> <div class="modal fade" id="SupplierCreateModal" tabindex="-1" role="dialog" aria-labelledby="SupplierCreateModalLabel"
data-backdrop
="static"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title"> <span>@L("CreateNewSupplier")</span> </h4> </div> <div class="modal-body"> <form name="SupplierCreateForm" role="form" class="form-validation"> <div> <div class="row clearfix"> <div class="col-sm-6"> <div class="form-group form-float"> <div class="form-line"> <label asp-for="@Model.Supplier.Code" class="form-label"></label> <input type="text" name="Code" class="form-control" required maxlength="50" /> </div> </div> </div> <div class="col-sm-6"> <div class="form-group form-float"> <div class="form-line"> <label asp-for="@Model.Supplier.Name" class="form-label"></label> <input type="text" name="Name" class="form-control" required maxlength="50" /> </div> </div> </div> </div> <div class="row clearfix"> <div class="col-sm-12"> <div class="form-group form-float"> <div class="form-line"> <label asp-for="@Model.Supplier.Address" class="form-label"></label> <input type="text" name="Address" class="form-control" required maxlength="255" /> </div> </div> </div> </div> <div class="row clearfix"> <div class="col-sm-6"> <div class="form-group form-float"> <div class="form-line"> <label asp-for="@Model.Supplier.LinkName" class="form-label"></label> <input type="text" name="LinkName" class="form-control" /> </div> </div> </div> <div class="col-sm-6"> <div class="form-group form-float"> <div class="form-line"> <label asp-for="@Model.Supplier.Mobile" class="form-label"></label> <input type="text" name="Mobile" class="form-control" /> </div> </div> </div> </div> <div class="row clearfix"> <div class="col-sm-6"> <div class="form-group form-float"> <div class="form-line"> <label asp-for="@Model.Supplier.Tel" class="form-label"></label> <input type="text" name="Tel" class="form-control" required maxlength="255" /> </div> </div> </div> <div class="col-sm-6"> <div class="form-group form-float"> <div class="form-line"> <label asp-for="@Model.Supplier.Status" class="form-label"></label> <input type="text" name="Status" class="form-control" /> </div> </div> </div> </div> <div class="row clearfix"> <div class="col-sm-6"> <div class="form-line"> <label asp-for="@Model.Supplier.Sex"></label> <input name="Sex" type="text" class="form-control" /> </div> </div> <div class="col-sm-6"> <div class="form-line"> <label asp-for="@Model.Supplier.Email"></label> <input name="Email" type="text" class="form-control" /> </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default waves-effect" data-dismiss="modal">@L("Cancel")</button> <button type="submit" class="btn btn-primary waves-effect">@L("Save")</button> </div> </form> </div> </div> </div> </div> <div class="modal fade" id="SupplierEditModal" tabindex="-1" role="dialog" aria-labelledby="SupplierEditModalLabel"
data-backdrop
="static"> <div class="modal-dialog" role="document"> <div class="modal-content"> </div> </div> </div>

 文章来源地址https://www.toymoban.com/news/detail-433604.html

到了这里,关于abp(net core)+easyui+efcore实现仓储管理系统——供应商管理升级之上(六十三)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 一个基于.NET Core开源、跨平台的仓储管理系统

    今天给大家推荐一个基于.NET Core开源、跨平台的仓储管理系统,数据库支持MSSQL/MySQL:ZEQP.WMS。 仓储管理系统(Warehouse Management System,WMS)是一种用于管理和控制仓库操作的软件系统,它可以帮助企业实现对仓库内物品的跟踪、存储、拣选、包装和发运等全过程管理,提高仓

    2024年02月21日
    浏览(40)
  • ASP.Net Core Web Api+EFCore+MySql实现动态查询(保姆教学)

    本文会详细讲解如何从打开文件到第一个API开发完成,过程十分详细,是基于学习入门。 现在让我们开始吧! 打开VS(演示用的Visual Studio2022) 第一步我们选择创建新项目   第二步 选择开发语言以及应用程序 我们选择C# -所有平台-Web API.找到 ASP.NET Core Web API 应用   这里应用

    2024年02月12日
    浏览(28)
  • 基于Java企业仓储管理系统详细设计和实现

    博主介绍 : ✌ 全网粉丝30W+,csdn特邀作者、博客专家、CSDN新星计划导师、Java领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和学生毕业项目实战,高校老师/讲师/同行前辈交流 ✌ 主要内容: SpringBoot、Vue、SSM、HLMT、Jsp、PHP、Nodejs、P

    2024年01月18日
    浏览(44)
  • .net core 多项目中使用EFCore

    类库一级项目使用.net core 3.1 框架 其中EFCore是和数据库交互的 MultiCore 注入EFCore中的DBContext与数据库交互 主要为了解决多项目中数据库迁移失败问题 EFCore 工程安装如下包 MultiCore 安装如下 EFCore person.cs personconfig.cs EFDbcontext.cs EFDbContextFac .cs 这是关键,但是这仅仅在开发环境下

    2024年02月07日
    浏览(77)
  • ASP.NET Core NET6 EFCore MySQL

    ASP.NET Core 下使用 EFCore 和 .NET Framework 下使用有点区别。 参考官方文档:https://dev.mysql.com/doc/connector-net/en/connector-net-entityframework-core.html 1.创建 ASP.NET Core Web应用 项目 创建新的项目的 Program.cs 文件中使用了顶级语句,与NET5 有所区别。 .NET 6 的 创建的项目使用了C# 顶级语句 ht

    2024年02月07日
    浏览(41)
  • 大中型WMS仓储管理系统选型推荐,实现货品出入库精细化管理-亿发

    智能制造是基于信息技术,通过将生产设备、工作流程、供应链等各个环节进行智能化互联,实现生产过程的优化和智能化管理的模式。它涵盖了数字化、网络化、智能化等多方面的科技,旨在增强生产效率、灵活度和质量。 WMS,即仓储管理系统,是一种专门用于管理仓库运

    2024年02月10日
    浏览(31)
  • 基于Java+Spring+Vue仓储出入库管理系统设计和实现

    博主介绍 : ✌ 全网粉丝30W+,csdn特邀作者、博客专家、CSDN新星计划导师、Java领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和学生毕业项目实战,高校老师/讲师/同行交流合作 ✌ 主要内容: SpringBoot、Vue、SSM、HLMT、Jsp、PHP、Nodejs、P

    2024年02月03日
    浏览(50)
  • asp.net core EFCore 属性配置与DbContext

    Entity Framework (EF) Core 是轻量化、可扩展、开源和跨平台版的常用 Entity Framework 数据访问技术。用于程序中的class类和数据库中的表互相之间建立映射关系。在学习过程中,EFCore中的属性配置显的尤为重要它是学习好asp.net core的基础是配置数据库表结构的重要基石。本篇内容为

    2024年02月07日
    浏览(38)
  • 基于Java+SpringBoot+Vue+uniapp微信小程序实现仓储管理系统

    博主介绍 : ✌ 全网粉丝20W+,csdn特邀作者、博客专家、CSDN新星计划导师、java领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战 ✌ 🍅 文末获取源码联系 🍅 👇🏻 精彩专栏 推荐订阅 👇🏻 不然下次找不到哟  java项目

    2024年02月09日
    浏览(79)
  • asp.net core 框架搭建2-搭建MVC后台管理系统

    作者:xcLeigh 文章地址:https://blog.csdn.net/weixin_43151418/article/details/131458964 asp.net core 框架搭建2-搭建MVC后台管理系统 ,本文章介绍asp.net core框架搭建,然后开发一个后台管理系统,将一步步带着大家,实现目标。所有操作过程将展现在本篇文章,下面咋们一起来实现它吧。 使

    2024年02月12日
    浏览(32)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包