Esempio n. 1
0
 private string MSDStatus(string status)
 {
     if (status == "MSD_PACKAGE")
     {
         return(MutiLanguages.ParserString("$CS_Package"));
     }
     else if (status == "MSD_OPENED")
     {
         return(MutiLanguages.ParserString("$CS_MSD_OPENED"));
     }
     else if (status == "MSD_ALLUSED")
     {
         return(MutiLanguages.ParserString("$CS_MSD_ALLUSED"));
     }
     //else if (status == "MSD_USING")
     //{
     //    return "使用";
     //}
     else if (status == "MSD_DRYING")
     {
         return(MutiLanguages.ParserString("$CS_MSD_DRYING"));
     }
     else if (status == "MSD_BAKING")
     {
         return(MutiLanguages.ParserString("$CS_MSD_BAKING"));
     }
     else
     {
         return(MutiLanguages.ParserString("$CS_TimeOver"));
     }
 }
Esempio n. 2
0
 private void BuildCheckStatus()
 {
     this.drpCheckedStatusQuery.Clear();
     this.drpCheckedStatusQuery.AddItem("", "");
     this.drpCheckedStatusQuery.AddItem(MutiLanguages.ParserString("Y"), "Y");
     this.drpCheckedStatusQuery.AddItem(MutiLanguages.ParserString("N"), "N");
     this.drpCheckedStatusQuery.SelectedIndex = 1;
 }
Esempio n. 3
0
 private void InitializeDUCT()
 {
     this.drpMaintainTYPE.Clear();
     this.drpMaintainTYPE.AddItem("", "");
     this.drpMaintainTYPE.AddItem(MutiLanguages.ParserString(EqpMaintType.EqpMaintType_USINGTYPE), EqpMaintType.EqpMaintType_USINGTYPE);
     this.drpMaintainTYPE.AddItem(MutiLanguages.ParserString(EqpMaintType.EqpMaintType_DAYTYPE), EqpMaintType.EqpMaintType_DAYTYPE);
     this.drpMaintainTYPE.SelectedIndex = 0;
 }
Esempio n. 4
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                //用户权限
                systemSettingFacade = new SystemSettingFacade(this.DataProvider);
                _facade             = new SecurityFacade(this.DataProvider);
                if (this.txtusercode.Value.Trim() == string.Empty)
                {
                    this.lblInfo.Text = MutiLanguages.ParserString("$Error_User_Code_Empty");
                    txtusercode.TextFocus(false, true);
                    return;
                }

                // 未输入密码
                if (this.txtpwd.Value.Trim() == string.Empty)
                {
                    this.lblInfo.Text = MutiLanguages.ParserString("$Error_Password_Empty");
                    txtpwd.Focus();
                    return;
                }

                object COOPParameter = systemSettingFacade.GetParameter(this.txtusercode.Value.Trim().ToUpper(), paraGroup);
                if (COOPParameter == null)
                {
                    this.lblInfo.Text = MutiLanguages.ParserString("$CS_CurrentUser_Have_No_Right");
                    this.txtusercode.TextFocus(false, true);
                    return;
                }

                // 用户名不存在
                object[] objUserGroup = null;
                User     user         = _facade.LoginCheck(this.txtusercode.Value.Trim().ToUpper(), this.txtpwd.Value.Trim().ToUpper(), out objUserGroup);
                if (user == null)
                {
                    this.lblInfo.Text = MutiLanguages.ParserString("$Error_User_Not_Exist");
                    return;
                }
                m_isRightUser = true;
                m_UserCode    = this.txtusercode.Value.Trim().ToUpper();
                this.Close();
            }
            catch (Exception ex)
            {
                this.ShowMessage(ex);
                if (ex.Message == "$Error_Password_Not_Match")
                {
                    this.txtpwd.Focus();
                }
                else
                {
                    this.txtusercode.TextFocus(false, true);
                }
            }
        }
Esempio n. 5
0
 protected string getMaintainType(string type)
 {
     if (type == "DAYTYPE")
     {
         return(MutiLanguages.ParserString("$CS_DAYTYPE"));
     }
     else if (type == "USINGTYPE")
     {
         return(MutiLanguages.ParserString("$CS_USINGTYPE"));
     }
     return("");
 }
Esempio n. 6
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            DocumentFacade _documentFacade = new DocumentFacade(this.DataProvider);

            object[] objs = _documentFacade.QueryDocuments(this.txtDocnameQuery.Value,
                                                           this.txtDocnumQuery.Value,
                                                           this.txtMcodelistQuery.Value,
                                                           this.txtOplistQuery.Value,
                                                           this.txtKeywordQuery.Value,
                                                           this.txtMemoQuery.Value,
                                                           FormatString(this.drpDoctypeQuery.SelectedItemValue),
                                                           FormatString(this.drpValidStatusQuery.SelectedItemValue),
                                                           FormatString(this.drpCheckedStatusQuery.SelectedItemValue),
                                                           1,
                                                           int.MaxValue
                                                           );
            _DataTableLoadedPart.Clear();

            if (objs == null)
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$CS_No_Data_To_Display"));
                return;
            }

            for (int i = 0; i < objs.Length; i++)
            {
                DocForQuery doc = objs[i] as DocForQuery;
                _DataTableLoadedPart.Rows.Add(new object[] {
                    doc.Docserial.ToString(),
                    doc.Dirserial.ToString(),
                    doc.Docname.ToString(),
                    doc.Docnum.ToString(),
                    doc.Docver.ToString(),
                    doc.DirName.ToString(),
                    doc.Itemlist.ToString(),
                    doc.Oplist.ToString(),
                    doc.Docchgnum.ToString(),
                    doc.Docchgfile.ToString(),
                    doc.Memo.ToString(),
                    doc.Keyword.ToString(),
                    doc.Doctype.ToString(),
                    MutiLanguages.ParserString(doc.Checkedstatus),
                    MutiLanguages.ParserString(doc.Validstatus),
                    FormatHelper.ToDateString(doc.Upfiledate),
                    doc.GetDisplayText("Upuser"),
                    FormatHelper.ToDateString(doc.Mdate),
                    doc.GetDisplayText("MaintainUser"),
                    FormatHelper.ToTimeString(doc.Mtime),
                    doc.ServerFileName.ToString()
                });
            }
        }
