Browse Source

Merge branch 'dev_DY_CC' of http://dev.ccwin-in.com:3000/BoXu.Zheng/WZC2 into dev_DY_CC

dev_DY_CC
lvzb 1 year ago
parent
commit
c819ea7209
  1. 204
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ThirdLocationJobController.cs
  2. 38
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationNoteController.cs
  3. 51
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationRequestController.cs
  4. 93
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/DTOs/ProductionLineItemDTO.cs
  5. 4
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/IProductionLineItemAppService.cs
  6. 44
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/Inputs/ProductionLineItemEditInput.cs
  7. 91
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/Inputs/ProductionLineItemImportInput.cs
  8. 35
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/DTOs/ProductionLineDTO.cs
  9. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/IProductionLineAppService.cs
  10. 36
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/Inputs/ProductionLineEditInput.cs
  11. 36
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/Inputs/ProductionLineImportInput.cs
  12. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ErpLocationItems/ErpLocationItemAppService.cs
  13. 30
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLineItems/ProductionLineItemAppService.cs
  14. 20
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLines/ProductionLineAppService.cs
  15. 74
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ProductionLineItems/ProductionLineItem.cs
  16. 34
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ProductionLines/ProductionLine.cs
  17. 4237
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/20240403083042_BaseData_ProductLine_BaseData_ProductLineItem.Designer.cs
  18. 223
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/20240403083042_BaseData_ProductLine_BaseData_ProductLineItem.cs
  19. 129
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/BasedataDbContextModelSnapshot.cs
  20. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/ProductionLines/ProductionLineDbContextModelCreatingExtensions.cs
  21. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/ProductionLines/ProductionLineEfCoreRepository.cs
  22. 14
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/Inputs/RecommendBalanceRequestInput.cs
  23. 21
      be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumIssueType.cs
  24. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CustomerProductionReturnNotes/Inputs/CustomerProductionReturnNoteEditInput.cs
  25. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/IProductReceiptNoteAppService.cs
  26. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/InjectionRequests/DTOs/InjectionRequestDetailDTO.cs
  27. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/InjectionRequests/IInjectionRequestAppService.cs
  28. 41
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/InjectionRequests/Inputs/InjectionRequestDetailInput.cs
  29. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs
  30. 20
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductReceiptNotes/ProductReceiptNoteAppService.cs
  31. 113
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs
  32. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAutoMapperProfile.cs
  33. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/IInjectionRequestManager.cs
  34. 30
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestDetail.cs
  35. 28
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestManager.cs
  36. 27637
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240403054940_Update_InjectionRequest.Designer.cs
  37. 568
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240403054940_Update_InjectionRequest.cs
  38. 29578
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240409090529_Update_InjectionRequest_2024_04_09.Designer.cs
  39. 730
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240409090529_Update_InjectionRequest_2024_04_09.cs
  40. 5231
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/StoreDbContextModelSnapshot.cs
  41. 171
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionRequestEventHandler.cs
  42. 68
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/BackFlushNoteEventHandler.cs
  43. 12
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/CustomerProductionReturnNoteEventHandler.cs
  44. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/MesNoteEventHandler.cs
  45. 52
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ProductReceiptNoteEventHandler.cs

204
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ThirdLocationJobController.cs

@ -0,0 +1,204 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Polly.Caching;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
using Win_in.Sfs.Auth.Application.Contracts;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.Pda.Controllers.Jobs;
/// <summary>
///
/// </summary>
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}job/third-location")]
public class ThirdLocationJobController : AbpController
{
private readonly IThirdLocationJobAppService _thirdLocationJobAppService;
private readonly IUserWorkGroupAppService _userWorkGroupAppService;
private readonly IDictAppService _dictApp;
/// <summary>
///
/// </summary>
/// <param name="thirdLocationJobAppService"></param>
/// <param name="userWorkGroupAppService"></param>
public ThirdLocationJobController(
IThirdLocationJobAppService thirdLocationJobAppService,
IDictAppService dictApp
, IUserWorkGroupAppService userWorkGroupAppService)
{
_userWorkGroupAppService = userWorkGroupAppService;
_thirdLocationJobAppService = thirdLocationJobAppService;
_dictApp = dictApp;
}
/// <summary>
/// 获取任务详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("{id}")]
public virtual async Task<ActionResult<ThirdLocationJobDTO>> GetAsync(Guid id)
{
var result = await _thirdLocationJobAppService.GetAsync(id).ConfigureAwait(false);
return Ok(result);
}
/// <summary>
/// 获取列表 筛选
/// </summary>
/// <param name="sfsRequestDTO"></param>
/// <returns></returns>
[HttpPost("list")]
public virtual async Task<PagedResultDto<ThirdLocationJobDTO>> GetListAsync(SfsJobRequestInputBase sfsRequestDTO)
{
var list = await _thirdLocationJobAppService.GetPagedListByFilterAsync(sfsRequestDTO, true).ConfigureAwait(false);
return list;
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="pageSize"></param>
/// <param name="pageIndex"></param>
/// <returns></returns>
[HttpGet("list")]
public virtual async Task<PagedResultDto<ThirdLocationJobDTO>> GetListAsync(int pageSize, int pageIndex, bool isFinished)
{
var dtos = await _dictApp.GetByCodeAsync("ContainerSpecificationsType").ConfigureAwait(false);
var status = new List<int>();
if (isFinished == true)
{
status.Add((int)EnumJobStatus.Done);
}
else
{
status.Add((int)EnumJobStatus.Open);
}
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase
{
MaxResultCount = pageSize,
SkipCount = (pageIndex - 1) * pageSize,
Sorting = $"{nameof(ThirdLocationJobDTO.CreationTime)} ASC",
Condition = new Condition
{
Filters = new List<Filter>
{
new(nameof(ThirdLocationJobDTO.JobStatus),jsonStatus,"In")
}
}
};
var list = await _thirdLocationJobAppService.GetPagedListByFilterAsync(request, true).ConfigureAwait(false);
return list;
}
/// <summary>
/// 根据Job Number 获取任务列表
/// </summary>
/// <param name="jobNumber"></param>
/// <returns></returns>
[HttpGet("by-number/{jobNumber}")]
public virtual async Task<ActionResult<ThirdLocationJobDTO>> GetByNumberAsync(string jobNumber)
{
var jobDto = await _thirdLocationJobAppService.GetByNumberAsync(jobNumber).ConfigureAwait(false);
if (jobDto == null)
{
throw new UserFriendlyException($"未找到编号为 {jobNumber} 的任务");
}
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
if (!wlgCodes.Contains(jobDto.WorkGroupCode))
{
return new NotFoundObjectResult($"任务属于工作组 {jobDto.WorkGroupCode}");
}
if (jobDto.JobStatus == EnumJobStatus.Doing && jobDto.AcceptUserId != CurrentUser.Id)
{
return new NotFoundObjectResult($"任务正在被 {jobDto.AcceptUserName} 处理");
}
return jobDto;
}
/// <summary>
/// 获取任务数量
/// </summary>
/// <returns></returns>
[HttpGet("count")]
public virtual async Task<ActionResult<long>> CountAsync()
{
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase
{
Sorting = $"{nameof(ThirdLocationJobDTO.Priority)} ASC",
Condition = new Condition
{
Filters = new List<Filter>
{
new(nameof(ThirdLocationJobDTO.WorkGroupCode),jsonCodes,"In"),
new(nameof(ThirdLocationJobDTO.JobStatus),jsonStatus,"In")
}
}
};
var count = await _thirdLocationJobAppService.GetCountByFilterAsync(request).ConfigureAwait(false);
return Ok(count);
}
/// <summary>
/// 承接任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("take/{id}")]
public virtual async Task TakeAsync(Guid id)
{
await _thirdLocationJobAppService.AcceptAsync(id).ConfigureAwait(false);
}
/// <summary>
/// 取消承接任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("cancel-take/{id}")]
public virtual async Task CancelTakeAsync(Guid id)
{
await _thirdLocationJobAppService.CancelAcceptAsync(id).ConfigureAwait(false);
}
/// <summary>
/// 执行任务
/// </summary>
/// <param name="id"></param>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("finish/{id}")]
public virtual async Task FinishAsync(Guid id, [FromBody] ThirdLocationJobDTO dto)
{
await _thirdLocationJobAppService.CompleteAsync(id, dto).ConfigureAwait(false);
}
}

38
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationNoteController.cs

@ -0,0 +1,38 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.Pda.Controllers.Stores;
/// <summary>
///
/// </summary>
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}store/third-location-note")]
public class ThirdLocationNoteController : AbpController
{
private readonly IThirdLocationNoteAppService _thirdLocationNoteAppService;
/// <summary>
///
/// </summary>
/// <param name="thirdLocationNoteAppService"></param>
public ThirdLocationNoteController(IThirdLocationNoteAppService thirdLocationNoteAppService)
{
_thirdLocationNoteAppService = thirdLocationNoteAppService;
}
/// <summary>
/// 创建器具转移记录
/// </summary>
/// <param name="input">CreateInput</param>
/// <returns></returns>
[HttpPost("")]
public virtual async Task CreateAsync(ThirdLocationNoteEditInput input)
{
await _thirdLocationNoteAppService.CreateAsync(input).ConfigureAwait(false);
}
}

51
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationRequestController.cs

@ -0,0 +1,51 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.Pda.Controllers.Stores;
/// <summary>
///三方库库移请求
/// </summary>
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}store/third-location-request")]
public class ThirdLocationRequestController : AbpController
{
private readonly IThirdLocationRequestAppService _thirdLocationRequestAppService;
/// <summary>
///
/// </summary>
/// <param name="ThirdLocationRequestAppService"></param>
public ThirdLocationRequestController(IThirdLocationRequestAppService ThirdLocationRequestAppService)
{
_thirdLocationRequestAppService = ThirdLocationRequestAppService;
}
/// <summary>
/// 三方库库移申请
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("")]
public virtual async Task CreateAsync(ThirdLocationRequestEditInput input)
{
_ = await _thirdLocationRequestAppService.CreateAsync(input).ConfigureAwait(false);
}
/// <summary>
/// 根据number获取三方库库移申请详情
/// </summary>
/// <param name="number"></param>
/// <returns></returns>
[HttpGet("{number}")]
public virtual async Task<ActionResult<ThirdLocationRequestDTO>> GetAsync(string number)
{
var result = await _thirdLocationRequestAppService.GetByNumberAsync(number).ConfigureAwait(false);
return Ok(result);
}
}

93
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/DTOs/ProductionLineItemDTO.cs

