abp(net core)+easyui+efcore实现仓储管理系统——入库管理之十二(四十八)
abp(net core)+easyui+efcore实现仓储管理系统目录
abp(net core)+easyui+efcore实现仓储管理系统——EasyUI前端页面框架 (十八)
在上面文章abp(net core)+easyui+efcore实现仓储管理系统——入库管理之十一(四十七)的学习之后,我们已经实现了入库单前端的关于实现库位的功能,今天我们来学习如何在后台实现添加库位的功能。接上文。
6. 在Visual Studio 2017的“解决方案资源管理器”中,左键单击“ABP.TPLMS.Application”项目,打开“InStocks\Dto”文件夹,找到InStockOrderDto与CreateUpdateInStockOrderDto两个类,分别添加一行代码。代码如下。
public List<InStockOrderDetailLocDto> InStockOrderDetailLoc { get; set; }
7. 在Visual Studio 2017的“解决方案资源管理器”中,右键单击在领域层“ABP.TPLMS.Web.Mvc”项目中的Controller目录。 找到InStockController.cs文件中输入如下代码,通过构造函数注入对应的服务类实例。
namespace ABP.TPLMS.Web.Controllers
{ public class InStockController : TPLMSControllerBase
{ private readonly IInStockOrderAppService _inSOAppService;
private readonly IInStockOrderDetailAppService _inSODAppService;
private readonly IInStockOrderDetailLocAppService _inSODLAppService; private const int MAX_COUNT = ;
public InStockController(IInStockOrderAppService InSOAppService,IInStockOrderDetailAppService InSODAppService, IInStockOrderDetailLocAppService InSODLAppService)
{ _inSOAppService = InSOAppService;
_inSODAppService = InSODAppService;
_inSODLAppService = InSODLAppService;
} //省略见前文 [HttpPost]
[DisableValidation] public string Update(InStockOrderDto iso)
{ string result = "NO";
List<InStockOrderDetailDto> list = new List<InStockOrderDetailDto>();
List<InStockOrderDetailLocDto> listLoc = new List<InStockOrderDetailLocDto>();
try
{
string head = Request.Form["postdata"];
if (!string.IsNullOrEmpty(head))
{ //把json字符串转换成对象
iso = JsonHelper.Instance.Deserialize<InStockOrderDto>(head);
} list = GetDetailDtos();
listLoc = GetDetailLocDtos();
if (iso == null)
{
return "没有表头!";
} iso.InStockOrderDetail = list;
iso.InStockOrderDetailLoc = listLoc;
result = _inSOAppService.Save(iso); }
catch
{ }
if (result == "OK")
{
return "更新成功!";
}
else
return "更新失败!";
} private List<InStockOrderDetailDto> GetDetailDtos()
{
List<InStockOrderDetailDto> list = new List<InStockOrderDetailDto>();
string deleted = Request.Form["deleted"];
string inserted = Request.Form["inserted"];
string updated = Request.Form["updated"]; // TODO: Add update logic here
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());
}
}
return list;
} private List<InStockOrderDetailLocDto> GetDetailLocDtos()
{
List<InStockOrderDetailLocDto> listLoc = new List<InStockOrderDetailLocDto>(); string locDel = Request.Form["locsDeleted"];
string locIns = Request.Form["locsInserted"];
string locUpd = Request.Form["locsUpdated"]; // TODO: Add update logic here
if (!string.IsNullOrEmpty(locDel))
{
//把json字符串转换成对象
List<InStockOrderDetailLocDto> listLocDeleted = JsonHelper.Instance.Deserialize<List<InStockOrderDetailLocDto>>(locDel);
//TODO 下面就可以根据转换后的对象进行相应的操作了
if (listLocDeleted != null && listLocDeleted.Count > )
{
listLoc.AddRange(listLocDeleted.ToArray());
} } if (!string.IsNullOrEmpty(locIns))
{
//把json字符串转换成对象
List<InStockOrderDetailLocDto> listLocInserted = JsonHelper.Instance.Deserialize<List<InStockOrderDetailLocDto>>(locIns);
if (listLocInserted != null && listLocInserted.Count > )
{
listLoc.AddRange(listLocInserted.ToArray());
}
} if (!string.IsNullOrEmpty(locUpd))
{
//把json字符串转换成对象
List<InStockOrderDetailLocDto> listLocUpdated = JsonHelper.Instance.Deserialize<List<InStockOrderDetailLocDto>>(locUpd);
if (listLocUpdated != null && listLocUpdated.Count > )
{
listLoc.AddRange(listLocUpdated.ToArray());
}
}
return listLoc;
} [DontWrapResult]
public string GetLocs(string Id)
{ int inodId;
int.TryParse(Id, out inodId); PagedInStockDetailLocResultRequestDto paged = new PagedInStockDetailLocResultRequestDto();
paged.MaxResultCount = MAX_COUNT;
paged.InStockOrderDetailId = inodId; var iodlList = _inSODLAppService.GetAll(paged).GetAwaiter().GetResult().Items; ; var json = JsonEasyUI(iodlList);
return json;
}
}
}
8.在Visual Studio 2017的“解决方案资源管理器”中,右键单击在领域层“ABP.TPLMS.Application”项目中的InStocks目录。 找到InStockOrderAppService.cs文件中的Save方法,修改如下。
public string Save(InStockOrderDto iso)
{
try
{ CreateUpdateInStockOrderDto order = ObjectMapper.Map<CreateUpdateInStockOrderDto>(iso);
foreach (var item in order.InStockOrderDetail)
{
CreateUpdateInStockOrderDetailDto isod = ObjectMapper.Map<CreateUpdateInStockOrderDetailDto>(item);
if (isod.Id > )
{
isodApp.Update(isod);
}
else
isodApp.Create(isod); }
foreach (var loc in iso.InStockOrderDetailLoc)
{
CreateUpdateInStockOrderDetailLocDto isodLoc = ObjectMapper.Map<CreateUpdateInStockOrderDetailLocDto>(loc); if (isodLoc.Id > )
{
isodLocApp.Update(isodLoc);
}
else
isodLocApp.Create(isodLoc); } order.InStockOrderDetail = null;
order.InStockOrderDetail = null;
order.Status = ;
Update(order);
}
catch (Exception ex)
{
throw ex;
}
return "OK";
}
9.在Visual Studio 2017的按F5运行。在主界面的菜单中,选择“Business->入库管理”菜单项,浏览器中呈现一个组织信息列表与五个按钮。
10.在“入库单管理”列表中选择一条入库单记录,然后点击“修改”按钮。弹出一个入库单修改界面,在界面中选择“入库单明细”,选中一条入库单明细。如下图。
11.选中序号为1的库位信息,我们发现库位这个单元格的数据不可见。如下图。
12. 在单元格上,点击鼠标右键,在弹出菜单中选择“查看元素”。如下图。
13.在修改文本框的样式,添加颜色。单元格中的数字立即可见。如下图。
14.我们找到“easyui-1.8\themes\bootstrap\easyui.css”文件,找到1879行,在这个样式中添加颜色(“color:#100”)。如下图。
15.使用鼠标左键点击“添加库位”按钮。如下图。
16.对于入库单的库位信息进行修改完成之后,点击“保存”按钮,弹出一个“您确认要修改吗?”对话框。点击对话框中的“确定”按钮。然后会出现修改入库单界面,如下图。
17.如果修改成功,会有一个“更新成功”的提示信息,同时更新入库单管理列表。如下图。
最后,我发现一个bug,偶尔出现,或是在第一次点保存按钮时出现。我暂时没找到原因。如果有知道如何解决的请留言。具体情况如下面三张图。图1,我添加了一条库位信息,点击保存按钮。见图2,实际上并没有把这个库位信息的数据传递到后台。最后的结果如图3。
图1
图2
图3
abp(net core)+easyui+efcore实现仓储管理系统——入库管理之十二(四十八)的更多相关文章
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之四(四十)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之五(四十一)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之六(四十二)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之七(四十三)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之八(四十四)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之九(四十五)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之十(四十六)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之十一(四十七)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之一(三十七)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
随机推荐
- SK-learn实现k近邻算法【准确率随k值的变化】-------莺尾花种类预测
代码详解: from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split fr ...
- 14个快捷键让你的idea飞起来(新手向 + 演示)
本期盘点一下博主在工作中,常用的13个idea快捷键,这些快捷键基本涵盖了大部分的开发场景,希望可以萌新们的idea使用效率,系统为mac系统 上一步 / 下一步撤销 / 反撤销进入一个类生成方法变量 ...
- python学习24之异常
'''''''''1.低级错误:纯语法错误2.中级错误:代码存在隐性错误,逻辑缺陷3.高级错误:软件面对不确定性的异常错误''''''一.捕获异常1.基本异常捕获语句try: #异常捕捉语句的开始 代 ...
- SQLI-LABS学习笔记(四)
第十六关 和之前的关卡一样,修改闭合,无意义的关卡 ")闭合即可 第十七关 这题从源码上看发现 这里进行了两次查询 先查询了用户名是否存在 再查询密码是否匹配 ...
- cut,xargs,sort,tr,rename命令解析
cut 文件内容查看 显示行中的指定部分,删除文件中指定字段 显示文件的内容,类似于下的type命令. 语法: cut(选项)(参数) 选项: -b:仅显示行中指定直接范围的内容: -c:仅显示行中指 ...
- 关于bash shell的理解
Bash Shell 基本特性 1.命令选项参数的补全 补全选项,需要安装 bash-completion yum install -y bash-completion 2.快捷键 Ctrl + a ...
- 数据开源工具:Hadoop为企业带来什么?
熟悉大数据的人一定不会对大名鼎鼎的Hadoop工具陌生,Hadoop是一个由Apache基金会所开发的分布式系统基础架构.用户可以在不了解分布式底层细节的情况下,开发分布式程序.Hadoop的框架最核 ...
- 谈谈你对vuex的理解
vuex创建公有仓库的插件 1.储存公共状态 2.能够根据事件来修改状态 3.多个组件都需要变化,有机制把这个新的状态通知给所有的组件 vuex中的四个类 1.state 定义需要共享的状态 2 ...
- 什么是动态规划?动态规划的意义是什么?https://www.zhihu.com/question/23995189
阮行止 上海洛谷网络科技有限公司 讲师 intro 很有意思的问题.以往见过许多教材,对动态规划(DP)的引入属于"奉天承运,皇帝诏曰"式:不给出一点引入,见面即拿出一大堆公式吓人 ...
- Codeforces Round #509 (Div. 2) A. Heist 贪心
There was an electronic store heist last night. All keyboards which were in the store yesterday were ...