Exemple #1
0
        private void btnRemoveCH_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            if (View.CurrentObject == null)
                return;

            UnitOfWork uow = new UnitOfWork();

            uow.BeginTransaction();
            OutlookSystemItem olItem = new OutlookSystemItem();

            foreach (Item tmpItem in View.SelectedObjects)
            {
                string itemNo = tmpItem.ItemNo;
                Item item = Item.FindItem(uow, itemNo);

                if (item.ItemNo.Substring(0, 2) == "CH")
                {
                    item.ItemNo = item.ItemNo.Replace("CH", "");
                    olItem.SaveToOutlookSystem(item);
                    item.IsConfirming = true;
                    item.Save();
                    uow.CommitChanges();
                }
            }
            uow.CommitTransaction();
        }
Exemple #2
0
        private void btnCreateFromOldSystem_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            if (View.CurrentObject == null)
                return;

            Logger.For(this).Info("从大货系统取资料");

            StringBuilder sb = new StringBuilder();
            UnitOfWork uow = (UnitOfWork)((XPObjectSpace)View.ObjectSpace).Session;

            sb.AppendLine("请确认是否从大货系统取出以下产品资料 !!");

            foreach (Item items in View.SelectedObjects)
            {
                sb.AppendLine(string.Format("产品编码 : {0}, 产品名称 : {1}, 产品种类 : {2}", items.ItemNo, items.ItemName, items.ItemType.ItemTypeName));
            }

            DialogResult dr = XtraMessageBox.Show(sb.ToString(), "确认取出", MessageBoxButtons.YesNo);

            if (dr == DialogResult.Yes)
            {
                //try
                //{
                    foreach (Item items in e.SelectedObjects)
                    {
                        OutlookSystemItem osItem = new OutlookSystemItem();
                        osItem.CreateItemFromOutlookSystem(items.ItemNo, uow);
                    }
                    uow.CommitTransaction();

                    XtraMessageBox.Show("完成从大货取出产品资料 !!!");
                //}
                //catch (Exception ex)
                //{
                //    XtraMessageBox.Show(ex.Message, "錯誤", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                //    uow.RollbackTransaction();
                //}
            }
        }
Exemple #3
0
        private void btnFixSubcon_Click(object sender, EventArgs e)
        {
            if (InitExcel("Item") == false)
                return;

            OutlookSystemItem olItem = new OutlookSystemItem();
            UnitOfWork uow = new UnitOfWork();

            String itemNo;
            string workCenterNo;
            string workDesc;
            RouteLine rLine;
            WorkCenter workCenter;

            int row = 3;
            uow.BeginTransaction();

            while (ExcelHelper.GetCellStringValue(xlSht, row, 1) != "")
            {
                itemNo = ExcelHelper.GetCellStringValue(xlSht, row, 1);
                olItem.InitRst(itemNo);

                if (olItem.GetStringField(olItem.rst.Fields["nw:partno"]) != "")
                {
                    workCenterNo = olItem.GetStringField(olItem.rst.Fields["nw:plating:plater"]);
                    workDesc = olItem.GetStringField(olItem.rst.Fields["nw:plating"]);

                    workCenter = WorkCenter.Find(uow, workCenterNo);

                    if (workCenter != null)
                    {
                        rLine = uow.FindObject<RouteLine>(CriteriaOperator.Parse(string.Format("Item.ItemNo = '{0}' AND WorkCenter.Oid = '{1}'",
                            itemNo, workCenter.Oid)));
                        if (rLine != null)
                        {
                            rLine.updateTimeStamp = false;
                            rLine.WorkDesc = workDesc;
                            rLine.Save();

                            xlSht.Cells[row, 6] = "ok";
                        }
                    }
                }
                row++;
            }

            uow.CommitTransaction();
        }
Exemple #4
0
        private void btnOutlookItem_Click(object sender, EventArgs e)
        {
            if (InitExcel("Item") == false)
                return;

            OutlookSystemItem olItem = new OutlookSystemItem();
            UnitOfWork uow = new UnitOfWork();
            bool replaceItem = false;

            if (ItemExist.SelectedIndex == 0)
                replaceItem = true;

            String itemNo;

            int row = 3;
            uow.BeginTransaction();

            while (ExcelHelper.GetCellStringValue(xlSht, row, 1) != "")
            {
                itemNo = ExcelHelper.GetCellStringValue(xlSht, row, 1);
                olItem.CreateItemFromOutlookSystem(itemNo, uow, replaceItem);
                xlSht.Cells[row, 6] = "ok";
                row++;
            }

            uow.CommitTransaction();
        }
Exemple #5
0
 public void SaveToOldSystem()
 {
     OutlookSystemItem osItem = new OutlookSystemItem();
     osItem.SaveToOutlookSystem(this);
 }