@ -2,82 +2,67 @@
// Copyright (c) 闻荫科技 www.ccwin-in.com
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Basedata.Application.Contracts;
/// <summary>
/// 生产线-物品配置
/// 生产线-物料关系
/// </summary>
[Display(Name = "生产线物品配置")]
[Display(Name = "生产线-物料关系")]
public class ProductionLineItemDTO : SfsBaseDataDTOBase
{
/// <summary>
/// 生产线代码
/// </summary>
[Key]
[Display(Name = "生产线代码")]
[Required(ErrorMessage = "{0}是必填项")]
[IgnoreUpdate]
public string ProdLineCode { get; set; }
/// <summary>
/// 物品代码
/// </summary>
[Key]
[Display(Name = "物品代码")]
[Required(ErrorMessage = "{0}是必填项")]
[IgnoreUpdate]
public string ItemCode { get; set; }
//[Display(Name = "代码")]
//[Required(ErrorMessage = "{0}是必填项")]
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
//public string Code { get; set; }
///// <summary>
///// 生产线ID
///// </summary>
//[Display(Name = "生产线Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid ProdLineId { get; set; }
///// <summary>
///// 生产线Name
///// </summary>
//public string ProdLineName { get; set; }
///// <summary>
///// 物品Code
///// </summary>
//public string ItemCode { get; set; }
///// <summary>
///// 物品Code
///// </summary>
//public string ItemName { get; set; }
///// <summary>
///// 产品结构ID
///// </summary>
//[Display(Name = "产品结构Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid BomId { get; set; }
/// <summary>
/// 物品名称
/// </summary>
[Display(Name = "物品名称")]
public string ItemName { get; set; }
///// <summary>
///// Bom名称
///// </summary>
//public string BomName { get; set; }
/// <summary>
/// 物品描述1
/// </summary>
[Display(Name = "物品描述1")]
public string ItemDesc1 { get; set; }
///// <summary>
///// 产品结构BomType
///// </summary>
//public string BomBomType { get; set; }
/// <summary>
/// 物品描述2
/// </summary>
[Display(Name = "物品描述2")]
public string ItemDesc2 { get; set; }
///// <summary>
///// 工艺路线ID
///// </summary>
//[Display(Name = "工艺路线Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid RoutingId { get; set; }
/// <summary>
/// 原料库位
/// </summary>
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
///// <summary>
///// 工艺路线Name
///// </summary>
//public string RouteName { get; set; }
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

4
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/IProductionLineItemAppService.cs

@ -1,6 +1,8 @@
// 闻荫智慧工厂管理套件
// Copyright (c) 闻荫科技 www.ccwin-in.com
using System.Collections.Generic;
using System.Threading.Tasks;
using Win_in.Sfs.Shared.Application.Contracts;
namespace Win_in.Sfs.Basedata.Application.Contracts;
@ -10,5 +12,5 @@ public interface IProductionLineItemAppService
, ISfsUpsertAppService<ProductionLineItemEditInput>
{
Task<List<ProductionLineItemDTO>> GetByProductLineCodeAsync(string productLineCode);
}

44
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/Inputs/ProductionLineItemEditInput.cs

@ -2,7 +2,7 @@
// Copyright (c) 闻荫科技 www.ccwin-in.com
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Basedata.Application.Contracts;
@ -11,13 +11,12 @@ namespace Win_in.Sfs.Basedata.Application.Contracts;
/// </summary>
public class ProductionLineItemEditInput : SfsBaseDataCreateOrUpdateInputBase
{
#region Create
/// <summary>
/// 生产线代码
/// </summary>
[Display(Name = "生产线代码")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
[IgnoreUpdate]
public string ProdLineCode { get; set; }
/// <summary>
@ -25,7 +24,42 @@ public class ProductionLineItemEditInput : SfsBaseDataCreateOrUpdateInputBase
/// </summary>
[Display(Name = "物品代码")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
[IgnoreUpdate]
public string ItemCode { get; set; }
#endregion
/// <summary>
/// 物品名称
/// </summary>
[Display(Name = "物品名称")]
public string ItemName { get; set; }
/// <summary>
/// 物品描述1
/// </summary>
[Display(Name = "物品描述1")]
public string ItemDesc1 { get; set; }
/// <summary>
/// 物品描述2
/// </summary>
[Display(Name = "物品描述2")]
public string ItemDesc2 { get; set; }
/// <summary>
/// 原料库位
/// </summary>
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

91
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/Inputs/ProductionLineItemImportInput.cs

@ -2,7 +2,7 @@
// Copyright (c) 闻荫科技 www.ccwin-in.com
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Basedata.Application.Contracts;
@ -15,77 +15,58 @@ public class ProductionLineItemImportInput : SfsBaseDataImportInputBase
/// <summary>
/// 生产线代码
/// </summary>
[Key]
[Display(Name = "生产线代码")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
[IgnoreUpdate]
public string ProdLineCode { get; set; }
/// <summary>
/// 物品代码
/// </summary>
[Key]
[Display(Name = "物品代码")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
[IgnoreUpdate]
public string ItemCode { get; set; }
/// <summary>
/// 备注
/// 物品名称
/// </summary>
[Display(Name = "备注")]
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Remark { get; set; }
///// <summary>
///// 生产线ID
///// </summary>
//[Display(Name = "生产线Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid ProdLineId { get; set; }
///// <summary>
///// 生产线Name
///// </summary>
//public string ProdLineName { get; set; }
///// <summary>
///// 物品Code
///// </summary>
//public string ItemCode { get; set; }
[Display(Name = "物品名称")]
public string ItemName { get; set; }
///// <summary>
///// 物品Code
///// </summary>
//public string ItemName { get; set; }
///// <summary>
///// 产品结构ID
///// </summary>
//[Display(Name = "产品结构Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid BomId { get; set; }
/// <summary>
/// 物品描述1
/// </summary>
[Display(Name = "物品描述1")]
public string ItemDesc1 { get; set; }
///// <summary>
///// Bom名称
///// </summary>
//public string BomName { get; set; }
/// <summary>
/// 物品描述2
/// </summary>
[Display(Name = "物品描述2")]
public string ItemDesc2 { get; set; }
///// <summary>
///// 产品结构BomType
///// </summary>
//public string BomBomType { get; set; }
/// <summary>
/// 原料库位
/// </summary>
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
///// <summary>
///// 工艺路线ID
///// </summary>
//[Display(Name = "工艺路线Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid RoutingId { get; set; }
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
///// <summary>
///// 工艺路线Name
///// </summary>
//public string RouteName { get; set; }
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
/// <summary>
/// 备注
/// </summary>
[Display(Name = "备注")]
public string Remark { get; set; }
}

35
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/DTOs/ProductionLineDTO.cs

@ -1,6 +1,4 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Entities;
@ -15,11 +13,19 @@ public class ProductionLineDTO : SfsBaseDataDTOBase, IHasCode, IHasName
/// <summary>
/// 代码
/// </summary>
[Display(Name = "代码")]
[Display(Name = "生产线代码")]
[Key]
[IgnoreUpdate]
public string Code { get; set; }
/// <summary>
/// 库位
/// </summary>
[Display(Name = "库位代码")]
[Key]
[IgnoreUpdate]
public string LocationCode { get; set; }
/// <summary>
/// 名称
/// </summary>
@ -31,27 +37,4 @@ public class ProductionLineDTO : SfsBaseDataDTOBase, IHasCode, IHasName
/// </summary>
[Display(Name = "描述")]
public string Description { get; set; }
/// <summary>
/// 类型
/// </summary>
public EnumProductionLineType Type { get; set; }
/// <summary>
/// 原料库位
/// </summary>
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

1
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/IProductionLineAppService.cs

@ -8,4 +8,5 @@ public interface IProductionLineAppService
, ISfsGetByCodeAppService<ProductionLineDTO>
, ISfsUpsertAppService<ProductionLineEditInput>
{
Task<ProductionLineDTO> GetByLocationCodeAsync(string locationCode);
}

36
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/Inputs/ProductionLineEditInput.cs

@ -1,7 +1,4 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Basedata.Application.Contracts;
@ -14,11 +11,19 @@ public class ProductionLineEditInput : SfsBaseDataCreateOrUpdateInputBase
/// <summary>
/// 代码
/// </summary>
[Display(Name = "代码")]
[Display(Name = "生产线代码")]
[Key]
[IgnoreUpdate]
public string Code { get; set; }
/// <summary>
/// 库位
/// </summary>
[Display(Name = "库位代码")]
[Key]
[IgnoreUpdate]
public string LocationCode { get; set; }
/// <summary>
/// 名称
/// </summary>
@ -30,27 +35,4 @@ public class ProductionLineEditInput : SfsBaseDataCreateOrUpdateInputBase
/// </summary>
[Display(Name = "描述")]
public string Description { get; set; }
/// <summary>
/// 类型
/// </summary>
public EnumProductionLineType Type { get; set; }
/// <summary>
/// 原料库位
/// </summary>
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

36
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductionLines/Inputs/ProductionLineImportInput.cs

@ -1,7 +1,4 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Basedata.Application.Contracts;
@ -15,11 +12,19 @@ public class ProductionLineImportInput : SfsBaseDataImportInputBase
/// <summary>
/// 代码
/// </summary>
[Display(Name = "代码")]
[Display(Name = "生产线代码")]
[Key]
[IgnoreUpdate]
public string Code { get; set; }
/// <summary>
/// 库位
/// </summary>
[Display(Name = "库位代码")]
[Key]
[IgnoreUpdate]
public string LocationCode { get; set; }
/// <summary>
/// 名称
/// </summary>
@ -31,27 +36,4 @@ public class ProductionLineImportInput : SfsBaseDataImportInputBase
/// </summary>
[Display(Name = "描述")]
public string Description { get; set; }
/// <summary>
/// 类型
/// </summary>
public EnumProductionLineType Type { get; set; }
/// <summary>
/// 原料库位
/// </summary>
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ErpLocationItems/ErpLocationItemAppService.cs

@ -61,7 +61,7 @@ public class ErpLocationItemAppService
if(entity != null)
{
throw new UserFriendlyException($"物品{input.ItemCode}和储位{input.ErpLocationCode} 对应关系已存在");
throw new UserFriendlyException($"物品 {input.ItemCode} 和储位 {input.ErpLocationCode} 对应关系已存在");
}
return await base.CreateAsync(input).ConfigureAwait(false);

30
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLineItems/ProductionLineItemAppService.cs

@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Caching;
@ -13,15 +12,11 @@ namespace Win_in.Sfs.Basedata.Application;
[Authorize]
[Route($"{BasedataConsts.RootPath}prod-line-item")]
public class ProductionLineItemAppService : SfsBaseDataAppServiceBase<ProductionLineItem, ProductionLineItemDTO, SfsBaseDataRequestInputBase, ProductionLineItemEditInput, ProductionLineItemImportInput>, IProductionLineItemAppService
public class ProductionLineItemAppService :
SfsBaseDataAppServiceBase<ProductionLineItem, ProductionLineItemDTO, SfsBaseDataRequestInputBase,
ProductionLineItemEditInput, ProductionLineItemImportInput>, IProductionLineItemAppService
{
private new readonly IProductionLineItemRepository _repository;
private readonly IProductionLineItemManager _manager;
private readonly IProductionLineAppService _productionLineAppService;
public ProductionLineItemAppService(
IProductionLineItemRepository repository
, IDistributedCache<ProductionLineItemDTO> cache
@ -30,27 +25,32 @@ public class ProductionLineItemAppService : SfsBaseDataAppServiceBase<Production
) : base(repository, cache)
{
_repository = repository;
_manager = manager;
_productionLineAppService = prodLineAppService;
base.CreatePolicyName = ProductionLineItemPermissions.Create;
base.UpdatePolicyName = ProductionLineItemPermissions.Update;
base.DeletePolicyName = ProductionLineItemPermissions.Delete;
}
[HttpPost("upsert")]
public virtual async Task UpsertAsync(ProductionLineItemEditInput input)
{
var entity = ObjectMapper.Map<ProductionLineItemEditInput, ProductionLineItem>(input);
await _repository.UpsertAsync(entity).ConfigureAwait(false);
}
protected override async Task ValidateImportModelAsync(ProductionLineItemImportInput importInput, List<ValidationResult> validationRresult)
protected override async Task ValidateImportModelAsync(ProductionLineItemImportInput importInput,
List<ValidationResult> validationRresult)
{
await base.ValidateImportModelAsync(importInput, validationRresult).ConfigureAwait(false);
await base.CheckItemBasicItemCodeAsync(importInput.ItemCode, validationRresult).ConfigureAwait(false);
await base.CheckProductionLineProdLineCodeAsync(importInput.ProdLineCode, validationRresult).ConfigureAwait(false);
await CheckItemBasicItemCodeAsync(importInput.ItemCode, validationRresult).ConfigureAwait(false);
await CheckProductionLineProdLineCodeAsync(importInput.ProdLineCode, validationRresult).ConfigureAwait(false);
}
[HttpPost("get-by-product")]
public virtual async Task<List<ProductionLineItemDTO>> GetByProductLineCodeAsync(string productLineCode)
{
var entityList = await _repository.GetListAsync(p => p.ProdLineCode == productLineCode).ConfigureAwait(false);
return ObjectMapper.Map<List<ProductionLineItem>, List<ProductionLineItemDTO>>(entityList);
}
}

20
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLines/ProductionLineAppService.cs

@ -1,9 +1,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Caching;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Domain;
@ -13,9 +11,9 @@ namespace Win_in.Sfs.Basedata.Application;
[Authorize]
[Route($"{BasedataConsts.RootPath}productionline")]
public class ProductionLineAppService
: SfsBaseDataWithCodeAppServiceBase<ProductionLine, ProductionLineDTO, SfsBaseDataRequestInputBase, ProductionLineEditInput, ProductionLineImportInput>
: SfsBaseDataWithCodeAppServiceBase<ProductionLine, ProductionLineDTO, SfsBaseDataRequestInputBase,
ProductionLineEditInput, ProductionLineImportInput>
, IProductionLineAppService
{
private new readonly IProductionLineRepository _repository;
@ -46,4 +44,16 @@ public class ProductionLineAppService
var entity = ObjectMapper.Map<ProductionLineEditInput, ProductionLine>(input);
await _repository.UpsertAsync(entity).ConfigureAwait(false);
}
[HttpPost("get-by-location")]
public virtual async Task<ProductionLineDTO> GetByLocationCodeAsync(string locationCode)
{
var entity = await _repository.FindAsync(p => p.LocationCode == locationCode).ConfigureAwait(false);
if (entity == null)
{
throw new UserFriendlyException($"【{locationCode}】库位不存在");
}
return ObjectMapper.Map<ProductionLine, ProductionLineDTO>(entity);
}
}

74
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ProductionLineItems/ProductionLineItem.cs

@ -14,6 +14,7 @@ public class ProductionLineItem : SfsBaseDataAggregateRootBase
/// <summary>
/// 生产线代码
/// </summary>
[Key]
[Display(Name = "生产线代码")]
[Required(ErrorMessage = "{0}是必填项")]
[IgnoreUpdate]
@ -27,52 +28,39 @@ public class ProductionLineItem : SfsBaseDataAggregateRootBase
[IgnoreUpdate]
public string ItemCode { get; set; }
///// <summary>
///// 生产线ID
///// </summary>
//[Display(Name = "生产线Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid ProdLineId { get; internal set; }
///// <summary>
///// 生产线 聚合根
///// </summary>
//public virtual ProductionLine ProdLineAggregateRoot { get; internal set; }
///// <summary>
///// 物品ID
///// </summary>
//[Display(Name = "物品Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid ItemId { get; internal set; }
///// <summary>
///// 物品 聚合根
///// </summary>
////public virtual Item ItemsAggregateRoot { get; internal set; }
/// <summary>
/// 物品名称
/// </summary>
[Display(Name = "物品名称")]
public string ItemName { get; set; }
///// <summary>
///// 产品结构ID
///// </summary>
//[Display(Name = "产品结构Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid BomId { get; internal set; }
/// <summary>
/// 物品描述1
/// </summary>
[Display(Name = "物品描述1")]
public string ItemDesc1 { get; set; }
///// <summary>
///// 产品结构 聚合根
///// </summary>
////public virtual Bom BomAggregateRoots { get; set; }
/// <summary>
/// 物品描述2
/// </summary>
[Display(Name = "物品描述2")]
public string ItemDesc2 { get; set; }
///// <summary>
///// 工艺路线ID
///// </summary>
//[Display(Name = "工艺路线Id")]
//[Required(ErrorMessage = "{0}是必填项")]
//public Guid RoutingId { get; internal set; }
/// <summary>
/// 原料库位
/// </summary>
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
///// <summary>
///// 工艺路线 聚合根
///// </summary>
////public virtual Route RouteAggregateRoot { get; set; }
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

34
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ProductionLines/ProductionLine.cs

@ -1,6 +1,4 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Entities;
@ -14,11 +12,18 @@ public class ProductionLine : SfsBaseDataAggregateRootBase, IHasCode, IHasName
/// <summary>
/// 代码
/// </summary>
[Display(Name = "代码")]
[Display(Name = "生产线代码")]
[Key]
[IgnoreUpdate]
public string Code { get; set; }
/// <summary>
/// 库位
/// </summary>
[Display(Name = "库位代码")]
[IgnoreUpdate]
public string LocationCode { get; set; }
/// <summary>
/// 名称
/// </summary>
@ -30,27 +35,4 @@ public class ProductionLine : SfsBaseDataAggregateRootBase, IHasCode, IHasName
/// </summary>
[Display(Name = "描述")]
public string Description { get; set; }
/// <summary>
/// 类型
/// </summary>
public EnumProductionLineType Type { get; set; }
/// <summary>
/// 原料库位
/// </summary>
[Display(Name = "原料库位Json集合")]
public string RawLocationCodeListJson { get; set; }
/// <summary>
/// 成品库位
/// </summary>
[Display(Name = "完工库位Json集合")]
public string ProductLocationCodeListJson { get; set; }
/// <summary>
/// 线边库位
/// </summary>
[Display(Name = "线边库位Json集合")]
public string WipLocationCodeListJson { get; set; }
}

4237
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/20240403083042_BaseData_ProductLine_BaseData_ProductLineItem.Designer.cs

File diff suppressed because it is too large

223
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/20240403083042_BaseData_ProductLine_BaseData_ProductLineItem.cs

@ -0,0 +1,223 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Win_in.Sfs.Basedata.Migrations
{
public partial class BaseData_ProductLine_BaseData_ProductLineItem : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_Basedata_ProductionLineItem",
table: "Basedata_ProductionLineItem");
migrationBuilder.DropColumn(
name: "ProductLocationCodeListJson",
table: "Basedata_ProductionLine");
migrationBuilder.DropColumn(
name: "RawLocationCodeListJson",
table: "Basedata_ProductionLine");
migrationBuilder.DropColumn(
name: "Type",
table: "Basedata_ProductionLine");
migrationBuilder.DropColumn(
name: "WipLocationCodeListJson",
table: "Basedata_ProductionLine");
migrationBuilder.AddColumn<string>(
name: "ItemDesc1",
table: "Basedata_ProductionLineItem",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ItemDesc2",
table: "Basedata_ProductionLineItem",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ItemName",
table: "Basedata_ProductionLineItem",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ProductLocationCodeListJson",
table: "Basedata_ProductionLineItem",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "RawLocationCodeListJson",
table: "Basedata_ProductionLineItem",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "WipLocationCodeListJson",
table: "Basedata_ProductionLineItem",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "LocationCode",
table: "Basedata_ProductionLine",
type: "nvarchar(max)",
nullable: false,
defaultValue: "");
migrationBuilder.AlterColumn<string>(
name: "Type",
table: "Basedata_Equipment",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(int),
oldType: "int",
oldMaxLength: 64);
migrationBuilder.AlterColumn<string>(
name: "Model",
table: "Basedata_Equipment",
type: "nvarchar(64)",
maxLength: 64,
nullable: true,
oldClrType: typeof(int),
oldType: "int",
oldMaxLength: 64);
migrationBuilder.AddPrimaryKey(
name: "PK_Basedata_ProductionLineItem",
table: "Basedata_ProductionLineItem",
column: "ProdLineCode");
migrationBuilder.CreateTable(
name: "Basedata_ItemContainer",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ContainerName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ContainerType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
BasicUom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Qty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Basedata_ItemContainer", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_Basedata_ItemContainer_ItemCode_ContainerCode",
table: "Basedata_ItemContainer",
columns: new[] { "ItemCode", "ContainerCode" },
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Basedata_ItemContainer");
migrationBuilder.DropPrimaryKey(
name: "PK_Basedata_ProductionLineItem",
table: "Basedata_ProductionLineItem");
migrationBuilder.DropColumn(
name: "ItemDesc1",
table: "Basedata_ProductionLineItem");
migrationBuilder.DropColumn(
name: "ItemDesc2",
table: "Basedata_ProductionLineItem");
migrationBuilder.DropColumn(
name: "ItemName",
table: "Basedata_ProductionLineItem");
migrationBuilder.DropColumn(
name: "ProductLocationCodeListJson",
table: "Basedata_ProductionLineItem");
migrationBuilder.DropColumn(
name: "RawLocationCodeListJson",
table: "Basedata_ProductionLineItem");
migrationBuilder.DropColumn(
name: "WipLocationCodeListJson",
table: "Basedata_ProductionLineItem");
migrationBuilder.DropColumn(
name: "LocationCode",
table: "Basedata_ProductionLine");
migrationBuilder.AddColumn<string>(
name: "ProductLocationCodeListJson",
table: "Basedata_ProductionLine",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "RawLocationCodeListJson",
table: "Basedata_ProductionLine",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Type",
table: "Basedata_ProductionLine",
type: "nvarchar(64)",
maxLength: 64,
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "WipLocationCodeListJson",
table: "Basedata_ProductionLine",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AlterColumn<int>(
name: "Type",
table: "Basedata_Equipment",
type: "int",
maxLength: 64,
nullable: false,
defaultValue: 0,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<int>(
name: "Model",
table: "Basedata_Equipment",
type: "int",
maxLength: 64,
nullable: false,
defaultValue: 0,
oldClrType: typeof(string),
oldType: "nvarchar(64)",
oldMaxLength: 64,
oldNullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_Basedata_ProductionLineItem",
table: "Basedata_ProductionLineItem",
column: "Id");
}
}
}

129
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Migrations/BasedataDbContextModelSnapshot.cs

@ -1112,9 +1112,9 @@ namespace Win_in.Sfs.Basedata.Migrations
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<int>("Model")
b.Property<string>("Model")
.HasMaxLength(64)
.HasColumnType("int");
.HasColumnType("nvarchar(64)");
b.Property<string>("Remark")
.HasMaxLength(3072)
@ -1131,9 +1131,8 @@ namespace Win_in.Sfs.Basedata.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<int>("Type")
.HasMaxLength(64)
.HasColumnType("int");
b.Property<string>("Type")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
@ -1696,6 +1695,79 @@ namespace Win_in.Sfs.Basedata.Migrations
b.ToTable("Basedata_ItemCategory", (string)null);
});
modelBuilder.Entity("Win_in.Sfs.Basedata.Domain.ItemContainer", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("BasicUom")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("ContainerCode")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ContainerName")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ContainerType")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("ItemCode")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<decimal>("Qty")
.HasColumnType("decimal(18,6)");
b.Property<string>("Remark")
.HasMaxLength(3072)
.HasColumnType("nvarchar(3072)")
.HasColumnName("Remark");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("ItemCode", "ContainerCode")
.IsUnique();
b.ToTable("Basedata_ItemContainer", (string)null);
});
modelBuilder.Entity("Win_in.Sfs.Basedata.Domain.ItemGuideBook", b =>
{
b.Property<Guid>("Id")
@ -2782,16 +2854,14 @@ namespace Win_in.Sfs.Basedata.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("LocationCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ProductLocationCodeListJson")
.HasColumnType("nvarchar(max)");
b.Property<string>("RawLocationCodeListJson")
.HasColumnType("nvarchar(max)");
b.Property<string>("Remark")
.HasMaxLength(3072)
.HasColumnType("nvarchar(3072)")
@ -2801,14 +2871,6 @@ namespace Win_in.Sfs.Basedata.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("WipLocationCodeListJson")
.HasColumnType("nvarchar(max)");
b.HasKey("Code");
b.HasIndex("Code")
@ -2819,8 +2881,8 @@ namespace Win_in.Sfs.Basedata.Migrations
modelBuilder.Entity("Win_in.Sfs.Basedata.Domain.ProductionLineItem", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("ProdLineCode")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
@ -2840,10 +2902,22 @@ namespace Win_in.Sfs.Basedata.Migrations
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("ItemCode")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<string>("ItemDesc1")
.HasColumnType("nvarchar(max)");
b.Property<string>("ItemDesc2")
.HasColumnType("nvarchar(max)");
b.Property<string>("ItemName")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
@ -2852,9 +2926,11 @@ namespace Win_in.Sfs.Basedata.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("ProdLineCode")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<string>("ProductLocationCodeListJson")
.HasColumnType("nvarchar(max)");
b.Property<string>("RawLocationCodeListJson")
.HasColumnType("nvarchar(max)");
b.Property<string>("Remark")
.HasMaxLength(3072)
@ -2865,7 +2941,10 @@ namespace Win_in.Sfs.Basedata.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.Property<string>("WipLocationCodeListJson")
.HasColumnType("nvarchar(max)");
b.HasKey("ProdLineCode");
b.HasIndex("ProdLineCode", "ItemCode")
.IsUnique();

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/ProductionLines/ProductionLineDbContextModelCreatingExtensions.cs

@ -19,8 +19,8 @@ public static class ProductionLineDbContextModelCreatingExtensions
b.Property(x => x.Code).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(x => x.Name).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(x => x.Description).HasMaxLength(SfsPropertyConst.DescLength);
b.Property(x => x.Type).IsRequired().HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
b.Property(q => q.Remark).HasMaxLength(SfsPropertyConst.RemarkLength);
b.Property(x => x.LocationCode).IsRequired();
b.HasKey(q => q.Code);
b.HasIndex(x => new { x.Code }).IsUnique();

1
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/ProductionLines/ProductionLineEfCoreRepository.cs

@ -28,7 +28,6 @@ public class ProductionLineEfCoreRepository : SfsBaseDataEfCoreRepositoryBase<Ba
// exist.TenantId = entity.TenantId;
exist.Remark = entity.Remark;
exist.Type = entity.Type;
// exist.RawLocation = entity.RawLocation;
// exist.ProductLocation = entity.ProductLocation;
// exist.RawLocationGroupCode = entity.RawLocationGroupCode;

14
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/Inputs/RecommendBalanceRequestInput.cs

@ -44,12 +44,12 @@ public class RecommendBalanceRequestInput
[Display(Name = "是否必须有箱码")]
public bool IsPackingCode { get; set; } = false;
public override string ToString()
{
var locationTypes = LocationTypes.Aggregate("", (current, locationType) => current + (locationType.GetDisplayName() + ","));
var locationAreas = LocationAreas.JoinAsString(",");
var statuses = Statuses.Aggregate("", (current, status) => current + (status.GetDisplayName() + ","));
//public override string ToString()
//{
// var locationTypes = LocationTypes.Aggregate("", (current, locationType) => current + (locationType.GetDisplayName() + ","));
// var locationAreas = LocationAreas.JoinAsString(",");
// var statuses = Statuses.Aggregate("", (current, status) => current + (status.GetDisplayName() + ","));
return $"物料号:{ItemCode}, 数量:{Qty}, 库位类型:{locationTypes}, 库区:{locationAreas}, 库存状态:{statuses}.";
}
// return $"物料号:{ItemCode}, 数量:{Qty}, 库位类型:{locationTypes}, 库区:{locationAreas}, 库存状态:{statuses}.";
//}
}

21
be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumIssueType.cs

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Win_in.Sfs.Shared.Domain.Shared.Enums.Store;
public enum EnumIssueType
{
None=0,
/// <summary>
/// 按箱 叫料
/// </summary>
Box=1,
/// <summary>
/// 按数量 叫料
/// </summary>
Num=2,
}

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CustomerProductionReturnNotes/Inputs/CustomerProductionReturnNoteEditInput.cs

@ -35,7 +35,7 @@ public class CustomerProductionReturnNoteEditInput : SfsStoreCreateOrUpdateInput
/// 退库记录单号
/// </summary>
[Display(Name = "退库记录单号")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Number { get; set; }
/// <summary>

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/IProductReceiptNoteAppService.cs

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
@ -14,4 +15,5 @@ public interface IProductReceiptNoteAppService : ISfsStoreMasterReadOnlyAppServi
bool includeDetails = false,
CancellationToken cancellationToken = default);
Task<List<ProductReceiptNoteDTO>> CreateManyAsync(List<ProductReceiptNoteEditInput> input);
}

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/InjectionRequests/DTOs/InjectionRequestDetailDTO.cs

@ -47,4 +47,9 @@ public class InjectionRequestDetailDTO : SfsStoreDetailWithQtyDTOBase
[NotMapped]
public decimal NotFinishQty => Qty - ReceivedQty;
/// <summary>
/// 需求箱数量
/// </summary>
[Display(Name = "需求箱数量")]
public decimal BoxQty { get; set; }
}

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/InjectionRequests/IInjectionRequestAppService.cs