Esempio n. 7
0
        private void QueryResult(string moCode, string mCode, string segCode, string ssCode, string opCode)
        {
            if (dataCollectFacade == null)
            {
                dataCollectFacade = new DataCollectFacade(this.DataProvider);
            }

            try
            {
                object[] objDis = dataCollectFacade.GetDisToLineList(moCode, mCode, segCode, ssCode, opCode);

                DataLoadDetail.Clear();
                if (objDis == null)
                {
                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$CS_No_Data_To_Display"));
                    return;
                }

                int cnt = 0;
                foreach (DisToLineList list in objDis)
                {
                    cnt++;
                    string leftMin = string.Empty;
                    //计算剩余生产时间
                    if (list.MssleftTime <= 59)
                    {
                        leftMin = Math.Ceiling(list.MssleftTime) + "秒";
                    }
                    else
                    {
                        leftMin = (Math.Ceiling(Convert.ToDecimal(list.MssleftTime / 60))).ToString() + "分" + Math.Ceiling(list.MssleftTime % 60) + "秒";
                    }

                    DataLoadDetail.Rows.Add(new object[] {
                        cnt,
                        list.Status,
                        MutiLanguages.ParserString("$CS_DisLine_" + list.Status),
                        list.MssdisQty,
                        list.MssleftQty,
                        leftMin,
                        list.MQty,
                        list.Delflag,
                        list.Delflag == "Y" ? "是" : "否",
                    });
                }
            }
            catch (Exception ex)
            {
                ApplicationRun.GetInfoForm().Add(ex.Message);
            }
        }
Esempio n. 8
0
 private void btnExport_Click(object sender, EventArgs e)
 {
     System.Windows.Forms.SaveFileDialog save = new SaveFileDialog();
     save.CheckPathExists = true;
     //save.Filter = "数据文件(*.xls)|*.xls";
     save.Filter     = MutiLanguages.ParserString("$CS_ExportFilter");
     save.DefaultExt = "xls";
     save.Title      = MutiLanguages.ParserString("$SaveTitle");
     //save.Title = "保存当前数据";
     if (save.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         ultraGridExcelExporter1.Export(ultraGridHead, save.FileName);
     }
 }
Esempio n. 9
0
        public void initGirdData()
        {
            Messages msg = new Messages();

            _DataTableLoadedPart.Clear();
            if (m_DataCollectFacade == null)
            {
                m_DataCollectFacade = new DataCollectFacade(this.DataProvider);
            }
            try
            {
                //加入工单的条件  add by klaus
                string   sourceRcard = m_DataCollectFacade.GetSourceCard(FormatHelper.CleanString(this.txtRcard.Text.Trim().ToUpper()), this.drownListMoCode.SelectedItemValue.ToString());
                object[] objs        = m_DataCollectFacade.QueryItemTracingFlow(sourceRcard,
                                                                                Convert.ToString(this.drownListRouteCode.SelectedItemValue),
                                                                                Convert.ToString(this.drownListMoCode.SelectedItemValue));
                _DataTableLoadedPart.Clear();
                if (objs == null)
                {
                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$CS_No_Data_To_Display"));
                    return;
                }

                for (int i = 0; i < objs.Length; i++)
                {
                    OnWIP wip = objs[i] as OnWIP;
                    _DataTableLoadedPart.Rows.Add(new object[] {
                        wip.ItemCode.ToString(),
                        wip.RunningCard.ToString(),
                        wip.MOCode.ToString(),
                        MutiLanguages.ParserString(wip.ActionResult.ToString()),
                        wip.OPCode.ToString(),
                        GetOPResult(wip.Action),
                        wip.RouteCode.ToString(),
                        wip.SegmentCode.ToString(),
                        wip.StepSequenceCode.ToString(),
                        wip.ResourceCode.ToString(),
                        FormatHelper.ToDateString(wip.MaintainDate),
                        FormatHelper.ToTimeString(wip.MaintainTime),
                        wip.GetDisplayText("MaintainUser")
                    });
                }
                this.gridSimulation.DataSource = this._DataTableLoadedPart;
            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 10
0
 protected string getCycleString(string cycle)
 {
     if (cycle == "D")
     {
         return(MutiLanguages.ParserString("$CS_DAY"));
     }
     else if (cycle == "W")
     {
         return(MutiLanguages.ParserString("$CS_Week"));
     }
     else if (cycle == "M")
     {
         return(MutiLanguages.ParserString("$CS_Month"));
     }
     else if (cycle == "Y")
     {
         return(MutiLanguages.ParserString("$CS_Year"));
     }
     return("");
 }
Esempio n. 11
0
        private void gridList_ClickCellButton(object sender, CellEventArgs e)
        {
            if (e.Cell.Column.Key.ToUpper() == "Edit".ToUpper())
            {
                string strStatusNo = ProductionStatus.ProductionStatus_NoProduction.ToString().Trim();

                this.txtRCardEdit.Value         = e.Cell.Row.Cells["Rcard"].Value.ToString();
                this.txtMoCodeEdit.Value        = e.Cell.Row.Cells["MOCode"].Value.ToString();
                this.txtRelationQtyEdit.Value   = e.Cell.Row.Cells["RelationQty"].Value.ToString();
                this.txtRCardEdit.Enabled       = false;
                this.txtMoCodeEdit.Enabled      = false;
                this.txtRelationQtyEdit.Enabled = false;
                this.ucBtnSave.Enabled          = true;
                this.ucBtnNew.Enabled           = false;

                if (e.Cell.Row.Cells["Status"].Value.ToString().Trim() == MutiLanguages.ParserString(strStatusNo))
                {
                    this.txtRelationQtyEdit.Enabled = true;
                    this.txtRelationQtyEdit.TextFocus(false, true);
                }
            }
        }
Esempio n. 12
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            if (ucLabelEditStorageCode.Value == string.Empty)
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$ERROR_Storage_Must_Selected"));
                this.ucLabelEditStorageCode.TextFocus(false, true);
                return;
            }

            string storageCode = this.ucLabelEditStorageCode.Value.ToUpper().Trim();
            string modelCode   = this.ucLabelEditModelCode.Value.ToUpper().Trim();

            ClearSampleList();//清空当前Grid信息

            #region 查询获取数据
            try
            {
                object[] obj = m_INVFacade.QueryMaterialFullMo(storageCode, modelCode);
                if (obj == null)
                {
                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_Not_Find_Metrial"));
                    return;
                }
                foreach (MaterialFull materialFull in obj)
                {
                    #region 主表数据
                    DataRow[] dataRowQty = m_CheckTable.Select(string.Format("MOCODE='{0}'", materialFull.MoCode));
                    if (dataRowQty.Length == 0)
                    {
                        DataRow rowCheckTable;
                        rowCheckTable             = this.m_SampleList.Tables["CheckTable"].NewRow();
                        rowCheckTable["MOCODE"]   = materialFull.MoCode;
                        rowCheckTable["ITEMCODE"] = materialFull.Itemcode;
                        rowCheckTable["ITEMDESC"] = materialFull.Modesc;
                        rowCheckTable["PLANTYPE"] = materialFull.PlanType;
                        rowCheckTable["PLANQTY"]  = materialFull.Planqty;
                        rowCheckTable["PLANDATE"] = materialFull.Plandate;
                        if (materialFull.PlanType == "MO")
                        {
                            rowCheckTable["PLANTYPENAME"] = MutiLanguages.ParserString("MO");
                        }
                        if (materialFull.PlanType == "PLAN")
                        {
                            rowCheckTable["PLANTYPENAME"] = MutiLanguages.ParserString("PLAN");
                        }

                        this.m_SampleList.Tables["CheckTable"].Rows.Add(rowCheckTable);
                        if (rowCheckTable != null)
                        {
                            this.m_SampleList.Tables["CheckTable"].AcceptChanges();
                        }
                    }
                    #endregion

                    #region 子表数据
                    DataRow rowCheckTableDetail;
                    rowCheckTableDetail             = this.m_SampleList.Tables["CheckTableDetail"].NewRow();
                    rowCheckTableDetail["MCODE"]    = materialFull.MCode;
                    rowCheckTableDetail["MOCODE"]   = materialFull.MoCode;
                    rowCheckTableDetail["MDESC"]    = materialFull.Mdesc;
                    rowCheckTableDetail["QTY"]      = materialFull.Qty;
                    rowCheckTableDetail["SHORTQTY"] = materialFull.ShortQty;
                    rowCheckTableDetail["LOSTQTY"]  = materialFull.LostQty;

                    this.m_SampleList.Tables["CheckTableDetail"].Rows.Add(rowCheckTableDetail);

                    if (rowCheckTableDetail != null)
                    {
                        this.m_SampleList.Tables["CheckTableDetail"].AcceptChanges();
                    }
                    #endregion
                }
                this.m_SampleList.AcceptChanges();
                this.ultraGridHead.DataSource = this.m_SampleList;
            }
            catch (Exception ex)
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, ex.Message));
                return;
            }
            #endregion
        }
