public static bool DownloadServerFiles() { //同步服务器时间 SpareEntities db = EntitiesFactory.CreateSpareInstance(); DateTime dtNow = db.Database.SqlQuery <DateTime>("select getdate()").FirstOrDefault(); if (dtNow != null) { TimeHelper.SyncTime(DateTime.Parse(dtNow.ToString())); } bool bReturn = false; int iFind = -1; Updates servers = GetServerFilesInfo(); if (servers == null) { return(bReturn); } Updates locals = new Updates(); GetLocalFilesInfo(locals, new System.IO.DirectoryInfo(Application.StartupPath)); string sFullname = ""; string sPath = ""; foreach (UpdateItem item in servers) { iFind = locals.Find(item.FileName); if (iFind >= 0) { if (item.ModifyDate > locals[iFind].ModifyDate.AddSeconds(5)) { Application.DoEvents(); sFullname = Application.StartupPath + @"\updatetmp\" + item.FileName; sPath = Path.GetDirectoryName(sFullname); if (!Directory.Exists(sPath)) { Directory.CreateDirectory(sPath); } FileStream tmpfs = (FileStream)LoadFileFromDB(db, "Update", item.FileName, sFullname); tmpfs.Close(); bReturn = true; } } else { Application.DoEvents(); sFullname = Application.StartupPath + @"\updatetmp\" + item.FileName; sPath = Path.GetDirectoryName(sFullname); if (!Directory.Exists(sPath)) { Directory.CreateDirectory(sPath); } FileStream tmpfs = (FileStream)LoadFileFromDB(db, "BLMUpdate", item.FileName, sFullname); tmpfs.Close(); bReturn = true; } } return(bReturn); }
private void btnAdd_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "文件(*.*)|*.*"; if (dlg.ShowDialog() == DialogResult.OK) { var attach = new TA_Attach() { TableName = TableName, TablePKID = TablePKID, CreateDate = DateTime.Now, CreatorName = GlobalVar.Oper.OperName, FileName = Path.GetFileName(dlg.FileName) }; FileStream fs = File.OpenRead(dlg.FileName); fs.Position = 0; byte[] blobdata = new Byte[fs.Length]; fs.Read(blobdata, 0, (int)fs.Length); attach.FileData = blobdata; fs.Close(); SpareEntities db = EntitiesFactory.CreateSpareInstance(); AttachController.AddOrUpdate(db, attach, GlobalVar.Oper); EntitiesFactory.SaveDb(db); MessageHelper.ShowInfo("保存成功!"); RefreshData(); } }
private void BtnSave_Click(object sender, EventArgs e) { try { bs.EndEdit(); if (_bill.单据类型 != (int)BillType.MaterialAsk) { MessageHelper.ShowError("请输入有效的单据类型!申请单单据类型为:" + (int)BillType.MaterialAsk); return; } if (_bill.子单据类型 != (int)SubBillType.SpareLoan && _bill.子单据类型 != (int)SubBillType.SpareOut) { MessageHelper.ShowError("维护的子单据类型无效!领用出库类型为:" + (int)SubBillType.SpareOut + "借用出库类型为:" + (int)SubBillType.SpareLoan); return; } var detailList = (List <TB_ASK>)bs.DataSource; if (detailList.Count == 0) { MessageHelper.ShowError("请维护领用申请明细!"); return; } var bill = _bill.VWToBill(GlobalVar.Oper.DeptCode); //List<TB_ASK> detailList = (from TB_ASK d in _list select d).ToList(); SpareEntities db = EntitiesFactory.CreateSpareInstance(); BillHandler.AddMaterialAsk(db, bill, detailList); EntitiesFactory.SaveDb(db); MessageHelper.ShowInfo("保存成功!"); } catch (Exception ex) { MessageHelper.ShowInfo(ex.ToString()); } }
private void BtnSave_Click(object sender, EventArgs e) { try { bs.EndEdit(); if (_bill.单据类型 != (int)BillType.StockMove) { MessageHelper.ShowError("请输入有效的单据类型!移库单据类型为:" + (int)BillType.StockMove); return; } var detailList = (List <TB_STOCK_MOVE>)bs.DataSource; if (detailList.Count == 0) { MessageHelper.ShowError("请维护移动明细!"); return; } SpareEntities db = EntitiesFactory.CreateSpareInstance(); BillHandler.AddStockMove(db, _bill.VWToBill(GlobalVar.Oper.DeptCode), detailList); EntitiesFactory.SaveDb(db); MessageHelper.ShowInfo("保存成功!"); } catch (Exception ex) { MessageHelper.ShowInfo(ex.ToString()); } }
private void BtnSave_Click(object sender, EventArgs e) { try { bs.EndEdit(); if (_bill.单据类型 != (int)BillType.OtherInOut) { MessageHelper.ShowError("请输入有效的单据类型!其他出入库单据类型为:" + (int)BillType.OtherInOut); return; } if (_bill.子单据类型 != (int)SubBillType.OtherIn) { MessageHelper.ShowError("维护的子单据类型无效!其他入库类型为:" + (int)SubBillType.OtherIn); return; } var detailList = (List <TB_OTHER_IN>)bs.DataSource; if (detailList.Count == 0) { MessageHelper.ShowError("请维护其他入库明细!"); return; } SpareEntities db = EntitiesFactory.CreateSpareInstance(); BillHandler.AddOtherIn(db, _bill.VWToBill(GlobalVar.Oper.DeptCode), detailList); EntitiesFactory.SaveDb(db); NotifyController.AddStockSafeQty(db, GlobalVar.Oper.OperName); MessageHelper.ShowInfo("保存成功!"); } catch (Exception ex) { MessageHelper.ShowInfo(ex.ToString()); } }
private void BtnSave_Click(object sender, EventArgs e) { try { bs.EndEdit(); if (_bill.单据类型 != (int)BillType.SpareReturn) { MessageHelper.ShowError("请输入有效的单据类型!领用归还单据类型为:" + (int)BillType.SpareReturn); return; } var detailList = (List <TB_RETURN>)bs.DataSource; if (detailList.Count == 0) { MessageHelper.ShowError("请维护领用还回明细!"); return; } //List<TB_RETURN> detailList = (from TB_RETURN d in _list select d).ToList(); SpareEntities db = EntitiesFactory.CreateSpareInstance(); BillHandler.AddMaterialReturn(db, _bill.VWToBill(GlobalVar.Oper.DeptCode), detailList); EntitiesFactory.SaveDb(db); MessageHelper.ShowInfo("保存成功!"); } catch (Exception ex) { MessageHelper.ShowInfo(ex.ToString()); } }
public static object LoadObj(string type, string name, object defobj) //从系统表中得到对象 { Object aObject; SpareEntities db = EntitiesFactory.CreateSpareInstance(); var obj = db.TS_CONFIG.FirstOrDefault(p => p.GRPID == type.Trim() && p.KEYID == name.Trim()); if (obj == null) { return(defobj); } try { byte[] blobdata = (byte[])(obj.DATA); if (blobdata.Length == 0) { return(null); } Stream stream = new MemoryStream(); stream.Write(blobdata, 0, blobdata.Length); stream.Position = 0; IFormatter formatter = new BinaryFormatter(); aObject = formatter.Deserialize(stream); stream.Close(); } catch { aObject = defobj; } return(aObject); }
private void SaveData() { int iFind = -1; SpareEntities db = EntitiesFactory.CreateSpareInstance(); for (int i = 0; i < gr.Length; i++) { if (gr[i].Check) { FileStream fs = new FileStream(gr[i].FullName, FileMode.Open, FileAccess.Read); UpdateControl.SaveFile2DB(db,"Update", gr[i].FileName, fs); iFind = servers.Find(gr[i].FileName); if (iFind >= 0) { if (servers[iFind].ModifyDate < DateTime.Parse(gr[i].lModifyDate)) { servers[iFind].ModifyDate = DateTime.Parse(gr[i].lModifyDate); servers[iFind].FileSize = long.Parse(gr[i].lFileSize); } } else { UpdateItem item = new UpdateItem(); item.FileName = gr[i].FileName; item.FileSize = long.Parse(gr[i].lFileSize); item.ModifyDate = DateTime.Parse(gr[i].lModifyDate); servers.Add(item); } } } UpdateControl.SaveObj(db,"Updates", "Updates", servers); EntitiesFactory.SaveDb(db); MessageHelper.ShowInfo("保存成功!"); RefreshData(); }
public PartComboTree() { var db = EntitiesFactory.CreateSpareInstance(); var _list = db.TA_PART.ToList(); DataSource = new BindingList <TA_PART>(_list); Columns.Clear(); Columns.Add(new ColumnHeader("Áã¼þºÅ")); Columns.Add(new ColumnHeader("Áã¼þÃèÊö1")); Columns.Add(new ColumnHeader("Áã¼þÃèÊö2")); for (int i = 0; i < _list.Count; i++) { AdvTree.Nodes[i].Cells.Add(new Cell(_list[i].PartCode)); AdvTree.Nodes[i].Cells.Add(new Cell(_list[i].PartDesc1)); AdvTree.Nodes[i].Cells.Add(new Cell(_list[i].PartDesc2)); } DisplayMembers = "PartCode,PartDesc1,PartDesc2"; ValueMember = "PartCode"; foreach (DevComponents.AdvTree.ColumnHeader chdr in AdvTree.Columns) { chdr.Width.AutoSize = true; } DropDownWidth = 400; }
private void BtnDeliver_Click(object sender, EventArgs e) { if (_bill == null || _bill.单据编号 == null) { MessageHelper.ShowInfo("请选择单据"); return; } if (MessageHelper.ShowQuestion("确定要执行选定的领用单?") == DialogResult.Yes) { SpareEntities db = EntitiesFactory.CreateSpareInstance(); var outlist = SpareOutController.GetList(db, _bill.单据编号); foreach (var spout in outlist) { if (string.IsNullOrEmpty(spout.TakeUser)) { MessageHelper.ShowError("领用详细中的领用人信息不能为空!"); return; } } BillHandler.FinishMaterialOut(db, _bill.VWToBill(GlobalVar.Oper.DeptCode), outlist); EntitiesFactory.SaveDb(db); NotifyController.AddStockSafeQty(db, GlobalVar.Oper.OperName); MessageHelper.ShowInfo("保存成功!"); } }
private void grid_CellValueChanged(object sender, GridCellValueChangedEventArgs e) { GridCell cell = e.GridCell; var row = (GridRow)e.GridPanel.Rows[cell.RowIndex]; if (cell.GridColumn == gcWorkshop) { if (Convert.ToString(row.Cells[gcWorkshop].Value) != "") { row[gcProcess].EditorType = typeof(ProcessComboBoxSelect); string n = row.Cells[gcWorkshop].Value.ToString(); var db = EntitiesFactory.CreateSpareInstance(); var list = new List <TA_PROCESS>(db.TA_PROCESS.Where(p => p.OwnedWorkshopCode == n).ToList()); row[gcProcess].EditorParams = new object[] { list }; if (row.Cells[gcProcess].Value != null) { string pro = row.Cells[gcProcess].Value.ToString(); if (list.All(p => p.OwendProcessCode != pro)) { row.Cells[gcProcess].Value = ""; } } } } }
private void btnStart_Click(object sender, EventArgs e) { Console.WriteLine(@"系统启动"); //获取默认收货库位 SpareEntities db = EntitiesFactory.CreateSpareInstance(); //todo 需要维护实际收货地点的编号 var firstOrDefault = ConfigController.GetList(db).FirstOrDefault(p => p.ParamName == "收货地点"); if (firstOrDefault != null) { QadInterface._defaultLoc = firstOrDefault.ParamValue; } lblErpGet.Visible = sbErpGet.Value; if (sbErpGet.Value) { _qadInterface.Receive(); _timerErpGet.Start(); Console.WriteLine(@"启动:获取ERP接口数据,执行周期:" + _timerErpGet.Interval / 1000 + "秒"); } lblErpPut.Visible = sbErpPut.Value; if (sbErpPut.Value) { _qadInterface.Send(); _timerErpPut.Start(); Console.WriteLine(@"启动:发送ERP接口数据,执行周期:" + _timerErpPut.Interval / 1000 + "秒"); } _timer.Start(); btnStart.Enabled = false; btnStop.Enabled = true; }
private void FormMain_Load(object sender, EventArgs e) { try { lblVer.Text = @"Ver " + Application.ProductVersion; timerNow_Tick(null, null); timerNotify.Start(); superTabControlMain.Tabs.Clear(); try { Init(); } catch (Exception ex) { MessageHelper.ShowError(ex); } SpareEntities db = EntitiesFactory.CreateSpareInstance(); NotifyController.AddStockNotify(db, GlobalVar.Oper.OperName); db.SaveChanges(); } catch (Exception ex) { this.Close(); } }
private static void Init() { using (SpareEntities db = EntitiesFactory.CreateSpareInstance()) { var configList = ConfigController.GetList(db); foreach (TA_CONFIG config in configList) { switch (config.ParamName) { case "IsProductInspect": IsProductInspect = Convert.ToBoolean(config.ParamValue); break; case "IsOutSourceInspect": IsOutSourceInspect = Convert.ToBoolean(config.ParamValue); break; case "IsBackFlush": IsBackFlush = Convert.ToBoolean(config.ParamValue); break; case "AutoFinishPartPick": AutoFinishPartPick = Convert.ToBoolean(config.ParamValue); break; case "AutoHandleMaterialAsk": AutoHandleMaterialAsk = Convert.ToBoolean(config.ParamValue); break; case "CcPartCode": CcPartCode = config.ParamValue; break; case "CcProjectId": CcProjectId = config.ParamValue; break; case "IgnoreErpPartCodeList": IgnoreErpPartCodeList = config.ParamValue.Split(',').ToList(); break; case "LocCodeVinWip": LocCodeVinWip = config.ParamValue; break; case "LocCodeVinFg": LocCodeVinFg = config.ParamValue; break; case "LocCodeVinSale": LocCodeVinSale = config.ParamValue; break; default: break; } } } }
public StoreWhseComboBox() { var db = EntitiesFactory.CreateSpareInstance(); DataSource = new BindingList <TA_STORE_WHSE>(db.TA_STORE_WHSE.ToList()); DisplayMember = "WhseName"; ValueMember = "WhseCode"; }
public GcLineNameComBoBox() { var db = EntitiesFactory.CreateSpareInstance(); DataSource = db.TA_LINE.ToList(); DisplayMember = "LineName"; ValueMember = "LineCode"; }
public WorkshopComboBoxList() { var db = EntitiesFactory.CreateSpareInstance(); DataSource = new BindingList <TA_WORKSHOP>(db.TA_WORKSHOP.ToList()); DisplayMember = "WorkshopName"; ValueMember = "OwnedWorkshopCode"; }
private void GetBillList() { using (SpareEntities db = EntitiesFactory.CreateSpareInstance()) { _billList = ReportViewController.GetIoSummarysByStockDetailList(db, _beginTime, _endTime); dgvBill.DataSource = ListHelper.ListToDataTable(_billList); } }
private void btnRefreshConfig_Click(object sender, EventArgs e) { using (SpareEntities db = EntitiesFactory.CreateSpareInstance()) { GlobalVar.InitGlobalVar(db, GlobalVar.Oper); MessageHelper.ShowInfo("系统参数已刷新!"); } }
public StoreLocComboBox() { var db = EntitiesFactory.CreateSpareInstance(); DataSource = new BindingList <TA_STORE_LOCATION>(db.TA_STORE_LOCATION.ToList()); DisplayMember = "LocCode"; ValueMember = "LocCode"; }
public ADeptComboBox() { var db = EntitiesFactory.CreateSpareInstance(); DataSource = new BindingList <TA_DEPT>((db.TA_DEPT).ToList()); DisplayMember = "DeptName"; ValueMember = "DeptCode"; }
public PartComboBox() { var db = EntitiesFactory.CreateSpareInstance(); DataSource = new BindingList <TA_PART>(db.TA_PART.ToList()); DisplayMember = "PartDesc2"; ValueMember = "PartCode"; }
public MachineTypeComboBox() { var db = EntitiesFactory.CreateSpareInstance(); DataSource = new BindingList <TT_MACHINE_TYPE>(db.TT_MACHINE_TYPE.ToList()); DisplayMember = "TypeName"; ValueMember = "MachineType"; }
public StoreGroupComboBox() { var db = EntitiesFactory.CreateSpareInstance(); DataSource = new BindingList <TA_STORE_GROUP>(db.TA_STORE_GROUP.ToList()); DisplayMember = "GroupName"; ValueMember = "GroupCode"; }
public UnitComboBox() { var db = EntitiesFactory.CreateSpareInstance(); DataSource = new BindingList <TA_UNIT>(db.TA_UNIT.ToList()); DisplayMember = "Unit"; ValueMember = "Unit"; }
public WorkLineComboBox() { var db = EntitiesFactory.CreateSpareInstance(); DataSource = new BindingList <TA_WORKLINE>(db.TA_WORKLINE.ToList()); DisplayMember = "WorkLineName"; ValueMember = "WorkLineCode"; }
public ProcessComboBoxList() { var db = EntitiesFactory.CreateSpareInstance(); // db.TA_PROCESS.ToList() DataSource = new BindingList <TA_PROCESS>(db.TA_PROCESS.ToList()); DisplayMember = "ProcessName"; ValueMember = "OwendProcessCode"; }
private void BgwFromErpDoWork(object sender, DoWorkEventArgs e) { SpareEntities db = EntitiesFactory.CreateSpareInstance(); InterfaceEntities OAdb = EntitiesFactory.CreateInterfaceInstance(); ReadErpFiles(db); GetOAData(OAdb, db); EntitiesFactory.SaveDb(db); EntitiesFactory.SaveDb(OAdb); }
private void GetBillList() { using (SpareEntities db = EntitiesFactory.CreateSpareInstance()) { _billList = ReportViewController.GetSafeQtysList(db); if (!string.IsNullOrEmpty(GlobalVar.Oper.DeptCode)) { _billList = _billList.Where(p => p.仓库 == GlobalVar.Oper.DeptCode).ToList(); } grid.PrimaryGrid.DataSource = _billList; } }
private void BtnSave_Click(object sender, EventArgs e) { try { SpareEntities db = EntitiesFactory.CreateSpareInstance(); // BillHandler.AddMaterialAsk(db,_bill, tList); EntitiesFactory.SaveDb(db); } catch (Exception ex) { MessageHelper.ShowInfo(ex.ToString()); } }