|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using BWP.B3ClientService.BO;
|
|
|
using Forks.EnterpriseServices.DomainObjects2;
|
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery;
|
|
|
using TSingSoft.WebPluginFramework;
|
|
|
|
|
|
namespace BWP.B3ClientService.Utils
|
|
|
{
|
|
|
public class SegmentationByPproductTraceBL
|
|
|
{
|
|
|
public static long Insert(IDmoSession session, SegmentationByPproductTrace dmo)
|
|
|
{
|
|
|
session.Insert(dmo);
|
|
|
return dmo.ID;
|
|
|
}
|
|
|
|
|
|
public static void SetInStoreTime(string barCode, DateTime inStoreTime)
|
|
|
{
|
|
|
using (var session = Dmo.NewSession())
|
|
|
{
|
|
|
var id = CheckIsExistByBarCode(session, barCode);
|
|
|
var dqupdateDom = new DQUpdateDom(typeof(SegmentationByPproductTrace));
|
|
|
dqupdateDom.Where.Conditions.Add(DQCondition.EQ("ID", id));
|
|
|
dqupdateDom.Columns.Add(new DQUpdateColumn("InStoreTime", inStoreTime));
|
|
|
session.ExecuteNonQuery(dqupdateDom);
|
|
|
session.Commit();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public static void SetSendInfo(string barCode, DateTime sendTime,string customerName,string carNumber,long? saleOutStoreId=null)
|
|
|
{
|
|
|
using (var session = Dmo.NewSession())
|
|
|
{
|
|
|
var id = CheckIsExistByBarCode(session, barCode);
|
|
|
var dqupdateDom = new DQUpdateDom(typeof(SegmentationByPproductTrace));
|
|
|
dqupdateDom.Where.Conditions.Add(DQCondition.EQ("ID", id));
|
|
|
dqupdateDom.Columns.Add(new DQUpdateColumn("SendTime", sendTime));
|
|
|
dqupdateDom.Columns.Add(new DQUpdateColumn("CarNumber", carNumber));
|
|
|
dqupdateDom.Columns.Add(new DQUpdateColumn("Customer_Name", customerName));
|
|
|
dqupdateDom.Columns.Add(new DQUpdateColumn("B3SaleOutStore_ID", saleOutStoreId));
|
|
|
session.ExecuteNonQuery(dqupdateDom);
|
|
|
session.Commit();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private static long CheckIsExistByBarCode(IDmoSessionWithTransaction session, string barCode)
|
|
|
{
|
|
|
var query = new DQueryDom(new JoinAlias(typeof(SegmentationByPproductTrace)));
|
|
|
query.Where.Conditions.Add(DQCondition.EQ("BarCode", barCode));
|
|
|
query.Columns.Add(DQSelectColumn.Field("ID"));
|
|
|
var res = query.EExecuteScalar<long?>(session);
|
|
|
if (res == null)
|
|
|
{
|
|
|
throw new Exception("不存在条码为:" + barCode + " 的记录");
|
|
|
}
|
|
|
return res.Value;
|
|
|
}
|
|
|
}
|
|
|
}
|