Exemplo n.º 1
0
 /// <summary>
 /// 修改模式
 /// </summary>
 /// <param name="data"></param>
 public Page_ProductionManagement_OutsideProcessBatch(Model_BatchInputOrder data, bool LockProcessors)
 {
     this.Is_LockProcessors = LockProcessors;
     this.OrderData         = data;
     this.OrderIndex        = Helper.DataDefinition.CommonParameters.OrderNoList.IndexOf(OrderData);
     this.IS_MODIFY         = true;
     this.IsOUT             = (data.OrderType == "0") ? true : false;
     InitializeComponent();
     InitializeDataGrid();
     InitializeButton();
     if (IsOUT)
     {
         this.DataGridTextColumn_MinorInjuries.Visibility = System.Windows.Visibility.Collapsed;
         this.DataGridTextColumn_Injuries.Visibility      = System.Windows.Visibility.Collapsed;
         this.DataGridTextColumn_Lose.Visibility          = System.Windows.Visibility.Collapsed;
         this.Label_Title.Content = "外加工单:抛光领货";
     }
     else
     {
         this.Label_Title.Content = "外加工单:抛光交货";
     }
     this.DatePicker_InsertDate.SelectedDate = Convert.ToDateTime(data.Date);
     this.TextBox_Number.Text   = data.Number;
     this.TextBox_Remark.Text   = data.Remark;
     this.Button_Commit.Content = "修改";
     this.TextBox_Processors.Focus();
     this.CheckBox_LockProcessors.IsChecked = this.Is_LockProcessors;
 }
 /// <summary>
 /// DataGrid RightKey Modify Click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MenuItem_Modify_Click(object sender, RoutedEventArgs e)
 {
     if (this.DataGrid_BatchHistory.SelectedCells.Count > 0)
     {
         Model_BatchInputOrder m = this.DataGrid_BatchHistory.SelectedCells[0].Item as Model_BatchInputOrder;
         if (OrderType == 1)//流水线
         {
             Helper.Events.PopUpEvent.OnShowPopUp(new Content_ProductionManagement.Page_ProductionManagement_AssemblyLineModuleBatchInput(m));
         }
         else if (OrderType == 2)//外加工
         {
             if ((bool)this.CheckBox_LockProcessors.IsChecked)
             {
                 Helper.Events.PopUpEvent.OnShowPopUp(new Content_ProductionManagement.Page_ProductionManagement_OutsideProcessBatch(m, true));
             }
             else
             {
                 Helper.Events.PopUpEvent.OnShowPopUp(new Content_ProductionManagement.Page_ProductionManagement_OutsideProcessBatch(m, false));
             }
         }
         else if (OrderType == 3)//仓库
         {
             Helper.Events.PopUpEvent.OnShowPopUp(new Page_Warehouse_Product_BatchIn(m));
         }
     }
 }
        public Page_Warehouse_Product_BatchIn(Model_BatchInputOrder Order)
        {
            this.ORDER = Order;
            IS_MODIFY  = true;
            InitializeComponent();
            this.TYPE = int.Parse(Order.OrderType);
            this.DatePicker_InsertDate.SelectedDate = Convert.ToDateTime(Order.Date);
            this.TextBox_Number.Text   = Order.Number;
            this.TextBox_Remark.Text   = Order.Remark;
            this.Button_Commit.Content = "修改";
            InitializeDataGrid();
            switch (TYPE)
            {
            case 0:
                this.Label_Title.Content = "入库:包装产品";
                break;

            case 1:
                this.Label_Title.Content = "入库:散件产品";
                break;

            case 2:
                this.Label_Title.Content = "出库:包装产品";
                break;

            case 3:
                this.Label_Title.Content = "出库:散件产品";
                break;
            }
        }
 public Page_ProductionManagement_AssemblyLineModuleBatchInput(Model_BatchInputOrder data)
 {
     this.OrderData = data;
     this.IS_MODIFY = true;
     InitializeComponent();
     InitializeDataGrid();
     this.TextBox_Number.Text   = data.Number;
     this.TextBox_Remark.Text   = data.Remark;
     this.Button_Commit.Content = "修改";
 }
        internal void ReadOrder(int BacthType, out ObservableCollection <Model_BatchInputOrder> data, int OrderType)
        {
            data = new ObservableCollection <Model_BatchInputOrder>();
            Model_BatchInputOrder m;
            DataSet ds        = new DataSet();
            string  TableName = GetTableName(BacthType);
            string  sql       = "select * from " + TableName + " WHERE DeleteMark ISNULL Order By rowid Desc";

            if (BacthType == 3 && OrderType > 0)
            {
                sql = "select * from " + TableName + " WHERE DeleteMark ISNULL AND OrderType='" + (OrderType - 1) + "' Order By rowid Desc";
            }
            else if (BacthType == 2)//外加工需读取加工商名字
            {
                string OrderTypeWhereParm = "";
                if (OrderType > 0)
                {
                    OrderTypeWhereParm = " AND a.OrderType='" + (OrderType - 1) + "'";
                }
                sql = "select a.*,b.Name as PName "
                      + " from " + TableName + " a "
                      + " Left join T_UserInfo_Processors b ON a.ProcessorsID=b.Guid"
                      + " WHERE a.DeleteMark ISNULL " + OrderTypeWhereParm + " Order By a.rowid Desc";
            }
            if (new DBHelper().QueryData(sql, out ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    m        = new Model_BatchInputOrder();
                    m.Guid   = (Guid)dr["Guid"];
                    m.Number = dr["Number"].ToString();
                    m.Name   = dr["Name"].ToString();
                    m.Date   = Convert.ToDateTime(dr["Date"].ToString()).ToString("yyyy-MM-dd");
                    m.Remark = dr["Remark"].ToString();
                    if (BacthType != 1)
                    {
                        m.OrderType = dr["OrderType"].ToString();
                    }
                    if (BacthType == 2)
                    {
                        m.ProcessorsID   = (Guid)dr["ProcessorsID"];
                        m.ProcessorsName = dr["PName"].ToString();
                    }
                    data.Add(m);
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 下一单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_NextOrder_Click(object sender, RoutedEventArgs e)
        {
            int i = 1;
            Model_BatchInputOrder NextOrder = Helper.DataDefinition.CommonParameters.OrderNoList[OrderIndex + i];

            if (Is_LockProcessors)
            {
                while (NextOrder.ProcessorsID != this.ProcessorsGuid)
                {
                    i++;
                    if (OrderIndex + i >= Helper.DataDefinition.CommonParameters.OrderNoList.Count)
                    {
                        MessageBox.Show("已到最后一单", "提示");
                        return;
                    }
                    NextOrder = Helper.DataDefinition.CommonParameters.OrderNoList[OrderIndex + i];
                }
            }
            Helper.Events.PopUpEvent.OnShowPopUp(new Page_ProductionManagement_OutsideProcessBatch(NextOrder, Is_LockProcessors));
        }
        /// <summary>
        /// 编辑时读取记录明细
        /// </summary>
        /// <returns></returns>
        internal ObservableCollection <Model_AssemblyLineModuleBatchInput> ReadDatas(Model_BatchInputOrder OrderData)
        {
            ObservableCollection <Model_AssemblyLineModuleBatchInput> data = new ObservableCollection <Model_AssemblyLineModuleBatchInput>();
            Model_AssemblyLineModuleBatchInput m;
            DataSet ds  = new DataSet();
            string  sql = "Select a.*,"
                          + " p.Guid as PGuid,p.Number as PNumber,p.Name as PName,p.P1,p.P2,p.P3,p.P4,p.P5,p.P6, "
                          + " s.Guid as SGuid,s.Number as SNumber,s.Name as SName "
                          + " from T_PM_ProductionSchedule a "
                          + " left join T_ProductInfo_Product p ON a.ProductID=p.Guid "
                          + " left join T_UserInfo_Staff s ON a.StaffID=s.Guid "
                          + " WHERE a.Obligate1='" + OrderData.Guid + "' "
                          + " AND a.DeleteMark ISNULL "
                          + " AND a.Remark<>'自动扣半成品原料' "
            ;

            if (new Helper.SQLite.DBHelper().QueryData(sql, out ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    m = new Model_AssemblyLineModuleBatchInput();

                    //Product Info
                    m.ProductGuid   = (Guid)dr["PGuid"];
                    m.ProductNumber = dr["PNumber"].ToString();
                    m.ProductName   = dr["PName"].ToString();
                    for (int i = 0; i < 6; i++)
                    {
                        if (dr["P" + (i + 1)].ToString() != "无")
                        {
                            m.ProcessList[i]  = dr["P" + (i + 1)].ToString();
                            m.ProcessListStr += dr["P" + (i + 1)].ToString() + ",";
                        }
                    }
                    m.ProcessListStr = m.ProcessListStr.Substring(0, m.ProcessListStr.Length - 1);

                    //Staff Info
                    m.StaffGuid   = (Guid)dr["SGuid"];
                    m.StaffNumber = dr["SNumber"].ToString();
                    m.StaffName   = dr["SName"].ToString();

                    //Input Info
                    m.Process  = dr["Process"].ToString();
                    m.Quantity = int.Parse(dr["Number"].ToString());
                    m.Injure   = int.Parse(dr["Break"].ToString());

                    data.Add(m);
                }
            }
            if (data.Count < 20)
            {
                int COUNT = data.Count;
                for (int i = 0; i < 20 - COUNT; i++)
                {
                    data.Add(new Model_AssemblyLineModuleBatchInput {
                        Id = i + 1
                    });
                }
            }
            return(data);
        }
        /// <summary>
        /// 编辑时读取记录明细
        /// </summary>
        /// <returns></returns>
        internal ObservableCollection <Model_ProductionManagement_OutsideProcessBatch> ReadDatas(Model_BatchInputOrder OrderData)
        {
            ObservableCollection <Model_ProductionManagement_OutsideProcessBatch> data = new ObservableCollection <Model_ProductionManagement_OutsideProcessBatch>();
            Model_ProductionManagement_OutsideProcessBatch m;
            DataSet ds  = new DataSet();
            string  sql = "Select a.*, "
                          + " b.Guid as PDGuid,b.Number as PDNumber,b.Name as PDName,b.Material, "
                          + " c.Guid as PCGuid,c.Number as PCNumber,c.Name as PCName "
                          + " from T_PM_ProcessSchedule a "
                          + " Left join T_ProductInfo_Product b ON b.Guid=a.ProductID "
                          + " Left Join T_UserInfo_Processors c ON c.Guid=a.ProcessorsID "
                          + " WHERE a.Obligate1='" + OrderData.Guid + "' "
                          //+ " AND a.DeleteMark ISNULL "
                          //+ " AND a.OrderType='" + ((OrderData.OrderType == "0") ? "出单" : "入单") + "'"
            ;

            if (new Helper.SQLite.DBHelper().QueryData(sql, out ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    m = new Model_ProductionManagement_OutsideProcessBatch();

                    //Product Info
                    m.ProductGuid   = (Guid)dr["PDGuid"];
                    m.ProductNumber = dr["PDNumber"].ToString();
                    m.ProductName   = dr["PDName"].ToString();
                    m.Material      = dr["Material"].ToString();
                    //Processors Info
                    m.ProcessorsGuid   = (Guid)dr["PCGuid"];
                    m.ProcessorsNumber = dr["PCNumber"].ToString();
                    m.ProcessorsName   = dr["PCName"].ToString();
                    //Input Info
                    m.Quantity      = int.Parse(dr["Quantity"].ToString());
                    m.MinorInjuries = int.Parse(dr["MinorInjuries"].ToString());
                    m.Injuries      = int.Parse(dr["Injuries"].ToString());
                    m.Lose          = int.Parse(dr["Lose"].ToString());
                    m.Remark        = dr["Remark"].ToString();

                    data.Add(m);
                }
            }
            if (data.Count < 20)
            {
                int COUNT = data.Count;
                for (int i = 0; i < 20 - COUNT; i++)
                {
                    data.Add(new Model_ProductionManagement_OutsideProcessBatch {
                        Id = i + 1
                    });
                }
            }
            return(data);
        }