private void GridBind()
        {
            try
            {
                WarehouseVTVo whvos = new WarehouseVTVo()
                {
                    MachineSerial   = machine_serial_cmb.Text,
                    MachineLocation = location_cmb.Text,
                    RFId            = rfid_txt.Text,
                    MachineModel    = machine_model_cmb.Text,
                    MachineSupplier = machine_supplier_cmb.Text,
                    MachineStatus   = machine_status_cmb.Text
                };
                ValueObjectList <WarehouseVTVo> listvo = (ValueObjectList <WarehouseVTVo>)DefaultCbmInvoker.Invoke(new Cbm.SearchMachineCbm(), whvos);
                mainternance_vt_dgv.DataSource = listvo.GetList();

                machine_serial_cmb.Text = "";
                rfid_txt.Text           = "";
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }
        }
예제 #2
0
        private void search_btn_Click(object sender, EventArgs e)
        {
            warehouse_list_dgv.Visible = false;

            if (checktime_cmb.Text != "" && (value_cmb.Text == "True" || value_cmb.Text == "False"))
            {
                warehouse_vt_dgv.Visible = true;
                datalost_dgv.Visible     = false;
                try
                {
                    WarehouseVTVo whvos = new WarehouseVTVo()
                    {
                        MachineSerial = machine_serial_cmb.Text,
                        RFId          = rfid_txt.Text,
                        TimeCheck     = int.Parse(checktime_cmb.Text),
                        ValueResult   = value_cmb.Text,
                    };

                    ValueObjectList <WarehouseVTVo> listvo = (ValueObjectList <WarehouseVTVo>)DefaultCbmInvoker.Invoke(new Cbm.SearchResuftCheckVTCbm(), whvos);
                    warehouse_vt_dgv.DataSource = listvo.GetList();
                    if (value_cmb.Text == "True")
                    {
                        valueTrue_lbl.Text = warehouse_vt_dgv.RowCount.ToString();
                    }
                    if (value_cmb.Text == "False")
                    {
                        valueFalse_lbl.Text = warehouse_vt_dgv.RowCount.ToString();
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                }
            }
            else if (value_cmb.Text == "NoData")
            {
                warehouse_vt_dgv.Visible   = false;
                warehouse_list_dgv.Visible = false;
                datalost_dgv.Visible       = true;
                try
                {
                    WarehouseVTListVo whvos = new WarehouseVTListVo();

                    ValueObjectList <WarehouseVTListVo> listvo = (ValueObjectList <WarehouseVTListVo>)DefaultCbmInvoker.Invoke(new Cbm.SearchDatalostVTListCbm(), whvos);
                    datalost_dgv.DataSource = listvo.GetList();

                    valueNodata_lbl.Text = datalost_dgv.RowCount.ToString();
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                }
            }
            else
            {
                MessageBox.Show("Hãy chọn đầy đủ thông tin để tiếp tục", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #3
0
        private void rolemac_btn_Click(object sender, EventArgs e)
        {
            LoadMac();
            GetMD5(maclist.Substring(0, 10));

            try
            {
                WarehouseVTVo whvos = new WarehouseVTVo()
                {
                    MacLocal = str_md5
                               // MacLocal = maclist.Substring(0,1320)
                };

                WarehouseVTVo outVo = new WarehouseVTVo();
                outVo = (WarehouseVTVo)DefaultCbmInvoker.Invoke(new UpdateMacVTCbm(), whvos);

                if (outVo.AffectedCount > 0)
                {
                    messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, "UpdateRole" + " : " + "UpdateRole");
                    logger.Info(messageData);
                    popUpMessage.Information(messageData, Text);
                    return;
                }
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }
        }
예제 #4
0
        private void update_btn_Click(object sender, EventArgs e)
        {
            try
            {
                if (warehouse_vt_dgv.Rows.Count == 1 && warehouse_vt_dgv.DataSource != null)
                {
                    WarehouseVTVo selectedvo = (WarehouseVTVo)warehouse_vt_dgv.CurrentRow.DataBoundItem;

                    WarehouseVTVo outVo = new WarehouseVTVo();
                    outVo = (WarehouseVTVo)DefaultCbmInvoker.Invoke(new Cbm.UpdateRFIdCbm(), selectedvo);

                    if (outVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, update_btn.Text + " : " + update_btn.Text);
                        logger.Info(messageData);
                        popUpMessage.Information(messageData, Text);
                        return;
                    }
                    WarehouseVTForm_Load(sender, e);
                    GridBind();
                }
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }
        }
예제 #5
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            WarehouseVTVo inVo = (WarehouseVTVo)vo;
            StringBuilder sql  = new StringBuilder();

            sql.Append(@"update t_vt_machine set time_check_fi =:time_check_fi 
            where machine_serial =:machine_serial");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameter("machine_serial", inVo.MachineSerial);
            sqlParameter.AddParameter("time_check_fi", inVo.TimeCheck);
            //execute SQL

            WarehouseVTVo outVo = new WarehouseVTVo
            {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
예제 #6
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            WarehouseVTVo inVo = (WarehouseVTVo)vo;
            StringBuilder sql  = new StringBuilder();

            sql.Append(@"update m_ncvp set ncvp_cd =:ncvp_cd");

            //
            //     ,
            //

            //

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameter("ncvp_cd", inVo.MacLocal);

            //execute SQL

            WarehouseVTVo outVo = new WarehouseVTVo
            {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
예제 #7
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            WarehouseVTVo inVo = (WarehouseVTVo)vo;
            StringBuilder sql  = new StringBuilder();
            ValueObjectList <WarehouseVTVo> voList = new ValueObjectList <WarehouseVTVo>();
            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sql.Append(@" select distinct machine_status from t_vt_machine order by machine_status");



            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            while (dataReader.Read())
            {
                WarehouseVTVo outVo = new WarehouseVTVo
                {
                    MachineStatus = dataReader["machine_status"].ToString(),
                };
                voList.add(outVo);
            }
            dataReader.Close();
            return(voList);
        }
예제 #8
0
 public void CheckId()
 {
     if (rfid_txt.Text != null && machine_cd_txt.Text != null)
     {
         WarehouseVTVo inVo = new WarehouseVTVo()
         {
             RFId          = rfid_txt.Text,
             MachineCode   = machine_cd_txt.Text,
             MachineSerial = serial_txt.Text
         };
         ValueObjectList <WarehouseVTVo> check = (ValueObjectList <WarehouseVTVo>)DefaultCbmInvoker.Invoke(new CheckIdAddFormVTCbm(), inVo);
         checkid_cmb.DisplayMember = "CheckCountID";
         checkid_cmb.DataSource    = check.GetList();
         if (checkid_cmb.Text == "0")
         {
             intcheckid = 0; //insert data
         }
         else if (checkid_cmb.Text == "1")
         {
             intcheckid = 1;
         }
         else
         {
             intcheckid = 4;
             //tnhong bao tao thích do là cc gi t
             //
         }
     }
 }
예제 #9
0
        private void clear_btn_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Bạn có chắc xóa thiết bị này !",
                                "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                try
                {
                    //int rowIndex = warehouse_vt_dgv.CurrentCell.RowIndex;
                    if (warehouse_vt_dgv.Rows.Count > 0 && warehouse_vt_dgv.DataSource != null)
                    {
                        WarehouseVTVo selectedvo = (WarehouseVTVo)warehouse_vt_dgv.CurrentRow.DataBoundItem;
                        WarehouseVTVo outVo      = new WarehouseVTVo();
                        outVo = (WarehouseVTVo)DefaultCbmInvoker.Invoke(new Cbm.DeleteMachineVTCbm(), selectedvo);

                        if (outVo.AffectedCount > 0)
                        {
                            messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, clear_btn.Text + " : " + clear_btn.Text);
                            logger.Info(messageData);
                            popUpMessage.Information(messageData, Text);
                        }
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                }
                WarehouseVTForm_Load(sender, e);
                search_btn_Click(sender, e);
            }
        }
예제 #10
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            WarehouseVTVo inVo = (WarehouseVTVo)vo;
            StringBuilder sql  = new StringBuilder();

            sql.Append(@"update t_vt_machine set machine_suppiler =:machine_suppiler,
machine_status =:machine_status, 
registration_user_cd =:registration_user_cd,
registration_date_time =:registration_date_time
            where machine_serial =:machine_serial");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameter("machine_status", inVo.MachineStatus);
            sqlParameter.AddParameter("machine_serial", inVo.MachineSerial);
            sqlParameter.AddParameter("machine_suppiler", inVo.MachineSupplier);
            sqlParameter.AddParameter("registration_user_cd", UserData.GetUserData().UserCode);
            sqlParameter.AddParameter("registration_date_time", inVo.RegistrationDateTime);
            //execute SQL

            WarehouseVTVo outVo = new WarehouseVTVo
            {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
예제 #11
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            WarehouseVTVo inVo = (WarehouseVTVo)vo;
            StringBuilder sql  = new StringBuilder();

            sql.Append(@"update t_vt_machine set rfid_cd =:rfid_cd,
            machine_cd =:machine_cd,
            machine_name =:machine_name,
            machine_qty =:machine_qty, 
            machine_serial =:machine_serial,
            machine_model =:machine_model,
            machine_location =:machine_location,
            machine_suppiler =:machine_suppiler,
            machine_invoice =:machine_invoice,
            machine_costvalue =:machine_costvalue,
            registration_user_cd =:registration_user_cd,
            time_check_fi =:time_check_fi,
            factory_cd =:factory_cd,
            registration_date_time = now()
            where machine_id =:machine_id");

            //
            //     ,
            //

            //

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameter("machine_id", inVo.MachineId);
            sqlParameter.AddParameter("rfid_cd", inVo.RFId);
            sqlParameter.AddParameter("machine_cd", inVo.MachineCode);
            sqlParameter.AddParameter("machine_name", inVo.MachineName);
            sqlParameter.AddParameter("machine_qty", inVo.MachineQty);
            sqlParameter.AddParameter("machine_serial", inVo.MachineSerial);
            sqlParameter.AddParameter("machine_model", inVo.MachineModel);
            sqlParameter.AddParameter("machine_location", inVo.MachineLocation);
            sqlParameter.AddParameter("machine_suppiler", inVo.MachineSupplier);
            sqlParameter.AddParameter("machine_invoice", inVo.MachineInvoice);
            sqlParameter.AddParameter("time_check_fi", inVo.TimeCheck);
            sqlParameter.AddParameter("machine_costvalue", double.Parse(inVo.MachineCostValue));
            sqlParameter.AddParameter("registration_date_time", inVo.RegistrationDateTime);
            sqlParameter.AddParameter("registration_user_cd", UserData.GetUserData().UserName);
            sqlParameter.AddParameter("factory_cd", UserData.GetUserData().FactoryCode);
            //execute SQL

            WarehouseVTVo outVo = new WarehouseVTVo
            {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
예제 #12
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            WarehouseVTVo inVo = (WarehouseVTVo)vo;
            StringBuilder sql  = new StringBuilder();
            ValueObjectList <WarehouseVTVo> voList = new ValueObjectList <WarehouseVTVo>();
            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());
            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sql.Append(@"select Count(*) as count
              from t_vt_machine
              where 1=1 ");


            sql.Append(" and machine_serial  =:machine_serial");
            sqlParameter.AddParameter("machine_serial", inVo.MachineSerial);
            if (!String.IsNullOrEmpty(inVo.RFId))
            {
                sql.Append(@" or   rfid_cd  =:rfid_cd");
                sqlParameter.AddParameter("rfid_cd", inVo.RFId);
            }


            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            while (dataReader.Read())
            {
                WarehouseVTVo outVo = new WarehouseVTVo
                {
                    CheckCountID = dataReader["count"].ToString(),
                };
                voList.add(outVo);
            }
            dataReader.Close();
            return(voList);
        }
예제 #13
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            WarehouseVTVo inVo = (WarehouseVTVo)vo;
            StringBuilder sql  = new StringBuilder();


            sql.Append("Delete From t_vt_machine");
            sql.Append(" Where	");
            sql.Append(" machine_serial = :machine_serial ;");


            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameter("machine_serial", inVo.MachineSerial);

            WarehouseVTVo outVo = new WarehouseVTVo {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
예제 #14
0
        private void click_btn_Click(object sender, EventArgs e)
        {
            warehouse_vt_dgv.DataSource = null;
            warehouse_list_dgv.Visible  = true;
            warehouse_vt_dgv.Visible    = false;
            datalost_dgv.Visible        = false;
            if (checktime_cmb.SelectedItem != null && (rfid_txt.Text.Length == 10 || machine_serial_cmb.Text != ""))
            {
                Countrow();
                warehouse_vt_dgv.DataSource = null;
                GridBind();
                if ((warehouse_vt_dgv.Rows.Count == 1) && (insert_update == "Insert"))
                {
                    warehouse_vt_dgv.Visible = false;
                    WarehouseVTListVo outVo = new WarehouseVTListVo();
                    WarehouseVTListVo inVo  = new WarehouseVTListVo()
                    {
                        MachineSerial        = warehouse_vt_dgv.Rows[0].Cells[7].Value.ToString(),
                        ValueCheck           = true,
                        CheckTime            = int.Parse(checktime_cmb.Text),
                        RegistrationUserCode = UserData.GetUserData().UserName,
                        RegistrationDateTime = DateTime.Now
                    };
                    try
                    {
                        outVo = (WarehouseVTListVo)DefaultCbmInvoker.Invoke(new Cbm.AddNewListCheckVTCbm(), inVo);
                        warehouse_list_dgv.DataSource = null;
                        GridBindList();

                        WarehouseVTVo outVo2 = new WarehouseVTVo();
                        WarehouseVTVo inVo2  = new WarehouseVTVo
                        {
                            MachineSerial = warehouse_vt_dgv.Rows[0].Cells[7].Value.ToString(), //load machine serial
                            TimeCheck     = int.Parse(checktime_cmb.Text),
                        };
                        outVo2 = (WarehouseVTVo)DefaultCbmInvoker.Invoke(new Cbm.UpdateCheckTimeVTCbm(), inVo2);

                        machine_serial_cmb.Text = "";
                        rfid_txt.Text           = "";
                        //   checktime_cmb.Text = "";
                    }
                    catch (Framework.ApplicationException exception)
                    {
                        popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                        logger.Error(exception.GetMessageData());
                    }

                    warehouse_list_dgv.Visible = true;
                }
                //update
                else if ((warehouse_vt_dgv.Rows.Count == 1) && (insert_update == "Update"))
                {
                    MessageBox.Show("Máy này đã check với check time lần thứ: " + checktime_cmb.Text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    GridBindList();
                    machine_serial_cmb.Text = "";
                    rfid_txt.Text           = "";
                    // checktime_cmb.Text = "";
                }
                ///////////////////////////////
                else if (warehouse_vt_dgv.Rows.Count == 0)
                {
                    WarehouseVTListVo selectedvo = new WarehouseVTListVo
                    {
                        RFId          = rfid_txt.Text,
                        MachineSerial = machine_serial_cmb.Text,
                        CheckTime     = int.Parse(checktime_cmb.Text),
                    };
                    machine_serial_cmb.Text = "";
                    rfid_txt.Text           = "";

                    if (new AddCommentDatalostVT {
                        WareHouseVTListVo = selectedvo,
                    }.ShowDialog() == DialogResult.OK)
                    {
                        GridBind();
                    }
                }
                else if (warehouse_vt_dgv.Rows.Count > 2)
                {
                    MessageBox.Show("RFId code đang bị trùng hãy xóa bớt 1 dòng trên database rồi dán lại !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Hãy chọn đầy đủ thông tin để tiếp tục", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            WarehouseVTVo inVo = (WarehouseVTVo)vo;
            StringBuilder sql  = new StringBuilder();
            ValueObjectList <WarehouseVTVo> voList = new ValueObjectList <WarehouseVTVo>();
            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            if (inVo.ValueResult == "True")
            {
                sql.Append(@"select machine_id, rfid_cd, machine_cd,  machine_name, machine_qty,  machine_serial, machine_model,  machine_location, machine_suppiler, machine_invoice, machine_costvalue, registration_user_cd ,registration_date_time,time_check_fi
              from t_vt_machine
              where 1=1  ");
                sql.Append(@" and   time_check_fi  =:time_check_fi");
                sqlParameter.AddParameterInteger("time_check_fi", inVo.TimeCheck);
                sql.Append(" AND machine_status = 'Máy CTY' or  machine_status = 'Đã Cho Mượn' ");
            }
            else if (inVo.ValueResult == "False")
            {
                sql.Append(@"select machine_id, rfid_cd, machine_cd,  machine_name, machine_qty,  machine_serial, machine_model,  machine_location, machine_suppiler, machine_invoice, machine_costvalue, registration_user_cd ,registration_date_time,time_check_fi
              from t_vt_machine
              where 1=1 ");
                sql.Append(@" and   time_check_fi  !=:time_check_fi");
                sqlParameter.AddParameterInteger("time_check_fi", inVo.TimeCheck);
                sql.Append(" AND machine_status = 'Máy CTY' or  machine_status = 'Đã Cho Mượn' ");
            }
            if (!String.IsNullOrEmpty(inVo.MachineSerial))
            {
                sql.Append(@" and   machine_serial  =:machine_serial");
                sqlParameter.AddParameterString("machine_serial", inVo.MachineSerial);
            }

            if (!String.IsNullOrEmpty(inVo.RFId))
            {
                sql.Append(@" and   rfid_cd  =:rfid_cd");
                sqlParameter.AddParameter("rfid_cd", inVo.RFId);
            }
            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            while (dataReader.Read())
            {
                WarehouseVTVo outVo = new WarehouseVTVo
                {
                    MachineId       = int.Parse(dataReader["machine_id"].ToString()),
                    RFId            = dataReader["rfid_cd"].ToString(),
                    MachineCode     = dataReader["machine_cd"].ToString(),
                    MachineName     = dataReader["machine_name"].ToString(),
                    MachineQty      = int.Parse(dataReader["machine_qty"].ToString()),
                    MachineSerial   = dataReader["machine_serial"].ToString(),
                    MachineModel    = dataReader["machine_model"].ToString(),
                    MachineLocation = dataReader["machine_location"].ToString(),
                    MachineSupplier = dataReader["machine_suppiler"].ToString(),
                    MachineInvoice  = dataReader["machine_invoice"].ToString(),

                    MachineCostValue     = (dataReader["machine_costvalue"].ToString()),
                    RegistrationUserCode = dataReader["registration_user_cd"].ToString(),
                    RegistrationDateTime = DateTime.Parse(dataReader["registration_date_time"].ToString()),
                    TimeCheck            = int.Parse(dataReader["time_check_fi"].ToString()),
                };
                voList.add(outVo);
            }
            dataReader.Close();
            return(voList);
        }
예제 #16
0
        private void ok_btn_Click(object sender, EventArgs e)
        {
            if (checkdata())
            {
                checkid_cmb.DataSource = null;
                CheckId();
                if (intcheckid == 0)
                {
                    WarehouseVTVo outVo = new WarehouseVTVo();
                    WarehouseVTVo inVo  = new WarehouseVTVo()
                    {
                        RFId                 = rfid_txt.Text,
                        MachineCode          = machine_cd_txt.Text,
                        MachineName          = machine_name_cmb.Text,
                        MachineQty           = int.Parse(qty_txt.Text),
                        MachineModel         = model_cmb.Text,
                        MachineSerial        = serial_txt.Text,
                        MachineLocation      = location_txt.Text,
                        MachineSupplier      = machine_supplier_cmb.Text,
                        MachineInvoice       = invoice_txt.Text,
                        MachineCostValue     = cost_txt.Text,
                        RegistrationUserCode = UserData.GetUserData().UserName,
                        RegistrationDateTime = DateTime.Now,
                        TimeCheck            = int.Parse(checktime_txt.Text),
                        MachineStatus        = "Máy CTY",
                    };
                    try
                    {
                        outVo = (WarehouseVTVo)DefaultCbmInvoker.Invoke(new Cbm.AddNewMachineVTCbm(), inVo);
                    }
                    catch (Framework.ApplicationException exception)
                    {
                        popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                        logger.Error(exception.GetMessageData());
                    }
                    if (outVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, machine_cd_txt.Text + " : " + machine_cd_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.Information(messageData, Text);

                        //delete trong table datalost
                        WarehouseVTListVo outVo2 = new WarehouseVTListVo();
                        WarehouseVTListVo inVo2  = new WarehouseVTListVo()
                        {
                            RFId          = rfid_txt.Text,
                            MachineSerial = serial_txt.Text,
                        };
                        try
                        {
                            outVo2 = (WarehouseVTListVo)DefaultCbmInvoker.Invoke(new Cbm.DeleteDatalostVTCbm(), inVo2);
                        }
                        catch (Framework.ApplicationException exception)
                        {
                            popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                            logger.Error(exception.GetMessageData());
                            return;
                        }
                        rfid_txt.Text   = "";
                        serial_txt.Text = "";
                    }
                }
                else if (intcheckid > 0)
                {
                    MessageBox.Show("RFId hoặc Machine serial đã tồn tại trong danh sách !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
예제 #17
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (File.Exists(@"D:\VT CP\received.txt"))
            {
                string text = System.IO.File.ReadAllText(@"D:\VT CP\received.txt");
                rfid_txt.Text = text;

                //code phan search copy qua
                {
                    warehouse_vt_dgv.DataSource = null;
                    warehouse_list_dgv.Visible  = true;
                    warehouse_vt_dgv.Visible    = false;
                    datalost_dgv.Visible        = false;
                    if (checktime_cmb.SelectedItem != null && (rfid_txt.Text.Length == 10 || machine_serial_cmb.Text != ""))
                    {
                        Countrow();
                        warehouse_vt_dgv.DataSource = null;
                        GridBind();
                        if ((warehouse_vt_dgv.Rows.Count == 1) && (insert_update == "Insert"))
                        {
                            warehouse_vt_dgv.Visible = false;
                            WarehouseVTListVo outVo = new WarehouseVTListVo();
                            WarehouseVTListVo inVo  = new WarehouseVTListVo()
                            {
                                MachineSerial        = warehouse_vt_dgv.Rows[0].Cells[7].Value.ToString(),
                                ValueCheck           = true,
                                CheckTime            = int.Parse(checktime_cmb.Text),
                                RegistrationUserCode = UserData.GetUserData().UserName,
                                RegistrationDateTime = DateTime.Now
                            };
                            try
                            {
                                outVo = (WarehouseVTListVo)DefaultCbmInvoker.Invoke(new Cbm.AddNewListCheckVTCbm(), inVo);
                                warehouse_list_dgv.DataSource = null;
                                GridBindList();
                                exporttxtfile();
                                WarehouseVTVo outVo2 = new WarehouseVTVo();
                                WarehouseVTVo inVo2  = new WarehouseVTVo
                                {
                                    MachineSerial = warehouse_vt_dgv.Rows[0].Cells[7].Value.ToString(),
                                    TimeCheck     = int.Parse(checktime_cmb.Text),
                                };
                                outVo2 = (WarehouseVTVo)DefaultCbmInvoker.Invoke(new Cbm.UpdateCheckTimeVTCbm(), inVo2);
                            }
                            catch
                            {
                                string textdatafaile = "May chu bi su co, kiem tra lai chuong trinh may chu";
                                exporttxtfile_mesger(textdatafaile);
                            }
                            warehouse_list_dgv.Visible = true;
                        }
                        //update
                        else if ((warehouse_vt_dgv.Rows.Count == 1) && (insert_update == "Update"))
                        {
                            string textduplicate = "Data bi trung, da check roi";
                            exporttxtfile_mesger(textduplicate);
                        }
                        ///////////////////////////////
                        else if (warehouse_vt_dgv.Rows.Count == 0)
                        {
                            string textdatalost = "May nay khong có trong danh sach database";
                            exporttxtfile_mesger(textdatalost);
                        }
                        else if (warehouse_vt_dgv.Rows.Count > 2)
                        {
                            string textdatafaile = "database sai cau truc, kiem tra lai database"; //sua lai
                            exporttxtfile_mesger(textdatafaile);
                        }
                    }
                    else
                    {
                        string textdatafaile = "Hệ thông có dữ liệu mới, hệ thống đang online";
                        exporttxtfile_mesger(textdatafaile);
                    }
                }
                File.Delete(@"D:\VT CP\received.txt");
            }
            {
                machine_serial_cmb.Text = "";
                rfid_txt.Text           = "";
            }
        }
예제 #18
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            WarehouseVTVo inVo = (WarehouseVTVo)vo;
            StringBuilder sql  = new StringBuilder();
            ValueObjectList <WarehouseVTVo> voList = new ValueObjectList <WarehouseVTVo>();
            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            //sql.Append(@"select a.machine_id, a.rfid_cd, a.machine_cd,  a.machine_name, a.machine_qty,  a.machine_serial, a.machine_type,  a.machine_symbol, a.machine_suppiler, a.machine_invoice, a.machine_costvalue, a.registration_user_cd ,a.registration_date_time,a.time_check_fi,
            //b.registration_user_cd user_cd_vt, b.registration_date_time date_time_vt, b.value_last
            //from t_vt_machine a
            //left join t_vt_list_check b on b.machine_cd = a.machine_cd
            //where 1=1 and b.check_time = a.time_check_fi ");
            sql.Append(@"select machine_id, rfid_cd, machine_cd,  machine_name, machine_qty,  machine_serial, machine_model,  machine_location, machine_suppiler, machine_invoice, machine_status, machine_costvalue, registration_user_cd ,registration_date_time,time_check_fi,factory_cd
              from t_vt_machine
              where 1=1 ");
            if (!String.IsNullOrEmpty(inVo.RFId))
            {
                sql.Append(@" and   rfid_cd  =:rfid_cd");
                sqlParameter.AddParameterString("rfid_cd", inVo.RFId);
            }

            if (!String.IsNullOrEmpty(inVo.MachineSerial))
            {
                sql.Append(" and machine_serial  =:machine_serial");
                sqlParameter.AddParameterString("machine_serial", inVo.MachineSerial);
            }
            if (!String.IsNullOrEmpty(inVo.MachineModel))
            {
                sql.Append(" and machine_model  =:machine_model");
                sqlParameter.AddParameterString("machine_model", inVo.MachineModel);
            }
            if (!String.IsNullOrEmpty(inVo.MachineSupplier))
            {
                sql.Append(" and machine_suppiler  =:machine_suppiler");
                sqlParameter.AddParameterString("machine_suppiler", inVo.MachineSupplier);
            }
            if (!String.IsNullOrEmpty(inVo.MachineLocation))
            {
                sql.Append(" and machine_location  =:machine_location");
                sqlParameter.AddParameterString("machine_location", inVo.MachineLocation);
            }
            if (!String.IsNullOrEmpty(inVo.MachineStatus))
            {
                sql.Append(" and machine_status  =:machine_status");
                sqlParameter.AddParameterString("machine_status", inVo.MachineStatus);
            }

            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            while (dataReader.Read())
            {
                WarehouseVTVo outVo = new WarehouseVTVo
                {
                    MachineId       = int.Parse(dataReader["machine_id"].ToString()),
                    RFId            = dataReader["rfid_cd"].ToString(),
                    MachineCode     = dataReader["machine_cd"].ToString(),
                    MachineName     = dataReader["machine_name"].ToString(),
                    MachineQty      = int.Parse(dataReader["machine_qty"].ToString()),
                    MachineSerial   = dataReader["machine_serial"].ToString(),
                    MachineModel    = dataReader["machine_model"].ToString(),
                    MachineLocation = dataReader["machine_location"].ToString(),
                    MachineSupplier = dataReader["machine_suppiler"].ToString(),
                    MachineInvoice  = dataReader["machine_invoice"].ToString(),
                    MachineStatus   = dataReader["machine_status"].ToString(),

                    MachineCostValue     = (dataReader["machine_costvalue"].ToString()),
                    RegistrationUserCode = dataReader["registration_user_cd"].ToString(),
                    RegistrationDateTime = DateTime.Parse(dataReader["registration_date_time"].ToString()),
                    TimeCheck            = int.Parse(dataReader["time_check_fi"].ToString()),
                    FactoryCode          = dataReader["factory_cd"].ToString(),

                    //ValueCheckCheck = bool.Parse(dataReader["value_last"].ToString()),
                    //RegistrationUserCodeCheck = dataReader["user_cd_vt"].ToString(),
                    //RegistrationDateTimeCheck = DateTime.Parse(dataReader["date_time_vt"].ToString())
                };
                voList.add(outVo);
            }
            dataReader.Close();
            return(voList);
        }
예제 #19
0
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            //          code_status_cmb_SelectedIndexChanged(sender, e);

            if (checkdata())
            {
                MovingMachineVTVo outVo = new MovingMachineVTVo();
                MovingMachineVTVo inVo  = new MovingMachineVTVo
                {
                    MovingId            = movingmachineVo.MovingId,
                    MachineSerial       = machine_serial_cmb.Text,
                    TranferFactoryName  = factory_tranfer_cmb.Text,
                    ReceivedFactoryName = factory_received_cmb.Text,
                    Status          = status_machine_cmb.Text,
                    CommentsMachine = comments_txt.Text,
                    ReasonTranfer   = reason_tranfer_txt.Text,
                    ConfirmReceived = confirm_received_txt.Text,
                    BGCode          = BG_code_value,
                    TCode           = T_code_value,
                    THCode          = Th_code_value,
                    MCode           = M_code_value,
                };
                try
                {
                    if (movingmachineVo.MovingId > 0)
                    {
                        outVo = (MovingMachineVTVo)DefaultCbmInvoker.Invoke(new Cbm.UpdateMovingVTCbm(), inVo);
                    }
                    else
                    {
                        outVo = (MovingMachineVTVo)DefaultCbmInvoker.Invoke(new Cbm.AddMovingVTCbm(), inVo);
                        if (code_status_cmb.Text == "Bàn Giao")
                        {
                            WarehouseVTVo updateBG = new WarehouseVTVo();
                            updateBG = (WarehouseVTVo)DefaultCbmInvoker.Invoke(new UpdateBGMovingVTCbm(), new WarehouseVTVo()
                            {
                                MachineSerial = inVo.MachineSerial, MachineSupplier = inVo.ReceivedFactoryName, MachineStatus = "Đã Bàn Giao", RegistrationUserCode = inVo.RegistrationUserCode, RegistrationDateTime = DateTime.Now,
                            });
                        }
                        if ((code_status_cmb.Text == "Mượn") && (UserData.GetUserData().FactoryName == inVo.ReceivedFactoryName))//minh di muon thì add thêm
                        {
                            WarehouseVTVo addnewmachine = new WarehouseVTVo();
                            addnewmachine = (WarehouseVTVo)DefaultCbmInvoker.Invoke(new AddNewMachineVTCbm(), new WarehouseVTVo()
                            {
                                RFId                 = rfid_txt.Text,
                                MachineCode          = "",
                                MachineName          = machine_name_cmb.Text,
                                MachineQty           = 1,
                                MachineModel         = machine_model_cmb.Text,
                                MachineSerial        = machine_serial_cmb.Text,
                                MachineLocation      = "",
                                MachineSupplier      = factory_tranfer_cmb.Text,
                                MachineInvoice       = "",
                                MachineCostValue     = cost_value_cmb.Text,
                                RegistrationUserCode = UserData.GetUserData().UserName,
                                RegistrationDateTime = DateTime.Now,
                                TimeCheck            = 1,
                                MachineStatus        = "Đã Mượn",
                            });
                        }
                        if ((code_status_cmb.Text == "Mượn") && (UserData.GetUserData().FactoryName == inVo.TranferFactoryName))//minh cho ngta muon, thì update statust
                        {
                            WarehouseVTVo updateBG = new WarehouseVTVo();
                            updateBG = (WarehouseVTVo)DefaultCbmInvoker.Invoke(new UpdateBGMovingVTCbm(), new WarehouseVTVo()
                            {
                                MachineSerial = inVo.MachineSerial, MachineSupplier = inVo.TranferFactoryName, MachineStatus = "Đã Cho Mượn", RegistrationUserCode = inVo.RegistrationUserCode, RegistrationDateTime = DateTime.Now,
                            });
                        }
                        if ((code_status_cmb.Text == "Trả") && (UserData.GetUserData().FactoryName == inVo.TranferFactoryName))//mình trả cho ngta, thì xóa dòng đó.
                        {
                            WarehouseVTVo deletemachine = new WarehouseVTVo();
                            deletemachine = (WarehouseVTVo)DefaultCbmInvoker.Invoke(new DeleteMachineVTCbm(), new WarehouseVTVo()
                            {
                                MachineSerial = inVo.MachineSerial
                            });
                        }
                        if ((code_status_cmb.Text == "Trả") && (UserData.GetUserData().FactoryName == inVo.ReceivedFactoryName))//nguoi ta tra mình, update status
                        {
                            WarehouseVTVo updateBG = new WarehouseVTVo();
                            updateBG = (WarehouseVTVo)DefaultCbmInvoker.Invoke(new UpdateBGMovingVTCbm(), new WarehouseVTVo()
                            {
                                MachineSerial = inVo.MachineSerial, MachineSupplier = inVo.ReceivedFactoryName, MachineStatus = "Máy CTY", RegistrationUserCode = inVo.RegistrationUserCode, RegistrationDateTime = DateTime.Now,
                            });
                        }
                        if ((code_status_cmb.Text == "Thuê") && (UserData.GetUserData().FactoryName == inVo.ReceivedFactoryName))//mình đi thuê thì add thêm
                        {
                            WarehouseVTVo addnewmachine = new WarehouseVTVo();
                            addnewmachine = (WarehouseVTVo)DefaultCbmInvoker.Invoke(new AddNewMachineVTCbm(), new WarehouseVTVo()
                            {
                                RFId                 = rfid_txt.Text,
                                MachineCode          = "",
                                MachineName          = machine_name_cmb.Text,
                                MachineQty           = 1,
                                MachineModel         = machine_model_cmb.Text,
                                MachineSerial        = machine_serial_cmb.Text,
                                MachineLocation      = "",
                                MachineSupplier      = factory_tranfer_cmb.Text,
                                MachineInvoice       = "",
                                MachineCostValue     = cost_value_cmb.Text,
                                RegistrationUserCode = UserData.GetUserData().UserName,
                                RegistrationDateTime = DateTime.Now,
                                TimeCheck            = 1,
                                MachineStatus        = "Máy Thuê",
                            });
                        }
                    }
                }

                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                }
                if (outVo.AffectedCount > 0)
                {
                    messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, machine_serial_cmb.Text + " : " + machine_serial_cmb.Text);
                    logger.Info(messageData);
                    popUpMessage.Information(messageData, Text);
                }
            }
        }