Commit c734d17c by zxw

单警柜切换模式

物资详情换orgid
第三方停启用状态
第三方批量完成打印单
统计导出调整
parent 4366ac90
......@@ -274,7 +274,7 @@ namespace JunmpPoliceStation.Controllers
/// <param name="jdata"></param>
/// <returns></returns>
[HttpPost("ChangeCabinetType")]
[NoSign]
public async Task<HttpResponseMessage> ChangeCabinetType([FromBody] JObject jdata)
{
return await Task.Run(() =>
......@@ -317,12 +317,20 @@ namespace JunmpPoliceStation.Controllers
var innerInv = updateInv.Where(x => x.CurrentState == 3).ToList();
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();
foreach (var Inv in outInv)
{
Inv.CabinetId = null;
Inv.CurrentState = 8;
updateInvs.Add(Inv);
}
}
......
......@@ -9222,11 +9222,11 @@ namespace JunmpPoliceStation.Controllers
{
if (entity.level == "本级")
{
expression = t => t.WarehouseCodeNavigation.OrgizationId.Equals(OrgId);
expression = t => t.OrgId.Equals(OrgId);
}
else
{
expression = t => dataList.Select(c => c.Id).Contains(t.WarehouseCodeNavigation.OrgizationId);
expression = t => dataList.Select(c => c.Id).Contains(t.OrgId);
}
}
else
......@@ -9289,11 +9289,18 @@ namespace JunmpPoliceStation.Controllers
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 6 && t.IsFixed == true);
break;
}
case "单警柜装备":
case "单警柜中":
{
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 3 || t.CurrentState == 7);
break;
}
case "仓库装备":
{
//(不包括单警柜的装备)
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 3 && t.CurrentState != 7);
break;
}
default:
break;
}
......@@ -9399,8 +9406,8 @@ namespace JunmpPoliceStation.Controllers
equipment.EquipmentCode,
warehouseName = equipment.WarehouseCodeNavigation?.Name,
equipment.WarehouseCode,
equipment.WarehouseCodeNavigation?.Orgization?.Name,
equipment.WarehouseCodeNavigation?.OrgizationId,
equipment.Org?.Name,
equipment.OrgId,
supplierName = equipment.SupplierCodeNavigation?.Name,
equipment.SupplierCode,
cabinetID = equipment.Cabinet?.Id,
......
......@@ -16,6 +16,9 @@ using System.Linq.Expressions;
using System.Net.Http;
using System.Threading.Tasks;
using JmpCommon.Tools;
using System.Configuration;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace JunmpPoliceStation.Controllers
{
......@@ -243,28 +246,45 @@ namespace JunmpPoliceStation.Controllers
string id = entity.id;
string state = entity.state;
var OrgInfo = _unitOfWork.OrganizationRepository.Get(p => p.Id.Equals(id));
if (OrgInfo != null)
using (var scope = _unitOfWork.BeginTransaction())
{
OrgInfo.State = short.Parse(state);
bool result = _unitOfWork.OrganizationRepository.Update(OrgInfo, true);
if (result)
try
{
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_SUCCESS);
var OrgInfo = _unitOfWork.OrganizationRepository.Get(p => p.Id.Equals(id));
if (OrgInfo != null)
{
OrgInfo.State = short.Parse(state);
bool result = _unitOfWork.OrganizationRepository.Update(OrgInfo, true);
if (result)
{
//更新第三方停启用状态
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
{
scope.Rollback();
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
}
}
else
{
scope.Rollback();
return JsonManager.SimpleStatusResponse(ResultCode.ORGANIZATION_ERROR);
}
}
else
catch (Exception e)
{
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
scope.Rollback();
throw;
}
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.ORGANIZATION_ERROR);
}
}
else
{
......@@ -1453,6 +1473,13 @@ namespace JunmpPoliceStation.Controllers
#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;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using MySqlX.XDevAPI.Common;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Rextec.SOA.Infrastructure;
......@@ -744,6 +745,75 @@ namespace JunmpPoliceStation.Controllers
}
/// <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>
/// <param name="jdata"></param>
......@@ -3793,7 +3863,7 @@ namespace JunmpPoliceStation.Controllers
/// <param name="jdata"></param>
/// <returns></returns>
[HttpPost("EditInventory")]
[SwaggerIgnore]
//[SwaggerIgnore]
public async Task<HttpResponseMessage> EditInventory([FromBody] JObject jdata)
{
return await Task.Run(() =>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论