Esempio n. 13
0
        private void btnQuery_Click(object sender, System.EventArgs e)
        {
            string status = string.Empty;

            if (smtfacade == null)
            {
                smtfacade = new SMTFacade(this.DataProvider);
            }
            if (mofacade == null)
            {
                mofacade = new MOFacade(this.DataProvider);
            }
            if (collectfacade == null)
            {
                collectfacade = new DataCollectFacade(this.DataProvider);
            }
            object[] objs = smtfacade.Querysmtrelation(this.txtMoCodeQuery.Value.Trim().ToUpper(),
                                                       this.txtPartNumber.Value.Trim().ToUpper(),
                                                       this.txtRCardQuery.Value.Trim().ToUpper(),
                                                       FormatHelper.TODateInt(this.startDate.Value),
                                                       FormatHelper.TODateInt(this.endDate.Value));
            tableSource.Rows.Clear();
            this.ucBtnNew.Enabled           = true;
            this.ucBtnSave.Enabled          = false;
            this.txtMoCodeEdit.Value        = string.Empty;
            this.txtRelationQtyEdit.Value   = string.Empty;
            this.txtRCardEdit.Value         = string.Empty;
            this.txtMoCodeEdit.Enabled      = true;
            this.txtRelationQtyEdit.Enabled = true;
            this.txtRCardEdit.Enabled       = true;
            this.txtMoCodeEdit.TextFocus(false, true);
            if (objs != null)
            {
                string strStatusClose = ProductionStatus.ProductionStatus_CloseProduction.ToString().Trim();
                string strStatusin    = ProductionStatus.ProductionStatus_InProduction.ToString().Trim();
                string strStatusNo    = ProductionStatus.ProductionStatus_NoProduction.ToString().Trim();
                for (int i = 0; i < objs.Length; i++)
                {
                    Smtrelationqty smt       = (Smtrelationqty)objs[i];
                    DataRow        row       = tableSource.NewRow();
                    object         simrepObj = collectfacade.GetSimulationReport(smt.Mocode.Trim().ToUpper(), smt.Rcard.Trim().ToUpper());

                    if (simrepObj != null)
                    {
                        if (((SimulationReport)simrepObj).IsComplete.Trim() == "1")
                        {
                            status = MutiLanguages.ParserString(strStatusClose);
                        }
                        else
                        {
                            status = MutiLanguages.ParserString(strStatusin);
                        }
                    }
                    else
                    {
                        status = MutiLanguages.ParserString(strStatusNo);
                    }
                    row["PartNumber"]  = smt.Itemcode.ToString();
                    row["MOCode"]      = smt.Mocode;
                    row["Rcard"]       = smt.Rcard;
                    row["RelationQty"] = smt.Relationqtry;
                    row["Status"]      = status;
                    row["MDate"]       = FormatHelper.ToDateTime(smt.Mdate, smt.Mtime);
                    row["Edit"]        = "";
                    tableSource.Rows.Add(row);
                }
            }
            else
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$CS_No_Data_To_Display"));
                return;
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Check 从垛位使用状况的页面带过来的垛位和库位
        /// </summary>
        /// <returns>true/false</returns>
        private bool CheckSelecetedStackAndStorage(string selectedStorage, string selectedStack, string originalStorage)
        {
            if (originalStorage.Trim().Length == 0)
            {
                //请输入库位
                ApplicationRun.GetInfoForm().Add(
                    new UserControl.Message(MessageType.Error, "$CS_STORAGE_NOT_INPUT"));
                return(false);
            }

            if (!selectedStorage.Equals(originalStorage))
            {
                InventoryFacade inventoryFacade  = new InventoryFacade(this.DataProvider);
                int             stack2RCardCount = inventoryFacade.GetStack2RCardCount(selectedStack, originalStorage);

                if (stack2RCardCount > 0)
                {
                    //垛位和库别不对应
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_STACK_STORAGE_NOT_SAME"));
                    return(false);
                }
                else
                {
                    //垛位和库别不对应,确定使用该垛位?

                    if (MessageBox.Show(UserControl.MutiLanguages.ParserMessage("$CS_STACK_STORAGE_NOT_SAME_CONFIRM"), MutiLanguages.ParserString("$ShowConfirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Esempio n. 15
0
        private void txtMLot_TxtboxKeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                string mLot = txtMLot.Value.ToUpper().Trim();
                if (mLot == String.Empty)
                {
                    this.ErrorMessage("$CS_MLot_Is_Empty");
                    this.txtMLot.TextFocus(false, true);
                    ClearInfo();
                    return;
                }
                //A.检查物料代码是否为湿敏物料。
                InventoryFacade _facade = new InventoryFacade(this.DataProvider);

                int Count = _facade.CheckMaterialByLotNO(mLot);
                if (Count == 0)
                {
                    this.ErrorMessage("$CS_MCode_IsNot_MSD");
                    this.txtMLot.TextFocus(false, true);
                    ClearInfo();
                    return;
                }

                //B.检查物料批号是否存在。
                ItemLotForQuery itemLotForQuery = (ItemLotForQuery)_facade.GetItemLotDesc(mLot);
                if (itemLotForQuery == null)
                {
                    this.ErrorMessage("$CS_MLotInfo_IsNot_Exit");
                    this.txtMLot.TextFocus(false, true);
                    ClearInfo();
                    return;
                }

                //C.带出物料批号的相关信息,第一次做拆封时TBLMSDLOT不存在数据。
                object objs = _facade.QueryMaterialMSD(mLot);

                this.txtMCode.Text  = objs == null ? itemLotForQuery.Mcode : ((MSDLOTLExc)objs).MCODE.ToString();
                this.txtMName.Text  = objs == null ? itemLotForQuery.MaterialName : ((MSDLOTLExc)objs).MNAME.ToString();
                this.txtMDesc.Text  = objs == null ? itemLotForQuery.MaterialDescription : ((MSDLOTLExc)objs).MDESC.ToString();
                this.txtStatus.Text = objs == null?MutiLanguages.ParserString("$CS_Package") : MSDStatus(((MSDLOTLExc)objs).Status.ToString());

                this.txtOverFloorlife.Text = string.Empty;
                if (objs == null)
                {
                    object msdLevel = _facade.GetMSDLevelByLotNo(mLot.Trim().ToUpper());
                    if (msdLevel != null)
                    {
                        this.txtOverFloorlife.Text = ((MSDLevel)msdLevel).FloorLife.ToString();
                    }
                }
                else
                {
                    this.txtOverFloorlife.Text = ((MSDLOTLExc)objs).OverFloorlife.ToString();
                }
                this.txtMUser.Text = ApplicationService.Current().UserCode;
                this.txtMDate.Text = objs == null ? "" : FormatHelper.ToDateString(((MSDLOTLExc)objs).MaintainDate);
                this.txtMtime.Text = objs == null ? "" : FormatHelper.ToTimeString(((MSDLOTLExc)objs).MaintainTime);

                #region IniultraOptionSetOperation

                if (objs == null)
                {
                    this.ultraOptionSetOperation.CheckedIndex = 1;
                }
                else if (((MSDLOTLExc)objs).Status.ToString() == "MSD_PACKAGE")
                {
                    this.ultraOptionSetOperation.CheckedIndex = 0;
                }
                else if (((MSDLOTLExc)objs).Status.ToString() == "MSD_OPENED")
                {
                    this.ultraOptionSetOperation.CheckedIndex = 1;
                }
                else if (((MSDLOTLExc)objs).Status.ToString() == "MSD_ALLUSED")
                {
                    this.ultraOptionSetOperation.CheckedIndex = 2;
                    this.ErrorMessage("$CS_MSD_ALLUSED_Info");  //提示“该批湿敏原料已全部使用,不可操作。”
                }
                //else if (((MSDLOTLExc)objs).Status.ToString() == "MSD_USING")
                //{
                //    this.ultraOptionSetOperation.CheckedIndex = 2;
                //}
                else if (((MSDLOTLExc)objs).Status.ToString() == "MSD_DRYING")
                {
                    this.ultraOptionSetOperation.CheckedIndex = 3;
                }
                else if (((MSDLOTLExc)objs).Status.ToString() == "MSD_BAKING")
                {
                    this.ultraOptionSetOperation.CheckedIndex = 4;
                }

                #endregion

                this.ultraOptionSetOperation.Focus();
            }
        }
Esempio n. 16
0
        private bool initFlowPicBox()
        {
            clear();
            string routeCode = "",
                   moCode    = "",
                   itemCode;

            object[] objs;

            if (string.IsNullOrEmpty(Convert.ToString(this.drownListMoCode.SelectedItemValue)))
            {
                return(false);
            }
            moCode = Convert.ToString(this.drownListMoCode.SelectedItemValue);
            if (string.IsNullOrEmpty(Convert.ToString(this.drownListRouteCode.SelectedItemValue)))
            {
                return(false);
            }
            routeCode = Convert.ToString(this.drownListRouteCode.SelectedItemValue);

            Messages msg = new Messages();

            if (m_DataCollectFacade == null)
            {
                m_DataCollectFacade = new DataCollectFacade(this.DataProvider);
            }
            try
            {
                //add
                string sourceRcard = m_DataCollectFacade.GetSourceCard(FormatHelper.CleanString(txtRcard.Text.ToUpper()), this.drownListMoCode.SelectedItemValue.ToString());
                //end
                //object objLastSimRe = m_DataCollectFacade.GetLastSimulationReport(FormatHelper.CleanString(sourceRcard));
                object objLastSimRe = m_DataCollectFacade.GetSimulationReport(this.drownListMoCode.SelectedItemValue.ToString(), FormatHelper.CleanString(sourceRcard));


                if (objLastSimRe == null)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$Error_CS_ID_Not_Exist"));
                    txtRcard.SelectAll();
                    txtRcard.Focus();
                    ApplicationRun.GetInfoForm().Add(msg);
                    return(false);
                }
                else
                {
                    SimulationReport currentSimRe = (SimulationReport)objLastSimRe;
                    itemCode = currentSimRe.ItemCode;

                    //查询当前途程工序捞TBLITEMROUTE2OP表
                    //QueryItemOpFlow(当前itemCode,当前途程Code);
                    objs = m_DataCollectFacade.QueryItemOpFlow(itemCode, routeCode);
                    if (objs == null)
                    {
                        ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$CS_No_Data_To_Display"));
                        //add by klaus 置焦点
                        txtRcard.SelectAll();
                        txtRcard.Focus();
                        return(false);
                    }

                    #region 画流程图
                    this.panelDrawFlow.Controls.Clear();
                    this.panelDrawFlow.Refresh();

                    StartButton btnStart = new StartButton();
                    this.panelDrawFlow.Controls.Add(btnStart);
                    btnStart.setProcessName(MutiLanguages.ParserString("$CS_Start"));
                    btnStart.Location = new Point(10, 30);
                    btnStart.DrawButton();

                    FunctionButton lastOne = btnStart;
                    FlowButton     btnFlow = new StraightArrowButton();
                    double         vdegree = 0;

                    ItemRoute2OP currentOP = null;

                    for (int i = 0; i < objs.Length; i++)
                    {
                        ItemRoute2OP itemRoute2Op = objs[i] as ItemRoute2OP;

                        btnFlow = lastOne.AddOutArrow(vdegree);
                        Operation op = (Operation) new BaseModelFacade(this.DataProvider).GetOperation(itemRoute2Op.OPCode);
                        lastOne = btnFlow.AddOutProcess(itemRoute2Op.OPCode);

                        lastOne.Tag       = itemRoute2Op.OPCode;
                        lastOne.ProcessID = op.OPDescription;
                        lastOne.DrawButton();
                        lastOne.BackColor = Color.Green;
                        lastOne.Click    += new EventHandler(btn_Click);

                        //string actionResult = m_DataCollectFacade.CheckOpIsExist(FormatHelper.CleanString(txtRcard.Text.Trim().ToUpper()), moCode, routeCode, itemRoute2Op.OPCode);
                        string actionResult = m_DataCollectFacade.CheckOpIsExist(sourceRcard, moCode, routeCode, itemRoute2Op.OPCode);
                        if (string.IsNullOrEmpty(actionResult))
                        {
                            lastOne.BackColor = Color.White;
                        }
                        else
                        {
                            if (actionResult == ProductStatus.GOOD)
                            {
                                lastOne.BackColor = Color.Green;
                            }
                            else
                            {
                                lastOne.BackColor = Color.Red;
                            }
                        }

                        if (itemRoute2Op.OPCode == currentSimRe.OPCode &&
                            itemRoute2Op.RouteCode == currentSimRe.RouteCode)
                        {
                            currentOP = (ItemRoute2OP)objs[i];
                            if (currentSimRe.Status == ProductStatus.GOOD)
                            {
                                lastOne.BackColor = Color.Green;
                            }
                            else
                            {
                                lastOne.BackColor = Color.Red;
                            }
                        }

                        #region 注释 Terry 2012-11-13
                        //如果途程里工序是从0开始,显示背景有问题。
                        //if ((currentOP != null) && (i > currentOP.OPSequence - 1))
                        //{
                        //    lastOne.BackColor = Color.WhiteSmoke;
                        //}
                        #endregion

                        if ((btnFlow as StraightArrowButton).Degree == 90)
                        {
                            vdegree = (vdegree + 180) % 360;
                        }
                    }
                    btnFlow = lastOne.AddOutArrow(vdegree);
                    EndButton btnEnd = btnFlow.AddEnd();
                    btnEnd.Text      = MutiLanguages.ParserString("$CS_End");
                    btnEnd.BackColor = lastOne.BackColor;
                    #endregion

                    return(true);
                }
            }
            catch (Exception ex)
            {
                msg.Add(new UserControl.Message(ex));
                ApplicationRun.GetInfoForm().Add(msg);
                txtRcard.Focus();
                return(false);
            }
        }
Esempio n. 17
0
        private void ucButton2_Click(object sender, EventArgs e)
        {
            Messages messages = new Messages();

            if (rCardEditor.Text.Trim() == String.Empty)
            {
                messages.Add(new UserControl.Message(MessageType.Error, "$CSError_RCard_CanNot_Empty"));
                ApplicationRun.GetInfoForm().Add(messages);
                return;
            }

            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
            string            sourceRCard       = dataCollectFacade.GetSourceCard(rCardEditor.Text.Trim().ToUpper(), string.Empty);

            string tsStatus;
            //Laws Lu,2005/11/22,新增	添加代理录入人员
            //modified by jessie lee, 2005/11/24
            string userCode = ApplicationService.Current().UserCode;

            if (txtAgentUser.Checked == true && txtAgentUser.Value.Trim().Length == 0)
            {
                messages.Add(new UserControl.Message(MessageType.Error, "$CS_Error_Vicegerent_CanNot_Empty"));
                ApplicationRun.GetInfoForm().Add(messages);
                return;
            }
            else if (txtAgentUser.Checked == true && txtAgentUser.Value != String.Empty)
            {
                if ((new BenQGuru.eMES.Security.SecurityFacade(this.DataProvider)).CheckResourceRight(txtAgentUser.Value.Trim().ToUpper()
                                                                                                      , ApplicationService.Current().ResourceCode))
                {
                    userCode = txtAgentUser.Value;
                }
                else
                {
                    messages.Add(new UserControl.Message(MessageType.Error, "$CS_Error_Vicegerent_Is_Wrong"));
                    ApplicationRun.GetInfoForm().Add(messages);
                    return;
                }
            }

            if (ultraCheckEditor1.Checked == true)
            {
                tsStatus = TSStatus.TSStatus_Reflow;

                //勾选回流,然后不工位栏位未选资料也可允许通过。在业务上回流是一定有确定的工位的。
                //系统要检查此时保存,工位是否为空。
                if (ucLabComboxOPCode.SelectedItemText == string.Empty)
                {
                    messages.Add(new UserControl.Message(MessageType.Error, "$CS_Error_ReflowOPCode_CanNot_Empty"));
                    ApplicationRun.GetInfoForm().Add(messages);
                    ucLabComboxOPCode.Focus();
                    return;
                }
            }
            else if (ultraCheckEditorScrap.Checked == true)
            {
                tsStatus = TSStatus.TSStatus_Scrap;
            }
            else
            {
                tsStatus = TSStatus.TSStatus_Complete;
//				//修改,Karron Qiu 2005-9-23
//				//线上采集的不良品,修复后则“回流”;修不好则“报废”。而不选“回流”或“报废”代表该产品要入了良品库,
//				//线上的不良品修好后是直接回产线回流,不需要入良品库的
//				messages.Add(new UserControl.Message(MessageType.Error,"$CSError_Please_Select_Reflow_OR_Scrap"));//请选择回流或者报废
//				ApplicationRun.GetInfoForm().Add(messages);
//				return;
            }

            ActionFactory     actionFactory    = new ActionFactory(this.DataProvider);
            IAction           actionTSComplete = actionFactory.CreateAction(ActionType.DataCollectAction_TSComplete);
            TSActionEventArgs actionEventArgs  = new TSActionEventArgs(
                ActionType.DataCollectAction_TSComplete,
                FormatHelper.PKCapitalFormat(FormatHelper.CleanString(sourceRCard)),
                userCode,
                ApplicationService.Current().ResourceCode,
                tsStatus,
                this.ucLabEditMOCode.Value,
                this.ucLabEditItemCode.Value,
                this.ucLabEditRoute.Value,
                this.ucLabComboxOPCode.SelectedItemText,
                ApplicationService.Current().UserCode,
                FormatHelper.CleanString(this.txtScrapCause.Text, 100));

            //修改 Karron Qiu 2005-9-26
            //在做维修完成处理时,依然按照之前的检查逻辑
            //(不良品是否“已选不良零件”或“已选不良位置”有信息),如果没有,则弹出提示信息,
            //比如:“该不良品无“不良零件”或“不良位置”信息,是否要维修完成”,
            //点击“确认”即维修完成,点击“取消”则维修完成失败

            TSFacade tsFacade = new TSFacade(this.DataProvider);
            object   obj      = tsFacade.GetCardLastTSRecord(actionEventArgs.RunningCard);

            if (obj == null)
            {
                messages.Add(new UserControl.Message(MessageType.Error, "$CSError_Card_Not_In_TS"));
                ApplicationRun.GetInfoForm().Add(messages);
                return;
            }
            else
            {
                Domain.TS.TS ts = (Domain.TS.TS)obj;
                if (tsFacade.CheckErrorCodeCountAndErrorSolutionForTSComplete(actionEventArgs.RunningCard))
                {
                    if (!tsFacade.CheckErrorPartAndErrorLocationForTSComplete(actionEventArgs.RunningCard))
                    {
                        if (System.Windows.Forms.MessageBox.Show(null, MutiLanguages.ParserString("$CS_No_ErrorPartAndLoc_Is_Com"), "", System.Windows.Forms.MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.Cancel)
                        {
                            return;
                        }
                    }
                }
                else
                {
                    messages.Add(new UserControl.Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus));
                    ApplicationRun.GetInfoForm().Add(messages);
                    return;
                }
            }
            //karron qiu ,2005/9/16 ,增加try catch,在catch中添加rollback操作
            DataProvider.BeginTransaction();
            try
            {
                messages.AddMessages(actionTSComplete.Execute(actionEventArgs));
                if (!messages.IsSuccess())
                {
                    this.DataProvider.RollbackTransaction();
                    ApplicationRun.GetInfoForm().Add(messages);
                }
                else
                {
                    this.DataProvider.CommitTransaction();
                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Success, "$CS_TSScrap_SUCCESS"));
                }
            }
            catch
            {
                this.DataProvider.RollbackTransaction();
                throw;
            }
            finally
            {
                (DataProvider as SQLDomainDataProvider).PersistBroker.CloseConnection();
            }
        }
Esempio n. 18
0
        //根据LastAction显示工序结果
        public static string GetOPResult(string lastAction)
        {
            string opResult = string.Empty;

            try
            {
                string moduleName = ActionType.GetOperationResultModule(lastAction);
                switch (moduleName)
                {
                case "Testing":
                    opResult = MutiLanguages.ParserString("ItemTracing_testing");
                    break;

                case "ComponentLoading":
                    opResult = MutiLanguages.ParserString("ItemTracing_componentloading");
                    break;

                case "IDTranslation":
                    opResult = MutiLanguages.ParserString("ItemTracing_sn");
                    break;

                case "Packing":
                    opResult = MutiLanguages.ParserString("ItemTracing_packing");
                    break;

                case "UnPacking":
                    opResult = MutiLanguages.ParserString("ItemTracing_unpacking");
                    break;

                case "TS":
                    opResult = MutiLanguages.ParserString("ItemTracing_ts");
                    break;

                case "OQC":
                    opResult = MutiLanguages.ParserString("ItemTracing_oqc");
                    break;

                //以下非工序结果 "Reject", "GoMO","ECN","SoftINFO","TRY"
                case "Reject":
                    opResult = MutiLanguages.ParserString("ItemTracing_Reject");
                    break;

                case "GoMO":
                    opResult = MutiLanguages.ParserString("ItemTracing_GoMO");
                    break;

                case "ECN":
                    opResult = MutiLanguages.ParserString("ItemTracing_ECN");
                    break;

                case "SoftINFO":
                    opResult = MutiLanguages.ParserString("ItemTracing_SoftINFO");
                    break;

                case "TRY":
                    opResult = MutiLanguages.ParserString("ItemTracing_TRY");
                    break;

                case "OutsideRoute":
                    opResult = MutiLanguages.ParserString("ItemTracing_OutsideRoute");
                    break;

                case "SMT":
                    opResult = MutiLanguages.ParserString("ItemTracing_SMT");
                    break;

                case "SPC":
                    opResult = MutiLanguages.ParserString("ItemTracing_SPC");
                    break;

                case "DeductBOMItem":
                    opResult = MutiLanguages.ParserString("ItemTracing_DeductBOMItem");
                    break;

                case "MidistOutput":
                    opResult = MutiLanguages.ParserString("ItemTracing_MidistOutput");
                    break;

                case "BurnIn":
                    opResult = MutiLanguages.ParserString("ItemTracing_BurnIn");
                    break;

                case "BurnOut":
                    opResult = MutiLanguages.ParserString("ItemTracing_BurnOut");
                    break;

                default:
                    opResult = string.Empty;
                    break;
                }

                return(opResult);
            }
            catch
            {
            }

            return(opResult);
        }
Esempio n. 19
0
        //Process Carton NO
        private void ProcessCarton(string cartonno)
        {
            DataCollectFacade dcf   = new DataCollectFacade(DataProvider);
            string            rCard = txtRCard.Value.Trim().ToUpper();

            rCard = dcf.GetSourceCard(rCard, string.Empty);

            //箱号为空时,表示序列号从旧箱中移除
            if (cartonno == String.Empty)
            {
                #region RCARD 从 Carton中移出
                if (DialogResult.OK == MessageBox.Show(this, MutiLanguages.ParserString("$CS_Confirm_Transfer_1") + " " + txtRCard.Value.Trim().ToUpper() + " "
                                                       + MutiLanguages.ParserString("$CS_Confirm_Transfer_2") + txtCurrentCarton.Value.Trim().ToUpper() + " " + MutiLanguages.ParserString("$CS_Confirm_Transfer_3"), MutiLanguages.ParserString("$ShowConfirm"), MessageBoxButtons.OKCancel))
                {
                    InventoryFacade materialDCF = new InventoryFacade(DataProvider);

                    object objSimulationReport = dcf.GetLastSimulationReport(rCard);

                    //在制品存在
                    if (objSimulationReport != null)
                    {
                        Domain.DataCollect.SimulationReport sim = objSimulationReport as Domain.DataCollect.SimulationReport;

                        sim.CartonCode = String.Empty;
                        PackageFacade pf = new PackageFacade(DataProvider);

                        #region 移出操作
                        DataProvider.BeginTransaction();
                        try
                        {
                            dcf.RemoveFromCarton(sim.RunningCard, ApplicationService.Current().UserCode);
                            //dcf.RemoveFromPallet2RCard(sim.RunningCard);
                            DataProvider.CommitTransaction();

                            ucMessage.Add(new UserControl.Message(MessageType.Success
                                                                  , "$CS_RCARD_BREAK_FROM_CARTON_SUCCESS $CS_Param_ID =" + txtRCard.Value.Trim().ToUpper()));

                            txtRCard.TextFocus(true, true);
                            txtCartonNO.Value = String.Empty;
                            ClearRCardInfo();
                        }
                        catch (Exception ex)
                        {
                            DataProvider.RollbackTransaction();
                            ucMessage.Add(new UserControl.Message(ex));

                            txtCartonNO.TextFocus(true, true);
                        }
                        finally
                        {
                            (DataProvider as SQLDomainDataProvider).PersistBroker.CloseConnection();
                        }
                        #endregion
                    }
                    else//在制品不存在
                    {
                        ucMessage.Add(new UserControl.Message(MessageType.Error
                                                              , "$NoSimulation $CS_Param_ID =" + txtRCard.Value.Trim().ToUpper()));

                        ClearRCardInfo();
                        txtRCard.TextFocus(true, true);
                    }
                }
                #endregion
            }
            else
            {
                #region RCARD 从当前Carton移转到另外一个Carton
                InventoryFacade materialDCF = new InventoryFacade(DataProvider);
                //ActionOnLineHelper onlineHelper = new ActionOnLineHelper(DataProvider);

                if (!CheckTargetCarton(cartonno))
                {
                    if (!m_NeedAddNewCarton)
                    {
                        txtCartonNO.TextFocus(true, true);
                        return;
                    }
                }
                string sourceCard          = dcf.GetSourceCard(txtRCard.Value.Trim().ToUpper(), string.Empty);
                object objSimulationReport = dcf.GetLastSimulationReport(sourceCard);

                if (objSimulationReport != null)
                {
                    Domain.DataCollect.SimulationReport simulationReport = objSimulationReport as Domain.DataCollect.SimulationReport;

                    simulationReport.CartonCode = cartonno.Trim().ToUpper();
                    Package.PackageFacade pf = new BenQGuru.eMES.Package.PackageFacade(DataProvider);

                    #region 移转操作
                    DataProvider.BeginTransaction();
                    try
                    {
                        //Add By Bernard @ 2010-11-01
                        string moCode           = txtMoCode.Value.Trim().ToUpper();
                        string oldCartonno      = txtCurrentCarton.Value.Trim().ToUpper();
                        bool   m_HasCartonAdded = false;
                        //end

                        //包装箱不存在,为CartonInfo表增加一个包装箱信息
                        if (m_NeedAddNewCarton)
                        {
                            DBDateTime currentDateTime = FormatHelper.GetNowDBDateTime(DataProvider);
                            BenQGuru.eMES.Domain.Package.CARTONINFO newCarton = new BenQGuru.eMES.Domain.Package.CARTONINFO();

                            newCarton.CARTONNO    = cartonno.Trim().ToUpper();
                            newCarton.CAPACITY    = ((new ItemFacade(DataProvider)).GetItem(simulationReport.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID) as Item).ItemCartonQty;
                            newCarton.COLLECTED   = 0;
                            newCarton.EATTRIBUTE1 = "";
                            newCarton.PKCARTONID  = System.Guid.NewGuid().ToString().ToUpper();
                            newCarton.MUSER       = ApplicationService.Current().UserCode;
                            newCarton.MDATE       = currentDateTime.DBDate;
                            newCarton.MTIME       = currentDateTime.DBTime;
                            pf.AddCARTONINFO(newCarton);

                            //0.向tblcarton2rcard表增加一个包装箱 Add By Bernard @ 2010-11-01
                            Carton2RCARD newCarton2RCard = new Carton2RCARD();
                            newCarton2RCard.CartonCode  = cartonno.Trim().ToUpper();
                            newCarton2RCard.Rcard       = rCard;
                            newCarton2RCard.MUser       = ApplicationService.Current().UserCode;
                            newCarton2RCard.MDate       = currentDateTime.DBDate;
                            newCarton2RCard.MTime       = currentDateTime.DBTime;
                            newCarton2RCard.Eattribute1 = "";
                            newCarton2RCard.MOCode      = moCode;
                            pf.AddCarton2RCARD(newCarton2RCard);
                            m_HasCartonAdded = true;
                            //end
                        }

                        //1.判断新箱与旧箱内产品工单代码是否一致 Add By Bernard @ 2010-11-01
                        object oldObj = pf.GetCarton2RCARD(oldCartonno, rCard);
                        //modified by lisa @20120829
                        //string newMOCode = moCode;
                        object[] newObj    = pf.GetCarton2RCARDByCartonNO(FormatHelper.CleanString(this.txtCartonNO.Value.Trim()));
                        string   newMOCode = ((Carton2RCARD)newObj[0]).MOCode;
                        //end add
                        string oldMOCode = ((Carton2RCARD)oldObj).MOCode;

                        if (oldMOCode == newMOCode)        //工单代码一致
                        {
                            if (m_HasCartonAdded == false) //箱号没有新增,则向Carton2RCard新增一条记录
                            {
                                DBDateTime   currentDateTime = FormatHelper.GetNowDBDateTime(DataProvider);
                                Carton2RCARD carton2rcard    = new Carton2RCARD();
                                carton2rcard.Rcard       = rCard;
                                carton2rcard.CartonCode  = cartonno;
                                carton2rcard.MOCode      = moCode;
                                carton2rcard.MUser       = ApplicationService.Current().UserCode;
                                carton2rcard.MDate       = currentDateTime.DBDate;
                                carton2rcard.MTime       = currentDateTime.DBTime;
                                carton2rcard.Eattribute1 = "";
                                pf.AddCarton2RCARD(carton2rcard);
                            }
                            //end

                            dcf.RemoveFromCarton(simulationReport.RunningCard, ApplicationService.Current().UserCode);

                            pf.UpdateCollected(cartonno.Trim().ToUpper());

                            Domain.DataCollect.Simulation simulation = (Domain.DataCollect.Simulation)dcf.GetSimulation(simulationReport.RunningCard);

                            if (simulation != null)
                            {
                                simulation.CartonCode = cartonno.Trim().ToUpper();
                                dcf.UpdateSimulation(simulation);
                            }

                            dcf.UpdateSimulationReport(simulationReport);

                            //记log
                            pf.addCarton2RCARDLog(cartonno, simulationReport.RunningCard, ApplicationService.Current().UserCode);
                            //end
                        }
                        else//新旧包装箱工单代码不一致 Add By Bernard @ 2010-11-01
                        {
                            if (m_HasCartonAdded == true)
                            {
                                //删除CartonInfo表新增加的包装箱
                                CARTONINFO cartoninfo = new CARTONINFO();
                                cartoninfo.CARTONNO = cartonno;
                                pf.DeleteCARTONINFO(cartoninfo);

                                //删除旧Carton2RCARD表新增加的箱号
                                Carton2RCARD carton2rcard = new Carton2RCARD();
                                carton2rcard.Rcard      = rCard;
                                carton2rcard.CartonCode = cartonno;
                                pf.DeleteCarton2RCARD(carton2rcard);
                            }
                            else
                            {
                                DataProvider.RollbackTransaction();
                                ucMessage.Add(new UserControl.Message(MessageType.Error,
                                                                      "$CS_CARTON_NO :" + cartonno + "$CS_Which_MOCode_With_RCard :" + rCard + "$CS_For_Carton_No's_MOCode_Is_Different"));
                                txtCartonNO.TextFocus(true, true);
                                return;
                            }
                        }
                        //end

                        DataProvider.CommitTransaction();

                        ucMessage.Add(new UserControl.Message(MessageType.Success
                                                              , "$CS_RCARD_TRANSFER_CARTON_SUCCESS $CS_Param_ID =" + txtRCard.Value.Trim().ToUpper()));

                        txtRCard.TextFocus(true, true);
                        txtCartonNO.Value = String.Empty;
                        ClearRCardInfo();
                    }
                    catch (Exception ex)
                    {
                        DataProvider.RollbackTransaction();
                        ucMessage.Add(new UserControl.Message(ex));

                        txtCartonNO.TextFocus(true, true);
                    }
                    finally
                    {
                        (DataProvider as SQLDomainDataProvider).PersistBroker.CloseConnection();
                    }
                    #endregion
                }
                else
                {
                    ucMessage.Add(new UserControl.Message(MessageType.Error, "$NoSimulation $CS_Param_ID =" + txtRCard.Value.Trim().ToUpper()));

                    ClearRCardInfo();
                    txtRCard.TextFocus(true, true);
                }

                #endregion
            }
        }