油漆实验室,批量变动,定时任务变动
This commit is contained in:
parent
0e4d7e11d2
commit
9b1c8b2b5a
@ -87,8 +87,10 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
throw new CustomException($"程序集或者类名不能为空");
|
||||
}
|
||||
//从 Dto 映射到 实体
|
||||
|
||||
var tasksQz = parm.Adapt<SysTasks>().ToCreate();
|
||||
tasksQz.Create_by = HttpContext.GetName();
|
||||
//tasksQz.Create_by = HttpContext.GetName();
|
||||
tasksQz.Create_by = "admin";
|
||||
tasksQz.ID = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
|
||||
return SUCCESS(_tasksQzService.AddTasks(tasksQz));
|
||||
@ -127,7 +129,8 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
throw new CustomException($"该任务正在运行中,请先停止在更新");
|
||||
}
|
||||
var model = parm.Adapt<SysTasks>();
|
||||
model.Update_by = HttpContextExtension.GetName(HttpContext);
|
||||
model.Update_by = "admin";
|
||||
//model.Update_by = HttpContextExtension.GetName(HttpContext);
|
||||
int response = _tasksQzService.UpdateTasks(model);
|
||||
if (response > 0)
|
||||
{
|
||||
|
||||
@ -50,6 +50,28 @@ namespace ZR.Admin.WebApi.Controllers.mes.ql
|
||||
return ToResponse(new ApiResult(200, "success", ret));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据工单自动生成批处理记录
|
||||
/// </summary>
|
||||
/// <param name="actionDate">执行时间</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("AddBatchListByWorkOrder")]
|
||||
public IActionResult AddBatchListByWorkOrder(DateTime actionDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
int ret = plBatchService.CreatePLBatchRecordsByWorkOrder(actionDate);
|
||||
|
||||
return ToResponse(new ApiResult(200, "success", ret));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return ToResponse(new ApiResult(500, "error", e.Message));
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除测试数据记录
|
||||
/// </summary>
|
||||
@ -89,6 +111,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.ql
|
||||
PLBatch pLBatch = new PLBatch();
|
||||
pLBatch.Id = pLBatchDto.Id;
|
||||
pLBatch.IdGroup = pLBatchDto.plIdGroup;
|
||||
pLBatch.Workorder = pLBatchDto.Workorder;
|
||||
pLBatch.Description = pLBatchDto.Description;
|
||||
pLBatch.Code = pLBatchDto.plCode;
|
||||
pLBatch.Dt = pLBatchDto.plDt;
|
||||
|
||||
@ -14,11 +14,13 @@ namespace ZR.Admin.WebApi.Extensions
|
||||
types.GetProperty("CreateTime", flag)?.SetValue(source, DateTime.Now, null);
|
||||
types.GetProperty("CreatedTime", flag)?.SetValue(source, DateTime.Now, null);
|
||||
types.GetProperty("AddTime", flag)?.SetValue(source, DateTime.Now, null);
|
||||
types.GetProperty("CreateBy", flag)?.SetValue(source, context.GetName(), null);
|
||||
types.GetProperty("Create_by", flag)?.SetValue(source, context.GetName(), null);
|
||||
types.GetProperty("CreatedBy", flag)?.SetValue(source, context.GetName(), null);
|
||||
types.GetProperty("UserId", flag)?.SetValue(source, context.GetUId(), null);
|
||||
|
||||
if(context != null)
|
||||
{
|
||||
types.GetProperty("CreateBy", flag)?.SetValue(source, context.GetName(), null);
|
||||
types.GetProperty("Create_by", flag)?.SetValue(source, context.GetName(), null);
|
||||
types.GetProperty("CreatedBy", flag)?.SetValue(source, context.GetName(), null);
|
||||
types.GetProperty("UserId", flag)?.SetValue(source, context.GetUId(), null);
|
||||
}
|
||||
return source;
|
||||
}
|
||||
|
||||
@ -31,10 +33,12 @@ namespace ZR.Admin.WebApi.Extensions
|
||||
types.GetProperty("UpdateTime", flag)?.SetValue(source, DateTime.Now, null);
|
||||
types.GetProperty("Update_time", flag)?.SetValue(source, DateTime.Now, null);
|
||||
types.GetProperty("UpdatedTime", flag)?.SetValue(source, DateTime.Now, null);
|
||||
types.GetProperty("UpdateBy", flag)?.SetValue(source, context.GetName(), null);
|
||||
types.GetProperty("Update_by", flag)?.SetValue(source, context.GetName(), null);
|
||||
types.GetProperty("UpdatedBy", flag)?.SetValue(source, context.GetName(), null);
|
||||
|
||||
if(context != null)
|
||||
{
|
||||
types.GetProperty("UpdateBy", flag)?.SetValue(source, context.GetName(), null);
|
||||
types.GetProperty("Update_by", flag)?.SetValue(source, context.GetName(), null);
|
||||
types.GetProperty("UpdatedBy", flag)?.SetValue(source, context.GetName(), null);
|
||||
}
|
||||
return source;
|
||||
}
|
||||
|
||||
|
||||
@ -16,6 +16,11 @@
|
||||
/// </summary>
|
||||
public string plIdGroup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源工单号
|
||||
/// </summary>
|
||||
public string Workorder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产品描述
|
||||
/// </summary>
|
||||
|
||||
@ -20,6 +20,12 @@
|
||||
public string IdGroup { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 来源工单号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "workorder")]
|
||||
public string Workorder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产品描述
|
||||
/// </summary>
|
||||
|
||||
@ -176,6 +176,7 @@ namespace ZR.Model.MES.wms.Dto
|
||||
public string Key { get; set; }
|
||||
public string Label { get; set; }
|
||||
public string Value { get; set; }
|
||||
public string Color { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
using Infrastructure.Attribute;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using ZR.Model.MES.pro;
|
||||
using ZR.Model.MES.ql;
|
||||
@ -73,14 +74,18 @@ namespace ZR.Service.mes.ql
|
||||
.ToExpression();
|
||||
List<ProWorkorder_v2> workOrderList = Context.Queryable<ProWorkorder_v2>()
|
||||
.Where(predicate)
|
||||
.OrderBy(it => it.Sort)
|
||||
.OrderByDescending(it => it.Sort)
|
||||
.ToList();
|
||||
foreach(ProWorkorder_v2 workorder in workOrderList)
|
||||
{
|
||||
|
||||
List<PLBatch> pLBatches = CreatePLBatchRecordsByWorkOrder(workorder);
|
||||
int res = Context.Insertable<PLBatch>(pLBatches).ExecuteCommand();
|
||||
if (res == 0)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("插入批量检测记录异常,异常工单:" + workorder.ClientWorkorder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Context.Ado.CommitTran();
|
||||
return 1;
|
||||
}
|
||||
@ -106,6 +111,40 @@ namespace ZR.Service.mes.ql
|
||||
PLBatch t4 = GetDefaultPLBatch();
|
||||
PLBatch t5 = GetDefaultPLBatch();
|
||||
PLBatch t6 = GetDefaultPLBatch();
|
||||
|
||||
// 工单信息录入
|
||||
t1.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t1.Description = workorder.ProductDescription;
|
||||
t1.Code = workorder.Colour;
|
||||
t1.Workorder = workorder.ClientWorkorder;
|
||||
|
||||
t2.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t2.Description = workorder.ProductDescription;
|
||||
t2.Code = workorder.Colour;
|
||||
t2.Workorder = workorder.ClientWorkorder;
|
||||
|
||||
t3.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t3.Description = workorder.ProductDescription;
|
||||
t3.Code = workorder.Colour;
|
||||
t3.Workorder = workorder.ClientWorkorder;
|
||||
|
||||
t4.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t4.Description = workorder.ProductDescription;
|
||||
t4.Code = workorder.Colour;
|
||||
t4.Workorder = workorder.ClientWorkorder;
|
||||
|
||||
t5.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t5.Description = workorder.ProductDescription;
|
||||
t5.Code = workorder.Colour;
|
||||
t5.Workorder = workorder.ClientWorkorder;
|
||||
|
||||
t6.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t6.Description = workorder.ProductDescription;
|
||||
t6.Code = workorder.Colour;
|
||||
t6.Workorder = workorder.ClientWorkorder;
|
||||
|
||||
|
||||
|
||||
t1.Value01 = "15°"; t1.Value07 = "0"; t1.Value09 = "R1"; t1.Value14 = "底漆"; t1.Value19 = "2";
|
||||
t2.Value01 = "25°"; t2.Value07 = "0"; t2.Value09 = "R2"; t2.Value14 = "色漆"; t2.Value19 = "2";
|
||||
t3.Value01 = "45°"; t3.Value07 = "0"; t3.Value09 = "R3"; t3.Value14 = "云母"; t3.Value19 = "2";
|
||||
@ -155,8 +194,8 @@ namespace ZR.Service.mes.ql
|
||||
endTime = endTime.ToLocalTime();
|
||||
int totalNum = 0;
|
||||
var predicate = Expressionable.Create<PLBatch>()
|
||||
.AndIF(starttime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.CreatedTime >= starttime.ToLocalTime())
|
||||
.AndIF(endTime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.CreatedTime <= endTime.ToLocalTime())
|
||||
.AndIF(starttime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.CreatedTime >= starttime)
|
||||
.AndIF(endTime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.CreatedTime <= endTime)
|
||||
.AndIF(!string.IsNullOrEmpty(code), it => it.Code.Contains(code))
|
||||
.AndIF(!string.IsNullOrEmpty(description), it => it.Description.Contains(description))
|
||||
.ToExpression();
|
||||
@ -187,6 +226,7 @@ namespace ZR.Service.mes.ql
|
||||
{
|
||||
Id = 0,
|
||||
IdGroup = DateTime.Now.ToString("yyyyMMddHHmmssfff"),
|
||||
Workorder = "",
|
||||
Description = "",
|
||||
Dt = "",
|
||||
Code = "",
|
||||
@ -246,7 +286,7 @@ namespace ZR.Service.mes.ql
|
||||
}
|
||||
else
|
||||
{
|
||||
return (int)dayOfWeek + 1;
|
||||
return (int)dayOfWeek;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,7 +158,8 @@ namespace ZR.Service.mes.ql
|
||||
{
|
||||
Key = it.Id,
|
||||
Label = "[ " + it.Partnumber + " ] " + it.Description,
|
||||
Value = it.Description
|
||||
Value = it.Description,
|
||||
Color = it.Color
|
||||
}
|
||||
)
|
||||
.Take(10)
|
||||
|
||||
@ -4,6 +4,7 @@ using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
using Infrastructure.Attribute;
|
||||
using JinianNet.JNTemplate;
|
||||
using Mapster.Utils;
|
||||
using Model.DBModel;
|
||||
using Quartz;
|
||||
using SqlSugar;
|
||||
@ -31,6 +32,7 @@ namespace ZR.Tasks.TaskScheduler
|
||||
|
||||
public async Task Run()
|
||||
{
|
||||
Console.WriteLine("执行毛坯调试自动出库");
|
||||
await Task.Delay(1);
|
||||
//TODO 业务逻辑
|
||||
DateTime nowTime = DateTime.Now;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user