解决代码冲突

This commit is contained in:
yang.lee
2023-11-23 09:27:30 +08:00
11 changed files with 66 additions and 36 deletions

View File

@@ -198,7 +198,8 @@ namespace Tnb.ProductionMgr
codeqty = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"),
});
}
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
string domain = "http://tnb.tuotong-tech.com";
Dictionary<string, object> header = new()
{
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
@@ -264,22 +265,31 @@ namespace Tnb.ProductionMgr
string equip_code = input.equip_code;
string label_code = input.label_code;
string warehouse_id = "2";
if (!string.IsNullOrEmpty(equip_code))
if (string.IsNullOrEmpty(equip_code))
{
throw Oops.Bah("请传机台号");
}
if (!string.IsNullOrEmpty(label_code))
if (string.IsNullOrEmpty(label_code))
{
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=="提报装箱称重点位")
.Select((x,y)=>x)
.FirstAsync();
EqpEquipment equipment = null;
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)
.FirstAsync();
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
if (equipment == null)
{
throw Oops.Bah("未找到机台");
@@ -299,6 +309,9 @@ namespace Tnb.ProductionMgr
PrdReport prdReport = await db.Queryable<PrdReport>()
.Where(x => x.equip_id == equipment.id && x.status == 0).OrderByDescending(x => x.create_time)
.FirstAsync();
string create_id = prdReport.create_id;
UserEntity user = await db.Queryable<UserEntity>().SingleAsync(x => x.Id == create_id);
string org_id = user.OrganizeId;
if (prdReport == null)
{
throw Oops.Bah("未找到提报记录");
@@ -317,14 +330,14 @@ namespace Tnb.ProductionMgr
{
bill_type = DictConst.CHANCHENGPINRUKUDAN,
bill_date = DateTime.Now,
create_id = _userManager.UserId,
create_id = create_id,
location_code = basLocation.location_code,
carry_code = prdReport.material_box_code,
is_check = 1,
station_id = prdReport.station,
workline_id = workline?.Id ?? "",
workshop_id = workshop?.Id ?? "",
org_id = _userManager.GetUserInfo().Result.organizeId,
org_id = org_id,
// warehouse_id = basLocation?.wh_id,
warehouse_id = warehouse_id,
status = 0,
@@ -338,7 +351,7 @@ namespace Tnb.ProductionMgr
material_code = basMaterial.code,
unit_id = prdReport.unit_id,
barcode = prdReport.barcode,
code_batch = prdReport.barcode + "0001",
code_batch = prdReport.mo_task_code,
quantity = (int)prdReport.reported_qty,
});
});
@@ -349,13 +362,13 @@ namespace Tnb.ProductionMgr
{
instock = new MESWmsInstockHInput()
{
org_id = _userManager.GetUserInfo().Result.organizeId,
org_id = org_id,
bill_date = DateTime.Now,
bill_type = DictConst.CHANCHENGPINRUKUDAN,
// warehouse_id = basLocation?.wh_id,
warehouse_id = warehouse_id,
source_id = prdInstockH.id,
create_id = _userManager.UserId,
create_id = create_id,
carry_code = prdReport.material_box_code,
location_code = basLocation.location_code,
is_check = 1,
@@ -368,7 +381,7 @@ namespace Tnb.ProductionMgr
material_id = prdReport.material_id,
material_code = basMaterial.code,
unit_id = prdReport.unit_id,
code_batch = prdReport.barcode,
code_batch = prdReport.mo_task_code,
pr_qty = (int)prdReport.reported_qty,
});
@@ -378,18 +391,20 @@ namespace Tnb.ProductionMgr
material_code = basMaterial.code,
unit_id = prdReport.unit_id,
barcode = prdReport.barcode,
code_batch = prdReport.barcode + "0001",
code_batch = prdReport.mo_task_code,
codeqty = (int)prdReport.reported_qty,
});
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
// string domain = "http://localhost:9232";
string domain = "http://tnb.tuotong-tech.com";
Dictionary<string, object> header = new()
{
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
// ["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
};
string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header);
Log.Information(sendResult);
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
result2 = authResponse.code != 200 || !authResponse.data.ObjToBool()
result2 = authResponse.code != 200 || !(bool)authResponse.data
? throw Oops.Bah(authResponse.msg)
: await db.Ado.UseTranAsync(async () =>
{
@@ -488,7 +503,8 @@ namespace Tnb.ProductionMgr
code_batch = prdReport.barcode + "0001",
codeqty = (int)prdReport.reported_qty,
});
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
string domain = "http://tnb.tuotong-tech.com";
Dictionary<string, object> header = new()
{
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
@@ -598,7 +614,8 @@ namespace Tnb.ProductionMgr
code_batch = prdReport.barcode + "0001",
codeqty = (int)prdReport.reported_qty,
});
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
string domain = "http://tnb.tuotong-tech.com";
Dictionary<string, object> header = new()
{
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
@@ -782,7 +799,8 @@ namespace Tnb.ProductionMgr
});
}
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
string domain = "http://tnb.tuotong-tech.com";
Dictionary<string, object> header = new()
{
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]

