Browse Source

bug

master
yibo 4 years ago
parent
commit
2d8bc73e37
1 changed files with 53 additions and 54 deletions
  1. +53
    -54
      ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs

+ 53
- 54
ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs View File

@ -74,7 +74,7 @@ namespace ButcherFactory.BO.LocalBL
var query = new DQueryDom(new JoinAlias(typeof(CarcassSaleOut_Detail)));
query.Where.Conditions.Add(DQCondition.EQ("BarCode", barCode));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(1), "c"));
query.Having.Conditions.Add(DQCondition.EQ(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ("IsBack", true), DQExpression.Value(-1), DQExpression.Value(1))), DQExpression.Value(0)));
//query.Having.Conditions.Add(DQCondition.EQ(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ("IsBack", true), DQExpression.Value(-1), DQExpression.Value(1))), DQExpression.Value(0)));
return query.EExecuteScalar() != null;
}
@ -94,61 +94,60 @@ namespace ButcherFactory.BO.LocalBL
}
public static void FillDetail(CarcassSaleOut_Detail first, string barCode, long? batchID)
{
{
var list = new List<Tuple<string, object>>();
if (barCode.StartsWith("G"))
{
var arr = barCode.TrimStart('G').Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries);
var gid = long.Parse(arr[0]);
var gInfo = GetGoodsInfo(gid);
first.Goods_ID = gid;
first.Goods_Name = gInfo.Item1;
first.Goods_Code = gInfo.Item2;
first.ProductBatch_ID = batchID;
if (arr.Length == 2)
{
first.Number = 0.5m;
list.Add(new Tuple<string, object>("Number", first.Number));
}
list.Add(new Tuple<string, object>("ProductBatch_ID", first.ProductBatch_ID));
}
else
{
string json;
try
{
json = RpcFacade.Call<string>("/MainSystem/B3ButcherManage/Rpcs/CarcassStoreDetailRpc/GetCarcassInstoreInfo", barCode);
}
catch
{
throw;
}
var mesInfo = JsonConvert.DeserializeObject<SaleOutCarcassObj>(json);
if (!string.IsNullOrEmpty(mesInfo.Goods_Code))
{
if (mesInfo.Goods_Code == "X002")//特殊处理,有个存货编码不存在。
mesInfo.Goods_Code = "0001";
var gInfo = GetGoodsInfo(mesInfo.Goods_Code);
first.Goods_Code = mesInfo.Goods_Code;
first.InStoreWeight = mesInfo.InStoreWeight;
first.Number = mesInfo.Number;
first.Goods_ID = gInfo.Item1;
first.Goods_Name = gInfo.Item2;
}
first.BarCode = barCode;
list.Add(new Tuple<string, object>("BarCode", first.BarCode));
list.Add(new Tuple<string, object>("InStoreWeight", first.InStoreWeight));
list.Add(new Tuple<string, object>("Number", first.Number));
}
first.Filled = true;
list.Add(new Tuple<string, object>("Goods_ID", first.Goods_ID));
list.Add(new Tuple<string, object>("Goods_Name", first.Goods_Name));
list.Add(new Tuple<string, object>("Goods_Code", first.Goods_Code));
list.Add(new Tuple<string, object>("Filled", first.Filled));
using (var session = DmoSession.New())
{
var list = new List<Tuple<string, object>>();
if (barCode.StartsWith("G"))
{
var arr = barCode.TrimStart('G').Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries);
var gid = long.Parse(arr[0]);
var gInfo = GetGoodsInfo(gid);
first.Goods_ID = gid;
first.Goods_Name = gInfo.Item1;
first.Goods_Code = gInfo.Item2;
first.ProductBatch_ID = batchID;
if (arr.Length == 2)
{
first.Number = 0.5m;
list.Add(new Tuple<string, object>("Number", first.Number));
}
list.Add(new Tuple<string, object>("ProductBatch_ID", first.ProductBatch_ID));
}
else
{
string json;
try
{
json = RpcFacade.Call<string>("/MainSystem/B3ButcherManage/Rpcs/CarcassStoreDetailRpc/GetCarcassInstoreInfo", barCode);
}
catch
{
session.Dispose();
throw;
}
var mesInfo = JsonConvert.DeserializeObject<SaleOutCarcassObj>(json);
if (!string.IsNullOrEmpty(mesInfo.Goods_Code))
{
if (mesInfo.Goods_Code == "X002")//特殊处理,有个存货编码不存在。
mesInfo.Goods_Code = "0001";
var gInfo = GetGoodsInfo(mesInfo.Goods_Code);
first.Goods_Code = mesInfo.Goods_Code;
first.InStoreWeight = mesInfo.InStoreWeight;
first.Number = mesInfo.Number;
first.Goods_ID = gInfo.Item1;
first.Goods_Name = gInfo.Item2;
}
first.BarCode = barCode;
list.Add(new Tuple<string, object>("BarCode", first.BarCode));
list.Add(new Tuple<string, object>("InStoreWeight", first.InStoreWeight));
list.Add(new Tuple<string, object>("Number", first.Number));
}
first.Filled = true;
list.Add(new Tuple<string, object>("Goods_ID", first.Goods_ID));
list.Add(new Tuple<string, object>("Goods_Name", first.Goods_Name));
list.Add(new Tuple<string, object>("Goods_Code", first.Goods_Code));
list.Add(new Tuple<string, object>("Filled", first.Filled));
Update(session, first.ID, list.ToArray());
session.Commit();
}


Loading…
Cancel
Save