Ejemplo n.º 1
0
        private void dataGridViewX1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex != -1 && DeleteMaterialData == false)
            {
                Scan_Data.Text = "";
                labpn.Text     = "";


                Scan_Data.Text = this.dataGridViewX1[0, e.RowIndex].Value.ToString() + " " + this.dataGridViewX1[1, e.RowIndex].Value.ToString();
                sKp_No         = this.dataGridViewX1[4, e.RowIndex].Value.ToString();
                sStation       = this.dataGridViewX1[5, e.RowIndex].Value.ToString();
                //sSQL = string.Format("select * from tMaterialPreparation where masterid='{0}'  and woId='{1}' and stationno='{2}' ", dataGridViewX1[0, e.RowIndex].Value.ToString(), dataGridViewX1[1, e.RowIndex].Value.ToString(), dataGridViewX1[5, e.RowIndex].Value.ToString());
                //DataTable dtm=  refWebExecuteSqlCmd.Instance.ExecuteQuerySQL(sSQL);
                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic.Add("MASTERID", dataGridViewX1[0, e.RowIndex].Value.ToString());
                dic.Add("WOID", dataGridViewX1[1, e.RowIndex].Value.ToString());
                dic.Add("STATIONNO", dataGridViewX1[5, e.RowIndex].Value.ToString());
                DataTable dtm = FrmBLL.ReleaseData.arrByteToDataTable(refWebtMaterialPreparation.Instance.GetKpdistinctMaterial(FrmBLL.ReleaseData.DictionaryToJson(dic)));
                //DataTable dtm = FrmBLL.ReleaseData.arrByteToDataTable(refWebtMaterialPreparation.Instance.GetKpdistinctMaterial(new WebServices.tMaterialPreparation.tMaterialPreparation1()
                //    {
                //        masterId = dataGridViewX1[0, e.RowIndex].Value.ToString(),
                //        woId = dataGridViewX1[1, e.RowIndex].Value.ToString(),
                //        stationno = dataGridViewX1[5, e.RowIndex].Value.ToString()
                //    }));

                for (int z = 0; z < dtm.Rows.Count; z++)
                {
                    labpn.Text = labpn.Text + dtm.Rows[z]["KPNUMBER"].ToString() + ",";
                }
                Scan_Data_KeyDown(null, new KeyEventArgs(Keys.Enter));
                Scan_Data.SelectAll();
                Scan_Data.Focus();
            }
        }
Ejemplo n.º 2
0
 private void UndoClearData()
 {
     sSEQ_MO           = false;
     Old_Material_tray = false;
     sKp_No            = "";
     sStation          = "";
     sRowid            = "";
     Scan_Data.SelectAll();
 }
Ejemplo n.º 3
0
 private void butRefresh_Click(object sender, EventArgs e)
 {
     if (iasyncresult == null || iasyncresult.IsCompleted)
     {
         eventquerymaterialmonitor = new refquerymaterialmonitor(this.QueryMaterialMonitor);
         iasyncresult = eventquerymaterialmonitor.BeginInvoke(null, null);
         Scan_Data.Focus();
         Scan_Data.SelectAll();
     }
 }
Ejemplo n.º 4
0
        public bool GetTrsnMaterial(string trsn, out string MaterialLabel)
        {
            Scan_Data.SelectAll();
            MaterialLabel = "";
            string    _StrErr = string.Empty;
            DataTable dt      = FrmBLL.ReleaseData.arrByteToDataTable(refWebtR_Tr_Sn.Instance.Sel_Tr_Sn_Info(trsn, out _StrErr));

            try
            {
                if (dt.Rows[0]["STATUS"].ToString() == "3")
                {
                    ShowMsg("此盘物料已经备好在生产线,请确认......", mLogMsgType.Outgoing);
                    return(false);
                }

                if (dt.Rows[0]["STATUS"].ToString() != "2")
                {
                    ShowMsg("此盘物料状态不在待备料,请确认......", mLogMsgType.Error);
                    return(false);
                }
                if (Check_Mo)
                {
                    if (dt.Rows[0]["WOID"].ToString() != sMO)
                    {
                        Dictionary <string, object> dic = new Dictionary <string, object>();
                        dic.Add("NEW_WOID", sMO);
                        DataTable dtSmtMoMerge = FrmBLL.ReleaseData.arrByteToDataTable(refWebtSmtWoMerge.Instance.Get_Smt_WO_Merge(FrmBLL.ReleaseData.DictionaryToJson(dic), "OLD_WOID"));

                        if (dtSmtMoMerge.Rows.Count == 0 || dtSmtMoMerge.Rows[0]["OLD_WOID"].ToString() != dt.Rows[0]["WOID"].ToString())
                        {
                            ShowMsg(string.Format("物料工单不同,{0}≠{1}", dt.Rows[0]["WOID"].ToString(), sMO), mLogMsgType.Error);
                            return(false);
                        }
                    }
                }


                MaterialLabel = dt.Rows[0]["KP_NO"].ToString() + "|" + dt.Rows[0]["VENDER_ID"].ToString() + "|" + dt.Rows[0]["DATE_CODE"].ToString() + "|" + dt.Rows[0]["LOT_CODE"].ToString() + "|" + dt.Rows[0]["QTY"].ToString();

                return(true);
            }
            catch
            {
                ShowMsg("唯一条码错误,请刷正确的唯一条码", mLogMsgType.Error);
                return(false);
            }
        }
