username@email.com
2025-10-22 0de684b2cd131f9801ca96abdb9028f7e30cd31b
CY_ECommercePlatform/CY.WebForm/Pages/Property/ShebeiWeixiuFukuanAdd.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
{
@@ -27,7 +30,8 @@
        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";
        OA_SubjectSetBLL _OA_SubjectSetBLL = null;
@@ -41,7 +45,7 @@
            oA_WorkReminderBll = new OA_WorkPlanBll();
            oA_ShebeiManageBLL = new OA_ShebeiManageBLL();
            oA_ShebeiWeixiuBLL = new OA_ShebeiWeixiuBLL();
            _OA_SubjectSetBLL = new OA_SubjectSetBLL();
        }
@@ -144,6 +148,12 @@
                JavaScript.MessageBox("已经申请付款!", this);
                return;
            }
            var shebeiManage = oA_ShebeiManageBLL.GetModelByKeyid(oA_ShebeiWeixiu.ShebeiId);
            var ShebeiZerenrenName = "";
            if (shebeiManage != null)
            {
                ShebeiZerenrenName = shebeiManage.ZerenrenName;
            }
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
@@ -166,6 +176,7 @@
                  
                  
                    oA_ShebeiWeixiu.WeixiuPrice = this.txtWeixiuPrice.Value.ToDecimal2();
                    oA_ShebeiWeixiu.Fukuanfangshi = this.selFukuanfangshi.Value;
                    oA_ShebeiWeixiu.LastUpdateTime = nowTime;
                    oA_ShebeiWeixiu.Operator = CurrentUser.ShortName;
@@ -173,94 +184,190 @@
                    OA_WorkPlan m_OA_WorkPlan = new OA_WorkPlan();
                    OA_Fukuanshenqing oA_Fukuanshenqing = new OA_Fukuanshenqing();
                    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;
                    //}
                        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);
                        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();
                        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.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;
                        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;
                        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 = 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.PlanContent = this.txtPlanRemark.Value + ".维修日期:" + this.txtWeixiuTime.Value;
                        m_OA_WorkPlan.PlanType = 3;
                        m_OA_WorkPlan.LastUpdateTime = nowTime;
                    }
                    else
                        m_OA_WorkPlan.DepartId = 0;
                    {
                        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.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;
                        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;
                    }
                    var workid = oA_WorkReminderBll.InserModelAndGetId(m_OA_WorkPlan);
                    m_OA_WorkPlan.Keyid = workid;
                    if (workid > 0)