username@email.com
4 天以前 e8e3122fdc4844202fb9e05477d47139e47a8aae
CY_ECommercePlatform/CY.WebForm/Pages/Property/ShebeiWeixiuAdd.aspx.cs
@@ -12,6 +12,9 @@
using System.Threading.Tasks;
using System.Transactions;
using CY.BLL.OA;
using System.Net;
using System.IO;
using System.Web.Script.Serialization;
namespace CY.WebForm.Pages.Property
{
@@ -22,12 +25,13 @@
        EC_OrderBasicBLL bll_EC_OrderBasicBLL = null;
        
        OA_FukuanshenqingBLL _oA_FukuanshenqingBLL = null;
        OA_SubjectSetBLL _OA_SubjectSetBLL = null;
        OA_StaffBLL bll_OA_StaffBLL = null;
        OA_WorkPlanBll oA_WorkReminderBll = null;
        OA_ShebeiManageBLL oA_ShebeiManageBLL = null;
        OA_ShebeiWeixiuBLL oA_ShebeiWeixiuBLL = null;
        string url = "https://yocaisim.51zhengcai.com/api/CYOSSetting/GetShowID";// "http://192.168.0.36:5000/api/CYOSSetting/GetShowID";
@@ -41,6 +45,7 @@
            oA_WorkReminderBll = new OA_WorkPlanBll();
            oA_ShebeiManageBLL = new OA_ShebeiManageBLL();
            oA_ShebeiWeixiuBLL = new OA_ShebeiWeixiuBLL();
            _OA_SubjectSetBLL = new OA_SubjectSetBLL();
        }
@@ -52,6 +57,10 @@
            {
                switch (Request["Target"])
                {
                    case "change":
                        Response.Write(reLoadAccountName(Request["TypeName"].ToString2()));
                        break;
                    case "GetSuplier":
                        LoadCommunication();
                        break;
@@ -85,11 +94,33 @@
                this.selShebei.DataBind();
            //this.selShebei.Items.Insert(0, new ListItem("全部", ""));
            this.selZerenren.DataSource = bll_OA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, null, null);
            this.selZerenren.DataTextField = "Name";
            this.selZerenren.DataValueField = "Keyid";
            this.selZerenren.DataBind();
            this.selZerenren.Items.Insert(0, new ListItem("全部", ""));
            this.selZerenren.Value = "";
            this.txtWeixiuTime.Value = DateTime.Now.ToString("yyyy-MM-dd");
        }
        protected string reLoadAccountName(string selAcoountType)
        {
            var query  = new Infrastructure.Query.Query();
            if (!string.IsNullOrEmpty(selAcoountType))
            {
                return JsonHelper.GetJsonStringByObject(oA_ShebeiManageBLL.SelectAllModel(query).Where(x => x.Status != 1 && x.Zerenren == selAcoountType.ToInt32()));
            }
            else
            {
                return JsonHelper.GetJsonStringByObject(oA_ShebeiManageBLL.SelectAllModel(query).Where(x => x.Status != 1));
            }
        }
        /// <summary>
        /// 加载供应商
@@ -160,11 +191,13 @@
                    oA_ShebeiWeixiu.ShebeiId = this.selShebei.Value.ToInt32();
                    oA_ShebeiWeixiu.WeixiuTime = this.txtWeixiuTime.Value.ToDateTime2();
                    var shebeiManage = oA_ShebeiManageBLL.GetModelByKeyid(oA_ShebeiWeixiu.ShebeiId);
                    var ShebeiZerenrenName = "";
                    if (shebeiManage != null)
                    {
                        oA_ShebeiWeixiu.CateId = shebeiManage.CateId;
                        oA_ShebeiWeixiu.Anzhuangdidian = shebeiManage.Anzhuangdidian;
                        oA_ShebeiWeixiu.Name = shebeiManage.Name;
                        ShebeiZerenrenName = shebeiManage.ZerenrenName;
                    }
                    oA_ShebeiWeixiu.Remark = this.txtPlanRemark.Value;
                    oA_ShebeiWeixiu.WeixiuPrice = this.txtWeixiuPrice.Value.ToDecimal2();
@@ -176,6 +209,7 @@
                    oA_ShebeiWeixiu.Creator = CurrentUser.ShortName;
                    oA_ShebeiWeixiu.LastUpdateTime = nowTime;
                    oA_ShebeiWeixiu.Operator = CurrentUser.ShortName;
                    //需要添加审批信息
