using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CY.BLL.EC; using CY.Model; using CY.Infrastructure.Common; using CY.BLL.Integrity; using CY.BLL; using System.Threading.Tasks; using System.Transactions; using CY.BLL.OA; namespace CY.WebForm.Pages.Property { //吴辉 //卖家评价 public partial class ShebeiWeixiuFukuanAdd : BasePage { EC_OrderBasicBLL bll_EC_OrderBasicBLL = null; OA_FukuanshenqingBLL _oA_FukuanshenqingBLL = null; OA_StaffBLL bll_OA_StaffBLL = null; OA_WorkPlanBll oA_WorkReminderBll = null; OA_ShebeiManageBLL oA_ShebeiManageBLL = null; OA_ShebeiWeixiuBLL oA_ShebeiWeixiuBLL = null; //初始化 public ShebeiWeixiuFukuanAdd() { bll_EC_OrderBasicBLL = new EC_OrderBasicBLL(); _oA_FukuanshenqingBLL = new OA_FukuanshenqingBLL(); bll_OA_StaffBLL = new OA_StaffBLL(); oA_WorkReminderBll = new OA_WorkPlanBll(); oA_ShebeiManageBLL = new OA_ShebeiManageBLL(); oA_ShebeiWeixiuBLL = new OA_ShebeiWeixiuBLL(); } //页面加载 protected void Page_Load(object sender, EventArgs e) { try { switch (Request["Target"]) { case "GetSuplier": LoadCommunication(); break; default: if (!IsPostBack) { InitData(); } return; } } catch (Exception ex) { PAGEHandleException(ex); Response.Clear(); //Response.Write("-1"); Response.Write(ex.Message); } Response.End(); } //绑定数据 public void InitData() { this.txtWeixiuTime.Value = DateTime.Now.ToString("yyyy-MM-dd"); var keyid = Request["keyid"]; var oA_ShebeiWeixiu =oA_ShebeiWeixiuBLL.GetModelByKeyid(keyid.ToInt32()); if (oA_ShebeiWeixiu!=null) { this.ShebeiName.InnerText = oA_ShebeiWeixiu.Name; this.txtPlanRemark.InnerText = oA_ShebeiWeixiu.Remark; this.txtWeixiuTime.Value = oA_ShebeiWeixiu.WeixiuTime.HasValue ? oA_ShebeiWeixiu.WeixiuTime.Value.ToString("yyyy-MM-dd") : ""; this.txtWeixiuPrice.Value = oA_ShebeiWeixiu.WeixiuPrice.Value.ToString("F2"); } } /// /// 加载供应商 /// private void LoadCommunication() { //Response.Clear(); //string id = Request["id"]; //if (string.IsNullOrEmpty(id)) //{ // Response.Write("-2"); // return; //} //var oA_Suppliers = _OA_SuppliersBLL.getSingleSupplier(id); //Response.Write(null == oA_Suppliers ? "" : JsonHelper.GetJsonStringByObject(oA_Suppliers)); } //提交事件 protected void btn_Submit_form(object sender, EventArgs e) { AcceptAll3(); } /// /// 批量开票申请 /// public void AcceptAll3() { if ( string.IsNullOrEmpty(this.txtWeixiuPrice.Value)) { JavaScript.MessageBox("请输入申请金额!", this); return; } var keyid = Request["keyid"]; var oA_ShebeiWeixiu = oA_ShebeiWeixiuBLL.GetModelByKeyid(keyid.ToInt32()); if (oA_ShebeiWeixiu.FukuanShebeiId.HasValue && oA_ShebeiWeixiu.FukuanShebeiId.Value>0) { JavaScript.MessageBox("已经申请付款!", this); return; } using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted, Timeout = TransactionManager.MaximumTimeout } ) ) { try { bool result = false; DateTime nowTime = DateTime.Now; oA_ShebeiWeixiu.WeixiuPrice = this.txtWeixiuPrice.Value.ToDecimal2(); oA_ShebeiWeixiu.LastUpdateTime = nowTime; oA_ShebeiWeixiu.Operator = CurrentUser.ShortName; //需要添加审批信息 OA_WorkPlan m_OA_WorkPlan = new OA_WorkPlan(); OA_Fukuanshenqing oA_Fukuanshenqing = new OA_Fukuanshenqing(); oA_Fukuanshenqing.FirmId = CurrentUser.MemberId; oA_Fukuanshenqing.SupplierId = "0"; oA_Fukuanshenqing.Fukuanshenqingstatus = 0; oA_Fukuanshenqing.ApprovalStatus = 0; oA_Fukuanshenqing.Molingmoney = 0; oA_Fukuanshenqing.Fukuanmoney = this.txtWeixiuPrice.Value.ToDecimal2(); oA_Fukuanshenqing.Bank = ""; oA_Fukuanshenqing.Huming = ""; oA_Fukuanshenqing.AccountID = ""; oA_Fukuanshenqing.Yishoumoney = 0; oA_Fukuanshenqing.Youwufapiao = 0; oA_Fukuanshenqing.Fukuanyongtu = "设备维修费"; oA_Fukuanshenqing.FukuanStatus = 1; oA_Fukuanshenqing.remark = ""; oA_Fukuanshenqing.DindanId = ""; oA_Fukuanshenqing.Creater = CurrentUser.ShortName; oA_Fukuanshenqing.CreateTime = nowTime; oA_Fukuanshenqing.Updater = CurrentUser.ShortName; oA_Fukuanshenqing.LastUpdateTime = nowTime; //var oA_Suppliers = _OA_SuppliersBLL.getSingleSupplier(this.selSuppliers.Value); //var _SupplierName = ""; //if (oA_Suppliers != null) //{ // _SupplierName = oA_Suppliers.Name; //} var _SupplierName = oA_ShebeiWeixiu.Name + "维修"; oA_Fukuanshenqing.SupplierName = _SupplierName; var id = _oA_FukuanshenqingBLL.InsertModel(oA_Fukuanshenqing); oA_ShebeiWeixiu.FukuanshenqingId = id; m_OA_WorkPlan.PlanComplany = id.ToString(); m_OA_WorkPlan.ApprovalContent = ""; m_OA_WorkPlan.ApprovalStaffId = Guid.Empty; m_OA_WorkPlan.ApprovalStaffName = ""; m_OA_WorkPlan.ApprovalStatus = 0; m_OA_WorkPlan.ApprovalTime = nowTime; m_OA_WorkPlan.EvaluationContent = ""; m_OA_WorkPlan.EvaluationStaff = ""; m_OA_WorkPlan.EvaluationStaffId = Guid.Empty; m_OA_WorkPlan.EvaluationStatus = 0; m_OA_WorkPlan.EvaluationTime = nowTime; m_OA_WorkPlan.RewardContent = ""; m_OA_WorkPlan.RewardMoney = 0; m_OA_WorkPlan.RewardResult = ""; m_OA_WorkPlan.RewardType = 0; m_OA_WorkPlan.PlanStartTime = nowTime; m_OA_WorkPlan.PlanStatus = 1; m_OA_WorkPlan.SentStaffId = CurrentUser.TrueMemberId; m_OA_WorkPlan.MemberId = CurrentUser.MemberId; OA_Staff m_OA_Staff = bll_OA_StaffBLL.GetModelByMemberId(CurrentUser.TrueMemberId); if (m_OA_Staff != null) m_OA_WorkPlan.DepartId = m_OA_Staff.DepartmentId; else m_OA_WorkPlan.DepartId = 0; m_OA_WorkPlan.PlanPeople = CurrentUser.TrueName; m_OA_WorkPlan.ReciveStaffId = CurrentUser.TrueMemberId; m_OA_WorkPlan.Operator = CurrentUser.ShortName; m_OA_WorkPlan.PlanContent = oA_ShebeiWeixiu.Name+ "维修付款申请"; m_OA_WorkPlan.PlanDataType = 19; m_OA_WorkPlan.PlanMoney = this.txtWeixiuPrice.Value.ToDecimal2(); m_OA_WorkPlan.RewardMoney = 0; m_OA_WorkPlan.PlanRemark = ""; m_OA_WorkPlan.PlanRunTime = DateTime.Now; m_OA_WorkPlan.PlanTitle = this.txtPlanRemark.Value+ ".维修日期:"+ this.txtWeixiuTime.Value; m_OA_WorkPlan.PlanType = 3; m_OA_WorkPlan.LastUpdateTime = nowTime; var workid = oA_WorkReminderBll.InserModelAndGetId(m_OA_WorkPlan); m_OA_WorkPlan.Keyid = workid; if (workid > 0) { oA_ShebeiWeixiu.FukuanShebeiId = workid; var ssss = oA_ShebeiWeixiuBLL.UpdateModel(oA_ShebeiWeixiu); } result = true; if (!result) { return; } //} scope.Complete(); } catch (Exception ex) { // 回滚事务 } finally { // 释放资源 scope.Dispose(); } } //JavaScript.MessageBox("提交成功", this); //操作成功 JavaScript.MessageBox("提交成功", this, true, true); } } }