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 ShebeiWeixiuAdd : 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 ShebeiWeixiuAdd()
|
{
|
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.selShebei.DataSource = oA_ShebeiManageBLL.SelectAllModel(null).Where(x=>x.Status == 2);
|
this.selShebei.DataBind();
|
//this.selShebei.Items.Insert(0, new ListItem("全部", ""));
|
|
this.txtWeixiuTime.Value = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
}
|
|
|
/// <summary>
|
/// 加载供应商
|
/// </summary>
|
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();
|
}
|
|
/// <summary>
|
/// 批量开票申请
|
/// </summary>
|
public void AcceptAll3()
|
{
|
|
if (string.IsNullOrEmpty(this.selShebei.Value))
|
{
|
JavaScript.MessageBox("请选择维修设备!", this);
|
return;
|
}
|
|
if (this.selShifoufukuan.Value == "1" && string.IsNullOrEmpty(this.txtWeixiuPrice.Value))
|
{
|
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;
|
|
|
var oA_ShebeiWeixiu = new OA_ShebeiWeixiu();
|
oA_ShebeiWeixiu.MemberId = CurrentUser.MemberId;
|
oA_ShebeiWeixiu.ShebeiId = this.selShebei.Value.ToInt32();
|
oA_ShebeiWeixiu.WeixiuTime = this.txtWeixiuTime.Value.ToDateTime2();
|
var shebeiManage = oA_ShebeiManageBLL.GetModelByKeyid(oA_ShebeiWeixiu.ShebeiId);
|
if (shebeiManage != null)
|
{
|
oA_ShebeiWeixiu.CateId = shebeiManage.CateId;
|
oA_ShebeiWeixiu.Anzhuangdidian = shebeiManage.Anzhuangdidian;
|
oA_ShebeiWeixiu.Name = shebeiManage.Name;
|
}
|
oA_ShebeiWeixiu.Remark = this.txtPlanRemark.Value;
|
oA_ShebeiWeixiu.WeixiuPrice = this.txtWeixiuPrice.Value.ToDecimal2();
|
oA_ShebeiWeixiu.Zerenren = 0;
|
oA_ShebeiWeixiu.ZerenrenName = "";
|
oA_ShebeiWeixiu.DanzePrice = 0;
|
oA_ShebeiWeixiu.Shifoufufei = 2;
|
oA_ShebeiWeixiu.CreateTime = nowTime;
|
oA_ShebeiWeixiu.Creator = CurrentUser.ShortName;
|
oA_ShebeiWeixiu.LastUpdateTime = nowTime;
|
oA_ShebeiWeixiu.Operator = CurrentUser.ShortName;
|
|
//需要添加审批信息
|
|
OA_WorkPlan m_OA_WorkPlan = new OA_WorkPlan();
|
|
|
if (this.selShifoufukuan.Value == "1" )
|
{
|
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();
|
}
|
else
|
{
|
m_OA_WorkPlan.PlanComplany = "";
|
}
|
|
|
|
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 = 18;
|
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.WeixiuShebeiId = workid;
|
|
|
if (this.selShifoufukuan.Value == "1")
|
{
|
oA_ShebeiWeixiu.FukuanShebeiId = workid;
|
}
|
|
|
var ssss = oA_ShebeiWeixiuBLL.InsertModel(oA_ShebeiWeixiu);
|
}
|
|
|
|
result = true;
|
|
|
|
|
|
|
|
|
|
if (!result)
|
{
|
return;
|
}
|
//}
|
scope.Complete();
|
}
|
catch (Exception ex)
|
{
|
// 回滚事务
|
}
|
finally
|
{
|
// 释放资源
|
scope.Dispose();
|
}
|
}
|
//JavaScript.MessageBox("提交成功", this);
|
|
//操作成功
|
JavaScript.MessageBox("提交成功", this, true, true);
|
}
|
|
}
|
}
|