@@ -3,6 +3,11 @@ using System.Data; | |||
using Learun.Application.TwoDevelopment.AssetManagementSystem; | |||
using System.Web.Mvc; | |||
using System.Collections.Generic; | |||
using ZipOneCode.ZipProvider; | |||
using System.Linq; | |||
using System.Drawing; | |||
using System.IO; | |||
using System; | |||
namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers | |||
{ | |||
@@ -64,8 +69,31 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers | |||
return View(); | |||
} | |||
[HttpGet] | |||
public ActionResult QRPrint() | |||
public ActionResult QRPrint(string keyValue) | |||
{ | |||
var lists = new List<Ass_AssetsInfoItemEntity>(); | |||
if (!string.IsNullOrEmpty(keyValue)) | |||
{ | |||
foreach (var item in keyValue.Split(',')) | |||
{ | |||
var entity = ass_AssetsInfoItemIBLL.GetAss_AssetsInfoItemEntity(item); | |||
if (entity != null) | |||
{ | |||
lists.Add(entity); | |||
//读图片 | |||
var d = QRCodeHelper.ProcessRequest(entity.AIId, @"~\Content\images\img1.png", "在册登记明细", entity.AIASSName + entity.AICode); | |||
FileStream fs = new FileStream(d.resultImgPath, FileMode.Open, FileAccess.Read); | |||
int length = (int)fs.Length; | |||
byte[] image = new byte[length]; | |||
fs.Read(image, 0, length); | |||
var src = "data:image/jepg;base64," + Convert.ToBase64String(image); | |||
entity.ImgBase64String = src; | |||
fs.Close(); | |||
} | |||
} | |||
} | |||
ViewBag.Lists = lists; | |||
return View(); | |||
} | |||
#endregion | |||
@@ -225,6 +253,88 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers | |||
ass_AssetsInfoItemIBLL.SaveEntity(keyValue, entity); | |||
return Success("保存成功!"); | |||
} | |||
/// <summary> | |||
/// 批量生成二维码 | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult GetQRCode(string keyValue,Pagination pagination) | |||
{ | |||
//TODO:文件夹压缩成zip | |||
//var a = @"D:\Job\test\zip"; | |||
//var aa = string.Format(@"{0}.zip", a); | |||
//ZipHelper.CreateZip(a, aa); | |||
//TODO:生成带logo二维码 | |||
//var resultImgPath = QRCodeHelper.ProcessRequest("demo", @"~\Content\images\img1.png"); | |||
//TODO:生成二维码,并打包 | |||
//var dArr = new List<string>(); | |||
//for (int i = 0; i < 5; i++) | |||
//{ | |||
// var d = QRCodeHelper.ProcessRequest("demo" + i, @"~\Content\images\img1.png", "demo" + i); | |||
// if (dArr.IndexOf(d) == -1) | |||
// { | |||
// dArr.Add(d); | |||
// } | |||
//} | |||
//foreach (var item in dArr) | |||
//{ | |||
// ZipHelper.CreateZip(item, item + ".zip"); | |||
//} | |||
//图片保存文件夹地址 | |||
var dArr = new List<string>(); | |||
//明细数据 | |||
var lists = new List<Ass_AssetsInfoItemEntity>(); | |||
if (!string.IsNullOrEmpty(keyValue)) | |||
{ | |||
foreach (var item in keyValue.Split(',')) | |||
{ | |||
var entity = ass_AssetsInfoItemIBLL.GetAss_AssetsInfoItemEntity(item); | |||
if (entity != null) | |||
{ | |||
lists.Add(entity); | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
var data = ass_AssetsInfoItemIBLL.GetPageList(pagination, "{}"); | |||
lists = data.ToList(); | |||
} | |||
foreach (var item in lists) | |||
{ | |||
var d = QRCodeHelper.ProcessRequest(item.AIId, @"~\Content\images\img1.png", "在册登记明细", item.AIASSName + item.AICode); | |||
if (dArr.IndexOf(d.resultImgDirectoryPath) == -1) | |||
{ | |||
dArr.Add(d.resultImgDirectoryPath); | |||
} | |||
} | |||
foreach (var item in dArr) | |||
{ | |||
ZipHelper.CreateZip(item, item + ".zip"); | |||
} | |||
return Success("操作成功!二维码图片地址为:" + string.Join(",", dArr),dArr); | |||
} | |||
/// <summary> | |||
/// 批量生成二维码下载 | |||
/// </summary> | |||
/// <param name="path"></param> | |||
[HttpPost] | |||
public void DownFile(string path) | |||
{ | |||
path = string.Format(@"{0}{1}", path, ".zip"); | |||
if (FileDownHelper.FileExists(path)) | |||
{ | |||
FileDownHelper.DownLoadold(path, path.Substring(path.LastIndexOf(@"\") + 1)); | |||
} | |||
} | |||
#endregion | |||
} | |||
@@ -80,6 +80,9 @@ | |||
<a id="lr_detail" class="btn btn-default"><i class="fa fa-bars"></i> 查看出入记录</a> | |||
<a id="lr_usedetail" class="btn btn-default"><i class="fa fa-bars"></i> 查看使用人员记录</a> | |||
</div> | |||
<div class=" btn-group btn-group-sm"> | |||
<a id="lr_getqrcode" class="btn btn-default"><i class="fa fa-plus"></i> 批量生成二维码</a> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-body" id="gridtable"></div> | |||
@@ -34,7 +34,7 @@ var bootstrap = function ($, learun) { | |||
nodeClick: function (item) { | |||
page.search({ AIASSClass: item.value }); | |||
} | |||
}); | |||
}); | |||
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) { | |||
page.search(queryJson); | |||
}, 400, 400); | |||
@@ -65,7 +65,8 @@ var bootstrap = function ($, learun) { | |||
height: 80 | |||
}); | |||
$("#lr_printBar").on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('AICode'); | |||
//var keyValue = $('#gridtable').jfGridValue('AICode'); | |||
var keyValue = $('#gridtable').jfGridValue('AIId'); | |||
var AName = $('#gridtable').jfGridValue('AIASSName'); | |||
if (learun.checkrow(keyValue)) { | |||
//todo 打印标签 | |||
@@ -86,7 +87,7 @@ var bootstrap = function ($, learun) { | |||
learun.layerForm({ | |||
id: 'formcardprint', | |||
title: '打印二维码', | |||
url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/QRPrint?keyValue=' + keyValue+'&aName='+escape(AName), | |||
url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/QRPrint?keyValue=' + keyValue + '&aName=' + escape(AName), | |||
width: 700, | |||
height: 300, | |||
btn: null, | |||
@@ -184,6 +185,39 @@ var bootstrap = function ($, learun) { | |||
} | |||
}); | |||
//生成二维码 | |||
$('#lr_getqrcode').on('click', function () { | |||
//console.log($('#gridtable')[0].dfop.running); | |||
var keyValue = $('#gridtable').jfGridValue('AIId'); | |||
//js方法: | |||
//if (keyValue != null && keyValue != "" && keyValue != undefined) { | |||
// //console.log("有选中"); | |||
//} else { | |||
// //console.log("无选中"); | |||
// if ($('#gridtable')[0].dfop.running.rowdata.length > 100) { | |||
// learun.alert.warning("最多可以选择100条数据!"); | |||
// return false; | |||
// } | |||
// var bb = new Array(); | |||
// for (var i = 0; i < $('#gridtable')[0].dfop.running.rowdata.length; i++) { | |||
// bb.push($('#gridtable')[0].dfop.running.rowdata[i]["jfgridRowData"]["AIId"]); | |||
// } | |||
// keyValue = bb.toString(); | |||
//} | |||
learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/GetQRCode', { keyValue: keyValue, pagination: $('#gridtable')[0].dfop.running.pageparam }, function (res) { | |||
//console.log(res); | |||
if (res && res.code == "200") { | |||
//top.layer.alert("二维码图片地址为:" + res.data, { icon: 7, title: "提示", yes: function (index) { layer.close(index) } }); | |||
//下载文件 | |||
for (var i = 0; i < res.data.length; i++) { | |||
learun.download({ url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/DownFile', param: { path: res.data[i], __RequestVerificationToken: $.lrToken }, method: 'POST' }); | |||
} | |||
} | |||
}); | |||
}); | |||
}, | |||
// 初始化列表 | |||
initGird: function () { | |||
@@ -377,7 +411,7 @@ var bootstrap = function ($, learun) { | |||
mainId: 'AIId', | |||
isMultiselect: true, | |||
isPage: true, | |||
sidx: 'AICodeNum' | |||
sidx: 'AICodeNum', | |||
}); | |||
page.search(); | |||
}, | |||
@@ -1,4 +1,5 @@ | |||
<!DOCTYPE html> | |||
@using Learun.Application.TwoDevelopment.AssetManagementSystem | |||
<!DOCTYPE html> | |||
<html> | |||
@@ -23,38 +24,47 @@ | |||
</head> | |||
<body style=""> | |||
<div id="qrcodeBox" style="text-align:center;margin-top:20px;"> | |||
<div class="qrcodeBox" style="display:inline-block"> | |||
<div id="qrcode" style="margin:0 auto 5px;"></div> | |||
<div class="qrcodeTxt" style="font-size:12px;"></div> | |||
<div id="qrcodeBox" style="text-align:center;margin-top:20px;"> | |||
@*<div class="qrcodeBox" style="display:inline-block"> | |||
<div id="qrcode" style="margin:0 auto 5px;"></div> | |||
<div class="qrcodeTxt" style="font-size:12px;"></div> | |||
</div>*@ | |||
@foreach (Ass_AssetsInfoItemEntity item in ViewBag.Lists) | |||
{ | |||
<div style="margin-bottom:20px;"> | |||
<img src="@item.ImgBase64String"/> | |||
<div style="font-size:12px;">@item.AIASSName@item.AICode</div> | |||
</div> | |||
} | |||
</div> | |||
</div> | |||
<div id="btnprint" type="button" class="btns" value="打印">打印</div> | |||
<script> | |||
//标签打印 | |||
var qrcode = new QRCode(document.getElementById("qrcode"), { | |||
width: 80, | |||
height: 80 | |||
}); | |||
var keyValue = request('keyValue');//二维码 | |||
var aName = request('aName'); | |||
$('.qrcodeTxt').html(unescape( aName)); | |||
$(function () { | |||
qrcode.makeCode(keyValue); | |||
$("#btnprint").on("click", function () { | |||
AddPrintContent3() | |||
}); | |||
<div id="btnprint" type="button" class="btns" value="打印">打印</div> | |||
<script> | |||
//标签打印 | |||
//var qrcode = new QRCode(document.getElementById("qrcode"), { | |||
// width: 142, | |||
// height: 142 | |||
//}); | |||
//var keyValue = request('keyValue');//二维码 | |||
//var aName = request('aName'); | |||
//$('.qrcodeTxt').html(unescape(aName)); | |||
$(function () { | |||
//qrcode.makeCode(keyValue); | |||
$("#btnprint").on("click", function () { | |||
AddPrintContent3() | |||
}); | |||
}); | |||
// 打印表单 | |||
}); | |||
// 打印表单 | |||
function AddPrintContent3() { | |||
$('#btnprint').css('display', 'none') | |||
window.print(); | |||
$('#btnprint').css('display', 'block') | |||
} | |||
</script> | |||
function AddPrintContent3() { | |||
$('#btnprint').css('display', 'none') | |||
window.print(); | |||
$('#btnprint').css('display', 'block') | |||
} | |||
</script> | |||
</body> | |||
</html> |
@@ -192,6 +192,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Include="Bootstraper.cs" /> | |||
<Compile Include="Modules\AssetManagementSystem\Ass_AssetsInfoItemApi.cs" /> | |||
<Compile Include="Modules\AttendanceApi.cs" /> | |||
<Compile Include="Modules\AnnexesApiWx.cs" /> | |||
<Compile Include="Modules\BaseNoLoginApi.cs" /> | |||
@@ -0,0 +1,47 @@ | |||
using Learun.Application.Base.SystemModule; | |||
using Learun.Application.TwoDevelopment.AssetManagementSystem; | |||
using Learun.Util; | |||
using Nancy; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.IO; | |||
namespace Learun.Application.WebApi.Modules | |||
{ | |||
public class Ass_AssetsInfoItemApi : BaseApi | |||
{ | |||
public Ass_AssetsInfoItemApi() | |||
: base("/learun/adms/AssetManagementSystem/Ass_AssetsInfoItem") | |||
{ | |||
Get["/getEntity"] = GetEntity; | |||
} | |||
private Ass_AssetsInfoItemIBLL ass_AssetsInfoItemIBLL = new Ass_AssetsInfoItemBLL(); | |||
private Ass_AssetsInfoIBLL ass_AssetsInfoIBLL = new Ass_AssetsInfoBLL(); | |||
/// <summary> | |||
/// 获取资产信息 | |||
/// </summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response GetEntity(dynamic _) | |||
{ | |||
var keyValue = this.GetReqData(); | |||
var entity = ass_AssetsInfoItemIBLL.GetAss_AssetsInfoItemEntity(keyValue); | |||
if (entity != null) | |||
{ | |||
entity.ACode = ass_AssetsInfoIBLL.GetAss_AssetsInfoEntity(entity.AId)?.ACode; | |||
} | |||
else | |||
{ | |||
entity = new Ass_AssetsInfoItemEntity(); | |||
} | |||
var result = new | |||
{ | |||
Ass_AssetsInfoItemEntity = entity | |||
}; | |||
return Success(result); | |||
} | |||
} | |||
} |
@@ -69,6 +69,18 @@ | |||
<publisherPolicy apply="no" /> | |||
<assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" /> | |||
</dependentAssembly> | |||
<dependentAssembly> | |||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" /> | |||
</dependentAssembly> | |||
<dependentAssembly> | |||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> | |||
</dependentAssembly> | |||
<dependentAssembly> | |||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" /> | |||
</dependentAssembly> | |||
</assemblyBinding> | |||
</runtime> | |||
<system.webServer> | |||
@@ -6,6 +6,18 @@ | |||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" /> | |||
</dependentAssembly> | |||
<dependentAssembly> | |||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" /> | |||
</dependentAssembly> | |||
<dependentAssembly> | |||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> | |||
</dependentAssembly> | |||
<dependentAssembly> | |||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" /> | |||
</dependentAssembly> | |||
</assemblyBinding> | |||
</runtime> | |||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /></startup></configuration> |
@@ -6,6 +6,18 @@ | |||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" /> | |||
</dependentAssembly> | |||
<dependentAssembly> | |||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" /> | |||
</dependentAssembly> | |||
<dependentAssembly> | |||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> | |||
</dependentAssembly> | |||
<dependentAssembly> | |||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" /> | |||
</dependentAssembly> | |||
</assemblyBinding> | |||
</runtime> | |||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /></startup></configuration> |
@@ -389,6 +389,24 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
/// </summary> | |||
[NotMapped] | |||
public string AIPhoto { get; set; } | |||
/// <summary> | |||
/// 资产名称 | |||
/// </summary> | |||
[NotMapped] | |||
public string AName { get; set; } | |||
/// <summary> | |||
/// 资产编号 | |||
/// </summary> | |||
[NotMapped] | |||
public string ACode { get; set; } | |||
/// <summary> | |||
/// 批量生成二维码base64字符串 | |||
/// </summary> | |||
[NotMapped] | |||
public string ImgBase64String { get; set; } | |||
#endregion | |||
} | |||
} | |||
@@ -274,7 +274,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
t.AContent | |||
"); | |||
strSql.Append(" FROM Ass_AssetsInfoItem a LEFT JOIN dbo.Ass_AssetsInfo t ON a.AId=t.AId "); | |||
strSql.Append(" WHERE a.AIASSState<>2 "); | |||
strSql.Append(" WHERE (a.AIASSState <> 2 or a.AIASSState is null) "); | |||
var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
@@ -313,24 +313,24 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
try | |||
{ | |||
var result = this.BaseRepository().FindEntity<Ass_AssetsInfoItemEntity>(keyValue); | |||
var assInfo = this.BaseRepository().FindEntity<Ass_AssetsInfoEntity>(a => a.AName == result.AIASSName); | |||
if (assInfo != null) | |||
if (result != null) | |||
{ | |||
if (assInfo.APhoto != null) | |||
var assInfo = this.BaseRepository().FindEntity<Ass_AssetsInfoEntity>(a => a.AName == result.AIASSName); | |||
if (assInfo != null) | |||
{ | |||
string photoPath = this.BaseRepository() | |||
.FindEntity<AnnexesFileEntity>(a => a.F_FolderId == assInfo.APhoto)?.F_FilePath; | |||
if (!string.IsNullOrEmpty(photoPath)) | |||
if (assInfo.APhoto != null) | |||
{ | |||
photoPath = "/" + photoPath.Substring(photoPath.IndexOf("Resource")); | |||
result.AIPhoto = photoPath; | |||
string photoPath = this.BaseRepository() | |||
.FindEntity<AnnexesFileEntity>(a => a.F_FolderId == assInfo.APhoto)?.F_FilePath; | |||
if (!string.IsNullOrEmpty(photoPath)) | |||
{ | |||
photoPath = "/" + photoPath.Substring(photoPath.IndexOf("Resource")); | |||
result.AIPhoto = photoPath; | |||
} | |||
} | |||
} | |||
} | |||
return result; | |||
} | |||
catch (Exception ex) | |||
@@ -81,6 +81,9 @@ | |||
<Reference Include="Microsoft.CSharp" /> | |||
<Reference Include="System.Data" /> | |||
<Reference Include="System.Xml" /> | |||
<Reference Include="ThoughtWorks.QRCode, Version=1.0.4778.30637, Culture=neutral, processorArchitecture=MSIL"> | |||
<HintPath>..\..\..\packages\ThoughtWorks.QRCode.1.1.0\lib\ThoughtWorks.QRCode.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Yahoo.Yui.Compressor"> | |||
<HintPath>..\..\..\packages\YUICompressor.NET.2.7.0.0\lib\NET20\Yahoo.Yui.Compressor.dll</HintPath> | |||
</Reference> | |||
@@ -128,8 +131,10 @@ | |||
<Compile Include="Ueditor\UeditorPathFormatter.cs" /> | |||
<Compile Include="Ueditor\UeditorUploadConfig.cs" /> | |||
<Compile Include="Ueditor\UeditorUploadResult.cs" /> | |||
<Compile Include="Web\QRCodeHelper.cs" /> | |||
<Compile Include="Web\CodeRuleEnum.cs" /> | |||
<Compile Include="Web\HttpMethods.cs" /> | |||
<Compile Include="Web\ZipHelper.cs" /> | |||
<Compile Include="Web\JsCssHelper.cs" /> | |||
<Compile Include="Web\FilterMode.cs" /> | |||
<Compile Include="Web\LoginUserInfo.cs" /> | |||
@@ -0,0 +1,133 @@ | |||
using System; | |||
using System.Web; | |||
using ThoughtWorks.QRCode.Codec; | |||
using ThoughtWorks.QRCode.Codec.Data; | |||
using ThoughtWorks.QRCode.Codec.Util; | |||
using System.IO; | |||
using System.Text; | |||
using System.Drawing; | |||
using System.Drawing.Drawing2D; | |||
using System.Collections.Generic; | |||
namespace Learun.Util | |||
{ | |||
public class QRCodeHelper | |||
{ | |||
/// <summary> | |||
/// 生成带图片的二维码 | |||
/// </summary> | |||
/// <param name="qrcodeText">二维码内容</param> | |||
/// <param name="imagePath">二维码上logo图片地址</param> | |||
/// <param name="savePath"></param> | |||
/// <param name="imageName">二维码图片名称</param> | |||
public static Result ProcessRequest(string qrcodeText,string imagePath,string savePath,string imageName) | |||
{ | |||
//最终图片保存路径 | |||
var resultImgPath = string.Empty; | |||
//最终图片文件夹保存路径 | |||
var resultImgDirectoryPath = string.Empty; | |||
if (!string.IsNullOrEmpty(qrcodeText)) | |||
{ | |||
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(); | |||
qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE;//设置编码模式(注意:BYTE能支持中文,ALPHA_NUMERIC扫描出来的都是数字) | |||
qrCodeEncoder.QRCodeScale = 4;//设置编码测量度(值越⼤⽣成的⼆维码图⽚像素越⾼) | |||
qrCodeEncoder.QRCodeVersion = 0;//设置编码版本(注意:设置为0主要是防止编码的字符串太长时发生错误) | |||
qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.H;//设置编码错误纠正(有4个等级:H-L-M-Q) | |||
System.Drawing.Image image = qrCodeEncoder.Encode(qrcodeText); | |||
System.IO.MemoryStream MStream = new System.IO.MemoryStream(); | |||
image.Save(MStream, System.Drawing.Imaging.ImageFormat.Png); | |||
System.IO.MemoryStream MStream1 = new System.IO.MemoryStream(); | |||
CombinImage(image, HttpContext.Current.Server.MapPath(imagePath)).Save(MStream1, System.Drawing.Imaging.ImageFormat.Png); | |||
//保存图片到本地文件夹 | |||
System.Drawing.Image img = System.Drawing.Image.FromStream(MStream1); | |||
//string imgDirectoryPath = System.IO.Path.Combine(Config.GetValue("AnnexesFile"), "带logo图片二维码", DateTime.Now.ToString("yyyyMMddHHmm")); | |||
string imgDirectoryPath = System.IO.Path.Combine(Config.GetValue("AnnexesFile"), "带logo图片二维码", savePath); | |||
if (!System.IO.Directory.Exists(imgDirectoryPath)) | |||
{ | |||
System.IO.Directory.CreateDirectory(imgDirectoryPath); | |||
} | |||
string imgPath = System.IO.Path.Combine(imgDirectoryPath, imageName + ".png"); | |||
img.Save(imgPath, System.Drawing.Imaging.ImageFormat.Png); | |||
resultImgDirectoryPath = imgDirectoryPath; | |||
resultImgPath = imgPath; | |||
//HttpContext.Current.Response.ClearContent(); | |||
//HttpContext.Current.Response.ContentType = "image/png"; | |||
//HttpContext.Current.Response.BinaryWrite(MStream1.ToArray()); | |||
//image.Dispose(); | |||
MStream.Dispose(); | |||
MStream1.Dispose(); | |||
} | |||
//HttpContext.Current.Response.Flush(); | |||
//HttpContext.Current.Response.End(); | |||
var result = new Result() | |||
{ | |||
resultImgPath = resultImgPath, | |||
resultImgDirectoryPath = resultImgDirectoryPath | |||
}; | |||
return result; | |||
} | |||
/// <summary> | |||
/// 调用此函数后使此两种图片合并,类似相册,有个 | |||
/// 背景图,中间贴自己的目标图片 | |||
/// </summary> | |||
/// <param name="imgBack">粘贴的源图片</param> | |||
/// <param name="destImg">粘贴的目标图片</param> | |||
public static Image CombinImage(Image imgBack, string destImg) | |||
{ | |||
Image img = Image.FromFile(destImg); //照片图片 | |||
if (img.Height != 30 || img.Width != 30) | |||
{ | |||
img = KiResizeImage(img, 30, 30, 0); | |||
} | |||
Graphics g = Graphics.FromImage(imgBack); | |||
g.DrawImage(imgBack, 0, 0, imgBack.Width, imgBack.Height); | |||
//g.DrawImage(imgBack, 0, 0, 相框宽, 相框高); | |||
//g.FillRectangle(System.Drawing.Brushes.White, imgBack.Width / 2 - img.Width / 2 - 1, imgBack.Width / 2 - img.Width / 2 - 1,1,1);//相片四周刷一层黑色边框 | |||
//g.DrawImage(img, 照片与相框的左边距, 照片与相框的上边距, 照片宽, 照片高); | |||
g.DrawImage(img, imgBack.Width / 2 - img.Width / 2, imgBack.Width / 2 - img.Width / 2, img.Width, img.Height); | |||
GC.Collect(); | |||
return imgBack; | |||
} | |||
/// <summary> | |||
/// Resize图片 | |||
/// </summary> | |||
/// <param name="bmp">原始Bitmap</param> | |||
/// <param name="newW">新的宽度</param> | |||
/// <param name="newH">新的高度</param> | |||
/// <param name="Mode">保留着,暂时未用</param> | |||
/// <returns>处理以后的图片</returns> | |||
public static Image KiResizeImage(Image bmp, int newW, int newH, int Mode) | |||
{ | |||
try | |||
{ | |||
Image b = new Bitmap(newW, newH); | |||
Graphics g = Graphics.FromImage(b); | |||
// 插值算法的质量 | |||
g.InterpolationMode = InterpolationMode.HighQualityBicubic; | |||
g.DrawImage(bmp, new Rectangle(0, 0, newW, newH), new Rectangle(0, 0, bmp.Width, bmp.Height), GraphicsUnit.Pixel); | |||
g.Dispose(); | |||
return b; | |||
} | |||
catch | |||
{ | |||
return null; | |||
} | |||
} | |||
public bool IsReusable | |||
{ | |||
get | |||
{ | |||
return false; | |||
} | |||
} | |||
public class Result { | |||
public string resultImgPath { get; set; } | |||
public string resultImgDirectoryPath { get; set; } | |||
} | |||
} | |||
} |
@@ -0,0 +1,73 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.IO; | |||
using System.Diagnostics; | |||
using ICSharpCode.SharpZipLib; | |||
using ICSharpCode.SharpZipLib.Zip; | |||
using ICSharpCode.SharpZipLib.Checksums; | |||
using ICSharpCode.SharpZipLib.Core; | |||
namespace ZipOneCode.ZipProvider | |||
{ | |||
public class ZipHelper | |||
{ | |||
/// <summary> | |||
/// 压缩文件 | |||
/// </summary> | |||
/// <param name="sourceFilePath"></param> | |||
/// <param name="destinationZipFilePath"></param> | |||
public static void CreateZip(string sourceFilePath, string destinationZipFilePath) | |||
{ | |||
if (sourceFilePath[sourceFilePath.Length - 1] != System.IO.Path.DirectorySeparatorChar) | |||
sourceFilePath += System.IO.Path.DirectorySeparatorChar; | |||
ZipOutputStream zipStream = new ZipOutputStream(File.Create(destinationZipFilePath)); | |||
zipStream.SetLevel(6); // 压缩级别 0-9 | |||
CreateZipFiles(sourceFilePath, zipStream, sourceFilePath); | |||
zipStream.Finish(); | |||
zipStream.Close(); | |||
} | |||
/// <summary> | |||
/// 递归压缩文件 | |||
/// </summary> | |||
/// <param name="sourceFilePath">待压缩的文件或文件夹路径</param> | |||
/// <param name="zipStream">打包结果的zip文件路径(类似 D:\WorkSpace\a.zip),全路径包括文件名和.zip扩展名</param> | |||
/// <param name="staticFile"></param> | |||
private static void CreateZipFiles(string sourceFilePath, ZipOutputStream zipStream, string staticFile) | |||
{ | |||
Crc32 crc = new Crc32(); | |||
string[] filesArray = Directory.GetFileSystemEntries(sourceFilePath); | |||
foreach (string file in filesArray) | |||
{ | |||
if (Directory.Exists(file)) //如果当前是文件夹,递归 | |||
{ | |||
CreateZipFiles(file, zipStream, staticFile); | |||
} | |||
else //如果是文件,开始压缩 | |||
{ | |||
FileStream fileStream = File.OpenRead(file); | |||
byte[] buffer = new byte[fileStream.Length]; | |||
fileStream.Read(buffer, 0, buffer.Length); | |||
string tempFile = file.Substring(staticFile.LastIndexOf("\\") + 1); | |||
ZipEntry entry = new ZipEntry(tempFile); | |||
entry.DateTime = DateTime.Now; | |||
entry.Size = fileStream.Length; | |||
fileStream.Close(); | |||
crc.Reset(); | |||
crc.Update(buffer); | |||
entry.Crc = crc.Value; | |||
zipStream.PutNextEntry(entry); | |||
zipStream.Write(buffer, 0, buffer.Length); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -7,5 +7,6 @@ | |||
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net461" /> | |||
<package id="NPOI" version="2.3.0" targetFramework="net45" /> | |||
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" /> | |||
<package id="ThoughtWorks.QRCode" version="1.1.0" targetFramework="net461" /> | |||
<package id="YUICompressor.NET" version="2.7.0.0" targetFramework="net45" /> | |||
</packages> |
@@ -2,10 +2,15 @@ | |||
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 | |||
"version": "0.0", | |||
"configurations": [{ | |||
"type": "uniCloud", | |||
"default": { | |||
"launchtype": "local" | |||
} | |||
} | |||
"app-plus" : | |||
{ | |||
"launchtype" : "local" | |||
}, | |||
"default" : | |||
{ | |||
"launchtype" : "local" | |||
}, | |||
"type" : "uniCloud" | |||
} | |||
] | |||
} |
@@ -16,11 +16,11 @@ export default { | |||
// "http://localhost:8088/" | |||
// ], | |||
"apiHost": [ | |||
"http://localhost:8088/" | |||
"http://192.168.10.45:8088/" | |||
], | |||
// 开发环境下自动填充登录账号密码,与接口地址一一对应,只在开发环境下显示 | |||
"devAccount": [ | |||
{ username: "system", password: "123456" } | |||
{ username: "system", password: "www.qj.com" } | |||
], | |||
//是否分布式部署 指WebApi与Web不在一台服务器 | |||
"isDistributed":true, | |||
@@ -1074,6 +1074,19 @@ | |||
"style": { | |||
"navigationBarTitleText": "详情" | |||
} | |||
}, | |||
//扫描资产二维码 | |||
{ | |||
"path": "pages/AssetManagementSystem/ScanAssetQRCode/list", | |||
"style": { | |||
"navigationBarTitleText": "扫描资产二维码" | |||
} | |||
}, | |||
{ | |||
"path": "pages/AssetManagementSystem/ScanAssetQRCode/from", | |||
"style": { | |||
"navigationBarTitleText": "资产详情" | |||
} | |||
} | |||
@@ -0,0 +1,195 @@ | |||
<template> | |||
<view class="welcome"> | |||
<view class="welT">资产信息</view> | |||
<view class="welBox"> | |||
<!-- <input type="hidden" name="AIId" :value="AIId" id="AIId" /> --> | |||
<l-input title="资产名称" placeholder="请填写" :value="Ass_AssetsInfoItemEntity.AIASSName" disabled right /> | |||
<l-input title="资产编号" placeholder="请填写" :value="Ass_AssetsInfoItemEntity.ACode" disabled right /> | |||
<l-input title="明细编号" placeholder="请填写" :value="Ass_AssetsInfoItemEntity.AICode" disabled right /> | |||
<l-input title="使用人员" placeholder="请填写" :value="displayListItem(Ass_AssetsInfoItemEntity, 'AIUsePeople')" disabled right /> | |||
<l-input title="所在库房" placeholder="请填写" :value="displayListItem(Ass_AssetsInfoItemEntity, 'AIIStorageId')" disabled right /> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
import moment from 'moment'; | |||
import get from 'lodash/get'; | |||
import set from 'lodash/set'; | |||
import todayTime from '@/common/js/todayTime.js'; | |||
export default { | |||
data() { | |||
return { | |||
pageInfo: '', | |||
scheme: { | |||
AIUsePeople: { | |||
type: 'sourceData', | |||
dataSource: '1', | |||
dataSourceId: 'BaseUser,f_realname,f_userid' | |||
}, | |||
AIIStorageId: { | |||
type: 'sourceData', | |||
dataSource: '1', | |||
dataSourceId: 'Ass_StorageData,sname,sid' | |||
} | |||
}, | |||
userInfo: {}, | |||
dataSource:{ | |||
AIUsePeople:[], | |||
AIIStorageId:[] | |||
}, | |||
AIId: '', | |||
Ass_AssetsInfoItemEntity:{} | |||
}; | |||
}, | |||
methods: { | |||
init() { | |||
// console.log(this.API) | |||
let _this = this; | |||
Promise.all([ | |||
this.FETCH_DATASOURCE('BaseUser').then(data => { | |||
// console.log(data) | |||
this.dataSource.AIUsePeople = data.data.map(t => ({ | |||
text: t.f_realname, | |||
value: t.f_userid | |||
})); | |||
}), | |||
this.FETCH_DATASOURCE('Ass_StorageData').then(data => { | |||
// console.log(data) | |||
this.dataSource.AIIStorageId = data.data.map(t => ({ | |||
text: t.sname, | |||
value: t.sid | |||
})); | |||
}), | |||
() => {} | |||
]); | |||
_this.LOADING('加载数据…'); | |||
_this.pageInfo = _this.GET_PARAM(); //获取页面传递参数 | |||
_this.AIId=_this.pageInfo.AIId; | |||
_this.HTTP_GET('/learun/adms/AssetManagementSystem/Ass_AssetsInfoItem/getEntity', _this.pageInfo.AIId, '加载数据时出错').then(res => { | |||
this.HIDE_LOADING(); | |||
console.log(res); | |||
_this.Ass_AssetsInfoItemEntity = _this.COPY(res.Ass_AssetsInfoItemEntity); | |||
}); | |||
}, | |||
// 显示列表中的标题项 | |||
displayListItem(item, field) { | |||
const fieldItem = this.scheme[field]; | |||
const value = item[field]; | |||
// console.log(Object.values(this.GET_GLOBAL('dataDictionary').usersex)); | |||
switch (fieldItem.type) { | |||
case 'currentInfo': | |||
case 'organize': | |||
return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, ''); | |||
case 'dataItem': | |||
const sex = this.dataSource[field].find(t => t.value === String(value)); | |||
return get(sex, 'text', ''); | |||
case 'sourceData': | |||
const BCdPartyFace = this.dataSource[field].find(t => t.value === String(value)); | |||
return get(BCdPartyFace, 'text', ''); | |||
case 'radio': | |||
case 'select': | |||
const selectItem = this.dataSource[field].find(t => t.value === String(value)); | |||
return get(selectItem, 'text', ''); | |||
case 'checkbox': | |||
if (!value || value.split(',').length <= 0) { | |||
return ''; | |||
} | |||
const checkboxItems = value.split(','); | |||
return this.dataSource[field] | |||
.filter(t => checkboxItems.includes(t.value)) | |||
.map(t => t.text) | |||
.join(','); | |||
case 'datetime': | |||
if (!value) { | |||
return ''; | |||
} | |||
return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm'); | |||
default: | |||
return value === null || value === undefined ? '' : value; | |||
} | |||
} | |||
}, | |||
created() { | |||
this.userInfo = this.GET_GLOBAL('loginUser'); //获取登录信息 | |||
this.init(); | |||
} | |||
}; | |||
</script> | |||
<style lang="less" scoped> | |||
/deep/ .cu-form-group { | |||
min-height: 40px; | |||
} | |||
.welcome { | |||
padding: 1px 0px 20px; | |||
background: #fff; | |||
} | |||
.welT { | |||
font-size: 16px; | |||
margin-bottom: 10px; | |||
line-height: 26px; | |||
padding: 0 12px; | |||
} | |||
.welT text { | |||
width: 26px; | |||
height: 26px; | |||
line-height: 24px; | |||
border: 1px solid #efefef; | |||
border-radius: 4px; | |||
float: right; | |||
text-align: center; | |||
color: #999; | |||
} | |||
.welLine { | |||
height: 1px; | |||
background: #efefef; | |||
// margin: 10px -12px; | |||
} | |||
.welInput { | |||
overflow: hidden; | |||
font-size: 14px; | |||
margin-top: 10px; | |||
} | |||
.welInput span { | |||
float: left; | |||
width: 26%; | |||
text-align: right; | |||
line-height: 30px; | |||
} | |||
.welInput input { | |||
display: block; | |||
margin-left: 28%; | |||
width: 72%; | |||
border: 1px solid #efefef; | |||
border-radius: 4px; | |||
height: 30px; | |||
line-height: 28px; | |||
padding: 0 10px; | |||
margin-bottom: 0; | |||
} | |||
.welCon { | |||
padding: 10px; | |||
border: 1px solid #efefef; | |||
margin-top: 18px; | |||
border-radius: 4px; | |||
position: relative; | |||
} | |||
</style> |
@@ -0,0 +1,47 @@ | |||
<template> | |||
<view class="page"> | |||
<view class="btn" @click="tapScan"> | |||
扫码 | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
import scanCodeFun from '@/common/js/scanCodeFun.js'; | |||
export default { | |||
data() { | |||
return {} | |||
}, | |||
methods: { | |||
init() { | |||
let _this = this; | |||
scanCodeFun.scanCodeFun().then(res => { | |||
console.log(res); //"scanType": "CODABAR"是一维码,QR_CODE是二维码, | |||
if (!res) return; | |||
if (res.scanType=="QR_CODE" && res.result != "" && res.result != null && res.result != undefined) { | |||
this.NAV_TO('./from', { | |||
AIId: res.result | |||
}, true); | |||
}else{ | |||
this.TOAST("无法识别到二维码!"); | |||
return; | |||
} | |||
}) | |||
}, | |||
tapScan() { | |||
this.init(); | |||
} | |||
}, | |||
mounted() { | |||
let _this = this; | |||
setTimeout(function() { | |||
_this.init(); | |||
}, 100); | |||
} | |||
}; | |||
</script> | |||
<style lang="less" scoped> | |||
@import '~@/common/css/sidepage.less'; | |||
@import '~@/common/css/customlist.less'; | |||
</style> |
@@ -0,0 +1,68 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | |||
<PropertyGroup> | |||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
<ProjectGuid>{767D20C4-B983-4940-BF97-74D5479CA558}</ProjectGuid> | |||
<OutputType>Library</OutputType> | |||
<AppDesignerFolder>Properties</AppDesignerFolder> | |||
<RootNamespace>Quanjiang.DigitalSchool.AsposeHelper</RootNamespace> | |||
<AssemblyName>Quanjiang.DigitalSchool.AsposeHelper</AssemblyName> | |||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> | |||
<FileAlignment>512</FileAlignment> | |||
<Deterministic>true</Deterministic> | |||
</PropertyGroup> | |||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
<DebugSymbols>true</DebugSymbols> | |||
<DebugType>full</DebugType> | |||
<Optimize>false</Optimize> | |||
<OutputPath>bin\Debug\</OutputPath> | |||
<DefineConstants>DEBUG;TRACE</DefineConstants> | |||
<ErrorReport>prompt</ErrorReport> | |||
<WarningLevel>4</WarningLevel> | |||
</PropertyGroup> | |||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
<DebugType>pdbonly</DebugType> | |||
<Optimize>true</Optimize> | |||
<OutputPath>bin\Release\</OutputPath> | |||
<DefineConstants>TRACE</DefineConstants> | |||
<ErrorReport>prompt</ErrorReport> | |||
<WarningLevel>4</WarningLevel> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Reference Include="Aspose.Cells, Version=20.10.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Aspose.Cells.20.10.0\lib\net40\Aspose.Cells.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Aspose.Words, Version=20.10.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Aspose.Words.20.10.0\lib\net461\Aspose.Words.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Aspose.Words.Pdf2Word, Version=20.10.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Aspose.Words.20.10.0\lib\net461\Aspose.Words.Pdf2Word.dll</HintPath> | |||
</Reference> | |||
<Reference Include="System" /> | |||
<Reference Include="System.Core" /> | |||
<Reference Include="System.Web" /> | |||
<Reference Include="System.Xml.Linq" /> | |||
<Reference Include="System.Data.DataSetExtensions" /> | |||
<Reference Include="Microsoft.CSharp" /> | |||
<Reference Include="System.Data" /> | |||
<Reference Include="System.Net.Http" /> | |||
<Reference Include="System.Xml" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Include="AsposeCore.cs" /> | |||
<Compile Include="Properties\AssemblyInfo.cs" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Include="app.config" /> | |||
<None Include="packages.config" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\Learun.Framework.Module\Learun.Util\Learun.Util\Learun.Util.csproj"> | |||
<Project>{CF8AE293-88AB-436C-9720-A8386BA5D7B7}</Project> | |||
<Name>Learun.Util</Name> | |||
</ProjectReference> | |||
</ItemGroup> | |||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
</Project> |
@@ -0,0 +1,11 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<configuration> | |||
<runtime> | |||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | |||
<dependentAssembly> | |||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" /> | |||
</dependentAssembly> | |||
</assemblyBinding> | |||
</runtime> | |||
</configuration> |