提报获取重量

This commit is contained in:
2024-05-22 16:37:56 +08:00
parent a53623823c
commit 90b567f653
6 changed files with 130 additions and 61 deletions

View File

@@ -31,7 +31,7 @@ using Tnb.WarehouseMgr.Entities.Dto.Inputs;
namespace Tnb.ProductionMgr
{
/// <summary>
/// mes<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// mes生产入库申请
/// </summary>
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
[Route("api/[area]/[controller]/[action]")]
@@ -111,7 +111,7 @@ namespace Tnb.ProductionMgr
if (string.IsNullOrEmpty(input.station_id))
{
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
throw Oops.Bah("请先选择工位");
}
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
@@ -225,11 +225,11 @@ namespace Tnb.ProductionMgr
});
}
return !result2.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result2.IsSuccess ? "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>" : result2.ErrorMessage);
return !result2.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result2.IsSuccess ? "保存成功" : result2.ErrorMessage);
}
/// <summary>
/// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD>
/// 入库申请同步
/// </summary>
/// <param name="dic">source_id</param>
/// <returns></returns>
@@ -259,7 +259,7 @@ namespace Tnb.ProductionMgr
}
/// <summary>
/// ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䵽λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// 注塑满箱到位后入库申请
/// </summary>
/// <param name="inut"></param>
/// <returns></returns>
@@ -272,12 +272,12 @@ namespace Tnb.ProductionMgr
string warehouse_id = "2";
if (string.IsNullOrEmpty(equip_code))
{
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><EFBFBD>");
throw Oops.Bah("请传机台号");
}
if (string.IsNullOrEmpty(label_code))
{
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>ǩ<EFBFBD><EFBFBD>");
throw Oops.Bah("请传标签号");
}
ISqlSugarClient db = _repository.AsSugarClient();
@@ -286,7 +286,7 @@ namespace Tnb.ProductionMgr
{
equipment = await db.Queryable<EqpEquipment>()
.LeftJoin<EqpDaq>((x, y) => x.id == y.equip_id)
.Where((x, y) => y.equip_code == equip_code && y.label_name == label_code && y.label_point == <>ܿ<EFBFBD><DCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
.Where((x, y) => y.equip_code == equip_code && y.label_point == label_code && y.label_name.Contains("注塑空满箱请求"))
.Select((x, y) => x)
.FirstAsync();
}
@@ -297,18 +297,18 @@ namespace Tnb.ProductionMgr
}
if (equipment == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>̨");
throw Oops.Bah("未找到机台");
}
if (string.IsNullOrEmpty(equipment.as_location_id))
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
throw Oops.Bah("未找到入库库位");
}
BasLocation basLocation = await db.Queryable<BasLocation>().SingleAsync(x => x.id == equipment.as_location_id);
if (basLocation == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
throw Oops.Bah("未找到入库库位");
}
PrdReport prdReport = await db.Queryable<PrdReport>()
@@ -319,7 +319,7 @@ namespace Tnb.ProductionMgr
string org_id = user.OrganizeId;
if (prdReport == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼");
throw Oops.Bah("未找到提报记录");
}
@@ -423,18 +423,18 @@ namespace Tnb.ProductionMgr
{
_ = await db.Insertable<PrdInstockD>(prdInstockDs).ExecuteCommandAsync();
}
//todo <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>޸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼״̬
//todo 入库申请后是否修改提报记录状态
});
}
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "<EFBFBD>ɹ<EFBFBD>";
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "成功";
}
// [HttpPost]
// public async Task<string> InstockTubeOne(PrdReport prdReport)
// {
// ISqlSugarClient db = _repository.AsSugarClient();
// string location_code = "ZCR01";//todo <EFBFBD>̹ܼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ֮<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// string location_code = "ZCR01";//todo 短管挤出件目标库位之后改
// string warehouse_id = "2";
//
// PrdInstockH? prdInstockH = null;
@@ -548,17 +548,17 @@ namespace Tnb.ProductionMgr
string label_code = input.label_code;
if (string.IsNullOrEmpty(equip_code))
{
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><EFBFBD>");
throw Oops.Bah("请传机台号");
}
if (string.IsNullOrEmpty(label_code))
{
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>ǩ<EFBFBD><EFBFBD>");
throw Oops.Bah("请传标签号");
}
ISqlSugarClient db = _repository.AsSugarClient();
// string location_code = "ZCR01";//todo <EFBFBD>̹ܼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ֮<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//todo <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٸ<EFBFBD>
// string location_code = "ZCR01";//todo 短管挤出件目标库位之后改
//todo 入库仓库确定后再改
string warehouse_id = "2";
PrdInstockH? prdInstockH = null;
@@ -569,7 +569,7 @@ namespace Tnb.ProductionMgr
{
equipment = await db.Queryable<EqpEquipment>()
.LeftJoin<EqpDaq>((x, y) => x.id == y.equip_id)
.Where((x, y) => y.equip_code == equip_code && y.label_name == label_code && y.label_point == "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
.Where((x, y) => y.equip_code == equip_code && y.label_point == label_code && y.label_name.Contains("挤出空满箱请求"))
.Select((x, y) => x)
.FirstAsync();
}
@@ -580,18 +580,18 @@ namespace Tnb.ProductionMgr
}
if (equipment == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>̨");
throw Oops.Bah("未找到机台");
}
if (string.IsNullOrEmpty(equipment.as_location_id))
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
throw Oops.Bah("未找到入库库位");
}
BasLocation basLocation = await db.Queryable<BasLocation>().SingleAsync(x => x.id == equipment.as_location_id);
if (basLocation == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
throw Oops.Bah("未找到入库库位");
}
string location_code = basLocation.location_code;
@@ -703,11 +703,11 @@ namespace Tnb.ProductionMgr
});
}
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "<EFBFBD>ɹ<EFBFBD>";
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "成功";
}
/// <summary>
/// <EFBFBD><EFBFBD><EFBFBD>ܹܼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// 长管管挤出入库申请
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@@ -715,7 +715,7 @@ namespace Tnb.ProductionMgr
{
ISqlSugarClient db = _repository.AsSugarClient();
string location_code = prdReport.location_code;
string warehouse_id = "27209786980373";//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
string warehouse_id = "27209786980373";//长件挤出缓存仓
PrdInstockH? prdInstockH = null;
List<PrdInstockD> prdInstockDs = new() { };
@@ -819,11 +819,11 @@ namespace Tnb.ProductionMgr
});
}
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "<EFBFBD>ɹ<EFBFBD>";
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "成功";
}
/// <summary>
/// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// 外包装入库申请
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@@ -831,39 +831,39 @@ namespace Tnb.ProductionMgr
{
string equip_code = input.equip_code;
string label_code = input.label_code;
string warehouse_id = "26103367464997";//<EFBFBD><EFBFBD>¥<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
string warehouse_id = "26103367464997";//四楼解析库
if (!string.IsNullOrEmpty(equip_code))
{
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><EFBFBD>");
throw Oops.Bah("请传机台号");
}
if (!string.IsNullOrEmpty(label_code))
{
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>ǩ<EFBFBD><EFBFBD>");
throw Oops.Bah("请传标签号");
}
ISqlSugarClient db = _repository.AsSugarClient();
EqpEquipment equipment = await db.Queryable<EqpEquipment>()
.LeftJoin<EqpDaq>((x, y) => x.id == y.equip_id)
.Where((x, y) => y.equip_code == equip_code && y.label_name == label_code && y.label_point == "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ")
.Where((x, y) => y.equip_code == equip_code && y.label_point == label_code && y.label_name == "外包装成品码垛点位")
.Select((x, y) => x)
.FirstAsync();
if (equipment == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>̨");
throw Oops.Bah("未找到机台");
}
if (string.IsNullOrEmpty(equipment.as_location_id))
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
throw Oops.Bah("未找到入库库位");
}
BasLocation basLocation = await db.Queryable<BasLocation>().SingleAsync(x => x.id == equipment.as_location_id);
if (basLocation == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
throw Oops.Bah("未找到入库库位");
}
OrganizeEntity station = await db.Queryable<OrganizeEntity>()
@@ -872,19 +872,19 @@ namespace Tnb.ProductionMgr
if (station == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>λ");
throw Oops.Bah("未找到工位");
}
PrdOutPacking prdOutPacking = await db.Queryable<PrdOutPacking>().Where(x => x.station_id == station.Id && x.status == "0").OrderByDescending(x => x.create_time).FirstAsync();
if (prdOutPacking == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
throw Oops.Bah("未找到托盘");
}
var prdOutPackMarkLabelList = await db.Queryable<PrdOutPackMarkLabel>().Where(x => x.station_id == station.Id && x.status == "1").ToListAsync();
if (prdOutPackMarkLabelList == null || prdOutPackMarkLabelList.Count <= 0)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼");
throw Oops.Bah("未找到提报记录");
}
List<string> reportIds = prdOutPackMarkLabelList.Select(x => x.report_id).ToList();
@@ -894,7 +894,7 @@ namespace Tnb.ProductionMgr
if (prdReports == null || prdReports.Count <= 0)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼");
throw Oops.Bah("未找到提报记录");
}
string create_id = prdReports[0].create_id;
UserEntity user = await db.Queryable<UserEntity>().SingleAsync(x => x.Id == create_id);
@@ -1014,11 +1014,11 @@ namespace Tnb.ProductionMgr
.SetColumns(x => x.status == "2")
.Where(x => x.station_id == station.Id && x.status == "1").ExecuteCommandAsync();
//todo <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>޸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼״̬
//todo 入库申请后是否修改提报记录状态
});
}
return !result2.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result2.IsSuccess ? "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>" : result2.ErrorMessage);
return !result2.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result2.IsSuccess ? "申请成功" : result2.ErrorMessage);
}
}
}