Beispiel #1
0
 private void BindingStyleContent(PackStyleOrderModel model)
 {
     ClearBindingByPackStyle();
     txtCustomer.Text = model.CustId + " - " + model.CustomerName;
     txtPackingStyle.Text = model.StyleCode;
     txtTotalQty.Text = model.TotalQuantity.ToString("0.00");
     txtPackingRemark.Text = model.Remarks;
 }
Beispiel #2
0
        public IEnumerable<SerialsPackingModel> GetSerialForFirstDefault(PackStyleOrderModel model)
        {
            string sql = string.Format(@"SELECT mat.Possession, busi.Key1 as BussinessType, busi.Character01 as BussinessTypeName
	                                            , cmdt.Key1 as CommodityCode, cmdt.Character01 as CommodityName
	                                            , spec.Key1 as SpecCode, spec.Character01 as SpecName, spec.Number01 as Gravity
	                                            , coat.Key1 as CoatingCode, ISNULL(coat.Character01, '') as CoatingName, ISNULL(coat.Number01, 0.00) as FrontPlate, ISNULL(coat.Number02, 0.00) as BackPlate
                                                , pkg.LineID as HeadLineID, gsn.UnitWeight
	                                            , gsn.LineID as SerialLineID, gsn.SerialNo, gsn.Thick, gsn.Width, gsn.Length
	                                            , 0 as LineID, {3} as PackStyleLineID, N'{2}' as PackingStyleCode, 0 as PackingDesignId, '' as SkidNumber, 0 as CompleteFlag
                                            FROM ucc_pln_SerialGenerated gsn
	                                            INNER JOIN ucc_pkg_Header pkg ON(gsn.WorkOrderID = pkg.WorkOrderID)
	                                            LEFT JOIN ucc_pln_Material mat ON(gsn.MaterialTransLineID = mat.TransactionLineID)
	                                            LEFT JOIN ucc_pln_CuttingDesign cut ON(gsn.CuttingLineID = cut.LineID)
	                                            LEFT JOIN ucc_pln_PlanHead pln ON(gsn.WorkOrderID = pln.WorkOrderID)
	                                            LEFT JOIN UD25 busi ON(mat.BT = busi.Key1)
	                                            LEFT JOIN UD29 cmdt ON(mat.Cmdty = cmdt.Key1)
	                                            LEFT JOIN UD30 spec ON(mat.Cmdty = spec.Key2 and mat.Spec = spec.Key1)
	                                            LEFT JOIN UD31 coat ON(mat.Coating = coat.Key1)
	                                            LEFT JOIN OrderDtl odt ON(cast(cut.SONo as int) = odt.OrderNum AND odt.OrderLine = cut.SOLine)
	                                            LEFT JOIN UD12 nor ON(cut.NORNum = nor.Key1)
                                            WHERE ProductionUsedFlag = 0
	                                            AND gsn.Status = 'F'
	                                            AND pkg.LineID = {0}	--{0} //HeadLineId
	                                            AND odt.Character01 = N'{1}'	--N'{1}'	//CustId
	                                            AND nor.ShortChar11	= N'{2}'	--N'{2}'	//StyleCode  CS-0002,CU-0001", model.HeadLineID, model.CustId, model.StyleCode, model.Id);

            return Repository.Instance.GetMany<SerialsPackingModel>(sql);
        }
Beispiel #3
0
        private void tbutSave_Click(object sender, EventArgs e)
        {
            PackingOrderModel model = new PackingOrderModel();
            model.WorkOrderId = HeaderContent.WorkOrderId;
            model.Remark = txtRemark.Text.ToString();
            model.CompleteFlag = (HeaderContent.SerialLines.Where(i => i.DesignedPack == false).ToList().Count > 0) ? 0 : 1;
            if (_repo.SavePackOrder(epiSession, model, out HeaderContent))
            {
                PackStyleOrderModel styles = new PackStyleOrderModel();
                styles.HeadLineID = HeaderContent.Id;
                styles.StyleCode = dgvPackStyle.CurrentRow.Cells["packstyle"].Value.ToString();
                styles.Remarks = txtPackingRemark.Text.ToString();

                if (_repo.SavePackStyles(epiSession, null, styles))
                {
                    MessageBox.Show("Save complete.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    HeaderContent.PackStyles = _repo.GetPackStyleByPackOrder(HeaderContent.WorkOrderId).ToList();
                }
            }
        }
Beispiel #4
0
        public bool SavePackStyles(SessionInfo _session, IEnumerable<PackStyleOrderModel> packStyles = null, PackStyleOrderModel model = null)
        {
            bool isSuccess = false;
            string sql = string.Empty;
            //resultRow = null;
            if (packStyles != null && model == null)
            {
                foreach (var item in packStyles)
                {
                    sql += string.Format(@"IF NOT EXISTS
                                        (
	                                        SELECT * FROM ucc_pkg_PackStyleList (NOLOCK)
	                                        WHERE HeadLineID = {1} AND StyleCode = N'{3}'
                                        )
	                                        BEGIN
		                                        INSERT INTO ucc_pkg_PackStyleList
				                                            (Plant
				                                            ,HeadLineID
				                                            ,CustID
				                                            ,StyleCode
				                                            ,TotalQuantity
				                                            ,ThickMin
				                                            ,ThickMax
				                                            ,WidthMin
				                                            ,WidthMax
				                                            ,Remarks
				                                            ,CompleteFlag
				                                            ,CreationDate
				                                            ,LastUpdateDate
				                                            ,CreatedBy
				                                            ,UpdatedBy
                                                            ,CoilWeigthPackMin
                                                            ,CoilWeigthPackMax
                                                            ,CoilPerPackMin
                                                            ,CoilPerPackMax)
			                                            VALUES
				                                            (N'{0}' --<Plant, nvarchar(8),>
				                                            ,{1} --<HeadLineID, bigint,>
				                                            ,N'{2}' --<CustID, nvarchar(25),>
				                                            ,N'{3}' --<StyleCode, nvarchar(45),>
				                                            ,{4} --<TotalQuantity, int,>
				                                            ,{5} --<ThickMin, decimal(15,9),>
				                                            ,{6} --<ThickMax, decimal(15,9),>
				                                            ,{7} --<WidthMin, decimal(15,9),>
				                                            ,{8} --<WidthMax, decimal(15,9),>
				                                            ,N'{9}' --<Remarks, nvarchar(max),>
				                                            ,{10} --<CompleteFlag, int,>
				                                            ,GETDATE() --<CreationDate, datetime,>
				                                            ,GETDATE() --<LastUpdateDate, datetime,>
				                                            ,N'{11}' --<CreatedBy, nvarchar(45),>
				                                            ,N'{11}' --<UpdatedBy, nvarchar(45),>
                                                            ,{12}
                                                            ,{13}
                                                            ,{14}
                                                            ,{15}
				                                            )
	                                        END
                                        ELSE
	                                        BEGIN
		                                        UPDATE ucc_pkg_PackStyleList
			                                        SET Remarks = N'{9}' --<Remarks, nvarchar(max),>
                                                       ,CompleteFlag = {10} --<CompleteFlag, int,>
				                                       ,HeadLineID = {1} --<HeadLineID, bigint,>
				                                       ,CustID = N'{2}' --<CustID, nvarchar(25),>
				                                       ,StyleCode = N'{3}' --<StyleCode, nvarchar(45),>
				                                       ,TotalQuantity = {4} --<TotalQuantity, int,>
				                                       ,ThickMin = {5} --<ThickMin, decimal(15,9),>
				                                       ,ThickMax = {6} --<ThickMax, decimal(15,9),>
				                                       ,WidthMin = {7} --<WidthMin, decimal(15,9),>
				                                       ,WidthMax = {8} --<WidthMax, decimal(15,9),>				                                       				                                        
				                                       ,LastUpdateDate = GETDATE() --<LastUpdateDate, datetime,>
				                                       ,UpdatedBy = N'{11}' --<UpdatedBy, nvarchar(45),>
				                                       ,CoilWeigthPackMin = {12} --<CoilWeigthPackMin, decimal(15,9),>
				                                       ,CoilWeigthPackMax = {13} --<CoilWeigthPackMax, decimal(15,9),>
				                                       ,CoilPerPackMin = {14} --<CoilPerPackMin, decimal(15,9),>
				                                       ,CoilPerPackMax = {15} --<CoilPerPackMax, decimal(15,9),>
			                                        WHERE HeadLineID = {1} AND StyleCode = N'{3}'
	                                        END
                                            " + Environment.NewLine
                                                     , _session.PlantID
                                                     , item.HeadLineID
                                                     , item.CustId
                                                     , item.StyleCode
                                                     , item.TotalQuantity
                                                     , item.ThickMin
                                                     , item.ThickMax
                                                     , item.WidthMin
                                                     , item.WidthMax
                                                     , item.Remarks
                                                     , 0
                                                     , _session.UserID
                                                     , item.CoilWeigthPackMin
                                                     , item.CoilWeigthPackMax
                                                     , item.CoilPerPackMin
                                                     , item.CoilPerPackMax);
                }
            }
            else if (packStyles == null && model != null)
            {
                sql = string.Format(@"UPDATE ucc_pkg_PackStyleList
			                            SET Remarks = N'{2}' --<Remarks, nvarchar(max),>
                                            ,CompleteFlag = {3} --<CompleteFlag, int,>
				                            ,LastUpdateDate = GETDATE() --<LastUpdateDate, datetime,>
				                            ,UpdatedBy = N'{4}' --<UpdatedBy, nvarchar(45),>
			                            WHERE HeadLineID = {0} AND StyleCode = N'{1}'" + Environment.NewLine
                                        , model.HeadLineID
                                        , model.StyleCode
                                        , model.Remarks
                                        , 0
                                        , _session.UserID);
            }

            try
            {
                Repository.Instance.ExecuteWithTransaction(sql, "Update Planning");
                isSuccess = true;
            }
            catch
            {
                isSuccess = false;
            }
            return isSuccess;
        }