Browse Source

销售出库单撤销清空条码销售信息

master
wugang 7 years ago
parent
commit
b38b3c04c6
1 changed files with 72 additions and 0 deletions
  1. +72
    -0
      B3CowButcherManageToSale/TypeIOCs/SaleOutStoreBLTypeIoc.cs

+ 72
- 0
B3CowButcherManageToSale/TypeIOCs/SaleOutStoreBLTypeIoc.cs View File

@ -108,4 +108,76 @@ namespace BWP.B3CowButcherManageToSale.TypeIOCs
get { return string.Format("销售出库单No.{0}扫码信息到屠宰系统", BillID); }
}
}
[TypeIOC(typeof(SaleOutStoreBL), typeof(SaleOutStoreBL.BillBLIOCs.AfterUnCheck))]
public class SaleOutStoreUnCheckBLTypeIoc : SaleOutStoreBL.BillBLIOCs.AfterUnCheck
{
public void Invoke(IDmoContext context, SaleOutStore dmo)
{
var task = new SaleInfoToButcherUnCheckTask(dmo.ID);
task.AddTaskUser_ID = BLContext.User.ID;
task.DomainUser_ID = DomainContext.Current.DomainUser.ID;
QueueTaskService.Add(task);
}
}
[Serializable]
class SaleInfoToButcherUnCheckTask : QueueTaskBase
{
public long BillID { get; set; }
public long DomainUser_ID { get; set; }
public SaleInfoToButcherUnCheckTask(long id)
{
BillID = id;
}
public override bool PersistTask
{
get
{
return true;
}
}
protected override bool SingleTaskInQueue
{
get
{
return true;
}
}
public override void Execute(QueueTaskContext context)
{
using (var scope = new SpecialDomainUserBLScope(DomainUser_ID))
{
using (var session = Dmo.NewSession())
{
var codes = GetBarCodeInfos(session, BillID);
if(codes.Count > 0)
BarCodeProductRpc.ClearSaleInfo(codes);
}
}
}
List<string> GetBarCodeInfos(IDmoSession session, long id)
{
var detail = new JoinAlias(typeof(SaleOutStore_Detail));
var bill = new JoinAlias(typeof(SaleOutStore));
var scan = new JoinAlias(typeof(WeightingInfo_ScanDetail));
var query = new DQueryDom(detail);
query.From.AddJoin(JoinType.Left, new DQDmoSource(bill), DQCondition.EQ(detail, "SaleOutStore_ID", bill, "ID"));
query.From.AddJoin(JoinType.Left, new DQDmoSource(scan), DQCondition.EQ(detail, "ID", scan, "Detail_ID"));
query.Columns.Add(DQSelectColumn.Field("BarCode", scan));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ(detail, "SaleOutStore_ID", id), DQCondition.IsNotNull(DQExpression.Field(scan, "ID"))));
query.Where.Conditions.Add(DQCondition.InEQ(scan, "BarCode", ""));
return query.EExecuteList<string>(session);
}
public override string Name
{
get { return string.Format("销售出库单No.{0}撤销清空条码销售信息到屠宰系统", BillID); }
}
}
}

Loading…
Cancel
Save