bug处理

This commit is contained in:
2024-04-23 10:16:16 +08:00
parent c8e2f1eafd
commit 579f2d3a39
197 changed files with 2509 additions and 1363 deletions

View File

@@ -31,7 +31,7 @@ using Tnb.WarehouseMgr.Entities.Dto.Inputs;
namespace Tnb.ProductionMgr
{
/// <summary>
/// mes生产入库申请
/// mes<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
[Route("api/[area]/[controller]/[action]")]
@@ -42,7 +42,7 @@ namespace Tnb.ProductionMgr
private readonly IUserManager _userManager;
private readonly IOrganizeService _organizeService;
private readonly IBillRullService _billRuleService;
private const string ModuleId = "25572529329173";
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
@@ -56,7 +56,7 @@ namespace Tnb.ProductionMgr
_repository = repository;
_organizeService = organizeService;
_userManager = userManager;
_billRuleService= billRullService;
_billRuleService = billRullService;
OverideFuncs.GetListAsync = GetList;
}
@@ -69,7 +69,7 @@ namespace Tnb.ProductionMgr
.LeftJoin<ToolMolds>((a, b, c) => a.mold_id == c.id)
.LeftJoin<EqpEquipment>((a, b, c, d) => a.eqp_id == d.id)
.WhereIF(!string.IsNullOrEmpty(moCode), (a, b, c, d) => a.mo_task_code!.Contains(moCode))
.Where(a=>string.IsNullOrEmpty(a.parent_id))
.Where(a => string.IsNullOrEmpty(a.parent_id))
.Select((a, b, c, d) => new PrdMoTaskTreeOutput()
{
id = a.id,
@@ -111,7 +111,7 @@ namespace Tnb.ProductionMgr
if (string.IsNullOrEmpty(input.station_id))
{
throw Oops.Bah("请先选择工位");
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
}
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
@@ -207,7 +207,7 @@ namespace Tnb.ProductionMgr
string domain = _userManager.Domain;
Dictionary<string, object> header = new()
{
["Authorization"] = App.HttpContext!=null ? App.HttpContext.Request.Headers["Authorization"] : ""
["Authorization"] = App.HttpContext != null ? App.HttpContext.Request.Headers["Authorization"] : ""
};
string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header);
Log.Information(sendResult);
@@ -225,11 +225,11 @@ namespace Tnb.ProductionMgr
});
}
return !result2.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result2.IsSuccess ? "保存成功" : result2.ErrorMessage);
return !result2.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result2.IsSuccess ? "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>" : 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("请传机台号");
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><EFBFBD>");
}
if (string.IsNullOrEmpty(label_code))
{
throw Oops.Bah("请传标签号");
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>ǩ<EFBFBD><EFBFBD>");
}
ISqlSugarClient db = _repository.AsSugarClient();
@@ -285,9 +285,9 @@ namespace Tnb.ProductionMgr
try
{
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=="注塑空满箱请求")
.Select((x,y)=>x)
.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>")
.Select((x, y) => x)
.FirstAsync();
}
catch (Exception e)
@@ -297,18 +297,18 @@ namespace Tnb.ProductionMgr
}
if (equipment == null)
{
throw Oops.Bah("未找到机台");
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>̨");
}
if (string.IsNullOrEmpty(equipment.as_location_id))
{
throw Oops.Bah("未找到入库库位");
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
}
BasLocation basLocation = await db.Queryable<BasLocation>().SingleAsync(x => x.id == equipment.as_location_id);
if (basLocation == null)
{
throw Oops.Bah("未找到入库库位");
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
}
PrdReport prdReport = await db.Queryable<PrdReport>()
@@ -319,7 +319,7 @@ namespace Tnb.ProductionMgr
string org_id = user.OrganizeId;
if (prdReport == null)
{
throw Oops.Bah("未找到提报记录");
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼");
}
@@ -423,18 +423,18 @@ namespace Tnb.ProductionMgr
{
_ = await db.Insertable<PrdInstockD>(prdInstockDs).ExecuteCommandAsync();
}
//todo 入库申请后是否修改提报记录状态
//todo <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>޸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼״̬
});
}
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "成功" ;
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "<EFBFBD>ɹ<EFBFBD>";
}
// [HttpPost]
// public async Task<string> InstockTubeOne(PrdReport prdReport)
// {
// ISqlSugarClient db = _repository.AsSugarClient();
// string location_code = "ZCR01";//todo 短管挤出件目标库位之后改
// string location_code = "ZCR01";//todo <EFBFBD>̹ܼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ֮<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// string warehouse_id = "2";
//
// PrdInstockH? prdInstockH = null;
@@ -539,8 +539,8 @@ namespace Tnb.ProductionMgr
//
// return result2.IsSuccess ? "true" : "false";
// }
[HttpPost]
public async Task<string> InstockTubeOne(InstockInput input)
{
@@ -548,16 +548,16 @@ namespace Tnb.ProductionMgr
string label_code = input.label_code;
if (string.IsNullOrEmpty(equip_code))
{
throw Oops.Bah("请传机台号");
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><EFBFBD>");
}
if (string.IsNullOrEmpty(label_code))
{
throw Oops.Bah("请传标签号");
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>ǩ<EFBFBD><EFBFBD>");
}
ISqlSugarClient db = _repository.AsSugarClient();
// string location_code = "ZCR01";//todo 短管挤出件目标库位之后改
// string location_code = "ZCR01";//todo <EFBFBD>̹ܼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ֮<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
string warehouse_id = "2";
PrdInstockH? prdInstockH = null;
@@ -567,9 +567,9 @@ namespace Tnb.ProductionMgr
try
{
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=="挤出空满箱请求")
.Select((x,y)=>x)
.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><EFBFBD><EFBFBD>")
.Select((x, y) => x)
.FirstAsync();
}
catch (Exception e)
@@ -579,27 +579,27 @@ namespace Tnb.ProductionMgr
}
if (equipment == null)
{
throw Oops.Bah("未找到机台");
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>̨");
}
if (string.IsNullOrEmpty(equipment.as_location_id))
{
throw Oops.Bah("未找到入库库位");
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
}
BasLocation basLocation = await db.Queryable<BasLocation>().SingleAsync(x => x.id == equipment.as_location_id);
if (basLocation == null)
{
throw Oops.Bah("未找到入库库位");
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
}
string location_code = basLocation.location_code;
PrdReport prdReport = await db.Queryable<PrdReport>()
.LeftJoin<BasMaterial>((x,y)=>x.material_id==y.id)
.Where((x,y) => y.category_id.Contains("\"DGJCJ\"") && x.status == 0).OrderByDescending(x => x.create_time)
.LeftJoin<BasMaterial>((x, y) => x.material_id == y.id)
.Where((x, y) => y.category_id.Contains("\"DGJCJ\"") && x.status == 0).OrderByDescending(x => x.create_time)
.FirstAsync();
BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == prdReport.material_id);
string create_id = prdReport.create_id;
UserEntity user = await db.Queryable<UserEntity>().SingleAsync(x => x.Id == create_id);
@@ -609,7 +609,7 @@ namespace Tnb.ProductionMgr
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorklineCode);
OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorkshopCode);
string code = await _billRuleService.GetBillNumber(CodeTemplateConst.PRDINSTOCK_CODE);
prdInstockH = new PrdInstockH()
{
code = code,
@@ -702,11 +702,11 @@ namespace Tnb.ProductionMgr
});
}
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "成功" ;
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "<EFBFBD>ɹ<EFBFBD>";
}
/// <summary>
/// 长管管挤出入库申请
/// <EFBFBD><EFBFBD><EFBFBD>ܹܼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@@ -714,7 +714,7 @@ namespace Tnb.ProductionMgr
{
ISqlSugarClient db = _repository.AsSugarClient();
string location_code = prdReport.location_code;
string warehouse_id = "27209786980373";//长件挤出缓存仓
string warehouse_id = "27209786980373";//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PrdInstockH? prdInstockH = null;
List<PrdInstockD> prdInstockDs = new() { };
@@ -818,11 +818,11 @@ namespace Tnb.ProductionMgr
});
}
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "成功" ;
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "<EFBFBD>ɹ<EFBFBD>";
}
/// <summary>
/// 外包装入库申请
/// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@@ -830,70 +830,70 @@ namespace Tnb.ProductionMgr
{
string equip_code = input.equip_code;
string label_code = input.label_code;
string warehouse_id = "26103367464997";//四楼解析库
string warehouse_id = "26103367464997";//<EFBFBD><EFBFBD>¥<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (!string.IsNullOrEmpty(equip_code))
{
throw Oops.Bah("请传机台号");
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><EFBFBD>");
}
if (!string.IsNullOrEmpty(label_code))
{
throw Oops.Bah("请传标签号");
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>ǩ<EFBFBD><EFBFBD>");
}
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=="外包装成品码垛点位")
.Select((x,y)=>x)
.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>λ")
.Select((x, y) => x)
.FirstAsync();
if (equipment == null)
{
throw Oops.Bah("未找到机台");
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>̨");
}
if (string.IsNullOrEmpty(equipment.as_location_id))
{
throw Oops.Bah("未找到入库库位");
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
}
BasLocation basLocation = await db.Queryable<BasLocation>().SingleAsync(x => x.id == equipment.as_location_id);
if (basLocation == null)
{
throw Oops.Bah("未找到入库库位");
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
}
OrganizeEntity station = await db.Queryable<OrganizeEntity>()
.LeftJoin<OrganizeRelationEntity>((x, y) => x.Id == y.OrganizeId)
.Where((x, y) => y.ObjectType == "Eqp" && y.ObjectId == equipment.id).FirstAsync();
if (station == null)
{
throw Oops.Bah("未找到工位");
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>λ");
}
PrdOutPacking prdOutPacking = await db.Queryable<PrdOutPacking>().Where(x=>x.station_id==station.Id && x.status=="0").OrderByDescending(x=>x.create_time).FirstAsync();
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("未找到托盘");
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
var prdOutPackMarkLabelList = await db.Queryable<PrdOutPackMarkLabel>().Where(x=>x.station_id==station.Id && x.status=="1").ToListAsync();
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("未找到提报记录");
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼");
}
List<string> reportIds = prdOutPackMarkLabelList.Select(x => x.report_id).ToList();
List<PrdReport> prdReports = await db.Queryable<PrdReport>().Where(x => reportIds.Contains(x.id)).ToListAsync();
List<PrdReport> prdReports = await db.Queryable<PrdReport>().Where(x => reportIds.Contains(x.id)).ToListAsync();
if (prdReports == null || prdReports.Count<=0)
if (prdReports == null || prdReports.Count <= 0)
{
throw Oops.Bah("未找到提报记录");
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼");
}
string create_id = prdReports[0].create_id;
UserEntity user = await db.Queryable<UserEntity>().SingleAsync(x => x.Id == create_id);
@@ -910,7 +910,7 @@ namespace Tnb.ProductionMgr
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(station.Id, DictConst.RegionCategoryWorklineCode);
OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(station.Id, DictConst.RegionCategoryWorkshopCode);
string code = await _billRuleService.GetBillNumber(CodeTemplateConst.PRDINSTOCK_CODE);
prdInstockH = new PrdInstockH()
{
code = code,
@@ -1012,12 +1012,12 @@ namespace Tnb.ProductionMgr
await db.Updateable<PrdOutPackMarkLabel>()
.SetColumns(x => x.status == "2")
.Where(x => x.station_id == station.Id && x.status == "1").ExecuteCommandAsync();
//todo 入库申请后是否修改提报记录状态
//todo <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>޸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼״̬
});
}
return !result2.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result2.IsSuccess ? "申请成功" : result2.ErrorMessage);
return !result2.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result2.IsSuccess ? "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>" : result2.ErrorMessage);
}
}
}