@@ -184,96 +218,238 @@
                    if (this.selShifoufukuan.Value == "1" )
                    {
                        OA_Fukuanshenqing oA_Fukuanshenqing = new OA_Fukuanshenqing();
                        oA_ShebeiWeixiu.Fukuanfangshi = this.selFukuanfangshi.Value;
                        if(oA_ShebeiWeixiu.Fukuanfangshi == "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.FirmId = CurrentUser.MemberId;
                            oA_Fukuanshenqing.SupplierId = "0";
                            oA_Fukuanshenqing.Fukuanshenqingstatus = 0;
                            oA_Fukuanshenqing.ApprovalStatus = 0;
                        oA_Fukuanshenqing.Molingmoney = 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.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();
                            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 + "(" + ShebeiZerenrenName + ")" + "维修";
                            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.PlanTitle = oA_ShebeiWeixiu.Name + "(" + ShebeiZerenrenName + ")" + "维修申请";
                            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.PlanContent = this.txtPlanRemark.Value + ".维修日期:" + this.txtWeixiuTime.Value;
                            m_OA_WorkPlan.PlanType = 3;
                            m_OA_WorkPlan.LastUpdateTime = nowTime;
                        }
                        else
                        {
                            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.EvaluationStaff = "";
                            m_OA_WorkPlan.EvaluationStaffId = Guid.Empty;
                            m_OA_WorkPlan.EvaluationStatus = 2;
                            m_OA_WorkPlan.EvaluationTime = nowTime;
                            m_OA_WorkPlan.RewardMoney = 0;
                            m_OA_WorkPlan.RewardType = 1;
                            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;
                            if (string.IsNullOrEmpty(m_OA_WorkPlan.EvaluationContent))
                            {
                                try
                                {
                                    var request = (HttpWebRequest)WebRequest.Create(url);
                                    request.Method = "GET";
                                    using (var response = (HttpWebResponse)request.GetResponse())
                                    {
                                        using (var reader = new StreamReader(response.GetResponseStream()))
                                        {
                                            string content = reader.ReadToEnd();
                                            JavaScriptSerializer serializer = new JavaScriptSerializer();
                                            var person = serializer.Deserialize<Responsebody>(content);
                                            if (person != null && person.code == 1)
                                            {
                                                m_OA_WorkPlan.EvaluationContent = person.data;
                                            }
                                            else
                                            {
                                                JavaScript.MessageBox("生成报销单号失败", this);
                                                return;
                                            }
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    JavaScript.MessageBox("生成报销单号失败", this);
                                    return;
                                }
                            }
                            var oA_SubjectSet =_OA_SubjectSetBLL.getAllSubject(CurrentUser.MemberId, "贷").Where(x=>x.SubjectName == "维修配件").FirstOrDefault();
                            if (oA_SubjectSet != null)
                            {
                                m_OA_WorkPlan.RewardResult = oA_SubjectSet.Keyid.ToString();
                                m_OA_WorkPlan.RewardContent = oA_SubjectSet.SubjectName;
                            }
                            else
                            {
                                m_OA_WorkPlan.RewardResult = "0";
                                m_OA_WorkPlan.RewardContent = "其他";
                            }
                            oA_ShebeiWeixiu.FukuanshenqingId = 0;
                            m_OA_WorkPlan.PlanComplany = "";
                            m_OA_WorkPlan.Operator = CurrentUser.ShortName;
                            m_OA_WorkPlan.HoubufapiaoStatus = 3;
                            m_OA_WorkPlan.PlanContent = oA_ShebeiWeixiu.Name + "(" + ShebeiZerenrenName + ")" + "维修申请." + this.txtPlanRemark.Value + ".维修日期:" + this.txtWeixiuTime.Value; ;
                            m_OA_WorkPlan.PlanDataType = 17;
                            m_OA_WorkPlan.PlanMoney = this.txtWeixiuPrice.Value.Trim().ToDecimal2() ?? 0;
                            m_OA_WorkPlan.PlanRemark = "";
                            m_OA_WorkPlan.PlanRunTime = DateTime.Now;
                            m_OA_WorkPlan.PlanTitle = oA_ShebeiWeixiu.Name + "(" + ShebeiZerenrenName + ")" + "维修申请";
                            m_OA_WorkPlan.PlanType = 3;
                            m_OA_WorkPlan.LastUpdateTime = nowTime;
                        }
                    }
                    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.PlanTitle = oA_ShebeiWeixiu.Name + "(" + ShebeiZerenrenName + ")" + "维修申请";
                        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.PlanContent = this.txtPlanRemark.Value + ".维修日期:" + this.txtWeixiuTime.Value;
                        m_OA_WorkPlan.PlanType = 3;
                        m_OA_WorkPlan.LastUpdateTime = nowTime;
                    }
                    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)