Exemple #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            List <ShipmentVO> list = new List <ShipmentVO>();

            foreach (DataGridViewRow row in dgvStockStatus.Rows)
            {
                bool isCellChecked = Convert.ToBoolean(row.Cells["chk"].EditedFormattedValue);
                if (isCellChecked)
                {
                    ShipmentVO vo = new ShipmentVO();

                    vo.plan_id = row.Cells[13].Value.ToString();

                    if (row.Cells["combo"].Value == null)
                    {
                        continue;
                    }
                    else
                    {
                        vo.factory_name = row.Cells["combo"].Value.ToString();
                    }

                    vo.w_count_present = Convert.ToInt32(row.Cells[10].Value);
                    //vo.uadmin = 1002;
                    vo.udate      = DateTime.Now.ToString("yyyy-MM-dd");
                    vo.product_id = Convert.ToInt32(row.Cells[17].Value);
                    vo.category   = "P_ORDER_MOVE";

                    list.Add(vo);
                }
            }

            try
            {
                ShipmentService shipment_service = new ShipmentService();
                if (MessageBox.Show($"선택하신 {list.Count}건을 이동처리 하시겠습니까?", "이동 처리"
                                    , MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    bool bResult = shipment_service.TransferProcessing(list);
                    if (bResult)        //이동처리 성공시
                    {
                        SetBottomStatusLabel($"선택하신 {list.Count}건의 이동처리가 완료되었습니다.");
                        btnSelect.PerformClick();
                    }
                }
            }
            catch (Exception err)
            {
                LoggingUtility.GetLoggingUtility(err.Message, Level.Error);
                //이동처리 실패시

                SetBottomStatusLabel("이동처리를 할 수 없습니다.");
                {
                    return;
                }
            }
        }
Exemple #2
0
        public int Shipment(ShipmentVO vo)
        {
            //using (SqlCommand cmd = new SqlCommand())
            //{
            //    cmd.Connection = conn;

            //    try
            //    {
            //        cmd.CommandText = @"insert into TBL_SHIPMENT (so_id, ship_count, ship_uadmin, ship_udate, ship_state, ship_edate) values(@so_id, @ship_count, @ship_uadmin, replace(convert(varchar(10), getdate(), 120), '-', '-'), '출하완료', replace(convert(varchar(10), getdate(), 120), '-', '-'));
            //                            update TBL_SO_MASTER set so_deleted = 'Y' where so_id = @so_id";
            //        cmd.Parameters.AddWithValue("@so_id", vo.so_id);
            //        cmd.Parameters.AddWithValue("@ship_count", vo.ship_count);
            //        cmd.Parameters.AddWithValue("@ship_uadmin", LoginVO.user.Name);

            //        cmd.ExecuteNonQuery();
            //    }
            //    catch (Exception err)
            //    {
            //        string msg = err.Message;
            //        return 0;
            //    }
            //}

            using (SqlCommand cmd = new SqlCommand())
            {
                cmd.Connection = conn;

                SqlTransaction trans = conn.BeginTransaction();

                cmd.Transaction = trans;

                try
                {
                    cmd.CommandText = "update TBL_SHIPMENT set ship_uadmin = @ship_uadmin, ship_state = '출하완료', ship_edate = replace(convert(varchar(10), getdate(), 120), '-', '-'), ship_udate = replace(convert(varchar(10), getdate(), 120), '-', '-') where ship_id = @ship_id";
                    cmd.Parameters.AddWithValue("@ship_id", vo.ship_id);
                    cmd.Parameters.AddWithValue("@ship_count", vo.ship_count);
                    cmd.Parameters.AddWithValue("@ship_uadmin", LoginVO.user.Name);

                    cmd.ExecuteNonQuery();

                    cmd.CommandText = "update TBL_SO_MASTER set so_deleted = 'Y' where so_id = @so_id";

                    //cmd.CommandText = "select IDENT_CURRENT('TBL_SHIPMENT')";
                    //int ship_id = Convert.ToInt32(cmd.ExecuteScalar());

                    cmd.CommandText = "select price_present from TBL_P_PRICE where product_id = @product_id and price_yn = 'Y'";
                    cmd.Parameters.AddWithValue("@product_id", vo.product_id);
                    int price = (Convert.ToInt32(cmd.ExecuteScalar()) * vo.ship_count);

                    cmd.CommandText = "insert into TBL_SALES (ship_id, sales_date, sales_price) values(@ship_id, replace(convert(varchar(10), getdate(), 120), '-', '-'), @sales_price)";
                    cmd.Parameters.AddWithValue("@sales_price", price);
                    cmd.ExecuteNonQuery();

                    trans.Commit();
                    return(1);
                }
                catch (Exception err)
                {
                    string msg = err.Message;
                    trans.Rollback();
                    return(0);
                }
            }
        }
Exemple #3
0
        public int Shipment(ShipmentVO vo)
        {
            ShipmentDAC dac = new ShipmentDAC();

            return(dac.Shipment(vo));
        }