Ejemplo n.º 1
0
        private void butAddPacking_Click(object sender, EventArgs e)
        {
            string styleId = dgvPackStyle.CurrentRow.Cells["styleid"].Value.GetString();
            if (string.IsNullOrEmpty(styleId))
            {
                MessageBox.Show("Please select pack style.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            SkidPackingModel model = new SkidPackingModel();
            model.HeadLineID = HeaderContent.Id;
            model.PackStyleId = Convert.ToInt32(styleId);
            var seqResult = HeaderContent.SkidPacks.Where(i => i.PackStyleId == Convert.ToInt32(styleId)).ToList();
            model.Seq = seqResult.Count + 1;

            HeaderContent.SkidPacks = _repo.AddSkidPacking(epiSession, model).ToList();
            ListSkidWithinSerial(HeaderContent.SkidPacks.Where(i => i.PackStyleId == Convert.ToInt32(styleId)));
        }
Ejemplo n.º 2
0
        private void butRight_Click(object sender, EventArgs e)
        {
            string id = string.Empty;
            try
            {
                id = dgvSkidNumber.CurrentRow.Cells["id"].Value.GetString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string styleId = dgvPackStyle.CurrentRow.Cells["styleid"].Value.GetString();
            string serialId = dgvSkidNumber.CurrentRow.Cells["serialId"].Value.GetString();
            int snId = string.IsNullOrEmpty(serialId) ? 0 : Convert.ToInt32(serialId);

            Int32 selectedCellCount = dgvCutting.GetCellCount(DataGridViewElementStates.Selected);
            string serialCollection = string.Empty;

            if (string.IsNullOrEmpty(id))
            {
                MessageBox.Show("Please select packing design.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (selectedCellCount > 0)
            {
                for (int i = 0; i < selectedCellCount; i++)
                {
                    if (dgvCutting.SelectedCells[i].OwningColumn.Name.ToString() == "seriallineid")
                    {
                        serialCollection += string.Format(@"{0},", dgvCutting.SelectedCells[i].Value.GetString());
                    }
                }
            }

            if (!string.IsNullOrEmpty(serialCollection))
            {
                SkidPackingModel model = new SkidPackingModel();
                HeaderContent.SkidPacks = _repo.AddSerialToSkid(epiSession, HeaderContent.Id, Convert.ToInt32(id), serialCollection.Substring(0, serialCollection.Length - 1)).ToList();
                ListSkidWithinSerial(HeaderContent.SkidPacks.Where(i => i.PackStyleId == Convert.ToInt32(styleId)));
                ListSerialCuttingToGrid(HeaderContent.SerialLines.Where(i => i.PackStyleId == Convert.ToInt32(styleId)));
            }
        }
Ejemplo n.º 3
0
        public IEnumerable<SkidPackingModel> AddSkidPacking(SessionInfo _session, SkidPackingModel pack)
        {
            string sql = string.Empty;
            sql += string.Format(@"INSERT INTO ucc_pkg_SkidDesignPacking
                                                   (Plant
                                                   ,HeadLineID
                                                   ,PackStyleLineID
                                                   ,Seq
                                                   ,SkidNumber
                                                   ,Description
                                                   ,CompleteFlag
                                                   ,CreationDate
                                                   ,LastUpdateDate
                                                   ,CreatedBy
                                                   ,UpdatedBy)
                                             VALUES
                                                   (N'{0}' --<Plant, nvarchar(8),>
                                                   ,{1} --<HeadLineID, int,>
                                                   ,{2} --<PackStyleLineID, int,>
                                                   ,{3} --<Seq, int,>
                                                   ,N'{4}' --<SkidNumber, nvarchar(45),>
                                                   ,N'{5}' --<Description, nvarchar(100),>
                                                   ,{6} --<CompleteFlag, int,>
                                                   ,GETDATE() --<CreationDate, datetime,>
                                                   ,GETDATE() --<LastUpdateDate, datetime,>
                                                   ,N'{7}' --<CreatedBy, nvarchar(45),>
                                                   ,N'{7}' --<UpdatedBy, nvarchar(45),>
				                             )" + Environment.NewLine
                                             , _session.PlantID
                                             , pack.HeadLineID
                                             , pack.PackStyleId
                                             , pack.Seq
                                             , pack.SkidNumber
                                             , pack.Description
                                             , 0
                                             , _session.UserID);

            Repository.Instance.ExecuteWithTransaction(sql, "Add Skid");
            return GetSkidPackingsByWork(pack.HeadLineID);
        }