修改生成规则

This commit is contained in:
tongfei
2024-02-18 16:53:18 +08:00
parent 8a3d4343a3
commit b3190e67e7
13 changed files with 332 additions and 85 deletions

View File

@@ -37,26 +37,29 @@ namespace WMS.Web.Domain.Services
/// <param name="dto"></param>
/// <param name="loginInfo"></param>
/// <returns></returns>
public async Task<Result> Generate(GenerateBoxMarkDto dto, LoginInDto loginInfo)
public async Task<ResultList<BoxMarkQueryResponse>> Generate(GenerateBoxMarkDto dto, LoginInDto loginInfo)
{
//1.获取最新的箱唛信息
var entity_new = await _boxMarkRepositories.GetBy();
//var entity_new = await _boxMarkRepositories.GetBy();
var billNo_new = await _boxMarkRepositories.GetLastBillNo();
//2.dto映射实体
var entity = new BoxMark();
entity= _mapper.Map(dto, entity);
entity.Create(loginInfo.UserInfo.StaffId);
var new_firstBillNo = entity_new == null ? 0 : entity_new.FirstBillNo;
var new_lastBillNo = entity_new == null ? 0 : entity_new.LastBillNo;
int new_firstBillNo = billNo_new == null ? 0 : billNo_new.FirstBillNo;
int new_lastBillNo = billNo_new == null ? 0 : billNo_new.LastBillNo;
entity.GenerateBillNo(new_firstBillNo, new_lastBillNo);
//添加
var isSuccess = await _boxMarkRepositories.Add(entity);
if (!isSuccess)
return Result<InStockTask>.ReFailure(ResultCodes.DateWriteError);
var model = await _boxMarkRepositories.Add(entity);
if (model==null)
return ResultList<BoxMarkQueryResponse>.ReFailure(ResultCodes.DateWriteError);
return Result.ReSuccess();
//返回列表-对应刚刚生成的数据和编号集合
var list= await _boxMarkRepositories.GetListInfoBy(model.Id, loginInfo.UserInfo.CompanyId);
return ResultList<BoxMarkQueryResponse>.ReSuccess(list);
}
}
}