public void LoadPLM_PRODUCT() { using (PLM.PLMDbContext PLMDB = new PLM.PLMDbContext(PLM_ConnStr)) { PLM_PRODUCT = PLMDB.PRODUCT.Where(o => o.DEL == false && o.STATE == "A").ToList(); } }
public void LoadPLM_MATERIAL() { using (PLM.PLMDbContext PLMDB = new PLM.PLMDbContext(PLM_ConnStr)) { PLM_MATERIAL = PLMDB.MATERIAL.Where(o => o.DEL == false && o.STATE == "A").ToList(); } }
public void LoadPLM_CONS_OBJOF() { using (PLM.PLMDbContext PLMDB = new PLM.PLMDbContext(PLM_ConnStr)) { PLM_CONS_OBJOF = PLMDB.CONS_OBJOF.Where(o => o.DEL == false && o.STATE == "A").ToList(); } }
/// <summary> /// 获取更新的BOM物料 /// </summary> /// <param name="LastGetTime"></param> /// <returns></returns> public List <DTO_MBOM> GetModBOM(DateTime LastGetTime) { List <DTO_MBOM> result = new List <DTO_MBOM>(); var PRODATA = GetNewPLMBOO(LastGetTime); string[] PartNums = new string[PRODATA.Count]; for (int i = 0; i < PRODATA.Count; i++) { PartNums[i] = PRODATA[i].PartNum.Trim(); } using (PLM.PLMDbContext PLMDB = new PLM.PLMDbContext(Connection)) { var MPART_DATA = from a in PLMDB.MPART where (a.CTIME > LastGetTime || a.MTIME > LastGetTime || a.DELTIME > LastGetTime) select a; var data = from a in PLMDB.MBOM join b in MPART_DATA on a.PID equals b.ID join c in PLMDB.MPART on a.CID equals c.ID where a.DEL == false && a.STATE == "A" && (PartNums.Contains(b.NO.Trim()) || PartNums.Contains(c.NO.Trim())) orderby a.MTIME descending, b.MTIME descending select new { bom = a, part = b }; foreach (var item in data) { DTO_MBOM obj = new DTO_MBOM(); obj.Company = "001"; obj.ECOGroupID = "manager"; obj.MtlSeq = item.bom.BOMPST.Value; obj.PartDescription = item.part.NAME; obj.PartNum = item.part.NO; obj.Plant = "MfgSys"; obj.PullAsAsm = ChkWGJ(item.part.SMEMO, "FALSE", "TRUE"); obj.QtyPer = item.bom.BNUM.Value; obj.RelatedOperation = 10; obj.RevisionNum = "A"; obj.ViewAsAsm = ChkWGJ(item.part.SMEMO, "FALSE", "TRUE"); obj.Source = item.part.SOURCE; result.Add(obj); } } return(result.ToList()); }
public List <DTO_MBOO> GetNewPLMBOO(DateTime dt) { List <DTO_MBOO> result = new List <DTO_MBOO>(); using (PLM.PLMDbContext PLMDB = new PLM.PLMDbContext(Connection)) { var data = from a in PLMDB.PROCESS join b in PLMDB.PROCESS_OBJOF on a.ID equals b.ITEMID2 join c in PLMDB.PRCV on b.ITEMID1 equals c.ID join d in PLMDB.PRCV_OBJOF on c.ID equals d.ITEMID2 join e in PLMDB.MPART on d.ITEMID1 equals e.ID where (a.CTIME > dt || a.MTIME > dt) && a.DEL == false && b.DEL == false && c.DEL == false && d.DEL == false && e.DEL == false && a.WKAID != "3" && b.WKAID != "3" && c.WKAID != "3" && d.WKAID != "3" && e.WKAID != "3" && a.STATE == "A" && a.GNO.Value > 0 && c.SEL == true select new { pc = a, pco = b, pr = c, pro = d, mp = e }; foreach (var item in data) { DTO_MBOO obj = new DTO_MBOO(); obj.Company = "001"; obj.DaysOut = IsSubcontract(item.pc.NO) ? "5" : ""; obj.ECOGroupID = "manager"; obj.LaborEntryMethod = "T"; obj.OpCode = item.pc.NO; obj.OprComment = item.pc.DETAILS; obj.OprSeq = item.pc.GNO.HasValue ? int.Parse(item.pc.GNO.Value.ToString()) : 0; obj.PartDescription = item.mp.NAME; obj.PartNum = item.mp.NO; obj.Plant = "MfgSys"; obj.ProdStandard = (item.pc.MACHT.HasValue ? item.pc.MACHT.Value : 0) + (item.pc.PRET.HasValue ? item.pc.PRET.Value : 0); obj.RevisionNum = "A"; obj.StdFormat = "HP"; obj.SubContract = IsSubcontract(item.pc.NO) ? "TRUE" : ""; obj.VendorNumVendorID = IsSubcontract(item.pc.NO) ? "999" : ""; result.Add(obj); } } return(result); }
public PLMRespository(string ConnStr, string ConfigUnit = "") { Connection = ConnStr; PLMDB = new PLM.PLMDbContext(ConnStr); Units = JsonConvert.DeserializeObject <List <DTO_Unit> >(ConfigUnit); }