Commit 633f8b75 by Seniorious

1

parent 4f23bed8
...@@ -8,6 +8,7 @@ using Common.Global; ...@@ -8,6 +8,7 @@ using Common.Global;
using Common.Utility.Model; using Common.Utility.Model;
using Common.Utility.RabbitMQ; using Common.Utility.RabbitMQ;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
...@@ -30,6 +31,7 @@ using System.Linq.Expressions; ...@@ -30,6 +31,7 @@ using System.Linq.Expressions;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Security.Cryptography.Xml; using System.Security.Cryptography.Xml;
using System.Text;
using static Common.HttpHelper; using static Common.HttpHelper;
using static Dm.net.buffer.ByteArrayBuffer; using static Dm.net.buffer.ByteArrayBuffer;
using static Microsoft.AspNetCore.Razor.Language.TagHelperMetadata; using static Microsoft.AspNetCore.Razor.Language.TagHelperMetadata;
...@@ -61,13 +63,14 @@ namespace APIs.Controllers ...@@ -61,13 +63,14 @@ namespace APIs.Controllers
private readonly IPoliceInfoService _policeInfoService; private readonly IPoliceInfoService _policeInfoService;
private readonly IBussinessInventoryService _bussinessInventoryService; private readonly IBussinessInventoryService _bussinessInventoryService;
private readonly IBussinessInventoryDetailService _bussinessInventoryDetailService; private readonly IBussinessInventoryDetailService _bussinessInventoryDetailService;
private readonly IChannelService _channelService;
public BaseInfoController(IMapper mapper,IPoliceService policeService, IEquipmentTypeService equipmentTypeService, public BaseInfoController(IMapper mapper,IPoliceService policeService, IEquipmentTypeService equipmentTypeService,
IEquipmentSizeService equipmentSizeService,ICarService carService, IInventoryService inventoryService, IEquipmentSizeService equipmentSizeService,ICarService carService, IInventoryService inventoryService,
IInvService invService, IUsersService usersService, ILogService logService, IDevHistoryService devHistoryService, IInvService invService, IUsersService usersService, ILogService logService, IDevHistoryService devHistoryService,
IDevService devService, IWarehouseService warehouseService, IOrderService orderService, ISupplierService supplierService, IDevService devService, IWarehouseService warehouseService, IOrderService orderService, ISupplierService supplierService,
IThisInfoService thisInfoService, IPrintService printService, IPoliceFingerService policeFingerService, IPoliceInfoService policeInfoService, IThisInfoService thisInfoService, IPrintService printService, IPoliceFingerService policeFingerService, IPoliceInfoService policeInfoService,
IBussinessInventoryService bussinessInventoryService, IBussinessInventoryDetailService bussinessInventoryDetailService) IBussinessInventoryService bussinessInventoryService, IBussinessInventoryDetailService bussinessInventoryDetailService, IChannelService channelService)
{ {
_carService = carService; _carService = carService;
_equipmentSizeService = equipmentSizeService; _equipmentSizeService = equipmentSizeService;
...@@ -88,6 +91,7 @@ namespace APIs.Controllers ...@@ -88,6 +91,7 @@ namespace APIs.Controllers
_policeInfoService = policeInfoService; _policeInfoService = policeInfoService;
_bussinessInventoryService = bussinessInventoryService; _bussinessInventoryService = bussinessInventoryService;
_bussinessInventoryDetailService = bussinessInventoryDetailService; _bussinessInventoryDetailService = bussinessInventoryDetailService;
_channelService = channelService;
Mapper = mapper; Mapper = mapper;
} }
...@@ -160,7 +164,7 @@ namespace APIs.Controllers ...@@ -160,7 +164,7 @@ namespace APIs.Controllers
} }
var httpRes = JsonConvert.DeserializeObject<res<string>>(json); var httpRes = JsonConvert.DeserializeObject<res<string>>(json);
if (httpRes.code != "10000") if (httpRes == null || httpRes.code != "9920")
{ {
await _bussinessInventoryService.OrderRollBack(rs); await _bussinessInventoryService.OrderRollBack(rs);
return new ApiResult return new ApiResult
...@@ -211,14 +215,27 @@ namespace APIs.Controllers ...@@ -211,14 +215,27 @@ namespace APIs.Controllers
}; };
} }
if (req == null || req.order == null || req.logList == null)
{
return new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = "参数错误",
};
}
var src = new ApiResult var rs = await _logService.HandUploadResult(Convert.ToInt64(AdminGlobalContext.jyzbConfig.OrgId), req);
return rs ? new ApiResult
{ {
code = ResultCode.OPERATE_SUCCESS.Code, code = ResultCode.OPERATE_SUCCESS.Code,
msg = ResultCode.OPERATE_SUCCESS.Msg, msg = ResultCode.OPERATE_SUCCESS.Msg,
}: new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = "数据更新失败",
}; };
return src;
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -373,6 +390,55 @@ namespace APIs.Controllers ...@@ -373,6 +390,55 @@ namespace APIs.Controllers
} }
/// <summary> /// <summary>
/// 通道获取配置
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<ApiResult> GetWarehouseConfig([FromBody] GetWarehouseConfigReq req)
{
try
{
if (req == null || string.IsNullOrEmpty(req.deviceId))
{
return new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = "参数错误",
};
}
var config = await _channelService.QueryOne(s => s.id.Equals(req.deviceId));
if (config != null)
{
return new ApiResult
{
code = ResultCode.OPERATE_SUCCESS.Code,
msg = ResultCode.OPERATE_SUCCESS.Msg,
data = config.config,
};
}
else
{
return new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = "无通道配置",
};
}
}
catch (Exception ex)
{
var error = new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = ex.Message,
};
return error;
}
}
/// <summary>
/// 人脸机通过人员标识获取警员信息 /// 人脸机通过人员标识获取警员信息
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
...@@ -449,7 +515,7 @@ namespace APIs.Controllers ...@@ -449,7 +515,7 @@ namespace APIs.Controllers
carNo = s.HkFaceDevice, carNo = s.HkFaceDevice,
createTime = s.createTime, createTime = s.createTime,
updateTime = s.updateTime, updateTime = s.updateTime,
fingerList = fingers.Where(c => c.policeId.Equals(s.id)).ToList(), fingerList = fingers.Where(c => c.policeId.Equals(s.id)).Select(s => new { fingerInfo = s.fingerInfo, fingerNum = s.fingerNum }).ToList(),
}).ToList(); }).ToList();
var src = new ApiResult var src = new ApiResult
...@@ -491,7 +557,7 @@ namespace APIs.Controllers ...@@ -491,7 +557,7 @@ namespace APIs.Controllers
}; };
} }
if (req.state != 0 || req.Epc.Count() != 1) if (req.state != 0 && req.state != 1)
{ {
return new ApiResult return new ApiResult
{ {
...@@ -565,6 +631,8 @@ namespace APIs.Controllers ...@@ -565,6 +631,8 @@ namespace APIs.Controllers
List<Inventory> newEquList = new List<Inventory>(); List<Inventory> newEquList = new List<Inventory>();
List<LogDetail> logDetailList = new List<LogDetail>(); List<LogDetail> logDetailList = new List<LogDetail>();
var policeName = string.IsNullOrEmpty(req.policeId) ? "" : (await _policeInfoService.QueryOne(s => s.id.Equals(req.policeId)))?.name;
var orgInfo = await _thisInfoService.QueryOne(s => true); var orgInfo = await _thisInfoService.QueryOne(s => true);
foreach (var epc in epcList) foreach (var epc in epcList)
{ {
...@@ -575,7 +643,7 @@ namespace APIs.Controllers ...@@ -575,7 +643,7 @@ namespace APIs.Controllers
var mytype = await _equipmentTypeService.QueryOne(s => s.id.Equals(typecode)); var mytype = await _equipmentTypeService.QueryOne(s => s.id.Equals(typecode));
var mysize = await _equipmentSizeService.QueryOne(s => s.typeId.Equals(typecode) && s.code.Equals(sizecode)); var mysize = await _equipmentSizeService.QueryOne(s => s.typeId.Equals(typecode) && s.code.Equals(sizecode));
var mysupplier = await _supplierService.QueryOne(s => s.code.Equals(suppliercode)); ; var mysupplier = await _supplierService.QueryOne(s => s.code.Equals(suppliercode));
if (mytype != null && mysize != null) if (mytype != null && mysize != null)
{ {
...@@ -661,7 +729,7 @@ namespace APIs.Controllers ...@@ -661,7 +729,7 @@ namespace APIs.Controllers
{ {
locationId = req.warehouseId, locationId = req.warehouseId,
locationName = warehouse.name, locationName = warehouse.name,
userName = "", userName = policeName,
useTime = DateTime.Now, useTime = DateTime.Now,
createTime = DateTime.Now, createTime = DateTime.Now,
updateTime = DateTime.Now, updateTime = DateTime.Now,
...@@ -702,6 +770,83 @@ namespace APIs.Controllers ...@@ -702,6 +770,83 @@ namespace APIs.Controllers
} }
/// <summary> /// <summary>
/// 更新警员指纹
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<ApiResult> UpdateFinger([FromBody] UpdateFingerReq req)
{
try
{
if(req == null)
{
return new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = "参数错误",
};
}else if(string.IsNullOrEmpty(req.policeId))
{
return new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = "警员编号为空",
};
}else if(req.fingerList == null || req.fingerList.Count() == 0)
{
return new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = "指纹信息为空",
};
}
var police = await _policeInfoService.QueryOne(s => s.id.Equals(req.policeId));
if(police == null)
{
return new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = "无警员信息",
};
}else
{
var json = HttpHelper.HttpPost(AdminGlobalContext.jyzbConfig.Url + "BussinessInventory/UpdateFinger", JsonConvert.SerializeObject(req));
var httprs = JsonConvert.DeserializeObject<HttpHelper.res<string>>(json);
if(httprs != null && httprs.code == "9920")
{
var rs = await _policeFingerService.UpdateFinger(req.policeId, req.fingerList);
return new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = ResultCode.OPERATE_FAILED.Msg,
};
}
else
{
return new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = "上传平台失败",
};
}
}
}
catch (Exception ex)
{
var error = new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = ex.Message,
};
return error;
}
}
/// <summary>
/// 获取装备类别 /// 获取装备类别
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
......
namespace APIs.Req using Models.Table;
namespace APIs.Req
{ {
public class CommonReq public class CommonReq
{ {
...@@ -25,4 +27,15 @@ ...@@ -25,4 +27,15 @@
{ {
public string warehouseId { get; set; } public string warehouseId { get; set; }
} }
public class GetWarehouseConfigReq
{
public string deviceId { get; set; }
}
public class UpdateFingerReq
{
public string policeId { get; set; }
public List<PoliceFinger> fingerList { get; set; }
}
} }
\ No newline at end of file
...@@ -77,6 +77,7 @@ namespace APIs ...@@ -77,6 +77,7 @@ namespace APIs
services.AddScoped<IPoliceFingerService, PoliceFingerService>(); services.AddScoped<IPoliceFingerService, PoliceFingerService>();
services.AddScoped<IBussinessInventoryService, BussinessInventoryService>(); services.AddScoped<IBussinessInventoryService, BussinessInventoryService>();
services.AddScoped<IBussinessInventoryDetailService, BussinessInventoryDetailService>(); services.AddScoped<IBussinessInventoryDetailService, BussinessInventoryDetailService>();
services.AddScoped<IChannelService, ChannelService>();
#endregion #endregion
#region Repository #region Repository
...@@ -103,6 +104,7 @@ namespace APIs ...@@ -103,6 +104,7 @@ namespace APIs
services.AddScoped<IPoliceFingerRepository, PoliceFingerRepository>(); services.AddScoped<IPoliceFingerRepository, PoliceFingerRepository>();
services.AddScoped<IBussinessInventoryRepository, BussinessInventoryRepository>(); services.AddScoped<IBussinessInventoryRepository, BussinessInventoryRepository>();
services.AddScoped<IBussinessInventoryDetailRepository, BussinessInventoryDetailRepository>(); services.AddScoped<IBussinessInventoryDetailRepository, BussinessInventoryDetailRepository>();
services.AddScoped<IChannelRepository, ChannelRepository>();
#endregion #endregion
#region 注册RabbitMQ消费者 #region 注册RabbitMQ消费者
......
...@@ -64,12 +64,13 @@ namespace Common.Utility.Model ...@@ -64,12 +64,13 @@ namespace Common.Utility.Model
public int? state { get; set; } public int? state { get; set; }
public string warehouseId { get; set; } public string warehouseId { get; set; }
public string picture { get; set; } public string picture { get; set; }
public string policeId { get; set; }
} }
public class HandResultReq public class HandResultReq
{ {
public OrderDetail order { get; set; } public OrderDetail order { get; set; }
public List<LogSummary> logList { get; set; } public List<LogSummary> logList { get; set; }
public List<Inventory>? purchaseList { get; set; }
} }
} }
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Models.Table
{
[SugarTable("base_warehouse_channel")]
public class Channel : BaseTable
{
[SugarColumn(IsPrimaryKey = true)]
public string id { get; set; }
[SugarColumn(ColumnName = "warehouse_id")]
public string warehouseId { get; set; }
[SugarColumn(ColumnName = "config")]
public string config { get; set; }
}
}
...@@ -30,5 +30,10 @@ namespace Models.Table ...@@ -30,5 +30,10 @@ namespace Models.Table
///</summary> ///</summary>
[SugarColumn(ColumnName="finger_info" )] [SugarColumn(ColumnName="finger_info" )]
public string fingerInfo { get; set; } public string fingerInfo { get; set; }
/// <summary>
/// 指纹编号
///</summary>
[SugarColumn(ColumnName = "finger_num")]
public string fingerNum { get; set; }
} }
} }
...@@ -8,7 +8,7 @@ using System.Threading.Tasks; ...@@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace Models.Table namespace Models.Table
{ {
[SugarTable("base_warehouse")] [SugarTable("base_warehouse")]
public class Warehouse : BaseTable public class Warehouse
{ {
[SugarColumn(IsPrimaryKey = true)] [SugarColumn(IsPrimaryKey = true)]
public string id { get; set; } public string id { get; set; }
......
...@@ -10,6 +10,6 @@ namespace Repositories.IRepository.IBussiness ...@@ -10,6 +10,6 @@ namespace Repositories.IRepository.IBussiness
public interface IBussinessInventoryRepository : IBaseRepository<BussinessInventory> public interface IBussinessInventoryRepository : IBaseRepository<BussinessInventory>
{ {
Task<BussinessInventory>? GenerateInventoryOrder(BussinessInventory myBIOrder); Task<BussinessInventory>? GenerateInventoryOrder(BussinessInventory myBIOrder);
async Task<bool> OrderRollBack(BussinessInventory myBIOrder); Task<bool> OrderRollBack(BussinessInventory myBIOrder);
} }
} }
using Models.Table;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Repositories.IRepository.IBussiness
{
public interface IChannelRepository : IBaseRepository<Channel>
{
}
}
 
using Common.Utility.Model;
using Models.SqlModel; using Models.SqlModel;
using Models.Table; using Models.Table;
using System; using System;
...@@ -17,5 +18,6 @@ namespace Repositories.IRepository.IBussiness ...@@ -17,5 +18,6 @@ namespace Repositories.IRepository.IBussiness
Task<bool> AddChannelLog(OrderMain? myOrder, LogSummary summary, List<Inventory> newInvs, Tuple<string, string> inv_states); Task<bool> AddChannelLog(OrderMain? myOrder, LogSummary summary, List<Inventory> newInvs, Tuple<string, string> inv_states);
Task<bool> HandUploadResult(long? orgid, HandResultReq req);
} }
} }
...@@ -9,5 +9,6 @@ namespace Repositories.IRepository.IBussiness ...@@ -9,5 +9,6 @@ namespace Repositories.IRepository.IBussiness
{ {
public interface IPoliceFingerRepository : IBaseRepository<PoliceFinger> public interface IPoliceFingerRepository : IBaseRepository<PoliceFinger>
{ {
Task<bool> UpdateFinger(string policeId, List<PoliceFinger> fingers);
} }
} }
using Models.Table;
using Repositories.IRepository.IBussiness;
using Repositories.IRepository.IUnitOfWork;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Repositories.Repository.Bussiness
{
public class ChannelRepository : BaseRepository<Channel>, IChannelRepository
{
public ChannelRepository(ILocalSugarUnitOfWork sugarUnitOfWork) : base(sugarUnitOfWork)
{
}
}
}
using AutoMapper; using AutoMapper;
using Common.Utility.Model;
using Models.SqlModel; using Models.SqlModel;
using Models.Table; using Models.Table;
using Repositories.IRepository.IBussiness; using Repositories.IRepository.IBussiness;
...@@ -21,6 +22,176 @@ namespace Repositories.Repository.Bussiness ...@@ -21,6 +22,176 @@ namespace Repositories.Repository.Bussiness
_suger = sugarUnitOfWork; _suger = sugarUnitOfWork;
} }
public async Task<bool> HandUploadResult(long? orgid, HandResultReq req)
{
using (var context = _suger.GetDbClient())
{
try
{
context.BeginTran();
//更新主单
var mainOrder = context.Queryable<OrderMain>().First(x => x.id.Equals(req.order.orderId));
mainOrder.actualQuantity += req.order.actualNum;
mainOrder.price += req.order.price;
mainOrder.updateTime = DateTime.Now;
context.Updateable(mainOrder)
.WhereColumns(s => new { s.actualQuantity, s.price, s.updateTime })
.ExecuteCommand();
//更新子单
req.order.updateTime = DateTime.Now;
context.Updateable(req.order)
.WhereColumns(s => new { s.actualNum, s.price, s.updateTime })
.PublicSetColumns(s => s.price, "+")//price += s.price
.PublicSetColumns(s => s.actualNum, "+")
.ExecuteCommand();
//新装备
bool isNewEqu = false;
bool isPurchase = false;
List<Inventory> newEquList = new List<Inventory>();
List<PrintDetail> periodInfoList = new List<PrintDetail>();//采购装备质保期维保期生产日期等信息
List<string> newEquOrderType = new List<string>() { "purchase", "gift", "allocate" };
if (newEquOrderType.Contains(mainOrder.bussinessType) && mainOrder.orderType.Equals("in"))
{
isNewEqu = true;
periodInfoList = context.Queryable<PrintDetail>().Where(s => s.orderId.Equals(mainOrder.id)).ToList();
if (mainOrder.bussinessType.Equals("purchase"))
{
isPurchase = true;
}
}
List<string> InventoryIds = new List<string>();
//出入库记录
var supplierDic = context.Queryable<Supplier>().ToList();
req.logList.ForEach(s =>
{
s.isUpload = 0;
s.useTime = DateTime.Now;
s.createTime = DateTime.Now;
s.updateTime = DateTime.Now;
s.DetailList.ForEach(c =>
{
var mySup = supplierDic.FirstOrDefault(a => a.code.Equals(c.supplierName));
if (!string.IsNullOrEmpty(c.inventoryId)) InventoryIds.Add(c.inventoryId);
c.createTime = DateTime.Now;
c.updateTime = DateTime.Now;
c.errorState = 0;
c.state = s.outInState == "in" ? 0 : 1;
c.supplierId = mySup?.id;
c.supplierName = mySup?.name;
//新装备
if (isNewEqu)
{
var equ = new Inventory()
{
id = Guid.NewGuid().ToString(),
equipmentType = "0",
typeId = c.equipmentTypeId,
typeName = c.equipmentName,
sizeId = c.equipmentSizeId,
sizeName = c.equipmentSize,
supplierId = mySup?.id,
supplierName = mySup?.name,
epc = c.epc,
orgId = orgid,
state = "0",
lostFlag = "0",
price = c.price,
locationType = "0",
locationId = s.locationId,
equState = "normal",
bussinessState = "normal",
createTime = DateTime.Now,
updateTime = DateTime.Now,
};
c.inventoryId = equ.id;
if (isPurchase)
{
var myperiod = periodInfoList?.FirstOrDefault(b => b.sizeId.Equals(c.equipmentSizeId));
equ.state = "2";
equ.maintenancePeriod = myperiod?.maintenancePeriod?.ToString();
equ.warrantyPeriod = myperiod?.warrantyPeriod?.ToString();
equ.productionDate = myperiod?.productionDate;
}
newEquList.Add(equ);
}
});
});
context.Insertable(req).ExecuteCommand();
if(newEquList != null && newEquList.Count() > 0)
{
context.Insertable(newEquList).ExecuteCommand();
}
#region 更新装备状态
var target_bussinessState = "normal";
var target_equState = "normal";
if (mainOrder.orderType.Equals("out"))//获取装备应设为的状态
{
switch (mainOrder.bussinessType)
{
case "allocate":
target_bussinessState = "transfer";
break;
case "use":
target_bussinessState = "take";
break;
case "remove":
target_bussinessState = "remove";
break;
case "destruction":
target_bussinessState = "destruction";
target_equState = "destory";
break;
case "repair":
target_bussinessState = "repair";
target_equState = "fix";
break;
default:
break;
}
}
if(InventoryIds.Count() > 0)
{
context.Updateable<Inventory>()
.Where(s => InventoryIds.Contains(s.id))
.ReSetValue(it =>
{
it.bussinessState = target_bussinessState;
it.equState = target_equState;
it.updateTime = DateTime.Now;
})
.ExecuteCommand();
}
#endregion
context.CommitTran();
return true;
}
catch (Exception e)
{
return false;
}
}
}
public async Task<bool> AddChannelLog(OrderMain? myOrder, LogSummary summary, List<Inventory> newInvs, Tuple<string,string> inv_states) public async Task<bool> AddChannelLog(OrderMain? myOrder, LogSummary summary, List<Inventory> newInvs, Tuple<string,string> inv_states)
{ {
using (var context = _suger.GetDbClient()) using (var context = _suger.GetDbClient())
...@@ -43,11 +214,12 @@ namespace Repositories.Repository.Bussiness ...@@ -43,11 +214,12 @@ namespace Repositories.Repository.Bussiness
var logrs = context.InsertNav(summary).Include(z1 => z1.DetailList).ExecuteCommand(); var logrs = context.InsertNav(summary).Include(z1 => z1.DetailList).ExecuteCommand();
//更新库存状态 //更新库存状态
var state = newInvs != null && newInvs.Count() > 0 ? "2" : summary.outInState.Equals("out") ? "1" : "0";
var invIds = summary.DetailList.Select(a => a.inventoryId).ToList(); var invIds = summary.DetailList.Select(a => a.inventoryId).ToList();
context.Updateable<Inventory>().Where(s => invIds.Contains(s.id)) context.Updateable<Inventory>().Where(s => invIds.Contains(s.id))
.SetColumns(i => new Inventory() .SetColumns(i => new Inventory()
{ {
state = newInvs != null && newInvs.Count() > 0 ? "2" : summary.outInState.Equals("out") ? "1" : "0", state = state,
bussinessState = inv_states.Item1, bussinessState = inv_states.Item1,
equState = inv_states.Item2, equState = inv_states.Item2,
updateTime = DateTime.Now updateTime = DateTime.Now
...@@ -169,5 +341,6 @@ namespace Repositories.Repository.Bussiness ...@@ -169,5 +341,6 @@ namespace Repositories.Repository.Bussiness
} }
return true; return true;
} }
} }
} }
using Models.Table; using AutoMapper;
using Models.Table;
using Repositories.IRepository.IBussiness; using Repositories.IRepository.IBussiness;
using Repositories.IRepository.IUnitOfWork; using Repositories.IRepository.IUnitOfWork;
using System; using System;
...@@ -11,9 +12,41 @@ namespace Repositories.Repository.Bussiness ...@@ -11,9 +12,41 @@ namespace Repositories.Repository.Bussiness
{ {
public class PoliceFingerRepository : BaseRepository<PoliceFinger>, IPoliceFingerRepository public class PoliceFingerRepository : BaseRepository<PoliceFinger>, IPoliceFingerRepository
{ {
protected readonly ILocalSugarUnitOfWork _suger;
public IMapper mapper;
public PoliceFingerRepository(ILocalSugarUnitOfWork sugarUnitOfWork) : base(sugarUnitOfWork) public PoliceFingerRepository(ILocalSugarUnitOfWork sugarUnitOfWork) : base(sugarUnitOfWork)
{ {
_suger = sugarUnitOfWork;
}
public async Task<bool> UpdateFinger(string policeId, List<PoliceFinger> fingers)
{
using (var context = _suger.GetDbClient())
{
try
{
fingers.ForEach(s =>
{
s.policeId = policeId;
s.createTime = DateTime.Now;
s.updateTime = DateTime.Now;
});
//新增或更新
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 })//不更新字段
.ExecuteCommand();
return true;
}
catch (Exception e)
{
return false;
}
}
} }
} }
} }
...@@ -29,7 +29,7 @@ namespace Services ...@@ -29,7 +29,7 @@ namespace Services
return _bussinessInventoryRepository.GenerateInventoryOrder(myBIOrder); return _bussinessInventoryRepository.GenerateInventoryOrder(myBIOrder);
} }
public async Task<bool> OrderRollBack(BussinessInventory myBIOrder) public Task<bool> OrderRollBack(BussinessInventory myBIOrder)
{ {
return _bussinessInventoryRepository.OrderRollBack(myBIOrder); return _bussinessInventoryRepository.OrderRollBack(myBIOrder);
} }
......
using Models.Table;
using Repositories.IRepository.IBussiness;
using Services.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Services
{
public class ChannelService : BaseService<Channel>, IChannelService
{
private readonly IChannelRepository _channelRepository;
public ChannelService(IChannelRepository channelRepository)
{
base.BaseDal = channelRepository;
_channelRepository = channelRepository;
}
}
}
...@@ -10,6 +10,6 @@ namespace Services.Interface ...@@ -10,6 +10,6 @@ namespace Services.Interface
public interface IBussinessInventoryService : IBaseServices<BussinessInventory> public interface IBussinessInventoryService : IBaseServices<BussinessInventory>
{ {
Task<BussinessInventory>? GenerateInventoryOrder(BussinessInventory myBIOrder); Task<BussinessInventory>? GenerateInventoryOrder(BussinessInventory myBIOrder);
async Task<bool> OrderRollBack(BussinessInventory myBIOrder); Task<bool> OrderRollBack(BussinessInventory myBIOrder);
} }
} }
using Models.Table;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Services.Interface
{
public interface IChannelService : IBaseServices<Channel>
{
}
}
...@@ -20,5 +20,7 @@ namespace Services.Interface ...@@ -20,5 +20,7 @@ namespace Services.Interface
Task<bool> AddHandLogs(HandRecordsReq model); Task<bool> AddHandLogs(HandRecordsReq model);
Task<bool> AddChannelLog(OrderMain? myOrder, LogSummary summary, List<Inventory> newInvs); Task<bool> AddChannelLog(OrderMain? myOrder, LogSummary summary, List<Inventory> newInvs);
Task<bool> HandUploadResult(long? orgid, HandResultReq req);
} }
} }
...@@ -9,5 +9,6 @@ namespace Services.Interface ...@@ -9,5 +9,6 @@ namespace Services.Interface
{ {
public interface IPoliceFingerService : IBaseServices<PoliceFinger> public interface IPoliceFingerService : IBaseServices<PoliceFinger>
{ {
Task<bool> UpdateFinger(string policeId, List<PoliceFinger> fingers);
} }
} }
...@@ -28,6 +28,11 @@ namespace Services ...@@ -28,6 +28,11 @@ namespace Services
mapper = _mapper; mapper = _mapper;
} }
public Task<bool> HandUploadResult(long? orgid, HandResultReq req)
{
return _logSummaryRepository.HandUploadResult(orgid, req);
}
public Task<bool> AddChannelLog(OrderMain? myOrder, LogSummary summary, List<Inventory> newInvs) public Task<bool> AddChannelLog(OrderMain? myOrder, LogSummary summary, List<Inventory> newInvs)
{ {
var rs1 = "normal";//bussiness_state var rs1 = "normal";//bussiness_state
...@@ -134,5 +139,6 @@ namespace Services ...@@ -134,5 +139,6 @@ namespace Services
}).ToList(); }).ToList();
return _logSummaryRepository.AddLogs(log, inveqList, invCarList); return _logSummaryRepository.AddLogs(log, inveqList, invCarList);
} }
} }
} }
...@@ -18,5 +18,9 @@ namespace Services ...@@ -18,5 +18,9 @@ namespace Services
_policeFingerRepository = policeFingerRepository; _policeFingerRepository = policeFingerRepository;
} }
public Task<bool> UpdateFinger(string policeId, List<PoliceFinger> fingers)
{
return _policeFingerRepository.UpdateFinger(policeId, fingers);
}
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论