public ResultJSON <string> ApplyBeMyClient(string carNo, int id, PlaceType placeType) { try { string accessToken; if (placeType == PlaceType.水上) { accessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.水上计划Secret); } else { accessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.陆上计划Secret); } string agentId = placeType == PlaceType.水上 ? option.水上计划AgentId : option.陆上计划AgentId; //推送到“水上或陆上计划” MassApi.SendTextCard(accessToken, agentId, $"{UserName}申请{carNo}成为他的客户" , $"<div class=\"gray\">客户:{carNo}</div>" , $"https://vue.car0774.com/#/sales/myclient/{id.ToString()}/{UserName}", toUser: "******"); return(new ResultJSON <string> { Code = 0, Msg = "提交申请成功" }); } catch { return(new ResultJSON <string> { Code = 503, Msg = "推送失败请重试" }); } }
public ResultJSON <Purchase> ChangeState([FromBody] Purchase p) { r.CurrentUser = UserName; var model = r.Update(p); model.LastUpdatedBy = UserName; if (p.State == Purchase.UnloadState.完工) { //推送到“卸油审核” this.option.卸油审核AccessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.卸油审核Secret); MassApi.SendTextCard(option.卸油审核AccessToken, option.卸油审核AgentId, "卸油施工结束,请审核更新油仓" , $"<div class=\"gray\">单号:{model.Name}</div>" + $"<div class=\"normal\">车号:{model.CarNo}</div>" + $"<div class=\"normal\">计划数量:{model.Count}吨</div>" + $"<div class=\"normal\">卸仓数量:{model.OilCount}升</div>" + $"<div class=\"normal\">密度:{model.Density}</div>" , $"http://vue.car0774.com/#/purchase/purchase/" + model.Id + "/buyboard", toUser: "******"); } return(new ResultJSON <Purchase> { Code = 0, Data = model }); }
public void SendMsg(string toUser, string toParty, string title, string content, string url, string btntxt = null) { if (!string.IsNullOrWhiteSpace(url) && url.IndexOf("http") < 0) { url = workSetting.Value.SendMsgHost + url; } var reObj = MassApi.SendTextCard(workSetting.Value.MsgAccessTokenKey, workSetting.Value.MsgAppId, title, content, url, btntxt: btntxt, toUser: toUser, toParty: toParty); }
public ResultJSON <Store> Put([FromBody] Store model) { r.CurrentUser = UserName; //推送到“系统设置” this.option.系统设置AccessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.系统设置Secret); MassApi.SendTextCard(option.系统设置AccessToken, option.系统设置AgentId, $"{UserName}修改了{model.Name}" , $"<div class=\"gray\">时间:{DateTime.Now.ToString("yyyy-MM-dd hh:mm")}</div>" , "https://vue.car0774.com/#/oilstore/store", toUser: "******"); return(new ResultJSON <Store> { Code = 0, Data = r.InsertOrUpdate(model) }); }
public ResultJSON <string> ApplyClientToCompany(int cid, int coid, string carNo, string companyName) { try { this.option.客户AccessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.客户Secret); //推送到“客户” MassApi.SendTextCard(this.option.客户AccessToken, this.option.客户AgentId, $"{UserName}申请{carNo}编入{companyName}" , $"<div class=\"gray\">申请编入公司:{companyName}</div>" , $"https://vue.car0774.com/#/sales/clienttocompany/{cid.ToString()}/{coid.ToString()}/{companyName}", toUser: "******"); return(new ResultJSON <string> { Code = 0, Msg = "提交申请成功" }); } catch { return(new ResultJSON <string> { Code = 503, Msg = "推送失败请重试" }); } }
public ResultJSON <Purchase> Post([FromBody] Purchase p) { //判断是否重复单号 if (r.Has(pu => pu.Name == p.Name)) { return new ResultJSON <Purchase> { Code = 502 } } ; var product = p.Product; p.Product = null; r.CurrentUser = UserName; var result = r.Insert(p); //推送到“进油看板” this.option.进油看板AccessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.进油看板Secret); MassApi.SendTextCard(option.进油看板AccessToken, option.进油看板AgentId, $"{UserName}开出了进油计划单" , $"<div class=\"gray\">单号:{result.Name}</div>" + $"<div class=\"normal\">商品:{product.Name}</div>" + $"<div class=\"normal\">运输车号:{result.CarNo}{result.TrailerNo}</div>" + $"<div class=\"normal\">预计到达:{result.ArrivalTime}</div>" , $"https://vue.car0774.com/#/produce/buyboard", toUser: "******"); //推送到“陆上卸油” this.option.陆上卸油AccessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.陆上卸油Secret); MassApi.SendTextCard(option.陆上卸油AccessToken, option.陆上卸油AgentId, $"{UserName}开出了进油计划单" , $"<div class=\"gray\">单号:{result.Name}</div>" + $"<div class=\"normal\">商品:{product.Name}</div>" + $"<div class=\"normal\">运输车号:{result.CarNo}{result.TrailerNo}</div>" + $"<div class=\"normal\">预计到达:{result.ArrivalTime}</div>" , $"https://vue.car0774.com/#/produce/buyboard", toUser: "******"); return(new ResultJSON <Purchase> { Code = 0, Data = result }); }
public ResultJSON <Product> ModifyProdPrice([FromBody] List <Product> list) { r.CurrentUser = UserName; int count = r.ModifyProdPrice(list); if (count == 0) { return new ResultJSON <Product> { Code = 501, Msg = "提交的单价没有变化" } } ; if (count == -1) { return new ResultJSON <Product> { Code = 501, Msg = "保存出错,请联系开发人员" } } ; #if DEBUG //推送到“水上计划” this.option.水上计划AccessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.水上计划Secret); MassApi.SendTextCard(option.水上计划AccessToken, option.水上计划AgentId, $"{UserName}修改了{count}项商品限价" , $"<div class=\"gray\">时间:{DateTime.Now.ToString("yyyy-MM-dd hh:mm")}</div>" , "https://", toUser: "******"); //推送到“陆上计划” this.option.陆上计划AccessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.陆上计划Secret); MassApi.SendTextCard(option.陆上计划AccessToken, option.陆上计划AgentId, $"{UserName}修改了{count}项商品限价" , $"<div class=\"gray\">时间:{DateTime.Now.ToString("yyyy-MM-dd hh:mm")}</div>" , "https://", toUser: "******"); //推送到“销售单” this.option.销售单AccessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.销售单Secret); MassApi.SendTextCard(option.销售单AccessToken, option.销售单AgentId, $"{UserName}修改了{count}项商品限价" , $"<div class=\"gray\">时间:{DateTime.Now.ToString("yyyy-MM-dd hh:mm")}</div>" , "https://", toUser: "******"); #endif return(new ResultJSON <Product> { Code = 0 }); }
public ResultJSON <Purchase> Del(int id, string delreason) { try { Purchase purchase = r.SetIsDel(id, delreason); //推送到“进油看板” this.option.进油看板AccessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.进油看板Secret); MassApi.SendTextCard(option.进油看板AccessToken, option.进油看板AgentId, $"{UserName}作废了进油计划单" , $"<div class=\"gray\">单号:{purchase.Name}</div>" + $"<div class=\"normal\">原因:{purchase.DelReason}</div>" , $"https://vue.car0774.com/#/purchase/purchase/" + purchase.Id + "/buyboard", toUser: "******"); return(new ResultJSON <Purchase> { Code = 0, Data = purchase }); } catch (Exception e) { return(new ResultJSON <Purchase> { Code = 503, Msg = e.Message }); } }
public ResultJSON <Purchase> AuditingOK([FromBody] Purchase pu) { pu.State = Purchase.UnloadState.已审核; decimal infactTotal = r.UpdateStoreOil(pu); string pName = p_r.Get(pu.ProductId).Name;//取得商品名称 //更新油仓相关数量,平均单价,出入仓记录 if (infactTotal > 0) { //推送到“油仓情况” this.option.油仓情况AccessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.油仓情况Secret); MassApi.SendTextCard(option.油仓情况AccessToken, option.油仓情况AgentId, "卸油审核成功,已更新油仓油量" , $"<div class=\"gray\">卸油单号:{pu.Name}</div>" + $"<div class=\"normal\">审核人:{UserName}</div>" + $"<div class=\"normal\">商品:{pName}</div>" + $"<div class=\"normal\">计划:{pu.Count}吨</div>" + $"<div class=\"normal\">实际:{infactTotal}升</div>" + $"<div class=\"normal\">密度:{pu.Density}</div>" , $"https://vue.car0774.com/#/purchase/purchase/{pu.Id}/unloadaudit", toUser: "******"); return(new ResultJSON <Purchase> { Code = 0, Data = r.Update(pu) }); } else { return new ResultJSON <Purchase> { Code = 500, Msg = "操作失败" } }; }
public ResultJSON <SalesPlan> Post([FromBody] SalesPlan s) { //判断是否重复单号 if (r.Has(sp => sp.Name == s.Name)) { return new ResultJSON <SalesPlan> { Code = 502 } } ; //更新客户默认商品 if (!cr.SaveDefaultProduct(s.CarNo, s.ProductId)) { return new ResultJSON <SalesPlan> { Code = 501, Msg = "无法更新客户默认商品,请联系开发人员" } } ; //标识“陆上”和“水上”的单 s.IsWater = s.SalesPlanType == SalesPlanType.水上加油 || s.SalesPlanType == SalesPlanType.水上机油 ? true : false; r.CurrentUser = UserName; SalesPlan result = r.Insert(s); if (s.SalesPlanType == SalesPlanType.水上加油 || s.SalesPlanType == SalesPlanType.水上机油) { //推送到“水上计划” this.option.水上计划AccessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.水上计划Secret); MassApi.SendTextCard(option.水上计划AccessToken, option.水上计划AgentId, $"【水上】{UserName}开出计划单" , $"<div class=\"gray\">单号:{result.Name}</div>" + $"<div class=\"normal\">开单人:{UserName}</div>" + $"<div class=\"normal\">船号/车号:{result.CarNo}</div>" + $"<div class=\"normal\">单价:{result.Price}</div>" + $"<div class=\"normal\">油品:{result.OilName}</div>" , $"https://vue.car0774.com/#/sales/plan/{result.Id}/plan", toUser: "******"); //推送到“水上计划审核” this.option.水上计划审核AccessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.水上计划审核Secret); MassApi.SendTextCard(option.水上计划审核AccessToken, option.水上计划审核AgentId, $"{UserName}开计划单,请审核" , $"<div class=\"gray\">单号:{result.Name}</div>" + $"<div class=\"normal\">船号/车号:{result.CarNo}</div>" + $"<div class=\"normal\">油品:{result.OilName}</div>" , $"https://vue.car0774.com/#/sales/auditing/false", toUser: "******"); } else if (s.SalesPlanType == SalesPlanType.陆上装车 || s.SalesPlanType == SalesPlanType.汇鸿车辆加油 || s.SalesPlanType == SalesPlanType.外来车辆加油) { this.option.陆上计划AccessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.陆上计划Secret); MassApi.SendTextCard(option.陆上计划AccessToken, option.陆上计划AgentId, $"【陆上】{UserName}开出计划单" , $"<div class=\"gray\">单号:{result.Name}</div>" + $"<div class=\"normal\">开单人:{UserName}</div>" + $"<div class=\"normal\">车牌号:{result.CarNo}</div>" + $"<div class=\"normal\">油品:{result.OilName}</div>" , $"https://vue.car0774.com/#/sales/plan/{result.Id}/plan", toUser: "******"); //推送到“陆上计划审核” this.option.陆上计划审核AccessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.陆上计划审核Secret); MassApi.SendTextCard(option.陆上计划审核AccessToken, option.陆上计划审核AgentId, $"{UserName}开计划单,请审核" , $"<div class=\"gray\">单号:{result.Name}</div>" + $"<div class=\"normal\">车牌号:{result.CarNo}</div>" + $"<div class=\"normal\">油品:{result.OilName}</div>" , $"https://vue.car0774.com/#/sales/auditing/true", toUser: "******"); } return(new ResultJSON <SalesPlan> { Code = 0, Data = result }); }