Пример #1
0
        private void InputScanData()
        {
            int _Total = 0;

            switch (dataGridEmp.Rows[0].Cells[2].Value.ToString())
            {
            case "E":
                dataGridEsn.Rows.Add(InputStr, InputData.Rows.Count.ToString());
                listBoxEsn.Items.Add(InputStr);
                for (int j = 1; j < dataGridEsn.Rows.Count; j++)
                {
                    _Total += Convert.ToInt32(dataGridEsn.Rows[j].Cells[1].Value.ToString());
                    dataGridEsn.Rows[0].Cells[1].Value = _Total.ToString();
                }

                break;

            case "T":
                dataGridTray.Rows.Add(InputStr, InputData.Rows.Count.ToString());
                listBoxTray.Items.Add(InputStr);
                for (int j = 1; j < dataGridEsn.Rows.Count; j++)
                {
                    _Total += Convert.ToInt32(dataGridTray.Rows[j].Cells[1].Value.ToString());
                    dataGridTray.Rows[0].Cells[1].Value = _Total.ToString();
                }
                break;

            case "C":
                dataGridCarton.Rows.Add(InputStr, InputData.Rows.Count.ToString());
                listBoxCarton.Items.Add(InputStr);
                for (int j = 1; j < dataGridEsn.Rows.Count; j++)
                {
                    _Total += Convert.ToInt32(dataGridCarton.Rows[j].Cells[1].Value.ToString());
                    dataGridCarton.Rows[0].Cells[1].Value = _Total.ToString();
                }
                break;

            case "P":
                dataGridPallet.Rows.Add(InputStr, InputData.Rows.Count.ToString());
                listBoxPallet.Items.Add(InputStr);
                for (int j = 1; j < dataGridPallet.Rows.Count; j++)
                {
                    _Total += Convert.ToInt32(dataGridPallet.Rows[j].Cells[1].Value.ToString());
                    dataGridPallet.Rows[0].Cells[1].Value = _Total.ToString();
                }
                break;
            }

            cdbAccess cda = new cdbAccess();

            cda.ExecuteOleDbCommand(string.Format("insert into T_CHECK_SAP (WOID,PARTNUMBER,DATA_NO,DATA_QTY) VALUES ('{0}','{1}','{2}','{3}')", InputData.Rows[0]["WOID"].ToString(), InputData.Rows[0]["PARTNUMBER"].ToString(), InputStr, InputData.Rows.Count));
        }
Пример #2
0
        private void ClearData()
        {
            dataGridEsn.Rows.Clear();
            dataGridEsn.Rows.Add("Toatal", "0");
            dataGridTray.Rows.Clear();
            dataGridTray.Rows.Add("Toatal", "0");
            dataGridCarton.Rows.Clear();
            dataGridCarton.Rows.Add("Toatal", "0");
            dataGridPallet.Rows.Clear();
            dataGridPallet.Rows.Add("Toatal", "0");
            listBoxEsn.Items.Clear();
            listBoxTray.Items.Clear();
            listBoxCarton.Items.Clear();
            listBoxPallet.Items.Clear();
            cdbAccess cda = new cdbAccess();

            cda.ExecuteOleDbCommand("delete from T_CHECK_SAP");
        }
