Esempio n. 1
0
        private void QueryEvent(object sender, EventArgs e)
        {
            //			int BeginDate = FormatHelper.TODateInt(this.txtBeginDate.Text);
            //			int EndDate = FormatHelper.TODateInt(this.txtEndDate.Text);

            string recBegDate  = String.Empty;
            string recEndDate  = String.Empty;
            string tossBegDate = String.Empty;
            string tossEndDate = String.Empty;

            if (chbRecieve.Checked == true)
            {
                recBegDate = FormatHelper.TODateInt(DateTime.Parse(this.txtRecieveBeginDate.Text)).ToString();
                recEndDate = FormatHelper.TODateInt(DateTime.Parse(this.txtRecieveEndDate.Text)).ToString();
            }
            if (chbToss.Checked == true)
            {
                tossBegDate = FormatHelper.TODateInt(DateTime.Parse(this.txtTossBeginDate.Text)).ToString();
                tossEndDate = FormatHelper.TODateInt(DateTime.Parse(this.txtTossEndDate.Text)).ToString();
            }

            string moCode   = String.Empty;
            string itemCode = String.Empty;

            if (FormatHelper.CleanString(this.txtMoQuery.Text).ToUpper() != String.Empty)
            {
                moCode = String.Join("','", FormatHelper.CleanString(this.txtMoQuery.Text).ToUpper().Split(','));
            }
            if (FormatHelper.CleanString(this.txtItemQuery.Text).ToUpper() != String.Empty)
            {
                itemCode = String.Join("','", FormatHelper.CleanString(this.txtItemQuery.Text).ToUpper().Split(','));
            }

            FacadeFactory facadeFactory = new FacadeFactory(base.DataProvider);

            (e as WebQueryEventArgs).GridDataSource =
                facadeFactory.CreateInventoryFacade().QueryERPINVInterface(
                    FormatHelper.CleanString(this.txtRecNO.Text).ToUpper(),
                    moCode,
                    itemCode,
                    recBegDate,
                    recEndDate,
                    tossBegDate,
                    tossEndDate,
                    FormatHelper.CleanString(this.drpStatusEdit.SelectedValue).ToUpper(),
                    (e as WebQueryEventArgs).StartRow,
                    (e as WebQueryEventArgs).EndRow);

            (e as WebQueryEventArgs).RowCount =
                facadeFactory.CreateInventoryFacade().QueryERPINVInterfaceCount(
                    FormatHelper.CleanString(this.txtRecNO.Text).ToUpper(),
                    moCode,
                    itemCode,
                    recBegDate,
                    recEndDate,
                    tossBegDate,
                    tossEndDate,
                    FormatHelper.CleanString(this.drpStatusEdit.SelectedValue).ToUpper()
                    );
        }
Esempio n. 2
0
        protected void cmdAdd_ServerClick(object sender, System.EventArgs e)
        {
            Common.Domain.IDomainDataProvider erpDataProvider = Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider(DBName.ERP);

            FacadeFactory   facadeFactory = new FacadeFactory(base.DataProvider);
            InventoryFacade mesFac        = facadeFactory.CreateInventoryFacade();

            ((SQLDomainDataProvider)erpDataProvider).PersistBroker.OpenConnection();
            erpDataProvider.BeginTransaction();
            ((SQLDomainDataProvider)base.DataProvider).PersistBroker.OpenConnection();
            DataProvider.BeginTransaction();
            int iSelectedRowCount = 0;

            try
            {
                foreach (Infragistics.WebUI.UltraWebGrid.UltraGridRow row in this.gridWebGrid.Rows)
                {
                    if (row.Selected == true)
                    {
                        iSelectedRowCount++;
                        string factory = "PO";
                        if (System.Configuration.ConfigurationSettings.AppSettings["InvFactory"] != null)
                        {
                            factory = System.Configuration.ConfigurationSettings.AppSettings["InvFactory"].Trim();
                        }

                        if (row.Cells[7].Text.Trim() != languageComponent1.GetString(Web.Helper.INVERPType.INVERPTYPE_NEW))
                        {
                            ERPSRMX srmx = new ERPSRMX();
                            srmx.SRMXNO = mesFac.GetMaxSRNO(int.Parse(DateTime.Now.Year.ToString().Substring(2, 2)), factory);

                            srmx.ENDATE = FormatHelper.TODateInt(DateTime.Now);
                            string mocode = row.Cells[3].Text.Trim().Substring(5, row.Cells[3].Text.Trim().Length - 5);
                            srmx.SONO   = Convert.ToInt32(mocode);
                            srmx.FINQTY = Convert.ToDecimal(row.Cells[6].Text.Trim());
                            srmx.SRPROD = row.Cells[2].Text.Trim();
                            srmx.SRDESC = row.Cells[2].Text.Trim();
                            //srmx.
                            srmx.UID = GetUserCode();
                            srmx.STA = "F";

                            //向ERP中插入数据
                            erpDataProvider.Insert(srmx);

                            ERPINVInterface erp    = new  ERPINVInterface();
                            object          objERP = mesFac.GetERPINVInterface(
                                row.Cells[1].Text.Trim()
                                , row.Cells[3].Text.Trim()
                                , Web.Helper.INVERPType.INVERPTYPE_PROCESSED
                                , row.Cells[10].Text.Trim());

                            if (objERP != null)
                            {
                                erp = objERP as ERPINVInterface;
                            }
                            else
                            {
                                erp.RECNO    = row.Cells[1].Text.Trim();
                                erp.SRNO     = srmx.SRMXNO;
                                erp.ITEMCODE = row.Cells[2].Text.Trim();

                                erp.MDATE  = FormatHelper.TODateInt(row.Cells[4].Text.Trim());
                                erp.MOCODE = row.Cells[3].Text.Trim();
                                erp.MTIME  = FormatHelper.TOTimeInt(DateTime.Now);
                                erp.MUSER  = GetUserCode();
                                erp.QTY    = Decimal.Parse(row.Cells[6].Text.Trim());
                                erp.STATUS = Web.Helper.INVERPType.INVERPTYPE_PROCESSED;
//								erp.UPLOADDATE =  erp.MDATE;
//								erp.UPLOADTIME= erp.MTIME;
//								erp.UPLOADUSER =  erp.MUSER;
                            }

                            erp.UPLOADDATE = FormatHelper.TODateInt(DateTime.Now);
                            erp.UPLOADTIME = FormatHelper.TOTimeInt(DateTime.Now);
                            erp.UPLOADUSER = GetUserCode();;
                            erp.LINKSRNO   = row.Cells[10].Text.Trim();
                            erp.SRNO       = srmx.SRMXNO;

                            mesFac.AddERPINVInterface(erp);
                        }
                        else
                        {
                            ExceptionManager.Raise(typeof(ERPINVInterface), "状态必须为" + languageComponent1.GetString(Web.Helper.INVERPType.INVERPTYPE_PROCESSED));
                        }
                        erpDataProvider.CommitTransaction();
                        DataProvider.CommitTransaction();
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Raise(this.GetType(), "", ex);
                erpDataProvider.RollbackTransaction();
            }
            finally
            {
                ((SQLDomainDataProvider)erpDataProvider).PersistBroker.CloseConnection();
                ((SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
            }

            if (iSelectedRowCount == 0)
            {
                ExceptionManager.Raise(typeof(ERPINVInterface), "没有选择任何记录");
            }
            else
            {
                this.Response.Redirect("FERPInvInterfaceQuery.aspx");
            }
        }