Beispiel #1
0
 public frm_Consumable(Maticsoft.Model.ConsumableInfo _ConsumableInfo)
 {
     InitializeComponent();
     grd_ConsumableInfo.DataContext = _ConsumableInfo;
     btn_Edit.IsEnabled             = true;
     MCP_CS.SetControl(grd_ConsumableInfo, false, false); //设置控件为不可编辑模式
     ShowImg(_ConsumableInfo.C_Picture);
 }
Beispiel #2
0
 //新增
 private void btn_Add_Click(object sender, RoutedEventArgs e)
 {
     Maticsoft.Model.ConsumableInfo _Consum = new Maticsoft.Model.ConsumableInfo();
     _Consum.C_Barcode = MCP_CS.ConsumableInfo.GetMaxID();
     grd_ConsumableInfo.DataContext = _Consum;
     IsAdd = true;
     btn_Save.IsEnabled = true;
     btn_Add.IsEnabled  = false;
     MCP_CS.SetControl(grd_ConsumableInfo, true, false); //设置控件为不可编辑模式
 }
 //
 //入库
 //
 private void btn_Storage_Click(object sender, RoutedEventArgs e)
 {
     _ConsumOperation.Operation = Maticsoft.BLL.cls_Consumable.ConsumableOperation.Storage;  //模式为入库模式
     MCP_CS.SetControl(grd_Rec_Or_Stog, true, true);
     MCP_CS.SetControl_Button(grd_Rec_Or_Stog, true, false);
     grd_Rec_Or_Stog.DataContext    = new Maticsoft.Model.ConsumableStorage();
     dgv_ConsumableList.ItemsSource = _dataList_Storage;
     lab_title.Content = "耗材入库";
     lab_User.Content  = "入库人:";
     txb_Consumable_Barcode.IsEnabled = false;
     txb_ConsumableName.IsEnabled     = false;
 }
 //
 //领料
 //
 private void btn_Receive_Click(object sender, RoutedEventArgs e)
 {
     _ConsumOperation.Operation = Maticsoft.BLL.cls_Consumable.ConsumableOperation.Receive; //模式为领料模式
     MCP_CS.SetControl(grd_Rec_Or_Stog, true, true);                                        //Text控件可编辑
     MCP_CS.SetControl_Button(grd_Rec_Or_Stog, true, false);                                //按钮可编辑
     grd_Rec_Or_Stog.DataContext    = new Maticsoft.Model.ConsumableReceive();              //数据显示控件指定数据源
     dgv_ConsumableList.ItemsSource = _dataList_Receive;
     lab_title.Content = "耗材领料";
     lab_User.Content  = "领用人:";
     txb_Consumable_Barcode.IsEnabled = false;
     txb_ConsumableName.IsEnabled     = false;
 }
Beispiel #5
0
 //
 //保存
 //
 private void btn_Save_Click(object sender, RoutedEventArgs e)
 {
     Maticsoft.Model.ConsumableInfo _Consum = (Maticsoft.Model.ConsumableInfo)grd_ConsumableInfo.DataContext;
     if (IsAdd) //添加模式
     {
         MCP_CS.ConsumableInfo.Add(_Consum);
         btn_Add.IsEnabled = true;
         My_MessageBox.My_MessageBox_Query("添加成功!");
         grd_ConsumableInfo.DataContext = new Maticsoft.Model.ConsumableInfo();
     }
     else      //更新模式
     {
         MCP_CS.ConsumableInfo.Update(_Consum);
     }
     MCP_CS.SetControl(grd_ConsumableInfo, false, false); //设置控件为不可编辑模式
 }
        //
        //保存
        //
        private void btn_Save_Click(object sender, RoutedEventArgs e)
        {
            int tem = _ConsumOperation.ConsumableSave(dgv_ConsumableList);

            if (tem > 0)
            {
                My_MessageBox.My_MessageBox_Message("保存成功记录 " + tem + "条!");
                _dataList_Receive.Clear();
                _dataList_Storage.Clear();
                MCP_CS.SetControl(grd_Rec_Or_Stog, false, true);
                MCP_CS.SetControl_Button(grd_Rec_Or_Stog, false, false);
            }
            else
            {
                My_MessageBox.My_MessageBox_Message("保存失败!请重试");
            }
        }
        //
        //添加
        //
        private void btn_Add_Click(object sender, RoutedEventArgs e)
        {
            Maticsoft.Model.ConsumableReceive _Receive = new Maticsoft.Model.ConsumableReceive();
            //  _Receive = (Maticsoft.Model.ConsumableReceive)dgv_ConsumableList.DataContext;

            Maticsoft.Model.ConsumableStorage _Storage = new Maticsoft.Model.ConsumableStorage();
            //  _Storage = (Maticsoft.Model.ConsumableStorage)dgv_ConsumableList.DataContext;

            bool IsOk = true;

            MCP_CS.CheckTextBoxNotNull(ref IsOk, txb_Consumable_Barcode, txb_R_Count, txb_R_Remaks, txb_R_UserID, txb_R_UserName);
            if (IsOk)
            {
                if (_ConsumOperation.Operation == Maticsoft.BLL.cls_Consumable.ConsumableOperation.Receive)
                {
                    _Receive.C_Barcode = txb_Consumable_Barcode.Text.Trim();
                    _Receive.C_Name    = txb_ConsumableName.Text.Trim();
                    _Receive.Datetime  = DateTime.Now.ToString();
                    _Receive.Count     = int.Parse(txb_R_Count.Text.Trim());
                    _Receive.UserName  = txb_R_UserName.Text.Trim();
                    _Receive.Remarks   = txb_R_Remaks.Text.Trim();

                    _dataList_Receive.Add(_Receive);
                }
                else
                {
                    _Storage.C_Barcode = txb_Consumable_Barcode.Text.Trim();
                    _Storage.C_Name    = txb_ConsumableName.Text.Trim();
                    _Storage.Datetime  = DateTime.Now.ToString();
                    _Storage.Count     = int.Parse(txb_R_Count.Text.Trim());
                    _Storage.UserName  = txb_R_UserName.Text.Trim();
                    _Storage.Remarks   = txb_R_Remaks.Text.Trim();

                    _dataList_Storage.Add(_Storage);
                }
                //
                txb_R_Count.Text            = "";
                txb_Consumable_Barcode.Text = "";
            }
        }
Beispiel #8
0
 //
 //编辑
 //
 private void btn_Edit_Click(object sender, RoutedEventArgs e)
 {
     IsAdd = false;
     MCP_CS.SetControl(grd_ConsumableInfo, true, false); //设置控件为不可编辑模式
 }
Beispiel #9
0
 public frm_Consumable()
 {
     InitializeComponent();
     MCP_CS.SetControl(grd_ConsumableInfo, false, false); //设置控件为不可编辑模式
     btn_Edit.IsEnabled = false;
 }