using System.Collections.Generic;
using Forks.JsonRpc.Client;
using Newtonsoft.Json;
using SegmentationInStore.Rpc.Dto;

namespace SegmentationInStore.Rpc
{
  public class SegmentationInStoreRpc
  {
    /// <summary>
    /// 获取所有未扫码的
    /// </summary>
    /// <returns></returns>
    public static List<SegmentationWeightRecord> GetNotInStoreList()
    {
      var json = RpcFacade.Call<string>("/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc/GetNotInStoreList");
      var list= JsonConvert.DeserializeObject<List<SegmentationWeightRecord>>(json);
      return list;
    }
    
    /// <summary>
    /// 获取所有未扫码的
    /// </summary>
    /// <returns></returns>
    public static List<SegmentationWeightRecord> GetNotInStoreListByMaxId(long id)
    {
      var json = RpcFacade.Call<string>("/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc/GetNotInStoreListByMaxId",id);
      var list= JsonConvert.DeserializeObject<List<SegmentationWeightRecord>>(json);
      return list;
    }
    /// <summary>
    /// 添加入库记录
    /// </summary>
    public static long Insert(SegmentationInStoreDto instore)
    {
      var json = JsonConvert.SerializeObject(instore);
      return  RpcFacade.Call<long>("/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc/Insert", json);
    }
  }
}