@ -9,5 +9,5 @@ public interface IInjectionRequestAppService
: ISfsStoreRequestMasterAppServiceBase<InjectionRequestDTO, SfsStoreRequestInputBase, InjectionRequestEditInput, InjectionRequestDetailDTO, SfsStoreRequestInputBase>
{
Task<InjectionRequestDTO> CreateAndHandleAsync(InjectionRequestEditInput input);
}

41
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/InjectionRequests/Inputs/InjectionRequestDetailInput.cs

@ -7,6 +7,8 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class InjectionRequestDetailInput : SfsStoreDetailWithQtyInputBase
{
#region 目标库位信息
/// <summary>
/// 目标库位
/// </summary>
@ -15,11 +17,30 @@ public class InjectionRequestDetailInput : SfsStoreDetailWithQtyInputBase
public string ToLocationCode { get; set; }
/// <summary>
/// 来源库区
/// 目标库区
/// </summary>
[Display(Name = "来源库区")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string FromLocationArea { get; set; }
[Display(Name = "目标库区")]
public string ToLocationArea { get; set; }
/// <summary>
/// 目标库位组
/// </summary>
[Display(Name = "目标库位组")]
public string ToLocationGroup { get; set; }
/// <summary>
/// 目标ERP储位
/// </summary>
[Display(Name = "目标ERP储位")]
public string ToLocationErpCode { get; set; }
/// <summary>
/// 目标仓库
/// </summary>
[Display(Name = "目标仓库")]
public string ToWarehouseCode { get; set; }
#endregion
/// <summary>
/// 生产线
@ -47,12 +68,6 @@ public class InjectionRequestDetailInput : SfsStoreDetailWithQtyInputBase
[Display(Name = "状态")]
public EnumRequestStatus RequestStatus { get; set; } = EnumRequestStatus.New;
/// <summary>
/// ERP储位
/// </summary>
[Display(Name = "ERP储位")]
public string ToLocationErpCode { get; set; }
/// <summary>
/// 已发数量
/// </summary>
@ -81,5 +96,9 @@ public class InjectionRequestDetailInput : SfsStoreDetailWithQtyInputBase
/// </summary>
public EnumRecommendType RecommendType { get; set; }
/// <summary>
/// 需求箱数量
/// </summary>
[Display(Name = "需求箱数量")]
public decimal BoxQty { get; set; }
}

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs

@ -43,8 +43,6 @@ public class CustomerProductionReturnNoteAppService :
itm.FromLocationCode = "HOLD";
itm.FromStatus = EnumInventoryStatus.OK;
itm.ToStatus=EnumInventoryStatus.OK;
}