View File

@@ -1500,10 +1500,12 @@ namespace Tnb.ProductionMgr
report = input.Adapt<PrdReport>();
report.id = SnowflakeIdHelper.NextId();
report.reported_qty = input.reported_qty;
report.material_box_code = input.material_box_qrcode;
report.create_id = _userManager.UserId;
report.create_time = DateTime.Now;
// report.batch = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString();
report.barcode = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString();
// report.barcode = input.mo_task_code+"0001";
report.equip_id = prdMoTask.eqp_id;
report.mbom_process_id = prdMoTask.mbom_process_id;
report.station = input.station;

View File

@@ -421,7 +421,7 @@ namespace Tnb.ProductionMgr
.LeftJoin<PrdMo>((a, b, c, d, e, f, g, h, i, j) => a.mo_id == j.id)
.LeftJoin<BasMaterialUnit>((a, b, c, d, e, f, g, h, i, j, k) => a.material_id == k.material_id && k.auxiliary_unit_id == "kg")
.LeftJoin<EqpDaq>((a, b, c, d, e, f, g, h, i, j, k, l) => a.eqp_id == l.equip_id && l.enabled == 1 && l.label_point == "提报装箱称重点位")
.Where((a, b) => a.workstation_id == input.stationId && (a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode || a.mo_task_status == DictConst.InProgressEnCode))
.Where((a, b) => a.workstation_id == input.stationId)
.WhereIF(!string.IsNullOrEmpty(mo_task_code), a => a.mo_task_code.Contains(mo_task_code))
//.WhereIF(!string.IsNullOrEmpty(mo_task_status),a=>a.mo_task_status==mo_task_status)
.WhereIF(statusList.Count > 0, a => statusList.Contains(a.mo_task_status))

View File

@@ -220,7 +220,7 @@ namespace Tnb.ProductionMgr
}
public Task StartAsync(CancellationToken cancellationToken)
{
Readtimer = new Timer(GetRedisData, null, TimeSpan.Zero, TimeSpan.FromSeconds(5));
Readtimer = new Timer(GetRedisData, null, TimeSpan.Zero, TimeSpan.FromSeconds(300));
return Task.CompletedTask;
}
public Task StopAsync(CancellationToken cancellationToken)

View File

@@ -318,7 +318,7 @@ namespace Tnb.WarehouseMgr
x.bill_code = $"{groupCode}-1";
}
}
else if ((moveNum >= areaPreTasks.Count && areaPreTasks.Count > 1) || moveNum < areaPreTasks.Count)
else if ((moveNum >= areaPreTasks.Count && areaPreTasks.Count > 1) || moveNum <= areaPreTasks.Count)
{
string groupCode = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE);
items.ForEach(x => x.is_chain = 1);

View File

