| | |
| | | operation.ReceiverAddr = req.Address |
| | | operation.Source = req.Source |
| | | operation.OperationSource = constvar.OperationSource(req.OperationSource) |
| | | operation.CompanyID = int(req.ClientId) |
| | | operation.CompanyID = strconv.FormatInt(req.ClientId, 10) |
| | | operation.CompanyName = req.ClientName |
| | | if req.DeliverType == 1 { |
| | | for _, product := range req.ProductList { |
| | |
| | | "wms_operation.number,wms_operation.waybill_number, logistic_company.name, wms_operation.base_operation_type, wms_operation.status, wms_operation.created_at"). |
| | | Joins("left join wms_operation on wms_operation.id = wms_operation_details.operation_id"). |
| | | Joins("left join logistic_company on logistic_company.id = wms_operation.logistic_company_id"). |
| | | Where("wms_operation.source_number = ?", req.Number). |
| | | Where("wms_operation.sales_details_number = ?", req.Number). |
| | | Where("wms_operation.base_operation_type in ?", []constvar.BaseOperationType{ |
| | | constvar.BaseOperationTypeIncoming, constvar.BaseOperationTypeOutgoing}). |
| | | Where("wms_operation.status in ?", []constvar.OperationStatus{constvar.OperationStatus_Ready, constvar.OperationStatus_Finish}) |
| | |
| | | inputLocationAmountMap := make(map[int64]map[string]decimal.Decimal) |
| | | outputLocationAmountMap := make(map[int64]map[string]decimal.Decimal) |
| | | for _, v := range outputList { |
| | | if req.WarehouseId != 0 && v.WareHouseID != req.WarehouseId { |
| | | continue |
| | | } |
| | | if outputProductMap[v.Number] == nil { |
| | | simpleInfo := &OutputSimpleInfo{ |
| | | Number: v.Number, |
| | |
| | | } |
| | | } |
| | | for _, v := range inputList { |
| | | if req.WarehouseId != 0 && v.WareHouseID != req.WarehouseId { |
| | | continue |
| | | } |
| | | if inputProductMap[v.Number] == nil { |
| | | storeInfo := &StoreInfo{ |
| | | Number: v.Number, |
| | |
| | | |
| | | LocationIDWarehouseIDMap := make(map[int64]int64) |
| | | for _, output := range outputList { |
| | | if req.WarehouseId != 0 && output.WareHouseID != req.WarehouseId { |
| | | continue |
| | | } |
| | | if outputLocationAmountMap[output.LocationID] == nil { |
| | | outputLocationAmountMap[output.LocationID] = make(map[string]decimal.Decimal) |
| | | } |
| | |
| | | outputLocationAmountMap[output.LocationID][output.Number] = outputAmount |
| | | } |
| | | for _, input := range inputList { |
| | | if req.WarehouseId != 0 && input.WareHouseID != req.WarehouseId { |
| | | continue |
| | | } |
| | | LocationIDWarehouseIDMap[input.LocationID] = input.WareHouseID |
| | | |
| | | if inputLocationAmountMap[input.LocationID] == nil { |
| | |
| | | return nil, errors.New("参数不能为空") |
| | | } |
| | | result := new(GetOutputOperationInfoResponse) |
| | | first, err := models.NewOperationSearch().SetSourceNumber(req.Number).SetStatus(constvar.OperationStatus_Finish).First() |
| | | first, err := models.NewOperationSearch().SetSourceNumber(req.Number).SetBaseOperationType(constvar.BaseOperationTypeOutgoing).SetStatus(constvar.OperationStatus_Finish).First() |
| | | if err != nil { |
| | | if err == gorm.ErrRecordNotFound { |
| | | return result, nil |