Пример #3
0
        private void Frm_StockingIn_Load(object sender, EventArgs e)
        {
            if (!Directory.Exists("C:\\SFIS"))
            {
                Directory.CreateDirectory("C:\\SFIS");
            }


            FileVersionInfo myFileVersion = FileVersionInfo.GetVersionInfo(System.Windows.Forms.Application.ExecutablePath);

            this.Text = string.Format("{0} Version:{1} (Build Date:{2})", "Stockin_In", myFileVersion.FileVersion, System.IO.File.GetLastWriteTime(System.Windows.Forms.Application.ExecutablePath).ToShortDateString());

            string _StrErr = string.Empty;

            if (!OperateDB.Check_Version("STOCKIN", System.Windows.Forms.Application.ProductVersion, null, null, null, out _StrErr))
            {
                if (_StrErr == "OK")
                {
                    RunFile(System.Windows.Forms.Application.StartupPath + @"\", "AutoUpdate.exe", appfilename);
                    MessageBox.Show("该程序为版本不是最新版\r\n请更新后运行");
                    string    FileName = System.IO.Path.GetFileName(System.Windows.Forms.Application.ExecutablePath);
                    Process[] prc      = Process.GetProcessesByName(FileName.Substring(0, FileName.LastIndexOf('.')));
                    if (prc.Length > 0)
                    {
                        foreach (Process pc in prc)
                        {
                            pc.Kill();
                        }
                    }
                    return;
                }
                else
                {
                    MessageBox.Show("检查版本失败:" + _StrErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Application.Exit();
                }
            }

            Line_Name = IniReadValue("STOCKIN", "LINE", IniFilePath);
            MYGROUP   = IniReadValue("STOCKIN", "MYGROUP", IniFilePath);
            SetStation();

            dataGridEsn.Columns.Add("ESN", "ESN");
            dataGridEsn.Columns.Add("Toatal", "Toatal Qty");
            dataGridEsn.Rows.Add("Toatal", "0");

            dataGridTray.Columns.Add("Tray", "Tray");
            dataGridTray.Columns.Add("Toatal", "Toatal Qty");
            dataGridTray.Rows.Add("Toatal", "0");

            dataGridCarton.Columns.Add("CARTON", "CARTON");
            dataGridCarton.Columns.Add("Toatal", "Toatal Qty");
            dataGridCarton.Rows.Add("Toatal", "0");

            dataGridPallet.Columns.Add("Pallet", "PALLET");
            dataGridPallet.Columns.Add("Toatal", "Toatal Qty");
            dataGridPallet.Rows.Add("Toatal", "0");
            SetdataGridWidth();
            dataGridEmp.Rows.Add("", "", "0");
            SetStation();

            if (!Directory.Exists(Application.StartupPath + @"\Database"))
            {
                Directory.CreateDirectory(Application.StartupPath + @"\Database");
            }
            if (File.Exists(Application.StartupPath + @"\Database\dbtemp.mdb"))
            {
                File.Delete(Application.StartupPath + @"\Database\dbtemp.mdb");
            }
            CreateAccessDb CDB = new CreateAccessDb();

            CDB._CreateMDB();
            CDB._Create_T_CHECK_SAP();
            cdbAccess cda = new cdbAccess();

            cda.ExecuteOleDbCommand("delete from T_CHECK_SAP");
            txt_InputStr.Focus();
        }
Пример #4
0
        private bool CHECK_SAP()
        {
            bool      AccessFlag = false;
            cdbAccess cdb        = new cdbAccess();
            DataTable dt         = cdb.GetDatatable("select woId,partnumber,sum(data_qty) as  QTY from T_CHECK_SAP group by  woId,partnumber");

            if (dt.Rows.Count == 0)
            {
                AccessFlag = true;
                dt.Rows.Add(InputData.Rows[0]["WOID"].ToString(), InputData.Rows[0]["partnumber"].ToString(), InputData.Rows.Count);
            }

            bool   sFlag     = false;
            string FactoryId = string.Empty;


            foreach (DataRow dr in dt.Rows)
            {
                int CHK_QTY = 0;
                if (dr["WOID"].ToString() == InputData.Rows[0]["WOID"].ToString() && !AccessFlag)
                {
                    CHK_QTY = Convert.ToInt32(dr["QTY"].ToString()) + InputData.Rows.Count;
                }
                else
                {
                    CHK_QTY = Convert.ToInt32(dr["QTY"].ToString());
                }

                FactoryId = OperateDB.Get_WoInfo(dr["WOID"].ToString()).Rows[0]["FACTORYID"].ToString();
                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic.Add("PARTNUMBER", dr["PARTNUMBER"].ToString());
                dic.Add("WOID", dr["WOID"].ToString());
                dic.Add("QTY", CHK_QTY);
                dic.Add("EMP_NO", dr["QTY"].ToString());
                dic.Add("EMP_NAME", dr["QTY"].ToString());
                dic.Add("PLANT", string.IsNullOrEmpty(FactoryId) ? "2100" : FactoryId);
                string[] LsMsg = SapConn.CHK_STOCKIN_Z_RFC_AUFNR_MIGO(DictionaryToJson(dic));
                if (LsMsg.Length < 5)
                {
                    SendMsg(mLogMsgType.Error, "检查SAP 发生异常" + LsMsg[0].ToString());
                    sFlag = false;
                }
                else
                {
                    string SAP_STOCKNO = LsMsg[0].ToString();
                    string SAP_TYPE    = LsMsg[1].ToString();
                    string SAP_E_ID    = LsMsg[2].ToString();
                    string SAP_E_NUM   = LsMsg[3].ToString();
                    string SAP_MSG     = LsMsg[4].ToString();
                    if (SAP_TYPE.ToUpper() == "S")
                    {
                        SendMsg(mLogMsgType.Incoming, string.Format("检查SAP 工单:[{0}] 数量:[{1}] OK", dr["WOID"].ToString(), CHK_QTY.ToString()));

                        sFlag = true;
                    }
                    else
                    {
                        string sSAP_MSG = string.Format("工单:{0},料号:{1},数量:{2},MSG:{3}", dr["WOID"].ToString(), dr["PARTNUMBER"].ToString(), CHK_QTY.ToString(), SAP_TYPE + "-" + SAP_E_ID + "-" + SAP_E_NUM + "-" + SAP_MSG);

                        SendMsg(mLogMsgType.Error, "SAP:" + sSAP_MSG);
                        sFlag = false;
                        break;
                    }
                }
            }

            SendMsg(mLogMsgType.Incoming, "检查SAP数据完成....");
            return(sFlag);
        }