20
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductReceiptNotes/ProductReceiptNoteAppService.cs

@ -8,6 +8,7 @@ using Win_in.Sfs.Wms.Store.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
@ -52,6 +53,25 @@ public class ProductReceiptNoteAppService :
return dto;
}
/// <summary>
/// 批量新增接口
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("create-many")]
//[Authorize(ProductReceiptNotePermissions.Create)]
public async Task<List<ProductReceiptNoteDTO>> CreateManyAsync(List<ProductReceiptNoteEditInput> input)
{
var entityList = ObjectMapper.Map<List<ProductReceiptNoteEditInput>, List<ProductReceiptNote>>(input);
//转到实现,保存【完工收货记录】
await _productReceiptNoteManager.CreateManyAsync(entityList).ConfigureAwait(false);
var dtoList = ObjectMapper.Map<List<ProductReceiptNote>, List<ProductReceiptNoteDTO>>(entityList);
//返回创建的记录
return dtoList;
}
[HttpPost("by-type/{type}")]
public virtual async Task<PagedResultDto<ProductReceiptNoteDTO>> GetListByTypeAsync(
SfsStoreRequestInputBase requestInput,

113
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs

@ -40,6 +40,7 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
private readonly IItemBasicAppService _itemBasicAppService;
private readonly IProductionLineAppService _productionLineAppService;
private readonly IInjectionJobAppService _issueJobAppService;
public InjectionRequestAppService(
IInjectionRequestRepository repository,
IInjectionRequestManager injectionRequestManager,
@ -66,13 +67,11 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
public override async Task<InjectionRequestDTO> HandleAsync(Guid id)
{
var entity = await _repository.GetAsync(id).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<InjectionRequest>(entity), false).ConfigureAwait(false);
return ObjectMapper.Map<InjectionRequest, InjectionRequestDTO>(entity);
await Task.CompletedTask.ConfigureAwait(false);
return null;
}
[HttpPost("")]
//[Authorize(InjectionRequestPermissions.Create)]
public override async Task<InjectionRequestDTO> CreateAsync(InjectionRequestEditInput input)
{
foreach (var item in input.Details)
@ -85,13 +84,20 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
foreach (var detailInput in input.Details) //赋值生产线
{
var toLocationDto = await _locationAppService.GetByCodeAsync(detailInput.ToLocationCode).ConfigureAwait(false);
var toLocationDto =
await _locationAppService.GetByCodeAsync(detailInput.ToLocationCode).ConfigureAwait(false);
CheckLocation(toLocationDto, detailInput.ToLocationCode);
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detailInput.ItemCode).ConfigureAwait(false);
CheckItemBasic(itemBasicDto, detailInput.ItemCode);
detailInput.ToLocationArea = toLocationDto.AreaCode;
detailInput.ToLocationGroup = toLocationDto.LocationGroupCode;
detailInput.ToWarehouseCode= toLocationDto.WarehouseCode;
detailInput.ProdLine = detailInput.ToLocationCode;
detailInput.ToLocationErpCode = toLocationDto.ErpLocationCode;
//因为是刚创建的 所以发料数一定是0
detailInput.IssuedQty = 0;
}
input.AutoSubmit = true;
@ -102,14 +108,13 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
var entity = ObjectMapper.Map<InjectionRequestEditInput, InjectionRequest>(input);
var result = await _injectionRequestManager.CreateAsync(entity).ConfigureAwait(false);
var result = await _injectionRequestManager.CreateByNumberAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<InjectionRequest, InjectionRequestDTO>(result);
return dto;
}
//[Authorize(InjectionRequestPermissions.Create)]
[HttpPost("create-and-handle")]
public async Task<InjectionRequestDTO> CreateAndHandleAsync(InjectionRequestEditInput input)
{
@ -122,21 +127,6 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
#endregion
/// <summary>
/// 根据类型 获取叫料申请
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
[HttpGet("list/by-type/{type}")]
public virtual async Task<List<InjectionRequestDTO>> GetListByTypeAsync(string type)
{
var entities = await _repository.GetListAsync(c => c.Type == type).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<InjectionRequest>, List<InjectionRequestDTO>>(entities);
return dtos;
}
#region 导入
/// <summary>
@ -196,6 +186,8 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
await CheckStoreRelationAsync(model, validationRresult).ConfigureAwait(false);
}
#endregion
#region 校验
protected override async Task<bool> ValidateImportEntities(Dictionary<InjectionRequest, EntityState> dict)
@ -217,35 +209,6 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
return await base.ValidateImportEntities(dict).ConfigureAwait(false);
}
protected async Task<ItemBasicDTO> CheckItemBasicAsync(InjectionRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
var item = await _itemBasicAppService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false);
if (item == null)
{
validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}不存在", new[] { "物品代码" }));
}
else if (item.StdPackQty == 0)
{
validationRresult.Add(
new ValidationResult($"物品代码{importInput.ItemCode}的物品信息中标准包装等于0或不存在", new[] { "标准包装" }));
}
return item;
}
protected async Task<LocationDTO> CheckLocationAsync(InjectionRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
var location = await _locationAppService.GetByCodeAsync(importInput.ToLocationCode).ConfigureAwait(false);
if (location == null)
{
validationRresult.Add(new ValidationResult($"目标库位{importInput.ToLocationCode}不存在", new[] { "目标库位" }));
}
return location;
}
protected async Task CheckAreaAsync(InjectionRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
@ -268,33 +231,55 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
}
}
#endregion
#endregion
#region 校验
private void CheckItemBasic(ItemBasicDTO ItemBasicDto, string itemCode)
private void CheckItemBasic(ItemBasicDTO itemBasicDto, string itemCode)
{
if (ItemBasicDto == null)
if (itemBasicDto == null)
{
throw new UserFriendlyException($"物品代码为【{itemCode}】不存在");
}
}
private void CheckLocation(LocationDTO LocationDto, string LocationCode)
private void CheckLocation(LocationDTO locationDto, string locationCode)
{
if (LocationDto == null)
if (locationDto == null)
{
throw new UserFriendlyException($"库位代码为【{LocationCode}】不存在");
throw new UserFriendlyException($"库位代码为【{locationCode}】不存在");
}
if (LocationDto.Type != EnumLocationType.WIP)
if (locationDto.Type != EnumLocationType.WIP)
{
throw new UserFriendlyException($"库位代码【{LocationCode}】不是【{EnumLocationType.WIP.GetDisplayName()}】类型");
throw new UserFriendlyException($"库位代码【{locationCode}】不是【{EnumLocationType.WIP.GetDisplayName()}】类型");
}
}
protected async Task<ItemBasicDTO> CheckItemBasicAsync(InjectionRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
var item = await _itemBasicAppService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false);
if (item == null)
{
validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}不存在", new[] { "物品代码" }));
}
else if (item.StdPackQty == 0)
{
validationRresult.Add(
new ValidationResult($"物品代码{importInput.ItemCode}的物品信息中标准包装等于0或不存在", new[] { "标准包装" }));
}
return item;
}
protected async Task<LocationDTO> CheckLocationAsync(InjectionRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
var location = await _locationAppService.GetByCodeAsync(importInput.ToLocationCode).ConfigureAwait(false);
if (location == null)
{
validationRresult.Add(new ValidationResult($"目标库位{importInput.ToLocationCode}不存在", new[] { "目标库位" }));
}
return location;
}
#endregion
}

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAutoMapperProfile.cs

