37 lines
996 B
Go
Raw Permalink Normal View History

package productbatch
import (
"muyu-apiserver/gateway/internal/types"
"muyu-apiserver/rpc/inventory/pb"
)
func batchInputToPB(input types.ProductBatchInput) *pb.ProductBatchInput {
return &pb.ProductBatchInput{
BatchNo: input.BatchNo,
YarnRatio: input.YarnRatio,
WarpWeightGM: input.WarpWeightGM,
WeftWeightGM: input.WeftWeightGM,
ProductionProcess: input.ProductionProcess,
Remark: input.Remark,
}
}
func batchInfoFromPB(b *pb.ProductBatchInfo) types.ProductBatchInfo {
if b == nil {
return types.ProductBatchInfo{}
}
return types.ProductBatchInfo{
BatchId: b.BatchId,
ProductId: b.ProductId,
BatchNo: b.BatchNo,
YarnRatio: b.YarnRatio,
WarpWeightGM: b.WarpWeightGM,
WeftWeightGM: b.WeftWeightGM,
ProductionProcess: b.ProductionProcess,
Remark: b.Remark,
Status: b.Status,
CreatedAt: b.CreatedAt,
UpdatedAt: b.UpdatedAt,
}
}