Commit 9fd46a7f by Seniorious

1

parent 6c3db362
......@@ -19,8 +19,8 @@ namespace APIs.Req
public class UpdateHKPictureReq
{
public byte[] picture { get; set; }
public string policeId { get; set; }
public string photo { get; set; }
}
public class GetInventoryOrderReq
......@@ -31,6 +31,7 @@ namespace APIs.Req
public class GetWarehouseConfigReq
{
public string deviceId { get; set; }
public string warehouseId { get; set; }
}
public class UpdateFingerReq
......
......@@ -30,6 +30,8 @@ namespace Common
/*---------以下为2.0版本新增参数,以下参数用于替换生产日期之后的字段,确保真唯一-----------*/
public ulong TimeSpan { get; set; } //当前日期时间戳,精确到毫秒
public byte MachineNum { get; set; } //服务器识别码(4bits),用于区分测试服务器与正式服务器生成的数据,实际1b就够了,其他3b做保留
/*---------以下为警用装备3.0添加参数-----------*/
public byte EType { get; set; } //1单标签 2双标签 3三标签(兼容2.0标签 2.0解析输出0)
}
public static class EpcConvert
......@@ -128,6 +130,11 @@ namespace Common
SetData(ref buf, pos, 12, epc.NoInBox);
pos += 12;
SetData(ref buf, pos, 4, epc.MachineNum);
pos += 4;
/*----------------警用装备3.0字段-------------*/
SetData(ref buf, pos, 4, epc.EType);
pos += 4;
// 双字节对齐, 剩余保留区
if (pos % 16 != 0)
......@@ -260,6 +267,8 @@ namespace Common
pos += 12;
rtn.MachineNum = (byte)GetData(epc, pos, 4);
pos += 4;
rtn.EType = (byte)GetData(epc, pos, 4);
pos += 4;
}
else
{
......@@ -286,6 +295,122 @@ namespace Common
return rtn;
}
//非单标签还原(jyzb3.0)
public static string RestoreEpc(string info)
{
var epc = ToHexByte(info);
var crc_chk = Crc16(epc, epc.Length - 2);
var crc_src = epc[epc.Length - 2] << 8 | epc[epc.Length - 1];
if (crc_src != crc_chk)
{
throw new Exception("CRC校验失败");
}
// 数据解析
Analyzingepc rtn = new Analyzingepc();
int pos = 0;
rtn.Header = (byte)GetData(epc, pos, 8);
pos += 8;
rtn.IssuerId = (byte)GetData(epc, pos, 6);
pos += 6;
var oc = GetData(epc, pos, 54);
rtn.OrganizationCode = OrganizationCodeToStr(oc);
pos += 54;
rtn.WzdmLen = (byte)(GetData(epc, pos, 4));
pos += 4;
var wzlen = ((rtn.WzdmLen - 1) % 8) * 8;
rtn.Wzdm = GetData(epc, pos, wzlen);
pos += wzlen;
rtn.Hxdm = GetData(epc, pos, 8);
pos += 8;
rtn.SerialLen = (byte)GetData(epc, pos, 4);
pos += 4;
rtn.Ver = (byte)GetData(epc, pos, 8);
pos += 8;
rtn.ProductionDate = (UInt32)GetData(epc, pos, 24);
pos += 24;
rtn.ExpiryDate = (byte)GetData(epc, pos, 6);
pos += 6;
rtn.ExpiryDateUnit = (byte)GetData(epc, pos, 2);
pos += 2;
rtn.TimeSpan = (ulong)GetData(epc, pos, 48);
pos += 48;
rtn.NoInBox = (UInt16)GetData(epc, pos, 12);
pos += 12;
rtn.MachineNum = (byte)GetData(epc, pos, 4);
pos += 4;
rtn.EType = (byte)GetData(epc, pos, 4);
pos += 4;
rtn.EType = 1;
string baseEpc = Hex16ByteToHex16String(EpcConvert.Epc2Gen(rtn)).Replace(" ", "");
return baseEpc;
}
//补充生成多标签(jyzb3.0)
public static List<string> SupplementEpc(string info, int etype)
{
var epc = ToHexByte(info);
var crc_chk = Crc16(epc, epc.Length - 2);
var crc_src = epc[epc.Length - 2] << 8 | epc[epc.Length - 1];
if (crc_src != crc_chk)
{
throw new Exception("CRC校验失败");
}
// 数据解析
Analyzingepc rtn = new Analyzingepc();
int pos = 0;
rtn.Header = (byte)GetData(epc, pos, 8);
pos += 8;
rtn.IssuerId = (byte)GetData(epc, pos, 6);
pos += 6;
var oc = GetData(epc, pos, 54);
rtn.OrganizationCode = OrganizationCodeToStr(oc);
pos += 54;
rtn.WzdmLen = (byte)(GetData(epc, pos, 4));
pos += 4;
var wzlen = ((rtn.WzdmLen - 1) % 8) * 8;
rtn.Wzdm = GetData(epc, pos, wzlen);
pos += wzlen;
rtn.Hxdm = GetData(epc, pos, 8);
pos += 8;
rtn.SerialLen = (byte)GetData(epc, pos, 4);
pos += 4;
rtn.Ver = (byte)GetData(epc, pos, 8);
pos += 8;
rtn.ProductionDate = (UInt32)GetData(epc, pos, 24);
pos += 24;
rtn.ExpiryDate = (byte)GetData(epc, pos, 6);
pos += 6;
rtn.ExpiryDateUnit = (byte)GetData(epc, pos, 2);
pos += 2;
rtn.TimeSpan = (ulong)GetData(epc, pos, 48);
pos += 48;
rtn.NoInBox = (UInt16)GetData(epc, pos, 12);
pos += 12;
rtn.MachineNum = (byte)GetData(epc, pos, 4);
pos += 4;
rtn.EType = (byte)GetData(epc, pos, 4);
pos += 4;
List<string> epcList = new List<string>();
for (int i = 2; i <= etype; i++)
{
rtn.EType = Convert.ToByte(i);
epcList.Add(Hex16ByteToHex16String(EpcConvert.Epc2Gen(rtn)).Replace(" ", ""));
}
return epcList;
}
/// <summary>
/// 向目标数组指定位置插入数据
/// </summary>
......
......@@ -13,7 +13,7 @@ namespace Models.Table
[SugarTable("base_equipment_size")]
public class EquipmentSize: BaseTable
{
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
[SugarColumn(IsPrimaryKey = true)]
public string id { get; set; }
......
......@@ -12,7 +12,7 @@ namespace Models.SqlModel
[SugarTable("base_equipment_type")]
public class EquipmentType : BaseTable
{
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
[SugarColumn(IsPrimaryKey = true)]
public string id { get; set; }
public string name { get; set; }
......
......@@ -13,7 +13,7 @@ namespace Models.Table
[SugarTable("base_inventory")]
public class Inventory : BaseTable
{
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
[SugarColumn(IsPrimaryKey = true)]
public string id { get; set; }
[SugarColumn(ColumnName = "type_id")]
......
......@@ -13,7 +13,7 @@ namespace Models.Table
/// <summary>
/// 指纹id
///</summary>
[SugarColumn(ColumnName="id" ,IsPrimaryKey = true ,IsIdentity = true )]
[SugarColumn(IsPrimaryKey = true ,IsIdentity = true)]
public int id { get; set; }
/// <summary>
/// 警员id
......
......@@ -33,11 +33,34 @@ namespace Repositories.Repository.Bussiness
});
//新增或更新
var x = context.Storageable(fingers).ToStorage();
x.AsInsertable.ExecuteCommand();
x.AsUpdateable.WhereColumns(s => new { s.id, s.fingerNum })//查询字段
.UpdateColumns(s => new { s.fingerInfo, s.updateTime })//更新字段
.IgnoreColumns(s => new { s.policeId, s.fingerNum, s.createTime })//不更新字段
//var x = context.Storageable(fingers).WhereColumns(s => new { s.policeId, s.fingerNum }).ToStorage();
//x.AsInsertable.IgnoreColumns(s => s.id).ExecuteCommand();
//x.AsUpdateable.WhereColumns(s => new { s.policeId, s.fingerNum })//查询字段
// .UpdateColumns(s => new { s.fingerInfo, s.updateTime })//更新字段
// //.IgnoreColumns(s => new { s.policeId, s.fingerNum, s.createTime })//不更新字段
// .ExecuteCommand();
var fingerinfo = context.Queryable<PoliceFinger>().Where(s => s.policeId.Equals(policeId)).ToList();
var updateDic = fingerinfo.Select(s => s.fingerNum).ToList();
var updateList = new List<PoliceFinger>();
var insertList = new List<PoliceFinger>();
fingers.ForEach(s =>
{
if (updateDic.Contains(s.fingerNum))
{
updateList.Add(s);
}
else
{
insertList.Add(s);
}
});
if (insertList.Any()) context.Insertable(insertList).ExecuteCommand();
if (updateList.Any()) context.Updateable(updateList)
.WhereColumns(it => new { it.policeId, it.fingerNum })
.UpdateColumns(it => new { it.fingerInfo, it.updateTime })
.ExecuteCommand();
return true;
......
......@@ -3,6 +3,7 @@ using Models.Table;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
......@@ -11,5 +12,6 @@ namespace Services.Interface
public interface IOrderService : IBaseServices<OrderMain>
{
Task<object> QueryHandOrder(string warehouseId);
Task<OrderMain?> QueryOrder(Expression<Func<OrderMain, bool>> exp);
}
}
......@@ -6,6 +6,7 @@ using Services.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
......@@ -29,5 +30,12 @@ namespace Services
{
return _orderMainRepository.QueryHandOrder(warehouseId);
}
public async Task<OrderMain?> QueryOrder(Expression<Func<OrderMain, bool>> exp)
{
var main = await _orderMainRepository.QueryOne(exp);
if (main != null) main.DetailList = await _orderDetailRepository.Query(s => s.orderId.Equals(main.id));
return main;
}
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论