Beispiel #1
0
        private void btnWHHistory_Click(object sender, EventArgs e)
        {
            using (MySqlConnection CnnMySQL = ServerHelper.ConnectToMySQL())
            {
                using (MySqlTransaction TranMySQL = CnnMySQL.BeginTransaction())
                {
                    try
                    {
                        WHIOType IOType = WHIOType.Input;
                        for (int i = 1; i < 1000; i++)
                        {
                            WHHistory WHHistory = new WHHistory();
                            WHHistory.TranMySQL = TranMySQL;
                            WHHistory.ItemNo = "01TX0015";
                            WHHistory.IOType = IOType;
                            WHHistory.OKQty = 111;
                            WHHistory.CreatedBy = "Kenneth";
                            WHHistory.CreatedDate = DateTime.Now;
                            WHHistory.CnnMySQL = CnnMySQL;
                            WHHistory.Save();

                            if (IOType == WHIOType.Input)
                                IOType = WHIOType.Output;
                            else
                                IOType = WHIOType.Input;

                        }
                        TranMySQL.Commit();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        TranMySQL.Rollback();
                    }
                }
                MessageBox.Show("OK");
            }
        }
        public void DeductWH()
        {
            if (OrderStatus != "Waiting")
                return;

            WHHistory WHHistory = new WHHistory();
            WHHistory.ItemNo = ItemNo;
            WHHistory.ItemName = ItemName;
            WHHistory.ItemType = ItemType;
            WHHistory.RefNo = OrderNo;
            WHHistory.RefType = "SO";
            WHHistory.OKQty = MoveQty;
            WHHistory.VendDefectQty = 0;
            WHHistory.DefectQty = 0;
            //WHHistory.OK = "ok";
            WHHistory.Supplier = Destination;
            WHHistory.Status = "Complete";
            WHHistory.IOType = WHIOType.Output;
            WHHistory.Save();

            ChangeStatus("TSI");
            UpdateAllRecord();
        }