Beispiel #1
0
        private void btn_Dtl_New_Click(object sender, EventArgs e)
        {
            if (optMain == OperateType.optNew || optMain == OperateType.optEdit)
            {
                MessageBox.Show("对不起,主表未保存,请先保存主单数据,再新增明细!");
                return;
            }
            if (bdsDtl == null)
            {
                return;
            }
            if (bdsMain.Count == 0)
            {
                return;
            }
            DataRowView drvM = (DataRowView)bdsMain.Current;

            if (drvM["bIsChecked"].ToString().ToLower() == "true")
            {
                MessageBox.Show("对不起,已被审核!");
                return;
            }
            DataRowView drvNewItem = (DataRowView)bdsDtl.AddNew();
            int         i          = GetNewItem(drvM["cBNo"].ToString());

            drvNewItem["nItem"]     = i;
            drvNewItem["fQty"]      = 0;
            drvNewItem["cBatchNo"]  = "";
            drvNewItem["dProdDate"] = DateTime.Now;
            drvNewItem["nQCStatus"] = 0;
            drvNewItem["nPStatus"]  = 0;
            drvNewItem["nDoStatus"] = 0;
            drvNewItem["fPallet"]   = 0;
            drvNewItem["fFinished"] = 0;
            drvNewItem["cUnit"]     = "";
            drvNewItem["cBNo"]      = drvM["cBNo"];
            //EnableC();
            FrmItemEditor frmX = new FrmItemEditor();

            try
            {
                frmX.UserInformation = UserInformation;
                frmX.AppInformation  = AppInformation;
                frmX.DrvItem         = drvNewItem;
                //frmX.DoItem = DoEditMaterialItemData;
                frmX.BIsNew = true;
                frmX.DataRowToUI();
                frmX.ShowDialog();
                if (frmX.BIsResult)
                {
                    OpenDtlDataSet(" where cBNo='" + drvM["cBNo"].ToString() + "'");
                }
            }
            finally
            {
                frmX.Dispose();
            }
        }
Beispiel #2
0
        private void btn_Dtl_Edit_Click(object sender, EventArgs e)
        {
            if (optMain == OperateType.optNew || optMain == OperateType.optEdit)
            {
                MessageBox.Show("对不起,主表未保存,请先保存主单数据,再修改明细!");
                return;
            }
            if (bdsDtl == null)
            {
                return;
            }
            if (bdsMain.Count == 0)
            {
                return;
            }
            DataRowView drvM = (DataRowView)bdsMain.Current;

            if (drvM["bIsChecked"].ToString().ToLower() == "true")
            {
                MessageBox.Show("对不起,已被审核!");
                return;
            }
            DataRowView   drX  = (DataRowView)bdsDtl.Current;
            FrmItemEditor frmX = new FrmItemEditor();

            try
            {
                frmX.UserInformation = UserInformation;
                frmX.AppInformation  = AppInformation;
                frmX.DrvItem         = drX;
                //frmX.DoItem = DoEditMaterialItemData;
                frmX.BIsNew = false;
                frmX.DataRowToUI();
                frmX.ShowDialog();
                if (frmX.BIsResult)
                {
                    OpenDtlDataSet(" where cBNo='" + drvM["cBNo"].ToString() + "'");
                }
            }
            finally
            {
                frmX.Dispose();
            }
        }