@ -18,9 +18,6 @@ public partial class StoreApplicationAutoMapperProfile : Profile
CreateMap<InjectionRequestDetailInput, InjectionRequestDetail>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.ToLocationArea)
.Ignore(x => x.ToLocationGroup)
.Ignore(x => x.ToWarehouseCode)
.Ignore(x => x.MasterID)
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/IInjectionRequestManager.cs

@ -1,16 +1,14 @@
using System.Threading.Tasks;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Shared.Domain;
public interface IInjectionRequestManager : ISfsStoreRequestManager<InjectionRequest, InjectionRequestDetail>,
IBulkImportService<InjectionRequest>
{
Task UpdateDetailsAsync(InjectionRequest entity);
Task CompleteAsync(string number);
Task<InjectionRequest> CreateBynNumberAsync(InjectionRequest entity);
Task<InjectionRequest> CreateByNumberAsync(InjectionRequest entity);
}

30
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestDetail.cs

@ -1,4 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
@ -10,35 +11,40 @@ namespace Win_in.Sfs.Wms.Store.Domain;
/// </summary>
public class InjectionRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLocation
{
#region 目标库位信息
/// <summary>
/// 到库位
/// 目标库位
/// </summary>
[Display(Name = "目标库位")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ToLocationCode { get; set; }
/// <summary>
/// 库区
/// 目标库区
/// </summary>
[Display(Name = "目标库区")]
public string ToLocationArea { get; set; }
/// <summary>
/// 库位组
/// 目标库位组
/// </summary>
[Display(Name = "目标库位组")]
public string ToLocationGroup { get; set; }
/// <summary>
/// 到ERP库
/// 目标ERP储
/// </summary>
[Display(Name = "目标ERP储位")]
public string ToLocationErpCode { get; set; }
/// <summary>
/// 仓库
/// 目标仓库
/// </summary>
[Display(Name = "目标仓库")]
public string ToWarehouseCode { get; set; }
/// <summary>
/// 来源库区
/// </summary>
public string FromLocationArea { get; set; }
#endregion
// /// <summary>
// /// 在途库库位
@ -102,4 +108,10 @@ public class InjectionRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLoc
/// 推荐类型
/// </summary>
public EnumRecommendType RecommendType { get; set; }
/// <summary>
/// 需求箱数量
/// </summary>
[Display(Name = "需求箱数量")]
public decimal BoxQty { get; set; }
}

28
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestManager.cs

@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Math;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using static Win_in.Sfs.Wms.Store.Domain.Shared.StoreSettings;
namespace Win_in.Sfs.Wms.Store.Domain;
@ -32,13 +29,15 @@ public class InjectionRequestManager
/// <summary>
/// 创建
/// 创建 同时 直接赋值Number 为了返回Number
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public virtual async Task<InjectionRequest> CreateBynNumberAsync(InjectionRequest entity)
public virtual async Task<InjectionRequest> CreateByNumberAsync(InjectionRequest entity)
{
var number = string.IsNullOrEmpty(entity.Number) ? await GenerateNumberAsync(nameof(InjectionRequest), entity.ActiveDate).ConfigureAwait(false) : entity.Number;
var number = string.IsNullOrEmpty(entity.Number)
? await GenerateNumberAsync(nameof(InjectionRequest), entity.ActiveDate).ConfigureAwait(false)
: entity.Number;
entity.SetIdAndNumberWithDetails(GuidGenerator, number);
entity.Submit();
entity.Agree();
@ -51,8 +50,8 @@ public class InjectionRequestManager
public virtual async Task UpdateDetailsAsync(InjectionRequest newEntity)
{
var oldEntity = await Repository.FindAsync(newEntity.Id, true).ConfigureAwait(false);
if(oldEntity!=null)
var oldEntity = await Repository.FindAsync(newEntity.Id).ConfigureAwait(false);
if (oldEntity != null)
{
foreach (var newDetail in newEntity.Details)
{
@ -68,12 +67,11 @@ public class InjectionRequestManager
await Repository.UpdateAsync(oldEntity).ConfigureAwait(false);
}
}
private void SetMaterialRequestDetailStatus(InjectionRequestDetail detail)
{
if (detail.ReceivedQty >= detail.Qty)//执行的时候 实际收料 多余 要料数
if (detail.ReceivedQty >= detail.Qty) //执行的时候 实际收料 多余 要料数
{
detail.Status = EnumStatus.Close;
}
@ -91,10 +89,12 @@ public class InjectionRequestManager
}
else
{
var issueJobs = await _issueJobRepository.GetListAsync(t => t.MaterialRequestNumber == materialRequest.Number).ConfigureAwait(false);
var issueJobs = await _issueJobRepository
.GetListAsync(t => t.MaterialRequestNumber == materialRequest.Number).ConfigureAwait(false);
if (issueJobs.Count > 0)
{
if (issueJobs.All(t => t.JobStatus is EnumJobStatus.Done or EnumJobStatus.Closed or EnumJobStatus.Cancelled))
if (issueJobs.All(t =>
t.JobStatus is EnumJobStatus.Done or EnumJobStatus.Closed or EnumJobStatus.Cancelled))
{
if (materialRequest.Details.All(p => p.ReceivedQty >= p.Qty))
{
@ -132,7 +132,8 @@ public class InjectionRequestManager
/// <summary>
/// 执行导入
/// </summary>
public virtual async Task ImportDataAsync(List<InjectionRequest> mergeEntities, List<InjectionRequest> deleteEntities = null)
public virtual async Task ImportDataAsync(List<InjectionRequest> mergeEntities,
List<InjectionRequest> deleteEntities = null)
{
if (deleteEntities != null && deleteEntities.Count > 0)
{
@ -143,5 +144,4 @@ public class InjectionRequestManager
}
#endregion
}

27637
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240403054940_Update_InjectionRequest.Designer.cs

File diff suppressed because it is too large

568
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240403054940_Update_InjectionRequest.cs

@ -0,0 +1,568 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Win_in.Sfs.Wms.Store.Migrations
{
public partial class Update_InjectionRequest : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "FromLocationArea",
table: "Store_InjectionRequestDetail");
migrationBuilder.DropColumn(
name: "PreparationPlanNumber",
table: "Store_InjectionRequest");
migrationBuilder.DropColumn(
name: "Workshop",
table: "Store_InjectionRequest");
migrationBuilder.AddColumn<string>(
name: "JobNumber",
table: "Store_ProductRecycleNote",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "ExecutedQty",
table: "Job_ProductRecycleJobDetail",
type: "decimal(18,6)",
nullable: false,
defaultValue: 0m);
migrationBuilder.AddColumn<string>(
name: "RequestNumber",
table: "Job_ProductRecycleJob",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.CreateTable(
name: "Job_AssembleJob",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RequestType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
AssembleRequestNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Workshop = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
UseOnTheWayLocation = table.Column<bool>(type: "bit", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
Worker = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
UpStreamJobNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
JobDescription = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true),
JobType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
JobStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Priority = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
PriorityIncrement = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
WorkGroupCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
IsAutoComplete = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
AcceptUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
AcceptUserName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
AcceptTime = table.Column<DateTime>(type: "datetime2", nullable: true),
CompleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CompleteUserName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
CompleteTime = table.Column<DateTime>(type: "datetime2", nullable: true),
WarehouseCode = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Job_AssembleJob", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Store_AssembleNote",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
JobNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Workshop = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RequestNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RequestType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
UseOnTheWayLocation = table.Column<bool>(type: "bit", nullable: false),
ConfirmTime = table.Column<DateTime>(type: "datetime2", nullable: true),
Confirmed = table.Column<bool>(type: "bit", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
Worker = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ActiveDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_AssembleNote", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Store_AssembleRequest",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Type = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
UseOnTheWayLocation = table.Column<bool>(type: "bit", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
Worker = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ActiveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
AutoSubmit = table.Column<bool>(type: "bit", nullable: false),
AutoAgree = table.Column<bool>(type: "bit", nullable: false),
AutoHandle = table.Column<bool>(type: "bit", nullable: false),
AutoCompleteJob = table.Column<bool>(type: "bit", nullable: false),
DirectCreateNote = table.Column<bool>(type: "bit", nullable: false),
RequestStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_AssembleRequest", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Store_MesNote",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
JobNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
MesRequestNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Type = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
Worker = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ActiveDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_MesNote", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Job_AssembleJobDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RequestLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
OnTheWayLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
WorkStation = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ExpiredTime = table.Column<DateTime>(type: "datetime2", nullable: false),
Operation = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
DistributionType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
TruncType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
RoundedQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
PlannedSplitRule = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
PlanBeginTime = table.Column<DateTime>(type: "datetime2", nullable: false),
DeliveryQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
PositionCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MasterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
ItemName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc1 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
StdPackQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
Status = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
RecommendContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Uom = table.Column<string>(type: "nvarchar(max)", nullable: true),
RecommendQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
HandledContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Job_AssembleJobDetail", x => x.Id);
table.ForeignKey(
name: "FK_Job_AssembleJobDetail_Job_AssembleJob_MasterID",
column: x => x.MasterID,
principalTable: "Job_AssembleJob",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Store_AssembleNoteDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
IssueTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ExpiredTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
WorkStation = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
OnTheWayLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
PositionCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MasterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
ItemName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc1 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Uom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Qty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
StdPackQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
FromPackingCode = table.Column<string>(type: "nvarchar(450)", nullable: true),
ToPackingCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
FromContainerCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
ToContainerCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
FromLot = table.Column<string>(type: "nvarchar(max)", nullable: true),
ToLot = table.Column<string>(type: "nvarchar(max)", nullable: true),
SupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
FromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
FromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
FromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
RecommendContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
HandledContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_AssembleNoteDetail", x => x.Id);
table.ForeignKey(
name: "FK_Store_AssembleNoteDetail_Store_AssembleNote_MasterID",
column: x => x.MasterID,
principalTable: "Store_AssembleNote",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Store_AssembleRequestDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromLocationArea = table.Column<string>(type: "nvarchar(max)", nullable: true),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
WorkStation = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ExpiredTime = table.Column<DateTime>(type: "datetime2", nullable: false),
IssuedQty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
ReceivedQty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
Status = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
PositionCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MasterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
ItemName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc1 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Uom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Qty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
StdPackQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_AssembleRequestDetail", x => x.Id);
table.ForeignKey(
name: "FK_Store_AssembleRequestDetail_Store_AssembleRequest_MasterID",
column: x => x.MasterID,
principalTable: "Store_AssembleRequest",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Store_MesNoteDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ReasonCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MasterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
ItemName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc1 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Uom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Qty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
StdPackQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
FromPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToPackingCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
FromContainerCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
ToContainerCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
FromLot = table.Column<string>(type: "nvarchar(450)", nullable: true),
ToLot = table.Column<string>(type: "nvarchar(max)", nullable: true),
SupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
FromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
FromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
FromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_MesNoteDetail", x => x.Id);
table.ForeignKey(
name: "FK_Store_MesNoteDetail_Store_MesNote_MasterID",
column: x => x.MasterID,
principalTable: "Store_MesNote",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Job_AssembleJob_Number",
table: "Job_AssembleJob",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Job_AssembleJobDetail_MasterID",
table: "Job_AssembleJobDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_AssembleNote_Number",
table: "Store_AssembleNote",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_AssembleNoteDetail_FromPackingCode",
table: "Store_AssembleNoteDetail",
column: "FromPackingCode");
migrationBuilder.CreateIndex(
name: "IX_Store_AssembleNoteDetail_MasterID",
table: "Store_AssembleNoteDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_AssembleNoteDetail_Number_FromPackingCode_FromLocationCode_ToLocationCode",
table: "Store_AssembleNoteDetail",
columns: new[] { "Number", "FromPackingCode", "FromLocationCode", "ToLocationCode" },
unique: true,
filter: "[FromPackingCode] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_Store_AssembleRequest_Number",
table: "Store_AssembleRequest",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_AssembleRequestDetail_ItemCode",
table: "Store_AssembleRequestDetail",
column: "ItemCode");
migrationBuilder.CreateIndex(
name: "IX_Store_AssembleRequestDetail_MasterID",
table: "Store_AssembleRequestDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_AssembleRequestDetail_Number_ItemCode_ToLocationCode",
table: "Store_AssembleRequestDetail",
columns: new[] { "Number", "ItemCode", "ToLocationCode" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_MesNote_Number",
table: "Store_MesNote",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_MesNoteDetail_MasterID",
table: "Store_MesNoteDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_MesNoteDetail_Number_ItemCode_FromPackingCode_FromLocationCode_ToLocationCode_FromLot_FromStatus",
table: "Store_MesNoteDetail",
columns: new[] { "Number", "ItemCode", "FromPackingCode", "FromLocationCode", "ToLocationCode", "FromLot", "FromStatus" },
unique: true,
filter: "[FromPackingCode] IS NOT NULL AND [FromLot] IS NOT NULL");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Job_AssembleJobDetail");
migrationBuilder.DropTable(
name: "Store_AssembleNoteDetail");
migrationBuilder.DropTable(
name: "Store_AssembleRequestDetail");
migrationBuilder.DropTable(
name: "Store_MesNoteDetail");
migrationBuilder.DropTable(
name: "Job_AssembleJob");
migrationBuilder.DropTable(
name: "Store_AssembleNote");
migrationBuilder.DropTable(
name: "Store_AssembleRequest");
migrationBuilder.DropTable(
name: "Store_MesNote");
migrationBuilder.DropColumn(
name: "JobNumber",
table: "Store_ProductRecycleNote");
migrationBuilder.DropColumn(
name: "ExecutedQty",
table: "Job_ProductRecycleJobDetail");
migrationBuilder.DropColumn(
name: "RequestNumber",
table: "Job_ProductRecycleJob");
migrationBuilder.AddColumn<string>(
name: "FromLocationArea",
table: "Store_InjectionRequestDetail",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "PreparationPlanNumber",
table: "Store_InjectionRequest",
type: "nvarchar(64)",
maxLength: 64,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Workshop",
table: "Store_InjectionRequest",
type: "nvarchar(64)",
maxLength: 64,
nullable: true);
}
}
}

29578
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240409090529_Update_InjectionRequest_2024_04_09.Designer.cs

File diff suppressed because it is too large

730
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240409090529_Update_InjectionRequest_2024_04_09.cs

@ -0,0 +1,730 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Win_in.Sfs.Wms.Store.Migrations
{
public partial class Update_InjectionRequest_2024_04_09 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<decimal>(
name: "BoxQty",
table: "Store_InjectionRequestDetail",
type: "decimal(18,6)",
nullable: false,
defaultValue: 0m);
migrationBuilder.CreateTable(
name: "Job_ThirdLocationJob",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RequestType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RequestNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Workshop = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
UseOnTheWayLocation = table.Column<bool>(type: "bit", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
Worker = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
UpStreamJobNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
JobDescription = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true),
JobType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
JobStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Priority = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
PriorityIncrement = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
WorkGroupCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
IsAutoComplete = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
AcceptUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
AcceptUserName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
AcceptTime = table.Column<DateTime>(type: "datetime2", nullable: true),
CompleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CompleteUserName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
CompleteTime = table.Column<DateTime>(type: "datetime2", nullable: true),
WarehouseCode = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Job_ThirdLocationJob", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Store_CustomerProductionReturnNote",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
JobNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ProductionReturnRequestNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ReturnTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
Worker = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ActiveDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_CustomerProductionReturnNote", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Store_InjectioModelPlan",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PlanDate = table.Column<DateTime>(type: "datetime2", nullable: false),
PlanTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
Worker = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ActiveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
AutoSubmit = table.Column<bool>(type: "bit", nullable: false),
AutoAgree = table.Column<bool>(type: "bit", nullable: false),
AutoHandle = table.Column<bool>(type: "bit", nullable: false),
AutoCompleteJob = table.Column<bool>(type: "bit", nullable: false),
DirectCreateNote = table.Column<bool>(type: "bit", nullable: false),
RequestStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_InjectioModelPlan", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Store_MesRecord",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
JobNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
MesRequestNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Type = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
State = table.Column<int>(type: "int", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
Worker = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ActiveDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_MesRecord", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Store_ThirdLocationNote",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
JobNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Workshop = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RequestNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RequestType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
UseOnTheWayLocation = table.Column<bool>(type: "bit", nullable: false),
ConfirmTime = table.Column<DateTime>(type: "datetime2", nullable: true),
Confirmed = table.Column<bool>(type: "bit", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
Worker = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ActiveDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_ThirdLocationNote", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Store_ThirdLocationRequest",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Type = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
UseOnTheWayLocation = table.Column<bool>(type: "bit", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
Worker = table.Column<string>(type: "nvarchar(max)", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ActiveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
AutoSubmit = table.Column<bool>(type: "bit", nullable: false),
AutoAgree = table.Column<bool>(type: "bit", nullable: false),
AutoHandle = table.Column<bool>(type: "bit", nullable: false),
AutoCompleteJob = table.Column<bool>(type: "bit", nullable: false),
DirectCreateNote = table.Column<bool>(type: "bit", nullable: false),
RequestStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_ThirdLocationRequest", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Job_ThirdLocationJobDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RequestLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
OnTheWayLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
WorkStation = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ExpiredTime = table.Column<DateTime>(type: "datetime2", nullable: false),
Operation = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
DistributionType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
TruncType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
RoundedQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
PlannedSplitRule = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
PlanBeginTime = table.Column<DateTime>(type: "datetime2", nullable: false),
DeliveryQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
PositionCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MasterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
ItemName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc1 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
StdPackQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
Status = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
RecommendContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Uom = table.Column<string>(type: "nvarchar(max)", nullable: true),
RecommendQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
HandledContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Job_ThirdLocationJobDetail", x => x.Id);
table.ForeignKey(
name: "FK_Job_ThirdLocationJobDetail_Job_ThirdLocationJob_MasterID",
column: x => x.MasterID,
principalTable: "Job_ThirdLocationJob",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Store_CustomerProductionReturnNoteDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MasterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
ItemName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc1 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Uom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Qty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
StdPackQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
FromPackingCode = table.Column<string>(type: "nvarchar(450)", nullable: true),
ToPackingCode = table.Column<string>(type: "nvarchar(450)", nullable: true),
FromContainerCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
ToContainerCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
FromLot = table.Column<string>(type: "nvarchar(max)", nullable: true),
ToLot = table.Column<string>(type: "nvarchar(max)", nullable: true),
SupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
FromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
FromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
FromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
RecommendContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
HandledContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_CustomerProductionReturnNoteDetail", x => x.Id);
table.ForeignKey(
name: "FK_Store_CustomerProductionReturnNoteDetail_Store_CustomerProductionReturnNote_MasterID",
column: x => x.MasterID,
principalTable: "Store_CustomerProductionReturnNote",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Store_InjectioModelPlanDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PlanQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
Uom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MasterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
ItemName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc1 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_InjectioModelPlanDetail", x => x.Id);
table.ForeignKey(
name: "FK_Store_InjectioModelPlanDetail_Store_InjectioModelPlan_MasterID",
column: x => x.MasterID,
principalTable: "Store_InjectioModelPlan",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Store_MesRecordDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ReasonCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MasterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
ItemName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc1 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Uom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Qty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
StdPackQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
FromPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToPackingCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
FromContainerCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
ToContainerCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
FromLot = table.Column<string>(type: "nvarchar(450)", nullable: true),
ToLot = table.Column<string>(type: "nvarchar(max)", nullable: true),
SupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
FromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
FromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
FromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_MesRecordDetail", x => x.Id);
table.ForeignKey(
name: "FK_Store_MesRecordDetail_Store_MesRecord_MasterID",
column: x => x.MasterID,
principalTable: "Store_MesRecord",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Store_ThirdLocationNoteDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
IssueTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ExpiredTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
WorkStation = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
OnTheWayLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
PositionCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MasterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
ItemName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc1 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Uom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Qty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
StdPackQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
FromPackingCode = table.Column<string>(type: "nvarchar(450)", nullable: true),
ToPackingCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
FromContainerCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
ToContainerCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
FromLot = table.Column<string>(type: "nvarchar(max)", nullable: true),
ToLot = table.Column<string>(type: "nvarchar(max)", nullable: true),
SupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
FromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
FromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
FromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToStatus = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
RecommendContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
RecommendLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendFromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
HandledContainerCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledPackingCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledSupplierBatch = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledArriveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledProduceDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HandledLot = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledFromWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
HandledQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_ThirdLocationNoteDetail", x => x.Id);
table.ForeignKey(
name: "FK_Store_ThirdLocationNoteDetail_Store_ThirdLocationNote_MasterID",
column: x => x.MasterID,
principalTable: "Store_ThirdLocationNote",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Store_ThirdLocationRequestDetail",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ToLocationCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationArea = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationGroup = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToLocationErpCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ToWarehouseCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
FromLocationArea = table.Column<string>(type: "nvarchar(max)", nullable: true),
ProdLine = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
WorkStation = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ExpiredTime = table.Column<DateTime>(type: "datetime2", nullable: false),
IssuedQty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
ReceivedQty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
Status = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
PositionCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
RecommendType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MasterID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Number = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Remark = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
ItemName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc1 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemDesc2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ItemCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Uom = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Qty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
StdPackQty = table.Column<decimal>(type: "decimal(18,6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Store_ThirdLocationRequestDetail", x => x.Id);
table.ForeignKey(
name: "FK_Store_ThirdLocationRequestDetail_Store_ThirdLocationRequest_MasterID",
column: x => x.MasterID,
principalTable: "Store_ThirdLocationRequest",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Job_ThirdLocationJob_Number",
table: "Job_ThirdLocationJob",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Job_ThirdLocationJobDetail_MasterID",
table: "Job_ThirdLocationJobDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_CustomerProductionReturnNote_Number",
table: "Store_CustomerProductionReturnNote",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_CustomerProductionReturnNoteDetail_MasterID",
table: "Store_CustomerProductionReturnNoteDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_CustomerProductionReturnNoteDetail_Number_ItemCode_FromPackingCode_ToPackingCode_FromLocationCode_ToLocationCode",
table: "Store_CustomerProductionReturnNoteDetail",
columns: new[] { "Number", "ItemCode", "FromPackingCode", "ToPackingCode", "FromLocationCode", "ToLocationCode" },
unique: true,
filter: "[FromPackingCode] IS NOT NULL AND [ToPackingCode] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_Store_InjectioModelPlan_Number",
table: "Store_InjectioModelPlan",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_InjectioModelPlanDetail_MasterID",
table: "Store_InjectioModelPlanDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_InjectioModelPlanDetail_Number_ItemCode",
table: "Store_InjectioModelPlanDetail",
columns: new[] { "Number", "ItemCode" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_MesRecord_Number",
table: "Store_MesRecord",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_MesRecordDetail_MasterID",
table: "Store_MesRecordDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_MesRecordDetail_Number_ItemCode_FromPackingCode_FromLocationCode_ToLocationCode_FromLot_FromStatus",
table: "Store_MesRecordDetail",
columns: new[] { "Number", "ItemCode", "FromPackingCode", "FromLocationCode", "ToLocationCode", "FromLot", "FromStatus" },
unique: true,
filter: "[FromPackingCode] IS NOT NULL AND [FromLot] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_Store_ThirdLocationNote_Number",
table: "Store_ThirdLocationNote",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_ThirdLocationNoteDetail_FromPackingCode",
table: "Store_ThirdLocationNoteDetail",
column: "FromPackingCode");
migrationBuilder.CreateIndex(
name: "IX_Store_ThirdLocationNoteDetail_MasterID",
table: "Store_ThirdLocationNoteDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_ThirdLocationNoteDetail_Number_FromPackingCode_FromLocationCode_ToLocationCode",
table: "Store_ThirdLocationNoteDetail",
columns: new[] { "Number", "FromPackingCode", "FromLocationCode", "ToLocationCode" },
unique: true,
filter: "[FromPackingCode] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_Store_ThirdLocationRequest_Number",
table: "Store_ThirdLocationRequest",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Store_ThirdLocationRequestDetail_ItemCode",
table: "Store_ThirdLocationRequestDetail",
column: "ItemCode");
migrationBuilder.CreateIndex(
name: "IX_Store_ThirdLocationRequestDetail_MasterID",
table: "Store_ThirdLocationRequestDetail",
column: "MasterID");
migrationBuilder.CreateIndex(
name: "IX_Store_ThirdLocationRequestDetail_Number_ItemCode_ToLocationCode",
table: "Store_ThirdLocationRequestDetail",
columns: new[] { "Number", "ItemCode", "ToLocationCode" },
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Job_ThirdLocationJobDetail");
migrationBuilder.DropTable(
name: "Store_CustomerProductionReturnNoteDetail");
migrationBuilder.DropTable(
name: "Store_InjectioModelPlanDetail");
migrationBuilder.DropTable(
name: "Store_MesRecordDetail");
migrationBuilder.DropTable(
name: "Store_ThirdLocationNoteDetail");
migrationBuilder.DropTable(
name: "Store_ThirdLocationRequestDetail");
migrationBuilder.DropTable(
name: "Job_ThirdLocationJob");
migrationBuilder.DropTable(
name: "Store_CustomerProductionReturnNote");
migrationBuilder.DropTable(
name: "Store_InjectioModelPlan");
migrationBuilder.DropTable(
name: "Store_MesRecord");
migrationBuilder.DropTable(
name: "Store_ThirdLocationNote");
migrationBuilder.DropTable(
name: "Store_ThirdLocationRequest");
migrationBuilder.DropColumn(
name: "BoxQty",
table: "Store_InjectionRequestDetail");
}
}
}

5231
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/StoreDbContextModelSnapshot.cs

File diff suppressed because it is too large

171
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionRequestEventHandler.cs

@ -1,13 +1,14 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using FluentValidation.Validators;
using Castle.Components.DictionaryAdapter;
using Volo.Abp;
using Volo.Abp.EventBus;
using Volo.Abp.SettingManagement;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
@ -27,21 +28,21 @@ public class InjectionRequestEventHandler
private readonly IInjectionJobAppService _injectionJobAppService;
private readonly IProductionLineAppService _productionLineAppService;
private readonly IInjectionRequestManager _injectionRequestManager;
private readonly IProductionLineItemAppService _productionLineItemAppService;
private readonly ILocationAppService _locationAppService;
private readonly IBalanceAppService _balanceAppService;
public InjectionRequestEventHandler(
IInjectionJobAppService injectionJobAppService
, IProductionLineAppService productionLineAppService
, IInjectionRequestManager injectionRequestManager
, ILocationAppService locationAppService
, IBalanceAppService balanceAppService)
IInjectionJobAppService injectionJobAppService, IProductionLineAppService productionLineAppService,
IInjectionRequestManager injectionRequestManager, ILocationAppService locationAppService,
IBalanceAppService balanceAppService, IProductionLineItemAppService productionLineItemAppService)
{
_injectionJobAppService = injectionJobAppService;
_productionLineAppService = productionLineAppService;
_injectionRequestManager = injectionRequestManager;
_locationAppService = locationAppService;
_balanceAppService = balanceAppService;
_productionLineItemAppService = productionLineItemAppService;
}
/// <summary>
@ -50,12 +51,7 @@ public class InjectionRequestEventHandler
/// <param name="eventData">Event data</param>
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<InjectionRequest> eventData)
{
var entity = eventData.Entity;
//if (entity.AutoSubmit)
//{
// await _injectionRequestManager.SubmitAsync(entity).ConfigureAwait(false);
//}
await Task.CompletedTask.ConfigureAwait(false);
}
/// <summary>
@ -64,15 +60,7 @@ public class InjectionRequestEventHandler
/// <param name="eventData">Event data</param>
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<InjectionRequest>> eventData)
{
var entitys = eventData.Entity;
foreach (var entity in entitys)
{
if (entity.AutoSubmit)
{
await _injectionRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
await Task.CompletedTask.ConfigureAwait(false);
}
/// <summary>
@ -83,7 +71,19 @@ public class InjectionRequestEventHandler
public virtual async Task HandleEventAsync(SfsHandledEntityEventData<InjectionRequest> eventData)
{
var entity = eventData.Entity;
var injectionJobs = await BuildInjectionJobAsync(entity).ConfigureAwait(false);
List<InjectionJobEditInput> injectionJobs = new EditableList<InjectionJobEditInput>();
switch (entity.Type)
{
case nameof(EnumIssueType.Box):
break;
case nameof(EnumIssueType.Num):
injectionJobs = await CreateInjectionJobWithBoxTypeAsync(entity).ConfigureAwait(false);
break;
}
if (injectionJobs.Any())
{
await _injectionJobAppService.CreateManyAsync(injectionJobs).ConfigureAwait(false);
@ -97,7 +97,7 @@ public class InjectionRequestEventHandler
/// <returns></returns>
public virtual async Task HandleEventAsync(SfsAbortedEntityEventData<InjectionRequest> eventData)
{
await Task.CompletedTask.ConfigureAwait(false);
}
/// <summary>
@ -115,24 +115,36 @@ public class InjectionRequestEventHandler
#region 私有
private async Task<List<InjectionJobEditInput>> BuildInjectionJobAsync
#region 按数量叫料
/// <summary>
/// 创建注塑任务
/// </summary>
/// <param name="injectionRequest"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
private async Task<List<InjectionJobEditInput>> CreateInjectionJobWithBoxTypeAsync
(InjectionRequest injectionRequest)
{
var jobs = new List<InjectionJobEditInput>();
var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false);//库存事务
var transactionType = await TransactionTypeAclService
.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false); //库存事务
var toLocationCodes = injectionRequest.Details.Select(p => p.ToLocationCode).Distinct().ToList();//所有发送库位的集合
var toLocations = await _locationAppService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false);//所有库位的集合
var toLocationCodes = injectionRequest.Details.Select(p => p.ToLocationCode).Distinct().ToList(); //所有发送库位的集合
var toLocations = await _locationAppService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false); //所有库位的集合
var injectionRequestDetails = injectionRequest.Details.Where(p => p.ToBeIssuedQty > 0);//所有还没发送物品的集合
foreach (var injectionRequestDetail in injectionRequestDetails)//如果有还有剩余未叫料的数量 则创建新的任务
var injectionRequestDetails = injectionRequest.Details.Where(p => p.ToBeIssuedQty > 0); //所有还没发送物品的集合
foreach (var injectionRequestDetail in injectionRequestDetails) //如果有还有剩余未叫料的数量 则创建新的任务
{
var toLocation = toLocations.FirstOrDefault(p => p.Code == injectionRequestDetail.ToLocationCode);//判断目标库位是否存在
var toLocation =
toLocations.FirstOrDefault(p => p.Code == injectionRequestDetail.ToLocationCode); //判断目标库位是否存在
Check.NotNull(toLocation, "库位代码", $"库位 {injectionRequestDetail.ToLocationCode} 不存在");
//创建详情
var jobDetails = await BuildInjectionJobDetailInputsAsync(injectionRequest, injectionRequestDetail, transactionType, toLocation.LocationGroupCode).ConfigureAwait(false);
var jobDetails =
await CreateInjectionJobDetailInputsWithBoxTypeAsync(injectionRequest, injectionRequestDetail,
toLocation.LocationGroupCode).ConfigureAwait(false);
if (!jobDetails.Any())
{
continue;
@ -143,9 +155,10 @@ public class InjectionRequestEventHandler
var job = jobs.FirstOrDefault(p => p.WorkGroupCode == fromLocation?.WorkGroupCode);
if (job == null || job.Details.Any(p => p.ToLocationCode != injectionRequestDetail.ToLocationCode))
{
job = BuildInjectionJobCreateInput(injectionRequest, fromLocation);
job = await BuildInjectionJobCreateInputWithBoxTypeAsync(injectionRequest, fromLocation).ConfigureAwait(false);
jobs.Add(job);
}
job.Details.AddRange(jobDetails);
if (injectionRequestDetail.ToBeIssuedQty < 0)
{
@ -164,10 +177,10 @@ public class InjectionRequestEventHandler
}
var enableMultipleCreateInjectionJob = await SettingManager.IsTrueAsync(StoreSettings.MaterialRequest.EnableMultipleCreateIssueJob).ConfigureAwait(false);
var enableMultipleCreateInjectionJob = await SettingManager
.IsTrueAsync(StoreSettings.MaterialRequest.EnableMultipleCreateIssueJob).ConfigureAwait(false);
if (enableMultipleCreateInjectionJob)
{
//injectionRequest.Partial();
}
else
@ -175,14 +188,24 @@ public class InjectionRequestEventHandler
var sb = new StringBuilder();
foreach (var openRequestDetail in openRequestDetails)
{
sb.AppendLine($"{openRequestDetail.ItemCode}请求数量 {openRequestDetail.Qty},可用库存数量 {openRequestDetail.IssuedQty}");
sb.AppendLine(
$"{openRequestDetail.ItemCode}请求数量 {openRequestDetail.Qty},可用库存数量 {openRequestDetail.IssuedQty}");
}
throw new UserFriendlyException($"{sb} 可用库存数量不足, 无法生成发料任务");
}
return jobs;
}
private InjectionJobEditInput BuildInjectionJobCreateInput(InjectionRequest injectionRequest, LocationDTO fromLocation)
/// <summary>
/// 构造注塑任务
/// </summary>
/// <param name="injectionRequest"></param>
/// <param name="fromLocation"></param>
/// <returns></returns>
private async Task<InjectionJobEditInput> BuildInjectionJobCreateInputWithBoxTypeAsync(InjectionRequest injectionRequest,
LocationDTO fromLocation)
{
InjectionJobEditInput job;
job = ObjectMapper.Map<InjectionRequest, InjectionJobEditInput>(injectionRequest);
@ -192,39 +215,67 @@ public class InjectionRequestEventHandler
job.WarehouseCode = fromLocation.WarehouseCode;
job.ProdLine = fromLocation.LocationGroupCode;
job.Worker = injectionRequest.Worker;
if(string.IsNullOrEmpty(job.Worker))
if (string.IsNullOrEmpty(job.Worker))
{
job.Worker = "admin";
}
job.InjectionRequestNumber = injectionRequest.Number;
await Task.CompletedTask.ConfigureAwait(false);
return job;
}
private async Task<List<InjectionJobDetailInput>> BuildInjectionJobDetailInputsAsync(InjectionRequest injectionRequest,
InjectionRequestDetail injectionRequestDetail, TransactionTypeDTO transactionType, string toLocationGroupCode)
/// <summary>
/// 创建注塑任务明细
/// </summary>
/// <param name="injectionRequest"></param>
/// <param name="injectionRequestDetail"></param>
/// <param name="toLocationGroupCode"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
private async Task<List<InjectionJobDetailInput>> CreateInjectionJobDetailInputsWithBoxTypeAsync(
InjectionRequest injectionRequest,
InjectionRequestDetail injectionRequestDetail, string toLocationGroupCode)
{
var jobDetails = new List<InjectionJobDetailInput>();
var input = new RecommendBalanceRequestInput()
//获取推荐库存
var productionLineDto = await _productionLineAppService
.GetByLocationCodeAsync(injectionRequestDetail.ToLocationCode).ConfigureAwait(false);
var productionLineItemDtos = await _productionLineItemAppService
.GetByProductLineCodeAsync(productionLineDto.Code).ConfigureAwait(false);
if (productionLineItemDtos == null)
{
throw new UserFriendlyException($"物品代码【{injectionRequestDetail.ItemCode}】没有对应的【生产线物品关系】");
}
var productionLineItemDto =
productionLineItemDtos.FirstOrDefault(p => p.ItemCode == injectionRequestDetail.ItemCode);
var input = new RecommendBalanceRequestInput
{
ItemCode = injectionRequestDetail.ItemCode,
Qty = injectionRequestDetail.ToBeIssuedQty,
LocationTypes = transactionType.OutLocationTypes,
LocationAreas = new List<string> { injectionRequestDetail.FromLocationArea },
Statuses = transactionType.OutInventoryStatuses,
//LocationTypes = transactionType.OutLocationTypes, productionLineItemDto.RawLocationCodeListJson
Statuses = new EditableList<EnumInventoryStatus> { EnumInventoryStatus.OK },
Locations = JsonSerializer.Deserialize<List<string>>(productionLineItemDto.RawLocationCodeListJson)
};
//获取推荐库存
var recommendList = await _balanceAppService.GetRecommendBalancesAsync(input).ConfigureAwait(false);
var recommendList = await _balanceAppService.GetRecommendBalancesByLocationsAsync(input).ConfigureAwait(false);
//没有推荐库存时 跳过此明细 不生成任务
if (recommendList.Count != 0)
{
foreach (var recommend in recommendList)
{
//拿走需求量
var detail = await BuildInjectionJobDetailAsync(injectionRequestDetail, recommend, toLocationGroupCode).ConfigureAwait(false);
var detail = await BuildInjectionJobDetailWithBoxTypeAsync(injectionRequestDetail, recommend, toLocationGroupCode)
.ConfigureAwait(false);
if (injectionRequest.UseOnTheWayLocation)
{
//获取在途库
var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false);
var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT)
.ConfigureAwait(false);
detail.OnTheWayLocationCode = locationDto.Code;
}
@ -233,15 +284,22 @@ public class InjectionRequestEventHandler
injectionRequestDetail.IssuedQty += recommend.Qty;
//await _injectionRequestManager.UpdateDetailsAsync(injectionRequest).ConfigureAwait(false);
}
}
return jobDetails;
}
private async Task<InjectionJobDetailInput> BuildInjectionJobDetailAsync(InjectionRequestDetail injectionRequestDetail, BalanceDTO balance, string toLocationGroupCode)
/// <summary>
/// 构造注塑任务明细
/// </summary>
/// <param name="injectionRequestDetail"></param>
/// <param name="balance"></param>
/// <param name="toLocationGroupCode"></param>
/// <returns></returns>
private async Task<InjectionJobDetailInput> BuildInjectionJobDetailWithBoxTypeAsync(
InjectionRequestDetail injectionRequestDetail, BalanceDTO balance, string toLocationGroupCode)
{
//ProductionLineDTO prodLine = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationGroupCode).ConfigureAwait(false);
var detail = ObjectMapper.Map<BalanceDTO, InjectionJobDetailInput>(balance);
@ -273,11 +331,18 @@ public class InjectionRequestEventHandler
detail.ToWarehouseCode = injectionRequestDetail.ToWarehouseCode;
//detail.ProdLine = prodLine == null ? toLocationGroupCode : prodLine.Code;
detail.ProdLine = toLocationGroupCode ;
detail.ProdLine = toLocationGroupCode;
await Task.CompletedTask.ConfigureAwait(false);
return detail;
}
#endregion
#region 按箱叫料
#endregion
#endregion
}

68
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/BackFlushNoteEventHandler.cs

@ -23,28 +23,68 @@ public class BackFlushNoteEventHandler
await AddTransactionsAsync(entity).ConfigureAwait(false);
}
private async Task AddTransactionsAsync(BackFlushNote backFlushNote)
{
var inboundTransactions = new List<TransactionEditInput>();
inboundTransactions.AddRange(await BuildTransactionsAsync(backFlushNote));
await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false);
}
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<BackFlushNote>> eventData)
{
var entities = eventData.Entity;
await AddTransactionsAsync(entities).ConfigureAwait(false);
}
foreach (var entity in entities)
private async Task AddTransactionsAsync(List<BackFlushNote> backFlushNotes)
{
await AddTransactionsAsync(entity).ConfigureAwait(false);
}
var inboundTransactions = new List<TransactionEditInput>();
//如果要做库存事务汇总,可以修改此处
foreach (var backFlushNote in backFlushNotes)
{
inboundTransactions.AddRange(await BuildTransactionsAsync(backFlushNote).ConfigureAwait(false));
}
private async Task AddTransactionsAsync(BackFlushNote backFlushNote)
var transactionEditInputs = inboundTransactions.GroupBy(p => new
{
var inboundTransactions = new List<TransactionEditInput>();
p.ItemCode,
p.LocationCode,
p.Status,
p.PackingCode,
p.Lot
}).Select(p => p.FirstOrDefault()).ToList();
foreach (var variableTransactionEditInput in transactionEditInputs)
{
var sameList = inboundTransactions.Where(p =>
p.ItemCode == variableTransactionEditInput.ItemCode &&
p.LocationCode == variableTransactionEditInput.LocationCode &&
p.Status == variableTransactionEditInput.Status &&
p.Lot == variableTransactionEditInput.Lot &&
p.PackingCode == variableTransactionEditInput.PackingCode)
.ToList();
inboundTransactions.AddRange(BuildTransactions(backFlushNote));
variableTransactionEditInput.Qty = sameList
.Sum(p => p.Qty);
await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false);
var docNumber = string.Empty;
foreach (var transactionEditInput in sameList)
{
docNumber += "----【单据号】" + transactionEditInput.DocNumber + "【物料代码】" + transactionEditInput.ItemCode + "【数量】" + transactionEditInput.Qty + " 】 ";
}
variableTransactionEditInput.Remark = docNumber;
}
private List<TransactionEditInput> BuildTransactions(BackFlushNote backFlushNote)
await Task.CompletedTask.ConfigureAwait(false);
await TransactionAppService.AddManyAsync(transactionEditInputs).ConfigureAwait(false);
}
private async Task<List<TransactionEditInput>> BuildTransactionsAsync(BackFlushNote backFlushNote)
{
var transactions = new List<TransactionEditInput>();
//构造库存转移记录创建Input
@ -69,15 +109,17 @@ public class BackFlushNoteEventHandler
transaction.JobNumber = backFlushNote.JobNumber;
transaction.Status = detail.Status;
transaction.LocationArea = detail.LocationArea;
transaction.LocationGroup=detail.LocationGroup;
transaction.LocationCode=detail.LocationCode;
transaction.LocationErpCode=detail.LocationErpCode;
transaction.WarehouseCode=detail.WarehouseCode;
transaction.LocationGroup = detail.LocationGroup;
transaction.LocationCode = detail.LocationCode;
transaction.LocationErpCode = detail.LocationErpCode;
transaction.WarehouseCode = detail.WarehouseCode;
transaction.Status = EnumInventoryStatus.OK;
transactions.Add(transaction);
}
return transactions;
await Task.CompletedTask.ConfigureAwait(false);
return transactions;
}
}

12
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/CustomerProductionReturnNoteEventHandler.cs

@ -1,8 +1,11 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Office2010.Excel;
using IdentityServer4.Models;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
@ -79,9 +82,16 @@ public class CustomerProductionReturnNoteEventHandler
{
var transaction = ObjectMapper.Map<CustomerProductionReturnNoteDetail, TransactionEditInput>(detail);
transaction.PackingCode = (!string.IsNullOrEmpty(transaction.PackingCode) )? transaction.PackingCode :"NONE" ;
transaction.ContainerCode = (!string.IsNullOrEmpty(transaction.ContainerCode) )? transaction.ContainerCode :"NONE" ;
transaction.Lot = (!string.IsNullOrEmpty(transaction.Lot) )? transaction.Lot :"NONE" ;
transaction.LocationArea = (!string.IsNullOrEmpty(transaction.LocationArea) )? transaction.LocationArea :"NONE" ;
transaction.LocationGroup = (!string.IsNullOrEmpty(transaction.LocationGroup) )? transaction.LocationGroup :"NONE" ;
transaction.LocationErpCode = (!string.IsNullOrEmpty(transaction.LocationErpCode))? transaction.LocationErpCode :"NONE" ;
transaction.WarehouseCode = (!string.IsNullOrEmpty(transaction.WarehouseCode)) ? transaction.WarehouseCode : "NONE";
transaction.LocationErpCode = (!string.IsNullOrEmpty(transaction.LocationErpCode)) ? transaction.LocationErpCode : "NONE";
transaction.TransType = TransType;
transaction.TransInOut = TransInOut;
transaction.Worker = CustomerProductionReturnNote.Worker;
transaction.DocNumber = CustomerProductionReturnNote.Number;
transaction.JobNumber = CustomerProductionReturnNote.JobNumber;

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/MesNoteEventHandler.cs

@ -51,6 +51,11 @@ public class MesNoteEventHandler
//}
//else
//{
var transferLogs = new List<TransferLogEditInput>();
foreach (var MesNote in MesNotes)
{

52
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ProductReceiptNoteEventHandler.cs

@ -23,7 +23,8 @@ public class ProductReceiptNoteEventHandler
private readonly IItemBasicAppService _itemBasicAppService;
private readonly ILocationAppService _locationAppService;
public ProductReceiptNoteEventHandler(IItemBasicAppService itemBasicAppService, ILocationAppService locationAppService)
public ProductReceiptNoteEventHandler(IItemBasicAppService itemBasicAppService,
ILocationAppService locationAppService)
{
_itemBasicAppService = itemBasicAppService;
_locationAppService = locationAppService;
@ -34,17 +35,15 @@ public class ProductReceiptNoteEventHandler
{
var entity = eventData.Entity;
await AddTransactionsAsync(entity).ConfigureAwait(false);
}
private async Task AddTransactionsAsync(ProductReceiptNote productReceiptNote)
{
var inboundTransactions = new List<TransactionEditInput>();
inboundTransactions.AddRange(await BuildTransactions(productReceiptNote));
inboundTransactions.AddRange(await BuildTransactionsAsync(productReceiptNote).ConfigureAwait(false));
await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false);
}
[UnitOfWork]
@ -56,19 +55,48 @@ public class ProductReceiptNoteEventHandler
private async Task AddTransactionsAsync(List<ProductReceiptNote> productReceiptNotes)
{
var inboundTransactions = new List<TransactionEditInput>();
//如果要做库存事务汇总,可以修改此处
foreach (var productReceiptNote in productReceiptNotes)
{
inboundTransactions.AddRange(await BuildTransactions(productReceiptNote));
inboundTransactions.AddRange(await BuildTransactionsAsync(productReceiptNote).ConfigureAwait(false));
}
await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false);
var transactionEditInputs = inboundTransactions.GroupBy(p => new
{
p.ItemCode,
p.LocationCode,
p.Status,
p.PackingCode,
p.Lot
}).Select(p => p.FirstOrDefault()).ToList();
foreach (var variableTransactionEditInput in transactionEditInputs)
{
var sameList = inboundTransactions.Where(p =>
p.ItemCode == variableTransactionEditInput.ItemCode &&
p.LocationCode == variableTransactionEditInput.LocationCode &&
p.Status == variableTransactionEditInput.Status &&
p.Lot == variableTransactionEditInput.Lot &&
p.PackingCode == variableTransactionEditInput.PackingCode)
.ToList();
variableTransactionEditInput.Qty = sameList
.Sum(p => p.Qty);
var docNumber = string.Empty;
foreach (var transactionEditInput in sameList)
{
docNumber += "----【单据号】" + transactionEditInput.DocNumber + "【物料代码】" + transactionEditInput.ItemCode + "【数量】" + transactionEditInput.Qty + " 】 ";
}
private async Task<List<TransactionEditInput>> BuildTransactions(ProductReceiptNote productReceiptNote)
variableTransactionEditInput.Remark = docNumber;
}
await TransactionAppService.AddManyAsync(transactionEditInputs).ConfigureAwait(false);
}
private async Task<List<TransactionEditInput>> BuildTransactionsAsync(ProductReceiptNote productReceiptNote)
{
var transactionCreateInputs = new List<TransactionEditInput>();
//构造库存入库创建Input
@ -76,7 +104,7 @@ public class ProductReceiptNoteEventHandler
{
var transaction = ObjectMapper.Map<ProductReceiptNoteDetail, TransactionEditInput>(detail);
var itemBasicDto= await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
if (itemBasicDto == null)
{
@ -86,8 +114,8 @@ public class ProductReceiptNoteEventHandler
detail.ItemDesc1 = itemBasicDto.Desc1;
detail.ItemDesc2 = itemBasicDto.Desc2;
detail.ItemName=itemBasicDto.Name;
detail.StdPackQty=itemBasicDto.StdPackQty;
detail.ItemName = itemBasicDto.Name;
detail.StdPackQty = itemBasicDto.StdPackQty;
transaction.TransType = TransType;
transaction.TransInOut = TransInOut;
@ -98,7 +126,7 @@ public class ProductReceiptNoteEventHandler
transactionCreateInputs.Add(transaction);
}
return transactionCreateInputs;
}
}

Loading…
Cancel
Save