Commit c734d17c by zxw

单警柜切换模式

物资详情换orgid
第三方停启用状态
第三方批量完成打印单
统计导出调整
parent 4366ac90
...@@ -274,7 +274,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -274,7 +274,7 @@ namespace JunmpPoliceStation.Controllers
/// <param name="jdata"></param> /// <param name="jdata"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("ChangeCabinetType")] [HttpPost("ChangeCabinetType")]
[NoSign]
public async Task<HttpResponseMessage> ChangeCabinetType([FromBody] JObject jdata) public async Task<HttpResponseMessage> ChangeCabinetType([FromBody] JObject jdata)
{ {
return await Task.Run(() => return await Task.Run(() =>
...@@ -317,12 +317,20 @@ namespace JunmpPoliceStation.Controllers ...@@ -317,12 +317,20 @@ namespace JunmpPoliceStation.Controllers
var innerInv = updateInv.Where(x => x.CurrentState == 3).ToList(); var innerInv = updateInv.Where(x => x.CurrentState == 3).ToList();
if (innerInv.Count > 0) if (innerInv.Count > 0)
{ {
return JsonManager.SimpleStatusResponse(ResultCode.CABINET_INVENTORY_EXIST); //return JsonManager.SimpleStatusResponse(ResultCode.CABINET_INVENTORY_EXIST);
//清除物资绑定
foreach (var inventory in innerInv)
{
inventory.CabinetId = null;
inventory.CurrentState = 8;
updateInvs.Add(inventory);
}
} }
var outInv = updateInv.Where(x => x.CurrentState == 7).ToList(); var outInv = updateInv.Where(x => x.CurrentState == 7).ToList();
foreach (var Inv in outInv) foreach (var Inv in outInv)
{ {
Inv.CabinetId = null; Inv.CabinetId = null;
Inv.CurrentState = 8;
updateInvs.Add(Inv); updateInvs.Add(Inv);
} }
} }
......
...@@ -9222,11 +9222,11 @@ namespace JunmpPoliceStation.Controllers ...@@ -9222,11 +9222,11 @@ namespace JunmpPoliceStation.Controllers
{ {
if (entity.level == "本级") if (entity.level == "本级")
{ {
expression = t => t.WarehouseCodeNavigation.OrgizationId.Equals(OrgId); expression = t => t.OrgId.Equals(OrgId);
} }
else else
{ {
expression = t => dataList.Select(c => c.Id).Contains(t.WarehouseCodeNavigation.OrgizationId); expression = t => dataList.Select(c => c.Id).Contains(t.OrgId);
} }
} }
else else
...@@ -9289,11 +9289,18 @@ namespace JunmpPoliceStation.Controllers ...@@ -9289,11 +9289,18 @@ namespace JunmpPoliceStation.Controllers
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 6 && t.IsFixed == true); expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 6 && t.IsFixed == true);
break; break;
} }
case "单警柜装备":
case "单警柜中": case "单警柜中":
{ {
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 3 || t.CurrentState == 7); expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 3 || t.CurrentState == 7);
break; break;
} }
case "仓库装备":
{
//(不包括单警柜的装备)
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 3 && t.CurrentState != 7);
break;
}
default: default:
break; break;
} }
...@@ -9399,8 +9406,8 @@ namespace JunmpPoliceStation.Controllers ...@@ -9399,8 +9406,8 @@ namespace JunmpPoliceStation.Controllers
equipment.EquipmentCode, equipment.EquipmentCode,
warehouseName = equipment.WarehouseCodeNavigation?.Name, warehouseName = equipment.WarehouseCodeNavigation?.Name,
equipment.WarehouseCode, equipment.WarehouseCode,
equipment.WarehouseCodeNavigation?.Orgization?.Name, equipment.Org?.Name,
equipment.WarehouseCodeNavigation?.OrgizationId, equipment.OrgId,
supplierName = equipment.SupplierCodeNavigation?.Name, supplierName = equipment.SupplierCodeNavigation?.Name,
equipment.SupplierCode, equipment.SupplierCode,
cabinetID = equipment.Cabinet?.Id, cabinetID = equipment.Cabinet?.Id,
......
...@@ -16,6 +16,9 @@ using System.Linq.Expressions; ...@@ -16,6 +16,9 @@ using System.Linq.Expressions;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using JmpCommon.Tools; using JmpCommon.Tools;
using System.Configuration;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace JunmpPoliceStation.Controllers namespace JunmpPoliceStation.Controllers
{ {
...@@ -243,6 +246,10 @@ namespace JunmpPoliceStation.Controllers ...@@ -243,6 +246,10 @@ namespace JunmpPoliceStation.Controllers
string id = entity.id; string id = entity.id;
string state = entity.state; string state = entity.state;
using (var scope = _unitOfWork.BeginTransaction())
{
try
{
var OrgInfo = _unitOfWork.OrganizationRepository.Get(p => p.Id.Equals(id)); var OrgInfo = _unitOfWork.OrganizationRepository.Get(p => p.Id.Equals(id));
if (OrgInfo != null) if (OrgInfo != null)
{ {
...@@ -250,21 +257,34 @@ namespace JunmpPoliceStation.Controllers ...@@ -250,21 +257,34 @@ namespace JunmpPoliceStation.Controllers
bool result = _unitOfWork.OrganizationRepository.Update(OrgInfo, true); bool result = _unitOfWork.OrganizationRepository.Update(OrgInfo, true);
if (result) if (result)
{ {
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_SUCCESS); //更新第三方停启用状态
using (var dbContext = new ApiSysDbContext())
{
dbContext.Database.ExecuteSqlRaw("update api_org set state={0} WHERE id={1}", OrgInfo.State, OrgInfo.Id);
} }
scope.Commit();
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_SUCCESS);
}
else else
{ {
scope.Rollback();
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED); return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
} }
} }
else else
{ {
scope.Rollback();
return JsonManager.SimpleStatusResponse(ResultCode.ORGANIZATION_ERROR); return JsonManager.SimpleStatusResponse(ResultCode.ORGANIZATION_ERROR);
} }
}
catch (Exception e)
{
scope.Rollback();
throw;
}
}
} }
else else
{ {
...@@ -1453,6 +1473,13 @@ namespace JunmpPoliceStation.Controllers ...@@ -1453,6 +1473,13 @@ namespace JunmpPoliceStation.Controllers
#endregion #endregion
} }
public class ApiSysDbContext : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
var configuration = Startup.ServiceLocator.Instance.GetService<IConfiguration>();
optionsBuilder.UseSqlServer(configuration.GetConnectionString("ApiSysConnection"));
}
}
} }
...@@ -21,6 +21,7 @@ using JunmpPoliceStation.Extensions; ...@@ -21,6 +21,7 @@ using JunmpPoliceStation.Extensions;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using MySqlX.XDevAPI.Common;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Rextec.SOA.Infrastructure; using Rextec.SOA.Infrastructure;
...@@ -744,6 +745,75 @@ namespace JunmpPoliceStation.Controllers ...@@ -744,6 +745,75 @@ namespace JunmpPoliceStation.Controllers
} }
/// <summary> /// <summary>
/// 批量更新EPC打印状态(第三方使用)
/// </summary>
/// <param name="jdata"></param>
/// <returns></returns>
/// <remarks>
/// /// ## 例子
///
/// {
/// "idList":["111","222"],
/// }
/// </remarks>
[HttpPost("UpdateRangeEpcStateDevelop")]
[ServiceFilter(typeof(ActionLimitAttribute))]
//[NoSign]
public async Task<HttpResponseMessage> UpdateRangeEpcStateDevelop([FromBody] JObject jdata)
{
return await Task.Run(() =>
{
try
{
if (jdata != null)
{
var entity = JsonManager.GetJsonEntity(jdata);
if (!entity.idList is IEnumerable)
{
return JsonManager.SimpleCustResponse($"idList is require");
}
var list = new List<string>();
foreach (var id in entity.idList)
{
list.Add(id.ToString());
}
var epcs = _unitOfWork.DbContext.CommonJpPurchaseEpcs
.Where(t => list.Contains(t.Id)
&& (t.CurrentState == 0 || t.CurrentState == 1) //允许重复执行打印绑定操作
)
.ToList();
if (epcs.Count > 0)
{
foreach (var epc in epcs)
{
epc.CurrentState = 1;
}
}
bool result = _unitOfWork.PurchaseEpcsRepository.Update(epcs);
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_SUCCESS);
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
}
catch (Exception ex)
{
//_logger.LogError("Login/SignIn 错误:" + ex.ToString());
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
}
});
}
/// <summary>
/// 获取装备号型、供应商 /// 获取装备号型、供应商
/// </summary> /// </summary>
/// <param name="jdata"></param> /// <param name="jdata"></param>
...@@ -3793,7 +3863,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -3793,7 +3863,7 @@ namespace JunmpPoliceStation.Controllers
/// <param name="jdata"></param> /// <param name="jdata"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("EditInventory")] [HttpPost("EditInventory")]
[SwaggerIgnore] //[SwaggerIgnore]
public async Task<HttpResponseMessage> EditInventory([FromBody] JObject jdata) public async Task<HttpResponseMessage> EditInventory([FromBody] JObject jdata)
{ {
return await Task.Run(() => return await Task.Run(() =>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论