Пример #1
0
        /// <summary>根据领料单号查询领料单信息
        /// 根据领料单号查询领料单信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void smbSelect_Click(object sender, EventArgs e)
        {
            MaterialReqOrReturnEntity materialReqOrReturnEntity = new MaterialReqOrReturnEntity();
            string    _numForSelect      = txtNumForSelect.Text.Trim();
            DataTable dtRequistion       = new DataTable();
            DataTable dtRequistionDetail = new DataTable();

            if (string.IsNullOrEmpty(_numForSelect))
            {
                //MessageBox.Show("领料单号不能为空!","系统错误提示");
                MessageBox.Show(StringParser.Parse("${res:FanHai.Hemera.Addins.MaterialRequisitionCtrl.msg.0015}"), StringParser.Parse("${res:Global.SystemInfo}"));
                return;
            }
            //判定是否存在领料单号
            DataSet dsCheckNum = materialReqOrReturnEntity.GetCountByNumToCheck(_numForSelect, 1);

            if (Convert.ToInt32(dsCheckNum.Tables[0].Rows[0]["COUNT"].ToString()) < 1)
            {
                //MessageBox.Show("不存在该领料单号请重新输入!", "系统错误提示");
                MessageBox.Show(StringParser.Parse("${res:FanHai.Hemera.Addins.MaterialRequisitionCtrl.msg.0016}"), StringParser.Parse("${res:Global.SystemInfo}"));
                return;
            }

            DataSet dsMaterialRequisitionInf = materialReqOrReturnEntity.GetMatRequisitionInfByNum(_numForSelect);

            if (dsMaterialRequisitionInf != null || dsMaterialRequisitionInf.Tables.Count > 0)
            {
                dtRequistion       = dsMaterialRequisitionInf.Tables["WST_STORE_MATERIAL_REQUISITION"];
                dtRequistionDetail = dsMaterialRequisitionInf.Tables["WST_STORE_MATERIAL_REQUISITION_DETAIL"];
                if (dtRequistion.Rows.Count > 0 && dtRequistionDetail.Rows.Count > 0)
                {
                    string status = GetStatus(dtRequistion.Rows[0]["STATUS"].ToString());
                    txtNum.Text = dtRequistion.Rows[0]["MBLNR"].ToString();
                    lueFactoryRoom.EditValue = dtRequistion.Rows[0]["FACTORYKEY"].ToString();
                    lueFactoryRoom.Text      = dtRequistion.Rows[0]["FACTORYNAME"].ToString();
                    lueOperation.Text        = dtRequistion.Rows[0]["PROCESS"].ToString();
                    lueStoreName.EditValue   = dtRequistion.Rows[0]["STORE_KEY"].ToString();
                    lueStoreName.Text        = dtRequistion.Rows[0]["STORE_NAME"].ToString();
                    lueWorkOrderNo.Text      = dtRequistion.Rows[0]["AUFNR"].ToString();
                    txtCreator.Text          = dtRequistion.Rows[0]["CREATOR"].ToString();
                    tetCreateTime.EditValue  = dtRequistion.Rows[0]["CREATE_TIME"].ToString();
                    txtStatus.Text           = status;
                    for (int i = 0; i < dtRequistionDetail.Rows.Count; i++)
                    {
                        dtRequistionDetail.Rows[i]["ROWNUMBER"] = i + 1;
                    }
                    gcInf.DataSource = dtRequistionDetail;
                    if (status.Equals("已创建"))
                    {
                        _status = "Select";
                    }
                    else
                    {
                        _status = "Pass";
                    }
                    Status(_status);
                }
            }
        }
Пример #2
0
        /// <summary> 插入数据到界面数据清单表中
        /// 插入数据到界面数据清单表中
        /// </summary>
        private void GetInfToGvlist()
        {
            MaterialReqOrReturnEntity materialReqOrReturnEntity = new MaterialReqOrReturnEntity();
            string    _workOrder = lueWorkOrderNo.Text.Trim();
            string    _mat       = lueMaterialCode.Text.Trim();
            string    _matDesc   = txtMaterialDescription.Text.Trim();
            string    _qty       = txtIssueQty.Text.Trim();
            string    _unit      = txtUnit.Text.Trim();
            string    _supplier  = lueSupplierName.Text.Trim();
            string    _creator   = txtCreator.Text.Trim();
            DataTable dtSource   = gcInf.DataSource as DataTable;
            string    _memo      = txtMemo.Text.Trim();
            DataTable dt         = new DataTable();

            if (dtSource == null)
            {
                DataSet dsMaterialRequisitionInf = materialReqOrReturnEntity.GetMatRequisitionInfByNum("");
                if (dsMaterialRequisitionInf != null || dsMaterialRequisitionInf.Tables.Count > 0)
                {
                    dt = dsMaterialRequisitionInf.Tables["WST_STORE_MATERIAL_REQUISITION_DETAIL"].Clone();
                }
            }
            else
            {
                dt = dtSource.Clone();
            }

            DataRow dr = dt.NewRow();

            dr["AUFNR"]   = _workOrder;
            dr["MATNR"]   = _mat;
            dr["MATXT"]   = _matDesc;
            dr["QTY"]     = _qty;
            dr["ERFME"]   = _unit;
            dr["LLIEF"]   = _supplier;
            dr["MEMO"]    = _memo;
            dr["CREATOR"] = _creator;

            dt.Rows.Add(dr);

            if (dtSource == null)
            {
                dtSource = dt;
            }
            else
            {
                dtSource.Merge(dt, true);
            }
            int j = 1;

            for (int i = 0; i < dtSource.Rows.Count; i++)
            {
                if (dtSource.Rows[i].RowState != DataRowState.Deleted && dtSource.Rows[i].RowState != DataRowState.Detached)
                {
                    dtSource.Rows[i]["ROWNUMBER"] = j.ToString();
                    j++;
                }
            }
            gcInf.DataSource = dtSource;
            lueMaterialCode.Select();
            lueMaterialCode.SelectAll();
            lueFactoryRoom.Properties.ReadOnly = true;
            lueOperation.Properties.ReadOnly   = true;
            lueStoreName.Properties.ReadOnly   = true;
            lueWorkOrderNo.Properties.ReadOnly = true;
        }