コード例 #1
0
        private void btnPWOModify_Click(object sender, EventArgs e)
        {
            List <EntityBatchPWO> pwos =
                grdPWOs.DataSource as List <EntityBatchPWO>;
            int idx = grdvPWOs.GetFocusedDataSourceRowIndex();

            if (idx >= 0 && idx < pwos.Count)
            {
                EntityBatchPWO pwo = pwos[idx];

                using (frmPWOInProductionEditor_QuenchAndTemper formEditor =
                           new frmPWOInProductionEditor_QuenchAndTemper(
                               EditStatus.Edit,
                               stationInfo.T134LeafID,
                               stationInfo.T216LeafID,
                               0,
                               pwos,
                               ref pwo))
                {
                    if (formEditor.ShowDialog() == DialogResult.OK)
                    {
                        grdvPWOs.UpdateCurrentRow();
                        grdvPWOs.BestFitColumns();

                        SaveToFile();

                        Refresh();
                    }
                }
            }
        }
コード例 #2
0
        private void btnPWONew_Click(object sender, EventArgs e)
        {
            if (cboPrdtType.SelectedItem == null)
            {
                XtraMessageBox.Show(
                    "请先选择产品类别!",
                    "系统信息",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
                cboPrdtType.Focus();
                return;
            }

            BatchRingCategory prdtType = cboPrdtType.SelectedItem as BatchRingCategory;

            EntityBatchPWO newPWO = new EntityBatchPWO();

            using (Dialogs.frmPWOInProductionEditor formEditor =
                       new Dialogs.frmPWOInProductionEditor(
                           EditStatus.New,
                           stationInfo.T134LeafID,
                           stationInfo.T216LeafID,
                           prdtType.T131LeafID,
                           pwos,
                           ref newPWO))
            {
                if (formEditor.ShowDialog() == DialogResult.OK)
                {
                    pwos.Add(newPWO);
                    grdvPWOs.BestFitColumns();
                }
            }
        }
コード例 #3
0
        private void btnPWONew_Click(object sender, EventArgs e)
        {
            List <EntityBatchPWO> pwos =
                grdPWOs.DataSource as List <EntityBatchPWO>;
            EntityBatchPWO newPWO = new EntityBatchPWO();

            using (frmPWOInProductionEditor_QuenchAndTemper formEditor =
                       new frmPWOInProductionEditor_QuenchAndTemper(
                           EditStatus.New,
                           stationInfo.T134LeafID,
                           stationInfo.T216LeafID,
                           0,
                           pwos,
                           ref newPWO))
            {
                if (formEditor.ShowDialog() == DialogResult.OK)
                {
                    pwos.Add(newPWO);
                    grdvPWOs.BestFitColumns();

                    SaveToFile();

                    Refresh();
                }
            }
        }
コード例 #4
0
        private void btnPWOModify_Click(object sender, EventArgs e)
        {
            int idx = grdvPWOs.GetFocusedDataSourceRowIndex();

            if (idx >= 0 && idx < pwos.Count)
            {
                EntityBatchPWO pwo = pwos[idx];

                using (Dialogs.frmPWOInProductionEditor formEditor =
                           new Dialogs.frmPWOInProductionEditor(
                               EditStatus.Edit,
                               stationInfo.T134LeafID,
                               stationInfo.T216LeafID,
                               0,
                               pwos,
                               ref pwo))
                {
                    if (formEditor.ShowDialog() == DialogResult.OK)
                    {
                        grdvPWOs.UpdateCurrentRow();
                        grdvPWOs.BestFitColumns();

                        SavePreparationPWOs(stationInfo.T133Code, pwos);
                    }
                }
            }
        }
コード例 #5
0
        public frmPWOInProductionEditor_QuenchAndTemper(
            EditStatus status,
            int t134LeafID,
            int t216LeafID,
            int t131LeafID,
            List <EntityBatchPWO> pwos,
            ref EntityBatchPWO pwo) :
            this()
        {
            editStatus = status;

            this.t134LeafID = t134LeafID;
            this.t216LeafID = t216LeafID;
            this.t131LeafID = t131LeafID;
            datas           = pwos;
            data            = pwo;

            switch (editStatus)
            {
            case EditStatus.New:
                Text = "新增";

                break;

            case EditStatus.Edit:
                Text = "修改";

                edtPWONo.Text         = data.PWONo;
                edtProductNo.Text     = data.T102Code;
                edtProductName.Text   = data.T102Name;
                edtBatchNo.Text       = data.LotNumber;
                edtTextureCode.Text   = data.Texture;
                edtQuantity1.Value    = Convert.ToDecimal(data.Quantity1);
                edtQuantity2.Value    = Convert.ToDecimal(data.Quantity2);
                edtDisplayRemark.Text = data.DisplayRemark;

                edtPWONo.Enabled = false;

                break;
            }
        }
コード例 #6
0
        private void btnPWONew_Click(object sender, EventArgs e)
        {
            EntityBatchPWO newPWO = new EntityBatchPWO();

            using (Dialogs.frmPWOInProductionEditor formEditor =
                       new Dialogs.frmPWOInProductionEditor(
                           EditStatus.New,
                           stationInfo.T134LeafID,
                           stationInfo.T216LeafID,
                           0,
                           pwos,
                           ref newPWO))
            {
                if (formEditor.ShowDialog() == DialogResult.OK)
                {
                    pwos.Add(newPWO);
                    grdvPWOs.BestFitColumns();

                    SavePreparationPWOs(stationInfo.T133Code, pwos);
                }
            }
        }
コード例 #7
0
        private void btnPWOModify_Click(object sender, EventArgs e)
        {
            if (cboPrdtType.SelectedItem == null)
            {
                XtraMessageBox.Show(
                    "请先选择产品类别!",
                    "系统信息",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
                cboPrdtType.Focus();
                return;
            }

            BatchRingCategory prdtType = cboPrdtType.SelectedItem as BatchRingCategory;
            int idx = grdvPWOs.GetFocusedDataSourceRowIndex();

            if (idx >= 0 && idx < pwos.Count)
            {
                EntityBatchPWO pwo = pwos[idx];

                using (Dialogs.frmPWOInProductionEditor formEditor =
                           new Dialogs.frmPWOInProductionEditor(
                               EditStatus.Edit,
                               stationInfo.T134LeafID,
                               stationInfo.T216LeafID,
                               prdtType.T131LeafID,
                               pwos,
                               ref pwo))
                {
                    if (formEditor.ShowDialog() == DialogResult.OK)
                    {
                        grdvPWOs.UpdateCurrentRow();

                        grdvPWOs.BestFitColumns();
                    }
                }
            }
        }
コード例 #8
0
        private void edtPWONo_Validating(object sender, CancelEventArgs e)
        {
            if (edtPWONo.Text == "")
            {
                data = new EntityBatchPWO();

                edtProductNo.Text     = "";
                edtProductName.Text   = "";
                edtBatchNo.Text       = "";
                edtTextureCode.Text   = "";
                edtQuantity1.Value    = 0;
                edtQuantity2.Value    = 0;
                edtDisplayRemark.Text = "";

                e.Cancel = false;
                return;
            }

            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            foreach (EntityBatchPWO pwo in datas)
            {
                if (pwo.PWONo == edtPWONo.Text)
                {
                    XtraMessageBox.Show(
                        string.Format(
                            "生产工单[{0}]已经存在,不能重复增加!",
                            pwo.PWONo),
                        "系统信息",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);

                    edtPWONo.Text = "";
                    e.Cancel      = true;
                    return;
                }
            }

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                int    errCode = 0;
                string errText = "";

                #region 根据输入的工单号查找工单
                OpenPWO openPWO = null;
                openPWO = GetPWOInfoFromPWONo(edtPWONo.Text, out errCode, out errText);
                if (errCode != 0)
                {
                    XtraMessageBox.Show(
                        errText,
                        "系统信息",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);

                    edtPWONo.Text = "";
                    e.Cancel      = true;
                    return;
                }
                #endregion

                #region 获取当前工单的材质,并校验是否和其它工单的材质一致
                string textureCode = GetTextureCodeFromMaterialCode(
                    openPWO.ProductNo,
                    out errCode,
                    out errText);
                if (errCode != 0)
                {
                    XtraMessageBox.Show(
                        string.Format(
                            "获取生产工单[{0}]的材质时发生错误:[{1}]",
                            openPWO.PWONo,
                            errText),
                        "系统信息",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);

                    edtPWONo.Text = "";
                    e.Cancel      = true;
                    return;
                }

                foreach (EntityBatchPWO entityPWO in datas)
                {
                    if (entityPWO.Texture.Substring(0, 3)
                        != textureCode.Substring(0, 3))
                    {
                        XtraMessageBox.Show(
                            string.Format(
                                "当前工单生产产品的材质是[{0}],无法和其他工单在同一炉中进行生产!",
                                textureCode),
                            "系统信息",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);

                        edtPWONo.Text = "";
                        e.Cancel      = true;
                        return;
                    }
                }
                #endregion

                #region 调用存储过程校验当前工单的工艺参数是否和其它工单一致
                string pokaYokeXML = GeneratePokaYokeXML(datas, openPWO);
                IRAPMESClient.Instance.usp_PokaYoke_ParamConsistency(
                    IRAPUser.Instance.CommunityID,
                    t131LeafID,
                    pokaYokeXML,
                    IRAPUser.Instance.SysLogID,
                    out errCode,
                    out errText);
                WriteLog.Instance.Write(
                    string.Format("({0}){1}", errCode, errText),
                    strProcedureName);
                if (errCode != 0)
                {
                    XtraMessageBox.Show(
                        errText,
                        "系统信息",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);

                    edtPWONo.Text = "";
                    e.Cancel      = true;
                    return;
                }
                #endregion

                if (data == null)
                {
                    data = new EntityBatchPWO();
                }
                data.PWONo      = openPWO.PWONo;
                data.T102Code   = openPWO.ProductNo;
                data.T102Name   = openPWO.ProductName;
                data.T102LeafID = openPWO.T102LeafID;
                data.LotNumber  = openPWO.LotNumber;
                data.Texture    = textureCode;

                edtProductNo.Text   = data.T102Code;
                edtProductName.Text = data.T102Name;
                edtBatchNo.Text     = data.LotNumber;
                edtTextureCode.Text = data.Texture;
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }