From f72fb9ca31fbf27b4abbc0156e60ea162f58df81 Mon Sep 17 00:00:00 2001 From: dsmzx <dsmzx@123.com> Date: 星期四, 13 六月 2024 15:30:50 +0800 Subject: [PATCH] 出入库调拨产品明细增加备注字段(同步产品的备注字段) --- service/operation.go | 60 ++++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 34 insertions(+), 26 deletions(-) diff --git a/service/operation.go b/service/operation.go index dd5a9ea..e3a187a 100644 --- a/service/operation.go +++ b/service/operation.go @@ -8,11 +8,12 @@ ) type OutputInfo struct { - LocationID int - WarehouseID int - Products []*ProductInfo - OperationID int - SourceNumber string + LocationID int + WarehouseID int + Products []*ProductInfo + OperationID int + SourceNumber string + SaleDetailsNumber string } type ProductInfo struct { @@ -42,6 +43,10 @@ } operations := make([]*models.Operation, 0, len(outputList)) for _, output := range outputList { + location, err := models.NewLocationSearch().SetType(int(constvar.LocationTypeCustomer)).First() + if err != nil { + return err + } details := make([]*models.OperationDetails, 0, len(output.Products)) for _, product := range output.Products { details = append(details, &models.OperationDetails{ @@ -49,33 +54,36 @@ ProductId: product.ProductID, Amount: product.Amount, FromLocationID: output.LocationID, + ToLocationID: location.Id, }) } if opTypeMap[output.WarehouseID] == nil { continue } operation := &models.Operation{ - Id: 0, - Number: autoCode, - SourceNumber: output.SourceNumber, - OperationTypeId: opTypeMap[output.WarehouseID].Id, - OperationTypeName: opTypeMap[output.WarehouseID].Name, - Status: constvar.OperationStatus_Ready, - OperationDate: time.Now().Format("2006-01-02 15:04:05"), - ContacterID: 0, - ContacterName: "", - CompanyID: 0, - CompanyName: "", - Comment: "crm鍙戣揣鐢宠", - LogisticCompanyId: "", - LogisticCompany: models.LogisticCompany{}, - WaybillNumber: "", - Weight: decimal.Decimal{}, - LogisticWeight: decimal.Decimal{}, - Source: "crm", - Details: details, - BaseOperationType: constvar.BaseOperationTypeOutgoing, - LocationID: output.LocationID, + Id: 0, + Number: autoCode, + SourceNumber: output.SourceNumber, + OperationTypeId: opTypeMap[output.WarehouseID].Id, + OperationTypeName: opTypeMap[output.WarehouseID].Name, + Status: constvar.OperationStatus_Ready, + OperationDate: time.Now().Format("2006-01-02 15:04:05"), + ContacterID: 0, + ContacterName: "", + CompanyID: "", + CompanyName: "", + Comment: "crm鍙戣揣鐢宠", + LogisticCompanyId: "", + LogisticCompany: models.LogisticCompany{}, + WaybillNumber: "", + Weight: decimal.Decimal{}, + LogisticWeight: decimal.Decimal{}, + Source: "crm", + Details: details, + BaseOperationType: constvar.BaseOperationTypeOutgoing, + LocationID: output.LocationID, + OperationSource: constvar.OperationSourceSaleDelivery, + SalesDetailsNumber: output.SaleDetailsNumber, } operations = append(operations, operation) autoCode = models.GetAutoCode(maxAutoIncr, codeStandard) -- Gitblit v1.8.0