using YLErp.Modules.SalesModule; using YLErp.Modules.TradeModule.DealModule; namespace YLErp.Web.Controllers { public class processtradelogController : BaseController { readonly YLContext db = new YLContext(); [HttpPost] public ActionResult UpdateTradeProcessLog(int tradeId, string status, string text, string additionalProcessing) { var result = new TradeOpenService(CurUser).UpdateTradeProcessLog(new TradeOpenReqModel { tradeId = tradeId, status = status, comments = text, ignoreMoneyCheck = (valuedateBLL.SystemDate.SpecialOperateForTrade == 1) && additionalProcessing == tradeBLL.LackOfMoney }); if (result.RetCode == TradeOpenRetCode.Success || string.IsNullOrWhiteSpace(result.ErrorMsg)) { if (status == "pass") { var trade = result.Trade; //生成确认书 if (PS.Config.IsAutoGenerateContracts && (trade.TradeStatus == ConsTrade.确认成交 || ConsTrade.TradeCompleteStatus.Contains(trade.TradeStatus))) { var contractType = "其它"; if (trade.TradeStatus == ConsTrade.确认成交 && trade.HasPartialUnWind != 1) { contractType = "确认书"; } new TradeContractGenerateService(CurUser).GenerateContractsAsync(new List { tradeId }, contractType); } //修改销售提成的状态 new SalesCommissionDataService(CurUser).SetCommissionVaild(trade.id); new TradeConfirmService(CurUser).EditReportStatus(trade.id); } return JsonSuccess("提交成功", string.IsNullOrEmpty(result.ChangeConfirmPath) ? null : new { generateChangeSuccess = true, url = result.ChangeConfirmPath }); } //如果客户缺少资金而交易特批已开启 if (result.RetCode == TradeOpenRetCode.LackOfMoney && (valuedateBLL.SystemDate.SpecialOperateForTrade == 1)) { return JsonSuccessData(new { proccessType = "AdditionalProcessing", type = tradeBLL.LackOfMoney, message = result.ErrorMsg }); } return JsonError("提交失败," + result.ErrorMsg); } /// /// 分组了结 主交易审批 /// /// /// /// /// /// [HttpPost] public ActionResult UpdateParentTradeProcessLog(int tradeId, string status, string text, string additionalProcessing) { var result = new TradeOpenService(CurUser).UpdateParentTradeProcessLog(new TradeOpenReqModel { tradeId = tradeId, status = status, comments = text, ignoreMoneyCheck = (valuedateBLL.SystemDate.SpecialOperateForTrade == 1) && additionalProcessing == tradeBLL.LackOfMoney }); if (result.RetCode == TradeOpenRetCode.Success || string.IsNullOrWhiteSpace(result.ErrorMsg)) { return JsonSuccess("提交成功",null); } //如果客户缺少资金而交易特批已开启 if (result.RetCode == TradeOpenRetCode.LackOfMoney && (valuedateBLL.SystemDate.SpecialOperateForTrade == 1)) { return JsonSuccessData(new { proccessType = "AdditionalProcessing", type = tradeBLL.LackOfMoney, message = result.ErrorMsg }); } return JsonError("提交失败," + result.ErrorMsg); } public ActionResult processtradelogListInner(int eid) { ViewBag.eid = eid; return View(); } [HttpPost] public JsonResult processtradelogInnerListQuery(ProcessTradeLogReq req) { var bll = new processtradelogBLL(); var sList = bll.SearchTradeList(req); return Json(sList); } } }