|
|
using ButcherFactory.BO.Utils;
|
|
|
using Forks.EnterpriseServices.DomainObjects2;
|
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery;
|
|
|
using Forks.JsonRpc.Client;
|
|
|
using Newtonsoft.Json;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
namespace ButcherFactory.BO.LocalBL
|
|
|
{
|
|
|
public static class SegmentStockUpBL
|
|
|
{
|
|
|
const string RpcPath = @"/MainSystem/B3Sale/Rpcs/";
|
|
|
const string MESPath = @"/MainSystem/B3ClientService/Rpcs/";
|
|
|
|
|
|
/// <summary>
|
|
|
/// </summary>
|
|
|
/// <param name="code"></param>
|
|
|
/// <returns>GoodsCode:StringExt1,Weight:DecimalExt1</returns>
|
|
|
public static ExtensionObj StockUpScan(string code)
|
|
|
{
|
|
|
var json = ButcherFactoryUtil.SecondUrlCall<string>(MESPath + "SegmentInStoreRpc/StockUpScan", code);
|
|
|
return JsonConvert.DeserializeObject<ExtensionObj>(json);
|
|
|
}
|
|
|
|
|
|
public static List<StockUpEntity> GetStockUpEntity(DateTime date, string code)
|
|
|
{
|
|
|
var json = RpcFacade.Call<string>(RpcPath + "SaleOutStoreRpc/GetSaleOutStoreByGoodsCode", date, code);
|
|
|
return JsonConvert.DeserializeObject<List<StockUpEntity>>(json);
|
|
|
}
|
|
|
|
|
|
public static List<StockUpEntity> RefreshList(DateTime date, IEnumerable<long> goodsIDs)
|
|
|
{
|
|
|
var json = RpcFacade.Call<string>(RpcPath + "SaleOutStoreRpc/GetSaleOutStoreByGoodsIDs", date, JsonConvert.SerializeObject(goodsIDs));
|
|
|
return JsonConvert.DeserializeObject<List<StockUpEntity>>(json);
|
|
|
}
|
|
|
|
|
|
public static bool CheckBarCodeUsed(string barCode)
|
|
|
{
|
|
|
return RpcFacade.Call<bool>(RpcPath + "SaleOutStoreRpc/CheckBarCodeUsed",barCode);
|
|
|
}
|
|
|
|
|
|
public static List<StockUpDetail> GetDetails(DateTime date, long driverLineID, long goodsID)
|
|
|
{
|
|
|
var json = RpcFacade.Call<string>(RpcPath + "SaleOutStoreRpc/GetStockUpDetails", date, driverLineID, goodsID);
|
|
|
return JsonConvert.DeserializeObject<List<StockUpDetail>>(json);
|
|
|
}
|
|
|
|
|
|
public static string InsertStockUpDetail(StockUpDetail detail)
|
|
|
{
|
|
|
var min = new MinStockUpDetail() { BarCode = detail.BarCode, SecondNumber = detail.SecondNumber, UnitNumber = detail.UnitNumber };
|
|
|
var json = JsonConvert.SerializeObject(min);
|
|
|
var bkJson = RpcFacade.Call<string>(RpcPath + "SaleOutStoreRpc/InsertStockUpDetail", detail.Date, detail.Goods_ID, detail.DeliverGoodsLine_ID, json);
|
|
|
if (string.IsNullOrEmpty(bkJson))
|
|
|
return string.Empty;
|
|
|
var backInfo = JsonConvert.DeserializeObject<ExtensionObj>(bkJson);
|
|
|
detail.SaleOutStoreID = backInfo.LongExt1.Value;
|
|
|
detail.ID = backInfo.LongExt2.Value;
|
|
|
return backInfo.StringExt1;
|
|
|
}
|
|
|
|
|
|
class MinStockUpDetail
|
|
|
{
|
|
|
public string BarCode { get; set; }
|
|
|
|
|
|
public decimal? SecondNumber { get; set; }
|
|
|
|
|
|
public decimal? UnitNumber { get; set; }
|
|
|
}
|
|
|
}
|
|
|
}
|