예제 #1
0
파일: StoreIn.cs 프로젝트: swankham/Epicoil
        public StoreIn(SessionInfo _session = null, StoreInHead model = null)
        {
            InitializeComponent();
            this._repoPlan = new StoreInPlanRepo();
            this._repo = new StoreInRepo();
            this._repoWhse = new WharehouseRepo();

            //Initial Session and content
            this.HeadContent = new StoreInHead();
            epiSession = _session;
            if (model != null) this.HeadContent = model;

            this.ModelClone = new StoreInHead();
            HeadContent.InsertState = false;
        }
예제 #2
0
        public StoreInHead InsertStoreIn(StoreInHead model, SessionInfo epiSession)
        {
            int id = 0;
            id = GenerateId(epiSession.PlantID);
            string sql = string.Format(@"IF NOT EXISTS
									    (
										    SELECT * FROM ucc_ic_StoreInHead (NOLOCK)
										    WHERE TransactionID = {13}
									    )
                                        BEGIN
                                            INSERT INTO ucc_ic_StoreInHead
                                                       (Company
                                                       ,Plant
                                                       ,TransactionType
                                                       ,StoreInId
                                                       ,StoreInNum
                                                       ,StoreInPlanId
                                                       ,StoreInDate
                                                       ,PORateType
                                                       ,PORate
                                                       ,DutyRate
                                                       ,Poscession
                                                       ,ActiveFlag
                                                       ,CreationDate
                                                       ,LastUpdateDate
                                                       ,CreatedBy
                                                       ,UpdatedBy
                                                       ,PONum
                                                       ,PONumber)
                                                 VALUES
                                                       (N'{0}'     --<Company, nvarchar(8),>
                                                       ,N'{1}'     --<Plant, nvarchar(8),>
                                                       ,N'{2}'     --<TransactionType, nvarchar(15),>
                                                       ,{3}     --<StoreInId, int,>
                                                       ,N'{4}'     --<StoreInNum, nvarchar(10),>
                                                       ,{5}     --<StoreInPlanId, int,>
                                                       ,CONVERT(DATETIME, '{6}',103)     --<StoreInDate, datetime,>
                                                       ,N'{7}'     --<PORateType, nvarchar(50),>
                                                       ,{8}     --<PORate, decimal(18,2),>
                                                       ,{9}     --<DutyRate, decimal(18,2),>
                                                       ,{10}     --<Poscession, nvarchar(50),>
                                                       ,{11}     --<ActiveFlag, tinyint,>
                                                       ,GETDATE()     --<CreationDate, datetime,>
                                                       ,GETDATE()     --<LastUpdateDate, datetime,>
                                                       ,N'{12}'     --<CreatedBy, varchar(45),>
                                                       ,N'{12}'     --<UpdatedBy, varchar(45),>
                                                       ,N'{14}'     --<CreatedBy, varchar(45),>
                                                       ,N'{15}'     --<UpdatedBy, varchar(45),>
                                                )
                                            END" + Environment.NewLine
                                              , epiSession.CompanyID  //{0}
                                              , epiSession.PlantID
                                              , model.PossessionPromt.ToUpper()
                                              , id
                                              , "IN" + id.ToString("00000")
                                              , model.StoreInPlanId  //{5}
                                              , model.StoreInDate.ToString("dd/MM/yyyy hh:mm:ss")
                                              , ""  //Fix PORateType to string.Empty
                                              , model.ExchangeRate
                                              , model.ExchangeRate
                                              , model.Possession  //{10}
                                              , 1
                                              , epiSession.UserID
                                              , model.TransactionID
                                              , model.PONum
                                              , model.PONumber);
            Repository.Instance.ExecuteWithTransaction(sql, "Update Stock");

            return GetStoreInByID(id, epiSession.PlantID);
        }
