Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -87,7 +87,7 @@ public static class DictConst
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ComplatedEnCode = "Complated";
|
public const string ComplatedEnCode = "Complated";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 任务单状态-待排产
|
/// 任务单状态-待下发
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ToBeScheduledEncode = "ToBeScheduled";
|
public const string ToBeScheduledEncode = "ToBeScheduled";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -203,4 +203,9 @@ public partial class EqpEquipment : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? responsibler_id { get; set; }
|
public string? responsibler_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 二维码
|
||||||
|
/// </summary>
|
||||||
|
public string? qrcode { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,5 +23,12 @@ namespace Tnb.EquipMgr.Interfaces
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<dynamic> GetWorklineAndEquipTree(Dictionary<string,string> dic);
|
public Task<dynamic> GetWorklineAndEquipTree(Dictionary<string,string> dic);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据二维码查设备
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dic"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Task<EqpEquipment> GetEntityByQrcode(Dictionary<string, string> dic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -233,5 +233,12 @@ namespace Tnb.EquipMgr
|
|||||||
["list"] = list1,
|
["list"] = list1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<EqpEquipment> GetEntityByQrcode(Dictionary<string, string> dic)
|
||||||
|
{
|
||||||
|
string qrcode = dic["qrcode"];
|
||||||
|
return await _repository.GetSingleAsync(x => x.qrcode == qrcode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||||
|
{
|
||||||
|
public class ChangeEquipInput
|
||||||
|
{
|
||||||
|
public string mo_task_id { get; set; }
|
||||||
|
public string equip_id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||||
|
{
|
||||||
|
public class ChangeMoldInput
|
||||||
|
{
|
||||||
|
public string mo_task_id { get; set; }
|
||||||
|
public string mold_id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||||
|
{
|
||||||
|
public class ChangeWorklineInput
|
||||||
|
{
|
||||||
|
public string mo_task_id { get; set; }
|
||||||
|
public string workline_id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,5 +16,10 @@ namespace Tnb.ProductionMgr.Entities.Dto
|
|||||||
///任务单操作状态
|
///任务单操作状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string statusName { get; set; }
|
public string statusName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排产类型:1、注塑、挤出2、组装、包装
|
||||||
|
/// </summary>
|
||||||
|
public int? schedule_type { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,18 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
|||||||
public string mo_task_code { get; set; }
|
public string mo_task_code { get; set; }
|
||||||
public string mo_task_status { get; set; }
|
public string mo_task_status { get; set; }
|
||||||
public string material_id { get; set; }
|
public string material_id { get; set; }
|
||||||
|
public string material_id_id { get; set; }
|
||||||
public string mold_id { get; set; }
|
public string mold_id { get; set; }
|
||||||
|
public string mold_id_id { get; set; }
|
||||||
public int? plan_qty { get; set; }
|
public int? plan_qty { get; set; }
|
||||||
public int? complete_qty { get; set; }
|
public int? complete_qty { get; set; }
|
||||||
public int? scheduled_qty { get; set; }
|
public int? scheduled_qty { get; set; }
|
||||||
public string workline_id { get; set; }
|
public string workline_id { get; set; }
|
||||||
|
public string workline_id_id { get; set; }
|
||||||
public string estimated_start_date { get; set; }
|
public string estimated_start_date { get; set; }
|
||||||
public string estimated_end_date { get; set; }
|
public string estimated_end_date { get; set; }
|
||||||
public string eqp_id { get; set; }
|
public string eqp_id { get; set; }
|
||||||
|
public string eqp_id_id { get; set; }
|
||||||
public string create_time { get; set; }
|
public string create_time { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,6 +114,14 @@ namespace Tnb.ProductionMgr.Entities
|
|||||||
[SugarColumn(IsIgnore = true)]
|
[SugarColumn(IsIgnore = true)]
|
||||||
public string workline_code { get; set; }
|
public string workline_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工位编号
|
||||||
|
/// </summary>
|
||||||
|
public string? station_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工序编号
|
||||||
|
/// </summary>
|
||||||
|
public string? process_code { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ using Tnb.ProductionMgr.Entities.Consts;
|
|||||||
using Tnb.WarehouseMgr;
|
using Tnb.WarehouseMgr;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
using Tnb.BasicData;
|
using Tnb.BasicData;
|
||||||
|
using Tnb.EquipMgr.Entities;
|
||||||
|
|
||||||
namespace Tnb.ProductionMgr
|
namespace Tnb.ProductionMgr
|
||||||
{
|
{
|
||||||
@@ -141,9 +142,29 @@ namespace Tnb.ProductionMgr
|
|||||||
throw new Exception("没有签收物料");
|
throw new Exception("没有签收物料");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var mo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == moTask.mo_id);
|
||||||
|
var material = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.material_id);
|
||||||
|
var station = await db.Queryable<OrganizeEntity>().SingleAsync(x => x.Id == input.station_id);
|
||||||
|
var process = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == input.process_id);
|
||||||
|
var taskLog = new PrdTaskLog();
|
||||||
|
taskLog.id = SnowflakeIdHelper.NextId();
|
||||||
|
taskLog.mo_code = mo?.mo_code!;
|
||||||
|
taskLog.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == input.equip_id))?.code!;
|
||||||
|
taskLog.mold_code = "";
|
||||||
|
taskLog.item_code = material?.code!;
|
||||||
|
taskLog.item_standard = material?.material_standard!;
|
||||||
|
taskLog.status = "生产投料";
|
||||||
|
taskLog.operator_name = _userManager.RealName;
|
||||||
|
taskLog.create_id = _userManager.UserId;
|
||||||
|
taskLog.create_time = DateTime.Now;
|
||||||
|
taskLog.mo_task_id = moTask.id;
|
||||||
|
taskLog.mo_task_code = moTask.mo_task_code;
|
||||||
|
taskLog.station_code = station?.EnCode;
|
||||||
|
taskLog.process_code = process.code;
|
||||||
|
|
||||||
await db.Insertable<PrdFeedingH>(prdFeedingH).ExecuteCommandAsync();
|
await db.Insertable<PrdFeedingH>(prdFeedingH).ExecuteCommandAsync();
|
||||||
await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
|
await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
|
||||||
|
await db.Insertable<PrdTaskLog>(taskLog).ExecuteCommandAsync();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -226,7 +226,11 @@ namespace Tnb.ProductionMgr
|
|||||||
var list = await _repository.AsSugarClient().Queryable<PrdTaskLog>().Where(it => it.mo_task_id == taskId).ToListAsync();
|
var list = await _repository.AsSugarClient().Queryable<PrdTaskLog>().Where(it => it.mo_task_id == taskId).ToListAsync();
|
||||||
var data = list.Adapt<List<PrdTaskOperOutput>>();
|
var data = list.Adapt<List<PrdTaskOperOutput>>();
|
||||||
var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
|
var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
|
||||||
_repository.AsSugarClient().ThenMapper(data, x => x.statusName = dic.ContainsKey(x.status) ? dic[x.status].ToString() : "");
|
_repository.AsSugarClient().ThenMapper(data, x =>
|
||||||
|
{
|
||||||
|
x.statusName = dic.ContainsKey(x.status) ? dic[x.status].ToString() : x.status;
|
||||||
|
x.schedule_type = _repository.AsSugarClient().Queryable<PrdMoTask>().Single(y => y.id == x.mo_task_id).schedule_type;
|
||||||
|
});
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1820,20 +1824,25 @@ namespace Tnb.ProductionMgr
|
|||||||
(a, b, c, d) => a.workline_id == eqpId || a.eqp_id == eqpId)
|
(a, b, c, d) => a.workline_id == eqpId || a.eqp_id == eqpId)
|
||||||
.WhereIF(worklineIds.Count > 0, (a, b, c, d) => worklineIds.Contains(a.workline_id))
|
.WhereIF(worklineIds.Count > 0, (a, b, c, d) => worklineIds.Contains(a.workline_id))
|
||||||
.WhereIF(equipIds.Count > 0, (a, b, c, d) => equipIds.Contains(a.eqp_id))
|
.WhereIF(equipIds.Count > 0, (a, b, c, d) => equipIds.Contains(a.eqp_id))
|
||||||
|
.Where((a)=>a.mo_task_status==DictConst.ToBeStartedEnCode || a.mo_task_code==DictConst.ToBeScheduledEncode || a.mo_task_code==DictConst.MoStatusPauseCode)
|
||||||
.Select((a, b, c, d,e,f,g,h) => new WorkOrderAdjustmentListOutput
|
.Select((a, b, c, d,e,f,g,h) => new WorkOrderAdjustmentListOutput
|
||||||
{
|
{
|
||||||
id = a.id,
|
id = a.id,
|
||||||
mo_task_code = a.mo_task_code,
|
mo_task_code = a.mo_task_code,
|
||||||
material_id = b.code+"/"+b.name,
|
material_id = b.code+"/"+b.name,
|
||||||
|
material_id_id = a.material_id,
|
||||||
mold_id = e.mold_code+"/"+e.mold_name,
|
mold_id = e.mold_code+"/"+e.mold_name,
|
||||||
|
mold_id_id = a.mold_id,
|
||||||
mo_task_status = d.FullName,
|
mo_task_status = d.FullName,
|
||||||
plan_qty = f.plan_qty,
|
plan_qty = f.plan_qty,
|
||||||
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0) + SqlFunc.IsNull(a.scrap_qty,0),
|
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0) + SqlFunc.IsNull(a.scrap_qty,0),
|
||||||
scheduled_qty = a.scheduled_qty,
|
scheduled_qty = a.scheduled_qty,
|
||||||
workline_id = a.workline_id==null ? "" :g.EnCode+"/"+g.FullName,
|
workline_id = a.workline_id==null ? "" :g.EnCode+"/"+g.FullName,
|
||||||
|
workline_id_id = a.workline_id,
|
||||||
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"),
|
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"),
|
||||||
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd"),
|
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd"),
|
||||||
eqp_id = a.eqp_id==null ? "" : h.code+"/"+h.name,
|
eqp_id = a.eqp_id==null ? "" : h.code+"/"+h.name,
|
||||||
|
eqp_id_id = a.eqp_id,
|
||||||
create_time = a.create_time==null ? "" :a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss")
|
create_time = a.create_time==null ? "" :a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss")
|
||||||
}).OrderByDescending(a => a.create_time).ToPagedListAsync(input.currentPage, input.pageSize);
|
}).OrderByDescending(a => a.create_time).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
return PageResult<WorkOrderAdjustmentListOutput>.SqlSugarPageResult(result);
|
return PageResult<WorkOrderAdjustmentListOutput>.SqlSugarPageResult(result);
|
||||||
@@ -1924,5 +1933,145 @@ namespace Tnb.ProductionMgr
|
|||||||
.Where(x => x.workline_id == id && x.mo_task_status == DictConst.InProgressEnCode).FirstAsync();
|
.Where(x => x.workline_id == id && x.mo_task_status == DictConst.InProgressEnCode).FirstAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更换机台
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> ChangeEquip(ChangeEquipInput input)
|
||||||
|
{
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||||
|
{
|
||||||
|
var moTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
|
||||||
|
if (moTask.eqp_id == input.equip_id)
|
||||||
|
{
|
||||||
|
throw new Exception("与原机台相同");
|
||||||
|
}
|
||||||
|
|
||||||
|
await db.Updateable<PrdMoTask>().SetColumns(x => x.eqp_id == input.equip_id)
|
||||||
|
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
var mo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == moTask.mo_id);
|
||||||
|
var material = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.material_id);
|
||||||
|
var process = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.process_id);
|
||||||
|
var taskLog = new PrdTaskLog();
|
||||||
|
taskLog.id = SnowflakeIdHelper.NextId();
|
||||||
|
taskLog.mo_code = mo?.mo_code!;
|
||||||
|
taskLog.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == input.equip_id))?.code!;
|
||||||
|
taskLog.mold_code = "";
|
||||||
|
taskLog.item_code = material?.code!;
|
||||||
|
taskLog.item_standard = material?.material_standard!;
|
||||||
|
taskLog.status = "更换机台";
|
||||||
|
taskLog.operator_name = _userManager.RealName;
|
||||||
|
taskLog.create_id = _userManager.UserId;
|
||||||
|
taskLog.create_time = DateTime.Now;
|
||||||
|
taskLog.mo_task_id = moTask.id;
|
||||||
|
taskLog.mo_task_code = moTask.mo_task_code;
|
||||||
|
taskLog.station_code = "";
|
||||||
|
taskLog.process_code = process?.code;
|
||||||
|
|
||||||
|
await db.Insertable<PrdTaskLog>(taskLog).ExecuteCommandAsync();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
||||||
|
return result.IsSuccess ? "延期成功" : result.ErrorMessage;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更换模具
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> ChangeMold(ChangeMoldInput input)
|
||||||
|
{
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||||
|
{
|
||||||
|
var moTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
|
||||||
|
if (moTask.mold_id == input.mold_id)
|
||||||
|
{
|
||||||
|
throw new Exception("与原模具相同");
|
||||||
|
}
|
||||||
|
|
||||||
|
await db.Updateable<PrdMoTask>().SetColumns(x => x.mold_id == input.mold_id)
|
||||||
|
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
var mo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == moTask.mo_id);
|
||||||
|
var mold = await db.Queryable<ToolMolds>().SingleAsync(x => x.id == input.mold_id);
|
||||||
|
var material = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.material_id);
|
||||||
|
var process = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.process_id);
|
||||||
|
var taskLog = new PrdTaskLog();
|
||||||
|
taskLog.id = SnowflakeIdHelper.NextId();
|
||||||
|
taskLog.mo_code = mo?.mo_code!;
|
||||||
|
taskLog.eqp_code = "";
|
||||||
|
taskLog.mold_code = mold?.mold_code;
|
||||||
|
taskLog.item_code = material?.code!;
|
||||||
|
taskLog.item_standard = material?.material_standard!;
|
||||||
|
taskLog.status = "更换模具";
|
||||||
|
taskLog.operator_name = _userManager.RealName;
|
||||||
|
taskLog.create_id = _userManager.UserId;
|
||||||
|
taskLog.create_time = DateTime.Now;
|
||||||
|
taskLog.mo_task_id = moTask.id;
|
||||||
|
taskLog.mo_task_code = moTask.mo_task_code;
|
||||||
|
taskLog.station_code = "";
|
||||||
|
taskLog.process_code = process?.code;
|
||||||
|
|
||||||
|
await db.Insertable<PrdTaskLog>(taskLog).ExecuteCommandAsync();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
||||||
|
return result.IsSuccess ? "延期成功" : result.ErrorMessage;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更换产线
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> ChangeWorkline(ChangeWorklineInput input)
|
||||||
|
{
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||||
|
{
|
||||||
|
var moTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
|
||||||
|
if (moTask.workline_id == input.workline_id)
|
||||||
|
{
|
||||||
|
throw new Exception("与原产线相同");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
await db.Updateable<PrdMoTask>().SetColumns(x => x.workline_id == input.workline_id)
|
||||||
|
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
var mo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == moTask.mo_id);
|
||||||
|
var material = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.material_id);
|
||||||
|
var process = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.process_id);
|
||||||
|
var taskLog = new PrdTaskLog();
|
||||||
|
taskLog.id = SnowflakeIdHelper.NextId();
|
||||||
|
taskLog.mo_code = mo?.mo_code!;
|
||||||
|
taskLog.eqp_code = "";
|
||||||
|
taskLog.mold_code = "";
|
||||||
|
taskLog.item_code = material?.code!;
|
||||||
|
taskLog.item_standard = material?.material_standard!;
|
||||||
|
taskLog.status = "更换产线";
|
||||||
|
taskLog.operator_name = _userManager.RealName;
|
||||||
|
taskLog.create_id = _userManager.UserId;
|
||||||
|
taskLog.create_time = DateTime.Now;
|
||||||
|
taskLog.mo_task_id = moTask.id;
|
||||||
|
taskLog.mo_task_code = moTask.mo_task_code;
|
||||||
|
taskLog.station_code = "";
|
||||||
|
taskLog.process_code = process?.code;
|
||||||
|
|
||||||
|
await db.Insertable<PrdTaskLog>(taskLog).ExecuteCommandAsync();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
||||||
|
return result.IsSuccess ? "延期成功" : result.ErrorMessage;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,17 @@ namespace Tnb.WarehouseMgr
|
|||||||
foreach (var d in dics)
|
foreach (var d in dics)
|
||||||
{
|
{
|
||||||
var LCode = d["location_code"].ToString() ?? string.Empty;
|
var LCode = d["location_code"].ToString() ?? string.Empty;
|
||||||
if (LCode == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据起始点位编号不可为空", 500);
|
if (LCode == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据库位编号不可为空", 500);
|
||||||
|
var isType = d["is_type"].ToString() ?? string.Empty;
|
||||||
|
if (isType == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据库位类型不可为空", 500);
|
||||||
|
var floor = d["floor"].ToString() ?? string.Empty;
|
||||||
|
if (floor == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据楼层不可为空", 500);
|
||||||
|
var layers = d["layers"].ToString() ?? string.Empty;
|
||||||
|
var locLine = d["loc_line"].ToString() ?? string.Empty;
|
||||||
|
var locColumn = d["loc_column"].ToString() ?? string.Empty;
|
||||||
|
if (locLine == string.Empty || locColumn == string.Empty || layers == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据行列层不可为空", 500);
|
||||||
|
var isSign = d["is_sign"].ToString() ?? string.Empty;
|
||||||
|
if(isSign==string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据自动签收不可为空", 500);
|
||||||
var cStdCode = d["carrystd_id"].ToString() ?? string.Empty;
|
var cStdCode = d["carrystd_id"].ToString() ?? string.Empty;
|
||||||
cStdCodes.Add(cStdCode);
|
cStdCodes.Add(cStdCode);
|
||||||
d["create_time"] = DateTime.Now;
|
d["create_time"] = DateTime.Now;
|
||||||
@@ -58,21 +68,19 @@ namespace Tnb.WarehouseMgr
|
|||||||
locs.Add(loc);
|
locs.Add(loc);
|
||||||
}
|
}
|
||||||
var carryStdDic = await _db.Queryable<WmsCarrystd>().Where(it => cStdCodes.Contains(it.carrystd_code)).ToDictionaryAsync(x => x.carrystd_code, x => x.id);
|
var carryStdDic = await _db.Queryable<WmsCarrystd>().Where(it => cStdCodes.Contains(it.carrystd_code)).ToDictionaryAsync(x => x.carrystd_code, x => x.id);
|
||||||
if (carryStdDic?.Count > 0)
|
locs.ForEach(x =>
|
||||||
{
|
{
|
||||||
locs.ForEach(x =>
|
if (!carryStdDic.Keys.Contains(x.carrystd_id)) throw new AppFriendlyException($"第{locs.IndexOf(x) + 1}个数据的载具规格有误", 500);
|
||||||
{
|
x.id = SnowflakeIdHelper.NextId();
|
||||||
if (!carryStdDic.Keys.Contains(x.carrystd_id)) throw new AppFriendlyException($"第{locs.IndexOf(x) + 1}个数据的载具规格有误", 500);
|
x.org_id = _userManager.User.OrganizeId;
|
||||||
x.id = SnowflakeIdHelper.NextId();
|
x.is_lock = 0;
|
||||||
x.org_id = _userManager.User.OrganizeId;
|
x.carrystd_id = carryStdDic[x.carrystd_id].ToString() ?? throw new AppFriendlyException($"第{locs.IndexOf(x) + 1}个数据的载具规格有误", 500);
|
||||||
x.is_lock = 0;
|
x.create_id = _userManager.UserId;
|
||||||
x.carrystd_id = carryStdDic[x.carrystd_id].ToString() ?? throw new AppFriendlyException($"第{locs.IndexOf(x) + 1}个数据的载具规格有误", 500);
|
x.modify_id = null;
|
||||||
x.create_id = _userManager.UserId;
|
x.modify_time = null;
|
||||||
x.modify_id = null;
|
x.is_mix = 1;
|
||||||
x.modify_time = null;
|
});
|
||||||
x.is_mix = 1;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
row = await _db.Insertable(locs).ExecuteCommandAsync();
|
row = await _db.Insertable(locs).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
List<Dictionary<string, object>> dics = input.list;
|
List<Dictionary<string, object>> dics = input.list;
|
||||||
List<WmsCarryH> carrys = new List<WmsCarryH>();
|
List<WmsCarryH> carrys = new List<WmsCarryH>();
|
||||||
|
Dictionary<string, object>? locs = null;
|
||||||
List<string> locCodes = new();
|
List<string> locCodes = new();
|
||||||
List<string> cStdCodes = new();
|
List<string> cStdCodes = new();
|
||||||
WmsCarryH carryH = new WmsCarryH();
|
WmsCarryH carryH = new WmsCarryH();
|
||||||
@@ -68,8 +69,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
foreach (var d in dics)
|
foreach (var d in dics)
|
||||||
{
|
{
|
||||||
var cStdCode = d["carrystd_id"].ToString() ?? string.Empty;
|
var cStdCode = d["carrystd_id"].ToString() ?? string.Empty;
|
||||||
//if (cStdCode == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据载具规格不可为空", 500);
|
locCodes.Add(d["location_code"].ToString() ?? string.Empty);
|
||||||
locCodes.Add(d["location_code"]?.ToString() ?? string.Empty);
|
|
||||||
cStdCodes.Add(cStdCode);
|
cStdCodes.Add(cStdCode);
|
||||||
d["create_time"] = DateTime.Now;
|
d["create_time"] = DateTime.Now;
|
||||||
d.Remove("modify_time");
|
d.Remove("modify_time");
|
||||||
@@ -77,18 +77,19 @@ namespace Tnb.WarehouseMgr
|
|||||||
carrys.Add(carryH);
|
carrys.Add(carryH);
|
||||||
}
|
}
|
||||||
var carryStdDic = await _db.Queryable<WmsCarrystd>().Where(it => cStdCodes.Contains(it.carrystd_code)).ToDictionaryAsync(x => x.carrystd_code, x => x.id);
|
var carryStdDic = await _db.Queryable<WmsCarrystd>().Where(it => cStdCodes.Contains(it.carrystd_code)).ToDictionaryAsync(x => x.carrystd_code, x => x.id);
|
||||||
var locs = await _db.Queryable<BasLocation>().Where(it => locCodes.Contains(it.location_code)).ToDictionaryAsync(x => x.location_code, x => x.id);
|
if (locCodes?.Count > 0)
|
||||||
|
locs = await _db.Queryable<BasLocation>().Where(it => locCodes.Contains(it.location_code)).ToDictionaryAsync(x => x.location_code, x => x.id);
|
||||||
carrys.ForEach(x =>
|
carrys.ForEach(x =>
|
||||||
{
|
{
|
||||||
if (!carryStdDic.Keys.Contains(x.carrystd_id)) throw new AppFriendlyException($"第{carrys.IndexOf(x) + 1}个数据的载具规格有误", 500);
|
if (!carryStdDic.Keys.Contains(x.carrystd_id)) throw new AppFriendlyException($"第{carrys.IndexOf(x) + 1}个数据的载具规格有误", 500);
|
||||||
if (!locs.Keys.Contains(x.location_code)) throw new AppFriendlyException($"第{carrys.IndexOf(x) + 1}个数据的库位编号有误", 500);
|
|
||||||
x.id = SnowflakeIdHelper.NextId();
|
x.id = SnowflakeIdHelper.NextId();
|
||||||
x.org_id = _userManager.User.OrganizeId;
|
x.org_id = _userManager.User.OrganizeId;
|
||||||
x.status = 1;
|
x.status = 1;
|
||||||
x.is_lock = 0;
|
x.is_lock = 0;
|
||||||
x.carrystd_id = carryStdDic[x.carrystd_id].ToString() ?? throw new AppFriendlyException($"第{carrys.IndexOf(x) + 1}个数据的载具规格有误", 500);
|
x.carrystd_id = carryStdDic[x.carrystd_id].ToString() ?? throw new AppFriendlyException($"第{carrys.IndexOf(x) + 1}个数据的载具规格有误", 500);
|
||||||
x.carry_status = ((int)EnumCarryStatus.空闲).ToString();
|
x.carry_status = ((int)EnumCarryStatus.空闲).ToString();
|
||||||
x.location_id = locs[x.location_code].ToString() ?? throw new AppFriendlyException($"第{carrys.IndexOf(x) + 1}个数据的库位编号有误", 500);
|
if (locs != null && x.location_code != null && x.location_code != string.Empty)
|
||||||
|
x.location_id = locs[x.location_code].ToString() ?? throw new AppFriendlyException($"第{carrys.IndexOf(x) + 1}个数据的库位编号有误", 500);
|
||||||
x.out_status = ((int)EnumOutStatus.正常).ToString();
|
x.out_status = ((int)EnumOutStatus.正常).ToString();
|
||||||
x.is_check = 1;
|
x.is_check = 1;
|
||||||
x.create_id = _userManager.UserId;
|
x.create_id = _userManager.UserId;
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
var floor = d["floor"].ToString() ?? string.Empty;
|
var floor = d["floor"].ToString() ?? string.Empty;
|
||||||
if (pCode == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据点位编号不可为空", 500);
|
if (pCode == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据点位编号不可为空", 500);
|
||||||
if (pName == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据点位名称不可为空", 500);
|
if (pName == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据点位名称不可为空", 500);
|
||||||
//if (aCode == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据管理区编号不可为空", 500);
|
|
||||||
if (floor == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据楼层不可为空", 500);
|
if (floor == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据楼层不可为空", 500);
|
||||||
aCodes.Add(aCode);
|
aCodes.Add(aCode);
|
||||||
d["create_time"] = DateTime.Now;
|
d["create_time"] = DateTime.Now;
|
||||||
|
|||||||
@@ -83,10 +83,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
var eCode = d["endpoint_code"].ToString() ?? string.Empty;
|
var eCode = d["endpoint_code"].ToString() ?? string.Empty;
|
||||||
var dis = d["distance"].ToString() ?? string.Empty;
|
var dis = d["distance"].ToString() ?? string.Empty;
|
||||||
if(sCode == eCode) throw new AppFriendlyException("起始点位不能等于终止点位", 500);
|
if(sCode == eCode) throw new AppFriendlyException("起始点位不能等于终止点位", 500);
|
||||||
//if (sCode.IsEmpty())
|
|
||||||
// throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据数据起始点位编号不可为空", 500);
|
|
||||||
//if (eCode.IsEmpty())
|
|
||||||
// throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据终止点位编号不可为空", 500);
|
|
||||||
if (dis.IsEmpty())
|
if (dis.IsEmpty())
|
||||||
throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据距离不可为空", 500);
|
throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据距离不可为空", 500);
|
||||||
pointCodes.Add(sCode);
|
pointCodes.Add(sCode);
|
||||||
|
|||||||
Reference in New Issue
Block a user