printcontroller test iot
This commit is contained in:
1 parent
7fa788d47e
commit
327ef35c54
2 files changed
+21
-58
No files matched your search
@@ -1,12 +1,11 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using HHWMS.Web.Models;
|
using HHWMS.Web.Models;
|
||||||
using ICSharpCode.SharpZipLib.Core;
|
using IoTClient.Clients.PLC;
|
||||||
using Microsoft.AspNetCore.Http;
|
using IoTClient.Common.Enums;
|
||||||
|
using IoTClient.Enums;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using WalkingTec.Mvvm.Core;
|
using WalkingTec.Mvvm.Core;
|
||||||
using WalkingTec.Mvvm.Core.Extensions;
|
|
||||||
using WalkingTec.Mvvm.Mvc;
|
using WalkingTec.Mvvm.Mvc;
|
||||||
|
|
||||||
namespace HHWMS.Web.Controllers
|
namespace HHWMS.Web.Controllers
|
||||||
@@ -15,11 +14,11 @@ namespace HHWMS.Web.Controllers
|
|||||||
[ActionDescription("打印管理")]
|
[ActionDescription("打印管理")]
|
||||||
public partial class PrintController : BaseController
|
public partial class PrintController : BaseController
|
||||||
{
|
{
|
||||||
private readonly IUnitWork _unitwork;
|
private readonly IUnitWork _unitWork;
|
||||||
|
|
||||||
public PrintController(IUnitWork unitwork)
|
public PrintController(IUnitWork unitWork)
|
||||||
{
|
{
|
||||||
_unitwork = unitwork;
|
_unitWork = unitWork;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Search
|
#region Search
|
||||||
@@ -27,62 +26,24 @@ namespace HHWMS.Web.Controllers
|
|||||||
[ActionDescription("Sys.Search")]
|
[ActionDescription("Sys.Search")]
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
{
|
{
|
||||||
var inv = _unitwork.Find<Inventory>(x => x.TaskStatus != InventoryTaskStatus.任务中)
|
SiemensClient client = new SiemensClient(SiemensVersion.S7_1500, "127.0.0.1", 102);
|
||||||
|
client.Write("V2209", 33);
|
||||||
|
|
||||||
|
Dictionary<string, DataTypeEnum> addresses = new Dictionary<string, DataTypeEnum>();
|
||||||
|
addresses.Add("DB4.24", DataTypeEnum.Float);
|
||||||
|
addresses.Add("DB1.434.0", DataTypeEnum.Bool);
|
||||||
|
addresses.Add("V4109", DataTypeEnum.Byte);
|
||||||
|
var result = client.BatchRead(addresses);
|
||||||
|
var tt = result.Value.First(x => x.Key.Equals("DB1.434.0")).Value;
|
||||||
|
|
||||||
|
var inv = _unitWork
|
||||||
|
.Find<Inventory>(x => x.TaskStatus != InventoryTaskStatus.任务中)
|
||||||
.ToList()
|
.ToList()
|
||||||
.GroupBy(x => x.ContainerCode);
|
.GroupBy(x => x.ContainerCode);
|
||||||
var vm = Wtm.CreateVM<ContainerListVM>();
|
var vm = Wtm.CreateVM<ContainerListVM>();
|
||||||
return PartialView(vm);
|
return PartialView(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Search
|
#endregion Search
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public ActionResult ScanCode(string code)
|
|
||||||
{
|
|
||||||
var material = _unitwork.FindSingle<Material>(x => x.QRCode.Equals(code));
|
|
||||||
if (material == null)
|
|
||||||
{
|
|
||||||
return JsonMore(null, 500, $"二维码{code}不存在!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return JsonMore(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public ActionResult GenCode(string code, int num = 1)
|
|
||||||
{
|
|
||||||
var material = _unitwork.FindSingle<Material>(x => x.QRCode.Equals(code));
|
|
||||||
if (material == null)
|
|
||||||
{
|
|
||||||
return JsonMore(null, 500, $"二维码{code}不存在!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var materialQrList = new List<MaterialQr>();
|
|
||||||
var printList = new List<dynamic>();
|
|
||||||
for (int i = 0; i < num; i++)
|
|
||||||
{
|
|
||||||
var prefix = code.Split("@")[1].Substring(2);
|
|
||||||
var uniqueCode = _unitwork.GetSerialNumber(prefix, length: 8);
|
|
||||||
//var uniqueCode = prefix + unique;
|
|
||||||
|
|
||||||
materialQrList.Add(new MaterialQr
|
|
||||||
{
|
|
||||||
QRCode = code,
|
|
||||||
UniqueCode = uniqueCode,
|
|
||||||
CreateTime = DateTime.Now,
|
|
||||||
CreateBy = Wtm.LoginUserInfo.ITCode
|
|
||||||
});
|
|
||||||
printList.Add(new
|
|
||||||
{
|
|
||||||
UniqueCode = uniqueCode,
|
|
||||||
Batch = material.Batch
|
|
||||||
});
|
|
||||||
}
|
|
||||||
_unitwork.BatchAdd(materialQrList.ToArray());
|
|
||||||
return JsonMore(printList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,11 +27,13 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="wwwroot\layuiadmin\lib\extend\" />
|
<Folder Include="wwwroot\layuiadmin\lib\extend\" />
|
||||||
<Folder Include="wwwroot\upload\" />
|
<Folder Include="wwwroot\upload\" />
|
||||||
|
<Folder Include="IOT\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.0" />
|
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.0" />
|
||||||
<PackageReference Include="EfCore.SchemaCompare" Version="6.0.0" />
|
<PackageReference Include="EfCore.SchemaCompare" Version="6.0.0" />
|
||||||
|
<PackageReference Include="IoTClient" Version="1.0.40" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.11">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.11">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
|||||||
Reference in new issue
Block a user