|
@ -1054,34 +1054,28 @@ namespace EasyBL.WEBAPP.ShowEasy |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// UpdMinPrice(i_crm.ORIGID, oEntity.ServiceID, oEntity.LangID);
|
|
|
// UpdMinPrice(i_crm.ORIGID, oEntity.ServiceID, oEntity.LangID);
|
|
|
|
|
|
|
|
|
int? MinPrice = int.MaxValue; |
|
|
int? MinPrice = int.MaxValue; |
|
|
var saONSiteBaseInfo = db.Queryable<SETB_PDT_ONSiteItem>().Where(x => x.OrgID == i_crm.ORIGID && x.ServiceID == oEntity.ServiceID && x.LangID == oEntity.LangID).Select(x => x.Guid).ToList(); |
|
|
var saONSiteBaseInfo = db.Queryable<SETB_PDT_ONSiteItem>().Where(x => x.OrgID == i_crm.ORIGID && x.ServiceID == oEntity.ServiceID && x.LangID == oEntity.LangID).Select(x => x.Guid).ToList(); |
|
|
if (saONSiteBaseInfo.Count > 0) |
|
|
if (saONSiteBaseInfo.Count > 0) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
var ServiceCostRulesPrice = db.Queryable<SETB_PDT_ServiceCostRules>().Where(x => saONSiteBaseInfo.Contains(x.QSID)).Min(x => x.Price); |
|
|
|
|
|
if (ServiceCostRulesPrice < MinPrice) |
|
|
|
|
|
|
|
|
var ServiceCostRulesPrice = db.Queryable<SETB_PDT_ServiceCostRules>().Where(x => saONSiteBaseInfo.Contains(x.QSID)).Min(x => x.Price * SqlFunc.IIF(x.PricingMode == "N", 1, SqlFunc.ToDouble(x.Weight_Min))); |
|
|
|
|
|
if (ServiceCostRulesPrice != null) |
|
|
{ |
|
|
{ |
|
|
MinPrice = ServiceCostRulesPrice; |
|
|
|
|
|
|
|
|
if (Convert.ToInt32(ServiceCostRulesPrice) < MinPrice) |
|
|
|
|
|
{ |
|
|
|
|
|
MinPrice = Convert.ToInt32(ServiceCostRulesPrice); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var ServiceTruckCostRulesPrice = db.Queryable<SETB_PDT_ServiceTruckCostRules>().Where(x => saONSiteBaseInfo.Contains(x.QSID)).Min(x => x.Price); |
|
|
var ServiceTruckCostRulesPrice = db.Queryable<SETB_PDT_ServiceTruckCostRules>().Where(x => saONSiteBaseInfo.Contains(x.QSID)).Min(x => x.Price); |
|
|
|
|
|
|
|
|
if (ServiceTruckCostRulesPrice < MinPrice) |
|
|
if (ServiceTruckCostRulesPrice < MinPrice) |
|
|
{ |
|
|
{ |
|
|
MinPrice = ServiceTruckCostRulesPrice; |
|
|
MinPrice = ServiceTruckCostRulesPrice; |
|
|
} |
|
|
} |
|
|
var ONSiteOtherCostRulesPrice = db.Queryable<SETB_PDT_ONSiteOtherCostRules>().Where(x => saONSiteBaseInfo.Contains(x.ONSiteItemID)).Min(x => x.Price); |
|
|
var ONSiteOtherCostRulesPrice = db.Queryable<SETB_PDT_ONSiteOtherCostRules>().Where(x => saONSiteBaseInfo.Contains(x.ONSiteItemID)).Min(x => x.Price); |
|
|
|
|
|
|
|
|
if (ONSiteOtherCostRulesPrice < MinPrice) |
|
|
if (ONSiteOtherCostRulesPrice < MinPrice) |
|
|
{ |
|
|
{ |
|
|
MinPrice = ONSiteOtherCostRulesPrice; |
|
|
MinPrice = ONSiteOtherCostRulesPrice; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -1124,72 +1118,7 @@ namespace EasyBL.WEBAPP.ShowEasy |
|
|
#endregion Onsite管理編輯(新增)
|
|
|
#endregion Onsite管理編輯(新增)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 更新最低金額
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="i_crm"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private void UpdMinPrice(string sOrgID,string sServiceID,string sLangID) |
|
|
|
|
|
{ |
|
|
|
|
|
int? MinPrice = int.MaxValue; |
|
|
|
|
|
var db = SugarBase.GetIntance(); |
|
|
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
var saONSiteBaseInfo = db.Queryable<SETB_PDT_ONSiteItem>().Where(x => x.OrgID == sOrgID && x.ServiceID == sServiceID && x.LangID == sLangID).Select(x => x.Guid).ToList(); |
|
|
|
|
|
if (saONSiteBaseInfo.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
var ServiceCostRulesPrice = db.Queryable<SETB_PDT_ServiceCostRules>().Where(x => saONSiteBaseInfo.Contains(x.QSID)).Min(x => x.Price); |
|
|
|
|
|
if (ServiceCostRulesPrice < MinPrice) |
|
|
|
|
|
{ |
|
|
|
|
|
MinPrice = ServiceCostRulesPrice; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var ServiceTruckCostRulesPrice = db.Queryable<SETB_PDT_ServiceTruckCostRules>().Where(x => saONSiteBaseInfo.Contains(x.QSID)).Min(x => x.Price); |
|
|
|
|
|
|
|
|
|
|
|
if (ServiceTruckCostRulesPrice < MinPrice) |
|
|
|
|
|
{ |
|
|
|
|
|
MinPrice = ServiceTruckCostRulesPrice; |
|
|
|
|
|
} |
|
|
|
|
|
var ONSiteOtherCostRulesPrice = db.Queryable<SETB_PDT_ONSiteOtherCostRules>().Where(x => saONSiteBaseInfo.Contains(x.ONSiteItemID)).Min(x => x.Price); |
|
|
|
|
|
|
|
|
|
|
|
if (ONSiteOtherCostRulesPrice < MinPrice) |
|
|
|
|
|
{ |
|
|
|
|
|
MinPrice = ONSiteOtherCostRulesPrice; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
MinPrice = 0; |
|
|
|
|
|
} |
|
|
|
|
|
//更新最低金額
|
|
|
|
|
|
var oONSiteBaseInfo = db.Queryable<SETB_PDT_ONSiteBaseInfo>().Single(x => x.OrgID == sOrgID && x.ServiceID == sServiceID && x.LangID == sLangID); |
|
|
|
|
|
|
|
|
|
|
|
oONSiteBaseInfo.MinPrice = MinPrice; |
|
|
|
|
|
var iRel = db.Updateable(oONSiteBaseInfo) |
|
|
|
|
|
.UpdateColumns(x => new |
|
|
|
|
|
{ |
|
|
|
|
|
x.MinPrice |
|
|
|
|
|
}).ExecuteCommand(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
var sMsg = Util.GetLastExceptionMsg(ex); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Plan(修改)
|
|
|
#region Plan(修改)
|
|
@ -1379,11 +1308,13 @@ namespace EasyBL.WEBAPP.ShowEasy |
|
|
var saONSiteBaseInfo = db.Queryable<SETB_PDT_ONSiteItem>().Where(x => x.OrgID == i_crm.ORIGID && x.ServiceID == oEntity.ServiceID && x.LangID == oEntity.LangID).Select(x => x.Guid).ToList(); |
|
|
var saONSiteBaseInfo = db.Queryable<SETB_PDT_ONSiteItem>().Where(x => x.OrgID == i_crm.ORIGID && x.ServiceID == oEntity.ServiceID && x.LangID == oEntity.LangID).Select(x => x.Guid).ToList(); |
|
|
if (saONSiteBaseInfo.Count > 0) |
|
|
if (saONSiteBaseInfo.Count > 0) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
var ServiceCostRulesPrice = db.Queryable<SETB_PDT_ServiceCostRules>().Where(x => saONSiteBaseInfo.Contains(x.QSID)).Min(x => x.Price); |
|
|
|
|
|
if (ServiceCostRulesPrice < MinPrice) |
|
|
|
|
|
|
|
|
var ServiceCostRulesPrice = db.Queryable<SETB_PDT_ServiceCostRules>().Where(x => saONSiteBaseInfo.Contains(x.QSID)).Min(x => x.Price * SqlFunc.IIF(x.PricingMode == "N", 1, SqlFunc.ToDouble(x.Weight_Min))); |
|
|
|
|
|
if (ServiceCostRulesPrice != null) |
|
|
{ |
|
|
{ |
|
|
MinPrice = ServiceCostRulesPrice; |
|
|
|
|
|
|
|
|
if (Convert.ToInt32(ServiceCostRulesPrice) < MinPrice) |
|
|
|
|
|
{ |
|
|
|
|
|
MinPrice = Convert.ToInt32(ServiceCostRulesPrice); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var ServiceTruckCostRulesPrice = db.Queryable<SETB_PDT_ServiceTruckCostRules>().Where(x => saONSiteBaseInfo.Contains(x.QSID)).Min(x => x.Price); |
|
|
var ServiceTruckCostRulesPrice = db.Queryable<SETB_PDT_ServiceTruckCostRules>().Where(x => saONSiteBaseInfo.Contains(x.QSID)).Min(x => x.Price); |
|
@ -1398,10 +1329,6 @@ namespace EasyBL.WEBAPP.ShowEasy |
|
|
{ |
|
|
{ |
|
|
MinPrice = ONSiteOtherCostRulesPrice; |
|
|
MinPrice = ONSiteOtherCostRulesPrice; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -1780,12 +1707,8 @@ namespace EasyBL.WEBAPP.ShowEasy |
|
|
var sServiceID = _fetchString(i_crm, @"ServiceID"); |
|
|
var sServiceID = _fetchString(i_crm, @"ServiceID"); |
|
|
var sLangID = _fetchString(i_crm, @"LangID"); |
|
|
var sLangID = _fetchString(i_crm, @"LangID"); |
|
|
var sPlanID = _fetchString(i_crm, @"PlanID"); |
|
|
var sPlanID = _fetchString(i_crm, @"PlanID"); |
|
|
|
|
|
|
|
|
var iRel = db.Deleteable<SETB_PDT_ONSiteItem>().Where(x => x.Guid == sPlanID && x.ServiceID == sServiceID && x.LangID == sLangID).ExecuteCommand(); |
|
|
var iRel = db.Deleteable<SETB_PDT_ONSiteItem>().Where(x => x.Guid == sPlanID && x.ServiceID == sServiceID && x.LangID == sLangID).ExecuteCommand(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var iRel1 = db.Deleteable<SETB_PDT_ServiceCostRules>().Where(x => x.QSID == sPlanID).ExecuteCommand(); |
|
|
|
|
|
|
|
|
var iRel1 = db.Deleteable<SETB_PDT_ServiceCostRules>().Where(x => x.QSID == sPlanID).ExecuteCommand(); |
|
|
iRel1 = db.Deleteable<SETB_PDT_ServiceTruckCostRules>().Where(x => x.QSID == sPlanID).ExecuteCommand(); |
|
|
iRel1 = db.Deleteable<SETB_PDT_ServiceTruckCostRules>().Where(x => x.QSID == sPlanID).ExecuteCommand(); |
|
|
iRel1 = db.Deleteable<SETB_PDT_ServiceTruckOtherCost>().Where(x => x.QSID == sPlanID).ExecuteCommand(); |
|
|
iRel1 = db.Deleteable<SETB_PDT_ServiceTruckOtherCost>().Where(x => x.QSID == sPlanID).ExecuteCommand(); |
|
|
iRel1 = db.Deleteable<SETB_PDT_ServiceTruckOtherCost>().Where(x => x.QSID == sPlanID).ExecuteCommand(); |
|
|
iRel1 = db.Deleteable<SETB_PDT_ServiceTruckOtherCost>().Where(x => x.QSID == sPlanID).ExecuteCommand(); |
|
@ -1796,11 +1719,14 @@ namespace EasyBL.WEBAPP.ShowEasy |
|
|
var saONSiteBaseInfo = db.Queryable<SETB_PDT_ONSiteItem>().Where(x => x.OrgID == i_crm.ORIGID && x.ServiceID == sServiceID && x.LangID == sLangID).Select(x => x.Guid).ToList(); |
|
|
var saONSiteBaseInfo = db.Queryable<SETB_PDT_ONSiteItem>().Where(x => x.OrgID == i_crm.ORIGID && x.ServiceID == sServiceID && x.LangID == sLangID).Select(x => x.Guid).ToList(); |
|
|
if (saONSiteBaseInfo.Count > 0) |
|
|
if (saONSiteBaseInfo.Count > 0) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
var ServiceCostRulesPrice = db.Queryable<SETB_PDT_ServiceCostRules>().Where(x => saONSiteBaseInfo.Contains(x.QSID)).Min(x => x.Price); |
|
|
|
|
|
if (ServiceCostRulesPrice < MinPrice) |
|
|
|
|
|
|
|
|
var ServiceCostRulesPrice = db.Queryable<SETB_PDT_ServiceCostRules>().Where(x => saONSiteBaseInfo.Contains(x.QSID)).Min(x => x.Price * SqlFunc.IIF(x.PricingMode == "N", 1, SqlFunc.ToDouble(x.Weight_Min))); |
|
|
|
|
|
if (ServiceCostRulesPrice != null) |
|
|
{ |
|
|
{ |
|
|
MinPrice = ServiceCostRulesPrice; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Convert.ToInt32(ServiceCostRulesPrice) < MinPrice) |
|
|
|
|
|
{ |
|
|
|
|
|
MinPrice = Convert.ToInt32(ServiceCostRulesPrice); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var ServiceTruckCostRulesPrice = db.Queryable<SETB_PDT_ServiceTruckCostRules>().Where(x => saONSiteBaseInfo.Contains(x.QSID)).Min(x => x.Price); |
|
|
var ServiceTruckCostRulesPrice = db.Queryable<SETB_PDT_ServiceTruckCostRules>().Where(x => saONSiteBaseInfo.Contains(x.QSID)).Min(x => x.Price); |
|
@ -1815,10 +1741,6 @@ namespace EasyBL.WEBAPP.ShowEasy |
|
|
{ |
|
|
{ |
|
|
MinPrice = ONSiteOtherCostRulesPrice; |
|
|
MinPrice = ONSiteOtherCostRulesPrice; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -1877,15 +1799,10 @@ namespace EasyBL.WEBAPP.ShowEasy |
|
|
{ |
|
|
{ |
|
|
var sServiceID = _fetchString(i_crm, @"ServiceID"); |
|
|
var sServiceID = _fetchString(i_crm, @"ServiceID"); |
|
|
var iRel = db.Deleteable<SETB_PDT_ONSiteBaseInfo>().Where(x => x.ServiceID == sServiceID).ExecuteCommand(); |
|
|
var iRel = db.Deleteable<SETB_PDT_ONSiteBaseInfo>().Where(x => x.ServiceID == sServiceID).ExecuteCommand(); |
|
|
var iRel1 = db.Deleteable<SETB_PDT_ServiceByPPTime>().Where(x => x.ServiceID == sServiceID).ExecuteCommand(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var iRel1 = db.Deleteable<SETB_PDT_ServiceByPPTime>().Where(x => x.ServiceID == sServiceID).ExecuteCommand(); |
|
|
iRel1 = db.Deleteable<SETB_PDT_ServiceByFQA>().Where(x => x.ServiceID == sServiceID).ExecuteCommand(); |
|
|
iRel1 = db.Deleteable<SETB_PDT_ServiceByFQA>().Where(x => x.ServiceID == sServiceID).ExecuteCommand(); |
|
|
|
|
|
|
|
|
iRel1 = db.Deleteable<SETB_PDT_ServiceByOther>().Where(x => x.ServiceID == sServiceID).ExecuteCommand(); |
|
|
iRel1 = db.Deleteable<SETB_PDT_ServiceByOther>().Where(x => x.ServiceID == sServiceID).ExecuteCommand(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
iRel1 = db.Deleteable<SETB_PDT_ServiceBySuitPlace>().Where(x => x.ServiceID == sServiceID).ExecuteCommand(); |
|
|
iRel1 = db.Deleteable<SETB_PDT_ServiceBySuitPlace>().Where(x => x.ServiceID == sServiceID).ExecuteCommand(); |
|
|
|
|
|
|
|
|
var saONSiteBaseInfo = db.Queryable<SETB_PDT_ONSiteItem>().Where(x => x.ServiceID == sServiceID).Select(x => x.Guid).ToList(); |
|
|
var saONSiteBaseInfo = db.Queryable<SETB_PDT_ONSiteItem>().Where(x => x.ServiceID == sServiceID).Select(x => x.Guid).ToList(); |
|
|
if (saONSiteBaseInfo.Count > 0) |
|
|
if (saONSiteBaseInfo.Count > 0) |
|
|
{ |
|
|
{ |
|
@ -1896,7 +1813,6 @@ namespace EasyBL.WEBAPP.ShowEasy |
|
|
iRel1 = db.Deleteable<SETB_PDT_ServiceTruckOtherCost>().Where(x => x.QSID == ONSiteItemGuid).ExecuteCommand(); |
|
|
iRel1 = db.Deleteable<SETB_PDT_ServiceTruckOtherCost>().Where(x => x.QSID == ONSiteItemGuid).ExecuteCommand(); |
|
|
iRel1 = db.Deleteable<SETB_PDT_ServiceTruckOtherCost>().Where(x => x.QSID == ONSiteItemGuid).ExecuteCommand(); |
|
|
iRel1 = db.Deleteable<SETB_PDT_ServiceTruckOtherCost>().Where(x => x.QSID == ONSiteItemGuid).ExecuteCommand(); |
|
|
iRel1 = db.Deleteable<SETB_PDT_ONSiteOtherCostRules>().Where(x => x.ONSiteItemID == ONSiteItemGuid).ExecuteCommand(); |
|
|
iRel1 = db.Deleteable<SETB_PDT_ONSiteOtherCostRules>().Where(x => x.ONSiteItemID == ONSiteItemGuid).ExecuteCommand(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
iRel1 = db.Deleteable<SETB_PDT_ONSiteItem>().Where(x => x.ServiceID == sServiceID).ExecuteCommand(); |
|
|
iRel1 = db.Deleteable<SETB_PDT_ONSiteItem>().Where(x => x.ServiceID == sServiceID).ExecuteCommand(); |
|
|