This commit is contained in:
FanLian
2023-07-17 15:18:39 +08:00
parent e2a03ded93
commit 9ca32bbcd6
2 changed files with 7 additions and 36 deletions

View File

@@ -94,7 +94,7 @@ namespace Tnb.WarehouseMgr
{
WmsCarrybindCode wmsCarrybindCode = new();
wmsCarrybindCode.id = SnowflakeIdHelper.NextId();
wmsCarrybindCode.org_id = subCarry?.org_id!;
wmsCarrybindCode.org_id = (subCarry != null && subCarry.org_id != null) ? subCarry.org_id : _userManager.User.OrganizeId;
wmsCarrybindCode.carrybind_id = input.data["ReturnIdentity"]?.ToString()!;
wmsCarrybindCode.material_id = items[i].material_id;
wmsCarrybindCode.material_code = items[i].material_code;

View File

@@ -27,25 +27,28 @@ namespace Tnb.WarehouseMgr
/// PDA投料记录
/// </summary>
[OverideVisualDev(ModuleConsts.MODULE_WMSFEEDINGRECORDPDA_ID)]
public class WmsPDAFeedingService : BaseWareHouseService, IWmsCarryService, IPdaStroage
public class WmsPDAFeedingService : BaseWareHouseService, IPdaStroage
{
private readonly ISqlSugarClient _db;
private readonly IUserManager _userManager;
private readonly IBillRullService _billRullService;
private readonly IRunService _runService;
private readonly IVisualDevService _visualDevService;
private readonly IWmsCarryService _carryService;
public WmsPDAFeedingService(
ISqlSugarRepository<WmsCarryH> repository,
IUserManager userManager,
IBillRullService billRullService,
IRunService runService,
IVisualDevService visualDevService)
IVisualDevService visualDevService,
IWmsCarryService carryService)
{
_db = repository.AsSugarClient();
_userManager = userManager;
_billRullService = billRullService;
_runService = runService;
_visualDevService = visualDevService;
_carryService = carryService;
OverideFuncs.CreateAsync = WmsPDAFeedingRecord;
}
@@ -97,7 +100,7 @@ namespace Tnb.WarehouseMgr
it.modify_time
}).ExecuteCommandAsync();
//更新载具
row = await UpdateNullCarry(carry);
row = await _carryService.UpdateNullCarry(carry);
isOk = (row > 0);
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
}
@@ -124,37 +127,5 @@ namespace Tnb.WarehouseMgr
return isOk;
}
public async Task<int> UpdateNullCarry(WmsCarryH carryObj)
{
var row = -1;
try
{
carryObj.status = 0;
carryObj.carry_status = ((int)EnumCarryStatus.).ToString();
carryObj.location_id = null;
carryObj.location_code = null;
carryObj.out_status = "0";
carryObj.is_check = 0;
carryObj.status = 1;
carryObj.bale_num = null;
carryObj.collocation_scheme_id = null;
carryObj.collocation_scheme_code = null;
carryObj.source_id = null;
carryObj.source_code = null;
row = await _db.Updateable(carryObj).ExecuteCommandAsync();
//删除对应明细表
//删除载具明细
await _db.Deleteable<WmsCarryD>().Where(it => it.carry_id == carryObj.id).ExecuteCommandHasChangeAsync();
//删除载具分拣物料明细
await _db.Deleteable<WmsCarryMat>().Where(it => it.carry_id == carryObj.id).ExecuteCommandHasChangeAsync();
//删除载具条码
await _db.Deleteable<WmsCarryCode>().Where(it => it.carry_id == carryObj.id).ExecuteCommandHasChangeAsync();
}
catch (Exception)
{
}
return row;
}
}
}