Ejemplo n.º 1
0
        public void validation()
        {
            string partID = this.txt_partID_input.Text;

            if (string.IsNullOrEmpty(partID))
            {
                MessageBox.Show("Part ID can not be empty!");
                this.txt_partID.Focus();
                return;
            }



            //查询tracking
            BLL.Tracking   trackBLL   = new BLL.Tracking();
            Model.Tracking trackModel = trackBLL.GetModel(partID);
            if (trackModel == null || trackModel.STATUS != StaticRes.Global.Status.PendingMix)
            {
                MessageBoxResult result = MessageBox.Show("This epoxy is not got from EMS, are you still need to mix?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (result == MessageBoxResult.No || result == MessageBoxResult.Cancel || result == MessageBoxResult.None)
                {
                    return;
                }
            }
            else
            {
                this.txt_partID.Text             = trackModel.PART_ID;
                this.txt_description.Text        = trackModel.DEPARTMENT;
                this.txt_thawingTime.Text        = trackModel.THAWING_DATETIME.Value.ToString("yyyy-MM-dd HH:mm:ss");
                this.txt_readyTime.Text          = trackModel.READY_DATETIME.Value.ToString("yyyy-MM-dd HH:mm:ss");
                this.txt_expiryTime.Text         = trackModel.EXPIRY_DATETIME.Value.ToString("yyyy-MM-dd HH:mm:ss");
                this.txt_currentWeight.Text      = trackModel.CURRENT_WEIGHT.ToString();
                this.txt_capacity.Text           = trackModel.CAPACITY.ToString();
                this.txt_emptySyringeWeight.Text = trackModel.EMPTY_SYRINGE_WEIGHT.ToString();
            }


            this.txt_partID_input.Background = System.Windows.Media.Brushes.White;
            this.btn_startMix.IsEnabled      = true;
            this.btn_startMix.Focus();
        }
Ejemplo n.º 2
0
        private bool Update(Model.Tracking trackModel, Model.History hisModel, Model.MixHistory mixModel)
        {
            BLL.MixHistory mixBLL   = new BLL.MixHistory();
            BLL.Tracking   trackBLL = new BLL.Tracking();
            BLL.History    hisBLL   = new BLL.History();

            List <SqlCommand> cmdList = new List <SqlCommand>();

            if (trackModel != null)
            {
                cmdList.Add(trackBLL.UpdateCommand(trackModel));
            }

            if (hisModel != null)
            {
                cmdList.Add(hisBLL.AddCommand(hisModel));
            }

            cmdList.Add(mixBLL.AddCommand(mixModel));



            return(Common.DB.SqlDB.SetData_Rollback(cmdList, Common.DB.Connection.SqlServer.EMS));
        }
Ejemplo n.º 3
0
        private void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            //检测 是否把epoxy拿了出来.
            //bool isMaterialIn = Hardware.IO_LIST.Input.X207_Mix_Material_In();
            //while (isMaterialIn)
            //{
            //    MessageBox.Show("Mixing complete, please open door and take out epoxy!");

            //    //重新检下测感应器状态.
            //    isMaterialIn = Hardware.IO_LIST.Input.X207_Mix_Material_In();
            //}



            //更新数据库
            Model.MixHistory mixModel = new Model.MixHistory();
            mixModel.PART_ID      = this.txt_partID_input.Text;
            mixModel.MIX_TIME     = decimal.Parse(mixTime.ToString());
            mixModel.MIX_DATETIME = DateTime.Now;
            mixModel.MIX_BY       = this.txt_userID.Text;
            mixModel.REMARK       = "";

            BLL.Tracking   trackBLL   = new BLL.Tracking();
            Model.Tracking trackModel = trackBLL.GetModel(this.txt_partID.Text);
            if (trackModel != null)
            {
                trackModel.STATUS       = StaticRes.Global.Status.Unload;
                trackModel.UPDATED_TIME = DateTime.Now;
                trackModel.ACTION       = "Mix";
            }

            BLL.History   hisBLL   = new BLL.History();
            Model.History hisModel = hisBLL.CopyTrackModel(trackModel);

            if (!Update(trackModel, hisModel, mixModel))
            {
                MessageBox.Show("Update database fail!");
                Common.Reports.LogFile.Log("[Mix] [BackgroundWorker_RunWorkerCompleted] - Update database fail partID:" + this.txt_partID.Text);
            }



            //init 变量
            onGoing       = false;
            runningTime   = 0;
            this.pb.Value = 0;



            //init ui
            InitMaterialInfo();
            this.txt_partID_input.Text      = "";
            this.txt_partID_input.IsEnabled = true;
            this.txt_partID_input.Focus();
            this.txt_partID_input.Background = StaticRes.ColorBrushes.Linear_Green;


            ShowWindow();

            this.txt_Msg.Text = "搅拌完成, 请取出后关闭或继续搅拌.";
        }