@@ -243,6 +243,7 @@ namespace Tnb.WarehouseMgr
endlocation_id = ePoint?.location_id!,
endlocation_code = ePoint?.location_code!,
startpoint_id = sPoint?.id!,
startpoint_code = sPoint?.point_code!,
endpoint_id = ePoint?.id!,
endpoint_code = ePoint?.point_code!,
start_floor = sPoint?.floor.ToString(),
@@ -391,7 +392,7 @@ namespace Tnb.WarehouseMgr
var carryCodes = await _db.Queryable<BasLocation>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.location_id)
.InnerJoin<WmsCarryH>((a, b, c) => b.carry_id == c.id)
.Where(filterExp)
.Select((a, b, c) => new WmsCarryCode { carry_code = c.carry_code }, true)
.Select<WmsCarryCode>()
.ToListAsync();
List<WmsCheckstockD> outputs = carryCodes.GroupBy(g => new { g.material_code, g.code_batch, g.location_code, g.carry_id }).Select(x => new WmsCheckstockD

View File

@@ -6,6 +6,7 @@ using JNPF.EventBus;
using JNPF.FriendlyException;
using JNPF.Systems.Interfaces.System;
using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Tnb.BasicData.Entities;
@@ -267,6 +268,7 @@ namespace Tnb.WarehouseMgr
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public async Task<dynamic> MESCreateInstock(MESCreateInstockInput input)
{
bool isSuccessFul = false;
@@ -308,8 +310,8 @@ namespace Tnb.WarehouseMgr
instock.location_id = loc.id;
instock.biz_type = WmsWareHouseConst.BIZTYPE_WMSINSTOCK_ID;
instock.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_INSTOCK_ENCODE).GetAwaiter().GetResult();
instock.generate_type = "1";// 自动
instock.sync_status = WmsWareHouseConst.SYNC_STATUS__NOTSYNC;//同步
instock.generate_type = "0";// 人工
instock.sync_status = WmsWareHouseConst.SYNC_STATUS_NONEEDSYNC;//无需同步
instock.print_status = WmsWareHouseConst.PRINT_STATUS_PRINTCOMPLETE;//已打印
instock.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;// 新增
instock.create_time = DateTime.Now;
@@ -347,7 +349,7 @@ namespace Tnb.WarehouseMgr
instockCOdes.Add(c);
}
}
string orgId = _userManager.User.OrganizeId;
string orgId = _userManager.User?.OrganizeId ?? input.instock.org_id;
_ = await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync();
//生成预任务申请
@@ -370,7 +372,7 @@ namespace Tnb.WarehouseMgr
WmsPretaskH preTask = new()
{
org_id = _userManager.User.OrganizeId,
org_id = orgId,
startlocation_id = sPoint?.location_id ?? string.Empty,
startlocation_code = sPoint?.location_code ?? string.Empty,
endlocation_id = ePoint?.location_id ?? string.Empty,
@@ -387,7 +389,7 @@ namespace Tnb.WarehouseMgr
area_code = it.Key,
require_id = instock?.id ?? string.Empty,
require_code = instock?.bill_code ?? string.Empty,
create_id = _userManager.UserId,
create_id = instock.create_id,
create_time = DateTime.Now
};
return preTask;
@@ -446,16 +448,16 @@ namespace Tnb.WarehouseMgr
{
WmsHandleCode handleCode = jo.Adapt<WmsHandleCode>();
handleCode.id = SnowflakeIdHelper.NextId();
handleCode.org_id = _userManager.User.OrganizeId;
handleCode.org_id = orgId;
handleCode.bill_id = operBillId;
handleCode.create_id = _userManager.UserId;
handleCode.create_id = instock.create_id;
handleCode.create_time = DateTime.Now;
preTaskUpInput.PreTaskHandleCodes.Add(handleCode);
}
}
//生成载具条码记录
List<WmsCarryCode> carryCodes = preTaskUpInput.PreTaskHandleCodes.Adapt<List<WmsCarryCode>>();
carryCodes.ForEach(x =>
{
x.id = SnowflakeIdHelper.NextId();
@@ -498,6 +500,7 @@ namespace Tnb.WarehouseMgr
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public async Task<dynamic> MesFetchInOutStockInfoByBarCode(MaterialLabelQuery input)
{
if (input.IsNull())

View File

@@ -13,6 +13,7 @@ using JNPF.VisualDev;
using JNPF.VisualDev.Entitys;
using JNPF.VisualDev.Interfaces;
using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using SqlSugar;
@@ -551,6 +552,7 @@ namespace Tnb.WarehouseMgr
/// <returns></returns>
[HttpPost]
//[NonUnify]
[AllowAnonymous]
public async Task<dynamic> MESCreateOutstock(MESCreateOutstockInput input)
{
bool isSuccessful = true;
@@ -574,8 +576,8 @@ namespace Tnb.WarehouseMgr
outstock.location_id = location.id;
outstock.biz_type = WmsWareHouseConst.BIZTYPE_WMSOUTSTOCK_ID;
outstock.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_OUTSTOCK_ENCODE).GetAwaiter().GetResult();
outstock.generate_type = "1";// 自动
outstock.sync_status = WmsWareHouseConst.SYNC_STATUS__NOTSYNC;//未同步
outstock.generate_type = "0";// 自动
outstock.sync_status = WmsWareHouseConst.SYNC_STATUS_NONEEDSYNC;//未同步
outstock.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;// 新增
outstock.create_id = _userManager.UserId;
outstock.create_time = DateTime.Now;

View File

@@ -2,6 +2,7 @@
using JNPF.Common.Extension;
using JNPF.Systems.Interfaces.System;
using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Tnb.BasicData.Entities;
@@ -114,6 +115,7 @@ namespace Tnb.WarehouseMgr
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public async Task<dynamic> MESCarrySign(MESCarrySignInput input)
{
if (input.IsNull())

View File

@@ -12,6 +12,7 @@ using JNPF.LinqBuilder;
using JNPF.Logging;
using JNPF.Systems.Interfaces.System;
using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Tnb.BasicData.Entities;
@@ -391,6 +392,7 @@ namespace Tnb.WarehouseMgr
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public async Task<dynamic> MESKittingOutStk(List<MESKittingOutStkInput> input)
{
bool isSuccessFul = false;

View File

@@ -57,7 +57,7 @@ public class Startup : AppStartup
//定时任务
services.AddHostedService<TimedTaskBackgroundService>();
//services.AddHostedService<RedisBackGround>();
services.AddHostedService<RedisBackGround>();
}