反向追溯相关接口
This commit is contained in:
@@ -15,8 +15,11 @@ namespace Tnb.BasicData
|
||||
|
||||
//齐套出库接口
|
||||
public const string MES_KITTING_OUT_STK = "/api/wms/wmskitting-out/mes-kitting-out-stk";
|
||||
|
||||
//物料标签查询接口
|
||||
public const string MES_FETCH_IN_OUT_STOCK_INFO_BY_BAR_CODE = "/api/wms/wms-in-stock/mes-fetch-in-out-stock-info-by-bar-code";
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -136,4 +136,105 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class PrdMoReverseFromMaterialOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
public string material_id { get; set; }
|
||||
/// <summary>
|
||||
/// 物料编号
|
||||
/// </summary>
|
||||
public string material_code { get; set; }
|
||||
/// <summary>
|
||||
/// 批次
|
||||
/// </summary>
|
||||
public string code_batch { get; set;}
|
||||
/// <summary>
|
||||
/// 采购单号
|
||||
/// </summary>
|
||||
public string purchase_code { get; set; }
|
||||
/// <summary>
|
||||
/// 供应商
|
||||
/// </summary>
|
||||
public string supplier_id { get; set; }
|
||||
/// <summary>
|
||||
/// 条码数量
|
||||
/// </summary>
|
||||
public decimal barcode_qty { get; set; }
|
||||
/// <summary>
|
||||
/// 单位ID
|
||||
/// </summary>
|
||||
public string unit_id { get; set; }
|
||||
/// <summary>
|
||||
/// 入库单号
|
||||
/// </summary>
|
||||
public string in_bill_code { get; set; }
|
||||
/// <summary>
|
||||
/// 入库时间
|
||||
/// </summary>
|
||||
public DateTime instock_time { get; set; }
|
||||
/// <summary>
|
||||
/// 出库单号
|
||||
/// </summary>
|
||||
public string out_bill_code { get; set; }
|
||||
/// <summary>
|
||||
/// 出库时间
|
||||
/// </summary>
|
||||
public DateTime? outstock_time { get; set; }
|
||||
/// <summary>
|
||||
/// 仓库ID
|
||||
/// </summary>
|
||||
public string warehouse_id { get; set; }
|
||||
/// <summary>
|
||||
/// 仓库名称
|
||||
/// </summary>
|
||||
public string warehouse_name { get; set; }
|
||||
/// <summary>
|
||||
/// 库位ID
|
||||
/// </summary>
|
||||
public string location_id { get; set; }
|
||||
/// <summary>
|
||||
/// 库位编号
|
||||
/// </summary>
|
||||
public string location_code { get; set; }
|
||||
/// <summary>
|
||||
/// 已投数量
|
||||
/// </summary>
|
||||
public decimal feeding_num { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 物料反向追溯投料信息输出父类
|
||||
/// </summary>
|
||||
public class PrdMoReverseFromFeedingOutput
|
||||
{
|
||||
public string mo_task_id { get; set; }
|
||||
public string mo_task_code { get; set; }
|
||||
public string mo_code { get; set; }
|
||||
public string material_code { get; set; }
|
||||
public string material_name { get; set; }
|
||||
public string material_standard { get; set; }
|
||||
public List<PrdMoReverseFromFeedingDetailOutput> children { get; set; } = new List<PrdMoReverseFromFeedingDetailOutput>();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 物料反向追溯投料信息输出字类
|
||||
/// </summary>
|
||||
public class PrdMoReverseFromFeedingDetailOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 投料子表id
|
||||
/// </summary>
|
||||
public string feeding_detail_id { get; set; }
|
||||
public string feeding_time { get; set; }
|
||||
public decimal num { get; set; }
|
||||
public string check_conclusion { get; set; }
|
||||
public string feeding_name { get; set; }
|
||||
public string station_name { get; set; }
|
||||
public string process_name { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,6 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
|
||||
public string? mo_task_code { get; set; }
|
||||
|
||||
public string? batch { get; set; }
|
||||
public string? barcode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,11 @@ public partial class PrdMaterialReceiptD : BaseEntity<string>
|
||||
/// 单位id
|
||||
/// </summary>
|
||||
public string? unit_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条码编号
|
||||
/// </summary>
|
||||
public string? barcode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 载具id
|
||||
|
||||
@@ -84,6 +84,12 @@ public partial class PrdReport : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string? batch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条码
|
||||
/// </summary>
|
||||
public string? barcode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设备id
|
||||
/// </summary>
|
||||
|
||||
@@ -181,6 +181,7 @@ namespace Tnb.ProductionMgr
|
||||
batch = item["batch"]?.ToString(),
|
||||
unit_id = item["unit_id"]?.ToString(),
|
||||
carry_id = input.carry_id,
|
||||
barcode = item["barcode"]?.ToString(),
|
||||
is_all_feeding = 0,
|
||||
member_carry_id = item["member_carry_id"]?.ToString(),
|
||||
member_carry_code = item["member_carry_code"]?.ToString(),
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Filter;
|
||||
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.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
@@ -12,6 +16,7 @@ using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.BasicData.Entities;
|
||||
@@ -21,6 +26,8 @@ using Tnb.ProductionMgr.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||
using Tnb.ProductionMgr.Entities.Enums;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
using AuthResponse = JNPF.Extras.CollectiveOAuth.Models.AuthResponse;
|
||||
using StringExtensions = JNPF.Common.Extension.StringExtensions;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
@@ -204,7 +211,7 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
throw new ArgumentNullException(nameof(input));
|
||||
}
|
||||
if (input.Behavior.IsNullOrWhiteSpace())
|
||||
if (StringExtensions.IsNullOrWhiteSpace(input.Behavior))
|
||||
{
|
||||
throw new ArgumentException($"{nameof(input.Behavior)},not be null or empty");
|
||||
}
|
||||
@@ -359,7 +366,7 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
#endregion
|
||||
|
||||
#region 工单追溯相关
|
||||
#region 正向工单追溯相关
|
||||
|
||||
/// <summary>
|
||||
/// 工单追溯一级列表
|
||||
@@ -377,15 +384,15 @@ namespace Tnb.ProductionMgr
|
||||
ids1 = await _db.Queryable<PrdMoTask>().Where(x => x.mo_task_code.Contains(x.mo_task_code)).Select(x => x.mo_id).ToListAsync();
|
||||
ids = ids1;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(input.batch))
|
||||
if (!string.IsNullOrEmpty(input.barcode))
|
||||
{
|
||||
ids2 = await _db.Queryable<PrdReport>()
|
||||
.LeftJoin<PrdMoTask>((a,b)=>a.mo_task_id==b.id)
|
||||
.Where((a,b) => a.batch.Contains(input.batch)).Select((a,b) => b.mo_id).ToListAsync();
|
||||
.Where((a,b) => a.barcode.Contains(input.barcode)).Select((a,b) => b.mo_id).ToListAsync();
|
||||
ids = ids2;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(input.mo_task_code) && !string.IsNullOrEmpty(input.batch))
|
||||
if (!string.IsNullOrEmpty(input.mo_task_code) && !string.IsNullOrEmpty(input.barcode))
|
||||
{
|
||||
ids = ids1.Intersect(ids2).ToList();
|
||||
}
|
||||
@@ -419,11 +426,11 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
string mo_id = dic.ContainsKey("mo_id") ? dic["mo_id"] : "";
|
||||
string mo_task_code = dic.ContainsKey("mo_task_code") ? dic["mo_task_code"] : "";
|
||||
string batch = dic.ContainsKey("batch") ? dic["batch"] : "";
|
||||
string barcode = dic.ContainsKey("barcode") ? dic["barcode"] : "";
|
||||
List<string> ids = new List<string>();
|
||||
if (!string.IsNullOrEmpty(batch))
|
||||
if (!string.IsNullOrEmpty(barcode))
|
||||
{
|
||||
ids = await _db.Queryable<PrdReport>().Where(x => x.batch.Contains(batch)).Select(x=>x.mo_task_id).ToListAsync();
|
||||
ids = await _db.Queryable<PrdReport>().Where(x => x.barcode.Contains(barcode)).Select(x=>x.mo_task_id).ToListAsync();
|
||||
}
|
||||
|
||||
PrdMo prdMo = await _repository.GetSingleAsync(x => x.id == mo_id);
|
||||
@@ -491,11 +498,11 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
string mo_task_id = dic.ContainsKey("mo_task_id") ? dic["mo_task_id"] : "";
|
||||
string mo_task_code = dic.ContainsKey("mo_task_code") ? dic["mo_task_code"] : "";
|
||||
string batch = dic.ContainsKey("batch") ? dic["batch"] : "";
|
||||
string barcode = dic.ContainsKey("barcode") ? dic["barcode"] : "";
|
||||
List<string> ids = new List<string>();
|
||||
if (!string.IsNullOrEmpty(batch))
|
||||
if (!string.IsNullOrEmpty(barcode))
|
||||
{
|
||||
ids = await _db.Queryable<PrdReport>().Where(x => x.batch.Contains(batch)).Select(x=>x.mo_task_id).ToListAsync();
|
||||
ids = await _db.Queryable<PrdReport>().Where(x => x.barcode.Contains(barcode)).Select(x=>x.mo_task_id).ToListAsync();
|
||||
}
|
||||
|
||||
PrdMoTask prdMoTask = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == mo_task_id);
|
||||
@@ -540,18 +547,18 @@ namespace Tnb.ProductionMgr
|
||||
public async Task<dynamic> PrdMoFromManList(Dictionary<string,string> dic)
|
||||
{
|
||||
string mo_task_id = dic.ContainsKey("mo_task_id") ? dic["mo_task_id"] : "";
|
||||
string batch = dic.ContainsKey("batch") ? dic["batch"] : "";
|
||||
string barcode = dic.ContainsKey("barcode") ? dic["barcode"] : "";
|
||||
List<string> ids = new List<string>();
|
||||
if (!string.IsNullOrEmpty(batch))
|
||||
if (!string.IsNullOrEmpty(barcode))
|
||||
{
|
||||
ids = await _db.Queryable<PrdReport>().Where(x => x.batch.Contains(batch)).Select(x=>x.mo_task_id).ToListAsync();
|
||||
ids = await _db.Queryable<PrdReport>().Where(x => x.barcode.Contains(barcode)).Select(x=>x.mo_task_id).ToListAsync();
|
||||
}
|
||||
|
||||
return await _db.Queryable<PrdReport>()
|
||||
.LeftJoin<UserEntity>((a, b) => a.create_id == b.Id)
|
||||
.WhereIF(!string.IsNullOrEmpty(mo_task_id), (a, b) => a.mo_task_id == mo_task_id)
|
||||
// .WhereIF(ids!=null && ids.Count>0,(a,b)=>ids.Contains(a.mo_task_id))
|
||||
.WhereIF(!string.IsNullOrEmpty(batch),(a,b)=>a.batch.Contains(batch))
|
||||
.WhereIF(!string.IsNullOrEmpty(barcode),(a,b)=>a.barcode.Contains(barcode))
|
||||
.GroupBy((a,b)=>new {a.create_id,employee_name = b.RealName})
|
||||
.Select((a, b) => new PrdMoFromManListOutput()
|
||||
{
|
||||
@@ -575,11 +582,11 @@ namespace Tnb.ProductionMgr
|
||||
public async Task<dynamic> PrdMoFromEquipList(Dictionary<string,string> dic)
|
||||
{
|
||||
string mo_task_id = dic.ContainsKey("mo_task_id") ? dic["mo_task_id"] : "";
|
||||
string batch = dic.ContainsKey("batch") ? dic["batch"] : "";
|
||||
string barcode = dic.ContainsKey("barcode") ? dic["barcode"] : "";
|
||||
List<string> ids = new List<string>();
|
||||
if (!string.IsNullOrEmpty(batch))
|
||||
if (!string.IsNullOrEmpty(barcode))
|
||||
{
|
||||
ids = await _db.Queryable<PrdReport>().Where(x => x.batch.Contains(batch)).Select(x=>x.mo_task_id).ToListAsync();
|
||||
ids = await _db.Queryable<PrdReport>().Where(x => x.barcode.Contains(barcode)).Select(x=>x.mo_task_id).ToListAsync();
|
||||
}
|
||||
|
||||
return await _db.Queryable<PrdMoTask>()
|
||||
@@ -603,11 +610,11 @@ namespace Tnb.ProductionMgr
|
||||
public async Task<dynamic> PrdMoFromMaterialList(Dictionary<string,string> dic)
|
||||
{
|
||||
string mo_task_id = dic.ContainsKey("mo_task_id") ? dic["mo_task_id"] : "";
|
||||
string batch = dic.ContainsKey("batch") ? dic["batch"] : "";
|
||||
string barcode = dic.ContainsKey("barcode") ? dic["barcode"] : "";
|
||||
List<string> ids = new List<string>();
|
||||
if (!string.IsNullOrEmpty(batch))
|
||||
if (!string.IsNullOrEmpty(barcode))
|
||||
{
|
||||
ids = await _db.Queryable<PrdReport>().Where(x => x.batch.Contains(batch)).Select(x=>x.mo_task_id).ToListAsync();
|
||||
ids = await _db.Queryable<PrdReport>().Where(x => x.barcode.Contains(barcode)).Select(x=>x.mo_task_id).ToListAsync();
|
||||
}
|
||||
PrdMoTask prdMoTask = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == mo_task_id);
|
||||
PrdMo prdMo = await _db.Queryable<PrdMo>().SingleAsync(x => x.id == prdMoTask.mo_id);
|
||||
@@ -617,7 +624,7 @@ namespace Tnb.ProductionMgr
|
||||
* 3 物料二维码为精确搜索时 按照先进先出的规则计算投入物料
|
||||
* 4 组装包装可投入物料组成 1)直接从生产线上流转下来的物料 2)投入的物料
|
||||
*/
|
||||
if (string.IsNullOrEmpty(batch))
|
||||
if (string.IsNullOrEmpty(barcode))
|
||||
{
|
||||
if (prdMoTask.schedule_type == 1)
|
||||
{
|
||||
@@ -645,8 +652,8 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
else
|
||||
{
|
||||
PrdReport prdReport = await _db.Queryable<PrdReport>().Where(x => x.batch == batch).FirstAsync();
|
||||
List<PrdReport> prdReports = await _db.Queryable<PrdReport>().Where(x=>x.create_time<=prdReport.create_time && x.batch!=batch && x.mo_task_id==mo_task_id).ToListAsync();
|
||||
PrdReport prdReport = await _db.Queryable<PrdReport>().Where(x => x.barcode == barcode).FirstAsync();
|
||||
List<PrdReport> prdReports = await _db.Queryable<PrdReport>().Where(x=>x.create_time<=prdReport.create_time && x.barcode!=barcode && x.mo_task_id==mo_task_id).ToListAsync();
|
||||
int? beforeReportNum = prdReports.Sum(x => x.reported_qty);
|
||||
List<string> prdFeedingIds = new List<string>();
|
||||
if (prdMoTask.schedule_type == 1)
|
||||
@@ -813,6 +820,7 @@ namespace Tnb.ProductionMgr
|
||||
material_code = b.code,
|
||||
material_name = b.name,
|
||||
batch = a.batch,
|
||||
supplier_name = "自制"
|
||||
});
|
||||
|
||||
return await _db.UnionAll(queryable1, queryable2).ToListAsync();
|
||||
@@ -825,13 +833,117 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 反向工单追溯相关
|
||||
|
||||
/// <summary>
|
||||
/// 物料反向追溯物料信息
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> PrdMoReverseFromMaterialInfo(Dictionary<string, string> dic)
|
||||
{
|
||||
string barcode = dic.ContainsKey("barcode") ? dic["barcode"] : "";
|
||||
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"]
|
||||
};
|
||||
Dictionary<string, object> postData = new Dictionary<string, object>()
|
||||
{
|
||||
["org_id"] = _userManager.GetUserInfo().Result.organizeId,
|
||||
["barcode"] = new List<string>() { barcode },
|
||||
["currentPage"] = 1,
|
||||
["pageSize"] = int.MaxValue,
|
||||
};
|
||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_FETCH_IN_OUT_STOCK_INFO_BY_BAR_CODE,JsonConvert.SerializeObject(postData),header);
|
||||
Log.Information(sendResult);
|
||||
|
||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||
if (authResponse.code != 200)
|
||||
{
|
||||
throw Oops.Bah(authResponse.msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
PageResult<PrdMoReverseFromMaterialOutput> output = JsonConvert.DeserializeObject<PageResult<PrdMoReverseFromMaterialOutput>>(authResponse.data.ToString(),new Tnb.Common.Utils.DateTimeJsonConverter());
|
||||
if (output.list != null && output.list.Count > 0)
|
||||
{
|
||||
output.list[0].feeding_num = await _db.Queryable<PrdMaterialReceiptD>()
|
||||
.LeftJoin<PrdFeedingD>((a, b) => a.id == b.material_receipt_detail_id)
|
||||
.Where((a, b) => a.barcode == barcode).SumAsync((a, b) => b.num);
|
||||
return output.list[0];
|
||||
}
|
||||
}
|
||||
|
||||
return Array.Empty<string>();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 物料反向追溯投料信息
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> PrdMoReverseFromFeedingInfo(Dictionary<string, string> dic)
|
||||
{
|
||||
string barcode = dic.ContainsKey("barcode") ? dic["barcode"] : "";
|
||||
List<string> ids = await _db.Queryable<PrdMaterialReceiptD>()
|
||||
.LeftJoin<PrdFeedingD>((a, b) => a.id == b.material_receipt_detail_id)
|
||||
.LeftJoin<PrdFeedingH>((a, b, c) => b.feeding_id == c.id)
|
||||
.Where(a => a.barcode == barcode)
|
||||
.Select((a, b, c) => c.mo_task_id).ToListAsync();
|
||||
|
||||
return await _db.Queryable<PrdMoTask>()
|
||||
.LeftJoin<PrdMo>((a, b) => a.mo_id == b.id)
|
||||
.LeftJoin<BasMaterial>((a,b,c)=>a.material_id==c.id)
|
||||
.Where((a,b,c)=>ids.Contains(a.id))
|
||||
.Select((a, b, c) => new PrdMoReverseFromFeedingOutput
|
||||
{
|
||||
mo_task_id = a.id,
|
||||
mo_task_code = a.mo_task_code,
|
||||
mo_code = b.mo_code,
|
||||
material_code = c.code,
|
||||
material_name = c.name,
|
||||
material_standard = c.material_standard,
|
||||
children = SqlFunc.Subqueryable<PrdFeedingD>()
|
||||
.LeftJoin<PrdFeedingH>((x,y)=>x.feeding_id==y.id)
|
||||
.LeftJoin<UserEntity>((x,y,z)=>y.create_id==z.Id)
|
||||
.LeftJoin<OrganizeEntity>((x,y,z,org)=>y.station_id==org.Id)
|
||||
.LeftJoin<BasProcess>((x,y,z,org,process)=>y.process_id==process.id)
|
||||
.LeftJoin<PrdMaterialReceiptD>((x,y,z,org,process,mp)=>x.material_receipt_detail_id==mp.id)
|
||||
.Where((x,y,z)=>y.mo_task_id==a.id).ToList((x,y,z,org,process,mp)=>new PrdMoReverseFromFeedingDetailOutput
|
||||
{
|
||||
feeding_detail_id = x.id,
|
||||
feeding_time = y.create_time==null ? "" : y.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
num = x.num,
|
||||
check_conclusion = mp.check_conclusion,
|
||||
feeding_name = z.RealName,
|
||||
station_name = org.FullName,
|
||||
process_name = process.process_name
|
||||
}),
|
||||
}).ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 物料反向追溯查出信息
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> PrdMoReverseFromOutInfo(Dictionary<string, string> dic)
|
||||
{
|
||||
string feeding_detail_id = dic.ContainsKey("feeding_detail_id") ? dic["feeding_detail_id"] : "";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1404,7 +1404,8 @@ namespace Tnb.ProductionMgr
|
||||
report.reported_qty = input.reported_qty;
|
||||
report.create_id = _userManager.UserId;
|
||||
report.create_time = DateTime.Now;
|
||||
report.batch = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString();
|
||||
// report.batch = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString();
|
||||
report.barcode = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString();
|
||||
report.equip_id = prdMoTask.eqp_id;
|
||||
report.mbom_process_id = prdMoTask.mbom_process_id;
|
||||
report.station = input.station;
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace Tnb.ProductionMgr
|
||||
create_id = y.RealName,
|
||||
create_id_id = x.create_id,
|
||||
create_time = x.create_time==null ? "" : x.create_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
batch = x.batch
|
||||
batch = x.barcode
|
||||
})
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
return PageResult<ReportRecordListOutput>.SqlSugarPageResult(result);
|
||||
|
||||
27
common/Tnb.Common/Utils/DateTimeJsonConverter.cs
Normal file
27
common/Tnb.Common/Utils/DateTimeJsonConverter.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Tnb.Common.Utils
|
||||
{
|
||||
public class DateTimeJsonConverter : JsonConverter
|
||||
{
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return objectType == typeof(DateTime);
|
||||
}
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
TypeCode typeCode = Type.GetTypeCode(reader.Value.GetType());
|
||||
if (typeCode == TypeCode.DateTime)
|
||||
return reader.Value;
|
||||
|
||||
var t = long.Parse((string)(reader.Value.ToString()));
|
||||
return new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(t);
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user