Ejemplo n.º 5
0
        private void Monitor_Load(object sender, EventArgs e)
        {
            #region 添加应用程序
            if (this.sInfo.gUserInfo.rolecaption == "系统开发员")
            {
                IList <IDictionary <string, object> > lsfunls = new List <IDictionary <string, object> >();
                FrmBLL.publicfuntion.GetFromCtls(this, ref lsfunls);
                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic.Add("PROGID", this.Name);
                dic.Add("PROGNAME", this.Text);
                dic.Add("PROGDESC", this.Text);
                FrmBLL.publicfuntion.AddProgInfo(dic, lsfunls);
            }
            #endregion

            dataGridViewX1.AutoGenerateColumns = false;


            QueryMaterialMonitor();
            QueryLineList();
            Scan_Data.SelectAll();
            Scan_Data.Focus();
            cblistline.Text = "ALL";
        }
Ejemplo n.º 6
0
        //private void Scan_Data_KeyDown(object sender, KeyEventArgs e)
        //{
        //    if (e.KeyValue == 13 && !string.IsNullOrEmpty(Scan_Data.Text))
        //    {
        //        if (Scan_Data.Text.Trim() == "UNDO")
        //        {
        //            UndoClearData();
        //            ShowMsg("清除完成,请刷入料站表", mLogMsgType.Incoming);

        //        }
        //        else
        //            if (sSEQ_MO == false)
        //            {
        //                try
        //                {
        //                    string str = Scan_Data.Text.Trim();
        //                    int i = str.IndexOf(' ');
        //                    sSEQ = str.Substring(0, i);
        //                    sMO = str.Substring(i + 1, str.Length - i - 1);
        //                }
        //                catch (Exception)
        //                {
        //                    ShowMsg("料站表刷入错误,请重新刷入料站表 ", mLogMsgType.Error);
        //                    Scan_Data.SelectAll();
        //                    sSEQ_MO = false;
        //                    return;
        //                }

        //               // sSQL = string.Format("select * from tSmtkPMonnitor where masterid='{0}'  and woId='{1}' and (cdata='0' or cdata='1') ", sSEQ, sMO);
        //              //  DataTable dt =  refWebExecuteSqlCmd.Instance.ExecuteQuerySQL(sSQL);

        //                DataTable dt = FrmBLL.ReleaseData.arrByteToDataTable(refWebtSmtKpMonitor.Instance.GetQueliaoStationList(sSEQ,sMO));

        //                if (dt.Rows.Count == 0)
        //                {
        //                    ShowMsg("料站表刷入错误,请重新刷入", mLogMsgType.Error);
        //                    Scan_Data.SelectAll();
        //                    return;
        //                }
        //                else
        //                {
        //                    ShowMsg("料站表正确,请刷唯一条码", mLogMsgType.Incoming);
        //                    Scan_Data.SelectAll();
        //                    sSEQ_MO = true;

        //                }
        //            }
        //            else
        //            {
        //                string LabelMaterial="";
        //              if (GetTrsnMaterial(Scan_Data.Text.Trim(), out LabelMaterial))
        //                {

        //                    string sPartNo = publicfuntion.mGetString(LabelMaterial, 1);//.GetString();
        //                    string sVenderCode = publicfuntion.mGetString(LabelMaterial, 2);
        //                    string sDateCode = publicfuntion.mGetString(LabelMaterial, 3);
        //                    string sLotID = publicfuntion.mGetString(LabelMaterial, 4);
        //                    string sQTY = publicfuntion.mGetString(LabelMaterial, 5);


        //                    if (!string.IsNullOrEmpty(sPartNo) &&
        //                        !string.IsNullOrEmpty(sVenderCode)  &&
        //                        !string.IsNullOrEmpty(sDateCode) &&
        //                        !string.IsNullOrEmpty(sLotID) &&
        //                        !string.IsNullOrEmpty(sQTY))
        //                    {
        //                        if (publicfuntion.Check_MaterialScrap(sPartNo, sVenderCode, sDateCode, sLotID))
        //                        {
        //                            //sSQL = string.Format("select a.kpmonitorid from tSmtkPMonnitor a,(select * from tMaterialPreparation where masterId='{0}' and woId='{1}') b " +
        //                            //                    " where a.masterid=b.masterid and a.woid=b.woid and a.stationno=b.stationno and a.kpnumber=b.kpnumber and a.cdata='0' and b.kpnumber='{2}'", sSEQ, sMO, sPartNo);
        //                            //DataTable dt =  refWebExecuteSqlCmd.Instance.ExecuteQuerySQL(sSQL);

        //                            DataTable dt = FrmBLL.ReleaseData.arrByteToDataTable(refWebtSmtKpMonitor.Instance.CheckSupplyMaterial(sSEQ, sMO, sPartNo));

        //                            if (dt.Rows.Count != 0)
        //                            {
        //                                sRowid = dt.Rows[0][0].ToString();

        //                                //sSQL = string.Format("Update tSmtkPMonnitor set kpnumber='{0}',vendercode='{1}',datecode='{2}',lotid='{3}',qty='{4}',cdata='{5}',supplyuser='******',supplytime=sysdate  where kpmonitorid='{7}'",
        //                                //                      sPartNo, sVenderCode, sDateCode, sLotID, sQTY, "1", sInfo.gUserInfo.userId, sRowid);
        //                                // refWebExecuteSqlCmd.Instance.ExecteSQLNonQuery(sSQL);

        //                                refWebtSmtKpMonitor.Instance.UpdateSupplyMaterialStatus(new WebServices.tSmtKpMonitor.tSmtKpMonitor1()
        //                                    {
        //                                        kpnumber = sPartNo,
        //                                        vendercode = sVenderCode,
        //                                        datecode = sDateCode,
        //                                        lotId = sLotID,
        //                                        qty = Convert.ToInt32(sQTY),
        //                                        cdata = 1,
        //                                        supplyuser = sInfo.gUserInfo.userId,
        //                                        kpmonitorId = sRowid
        //                                    });
        //                                refWebtSmtKpMonitor.Instance.UpdateTrsnStatus(Scan_Data.Text.Trim(), "2", sInfo.gUserInfo.userId);
        //                                ShowMsg("补料完成,请刷入料表", mLogMsgType.Incoming);
        //                                sSEQ_MO = false;
        //                                QueryMaterialMonitor();
        //                                cblistline_SelectionChangeCommitted(null, EventArgs.Empty);
        //                                Scan_Data.SelectAll();
        //                            }
        //                            else
        //                            {
        //                                ShowMsg("该物料未缺料或不在此料表内", mLogMsgType.Error);
        //                                Scan_Data.SelectAll();
        //                            }

        //                        }
        //                        else
        //                        {
        //                            ShowMsg("清仓物料,静止使用", mLogMsgType.Error);
        //                            Scan_Data.SelectAll();
        //                        }
        //                    }
        //                    else
        //                    {
        //                        ShowMsg("五合一条码格式错误", mLogMsgType.Error);
        //                        Scan_Data.SelectAll();
        //                    }
        //                }
        //            }
        //    }
        //}


        private void Scan_Data_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyValue == 13 && !string.IsNullOrEmpty(Scan_Data.Text))
            {
                if (Scan_Data.Text.Trim() == "UNDO")
                {
                    UndoClearData();
                    ShowMsg("清除完成,请刷入料站表", mLogMsgType.Incoming);
                }
                else
                if (sSEQ_MO == false)
                {
                    try
                    {
                        string str = Scan_Data.Text.Trim();
                        int    i   = str.IndexOf(' ');
                        sSEQ = str.Substring(0, i);
                        sMO  = str.Substring(i + 1, str.Length - i - 1);
                    }
                    catch (Exception)
                    {
                        ShowMsg("料站表刷入错误,请重新刷入料站表 ", mLogMsgType.Error);
                        Scan_Data.SelectAll();
                        sSEQ_MO = false;
                        return;
                    }

                    DataTable dt = FrmBLL.ReleaseData.arrByteToDataTable(refWebtSmtKpMonitor.Instance.GetQueliaoStationList(sSEQ, sMO));

                    if (dt.Rows.Count == 0)
                    {
                        ShowMsg("料站表刷入错误,请重新刷入", mLogMsgType.Error);
                        Scan_Data.SelectAll();
                        return;
                    }
                    else
                    {
                        ShowMsg("料站表正确,请刷唯一条码[原条码]", mLogMsgType.Incoming);
                        Scan_Data.SelectAll();
                        sSEQ_MO = true;
                    }
                }
                else
                if (Old_Material_tray == false)
                {
                    Scan_Data.SelectAll();

                    string    _StrErr = string.Empty;
                    DataTable dt_trsn = FrmBLL.ReleaseData.arrByteToDataTable(refWebtR_Tr_Sn.Instance.Sel_Tr_Sn_Info(Scan_Data.Text.Trim(), out _StrErr));
                    if (dt_trsn.Rows.Count == 0)
                    {
                        ShowMsg("原料盘刷入错误", mLogMsgType.Error);
                        return;
                    }
                    else
                    {
                        if (dt_trsn.Rows[0]["STATUS"].ToString() != "7")
                        {
                            ShowMsg("原料盘未使用,请确认...", mLogMsgType.Error);
                            return;
                        }
                        if (dt_trsn.Rows[0]["KP_NO"].ToString() != sKp_No)
                        {
                            ShowMsg(string.Format("原料盘料号[{0}]与缺料料号[{1}]不符,请确认...", dt_trsn.Rows[0]["KP_NO"].ToString(), sKp_No), mLogMsgType.Error);
                            return;
                        }

                        ShowMsg("原条码刷入正确,请刷新料盘", mLogMsgType.Incoming);
                        Scan_Data.SelectAll();
                        Old_Tr_sn         = Scan_Data.Text.Trim();
                        Old_Material_tray = true;
                    }
                }
                else

                {
                    string LabelMaterial = "";
                    string trsn          = Scan_Data.Text.Trim();
                    if (GetTrsnMaterial(Scan_Data.Text.Trim(), out LabelMaterial))
                    {
                        string sPartNo     = publicfuntion.mGetString(LabelMaterial, 1);//.GetString();
                        string sVenderCode = publicfuntion.mGetString(LabelMaterial, 2);
                        string sDateCode   = publicfuntion.mGetString(LabelMaterial, 3);
                        string sLotID      = publicfuntion.mGetString(LabelMaterial, 4);
                        string sQTY        = publicfuntion.mGetString(LabelMaterial, 5);


                        if (!string.IsNullOrEmpty(sPartNo) &&
                            !string.IsNullOrEmpty(sVenderCode) &&
                            !string.IsNullOrEmpty(sDateCode) &&
                            !string.IsNullOrEmpty(sLotID) &&
                            !string.IsNullOrEmpty(sQTY))
                        {
                            if (refWebtPartBlocked.Instance.Check_MaterialScrap(sPartNo, sVenderCode, sDateCode, sLotID))
                            {
                                DataTable dt = FrmBLL.ReleaseData.arrByteToDataTable(refWebtSmtKpMonitor.Instance.CheckSupplyMaterial(sSEQ, sMO, sPartNo));

                                if (dt.Rows.Count != 0)
                                {
                                    sRowid = dt.Rows[0][0].ToString();
                                    Dictionary <string, object> dic = new Dictionary <string, object>();
                                    dic.Add("KPNUMBER", sPartNo);
                                    dic.Add("VENDERCODE", sVenderCode);
                                    dic.Add("DATECODE", sDateCode);
                                    dic.Add("LOTID", sLotID);
                                    dic.Add("QTY", Convert.ToInt32(sQTY));
                                    dic.Add("CDATA", 1);
                                    dic.Add("SUPPLYUSER", sInfo.gUserInfo.userId);
                                    dic.Add("TRSN", trsn);
                                    dic.Add("ROWID", sRowid);
                                    refWebtSmtKpMonitor.Instance.UpdateSupplyMaterialStatus(FrmBLL.ReleaseData.DictionaryToJson(dic));
                                    string _StrErr = refWebtR_Tr_Sn.Instance.Update_TR_SN(Scan_Data.Text.Trim(), "NA", sInfo.gUserInfo.userId, "3", "NA", "NA");
                                    _StrErr = refWebtR_Tr_Sn.Instance.Update_TR_SN(Old_Tr_sn, "NA", sInfo.gUserInfo.userId, "8", "NA", "NA");    //原料盘更改为已下线
                                    ShowMsg("更改状态->" + _StrErr, mLogMsgType.Incoming);
                                    ShowMsg("补料完成,请刷入料表", mLogMsgType.Incoming);
                                    sSEQ_MO           = false;
                                    Old_Material_tray = false;
                                    Old_Tr_sn         = string.Empty;
                                    sKp_No            = string.Empty;
                                    cblistline_SelectionChangeCommitted(null, EventArgs.Empty);
                                    Scan_Data.SelectAll();
                                    QueryMaterialMonitor();
                                }
                                else
                                {
                                    ShowMsg("该物料未缺料或不在此料表内", mLogMsgType.Error);
                                    Scan_Data.SelectAll();
                                }
                            }
                            else
                            {
                                ShowMsg("清仓物料,静止使用", mLogMsgType.Error);
                                Scan_Data.SelectAll();
                            }
                        }
                        else
                        {
                            ShowMsg("五合一条码格式错误", mLogMsgType.Error);
                            Scan_Data.SelectAll();
                        }
                    }
                }
            }
        }