Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -3,7 +3,7 @@ using Tnb.ProductionMgr.Entities.Dto;
|
||||
namespace Tnb.ProductionMgr.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料签收服务接口
|
||||
/// 物料投料服务接口
|
||||
/// </summary>
|
||||
public interface IPrdFeedingService
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ using Tnb.BasicData;
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 业务实现:物料签收
|
||||
/// 业务实现:物料投料
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
@@ -159,7 +159,7 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
||||
return result.IsSuccess ? "签收成功" : result.ErrorMessage;
|
||||
return result.IsSuccess ? "投料成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@@ -272,34 +272,34 @@ namespace Tnb.ProductionMgr
|
||||
// carry_code = input.carry_code ?? "",
|
||||
// });
|
||||
|
||||
var mesCarrySignInput = new MESCarrySignInput()
|
||||
{
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
create_id = _userManager.UserId,
|
||||
carry_code = input.carry_code ?? "",
|
||||
};
|
||||
|
||||
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
||||
Dictionary<string, object> header = new Dictionary<string, object>()
|
||||
{
|
||||
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||
};
|
||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CARRY_SIGN,JsonConvert.SerializeObject(mesCarrySignInput),header);
|
||||
Log.Information(sendResult);
|
||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||
if (authResponse.code != 200)
|
||||
{
|
||||
throw Oops.Bah(authResponse.msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
result2 = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await db.Insertable<PrdFeedingH>(prdFeedingH).ExecuteCommandAsync();
|
||||
await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
|
||||
});
|
||||
|
||||
}
|
||||
// var mesCarrySignInput = new MESCarrySignInput()
|
||||
// {
|
||||
// org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
// create_id = _userManager.UserId,
|
||||
// carry_code = input.carry_code ?? "",
|
||||
// };
|
||||
//
|
||||
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
||||
// Dictionary<string, object> header = new Dictionary<string, object>()
|
||||
// {
|
||||
// ["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||
// };
|
||||
// var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CARRY_SIGN,JsonConvert.SerializeObject(mesCarrySignInput),header);
|
||||
// Log.Information(sendResult);
|
||||
// AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||
// if (authResponse.code != 200)
|
||||
// {
|
||||
// throw Oops.Bah(authResponse.msg);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// result2 = await db.Ado.UseTranAsync(async () =>
|
||||
// {
|
||||
// await db.Insertable<PrdFeedingH>(prdFeedingH).ExecuteCommandAsync();
|
||||
// await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
|
||||
// });
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
if(!result2.IsSuccess) throw Oops.Oh(result2.ErrorMessage);
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
using JNPF;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Extras.CollectiveOAuth.Models;
|
||||
using JNPF.Extras.CollectiveOAuth.Utils;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
@@ -14,6 +19,13 @@ using Tnb.ProductionMgr.Interfaces;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Entities.Consts;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
using Tnb.ProductionMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.BasicData;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
@@ -71,6 +83,9 @@ namespace Tnb.ProductionMgr
|
||||
public async Task<dynamic> SaveData(MaterialReceiptInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
DbResult<bool> result2 = new DbResult<bool>();
|
||||
PrdMaterialReceiptH prdMaterialReceiptH = null;
|
||||
List<PrdMaterialReceiptD> list = new List<PrdMaterialReceiptD>();
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var moTask = await db.Queryable<PrdMoTask>().FirstAsync(x => x.id == input.mo_task_id);
|
||||
@@ -80,7 +95,7 @@ namespace Tnb.ProductionMgr
|
||||
.ToListAsync();
|
||||
|
||||
string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.MATERIAL_RECEIPT_CODE);
|
||||
PrdMaterialReceiptH prdMaterialReceiptH = new PrdMaterialReceiptH()
|
||||
prdMaterialReceiptH = new PrdMaterialReceiptH()
|
||||
{
|
||||
code = code,
|
||||
station_id = input.station_id,
|
||||
@@ -125,13 +140,54 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
|
||||
|
||||
await db.Insertable<PrdMaterialReceiptH>(prdMaterialReceiptH).ExecuteCommandAsync();
|
||||
await db.Insertable<PrdMaterialReceiptD>(list).ExecuteCommandAsync();
|
||||
// await db.Insertable<PrdMaterialReceiptH>(prdMaterialReceiptH).ExecuteCommandAsync();
|
||||
// await db.Insertable<PrdMaterialReceiptD>(list).ExecuteCommandAsync();
|
||||
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
||||
return result.IsSuccess ? "签收成功" : result.ErrorMessage;
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
//签收后调用载具签收接口
|
||||
// await _wmsSignForDeliveryService.MESCarrySign(new MESCarrySignInput()
|
||||
// {
|
||||
// org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
// create_id = _userManager.UserId,
|
||||
// carry_code = input.carry_code ?? "",
|
||||
// });
|
||||
|
||||
var mesCarrySignInput = new MESCarrySignInput()
|
||||
{
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
create_id = _userManager.UserId,
|
||||
carry_code = input.carry_code ?? "",
|
||||
};
|
||||
|
||||
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
||||
Dictionary<string, object> header = new Dictionary<string, object>()
|
||||
{
|
||||
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||
};
|
||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CARRY_SIGN,JsonConvert.SerializeObject(mesCarrySignInput),header);
|
||||
Log.Information(sendResult);
|
||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||
if (authResponse.code != 200)
|
||||
{
|
||||
throw Oops.Bah(authResponse.msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
result2 = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await db.Insertable<PrdMaterialReceiptH>(prdMaterialReceiptH).ExecuteCommandAsync();
|
||||
await db.Insertable<PrdMaterialReceiptD>(list).ExecuteCommandAsync();
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(!result2.IsSuccess) throw Oops.Oh(result2.ErrorMessage);
|
||||
return result2.IsSuccess ? "签收成功" : result2.ErrorMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,9 @@ using Newtonsoft.Json;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Tnb.PerMgr.Entities;
|
||||
using Tnb.QcMgr.Interfaces;
|
||||
using Tnb.QcMgr.Entities.Dto;
|
||||
using Tnb.QcMgr.Entities.Enums;
|
||||
|
||||
// using Tnb.PerMgr.Entities;
|
||||
|
||||
@@ -67,7 +70,7 @@ namespace Tnb.ProductionMgr
|
||||
private static Dictionary<string, object> _dicProcess = new Dictionary<string, object>();
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IBillRullService _billRuleService;
|
||||
|
||||
private readonly IQcCheckPlanService _qcCheckPlanService;
|
||||
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public PrdMoTaskService(
|
||||
@@ -76,7 +79,8 @@ namespace Tnb.ProductionMgr
|
||||
IDictionaryDataService dictionaryDataService,
|
||||
IRunService runService,
|
||||
IBillRullService billRullService,
|
||||
IVisualDevService visualDevService
|
||||
IVisualDevService visualDevService,
|
||||
IQcCheckPlanService qcCheckPlanService
|
||||
)
|
||||
{
|
||||
_repository = repository;
|
||||
@@ -88,7 +92,7 @@ namespace Tnb.ProductionMgr
|
||||
OverideFuncs.DeleteAsync = Delete;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
_billRuleService = billRullService;
|
||||
|
||||
_qcCheckPlanService=qcCheckPlanService;
|
||||
}
|
||||
|
||||
#region Get
|
||||
@@ -1004,16 +1008,22 @@ namespace Tnb.ProductionMgr
|
||||
var taskReportLogs = new List<PrdMoTask>();
|
||||
var prdTaskList = await db.Queryable<PrdMoTask>().Where(it => input.TaskIds.Contains(it.id)).ToListAsync();
|
||||
if (prdTaskList?.Count > 0)
|
||||
{
|
||||
/*
|
||||
if (prdTaskList.Where(p => p.mo_task_status == "Closed").Count() > 0 && status == "InProgress")
|
||||
{
|
||||
foreach (var task in prdTaskList.Where(p => p.mo_task_status == "Closed").ToList())
|
||||
{
|
||||
{
|
||||
#region 质检模块
|
||||
//质检
|
||||
if (prdTaskList.Where(p => p.mo_task_status == "Pause").Count() > 0 && status == "InProgress")
|
||||
{
|
||||
foreach (var task in prdTaskList.Where(p => p.mo_task_status == "Pause").ToList())
|
||||
{
|
||||
TriggerPlanEntity entity = new TriggerPlanEntity();
|
||||
entity.materialid = task.material_id;
|
||||
entity.processid = task.process_id;
|
||||
entity.workid = task.workstation_id;
|
||||
entity.triggerevent = EnumTriggerEvent.首件检生产任务暂停;
|
||||
await _qcCheckPlanService.CreateTask(entity);
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endregion
|
||||
prdTaskList.ForEach(x => x.mo_task_status = status);
|
||||
row = await db.Updateable(prdTaskList).ExecuteCommandAsync();
|
||||
if (row > 0)
|
||||
@@ -1299,7 +1309,19 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
row = await db.Insertable(report).ExecuteCommandAsync();
|
||||
|
||||
|
||||
#region 质检模块
|
||||
//质检模块
|
||||
TriggerPlanEntity entity = new TriggerPlanEntity();
|
||||
entity.materialid = prdMoTask.material_id;
|
||||
entity.processid = prdMoTask.process_id;
|
||||
entity.workid = prdMoTask.workstation_id;
|
||||
var reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty;
|
||||
var scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty;
|
||||
entity.oldpronum = reported+ scrap;
|
||||
entity.newpronum = input.reported_qty;
|
||||
entity.triggerevent = EnumTriggerEvent.生产检定量;
|
||||
await _qcCheckPlanService.CreateTask(entity);
|
||||
#endregion
|
||||
if (prdMoTask.reported_work_qty == null)
|
||||
{
|
||||
await db.Updateable<PrdMoTask>()
|
||||
@@ -1482,6 +1504,20 @@ namespace Tnb.ProductionMgr
|
||||
var scrapQty = db.Queryable<PrdMoTaskDefect>().Where(it => it.mo_task_id == input.mo_task_id)?.Sum(d => d.defective_item_qty);
|
||||
if (scrapQty.HasValue && scrapQty.Value > 0)//更新生产任务表报废数量
|
||||
{
|
||||
#region 质检模块
|
||||
//质检模块
|
||||
var prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
|
||||
TriggerPlanEntity entity = new TriggerPlanEntity();
|
||||
entity.materialid = prdMoTask.material_id;
|
||||
entity.processid = prdMoTask.process_id;
|
||||
entity.workid = prdMoTask.workstation_id;
|
||||
var reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty;
|
||||
var scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty;
|
||||
entity.oldpronum = reported + scrap;
|
||||
entity.newpronum = input.scrap_qty;
|
||||
entity.triggerevent = EnumTriggerEvent.生产检定量;
|
||||
await _qcCheckPlanService.CreateTask(entity);
|
||||
#endregion
|
||||
await db.Updateable<PrdMoTask>().SetColumns(it => new PrdMoTask { scrap_qty = scrapQty.Value }).Where(it => it.id == input.mo_task_id).ExecuteCommandAsync();
|
||||
}
|
||||
var defectRecord = await db.Queryable<PrdMoTaskDefectRecord>().FirstAsync(it => it.mo_task_id == input.mo_task_id);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<ProjectReference Include="..\..\EquipMgr\Tnb.EquipMgr.Interfaces\Tnb.EquipMgr.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\..\message\Tnb.Message\Tnb.Message.csproj" />
|
||||
<ProjectReference Include="..\..\PerMgr\Tnb.PerMgr.Entities\Tnb.PerMgr.Entities.csproj" />
|
||||
<ProjectReference Include="..\..\QcMgr\Tnb.QcMgr.Interfaces\Tnb.QcMgr.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\..\taskschedule\Tnb.TaskScheduler\Tnb.TaskScheduler.csproj" />
|
||||
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
||||
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr.Entities\Tnb.WarehouseMgr.Entities.csproj" />
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace Tnb.QcMgr.Entities
|
||||
public string? addid { get; set; }
|
||||
public string? triggertype { get; set; }
|
||||
public string? content { get; set; }
|
||||
public int? number { get; set; }
|
||||
public List<CheckPlanTypeInput>? checktypes { get; set; }
|
||||
}
|
||||
public class CheckPlanTypeInput
|
||||
@@ -38,10 +39,11 @@ namespace Tnb.QcMgr.Entities
|
||||
{
|
||||
public string? id { get; set; }
|
||||
public bool hasadd { get; set; }
|
||||
public bool hasitem{ get; set; }
|
||||
public bool hasitem { get; set; }
|
||||
public string? addid { get; set; }
|
||||
public string? triggertype { get; set; }
|
||||
public string? content { get; set; }
|
||||
public int? number { get; set; }
|
||||
public List<CheckPlanTypeOut>? checktypes { get; set; }
|
||||
}
|
||||
public class CheckPlanTypeOut
|
||||
|
||||
@@ -37,5 +37,18 @@ namespace Tnb.QcMgr.Entities.Dto
|
||||
/// 触发条件
|
||||
/// </summary>
|
||||
public EnumTriggerEvent? triggerevent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 原先生产数量
|
||||
/// </summary>
|
||||
public int? oldpronum { get; set; }
|
||||
/// <summary>
|
||||
/// 新生产数量
|
||||
/// </summary>
|
||||
public int? newpronum { get; set; }
|
||||
/// <summary>
|
||||
/// 生产次数
|
||||
/// </summary>
|
||||
public int? pronum { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,5 +34,10 @@ namespace Tnb.QcMgr.Entities
|
||||
/// 主表编号
|
||||
/// </summary>
|
||||
public string? mainid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 频次/数量
|
||||
/// </summary>
|
||||
public int? number { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -14,18 +16,48 @@ namespace Tnb.QcMgr.Entities.Enums
|
||||
}
|
||||
public enum EnumTriggerEvent
|
||||
{
|
||||
[Remark("首件检", "换模具")]
|
||||
首件检换模具 = 1,
|
||||
[Remark("首件检", "换物料批号")]
|
||||
首件检换物料批号 = 2,
|
||||
[Remark("首件检", "换物料编号")]
|
||||
首件检换物料编号 = 3,
|
||||
[Remark("首件检", "新的生产任务")]
|
||||
首件检新的生产任务 = 4,
|
||||
[Remark("首件检", "生产任务暂停")]
|
||||
首件检生产任务暂停 = 5,
|
||||
[Remark("出厂检", "按入厂频次")]
|
||||
出厂检按入厂频次 = 6,
|
||||
[Remark("入厂检", "按物料频次")]
|
||||
入厂检按物料频次 = 7,
|
||||
[Remark("入厂检", "按物料编号")]
|
||||
入厂检按物料编号 = 8,
|
||||
[Remark("生产检", "定量")]
|
||||
生产检定量 = 9,
|
||||
[Remark("生产检", "定码")]
|
||||
生产检定码 = 10,
|
||||
[Remark("生产检", "产出频次")]
|
||||
生产检产出频次 = 11,
|
||||
[Remark("生产检", "固定次数")]
|
||||
生产检固定次数 = 12,
|
||||
[Remark("生产检", "按流转卡")]
|
||||
生产检按流转卡 = 13
|
||||
}
|
||||
public class RemarkAttribute : Attribute
|
||||
{
|
||||
public string CheckType { get; set; }
|
||||
public string CheckContent { get; set; }
|
||||
|
||||
public RemarkAttribute(string checkType, string checkContent)
|
||||
{
|
||||
this.CheckType = checkType;
|
||||
this.CheckContent = checkContent;
|
||||
}
|
||||
public static RemarkAttribute GetRemark(EnumTriggerEvent? enumTriggerEvent)
|
||||
{
|
||||
FieldInfo fi = enumTriggerEvent!.GetType().GetField(enumTriggerEvent.ToString()!)!;
|
||||
object[] attributes = fi.GetCustomAttributes(typeof(RemarkAttribute), false);
|
||||
return ((RemarkAttribute)attributes[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,5 +31,12 @@ namespace Tnb.QcMgr.Interfaces
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetTriggerPlans();
|
||||
|
||||
/// <summary>
|
||||
/// 根据计划生成任务
|
||||
/// </summary>
|
||||
/// <param name="TriggerPlanEntity"></param>
|
||||
/// <returns></returns>
|
||||
public Task CreateTask(TriggerPlanEntity entity);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aspose.Cells.Drawing;
|
||||
using COSXML.Model.Tag;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
@@ -93,6 +94,7 @@ namespace Tnb.QcMgr
|
||||
CheckPlansOut.addid = QcCheckPlanAdd.id;
|
||||
CheckPlansOut.triggertype = QcCheckPlanAdd.triggertype!;
|
||||
CheckPlansOut.content = QcCheckPlanAdd.content!;
|
||||
CheckPlansOut.number= QcCheckPlanAdd.number;
|
||||
}
|
||||
if (QcCheckPlanDs != null && QcCheckPlanDs.Count > 0)
|
||||
{
|
||||
@@ -191,6 +193,7 @@ namespace Tnb.QcMgr
|
||||
QcCheckPlanAdd.mainid = CheckPlanInput.mainid;
|
||||
QcCheckPlanAdd.triggertype = CheckPlanInput.triggertype;
|
||||
QcCheckPlanAdd.content = CheckPlanInput.content;
|
||||
QcCheckPlanAdd.number = CheckPlanInput.number;
|
||||
List<QcCheckPlanD> QcCheckPlanDs = new List<QcCheckPlanD>();
|
||||
if (CheckPlanInput.checktypes != null)
|
||||
{
|
||||
@@ -276,49 +279,93 @@ namespace Tnb.QcMgr
|
||||
JoinType.Left,a.id == d.planid,
|
||||
JoinType.Left,a.id == e.planid,
|
||||
});
|
||||
GetQuery(Query, entity.triggerevent);
|
||||
GetQuery(Query, entity);
|
||||
var list = await Query
|
||||
.WhereIF(!string.IsNullOrEmpty(entity.materialid), (a, b, c, d, e) => c.materialid == entity.materialid)
|
||||
.WhereIF(!string.IsNullOrEmpty(entity.processid), (a, b, c, d, e) => d.processid == entity.processid)
|
||||
.WhereIF(!string.IsNullOrEmpty(entity.workid), (a, b, c, d, e) => e.workid == entity.workid).ToListAsync();
|
||||
Filter(list, entity);
|
||||
if (list.Count > 0)
|
||||
await SaveTask(list, entity);
|
||||
}
|
||||
private void GetQuery(ISugarQueryable<QcCheckPlanH, QcCheckPlanAdd, QcCheckPlanMaterial, QcCheckPlanProcess, QcCheckPlanWork> Query, EnumTriggerEvent? enumTriggerEvent)
|
||||
private void GetQuery(ISugarQueryable<QcCheckPlanH, QcCheckPlanAdd, QcCheckPlanMaterial, QcCheckPlanProcess, QcCheckPlanWork> Query, TriggerPlanEntity entity)
|
||||
{
|
||||
|
||||
var DictionaryData = _repository.AsSugarClient().Queryable<DictionaryDataEntity, DictionaryTypeEntity>
|
||||
((a, b) => new object[] { JoinType.Left, a.DictionaryTypeId == b.Id, })
|
||||
.Where((a, b) => b.FullName == "质量方案类型").ToList();
|
||||
var TriggerEvent = new QcTriggerEvent();
|
||||
if (enumTriggerEvent == EnumTriggerEvent.首件检换模具)
|
||||
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == DictionaryData.Where(p => p.FullName == "首件检").First().Id && p.name == "换模具").First();
|
||||
if (enumTriggerEvent == EnumTriggerEvent.首件检换物料批号)
|
||||
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == DictionaryData.Where(p => p.FullName == "首件检").First().Id && p.name == "换物料批号").First();
|
||||
if (enumTriggerEvent == EnumTriggerEvent.首件检换物料编号)
|
||||
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == DictionaryData.Where(p => p.FullName == "首件检").First().Id && p.name == "换物料编号").First();
|
||||
if (enumTriggerEvent == EnumTriggerEvent.首件检新的生产任务)
|
||||
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == DictionaryData.Where(p => p.FullName == "首件检").First().Id && p.name == "新的生产任务").First();
|
||||
if (enumTriggerEvent == EnumTriggerEvent.首件检生产任务暂停)
|
||||
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == DictionaryData.Where(p => p.FullName == "首件检").First().Id && p.name == "生产任务暂停").First();
|
||||
if (enumTriggerEvent == EnumTriggerEvent.出厂检按入厂频次)
|
||||
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == DictionaryData.Where(p => p.FullName == "出厂检").First().Id && p.name == "按入厂频次").First();
|
||||
if (enumTriggerEvent == EnumTriggerEvent.入厂检按物料频次)
|
||||
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == DictionaryData.Where(p => p.FullName == "入厂检").First().Id && p.name == "按物料频次").First();
|
||||
if (enumTriggerEvent == EnumTriggerEvent.入厂检按物料编号)
|
||||
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == DictionaryData.Where(p => p.FullName == "入厂检").First().Id && p.name == "按物料编号").First();
|
||||
if (enumTriggerEvent == EnumTriggerEvent.生产检定量)
|
||||
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == DictionaryData.Where(p => p.FullName == "生产检").First().Id && p.name == "定量").First();
|
||||
if (enumTriggerEvent == EnumTriggerEvent.生产检定码)
|
||||
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == DictionaryData.Where(p => p.FullName == "生产检").First().Id && p.name == "定码").First();
|
||||
if (enumTriggerEvent == EnumTriggerEvent.生产检产出频次)
|
||||
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == DictionaryData.Where(p => p.FullName == "生产检").First().Id && p.name == "产出频次").First();
|
||||
if (enumTriggerEvent == EnumTriggerEvent.生产检固定次数)
|
||||
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == DictionaryData.Where(p => p.FullName == "生产检").First().Id && p.name == "固定次数").First();
|
||||
if (enumTriggerEvent == EnumTriggerEvent.生产检按流转卡)
|
||||
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == DictionaryData.Where(p => p.FullName == "生产检").First().Id && p.name == "按流转卡").First();
|
||||
var enumTriggerEvent = entity.triggerevent;
|
||||
var remark = RemarkAttribute.GetRemark(enumTriggerEvent);
|
||||
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == DictionaryData.Where(p => p.FullName == remark.CheckType).First().Id && p.name == remark.CheckContent).First();
|
||||
Query = Query.Where((a, b, c, d, e) => b.triggertype == "3" && b.content!.Contains(TriggerEvent.id));
|
||||
}
|
||||
private void Filter(List<QcCheckPlanH> QcCheckPlanHs, TriggerPlanEntity entity)
|
||||
{
|
||||
var removePlanHs = new List<QcCheckPlanH>();
|
||||
var enumTriggerEvent = entity.triggerevent;
|
||||
foreach (var plan in QcCheckPlanHs)
|
||||
{
|
||||
if (enumTriggerEvent == EnumTriggerEvent.首件检换模具)
|
||||
{
|
||||
|
||||
}
|
||||
if (enumTriggerEvent == EnumTriggerEvent.首件检换物料批号)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (enumTriggerEvent == EnumTriggerEvent.首件检换物料编号)
|
||||
{
|
||||
|
||||
}
|
||||
if (enumTriggerEvent == EnumTriggerEvent.首件检新的生产任务)
|
||||
{
|
||||
|
||||
}
|
||||
if (enumTriggerEvent == EnumTriggerEvent.首件检生产任务暂停)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (enumTriggerEvent == EnumTriggerEvent.出厂检按入厂频次)
|
||||
{
|
||||
|
||||
}
|
||||
if (enumTriggerEvent == EnumTriggerEvent.入厂检按物料频次)
|
||||
{
|
||||
|
||||
}
|
||||
if (enumTriggerEvent == EnumTriggerEvent.入厂检按物料编号)
|
||||
{
|
||||
|
||||
}
|
||||
if (enumTriggerEvent == EnumTriggerEvent.生产检定量)
|
||||
{
|
||||
var number = _repository.AsSugarClient().Queryable<QcCheckPlanAdd>().Where(p => p.mainid == plan.id).First().number;
|
||||
if ((entity.newpronum + entity.oldpronum / number) <= (entity.oldpronum / number))
|
||||
removePlanHs.Add(plan);
|
||||
}
|
||||
if (enumTriggerEvent == EnumTriggerEvent.生产检定码)
|
||||
{
|
||||
|
||||
}
|
||||
if (enumTriggerEvent == EnumTriggerEvent.生产检产出频次)
|
||||
{
|
||||
var number = _repository.AsSugarClient().Queryable<QcCheckPlanAdd>().Where(p => p.mainid == plan.id).First().number;
|
||||
if ((entity.pronum % number) != 0)
|
||||
removePlanHs.Add(plan);
|
||||
}
|
||||
if (enumTriggerEvent == EnumTriggerEvent.生产检固定次数)
|
||||
{
|
||||
|
||||
}
|
||||
if (enumTriggerEvent == EnumTriggerEvent.生产检按流转卡)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
removePlanHs.ForEach(p => { QcCheckPlanHs.Remove(p); });
|
||||
}
|
||||
private async Task SaveTask(List<QcCheckPlanH> planhs, TriggerPlanEntity entity)
|
||||
{
|
||||
var DictionaryData = _repository.AsSugarClient().Queryable<DictionaryDataEntity, DictionaryTypeEntity>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aop.Api.Domain;
|
||||
@@ -11,6 +12,7 @@ using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||
@@ -67,7 +69,18 @@ namespace Tnb.WarehouseMgr
|
||||
try
|
||||
{
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.carry_code);
|
||||
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carry.id).ToListAsync();
|
||||
List<WmsCarryCode> carryCodes = new();
|
||||
if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID)
|
||||
{
|
||||
var carryDs = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == carry.id).ToListAsync();
|
||||
var mCarryIds = carryDs.Select(x => x.membercarry_id).ToList();
|
||||
carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => mCarryIds.Contains(it.carry_id)).ToListAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carry.id).ToListAsync();
|
||||
}
|
||||
|
||||
data = carry.Adapt<CarryQueryOutput>();
|
||||
data.wmsCarryCodes = carryCodes.Adapt<List<CarryCodeQueryOutput>>();
|
||||
|
||||
|
||||
@@ -346,6 +346,7 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Ado.BeginTranAsync();
|
||||
List<WmsKittingoutD> kittingOutDs = new();
|
||||
var kittingOuts = input.Adapt<List<WmsKittingoutH>>();
|
||||
var ids = input.Select(x => x.location_code).ToArray();
|
||||
|
||||
for (int i = 0; i < kittingOuts.Count; i++)
|
||||
{
|
||||
@@ -356,6 +357,7 @@ namespace Tnb.WarehouseMgr
|
||||
x.bill_type = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID;
|
||||
x.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
||||
x.biz_type = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID;
|
||||
x.location_id = ids[i];
|
||||
var d = input[i]?.wmsKittingoutDs?.Adapt<List<WmsKittingoutD>>();
|
||||
d?.ForEach(it =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user