This commit is contained in:
FanLian
2023-06-16 08:55:22 +08:00
12 changed files with 39 additions and 15 deletions

View File

@@ -47,10 +47,12 @@ namespace Tnb.WarehouseMgr
{
private readonly ISqlSugarClient _db;
private readonly IDictionaryDataService _dictionaryDataService;
public WareHouseService(ISqlSugarRepository<WmsInstockH> repository, IDictionaryDataService dictionaryDataService)
private readonly IBillRullService _billRullService;
public WareHouseService(ISqlSugarRepository<WmsInstockH> repository, IDictionaryDataService dictionaryDataService, IBillRullService billRullService)
{
_db = repository.AsSugarClient();
_dictionaryDataService = dictionaryDataService;
_billRullService= billRullService;
}
/// <summary>
/// 根据载具Id带出库位、仓库信息
@@ -231,6 +233,7 @@ namespace Tnb.WarehouseMgr
items.ForEach(x =>
{
x.is_chain = 0;
x.chain_type = "0";
});
}
@@ -266,6 +269,12 @@ namespace Tnb.WarehouseMgr
{
var moveNum = itGroup.First().move_num;
var items = itGroup.Adapt<List<WmsDistaskH>>();
items.ForEach(x =>
{
x.status = WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID;
x.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE).GetAwaiter().GetResult();
x.is_sign = 1;
});
var areaPreTasks = itGroup.ToList();
if (moveNum == 1)
{
@@ -460,16 +469,14 @@ namespace Tnb.WarehouseMgr
/// </summary>
/// <returns></returns>
[NonAction]
public async Task GenTaskHandleAfter(GenPreTaskUpInput input)
public async Task GenInStockTaskHandleAfter(GenPreTaskUpInput input)
{
try
{
await _db.Ado.BeginTranAsync();
//根据载具移入Id回更单据状态
await _db.Updateable<WmsMoveInstock>().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.PreTaskId).ExecuteCommandAsync();
//根据生成的预任务,插入预任务操作记录
await _db.Insertable(input.PreTaskRecord).ExecuteCommandAsync();
if(input.PreTaskHandleCodes.Count > 0)
if (input.PreTaskHandleCodes.Count > 0)
{
await _db.Insertable(input.PreTaskHandleCodes).ExecuteCommandAsync();
}

View File

@@ -138,8 +138,10 @@ namespace Tnb.WarehouseMgr
handleH.create_id = _userManager.UserId;
handleH.create_time = DateTime.Now;
preTaskUpInput.PreTaskRecord = handleH;
//根据载具移入Id回更单据状态
await _db.Updateable<WmsMoveInstock>().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.PreTaskId).ExecuteCommandAsync();
await _wareHouseService.GenTaskHandleAfter(preTaskUpInput);
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput);
}
}

View File

@@ -124,7 +124,7 @@ namespace Tnb.WarehouseMgr
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
await _wareHouseService.GenTaskHandleAfter(preTaskUpInput);
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput);
}
}

View File

@@ -125,7 +125,7 @@ namespace Tnb.WarehouseMgr
preTaskUpInput.LocationIds = points.Select(x => x.id).ToList();
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
await _wareHouseService.GenTaskHandleAfter(preTaskUpInput);
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput);
}
}

View File

@@ -149,7 +149,7 @@ namespace Tnb.WarehouseMgr
preTaskUpInput.LocationIds = points.Select(x => x.id).ToList();
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
await _wareHouseService.GenTaskHandleAfter(preTaskUpInput);
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput);
}
}
}

View File

@@ -127,7 +127,7 @@ namespace Tnb.WarehouseMgr
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
await _wareHouseService.GenTaskHandleAfter(preTaskUpInput);
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput);
}
}

View File

@@ -124,7 +124,7 @@ namespace Tnb.WarehouseMgr
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
await _wareHouseService.GenTaskHandleAfter(preTaskUpInput);
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput);
}
}

View File

@@ -125,7 +125,7 @@ namespace Tnb.WarehouseMgr
preTaskUpInput.LocationIds = points.Select(x => x.id).ToList();
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
await _wareHouseService.GenTaskHandleAfter(preTaskUpInput);
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput);
}
}

View File

@@ -157,7 +157,6 @@ namespace Tnb.WarehouseMgr
handleCode.code_batch = jo.Value<string>(nameof(WmsHandleCode.code_batch));
handleCode.codeqty = jo.Value<int>(nameof(WmsHandleCode.codeqty));
handleCode.unit_id = _db.Queryable<BasMaterial>().Single(it => it.id == materialId).unit_id;
//handleCode.unit_code=_db.Queryable<BasMaterial>().Single(it => it.id == materialId);
handleCode.create_id = _userManager.UserId;
handleCode.create_time = DateTime.Now;
preTaskUpInput.PreTaskHandleCodes.Add(handleCode);
@@ -165,7 +164,9 @@ namespace Tnb.WarehouseMgr
}
}
}
await _wareHouseService.GenTaskHandleAfter(preTaskUpInput);
await _db.Insertable(preTaskUpInput.PreTaskRecord).ExecuteCommandAsync();
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString(), is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }).Where(it => it.id == preTaskUpInput.CarryId).ExecuteCommandAsync();
}
}
}