diff --git a/services/Syc.Basic.Web.WMS.Application.Contracts/Syc.Basic.Web.WMS.Application.Contracts.xml b/services/Syc.Basic.Web.WMS.Application.Contracts/Syc.Basic.Web.WMS.Application.Contracts.xml
index 5d87ac1..3234db9 100644
--- a/services/Syc.Basic.Web.WMS.Application.Contracts/Syc.Basic.Web.WMS.Application.Contracts.xml
+++ b/services/Syc.Basic.Web.WMS.Application.Contracts/Syc.Basic.Web.WMS.Application.Contracts.xml
@@ -183,5 +183,20 @@
+
+
+ 设备id
+
+
+
+
+ 设备类型,Scanner : 扫码枪 Balance : 电子秤
+
+
+
+
+ 值
+
+
diff --git a/services/Syc.Basic.Web.WMS.Application.Contracts/WMSApplicationContractsModule.cs b/services/Syc.Basic.Web.WMS.Application.Contracts/WMSApplicationContractsModule.cs
index ba22bb3..e07a2c8 100644
--- a/services/Syc.Basic.Web.WMS.Application.Contracts/WMSApplicationContractsModule.cs
+++ b/services/Syc.Basic.Web.WMS.Application.Contracts/WMSApplicationContractsModule.cs
@@ -16,4 +16,9 @@ public class WMSApplicationContractsModule : AbpModule
{
WMSDtoExtensions.Configure();
}
+
+ public override void PostConfigureServices(ServiceConfigurationContext context)
+ {
+ base.PostConfigureServices(context);
+ }
}
diff --git a/services/Syc.Basic.Web.WMS.Application.Contracts/WebSocket/DeviceMessage.cs b/services/Syc.Basic.Web.WMS.Application.Contracts/WebSocket/DeviceMessage.cs
new file mode 100644
index 0000000..6ec8a29
--- /dev/null
+++ b/services/Syc.Basic.Web.WMS.Application.Contracts/WebSocket/DeviceMessage.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Syc.Basic.Web.WMS.WebSocket
+{
+ public class DeviceMessage
+ {
+ public DeviceMessage()
+ {
+
+ }
+ public DeviceMessage(int id,string type,object value)
+ {
+ Id = id;
+ Type = type;
+ Value = value;
+ }
+ ///
+ /// 设备id
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 设备类型,Scanner : 扫码枪 Balance : 电子秤
+ ///
+ public string Type { get; set; }
+
+ ///
+ /// 值
+ ///
+ public object Value { get; set; }
+ }
+}
diff --git a/services/Syc.Basic.Web.WMS.Application.Contracts/WebSocket/WebSocketManager.cs b/services/Syc.Basic.Web.WMS.Application.Contracts/WebSocket/WebSocketManager.cs
new file mode 100644
index 0000000..84589b3
--- /dev/null
+++ b/services/Syc.Basic.Web.WMS.Application.Contracts/WebSocket/WebSocketManager.cs
@@ -0,0 +1,74 @@
+using System.Collections.Concurrent;
+using System.Net.WebSockets;
+using System.Text;
+using System.Threading.Tasks;
+using System.Threading;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Syc.Basic.Web.WMS
+{
+ // WebSocketManager.cs
+ public class WebSocketManager
+ {
+ private readonly ConcurrentDictionary _sockets = new();
+ private static Lazy socketManager = new Lazy(() => new WebSocketManager());
+ public static WebSocketManager SocketManager => socketManager.Value;
+ public void AddSocket(System.Net.WebSockets.WebSocket socket, string connectionId)
+ {
+ _sockets.TryAdd(connectionId, socket);
+ }
+
+ public async Task RemoveSocket(string connectionId)
+ {
+ if (_sockets.TryRemove(connectionId, out var socket))
+ {
+ await socket.CloseAsync(
+ WebSocketCloseStatus.NormalClosure,
+ "Connection closed",
+ CancellationToken.None);
+ }
+ }
+
+ public async Task SendMessageAsync(string connectionId, string message)
+ {
+ if (_sockets.TryGetValue(connectionId, out var socket))
+ {
+ var buffer = Encoding.UTF8.GetBytes(message);
+ await socket.SendAsync(
+ new ArraySegment(buffer),
+ WebSocketMessageType.Text,
+ true,
+ CancellationToken.None);
+ }
+ }
+
+ public async Task BroadcastAsync(string message)
+ {
+ List keys = new List();
+ foreach (var pair in _sockets)
+ {
+ if (pair.Value.State == WebSocketState.Open)
+ {
+ try
+ {
+ await SendMessageAsync(pair.Key, message);
+ }
+ catch (Exception ex)
+ {
+ keys.Add(pair.Key);
+ }
+ }
+ }
+
+ if (keys.Any())
+ {
+ foreach (var item in keys)
+ {
+ _sockets.Remove(item,out _);
+ }
+ }
+ }
+ }
+}
diff --git a/services/Syc.Basic.Web.WMS.Application/DeviceEventHandle/DefaultScannerEventHandle.cs b/services/Syc.Basic.Web.WMS.Application/DeviceEventHandle/DefaultScannerEventHandle.cs
new file mode 100644
index 0000000..a851f97
--- /dev/null
+++ b/services/Syc.Basic.Web.WMS.Application/DeviceEventHandle/DefaultScannerEventHandle.cs
@@ -0,0 +1,89 @@
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using Seyounth.Auto.Hs.Runtime.Scanner;
+using Syc.Basic.Web.WMS.Entitys;
+using Syc.Basic.Web.WMS.WebSocket;
+using Syc.Core.Tools;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Uow;
+
+namespace Syc.Basic.Web.WMS
+{
+ ///
+ /// 默认的扫码枪扫码触发事件处理
+ ///
+ public class DefaultScannerEventHandle : IScannerEventHandle
+ {
+ private readonly IRepository silkRepository;
+ private readonly IUnitOfWorkManager uowm;
+
+ public DefaultScannerEventHandle(IRepository silkRepository, IUnitOfWorkManager unitOfWork)
+ {
+ this.silkRepository = silkRepository;
+ this.uowm = unitOfWork;
+ }
+
+ ///
+ /// 扫码枪
+ ///
+ ///
+ ///
+ ///
+ public async Task ExecAsync(string code, int id)
+ {
+ using (var uow = uowm.Reserve(UnitOfWork.UnitOfWorkReservationName))
+ {
+ try
+ {
+ /*
+ * 如果有其他的处理写在这里,或者另外建一个类实现IScannerEventHandle接口,
+ */
+ var msg = new DeviceMessage(id, "扫码枪", code);
+ if (!code.IsNullOrWhiteSpace())
+ {
+ var result = await silkRepository.AnyAsync(x => x.Code == code);
+ if (result)
+ msg.Value = $"存在重复编号({code})";
+ }
+ await WebSocketManager.SocketManager.BroadcastAsync(msg.ToJsonString());
+ await uow.CompleteAsync();
+ }
+ catch (Exception ex)
+ {
+ await uow.RollbackAsync();
+ }
+ }
+ }
+
+ public async Task ExecAsync2(string code, int id)
+ {
+ using (var uow = uowm.Reserve(UnitOfWork.UnitOfWorkReservationName))
+ {
+ try
+ {
+ /*
+ * 如果有其他的处理写在这里,或者另外建一个类实现IScannerEventHandle接口,
+ */
+ var msg = new DeviceMessage(id, "体重秤", code);
+ if (!code.IsNullOrWhiteSpace())
+ {
+ var result = await silkRepository.AnyAsync(x => x.Code == code);
+ if (result)
+ msg.Value = $"存在重复编号({code})";
+ }
+ await WebSocketManager.SocketManager.BroadcastAsync(msg.ToJsonString());
+ await uow.CompleteAsync();
+ }
+ catch (Exception ex)
+ {
+ await uow.RollbackAsync();
+ }
+ }
+ }
+ }
+}
diff --git a/services/Syc.Basic.Web.WMS.Application/Dto/BoxDto.cs b/services/Syc.Basic.Web.WMS.Application/Dto/BoxDto.cs
index bb94eb6..15de9c1 100644
--- a/services/Syc.Basic.Web.WMS.Application/Dto/BoxDto.cs
+++ b/services/Syc.Basic.Web.WMS.Application/Dto/BoxDto.cs
@@ -17,7 +17,7 @@ namespace Syc.Basic.Web.WMS.Dto
public string? Lot_No { get; set; }
public double? Length { get; set; }
public DateTime? Dom_Time { get; set; }
- public DateTime? Exp_Time { get; set; }
+ public string Exp_Time { get; set; }
public int IsDelete { get; set; }
}
}
diff --git a/services/Syc.Basic.Web.WMS.Application/Dto/BoxInput.cs b/services/Syc.Basic.Web.WMS.Application/Dto/BoxInput.cs
index b7a232d..80722eb 100644
--- a/services/Syc.Basic.Web.WMS.Application/Dto/BoxInput.cs
+++ b/services/Syc.Basic.Web.WMS.Application/Dto/BoxInput.cs
@@ -6,7 +6,9 @@ using System.Threading.Tasks;
namespace Syc.Basic.Web.WMS.Dto
{
- public class BoxInput:SilkInput
+ public class BoxInput: PagedInput
{
+ public string Lot_No { get; set; }
+ public string Spec { get; set; }
}
}
diff --git a/services/Syc.Basic.Web.WMS.Application/Dto/DelInput.cs b/services/Syc.Basic.Web.WMS.Application/Dto/DelInput.cs
new file mode 100644
index 0000000..4d50683
--- /dev/null
+++ b/services/Syc.Basic.Web.WMS.Application/Dto/DelInput.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Syc.Basic.Web.WMS.Dto
+{
+ public class DelInput
+ {
+ public int[] ids { get; set; }
+ public int id { get; set; }
+ }
+}
diff --git a/services/Syc.Basic.Web.WMS.Application/Dto/PageInput.cs b/services/Syc.Basic.Web.WMS.Application/Dto/PageInput.cs
new file mode 100644
index 0000000..80bcba7
--- /dev/null
+++ b/services/Syc.Basic.Web.WMS.Application/Dto/PageInput.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Syc.Basic.Web.WMS.Dto
+{
+ public class PageInput
+ {
+ public int PageSize { get; set; }
+ public int Page { get; set; }
+ }
+}
diff --git a/services/Syc.Basic.Web.WMS.Application/Dto/ProduceDto.cs b/services/Syc.Basic.Web.WMS.Application/Dto/ProduceDto.cs
index 08325e7..d7ba409 100644
--- a/services/Syc.Basic.Web.WMS.Application/Dto/ProduceDto.cs
+++ b/services/Syc.Basic.Web.WMS.Application/Dto/ProduceDto.cs
@@ -16,7 +16,7 @@ namespace Syc.Basic.Web.WMS.Dto
public string Lot_No { get; set; }
public string Name { get; set; }
public int? Qty { get; set; }
- public DateTime? Exp_Time { get; set; }
+ public string Exp_Time { get; set; }
public int IfUse { get; set; }
public int IsDelete { get; set; }
}
diff --git a/services/Syc.Basic.Web.WMS.Application/Dto/ProduceInput.cs b/services/Syc.Basic.Web.WMS.Application/Dto/ProduceInput.cs
index 5933f97..a48c44d 100644
--- a/services/Syc.Basic.Web.WMS.Application/Dto/ProduceInput.cs
+++ b/services/Syc.Basic.Web.WMS.Application/Dto/ProduceInput.cs
@@ -6,8 +6,9 @@ using System.Threading.Tasks;
namespace Syc.Basic.Web.WMS.Dto
{
- public class ProduceInput:BoxInput
+ public class ProduceInput: PagedInput
{
-
+ public int Id { get; set; }
+ public string Lot_No { get; set; }
}
}
diff --git a/services/Syc.Basic.Web.WMS.Application/Dto/SilkDto.cs b/services/Syc.Basic.Web.WMS.Application/Dto/SilkDto.cs
index cf65638..b0e24cb 100644
--- a/services/Syc.Basic.Web.WMS.Application/Dto/SilkDto.cs
+++ b/services/Syc.Basic.Web.WMS.Application/Dto/SilkDto.cs
@@ -9,13 +9,13 @@ namespace Syc.Basic.Web.WMS.Dto
public class SilkDto
{
public int Id { get; set; }
- public string? Code { get; set; }
- public string? Type { get; set; }
- public string? Spec { get; set; }
+ public string Code { get; set; }
+ public string Type { get; set; }
+ public string Spec { get; set; }
public double? Net_Weight { get; set; }
public double? Length { get; set; }
public DateTime? Date { get; set; }
- public string? Lot_No { get; set; }
+ public string Lot_No { get; set; }
public int IsDelete { get; set; }
}
}
diff --git a/services/Syc.Basic.Web.WMS.Application/Dto/SilkInput.cs b/services/Syc.Basic.Web.WMS.Application/Dto/SilkInput.cs
index 7a37000..80dfa7d 100644
--- a/services/Syc.Basic.Web.WMS.Application/Dto/SilkInput.cs
+++ b/services/Syc.Basic.Web.WMS.Application/Dto/SilkInput.cs
@@ -6,9 +6,9 @@ using System.Threading.Tasks;
namespace Syc.Basic.Web.WMS.Dto
{
- public class SilkInput
+ public class SilkInput: PagedInput
{
- public int[] ids { get; set; }
- public int id { get; set; }
+ public string Lot_No { get; set; }
+ public string Spec { get; set; }
}
}
diff --git a/services/Syc.Basic.Web.WMS.Application/Mapper/SystemMapper.cs b/services/Syc.Basic.Web.WMS.Application/Mapper/SystemMapper.cs
index b56c4a2..1557d3f 100644
--- a/services/Syc.Basic.Web.WMS.Application/Mapper/SystemMapper.cs
+++ b/services/Syc.Basic.Web.WMS.Application/Mapper/SystemMapper.cs
@@ -24,14 +24,14 @@ namespace Syc.Basic.Web.Mapper
.ForMember(dest => dest.Createtime,opt => opt.MapFrom(m => m.createdAt))
.ReverseMap();
- //CreateMap();
- //CreateMap();
+ CreateMap();
+ CreateMap();
- //CreateMap()
- // .ForMember(dest => dest.Net_Weight, opt => opt.MapFrom(m => m.Net_Weight))
- // .ForMember(dest => dest.Length, opt => opt.MapFrom(m => m.Length))
- // .ReverseMap();
- //CreateMap();
+ CreateMap().ReverseMap();
+ CreateMap();
+
+ CreateMap().ReverseMap();
+ CreateMap();
}
}
}
diff --git a/services/Syc.Basic.Web.WMS.Application/ScannerEvent.cs b/services/Syc.Basic.Web.WMS.Application/ScannerEvent.cs
new file mode 100644
index 0000000..004c087
--- /dev/null
+++ b/services/Syc.Basic.Web.WMS.Application/ScannerEvent.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Syc.Basic.Web.WMS
+{
+ internal class ScannerEvent
+ {
+ }
+}
diff --git a/services/Syc.Basic.Web.WMS.Application/Service/BoxService.cs b/services/Syc.Basic.Web.WMS.Application/Service/BoxService.cs
index f47f1cf..82a71f4 100644
--- a/services/Syc.Basic.Web.WMS.Application/Service/BoxService.cs
+++ b/services/Syc.Basic.Web.WMS.Application/Service/BoxService.cs
@@ -2,11 +2,13 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
+using NUglify.Helpers;
using Syc.Basic.Web.WMS.Dto;
using Syc.Basic.Web.WMS.Entitys;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Linq.Dynamic.Core;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
@@ -30,16 +32,17 @@ namespace Syc.Basic.Web.WMS.Service
///
///
[HttpPost]
- public async Task> GetBoxList(BoxDto input)
+ public async Task> GetBoxList(BoxInput input)
{
var boxlist = await boxRepository.GetQueryableAsync();
boxlist = boxlist.Where(x => x.IsDelete == 0);
- if (input.Name != null)
- boxlist = boxlist.Where(x => x.Name.Contains(input.Name));
+ if (input.Lot_No != null)
+ boxlist = boxlist.Where(x => x.Name.Contains(input.Lot_No));
if (input.Spec != null)
boxlist = boxlist.Where(x => x.Spec.Contains(input.Spec));
- var data = boxlist.Select(e => new BoxDto()
+ var result = boxlist.PageResult(input.Page, input.PageSize);
+ var data = result.Queryable.Select(e => new BoxDto()
{
Length = e.Length,
Net_Weight = e.Net_Weight,
@@ -47,7 +50,7 @@ namespace Syc.Basic.Web.WMS.Service
Id = e.Id,
Code = e.Code,
Dom_Time = e.Dom_Time,
- Exp_Time = e.Exp_Time,
+ Exp_Time = e.Exp_Time.ToString(),
Lot_No = e.Lot_No,
Name = e.Name,
Spec = e.Spec,
@@ -56,6 +59,8 @@ namespace Syc.Basic.Web.WMS.Service
PageOutput pageOutput = new PageOutput();
pageOutput.Total = boxlist.Count();
pageOutput.Data = data;
+ pageOutput.PageIndex = input.Page;
+ pageOutput.PageSize=input.PageSize;
return pageOutput;
}
///
@@ -66,11 +71,14 @@ namespace Syc.Basic.Web.WMS.Service
[HttpPost]
public async Task InsertBox(BoxDto input)
{
+ if (await boxRepository.AnyAsync(x => x.Code == input.Code))
+ throw Oops.Oh("条码已存在,不允许添加");
+
var box = new Box()
{
Name = input.Name,
Dom_Time = DateTime.Now,
- Exp_Time = input.Exp_Time,
+ Exp_Time = string.IsNullOrWhiteSpace(input.Exp_Time) ? null : Convert.ToDateTime(input.Exp_Time),
Qty = input.Qty,
Length = input.Length,
Lot_No = input.Lot_No,
@@ -99,7 +107,7 @@ namespace Syc.Basic.Web.WMS.Service
box.Dom_Time = DateTime.Now;
box.Qty = input.Qty;
box.Name = input.Name;
- box.Exp_Time = input.Exp_Time;
+ box.Exp_Time = string.IsNullOrWhiteSpace(input.Exp_Time) ? null : Convert.ToDateTime(input.Exp_Time);
await boxRepository.UpdateAsync(box);
}
///
@@ -108,7 +116,7 @@ namespace Syc.Basic.Web.WMS.Service
///
///
[HttpPost]
- public async Task DeleteBox(BoxInput input)
+ public async Task DeleteBox(DelInput input)
{
var box = await boxRepository.FirstOrDefaultAsync(x => x.Id == input.id);
if (box == null)
@@ -123,7 +131,7 @@ namespace Syc.Basic.Web.WMS.Service
///
///
[HttpPost]
- public async Task DeletesBoxs(BoxInput input)
+ public async Task DeletesBoxs(DelInput input)
{
var boxs = await boxRepository.GetListAsync(x => input.ids.Contains(x.Id));
if (boxs.Count == 0)
diff --git a/services/Syc.Basic.Web.WMS.Application/Service/ProduceService.cs b/services/Syc.Basic.Web.WMS.Application/Service/ProduceService.cs
index cb06f46..6ba5ecd 100644
--- a/services/Syc.Basic.Web.WMS.Application/Service/ProduceService.cs
+++ b/services/Syc.Basic.Web.WMS.Application/Service/ProduceService.cs
@@ -5,6 +5,7 @@ using Syc.Basic.Web.WMS.Entitys;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Linq.Dynamic.Core;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
@@ -22,36 +23,56 @@ namespace Syc.Basic.Web.WMS.Service
this.logger = logger;
}
///
- /// 查询丝锭
+ /// 查询生产
///
///
///
[HttpPost]
- public async Task> GetProduceList(ProduceDto input)
+ public async Task> GetProduceList(ProduceInput input)
{
var list = await produceRepository.GetQueryableAsync();
list = list.Where(x => x.IsDelete == 0);
- var data = list.Select(x => new ProduceDto()
+ if (!string.IsNullOrEmpty(input.Lot_No))
+ list = list.Where(x => x.Lot_No.Contains(input.Lot_No));
+
+ var result = list.PageResult(input.Page, input.PageSize);
+ var data = result.Queryable.Select(x => new ProduceDto()
{
Spec = x.Spec,
Lot_No = x.Lot_No,
Id = x.Id,
Length = x.Length,
Type = x.Type,
- Exp_Time = x.Exp_Time,
+ Exp_Time = x.Exp_Time.ToString(),
IfUse = x.IfUse,
Name = x.Name,
Qty = x.Qty
});
+
PageOutput pageOutput = new PageOutput();
pageOutput.Total = list.Count();
pageOutput.Data = data;
+ pageOutput.PageIndex = input.Page;
+ pageOutput.PageSize = input.PageSize;
return pageOutput;
}
+
///
- /// 添加丝锭
+ /// 通过id查询生产列表
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task> GetProduceListById(ProduceInput input)
+ {
+ var list = await produceRepository.GetListAsync(x => x.IsDelete == 0 && x.Id == input.Id);
+ var data = ObjectMapper.Map(list, new List());
+ return data;
+ }
+ ///
+ /// 添加生产
///
///
///
@@ -75,7 +96,7 @@ namespace Syc.Basic.Web.WMS.Service
Spec = input.Spec,
Type = input.Type,
Qty=input.Qty,
- Exp_Time = input.Exp_Time,
+ Exp_Time = string.IsNullOrWhiteSpace(input.Exp_Time) ? null : Convert.ToDateTime(input.Exp_Time),
IfUse = 1,
Name = input.Name,
IsDelete = 0
@@ -84,7 +105,7 @@ namespace Syc.Basic.Web.WMS.Service
await produceRepository.InsertAsync(produce);
}
///
- /// 修改丝锭
+ /// 修改生产
///
///
///
@@ -98,17 +119,17 @@ namespace Syc.Basic.Web.WMS.Service
produce.Length = input.Length;
produce.Lot_No = input.Lot_No;
produce.Qty = input.Qty;
- produce.Exp_Time = input.Exp_Time;
+ produce.Exp_Time = string.IsNullOrWhiteSpace(input.Exp_Time) ? null : Convert.ToDateTime(input.Exp_Time);
produce.IfUse = input.IfUse;
await produceRepository.UpdateAsync(produce);
}
///
- /// 删除丝锭
+ /// 删除生产
///
///
///
[HttpPost]
- public async Task DeleteProduce(ProduceInput input)
+ public async Task DeleteProduce(DelInput input)
{
var produce = await produceRepository.FirstOrDefaultAsync(x => x.Id == input.id);
if (produce == null)
@@ -118,12 +139,12 @@ namespace Syc.Basic.Web.WMS.Service
}
///
- /// 批量删除丝锭
+ /// 批量删除生产
///
///
///
[HttpPost]
- public async Task DeletesProduces(ProduceInput input)
+ public async Task DeletesProduces(DelInput input)
{
var produces = await produceRepository.GetListAsync(x => input.ids.Contains(x.Id));
if (produces.Count==0)
diff --git a/services/Syc.Basic.Web.WMS.Application/Service/SilkService.cs b/services/Syc.Basic.Web.WMS.Application/Service/SilkService.cs
index 0c1bfd7..35c6008 100644
--- a/services/Syc.Basic.Web.WMS.Application/Service/SilkService.cs
+++ b/services/Syc.Basic.Web.WMS.Application/Service/SilkService.cs
@@ -7,6 +7,7 @@ using Syc.Basic.Web.WMS.Entitys;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Linq.Dynamic.Core;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
@@ -30,14 +31,17 @@ namespace Syc.Basic.Web.WMS.Service
///
///
[HttpPost]
- public async Task> GetSilkList(SilkDto input)
+ public async Task> GetSilkList(SilkInput input)
{
var silklist = await silkRepository.GetQueryableAsync();
silklist = silklist.Where(x => x.IsDelete == 0);
- if (input.Type != null)
- silklist = silklist.Where(x => x.Type.Contains(input.Type));
+ if (input.Spec != null)
+ silklist = silklist.Where(x => x.Type.Contains(input.Spec));
+ if (input.Lot_No != null)
+ silklist = silklist.Where(x => x.Type.Contains(input.Lot_No));
- var data = silklist.Select(x=>new SilkDto()
+ var result = silklist.PageResult(input.Page, input.PageSize);
+ var data = result.Queryable.Select(x=>new SilkDto()
{
Spec=x.Spec,
Net_Weight=x.Net_Weight,
@@ -52,6 +56,8 @@ namespace Syc.Basic.Web.WMS.Service
PageOutput pageOutput = new PageOutput();
pageOutput.Total = silklist.Count();
pageOutput.Data = data;
+ pageOutput.PageIndex = input.Page;
+ pageOutput.PageSize = input.PageSize;
return pageOutput;
}
///
@@ -62,6 +68,9 @@ namespace Syc.Basic.Web.WMS.Service
[HttpPost]
public async Task InsertSilk(SilkDto input)
{
+ if (await silkRepository.AnyAsync(x => x.Code == input.Code))
+ throw Oops.Oh("条码已存在,不允许添加");
+
var silk = new Silk()
{
Date = DateTime.Now,
@@ -100,7 +109,7 @@ namespace Syc.Basic.Web.WMS.Service
///
///
[HttpPost]
- public async Task DeleteSilk(SilkInput input)
+ public async Task DeleteSilk(DelInput input)
{
var silk = await silkRepository.FirstOrDefaultAsync(x => x.Id == input.id);
if (silk == null)
@@ -115,7 +124,7 @@ namespace Syc.Basic.Web.WMS.Service
///
///
[HttpPost]
- public async Task DeletesSilks(SilkInput input)
+ public async Task DeletesSilks(DelInput input)
{
var silks = await silkRepository.GetListAsync(x => input.ids.Contains(x.Id));
if (silks.Count == 0)
diff --git a/services/Syc.Basic.Web.WMS.Application/Syc.Basic.Web.WMS.Application.xml b/services/Syc.Basic.Web.WMS.Application/Syc.Basic.Web.WMS.Application.xml
index 4c3a702..0596f16 100644
--- a/services/Syc.Basic.Web.WMS.Application/Syc.Basic.Web.WMS.Application.xml
+++ b/services/Syc.Basic.Web.WMS.Application/Syc.Basic.Web.WMS.Application.xml
@@ -4,6 +4,19 @@
Syc.Basic.Web.WMS.Application
+
+
+ 默认的扫码枪扫码触发事件处理
+
+
+
+
+ 扫码枪
+
+
+
+
+
账号密码登录
@@ -36,7 +49,7 @@
-
+
查询纸箱
@@ -57,56 +70,63 @@
-
+
删除纸箱
-
+
批量删除纸箱
-
+
- 查询丝锭
+ 查询生产
+
+
+
+
+
+
+ 通过id查询生产列表
- 添加丝锭
+ 添加生产
- 修改丝锭
+ 修改生产
-
+
- 删除丝锭
+ 删除生产
-
+
- 批量删除丝锭
+ 批量删除生产
-
+
查询丝锭
@@ -127,14 +147,14 @@
-
+
删除丝锭
-
+
批量删除丝锭
diff --git a/services/Syc.Basic.Web.WMS.Application/WMSApplicationModule.cs b/services/Syc.Basic.Web.WMS.Application/WMSApplicationModule.cs
index 3b534ad..dca3bec 100644
--- a/services/Syc.Basic.Web.WMS.Application/WMSApplicationModule.cs
+++ b/services/Syc.Basic.Web.WMS.Application/WMSApplicationModule.cs
@@ -1,4 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
+using Seyounth.Auto.Hs.Runtime.Handlers;
+using Seyounth.Auto.Hs.Runtime;
using Syc.Abp.Application.Contracts;
using Syc.Abp.Application.Contracts.Options;
using Syc.Basic.Web.WMS.Entitys;
@@ -38,6 +40,9 @@ public class WMSApplicationModule : AbpModule
});
ConfigureMapper();
+
+ context.Services.AddHs();
+ context.Services.AddScannerEventHandle();
}
private void ConfigureMapper()
diff --git a/services/Syc.Basic.Web.WMS.Domain.Shared/WMSDomainSharedModule.cs b/services/Syc.Basic.Web.WMS.Domain.Shared/WMSDomainSharedModule.cs
index c423be0..7b37f26 100644
--- a/services/Syc.Basic.Web.WMS.Domain.Shared/WMSDomainSharedModule.cs
+++ b/services/Syc.Basic.Web.WMS.Domain.Shared/WMSDomainSharedModule.cs
@@ -42,7 +42,5 @@ public class WMSDomainSharedModule : AbpModule
{
options.MapCodeNamespace("WMS", typeof(WMSResource));
});
-
- context.Services.AddHs();
}
}
\ No newline at end of file
diff --git a/services/Syc.Basic.Web.WMS.Domain/Entitys/Box.cs b/services/Syc.Basic.Web.WMS.Domain/Entitys/Box.cs
index 7eb84c4..76be8cf 100644
--- a/services/Syc.Basic.Web.WMS.Domain/Entitys/Box.cs
+++ b/services/Syc.Basic.Web.WMS.Domain/Entitys/Box.cs
@@ -9,12 +9,12 @@ namespace Syc.Basic.Web.WMS.Entitys
{
public class Box:Entity
{
- public string? Name { get; set; }
- public string? Code { get; set; }
- public string? Spec { get; set; }
+ public string Name { get; set; }
+ public string Code { get; set; }
+ public string Spec { get; set; }
public int? Qty { get; set; }
public double? Net_Weight { get; set; }
- public string? Lot_No { get; set; }
+ public string Lot_No { get; set; }
public double? Length { get; set; }
public DateTime? Dom_Time { get; set; }
public DateTime? Exp_Time { get; set; }
diff --git a/services/Syc.Basic.Web.WMS.Domain/Entitys/Silk.cs b/services/Syc.Basic.Web.WMS.Domain/Entitys/Silk.cs
index 7928c3c..a88429d 100644
--- a/services/Syc.Basic.Web.WMS.Domain/Entitys/Silk.cs
+++ b/services/Syc.Basic.Web.WMS.Domain/Entitys/Silk.cs
@@ -9,13 +9,13 @@ namespace Syc.Basic.Web.WMS.Entitys
{
public class Silk:Entity
{
- public string? Code { get; set; }
- public string? Type { get; set; }
- public string? Spec { get; set; }
+ public string Code { get; set; }
+ public string Type { get; set; }
+ public string Spec { get; set; }
public double? Net_Weight { get; set; }
public double? Length { get; set; }
public DateTime? Date { get; set; }
- public string? Lot_No { get; set; }
+ public string Lot_No { get; set; }
public int IsDelete { get; set; }
}
}