|
@@ -210,7 +210,11 @@ func (s *StoreEntry) FeedSyncData(ctx context.Context, req *operationPb.FeedForm
|
|
|
Page: int32(page),
|
|
|
PageSize: int32(pageSize),
|
|
|
}
|
|
|
+<<<<<<< HEAD
|
|
|
+ response := &model.FeedListResponse{}
|
|
|
+=======
|
|
|
response := &model.FeedFormulaListResponse{}
|
|
|
+>>>>>>> develop
|
|
|
if _, err = s.PastureHttpClient(ctx, model.FeedAsyncUrl, int64(req.PastureId), body, response); err != nil {
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
@@ -230,26 +234,40 @@ func (s *StoreEntry) FeedSyncData(ctx context.Context, req *operationPb.FeedForm
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-func (s *StoreEntry) FeedInsert(ctx context.Context, groupPasture *model.GroupPasture, list []*model.FeedTemplate) error {
|
|
|
- res := make([]*model.FeedFormula, 0)
|
|
|
+func (s *StoreEntry) FeedInsert(ctx context.Context, groupPasture *model.GroupPasture, list []*model.Feed) error {
|
|
|
+ res := make([]*model.Forage, 0)
|
|
|
for _, data := range list {
|
|
|
- res = append(res, &model.FeedFormula{
|
|
|
- Name: data.TName,
|
|
|
- Colour: data.TColor,
|
|
|
- EncodeNumber: data.TCode,
|
|
|
- CattleCategoryId: operationPb.CattleCategoryParent_Kind(data.CCid),
|
|
|
- CattleCategoryName: data.CCName,
|
|
|
- FormulaTypeId: data.FTTypeId,
|
|
|
- FormulaTypeName: data.FTType,
|
|
|
- DataSourceId: operationPb.DataSource_FROM_PASTURE,
|
|
|
- DataSourceName: "牧场同步",
|
|
|
- Remarks: data.Remark,
|
|
|
- Version: data.Version,
|
|
|
- PastureId: groupPasture.PastureId,
|
|
|
+
|
|
|
+ forageSourceName := data.Source
|
|
|
+ forageSourceId := operationPb.ForageSource_SYSTEM_BUILT_IN
|
|
|
+ if forageSourceName == "用户自定义" {
|
|
|
+ forageSourceId = operationPb.ForageSource_USER_DEFINED
|
|
|
+ }
|
|
|
+
|
|
|
+ res = append(res, &model.Forage{
|
|
|
+ Name: data.FName,
|
|
|
+ CategoryId: data.FClassId,
|
|
|
+ CategoryName: data.FClass,
|
|
|
+ MaterialType: 0,
|
|
|
+ UniqueEncode: data.FeedCode,
|
|
|
+ ForageSourceId: forageSourceId,
|
|
|
+ ForageSourceName: forageSourceName,
|
|
|
+ PlanTypeId: operationPb.ForagePlanType_Kind(data.PrintGroupId),
|
|
|
+ PlanTypeName: data.PrintGroup,
|
|
|
+ SmallMaterialScale: data.SmtMrName,
|
|
|
+ AllowError: data.AllowRatio,
|
|
|
+ PackageWeight: data.UnitWeight,
|
|
|
+ Price: int64(data.UPrice * 100),
|
|
|
+ JumpWeight: data.AutoZone,
|
|
|
+ JumpDelay: operationPb.JumpDelaType_Kind(data.AutoSecond),
|
|
|
+ ConfirmStart: operationPb.IsShow_Kind(data.ConfirmStart),
|
|
|
+ RelayLocations: int64(data.TrgAddress),
|
|
|
+ Jmp: operationPb.IsShow_Kind(data.Jmp),
|
|
|
+ DataSource: operationPb.DataSource_FROM_PASTURE,
|
|
|
+ Sort: int64(data.Sort),
|
|
|
PastureName: groupPasture.Name,
|
|
|
PastureDataId: data.Id,
|
|
|
IsShow: operationPb.IsShow_Kind(data.Enable),
|
|
|
- IsModify: operationPb.IsShow_Kind(data.IsModify),
|
|
|
IsDelete: operationPb.IsShow_OK,
|
|
|
})
|
|
|
}
|