private static PriceSetInfo TranslatePriceSetInfo(PriceSetEntity entity) { PriceSetInfo info = new PriceSetInfo(); if (entity != null) { info.PriceSetID = entity.PriceSetID; info.CustomerID = entity.CustomerID; info.StorageID = entity.StorageID; info.CarrierID = entity.CarrierID; info.ReceivingType = entity.ReceivingType; info.ReceivingID = entity.ReceivingID; info.TemType = entity.TemType; info.configPrice = entity.configPrice; info.configHandInAmt = entity.configHandInAmt; info.configSortPrice = entity.configSortPrice; info.configCosting = entity.configCosting; info.configHandOutAmt = entity.configHandOutAmt; info.configSortCosting = entity.configSortCosting; info.DeliveryModel = entity.DeliveryModel; info.Remark = entity.Remark; info.Status = entity.Status; info.CreateDate = entity.CreateDate; info.ChangeDate = entity.ChangeDate; } return(info); }
public int ModifyPriceSet(PriceSetInfo PriceSet) { DataCommand command = new DataCommand(ConnectionString, GetDbCommand(PriceSetStatement.ModifyPriceSet, "Text")); command.AddInputParameter("@CustomerID", DbType.Int32, PriceSet.CustomerID); command.AddInputParameter("@StorageID", DbType.Int32, PriceSet.StorageID); command.AddInputParameter("@CarrierID", DbType.Int32, PriceSet.CarrierID); command.AddInputParameter("@ReceivingType", DbType.String, PriceSet.ReceivingType); command.AddInputParameter("@ReceivingID", DbType.Int32, PriceSet.ReceivingID); command.AddInputParameter("@TemType", DbType.String, PriceSet.TemType); command.AddInputParameter("@configPrice", DbType.Decimal, PriceSet.configPrice); command.AddInputParameter("@configHandInAmt", DbType.Decimal, PriceSet.configHandInAmt); command.AddInputParameter("@configSortPrice", DbType.Decimal, PriceSet.configSortPrice); command.AddInputParameter("@configCosting", DbType.Decimal, PriceSet.configCosting); command.AddInputParameter("@configHandOutAmt", DbType.Decimal, PriceSet.configHandOutAmt); command.AddInputParameter("@configSortCosting", DbType.Decimal, PriceSet.configSortCosting); command.AddInputParameter("@DeliveryModel", DbType.String, PriceSet.DeliveryModel); command.AddInputParameter("@Remark", DbType.String, PriceSet.Remark); command.AddInputParameter("@Status", DbType.Int32, PriceSet.Status); command.AddInputParameter("@OperatorID", DbType.Int32, PriceSet.OperatorID); command.AddInputParameter("@ChangeDate", DbType.DateTime, PriceSet.ChangeDate); command.AddInputParameter("@PriceSetID", DbType.Int32, PriceSet.PriceSetID); return(command.ExecuteNonQuery()); }
public long CreateNew(PriceSetInfo PriceSet) { DataCommand command = new DataCommand(ConnectionString, GetDbCommand(PriceSetStatement.CreateNewPriceSet, "Text")); command.AddInputParameter("@CustomerID", DbType.Int32, PriceSet.CustomerID); command.AddInputParameter("@StorageID", DbType.Int32, PriceSet.StorageID); command.AddInputParameter("@CarrierID", DbType.Int32, PriceSet.CarrierID); command.AddInputParameter("@ReceivingType", DbType.String, PriceSet.ReceivingType); command.AddInputParameter("@ReceivingID", DbType.Int32, PriceSet.ReceivingID); command.AddInputParameter("@TemType", DbType.String, PriceSet.TemType); command.AddInputParameter("@configPrice", DbType.Decimal, PriceSet.configPrice); command.AddInputParameter("@configHandInAmt", DbType.Decimal, PriceSet.configHandInAmt); command.AddInputParameter("@configSortPrice", DbType.Decimal, PriceSet.configSortPrice); command.AddInputParameter("@configCosting", DbType.Decimal, PriceSet.configCosting); command.AddInputParameter("@configHandOutAmt", DbType.Decimal, PriceSet.configHandOutAmt); command.AddInputParameter("@configSortCosting", DbType.Decimal, PriceSet.configSortCosting); command.AddInputParameter("@DeliveryModel", DbType.String, PriceSet.DeliveryModel); command.AddInputParameter("@Remark", DbType.String, PriceSet.Remark); command.AddInputParameter("@Status", DbType.Int32, PriceSet.Status); command.AddInputParameter("@OperatorID", DbType.Int32, PriceSet.OperatorID); command.AddInputParameter("@CreateDate", DbType.DateTime, PriceSet.CreateDate); command.AddInputParameter("@ChangeDate", DbType.DateTime, PriceSet.ChangeDate); var o = command.ExecuteScalar <object>(); return(Convert.ToInt64(o)); }
public static PriceSetEntity GetPriceSetById(long gid) { PriceSetEntity result = new PriceSetEntity(); PriceSetRepository mr = new PriceSetRepository(); PriceSetInfo info = mr.GetPriceSetByKey(gid); result = TranslatePriceSetEntity(info); return(result); }
public PriceSetInfo GetPriceSetByKey(long gid) { PriceSetInfo result = new PriceSetInfo(); DataCommand command = new DataCommand(ConnectionString, GetDbCommand(PriceSetStatement.GetPriceSetByKey, "Text")); command.AddInputParameter("@PriceSetID", DbType.Int32, gid); result = command.ExecuteEntity <PriceSetInfo>(); return(result); }
private static PriceSetEntity TranslatePriceSetEntity(PriceSetInfo info) { PriceSetEntity entity = new PriceSetEntity(); if (info != null) { entity.PriceSetID = info.PriceSetID; entity.CustomerID = info.CustomerID; entity.StorageID = info.StorageID; entity.CarrierID = info.CarrierID; entity.ReceivingType = info.ReceivingType; entity.ReceivingID = info.ReceivingID; entity.TemType = info.TemType; entity.configPrice = info.configPrice; entity.configHandInAmt = info.configHandInAmt; entity.configSortPrice = info.configSortPrice; entity.configCosting = info.configCosting; entity.configHandOutAmt = info.configHandOutAmt; entity.configSortCosting = info.configSortCosting; entity.DeliveryModel = info.DeliveryModel; entity.Remark = info.Remark; entity.Status = info.Status; entity.CreateDate = info.CreateDate; entity.ChangeDate = info.ChangeDate; entity.customer = CustomerService.GetCustomerById(info.CustomerID); entity.storage = StorageService.GetStorageEntityById(info.StorageID); entity.carrier = CarrierService.GetCarrierById(info.CarrierID); entity.receiver = ReceiverService.GetReceiverById(info.ReceivingID); //if (!string.IsNullOrEmpty(entity.ReceivingType)) //{ // if ("仓库".Equals(entity.ReceivingType)) // { // StorageEntity sentity= StorageService.GetStorageEntityById(entity.ReceivingID); // if (sentity != null) // { // entity.ReceivingName = sentity.StorageName; // } // } // if ("门店".Equals(entity.ReceivingType)) // { // StorageEntity sentity = StorageService.GetStorageEntityById(entity.ReceivingID); // if (sentity != null) // { // entity.ReceivingName = sentity.StorageName; // } // } //} } return(entity); }
public static PriceSetEntity GetPriceSetEntityById(long cid) { PriceSetEntity result = new PriceSetEntity(); PriceSetRepository mr = new PriceSetRepository(); PriceSetInfo info = mr.GetPriceSetByKey(cid); result = TranslatePriceSetEntity(info); //获取联系人信息 //result.listContact= ContactService.GetContactByRule(UnionType.PriceSet.ToString(), info.PriceSetID); return(result); }
public bool CreateContractPriceSetInfo(ContractInfo curretnInfo) { //创建报价体系 IList <ICriterion> qryList = new List <ICriterion>(); PriceSetInfo newPriceSetInfo = new PriceSetInfo(); newPriceSetInfo.ContractID = curretnInfo.ID; newPriceSetInfo.IsUsed = "1"; newPriceSetInfo.Remark = ""; newPriceSetInfo.SetDate = DateTime.Now.ToString("yyyyMMdd"); Core.Container.Instance.Resolve <IServicePriceSetInfo>().Create(newPriceSetInfo); //获取当前创建套系的ID qryList = new List <ICriterion>(); qryList.Add(Expression.Eq("SetDate", newPriceSetInfo.SetDate)); qryList.Add(Expression.Eq("ContractID", curretnInfo.ID)); PriceSetInfo priceSetInfo = Core.Container.Instance.Resolve <IServicePriceSetInfo>().GetEntityByFields(qryList); /*------------------创建物品价明细------------------------*/ PriceSetGoodsInfo priceSetGoodsInfo = new PriceSetGoodsInfo(); //获取物品类别,判断报价类型,不参与报价的不需要 qryList = new List <ICriterion>(); qryList.Add(Expression.Eq("IsUsed", "1")); Order[] orderList = new Order[1]; Order orderli = new Order("ID", true); orderList[0] = orderli; IList <EquipmentTypeInfo> listEquipmentType = Core.Container.Instance.Resolve <IServiceEquipmentTypeInfo>().GetAllByKeys(qryList, orderList); foreach (EquipmentTypeInfo typeInfo in listEquipmentType) { ////报价类型 1:按类别统计报价 //if (typeInfo.PriceSetType == 1) //{ // priceSetGoodsInfo = new PriceSetGoodsInfo(); // priceSetGoodsInfo.DailyRents = typeInfo.RentPrice; // priceSetGoodsInfo.EquipmentID = typeInfo.ID; // priceSetGoodsInfo.MinRentingDays = typeInfo.MinRentingDays; // priceSetGoodsInfo.UnitPrice = typeInfo.PayForPrice; // priceSetGoodsInfo.SetID = priceSetInfo.ID; // priceSetGoodsInfo.SetDate = priceSetInfo.SetDate; // priceSetGoodsInfo.FixPrice = typeInfo.FixPrice; // priceSetGoodsInfo.GoodsTypeID = typeInfo.ID; // priceSetGoodsInfo.CustomerUnit = typeInfo.CustomerUnit; // priceSetGoodsInfo.DriverUnit = typeInfo.DriverUnit; // priceSetGoodsInfo.StaffUnit = typeInfo.StaffUnit; // priceSetGoodsInfo.IsGoodType = 1; // Core.Container.Instance.Resolve<IServicePriceSetGoodsInfo>().Create(priceSetGoodsInfo); //} ////报价类型 2:按物品分别报价 //if (typeInfo.PriceSetType == 2) //{ // qryList = new List<ICriterion>(); // qryList.Add(Expression.Eq("IsUsed", "1")); // qryList.Add(Expression.Eq("EquipmentTypeID", typeInfo.ID)); // IList<EquipmentInfo> listEquipment = Core.Container.Instance.Resolve<IServiceEquipmentInfo>().GetAllByKeys(qryList, orderList); // foreach (EquipmentInfo obj in listEquipment) // { // priceSetGoodsInfo = new PriceSetGoodsInfo(); // priceSetGoodsInfo.DailyRents = obj.DailyRents; // priceSetGoodsInfo.EquipmentID = obj.ID; // priceSetGoodsInfo.MinRentingDays = obj.MinRentingDays; // priceSetGoodsInfo.UnitPrice = obj.UnitPrice; // priceSetGoodsInfo.SetID = priceSetInfo.ID; // priceSetGoodsInfo.SetDate = priceSetInfo.SetDate; // priceSetGoodsInfo.FixPrice = obj.FixPrice; // priceSetGoodsInfo.GoodsTypeID = obj.EquipmentTypeID; // priceSetGoodsInfo.CustomerUnit = obj.CustomerUnit; // priceSetGoodsInfo.DriverUnit = obj.DriverUnit; // priceSetGoodsInfo.StaffUnit = obj.StaffUnit; // priceSetGoodsInfo.IsGoodType = 2; // Core.Container.Instance.Resolve<IServicePriceSetGoodsInfo>().Create(priceSetGoodsInfo); // } //} ////报价类型 3:不参与合同报价 //if (typeInfo.PriceSetType == 3) //{ // continue; //} } //更新合同价格套系信息 //curretnInfo.PriceSetID = priceSetInfo.ID; Core.Container.Instance.Resolve <IServiceContractInfo>().Update(curretnInfo); return(true); }
/// <summary> /// 创建收货单辅材信息 /// </summary> /// <param name="dbEntity">收货单主材信息</param> /// <param name="priceSetInfo">合同价格套系</param> /// <param name="whGoodsEntity">库存物品信息</param> private void CreateSHSecondaryDetail(ContractOrderDetail dbEntity, PriceSetInfo priceSetInfo, WHGoodsDetail whGoodsEntity) { IList <ICriterion> qryList = new List <ICriterion>(); //获取主材相关辅材信息 qryList = new List <ICriterion>(); qryList.Add(Expression.Eq("ParentEquipmentID", whGoodsEntity.GoodsID)); qryList.Add(Expression.Eq("EquipmentType", "2")); //IList<EquipmentAssortInfo> assortInfolist = Core.Container.Instance.Resolve<IServiceEquipmentAssortInfo>().GetAllByKeys(qryList); ////计算并保存辅材信息 //foreach (EquipmentAssortInfo assortInfo in assortInfolist) //{ // //判断辅材是否入库要算量 // if (assortInfo.IsInCalcNumber == 1) // { // //获取辅材物品基本信息 // EquipmentInfo equipmentInfo = Core.Container.Instance.Resolve<IServiceEquipmentInfo>().GetEntity(assortInfo.EquipmentID); // //创建辅材信息 // ContractOrderSecondaryDetail detail = new ContractOrderSecondaryDetail(); // detail.GoodsID = assortInfo.EquipmentID; // detail.MainGoodsID = whGoodsEntity.GoodsID; // detail.GoodsNumber = Math.Floor(1 / assortInfo.EquipmentCount) * assortInfo.AssortCount; // detail.FormerlyGoodsNumber = Math.Floor(1 / assortInfo.EquipmentCount) * assortInfo.AssortCount; // detail.PayForNumber = 0; // detail.GoodsUnit = equipmentInfo.EquipmentUnit; // detail.GoodsUnitPrice = 0; // detail.IsShow = 0; // //判断辅材收货时是否计算金额买赔 // if (assortInfo.IsInCalcPrice == 1) // { // /*-------------------获取价格-------------------*/ // //获取主材类别,根据类别的报价策略获取价格 // EquipmentTypeInfo equipmentTypeInfo = Core.Container.Instance.Resolve<IServiceEquipmentTypeInfo>().GetEntity(equipmentInfo.EquipmentTypeID); // //获取价格 // qryList = new List<ICriterion>(); // qryList.Add(Expression.Eq("SetID", priceSetInfo.ID)); // // 报价类型 1:按类别统计报价 2:按物品分别报价 3:不参与合同报价 // //if (equipmentTypeInfo.PriceSetType == 1) // //{ // // qryList.Add(Expression.Eq("EquipmentID", equipmentInfo.EquipmentTypeID)); // //} // //if (equipmentTypeInfo.PriceSetType == 2) // //{ // // qryList.Add(Expression.Eq("EquipmentID", equipmentInfo.ID)); // //} // //获取合同价格设置 // PriceSetGoodsInfo priceSetGoodsInfo1 = Core.Container.Instance.Resolve<IServicePriceSetGoodsInfo>().GetEntityByFields(qryList); // if (priceSetGoodsInfo1 != null) // { // detail.GoodsUnitPrice = priceSetGoodsInfo1.UnitPrice; // } // else // { // detail.GoodsUnitPrice = equipmentInfo.UnitPrice; // } // detail.IsShow = 1; // } // detail.GoodsTotalPrice = detail.GoodsNumber * detail.GoodsUnitPrice; // detail.IsCalcNumber = assortInfo.IsInCalcNumber; // detail.IsCalcPrice = assortInfo.IsInCalcPrice; // detail.OrderDate = dbEntity.OrderDate; // detail.OrderNO = OrderNO; // detail.OrderType = OrderType; // detail.WareHouseID = int.Parse(ddlWH.SelectedValue); // //保存收货辅材信息 // Core.Container.Instance.Resolve<IServiceContractOrderSecondaryDetail>().Create(detail); // } //} }
private void SaveItem() { // 从每个选中的行中获取ID(在Grid1中定义的DataKeyNames) List <int> ids = GetSelectedDataKeyIDs(Grid1); WHGoodsDetail whGoodsEntity = new WHGoodsDetail(); ContractOrderDetail dbEntity = new ContractOrderDetail(); IList <ICriterion> qryList = new List <ICriterion>(); PriceSetInfo priceSetInfo = new PriceSetInfo(); //获取合同信息 ContractInfo contractInfo = Core.Container.Instance.Resolve <IServiceContractInfo>().GetEntity(ContractID); // 执行数据库操作 foreach (int ID in ids) { //获取物品信息 whGoodsEntity = Core.Container.Instance.Resolve <IServiceWHGoodsDetail>().GetEntity(ID); if (whGoodsEntity != null) { whGoodsEntity.GoodsInfo = Core.Container.Instance.Resolve <IServiceEquipmentInfo>().GetEntity(whGoodsEntity.GoodsID); //判断是否已经添加改商品物品 if (whGoodsEntity.GoodsInfo != null && !IsExists(whGoodsEntity.GoodsID)) { #region 主材 dbEntity = new ContractOrderDetail(); dbEntity.OrderNO = OrderNO; dbEntity.OrderDate = DateTime.Now; dbEntity.GoodsID = whGoodsEntity.GoodsID; dbEntity.GoodTypeID = whGoodsEntity.GoodsTypeID; dbEntity.GoodsNumber = 1; dbEntity.FormerlyGoodsNumber = 1; dbEntity.FixGoodsNumber = 0; dbEntity.GoodsUnit = whGoodsEntity.InventoryUnit; //dbEntity.GoodsCalcUnit = whGoodsEntity.GoodsInfo.CalcPriceUnit; //dbEntity.NotOffsetNumber = dbEntity.GoodsNumber; //dbEntity.GoodCalcPriceNumber = dbEntity.GoodsNumber * whGoodsEntity.GoodsInfo.Standard; //dbEntity.PayUnit = whGoodsEntity.GoodsInfo.PayUnit; /*-------------------获取价格-------------------*/ //获取主材类别,根据类别的报价策略获取价格 EquipmentTypeInfo equipmentTypeInfo = Core.Container.Instance.Resolve <IServiceEquipmentTypeInfo>().GetEntity(whGoodsEntity.GoodsInfo.EquipmentTypeID); //dbEntity.IsStockByRepaired = equipmentTypeInfo.IsStockByRepaired; //priceSetInfo = Core.Container.Instance.Resolve<IServicePriceSetInfo>().GetEntity(contractInfo.PriceSetID); qryList = new List <ICriterion>(); qryList.Add(Expression.Eq("SetID", priceSetInfo.ID)); // 报价类型 1:按类别统计报价 2:按物品分别报价 3:不参与合同报价 //if (equipmentTypeInfo.PriceSetType == 1) //{ // qryList.Add(Expression.Eq("EquipmentID", whGoodsEntity.GoodsInfo.EquipmentTypeID)); //} //if (equipmentTypeInfo.PriceSetType == 2) //{ // qryList.Add(Expression.Eq("EquipmentID", whGoodsEntity.GoodsID)); //} PriceSetGoodsInfo priceSetGoodsInfo = Core.Container.Instance.Resolve <IServicePriceSetGoodsInfo>().GetEntityByFields(qryList); if (priceSetGoodsInfo != null) { dbEntity.GoodsUnitPrice = priceSetGoodsInfo.DailyRents; //判断物品费用是日租金还是现金买赔 //if (whGoodsEntity.GoodsInfo.IsPayNow == 1) //{ // dbEntity.GoodsUnitPrice = priceSetGoodsInfo.UnitPrice; //} } else { // dbEntity.GoodsUnitPrice = whGoodsEntity.GoodsInfo.DailyRents; //判断物品费用是日租金还是现金买赔 //if (whGoodsEntity.GoodsInfo.IsPayNow == 1) //{ // dbEntity.GoodsUnitPrice = whGoodsEntity.GoodsInfo.UnitPrice; //} } dbEntity.NotOffsetNumber = 1; dbEntity.WareHouseID = int.Parse(ddlWH.SelectedValue); //保存领用主材信息 Core.Container.Instance.Resolve <IServiceContractOrderDetail>().Create(dbEntity); #endregion 主材 //辅材列表 if (OrderType == 1) { //创建发货单辅材信息 CreateFHSecondaryDetail(dbEntity, priceSetInfo, whGoodsEntity); } else { //创建收货单辅材信息 CreateSHSecondaryDetail(dbEntity, priceSetInfo, whGoodsEntity); } } } } }
public static bool ModifyPriceSet(PriceSetEntity entity) { long result = 0; if (entity != null) { PriceSetRepository mr = new PriceSetRepository(); PriceSetInfo PriceSetInfo = TranslatePriceSetInfo(entity); //ContactJsonEntity jsonlist = null; //if (!string.IsNullOrEmpty(entity.ContactJson)) //{ // try // { // jsonlist = (ContactJsonEntity)JsonHelper.FromJson(entity.ContactJson, typeof(ContactJsonEntity)); // } // catch (Exception ex) // { // string str = ex.ToString(); // } //} if (entity.PriceSetID > 0) { PriceSetInfo.PriceSetID = entity.PriceSetID; PriceSetInfo.ChangeDate = DateTime.Now; result = mr.ModifyPriceSet(PriceSetInfo); } else { PriceSetInfo.ChangeDate = DateTime.Now; PriceSetInfo.CreateDate = DateTime.Now; result = mr.CreateNew(PriceSetInfo); } #region 更新联系人信息 //if (jsonlist != null) //{ // List<ContactJson> list = jsonlist.listContact; // if (list != null && list.Count > 0) // { // foreach (ContactJson cc in list) // { // ContactRepository cr = new ContactRepository(); // ContactInfo contact = new ContactInfo(); // contact.ContactName = cc.ContactName; // contact.Mobile = cc.Mobile; // contact.Telephone = cc.Telephone; // contact.Email = cc.Email; // contact.Remark = cc.Remark; // contact.UnionType = UnionType.PriceSet.ToString();//承运商 // if (cc.ContactID > 0) // { // contact.ContactID = cc.ContactID; // contact.UnionID = entity.PriceSetID; // contact.ChangeDate = DateTime.Now; // cr.ModifyContact(contact); // } // else // { // contact.UnionID = entity.PriceSetID > 0 ? entity.PriceSetID : result; // contact.CreateDate = DateTime.Now; // contact.ChangeDate = DateTime.Now; // cr.CreateNew(contact); // } // } // } //} #endregion List <PriceSetInfo> miList = mr.GetAllPriceSet();//刷新缓存 Cache.Add("PriceSetALL", miList); } return(result > 0); }
//获取当前执行的报价体系 public string GetPriceSet(string priceID) { PriceSetInfo priceSetInfo = Core.Container.Instance.Resolve <IServicePriceSetInfo>().GetEntity(int.Parse(priceID)); return(priceSetInfo != null ? priceSetInfo.SetDate : ""); }