Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -25,62 +25,74 @@ namespace Tnb.ProductionMgr
|
||||
//获取注塑装箱状态
|
||||
private void GetZSPackStatus(object state)
|
||||
{
|
||||
string[] strs = new string[1] { "TY4C-ZHUSU1" };
|
||||
string sign = "agvMode";
|
||||
foreach (string s in strs)
|
||||
try
|
||||
{
|
||||
Dictionary<string, string> dic = _redisData.HGetAll(s).Result;
|
||||
foreach (KeyValuePair<string, string> kv in dic)
|
||||
string[] strs = new string[1] { "TY4C-ZHUSU1" };
|
||||
string sign = "agvMode";
|
||||
foreach (string s in strs)
|
||||
{
|
||||
if (!kv.Key.Contains(sign))
|
||||
Dictionary<string, string> dic = _redisData.HGetAll(s).Result;
|
||||
foreach (KeyValuePair<string, string> kv in dic)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
JObject? res = JsonConvert.DeserializeObject<JObject>(kv.Value);
|
||||
if (res != null && res["Value"] != null)
|
||||
{
|
||||
if (int.Parse(res["Value"]!.ToString()) is not ((int)Eagvmode.无请求) and not ((int)Eagvmode.收到请求))
|
||||
if (!kv.Key.Contains(sign))
|
||||
{
|
||||
InstockInput instockInput = new()
|
||||
continue;
|
||||
}
|
||||
JObject? res = JsonConvert.DeserializeObject<JObject>(kv.Value);
|
||||
if (res != null && res["Value"] != null)
|
||||
{
|
||||
if (int.Parse(res["Value"]!.ToString()) is not ((int)Eagvmode.无请求) and not ((int)Eagvmode.收到请求))
|
||||
{
|
||||
equip_code = res["TagName"]!.ToString()
|
||||
};
|
||||
_ = _prdInstockService.InstockTypeOne(instockInput);
|
||||
InstockInput instockInput = new()
|
||||
{
|
||||
equip_code = res["DevName"]!.ToString(),
|
||||
label_code = res["TagName"]!.ToString()
|
||||
};
|
||||
_prdInstockService.InstockTypeOne(instockInput);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
//获取挤出装箱状态
|
||||
private void GetJCPackStatus(object state)
|
||||
{
|
||||
string[] strs = new string[1] { "TY4C-SHUSONG-JC" };
|
||||
string sign = "AGVFullCall";
|
||||
foreach (string s in strs)
|
||||
try
|
||||
{
|
||||
Dictionary<string, string> dic = _redisData.HGetAll(s).Result;
|
||||
foreach (KeyValuePair<string, string> kv in dic)
|
||||
string[] strs = new string[1] { "TY4C-SHUSONG-JC" };
|
||||
string sign = "AGVFullCall";
|
||||
foreach (string s in strs)
|
||||
{
|
||||
if (!kv.Key.Contains(sign))
|
||||
Dictionary<string, string> dic = _redisData.HGetAll(s).Result;
|
||||
foreach (KeyValuePair<string, string> kv in dic)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
JObject? res = JsonConvert.DeserializeObject<JObject>(kv.Value);
|
||||
if (res != null && res["Value"] != null)
|
||||
{
|
||||
if (res.Value<bool>("Value"))
|
||||
if (!kv.Key.Contains(sign))
|
||||
{
|
||||
InstockInput instockInput = new()
|
||||
continue;
|
||||
}
|
||||
JObject? res = JsonConvert.DeserializeObject<JObject>(kv.Value);
|
||||
if (res != null && res["Value"] != null)
|
||||
{
|
||||
if (res.Value<bool>("Value"))
|
||||
{
|
||||
equip_code = res["TagName"]!.ToString()
|
||||
};
|
||||
_ = _prdInstockService.InstockTypeOne(instockInput);
|
||||
InstockInput instockInput = new()
|
||||
{
|
||||
equip_code = res["DevName"]!.ToString(),
|
||||
label_code = res["TagName"]!.ToString()
|
||||
};
|
||||
_prdInstockService.InstockTypeOne(instockInput);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
//获取限位状态
|
||||
private void GetLimitStatus(object state)
|
||||
@@ -90,29 +102,33 @@ namespace Tnb.ProductionMgr
|
||||
Console.WriteLine($"获取挤出装箱状态");
|
||||
string data = _redisData.GetHash("TY4C-SHUSONG-JC", "AGVFullCall").Result;
|
||||
Console.WriteLine(data);*/
|
||||
/*
|
||||
string[] strs = new string[1] { "TY4C-WAIBAO" };
|
||||
string sign = "AGVCall";
|
||||
foreach (string s in strs)
|
||||
try
|
||||
{
|
||||
Dictionary<string, string> dic = _redisData.HGetAll(s).Result;
|
||||
foreach (KeyValuePair<string, string> kv in dic)
|
||||
string[] strs = new string[1] { "TY4C-WAIBAO" };
|
||||
string sign = "AGVCall";
|
||||
foreach (string s in strs)
|
||||
{
|
||||
if (!kv.Key.Contains(sign))
|
||||
Dictionary<string, string> dic = _redisData.HGetAll(s).Result;
|
||||
foreach (KeyValuePair<string, string> kv in dic)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
JObject? res = JsonConvert.DeserializeObject<JObject>(kv.Value);
|
||||
if (res != null && res["Value"] != null)
|
||||
{
|
||||
if (res.Value<bool>("Value"))
|
||||
if (!kv.Key.Contains(sign))
|
||||
{
|
||||
//
|
||||
continue;
|
||||
}
|
||||
JObject? res = JsonConvert.DeserializeObject<JObject>(kv.Value);
|
||||
if (res != null && res["Value"] != null)
|
||||
{
|
||||
if (res.Value<bool>("Value"))
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
@@ -122,9 +138,9 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
// ZSpacktimer = new Timer(GetZSPackStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
|
||||
// JCpacktimer = new Timer(GetJCPackStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
|
||||
// limittimer = new Timer(GetLimitStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
|
||||
ZSpacktimer = new Timer(GetZSPackStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(5));
|
||||
JCpacktimer = new Timer(GetJCPackStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(5));
|
||||
limittimer = new Timer(GetLimitStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(5));
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
public Task StopAsync(CancellationToken cancellationToken)
|
||||
|
||||
@@ -45,4 +45,26 @@ namespace Tnb.QcMgr.Entities
|
||||
/// </summary>
|
||||
public int? pronum { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class CreateTaskEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料方案编号
|
||||
/// </summary>
|
||||
public List<string> materialids { get; set; }
|
||||
/// <summary>
|
||||
/// 触发条件
|
||||
/// </summary>
|
||||
public EnumTriggerEvent? triggerevent { get; set; }
|
||||
|
||||
public string maintableid { get; set; }
|
||||
}
|
||||
public class TaskEntity
|
||||
{
|
||||
public List<string> materialids { get; set; }
|
||||
public QcCheckPlanH qcCheckPlanH { get; set; }
|
||||
public string maintableid { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,5 +32,7 @@ namespace Tnb.QcMgr.Interfaces
|
||||
/// <returns></returns>
|
||||
public Task CreateTask(TriggerPlanEntity entity);
|
||||
|
||||
public Task CreateWmsTask(CreateTaskEntity entity);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,6 +286,109 @@ namespace Tnb.QcMgr
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WMS出库入库检
|
||||
/// </summary>
|
||||
/// <param name="CreateTaskEntity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task CreateWmsTask(CreateTaskEntity entity)
|
||||
{
|
||||
ISugarQueryable<QcCheckPlanH, QcCheckPlanAdd> Query = _repository.AsSugarClient().Queryable<QcCheckPlanH, QcCheckPlanAdd>
|
||||
((a, b) => new object[] {
|
||||
JoinType.Inner,a.id== b.mainid,
|
||||
});
|
||||
GetQuery(Query, entity);
|
||||
List<QcCheckPlanH> list = await Query.ToListAsync();
|
||||
List<TaskEntity> taskEntities = new List<TaskEntity>();
|
||||
foreach (QcCheckPlanH data in list)
|
||||
{
|
||||
if (entity.materialids.Count>0)
|
||||
{
|
||||
if (_repository.AsSugarClient().Queryable<QcCheckPlanMaterial>().Where(p => p.planid == data.id).Any())
|
||||
{
|
||||
var Materials= _repository.AsSugarClient().Queryable<QcCheckPlanMaterial>().Where(p => p.planid == data.id).Select(p=>p.materialid).ToList();
|
||||
var Intersect = entity.materialids.Intersect(Materials).ToList();
|
||||
if (Intersect.Count > 0)
|
||||
{
|
||||
taskEntities.Add(new TaskEntity { maintableid=entity.maintableid, materialids = Intersect!, qcCheckPlanH = data });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (taskEntities.Count > 0)
|
||||
{
|
||||
await SaveTask(taskEntities);
|
||||
}
|
||||
}
|
||||
|
||||
private void GetQuery(ISugarQueryable<QcCheckPlanH, QcCheckPlanAdd> Query, CreateTaskEntity entity)
|
||||
{
|
||||
List<DictionaryDataEntity> DictionaryData = _repository.AsSugarClient().Queryable<DictionaryDataEntity, DictionaryTypeEntity>
|
||||
((a, b) => new object[] { JoinType.Left, a.DictionaryTypeId == b.Id, })
|
||||
.Where((a, b) => b.FullName == "质检类型选择").ToList();
|
||||
QcTriggerEvent TriggerEvent = new();
|
||||
EnumTriggerEvent? enumTriggerEvent = entity.triggerevent;
|
||||
RemarkAttribute remark = RemarkAttribute.GetRemark(enumTriggerEvent);
|
||||
string type = DictionaryData.Where(p => p.FullName == remark.CheckType).First().Id;
|
||||
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == type && p.name == remark.CheckContent).First();
|
||||
Query = Query.Where((a, b) => b.triggertype == "3" && b.content!.Contains(TriggerEvent.id));
|
||||
}
|
||||
|
||||
private async Task SaveTask(List<TaskEntity> taskEntities)
|
||||
{
|
||||
DictionaryDataEntity DictionaryData = _repository.AsSugarClient().Queryable<DictionaryDataEntity, DictionaryTypeEntity>
|
||||
((a, b) => new object[] { JoinType.Left, a.DictionaryTypeId == b.Id, })
|
||||
.Where((a, b) => b.FullName == "质检状态" && a.FullName == "待执行").First();
|
||||
foreach (var entity in taskEntities)
|
||||
{
|
||||
List<QcCheckPlanD> plands = await _repository.AsSugarClient().Queryable<QcCheckPlanD>().Where(p =>p.mainid== entity.qcCheckPlanH.id).ToListAsync();
|
||||
|
||||
foreach (string s in entity.materialids)
|
||||
{
|
||||
DateTime time = DateTime.Now;
|
||||
QcCheckExecH qcCheckExecH = new()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId(),
|
||||
checktype = entity.qcCheckPlanH.checktype,
|
||||
status = DictionaryData.Id,
|
||||
tasktime = time.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
materialid = s,
|
||||
create_id = _userManager.UserId,
|
||||
create_time = time,
|
||||
extras= entity.maintableid
|
||||
};
|
||||
List<QcCheckExecD> ExecDs = new();
|
||||
foreach (var pland in plands)
|
||||
{
|
||||
QcCheckExecD QcCheckExecD = new()
|
||||
{
|
||||
mainid = qcCheckExecH.id,
|
||||
extype = pland.extype,
|
||||
excontent = pland.excontent,
|
||||
check = pland.check,
|
||||
errorcause = pland.errorcause,
|
||||
errorlevel = pland.errorlevel,
|
||||
remark = pland.remark,
|
||||
attachment = pland.attachment,
|
||||
isexec = pland.isexec,
|
||||
custom = pland.custom,
|
||||
typeid = pland.typeid,
|
||||
itemid = pland.itemid,
|
||||
create_id = _userManager.UserId,
|
||||
create_time = time
|
||||
};
|
||||
ExecDs.Add(QcCheckExecD);
|
||||
}
|
||||
_ = await _repository.AsSugarClient().Insertable(qcCheckExecH).ExecuteCommandAsync();
|
||||
_ = await _repository.AsSugarClient().Insertable(ExecDs).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据计划生成任务
|
||||
/// </summary>
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Tnb.QcMgr
|
||||
{
|
||||
{ "ok", "合格" },
|
||||
{ "no", "不合格" },
|
||||
{ "barelyok", "让步合格" },
|
||||
{ "barelyOk", "让步合格" },
|
||||
{ "await", "待检" },
|
||||
{ "temporarily", "暂控" }
|
||||
};
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
{
|
||||
/// <summary>
|
||||
/// Mes检验后回传输入参数
|
||||
/// </summary>
|
||||
public class MesCheckdCallbackUpinput
|
||||
{
|
||||
/// <summary>
|
||||
/// 主表Id
|
||||
/// </summary>
|
||||
public string maintableid { get; set; }
|
||||
/// <summary>
|
||||
/// 检验结论
|
||||
/// </summary>
|
||||
public int check_conclusion { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Entity.Constraints
|
||||
{
|
||||
/// <summary>
|
||||
/// 修改出入库检验状态
|
||||
/// </summary>
|
||||
public interface InOutCheckStatusUpdateEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 检验状态
|
||||
/// </summary>
|
||||
public int? check_conclusion { get; set; }
|
||||
/// <summary>
|
||||
/// 是否检验
|
||||
/// </summary>
|
||||
public int? is_check { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities.Entity.Constraints;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities;
|
||||
|
||||
@@ -8,7 +9,7 @@ namespace Tnb.WarehouseMgr.Entities;
|
||||
/// 入库申请主表
|
||||
/// </summary>
|
||||
[SugarTable("wms_instock_h")]
|
||||
public partial class WmsInstockH : BaseEntity<string>
|
||||
public partial class WmsInstockH : BaseEntity<string>, InOutCheckStatusUpdateEntity
|
||||
{
|
||||
public WmsInstockH()
|
||||
{
|
||||
@@ -212,4 +213,8 @@ public partial class WmsInstockH : BaseEntity<string>
|
||||
/// 采购单号
|
||||
/// </summary>
|
||||
public string purchase_code { get; set; }
|
||||
/// <summary>
|
||||
/// 检验结论
|
||||
/// </summary>
|
||||
public int? check_conclusion { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities.Entity.Constraints;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities;
|
||||
|
||||
@@ -8,7 +9,7 @@ namespace Tnb.WarehouseMgr.Entities;
|
||||
/// 出库申请主表
|
||||
/// </summary>
|
||||
[SugarTable("wms_outstock_h")]
|
||||
public partial class WmsOutstockH : BaseEntity<string>
|
||||
public partial class WmsOutstockH : BaseEntity<string>, InOutCheckStatusUpdateEntity
|
||||
{
|
||||
public WmsOutstockH()
|
||||
{
|
||||
@@ -170,4 +171,8 @@ public partial class WmsOutstockH : BaseEntity<string>
|
||||
/// 载具Id
|
||||
/// </summary>
|
||||
public string carry_id { get; set; }
|
||||
/// <summary>
|
||||
/// 检验结论
|
||||
/// </summary>
|
||||
public int? check_conclusion { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// 采购收货
|
||||
/// </summary>
|
||||
public interface IWmsPurchaseService
|
||||
{
|
||||
Task<dynamic> MesCheckdPurchaseCallback(MesCheckdCallbackUpinput input);
|
||||
}
|
||||
}
|
||||
17
WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSaleService.cs
Normal file
17
WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSaleService.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// 销售发货
|
||||
/// </summary>
|
||||
public interface IWmsSaleService
|
||||
{
|
||||
Task<dynamic> MesCheckdSaleCallback(MesCheckdCallbackUpinput input);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
<ProjectReference Include="..\..\EquipMgr\Tnb.EquipMgr.Entities\Tnb.EquipMgr.Entities.csproj" />
|
||||
<ProjectReference Include="..\..\message\Tnb.Message.Interfaces\Tnb.Message.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\..\ProductionMgr\Tnb.ProductionMgr.Interfaces\Tnb.ProductionMgr.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\..\QcMgr\Tnb.QcMgr.Interfaces\Tnb.QcMgr.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
||||
<ProjectReference Include="..\Tnb.WarehouseMgr.Interfaces\Tnb.WarehouseMgr.Interfaces.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -208,6 +208,9 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new AppFriendlyException("没有匹配的空载具可以出库", 500);
|
||||
}
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace Tnb.WarehouseMgr
|
||||
List<string> carryIds = new();
|
||||
var mapKeys = new List<string> { "tablefield120", "details" };
|
||||
//tablefield120 出库物料明细
|
||||
if (input.data.Keys.Where(k => mapKeys.Contains(k)).Any()) //input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull()
|
||||
if (input.data.Keys.Any(k => mapKeys.Contains(k))) //input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull()
|
||||
{
|
||||
List<WmsOutstockD> outStockDList = new();
|
||||
if (input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull())
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.FriendlyException;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
@@ -15,6 +16,7 @@ using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
using Tnb.WarehouseMgr.Entities.Entity.Constraints;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
@@ -118,5 +120,25 @@ namespace Tnb.WarehouseMgr
|
||||
return await _db.Updateable<TEntity>().SetColumns(it => it.audit_status == (int)input.auditType).Where(it => input.ids.Contains(it.id)).ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
|
||||
protected async Task<bool> UpdateChackStatus<TEntity>(MesCheckdCallbackUpinput input) where TEntity : BaseEntity<string>, InOutCheckStatusUpdateEntity, new()
|
||||
{
|
||||
var stock = await _db.Queryable<TEntity>().SingleAsync(it => it.id == input.maintableid);
|
||||
stock.check_conclusion = input.check_conclusion;
|
||||
stock.is_check = 1;
|
||||
var isOk = await _db.Updateable(stock).UpdateColumns(it => new { it.check_conclusion, it.is_check }).ExecuteCommandHasChangeAsync();
|
||||
var preTask = await _db.Queryable<WmsPretaskH>().FirstAsync(it => it.require_id == input.maintableid);
|
||||
if (preTask != null)
|
||||
{
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == preTask.carry_id);
|
||||
if (carry != null)
|
||||
{
|
||||
carry.check_conclusion = input.check_conclusion;
|
||||
carry.is_check = 1;
|
||||
isOk = await _db.Updateable(carry).UpdateColumns(it => new { it.check_conclusion, it.is_check }).ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
}
|
||||
return isOk;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,9 @@ using NPOI.OpenXmlFormats.Dml.Diagram;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.Common.Utils;
|
||||
using Tnb.QcMgr.Entities;
|
||||
using Tnb.QcMgr.Entities.Enums;
|
||||
using Tnb.QcMgr.Interfaces;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
@@ -30,15 +33,17 @@ namespace Tnb.WarehouseMgr
|
||||
/// 采购收货
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSPURCHASE_ID)]
|
||||
public class WmsPurchaseService : WmsPurchaseAndSaleCommonService<WmsPurchaseD>
|
||||
public class WmsPurchaseService : WmsPurchaseAndSaleCommonService<WmsPurchaseD>, IWmsPurchaseService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
public WmsPurchaseService(ISqlSugarRepository<WmsPurchaseH> repo, IUserManager userManager)
|
||||
private readonly IQcCheckPlanService _qcCheckPlanService;
|
||||
public WmsPurchaseService(ISqlSugarRepository<WmsPurchaseH> repo, IUserManager userManager, IQcCheckPlanService qcCheckPlanService)
|
||||
: base(repo, userManager)
|
||||
{
|
||||
_db = repo.AsSugarClient();
|
||||
_userManager = userManager;
|
||||
_qcCheckPlanService = qcCheckPlanService;
|
||||
}
|
||||
|
||||
private async Task<dynamic> xxx(VisualDevModelDataCrInput input)
|
||||
@@ -62,24 +67,33 @@ namespace Tnb.WarehouseMgr
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
WmsInstockH? instock = null;
|
||||
var purchaseDs = await PurchaseAndSaleUpdate(input);
|
||||
List<WmsInstockD> instockDs = new();
|
||||
if (purchaseDs?.Count > 0)
|
||||
{
|
||||
var instock = input.Adapt<WmsInstockH>();
|
||||
instock = input.Adapt<WmsInstockH>();
|
||||
instock.id = SnowflakeIdHelper.NextId();
|
||||
instock.create_id = _userManager.UserId;
|
||||
instock.create_time = DateTime.Now;
|
||||
instock.org_id = _userManager.User.OrganizeId;
|
||||
await _db.Insertable(instock).ExecuteCommandAsync();
|
||||
|
||||
var instockD = purchaseDs.Adapt<WmsInstockD>();
|
||||
instockD.create_id = _userManager.UserId;
|
||||
instockD.create_time = DateTime.Now;
|
||||
instockD.org_id = _userManager.User.OrganizeId;
|
||||
await _db.Insertable(instockD).ExecuteCommandAsync();
|
||||
instockDs = purchaseDs.Adapt<List<WmsInstockD>>();
|
||||
instockDs.ForEach(instockD =>
|
||||
{
|
||||
instockD.create_id = _userManager.UserId;
|
||||
instockD.create_time = DateTime.Now;
|
||||
instockD.org_id = _userManager.User.OrganizeId;
|
||||
});
|
||||
await _db.Insertable(instockDs).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
//通知Mes接口
|
||||
CreateTaskEntity ctEntity = new();
|
||||
ctEntity.maintableid = instock.id;
|
||||
ctEntity.materialids = instockDs.Select(x => x.material_id).ToList();
|
||||
ctEntity.triggerevent = EnumTriggerEvent.入厂检按物料编号;
|
||||
_ = _qcCheckPlanService.CreateWmsTask(ctEntity);
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -114,5 +128,16 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
return await Audit<WmsPurchaseH>(input);
|
||||
}
|
||||
/// <summary>
|
||||
/// mes 检验完后通知wms(采购) 回调接口
|
||||
/// </summary>
|
||||
/// <param name="input">
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> MesCheckdPurchaseCallback(MesCheckdCallbackUpinput input)
|
||||
{
|
||||
return await UpdateChackStatus<WmsInstockH>(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// <summary>
|
||||
/// 销售发货
|
||||
/// </summary>
|
||||
public class WmsSaleService : WmsPurchaseAndSaleCommonService<WmsSaleD>
|
||||
public class WmsSaleService : WmsPurchaseAndSaleCommonService<WmsSaleD>, IWmsSaleService
|
||||
{
|
||||
private readonly IWmsOutStockService _wmsOutStockService;
|
||||
|
||||
@@ -72,5 +72,17 @@ namespace Tnb.WarehouseMgr
|
||||
return await Audit<WmsSaleH>(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// mes 检验完后通知wms(销售) 回调接口
|
||||
/// </summary>
|
||||
/// <param name="input">
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> MesCheckdSaleCallback(MesCheckdCallbackUpinput input)
|
||||
{
|
||||
return await UpdateChackStatus<WmsOutstockH>(input);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user