예제 #3
0
파일: StoreIn.cs 프로젝트: swankham/Epicoil
 private void jISHAZAIToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ClearHeaderContent();
     HeadContent = new StoreInHead();
     HeadContent.StoreInFlag = "0";
     HeadContent.Possession = 0;  //Set Posession (JISHAZAI)
     HeadContent.InsertState = true;
     ModelClone = (StoreInHead)HeadContent.Clone();
     SetHeaderContent(HeadContent);
     button1.Enabled = true;
 }
예제 #4
0
파일: StoreIn.cs 프로젝트: swankham/Epicoil
        private void StoreIn_Load(object sender, EventArgs e)
        {
            if (epiSession.SessionID == null)
            {
                Login frm = new Login();
                frm.ShowDialog();
            }
            else if (epiSession.SessionID == "x")
            {
                this.Dispose();
                this.Close();
                Environment.Exit(1);
            }
            else
            {
                this.Text = epiSession.PlantName;

                if (HeadContent.StoreInPlanId != 0)
                {
                    txtStoreInNum.Text = HeadContent.StoreInNum;
                    SetHeaderContent(HeadContent);
                }

                ModelClone = (StoreInHead)HeadContent.Clone();
                return;
            }
            StoreIn_Load(sender, e);
        }
예제 #5
0
파일: StoreIn.cs 프로젝트: swankham/Epicoil
        private void tlbSave_Click(object sender, EventArgs e)
        {
            //bool IsSuccess;
            string msg;
            int StoreInid;
            int SelectedCount = 0;

            if (dataGridView1.Rows.Count == 0)
            {
                return;
            }

            if (!HashListSeleted())
            {
                MessageBox.Show("Please select rows in grid.", "Please try agian.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }

            if (!HashArticleSelected(out SelectedCount))
            {
                MessageBox.Show("Please select rows in grid.", "Please try agian.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }

            if (SelectedCount > 0)
            {
                DialogResult dialogResult = MessageBox.Show("Are you sure to save store in. \rAfter your save, you can't modify it.", "Please Confirm.", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    int iRow = dataGridView1.CurrentRow.Index;
                    List<StoreInDetail> selectedList = new List<StoreInDetail>();

                    for (int i = 0; (this.dataGridView2.Rows.Count) > i; i++)
                    {
                        if ((bool)dataGridView2[0, i].EditedFormattedValue && string.IsNullOrEmpty(dataGridView2.Rows[i].Cells["stock"].Value.GetString()))
                        {
                            dataGridView2.CurrentCell = dataGridView2[0, i];

                            var item = new StoreInDetail();
                            item = _repo.GetArticleListToSave(Convert.ToInt32(dataGridView2.Rows[i].Cells["lineid"].Value));
                            item.Location = dataGridView2.Rows[i].Cells["Place"].Value.GetString();
                            item.NGStatus = Convert.ToInt32(dataGridView2.Rows[i].Cells["ngflag"].Value.GetBoolean());
                            item.NGRemark = dataGridView2.Rows[i].Cells["ngRemark"].Value.GetString();
                            HeadContent.PONum = item.PONum;
                            HeadContent.PONumber = item.PONumber;
                            selectedList.Add(item);
                        }
                    }

                    if (selectedList != null)
                    {
                        HeadContent.StoreInDate = DateTime.Now;
                        HeadContent = _repo.InsertStoreIn(HeadContent, epiSession);
                        _repo.InsertStoreInLine(selectedList, epiSession, HeadContent.StoreInID, HeadContent.TransactionID, out msg);
                    }
                    SetHeaderContent(HeadContent);
                    MessageBox.Show("Save Store In completed. And then will be create Part in Epicor.", "Progression.", MessageBoxButtons.OK);
                    Progression frm1 = new Progression("NEWPART", HeadContent.TransactionID, epiSession, HeadContent.Possession);
                    frm1.ShowDialog();

                    tlbSave.Enabled = false;
                    SetHeaderContent(HeadContent, true);
                    var result = _repo.GetDetailArticle(HeadContent.StoreInPlanId, HeadContent.TransactionID);
                    SetDetailArticle(result, true);
                }
            }
        }
예제 #6
0
파일: StoreIn.cs 프로젝트: swankham/Epicoil
 private void tlbClear_Click(object sender, EventArgs e)
 {
     ClearHeaderContent();
     HeadContent = new StoreInHead();
     HeadContent.InsertState = false;
     HeadContent.StoreInFlag = "0";
     HeadContent.Possession = 3;
     ModelClone = (StoreInHead)HeadContent.Clone();
     SetHeaderContent(HeadContent);
     //button1.Enabled = true;
 }
예제 #7
0
파일: StoreIn.cs 프로젝트: swankham/Epicoil
        private void SetHeaderContent(StoreInHead model, bool saved = false)
        {
            ClearHeaderContent();
            txtStoreInNum.DataBindings.Add("Text", model, "StoreInNum", false, DataSourceUpdateMode.OnPropertyChanged);
            txtStoreInPlanNum.DataBindings.Add("Text", model, "StoreInPlanNum", false, DataSourceUpdateMode.OnPropertyChanged);
            txtInvoiceNum.DataBindings.Add("Text", model, "InvoiceNum", false, DataSourceUpdateMode.OnPropertyChanged);
            txtSupplierCode.DataBindings.Add("Text", model, "SupplierCode", false, DataSourceUpdateMode.OnPropertyChanged);
            txtSupplierName.DataBindings.Add("Text", model, "SupplierName", false, DataSourceUpdateMode.OnPropertyChanged);
            txtMakerCode.DataBindings.Add("Text", model, "MakerCode", false, DataSourceUpdateMode.OnPropertyChanged);
            txtMakerName.DataBindings.Add("Text", model, "MakerName", false, DataSourceUpdateMode.OnPropertyChanged);
            txtMillCode.DataBindings.Add("Text", model, "MillCode", false, DataSourceUpdateMode.OnPropertyChanged);
            txtMillName.DataBindings.Add("Text", model, "MillName", false, DataSourceUpdateMode.OnPropertyChanged);
            txtBussinessType.DataBindings.Add("Text", model, "BussinessType", false, DataSourceUpdateMode.OnPropertyChanged);
            txtBussinessTypeName.DataBindings.Add("Text", model, "BussinessTypeName", false, DataSourceUpdateMode.OnPropertyChanged);
            txtVessel.DataBindings.Add("Text", model, "Vessel", false, DataSourceUpdateMode.OnPropertyChanged);

            txtLoadPort.DataBindings.Add("Text", model, "LoadPort", false, DataSourceUpdateMode.OnPropertyChanged);
            txtArivePort.DataBindings.Add("Text", model, "ArivePort", false, DataSourceUpdateMode.OnPropertyChanged);

            txtETADate.DataBindings.Add("Text", model, "ETADate", false, DataSourceUpdateMode.OnPropertyChanged);
            txtETDDate.DataBindings.Add("Text", model, "ETDDate", false, DataSourceUpdateMode.OnPropertyChanged);
            txtInvoiceDate.DataBindings.Add("Text", model, "InvoiceDate", false, DataSourceUpdateMode.OnPropertyChanged);

            //if (HeadContent.Possession != 2)
            //{
            txtPoscession.DataBindings.Add("Text", model, "PossessionPromt", false, DataSourceUpdateMode.OnPropertyChanged);
            //}

            if (HeadContent.InsertState == true)
            {
                button1.Enabled = true;
            }
            else
            {
                button1.Enabled = false;
            }

            if (model.StoreInFlag == "1")
            {
                tlbSave.Enabled = false;
            }
            else
            {
                tlbSave.Enabled = true;
            }

            //If not yet saving Store In.
            if (!saved)
            {
                var result = _repo.GetDetail(HeadContent.StoreInPlanId);
                SetDetail(result);
            }
            else
            {
                var result = _repo.GetDetailByStoreIn(HeadContent.StoreInID);
                SetDetail(result);
            }            
        }