41 changed files with 43846 additions and 4257 deletions
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,801 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Migrations |
|||
{ |
|||
public partial class Update_2024_03_28_ProductLine : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<bool>( |
|||
name: "Confirmed", |
|||
table: "Job_TransferLibJob", |
|||
type: "bit", |
|||
nullable: false, |
|||
defaultValue: false); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Job_CoatingIssueJob", |
|||
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), |
|||
MaterialRequestNumber = 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_CoatingIssueJob", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Job_InjectionJob", |
|||
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), |
|||
InjectionRequestNumber = 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_InjectionJob", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Store_CoatingIssueNote", |
|||
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_CoatingIssueNote", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Store_CoatingMaterialRequest", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
Type = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true), |
|||
PreparationPlanNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true), |
|||
ProdLine = 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), |
|||
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_CoatingMaterialRequest", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Store_InjectionNote", |
|||
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_InjectionNote", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Store_InjectionRequest", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
Type = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true), |
|||
PreparationPlanNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true), |
|||
ProdLine = 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), |
|||
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_InjectionRequest", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Job_CoatingIssueJobDetail", |
|||
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_CoatingIssueJobDetail", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_Job_CoatingIssueJobDetail_Job_CoatingIssueJob_MasterID", |
|||
column: x => x.MasterID, |
|||
principalTable: "Job_CoatingIssueJob", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Job_InjectionJobDetail", |
|||
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_InjectionJobDetail", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_Job_InjectionJobDetail_Job_InjectionJob_MasterID", |
|||
column: x => x.MasterID, |
|||
principalTable: "Job_InjectionJob", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Store_CoatingIssueNoteDetail", |
|||
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(max)", 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_CoatingIssueNoteDetail", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_Store_CoatingIssueNoteDetail_Store_CoatingIssueNote_MasterID", |
|||
column: x => x.MasterID, |
|||
principalTable: "Store_CoatingIssueNote", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Store_CoatingMaterialRequestDetail", |
|||
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(max)", 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_CoatingMaterialRequestDetail", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_Store_CoatingMaterialRequestDetail_Store_CoatingMaterialRequest_MasterID", |
|||
column: x => x.MasterID, |
|||
principalTable: "Store_CoatingMaterialRequest", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Store_InjectionNoteDetail", |
|||
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_InjectionNoteDetail", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_Store_InjectionNoteDetail_Store_InjectionNote_MasterID", |
|||
column: x => x.MasterID, |
|||
principalTable: "Store_InjectionNote", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Store_InjectionRequestDetail", |
|||
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_InjectionRequestDetail", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_Store_InjectionRequestDetail_Store_InjectionRequest_MasterID", |
|||
column: x => x.MasterID, |
|||
principalTable: "Store_InjectionRequest", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Job_CoatingIssueJob_Number", |
|||
table: "Job_CoatingIssueJob", |
|||
column: "Number", |
|||
unique: true); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Job_CoatingIssueJobDetail_MasterID", |
|||
table: "Job_CoatingIssueJobDetail", |
|||
column: "MasterID"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Job_InjectionJob_Number", |
|||
table: "Job_InjectionJob", |
|||
column: "Number", |
|||
unique: true); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Job_InjectionJobDetail_MasterID", |
|||
table: "Job_InjectionJobDetail", |
|||
column: "MasterID"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Store_CoatingIssueNote_Number", |
|||
table: "Store_CoatingIssueNote", |
|||
column: "Number", |
|||
unique: true); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Store_CoatingIssueNoteDetail_FromPackingCode", |
|||
table: "Store_CoatingIssueNoteDetail", |
|||
column: "FromPackingCode"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Store_CoatingIssueNoteDetail_MasterID", |
|||
table: "Store_CoatingIssueNoteDetail", |
|||
column: "MasterID"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Store_CoatingIssueNoteDetail_Number_FromPackingCode_FromLocationCode_ToLocationCode", |
|||
table: "Store_CoatingIssueNoteDetail", |
|||
columns: new[] { "Number", "FromPackingCode", "FromLocationCode", "ToLocationCode" }, |
|||
unique: true, |
|||
filter: "[FromPackingCode] IS NOT NULL"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Store_CoatingMaterialRequest_Number", |
|||
table: "Store_CoatingMaterialRequest", |
|||
column: "Number", |
|||
unique: true); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Store_CoatingMaterialRequestDetail_ItemCode", |
|||
table: "Store_CoatingMaterialRequestDetail", |
|||
column: "ItemCode"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Store_CoatingMaterialRequestDetail_MasterID", |
|||
table: "Store_CoatingMaterialRequestDetail", |
|||
column: "MasterID"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Store_CoatingMaterialRequestDetail_Number_ItemCode_ToLocationCode", |
|||
table: "Store_CoatingMaterialRequestDetail", |
|||
columns: new[] { "Number", "ItemCode", "ToLocationCode" }, |
|||
unique: true); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Store_InjectionNote_Number", |
|||
table: "Store_InjectionNote", |
|||
column: "Number", |
|||
unique: true); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Store_InjectionNoteDetail_FromPackingCode", |
|||
table: "Store_InjectionNoteDetail", |
|||
column: "FromPackingCode"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Store_InjectionNoteDetail_MasterID", |
|||
table: "Store_InjectionNoteDetail", |
|||
column: "MasterID"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Store_InjectionNoteDetail_Number_FromPackingCode_FromLocationCode_ToLocationCode", |
|||
table: "Store_InjectionNoteDetail", |
|||
columns: new[] { "Number", "FromPackingCode", "FromLocationCode", "ToLocationCode" }, |
|||
unique: true, |
|||
filter: "[FromPackingCode] IS NOT NULL"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Store_InjectionRequest_Number", |
|||
table: "Store_InjectionRequest", |
|||
column: "Number", |
|||
unique: true); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Store_InjectionRequestDetail_ItemCode", |
|||
table: "Store_InjectionRequestDetail", |
|||
column: "ItemCode"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Store_InjectionRequestDetail_MasterID", |
|||
table: "Store_InjectionRequestDetail", |
|||
column: "MasterID"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Store_InjectionRequestDetail_Number_ItemCode_ToLocationCode", |
|||
table: "Store_InjectionRequestDetail", |
|||
columns: new[] { "Number", "ItemCode", "ToLocationCode" }, |
|||
unique: true); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "Job_CoatingIssueJobDetail"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Job_InjectionJobDetail"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Store_CoatingIssueNoteDetail"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Store_CoatingMaterialRequestDetail"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Store_InjectionNoteDetail"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Store_InjectionRequestDetail"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Job_CoatingIssueJob"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Job_InjectionJob"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Store_CoatingIssueNote"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Store_CoatingMaterialRequest"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Store_InjectionNote"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Store_InjectionRequest"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "Confirmed", |
|||
table: "Job_TransferLibJob"); |
|||
} |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,132 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.Uow; |
|||
using Win_in.Sfs.Basedata.Application.Contracts; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
using Win_in.Sfs.Shared.Event; |
|||
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
using Win_in.Sfs.Wms.Store.Domain; |
|||
using Win_in.Sfs.Wms.Store.Domain.Shared; |
|||
using Win_in.Sfs.Wms.Store.Jobs.IssueJobs; |
|||
using Win_in.Sfs.Wms.Store.Notes.IssueNotes; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Event.BusinessJob; |
|||
|
|||
public class CoatingIssueJobEventHandler : |
|||
StoreEventHandlerBase |
|||
, ILocalEventHandler<SfsCompletedEntityEventData<CoatingIssueJob>> |
|||
{ |
|||
private const EnumTransType TransType = EnumTransType.Issue; |
|||
|
|||
private readonly ICoatingIssueNoteAppService _issueNoteAppService; |
|||
private readonly ILocationAppService _locationAppService; |
|||
|
|||
public CoatingIssueJobEventHandler(ICoatingIssueNoteAppService issueNoteAppService, ILocationAppService locationAppService) |
|||
{ |
|||
_issueNoteAppService = issueNoteAppService; |
|||
_locationAppService = locationAppService; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 执行后
|
|||
/// </summary>
|
|||
/// <param name="eventData"></param>
|
|||
/// <returns></returns>
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(SfsCompletedEntityEventData<CoatingIssueJob> eventData) |
|||
{ |
|||
var entity = eventData.Entity; |
|||
var issueNote = await BuildIssueNoteAsync(entity).ConfigureAwait(false); |
|||
await _issueNoteAppService.CreateAsync(issueNote).ConfigureAwait(false); |
|||
} |
|||
|
|||
#region 私有
|
|||
|
|||
/// <summary>
|
|||
/// 创建补料记录实体
|
|||
/// </summary>
|
|||
/// <param name="entity"></param>
|
|||
/// <returns></returns>
|
|||
private async Task<CoatingIssueNoteEditInput> BuildIssueNoteAsync(CoatingIssueJob entity) |
|||
{ |
|||
var issueNoteCreateInput = ObjectMapper.Map<CoatingIssueJob, CoatingIssueNoteEditInput>(entity); |
|||
issueNoteCreateInput.JobNumber = entity.Number; |
|||
var locationCodes = issueNoteCreateInput.Details.Select(p => p.ToLocationCode).Distinct().ToList(); |
|||
var locations = await _locationAppService.GetByCodesAsync(locationCodes).ConfigureAwait(false); |
|||
|
|||
issueNoteCreateInput.Details.RemoveAll(p => p.Qty == 0); |
|||
|
|||
foreach (var detail in issueNoteCreateInput.Details) |
|||
{ |
|||
var location = locations.First(p => p.Code == detail.ToLocationCode); |
|||
await RemovePackingCodeAndContainerCodeAndLotAsync(detail, location.Type).ConfigureAwait(false); //去箱 去托 去批
|
|||
|
|||
detail.ToLocationArea = location.AreaCode; |
|||
detail.ToLocationGroup = location.LocationGroupCode; |
|||
detail.ToLocationErpCode = location.ErpLocationCode; |
|||
detail.ToWarehouseCode = location.WarehouseCode; |
|||
} |
|||
|
|||
return issueNoteCreateInput; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 去除箱码 托码 批次
|
|||
/// </summary>
|
|||
private async Task RemovePackingCodeAndContainerCodeAndLotAsync(CoatingIssueNoteDetailInput issueNoteDetail, |
|||
EnumLocationType locationType) |
|||
{ |
|||
switch (locationType) |
|||
{ |
|||
case EnumLocationType.WIP: |
|||
{ |
|||
//用开关控制 发料到线边后去除箱码和托码 ???
|
|||
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemovePackingCode) |
|||
.ConfigureAwait(false)) |
|||
{ |
|||
issueNoteDetail.ToPackingCode = ""; |
|||
} |
|||
|
|||
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveContainerCode) |
|||
.ConfigureAwait(false)) |
|||
{ |
|||
issueNoteDetail.ToContainerCode = ""; |
|||
} |
|||
|
|||
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveLot).ConfigureAwait(false)) |
|||
{ |
|||
issueNoteDetail.ToLot = ""; |
|||
} |
|||
|
|||
break; |
|||
} |
|||
case EnumLocationType.SEMI: |
|||
{ |
|||
//用开关控制 发料到后去除箱码和托码 ???
|
|||
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemovePackingCode) |
|||
.ConfigureAwait(false)) |
|||
{ |
|||
issueNoteDetail.ToPackingCode = ""; |
|||
} |
|||
|
|||
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveContainerCode) |
|||
.ConfigureAwait(false)) |
|||
{ |
|||
issueNoteDetail.ToContainerCode = ""; |
|||
} |
|||
|
|||
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveLot).ConfigureAwait(false)) |
|||
{ |
|||
issueNoteDetail.ToLot = ""; |
|||
} |
|||
|
|||
break; |
|||
} |
|||
} |
|||
} |
|||
|
|||
#endregion
|
|||
} |
@ -0,0 +1,307 @@ |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using FluentValidation.Validators; |
|||
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.Event; |
|||
using Win_in.Sfs.Wms.Inventory.Application.Contracts; |
|||
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
using Win_in.Sfs.Wms.Store.Domain; |
|||
using Win_in.Sfs.Wms.Store.Domain.Shared; |
|||
using Win_in.Sfs.Wms.Store.Jobs.IssueJobs; |
|||
using Win_in.Sfs.Wms.Store.Requests.MaterialRequests; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; |
|||
|
|||
public class CoatingMaterialRequestEventHandler |
|||
: StoreEventHandlerBase |
|||
, ILocalEventHandler<SfsHandledEntityEventData<CoatingMaterialRequest>> |
|||
, ILocalEventHandler<SfsAbortedEntityEventData<CoatingMaterialRequest>> |
|||
, ILocalEventHandler<SfsCompletedEntityEventData<CoatingMaterialRequest>> |
|||
, ILocalEventHandler<SfsCreatedEntityEventData<CoatingMaterialRequest>> |
|||
, ILocalEventHandler<SfsCreatedEntityEventData<List<CoatingMaterialRequest>>> |
|||
{ |
|||
private readonly ICoatingIssueJobAppService _issueJobAppService; |
|||
private readonly IProductionLineAppService _productionLineAppService; |
|||
private readonly ICoatingMaterialRequestManager _CoatingMaterialRequestManager; |
|||
private readonly ILocationAppService _locationAppService; |
|||
private readonly IBalanceAppService _balanceAppService; |
|||
|
|||
public CoatingMaterialRequestEventHandler( |
|||
ICoatingIssueJobAppService issueJobAppService |
|||
, IProductionLineAppService productionLineAppService |
|||
, ICoatingMaterialRequestManager CoatingMaterialRequestManager |
|||
, ILocationAppService locationAppService |
|||
, IBalanceAppService balanceAppService) |
|||
{ |
|||
_issueJobAppService = issueJobAppService; |
|||
_productionLineAppService = productionLineAppService; |
|||
_CoatingMaterialRequestManager = CoatingMaterialRequestManager; |
|||
_locationAppService = locationAppService; |
|||
_balanceAppService = balanceAppService; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 创建后
|
|||
/// </summary>
|
|||
/// <param name="eventData">Event data</param>
|
|||
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<CoatingMaterialRequest> eventData) |
|||
{ |
|||
var entity = eventData.Entity; |
|||
|
|||
//if (entity.AutoSubmit)
|
|||
//{
|
|||
// await _CoatingMaterialRequestManager.SubmitAsync(entity).ConfigureAwait(false);
|
|||
//}
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 批量创建后
|
|||
/// </summary>
|
|||
/// <param name="eventData">Event data</param>
|
|||
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<CoatingMaterialRequest>> eventData) |
|||
{ |
|||
var entitys = eventData.Entity; |
|||
foreach (var entity in entitys) |
|||
{ |
|||
if (entity.AutoSubmit) |
|||
{ |
|||
await _CoatingMaterialRequestManager.SubmitAsync(entity).ConfigureAwait(false); |
|||
} |
|||
if (entity.Type == EnumMaterialRequestType.Issue_WIP.ToString()) |
|||
{ |
|||
await _CoatingMaterialRequestManager.SubmitAsync(entity).ConfigureAwait(false); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 执行后
|
|||
/// </summary>
|
|||
/// <param name="eventData"></param>
|
|||
/// <returns></returns>
|
|||
public virtual async Task HandleEventAsync(SfsHandledEntityEventData<CoatingMaterialRequest> eventData) |
|||
{ |
|||
var entity = eventData.Entity; |
|||
var issueJobs = await BuildIssueJobAsync(entity).ConfigureAwait(false); |
|||
if (issueJobs.Any()) |
|||
{ |
|||
await _issueJobAppService.CreateManyAsync(issueJobs).ConfigureAwait(false); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 驳回后
|
|||
/// </summary>
|
|||
/// <param name="eventData"></param>
|
|||
/// <returns></returns>
|
|||
public virtual async Task HandleEventAsync(SfsAbortedEntityEventData<CoatingMaterialRequest> eventData) |
|||
{ |
|||
var entity = eventData.Entity; |
|||
await _issueJobAppService.CancelByMaterialRequestAsync(entity.Number).ConfigureAwait(false); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 完成后
|
|||
/// </summary>
|
|||
/// <param name="eventData"></param>
|
|||
/// <returns></returns>
|
|||
public virtual async Task HandleEventAsync(SfsCompletedEntityEventData<CoatingMaterialRequest> eventData) |
|||
{ |
|||
_ = eventData.Entity; |
|||
// await _issueJobAppService.CompleteByCoatingMaterialRequestAsync(entity.Number);
|
|||
|
|||
await Task.CompletedTask.ConfigureAwait(false); |
|||
} |
|||
|
|||
#region 私有
|
|||
|
|||
private async Task<List<CoatingIssueJobEditInput>> BuildIssueJobAsync |
|||
(CoatingMaterialRequest CoatingMaterialRequest) |
|||
{ |
|||
var jobs = new List<CoatingIssueJobEditInput>(); |
|||
|
|||
var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false);//库存事务
|
|||
|
|||
var toLocationCodes = CoatingMaterialRequest.Details.Select(p => p.ToLocationCode).Distinct().ToList();//所有发送库位的集合
|
|||
var toLocations = await _locationAppService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false);//所有库位的集合
|
|||
|
|||
var CoatingMaterialRequestDetails = CoatingMaterialRequest.Details.Where(p => p.ToBeIssuedQty > 0);//所有还没发送物品的集合
|
|||
foreach (var CoatingMaterialRequestDetail in CoatingMaterialRequestDetails)//如果有还有剩余未叫料的数量 则创建新的任务
|
|||
{ |
|||
var toLocation = toLocations.FirstOrDefault(p => p.Code == CoatingMaterialRequestDetail.ToLocationCode);//判断目标库位是否存在
|
|||
Check.NotNull(toLocation, "库位代码", $"库位 {CoatingMaterialRequestDetail.ToLocationCode} 不存在"); |
|||
|
|||
//创建详情
|
|||
var jobDetails = await BuildIssueJobDetailInputsAsync(CoatingMaterialRequest, CoatingMaterialRequestDetail, transactionType, toLocation.LocationGroupCode).ConfigureAwait(false); |
|||
if (!jobDetails.Any()) |
|||
{ |
|||
continue; |
|||
} |
|||
|
|||
var fromLocationCode = jobDetails[0].RecommendFromLocationCode; |
|||
var fromLocation = await _locationAppService.GetByCodeAsync(fromLocationCode).ConfigureAwait(false); |
|||
var job = jobs.FirstOrDefault(p => p.WorkGroupCode == fromLocation?.WorkGroupCode); |
|||
if (job == null || job.Details.Any(p => p.ToLocationCode != CoatingMaterialRequestDetail.ToLocationCode)) |
|||
{ |
|||
job = BuildIssueJobCreateInput(CoatingMaterialRequest, fromLocation); |
|||
jobs.Add(job); |
|||
} |
|||
job.Details.AddRange(jobDetails); |
|||
if (CoatingMaterialRequestDetail.ToBeIssuedQty < 0) |
|||
{ |
|||
CoatingMaterialRequestDetail.Status = EnumStatus.Close; |
|||
} |
|||
} |
|||
|
|||
jobs = jobs.Where(p => p.Details.Any()).ToList(); |
|||
|
|||
var openRequestDetails = |
|||
CoatingMaterialRequest.Details.Where(p => p.Status != EnumStatus.Close).ToList(); |
|||
|
|||
if (!openRequestDetails.Any()) |
|||
{ |
|||
return jobs; |
|||
} |
|||
|
|||
var enableMultipleCreateIssueJob = await SettingManager.IsTrueAsync(StoreSettings.MaterialRequest.EnableMultipleCreateIssueJob).ConfigureAwait(false); |
|||
if (enableMultipleCreateIssueJob) |
|||
{ |
|||
CoatingMaterialRequest.Partial(); |
|||
} |
|||
else |
|||
{ |
|||
var sb = new StringBuilder(); |
|||
foreach (var openRequestDetail in openRequestDetails) |
|||
{ |
|||
sb.AppendLine($"{openRequestDetail.ItemCode}请求数量 {openRequestDetail.Qty},可用库存数量 {openRequestDetail.IssuedQty}"); |
|||
} |
|||
throw new UserFriendlyException($"{sb} 可用库存数量不足, 无法生成发料任务"); |
|||
} |
|||
return jobs; |
|||
} |
|||
|
|||
private CoatingIssueJobEditInput BuildIssueJobCreateInput(CoatingMaterialRequest CoatingMaterialRequest, LocationDTO fromLocation) |
|||
{ |
|||
CoatingIssueJobEditInput job; |
|||
job = ObjectMapper.Map<CoatingMaterialRequest,CoatingIssueJobEditInput>(CoatingMaterialRequest); |
|||
job.JobType = EnumJobType.IssueJob; |
|||
job.JobStatus = EnumJobStatus.Open; |
|||
job.WorkGroupCode = fromLocation.WorkGroupCode; |
|||
job.WarehouseCode = fromLocation.WarehouseCode; |
|||
job.ProdLine = fromLocation.LocationGroupCode; |
|||
job.Worker = CoatingMaterialRequest.Worker; |
|||
job.MaterialRequestNumber = CoatingMaterialRequest.Number; |
|||
return job; |
|||
} |
|||
|
|||
private async Task<List<CoatingIssueJobDetailInput>> BuildIssueJobDetailInputsAsync(CoatingMaterialRequest CoatingMaterialRequest, |
|||
CoatingMaterialRequestDetail CoatingMaterialRequestDetail, TransactionTypeDTO transactionType, string toLocationGroupCode) |
|||
{ |
|||
var jobDetails = new List<CoatingIssueJobDetailInput>(); |
|||
var input = new RecommendBalanceRequestInput() |
|||
{ |
|||
ItemCode = CoatingMaterialRequestDetail.ItemCode, |
|||
Qty = CoatingMaterialRequestDetail.ToBeIssuedQty, |
|||
LocationTypes = transactionType.OutLocationTypes, |
|||
LocationAreas = new List<string> { CoatingMaterialRequestDetail.FromLocationArea }, |
|||
Statuses = transactionType.OutInventoryStatuses, |
|||
}; |
|||
//获取推荐库存
|
|||
var recommendList = await _balanceAppService.GetRecommendBalancesAsync(input).ConfigureAwait(false); |
|||
//没有推荐库存时 跳过此明细 不生成任务
|
|||
if (recommendList.Count != 0) |
|||
{ |
|||
foreach (var recommend in recommendList) |
|||
{ |
|||
//拿走需求量
|
|||
var detail = await BuildIssueJobDetailAsync(CoatingMaterialRequestDetail, recommend, toLocationGroupCode).ConfigureAwait(false); |
|||
if (CoatingMaterialRequest.UseOnTheWayLocation) |
|||
{ |
|||
//获取在途库
|
|||
var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false); |
|||
|
|||
detail.OnTheWayLocationCode = locationDto.Code; |
|||
} |
|||
|
|||
jobDetails.Add(detail); |
|||
CoatingMaterialRequestDetail.IssuedQty += recommend.Qty; |
|||
await _CoatingMaterialRequestManager.UpdateDetailsAsync(CoatingMaterialRequest).ConfigureAwait(false); |
|||
|
|||
} |
|||
} |
|||
return jobDetails; |
|||
} |
|||
|
|||
private async Task<CoatingIssueJobDetailInput> BuildIssueJobDetailAsync(CoatingMaterialRequestDetail CoatingMaterialRequestDetail, BalanceDTO balance, string toLocationGroupCode) |
|||
{ |
|||
//ProductionLineDTO prodLine = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationGroupCode).ConfigureAwait(false);
|
|||
|
|||
var detail = ObjectMapper.Map<BalanceDTO, CoatingIssueJobDetailInput>(balance); |
|||
detail.RequestLocationCode = CoatingMaterialRequestDetail.ToLocationCode; |
|||
detail.WorkStation = CoatingMaterialRequestDetail.WorkStation; |
|||
detail.ExpiredTime = CoatingMaterialRequestDetail.ExpiredTime; |
|||
detail.PositionCode = CoatingMaterialRequestDetail.PositionCode; |
|||
detail.RecommendType = CoatingMaterialRequestDetail.RecommendType; |
|||
|
|||
detail.RecommendPackingCode = balance.PackingCode; |
|||
detail.RecommendContainerCode = balance.ContainerCode; |
|||
detail.RecommendSupplierBatch = balance.SupplierBatch; |
|||
detail.RecommendProduceDate = balance.ProduceDate; |
|||
detail.RecommendExpireDate = balance.ExpireDate; |
|||
detail.RecommendLot = balance.Lot; |
|||
detail.RecommendProduceDate = balance.ProduceDate; |
|||
detail.RecommendArriveDate = balance.ArriveDate; |
|||
detail.RecommendFromLocationArea = balance.LocationArea; |
|||
detail.RecommendFromLocationCode = balance.LocationCode; |
|||
detail.RecommendFromLocationErpCode = balance.LocationErpCode; |
|||
detail.RecommendFromLocationGroup = balance.LocationGroup; |
|||
detail.RecommendFromWarehouseCode = balance.WarehouseCode; |
|||
detail.RecommendQty = balance.Qty; |
|||
detail.Uom = balance.Uom; |
|||
|
|||
detail.ToLocationCode = CoatingMaterialRequestDetail.ToLocationCode; |
|||
detail.ToLocationErpCode = CoatingMaterialRequestDetail.ToLocationErpCode; |
|||
detail.ToLocationArea = CoatingMaterialRequestDetail.ToLocationArea; |
|||
detail.ToWarehouseCode = CoatingMaterialRequestDetail.ToWarehouseCode; |
|||
detail.ToLocationGroup = CoatingMaterialRequestDetail.ToLocationGroup; |
|||
//detail.Operation = //TODO
|
|||
//detail.DistributionType =//TODO
|
|||
//detail.TruncType = //TODO
|
|||
//detail.RoundedQty =//TODO
|
|||
//detail.PlannedSplitRule = //TODO
|
|||
//detail.PlanBeginTime = //TODO
|
|||
//detaiol.DeliveryQty = //TODO
|
|||
|
|||
// var detail = ObjectMapper.Map<CoatingMaterialRequestDetail, IssueJobDetailInput>(CoatingMaterialRequestDetail);
|
|||
//
|
|||
// detail.RecommendPackingCode = balance.PackingCode;
|
|||
// detail.RecommendContainerCode = balance.ContainerCode;
|
|||
// detail.RecommendLot = balance.Lot;
|
|||
// detail.RecommendLocationCode = balance.LocationCode;
|
|||
// detail.RecommendLocationArea = balance.LocationArea;
|
|||
// detail.RecommendLocationGroup = balance.LocationGroup;
|
|||
// detail.RecommendLocationErpCode = balance.LocationErpCode;
|
|||
// detail.WarehouseCode = balance.WarehouseCode;
|
|||
// detail.Status = balance.Status;
|
|||
// detail.RecommendSupplierBatch = balance.SupplierBatch;
|
|||
// detail.RecommendArriveDate = balance.ArriveDate;
|
|||
// detail.RecommendProduceDate = balance.ProduceDate;
|
|||
// detail.RecommendExpireDate = balance.ExpireDate;
|
|||
// detail.RecommendQty = balance.Qty;
|
|||
// detail.RecommendUom = balance.Uom;
|
|||
|
|||
// detail.ProdLine = prodLine == null ? toLocationGroupCode : prodLine.Code;
|
|||
detail.ProdLine = toLocationGroupCode; |
|||
await Task.CompletedTask.ConfigureAwait(false); |
|||
return detail; |
|||
|
|||
} |
|||
|
|||
#endregion
|
|||
} |
@ -0,0 +1,100 @@ |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.Uow; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
using Win_in.Sfs.Shared.Event; |
|||
using Win_in.Sfs.Wms.Store.Domain; |
|||
using Win_in.Sfs.Wms.Store.Notes.IssueNotes; |
|||
using Win_in.Sfs.Wms.Store.Requests.MaterialRequests; |
|||
using static Win_in.Sfs.Wms.Store.Domain.Shared.StoreSettings; |
|||
using MaterialRequest = Win_in.Sfs.Wms.Store.Domain.MaterialRequest; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; |
|||
|
|||
public class CoatingIssueNoteEventHandler |
|||
: StoreEventHandlerBase |
|||
, ILocalEventHandler<SfsCreatedEntityEventData<CoatingIssueNote>> |
|||
, ILocalEventHandler<SfsCreatedEntityEventData<List<CoatingIssueNote>>> |
|||
, ILocalEventHandler<SfsConfirmedEntityEventData<CoatingIssueNote>> |
|||
{ |
|||
private readonly ICoatingMaterialRequestManager _materialRequestManager; |
|||
|
|||
public CoatingIssueNoteEventHandler( |
|||
ICoatingMaterialRequestManager materialRequestManager |
|||
) |
|||
{ |
|||
_materialRequestManager = materialRequestManager; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 当叫料记录创建后 修改请求的值
|
|||
/// </summary>
|
|||
/// <param name="eventData"></param>
|
|||
/// <returns></returns>
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(SfsConfirmedEntityEventData<CoatingIssueNote> eventData) |
|||
{ |
|||
var entity = eventData.Entity; |
|||
|
|||
await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 当叫料记录创建后 修改请求的值
|
|||
/// </summary>
|
|||
/// <param name="eventData"></param>
|
|||
/// <returns></returns>
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<CoatingIssueNote> eventData) |
|||
{ |
|||
var entity = eventData.Entity; |
|||
if (!entity.UseOnTheWayLocation) |
|||
{ |
|||
await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 当叫料记录创建后 修改请求的值
|
|||
/// </summary>
|
|||
/// <param name="eventData"></param>
|
|||
/// <returns></returns>
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<CoatingIssueNote>> eventData) |
|||
{ |
|||
var entities = eventData.Entity; |
|||
foreach (var entity in entities.Where(entity => !entity.UseOnTheWayLocation)) |
|||
{ |
|||
await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); |
|||
} |
|||
} |
|||
|
|||
private async Task UpdateReceivedQtyMaterialRequestAsync(CoatingIssueNote entity) |
|||
{ |
|||
var receiveQtyGroup = entity.Details |
|||
.GroupBy(p => new { p.ItemCode, p.ToLocationCode }) |
|||
.Select(p => new { p.Key.ItemCode, p.Key.ToLocationCode, Qty = p.Sum(d => d.Qty) }) |
|||
.ToList(); |
|||
|
|||
var materialRequest = await _materialRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false); |
|||
|
|||
if (entity.RequestType != EnumMaterialRequestType.Issue_Direct.ToString()) |
|||
{ |
|||
//更新叫料请求的已收数量
|
|||
foreach (var materialRequestDetail in materialRequest.Details) |
|||
{ |
|||
var receiveQty = receiveQtyGroup.FirstOrDefault(p => |
|||
p.ItemCode == materialRequestDetail.ItemCode && |
|||
p.ToLocationCode == materialRequestDetail.ToLocationCode)?.Qty; |
|||
if (receiveQty != null) |
|||
{ |
|||
materialRequestDetail.ReceivedQty += receiveQty.Value; |
|||
} |
|||
} |
|||
|
|||
await _materialRequestManager.UpdateDetailsAsync(materialRequest).ConfigureAwait(false); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue