Beispiel #1
0
        /// <summary>
        /// 有以前的通过Excel表读取数据模式改为现在的直接读取ERP中数据,通过周期调用此函数,周期存库
        /// </summary>
        /// <param name="json1"></param>
        /// <returns></returns>
        public void ERPSubmit()
        {
            try
            {
                PersonManagment   PM       = new PersonManagment();
                A6dot2Managment   WM       = new A6dot2Managment();
                A6dot2Tab1        WDT_list = new A6dot2Tab1();
                ERPInfoManagement erp      = new ERPInfoManagement();
                EquipManagment    EM       = new EquipManagment();

                string EquipPhaseB;
                WDT_list.uploadDesc      = ""; //字段保留,(以前用于上传五定表的描述)
                WDT_list.uuploadFileName = ""; //字段保留,(以前用于上传五定表的名字)
                //string[] savedFileName = WDT_list.uuploadFileName.Split(new char[] { '$' });
                //string wdt_filename = Path.Combine(Request.MapPath("~/Upload"), savedFileName[1]);//没有用到的变量
                //WDT_list.userName = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
                WDT_list.userName   = "******";
                WDT_list.uploadtime = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss");
                //WDT_list.pqName = PM.Get_Person_Depart((Session["User"] as EquipModel.Entities.Person_Info).Person_Id).Depart_Name;
                WDT_list.pqName = "待定";
                int WDT_ID = WM.add_WDT_list(WDT_list);

                List <OilInfo> OilInfo_Overdue = erp.getOilInfo_overdue();

                List <A6dot2Tab2> wdt_list = new List <A6dot2Tab2>();
                foreach (var i in OilInfo_Overdue)
                {
                    A6dot2Tab2 tmp = new A6dot2Tab2();
                    tmp.isValid            = 1;
                    tmp.equipCode          = i.oil_EquipCode;
                    tmp.equipDesc          = i.oil_EquipDesc;
                    tmp.funLoc             = i.oil_Fun_Loc;
                    tmp.funLoc_desc        = i.oil_Fun_LocDesc;
                    tmp.oilLoc             = i.oil_Loc;
                    tmp.oilLoc_desc        = i.oil_Loc;
                    tmp.oilInterval        = Convert.ToInt32(i.oil_Interval);
                    tmp.unit               = i.oil_Unit;
                    tmp.lastOilTime        = i.oil_LastDate;
                    tmp.lastOilNumber      = Convert.ToDouble(i.oil_LastNum);
                    tmp.lastOilUnit        = i.oil_Unit;
                    tmp.NextOilTime        = i.oil_NextDate.ToString();
                    tmp.NextOilNumber      = Convert.ToDouble(i.oil_NextNum);
                    tmp.NextOilUnit        = i.oil_Unit2;
                    tmp.oilCode            = i.oil_Code;
                    tmp.oilCode_desc       = i.oil_Desc;
                    tmp.substiOilCode      = "";
                    tmp.substiOilCode_desc = "";
                    if (EM.getEquip_Info(tmp.equipCode) != null)
                    {
                        EquipPhaseB = EM.getEquip_Info(tmp.equipCode).Equip_PhaseB;
                        if (EquipPhaseB == null)
                        {
                            tmp.isOilType = 0;
                        }
                        else
                        {
                            if (EquipPhaseB.Equals("机泵") || EquipPhaseB.Equals("风机"))
                            {
                                tmp.isOilType = 1;
                            }
                            else
                            {
                                tmp.isOilType = 0;
                            }
                        }
                        List <Equip_Archi> ZzCj = EM.getEquip_ZzBelong(EM.getEquip_Info(tmp.equipCode).Equip_Id);
                        tmp.equip_ZzName = ZzCj.First().EA_Name;
                        tmp.equip_CjName = ZzCj.Last().EA_Name;
                        tmp.equip_PqName = EM.GetPqofZz(tmp.equip_ZzName).Pq_Name;
                    }

                    tmp.isExceed = 1;
                    tmp.Tab1_Id  = WDT_ID;
                    wdt_list.Add(tmp);
                }
                WM.add_WDT_content(WDT_ID, wdt_list);

                /*  foreach(var i in wdt_content)
                 * {
                 *    return i.equip_CjName;
                 * }
                 * */

                // return "/A6dot2/Index_Tj";
            }
            catch { }
        }