Exemplo n.º 1
0
        private void CmdQueryBtn_Click(object sender, EventArgs e)
        {
            string strWhe = string.Empty;

            try
            {
                string strSql = "select Cmd_Sno, Cmd_Mode, Cmd_Sts, Stn_No, Loc, New_Loc, Height, substring(Crt_Date,1,10) as Crt_Dte, substring(Crt_Date,12,8) as Crt_Tim," +
                                "User_Id, Plt_ID, Trace  from Cmd_Mst where Cmd_Sts in ('0','1') ";
                if (cmbCmdMode.SelectedIndex != 0)
                {
                    strWhe += string.Format(" and Cmd_Mode='{0}'", cmbCmdMode.Text.Split("-".ToCharArray())[0]);
                }
                if (CmdSnoCtl.Text != "命令号")
                {
                    strWhe += string.Format(" and Cmd_Sno='{0}'", GCtrl.C5Sno(int.Parse(CmdSnoCtl.Text)));
                }
                strSql = strSql + strWhe;
                dtCmdQuery.Clear();
                Globals.DB.ExecGetTable(strSql, ref dtCmdQuery);
                dgvCmdMst.ClearSelection();
            }
            catch (Exception ex)
            {
                Log.WriteLog(ex);
            }
        }
Exemplo n.º 2
0
 private void CmdSnoCtl_Leave(object sender, EventArgs e)
 {
     try
     {
         CmdSnoCtl.Text = GCtrl.C5Sno(int.Parse(CmdSnoCtl.Text));
     }
     catch (Exception)
     {
         CmdSnoCtl.Text = "命令号";
     }
 }
Exemplo n.º 3
0
        private void Init()
        {
            InitData();
            InitCtl();
            InitCrane();
            GCtrl.GetCrnInfo();
            string strSql = string.Format("select * from ctrlhs where EquNo='{0}'", Globals.strEquNo);

            if (!Globals.DB.ExecQuery(strSql))
            {
                strSql = string.Format("insert into ctrlhs(HS,EquNo,trndt) values ('1','{0}','2015-10-10 12:00:00')", Globals.strEquNo);
                Globals.DB.ExecSql(strSql);
            }

            Log.WriteLogClose(cLog.Start, "...");
        }
Exemplo n.º 4
0
        public static bool GetReadyOut(string sLoc)
        {
            bool   bReady = false;
            string sSql = string.Empty, sStnNo = string.Empty;
            string sPltNo = string.Empty, sInnerLoc = string.Empty;
            string sItmType = string.Empty, sNewLoc = string.Empty;
            string sIoType = string.Empty, sRunInfo = string.Empty;
            int    nCrn = 0;

            DataRow drLoc = null;

            try
            {
                if (GCtrl.IsInnerLoc(sLoc))
                {
                    return(true);
                }

                nCrn      = GCtrl.GetEquFLoc(sLoc);
                sStnNo    = string.Format("S{0}00", nCrn);
                sInnerLoc = GCtrl.GetInnerLoc(sLoc);
                sSql      = string.Format(@"select * from Loc_Mst where Loc='{0}'", sInnerLoc);
                if (!dbConn.ExecGetRow(sSql, ref drLoc) || drLoc == null)
                {
                    throw new Exception("获取内储位失败!");
                }

                // 根据内储位状态判断如何处理
                eLocSts sLocSts = (eLocSts)Enum.Parse(typeof(eLocSts), drLoc["Loc_Sts"].ToString());

                switch (sLocSts)
                {
                case eLocSts.S:
                case eLocSts.E:
                    if (sLocSts == eLocSts.S)
                    {
                        sItmType = cItmType.Stock;
                    }
                    else if (sLocSts == eLocSts.E)
                    {
                        sItmType = cItmType.EptPlt;
                    }

                    sPltNo = drLoc["Plt_id"].ToString();
                    // 将内储位的货物放置到新的储位
                    sNewLoc = GCtrl.GetNewInL2L(nCrn, drLoc["Loc_Size"], sItmType, sPltNo, sInnerLoc, out sRunInfo);
                    if (sNewLoc.Length != 7)
                    {
                        throw new Exception(string.Format("储位:{0} 状态:{1},库对库{2}", sInnerLoc, sLocSts, sRunInfo));
                    }

                    Log.WriteLog(cLog.RunLog, string.Format("储位:{0} 状态:{1},库对库{2}:{3}", sInnerLoc, sLocSts, sRunInfo, sNewLoc));

                    dbConn.BeginTran(true);
                    // ======================================================================================================================
                    sSql = string.Format("update loc_mst set old_sts = loc_sts ,loc_sts = 'O',trn_time = '{0}' where loc = '{1}' and loc_sts in ('S','E')",
                                         DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), sInnerLoc);
                    if (!dbConn.ExecSql(sSql))
                    {
                        throw new Exception(dbConn.ErrorInfo);
                    }

                    sSql = string.Format("update loc_mst set old_sts = loc_sts ,loc_sts = 'I',trn_time = '{0}' where loc = '{1}' and loc_sts in ('N')",
                                         DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), sNewLoc);
                    if (!dbConn.ExecSql(sSql))
                    {
                        throw new Exception(dbConn.ErrorInfo);
                    }
                    Log.WriteLog("库对库更新库位状态为预约" + sSql);
                    //string sCmdSno = Globals.GetSno();
                    if (sItmType == cItmType.EptPlt)
                    {
                        sIoType = cIoType.EptPltL2L;
                    }
                    else if (sItmType == cItmType.Stock)
                    {
                        sIoType = cIoType.StockL2L;
                    }

                    // 产生库对库命令
                    if (!GCtrl.CrtCmdMst(sPltNo, "0", "1", "", cCmdMode.L2L, sIoType, sInnerLoc, sNewLoc, "", sPltNo, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "wcs", "wcs", "dfd", drLoc["Loc_Size"]))
                    {
                        throw new Exception(dbConn.ErrorInfo);
                    }

                    Log.WriteLog(cLog.RunLog, string.Format("储位:{0} 托盘:{1} 下库对库命令成功,命令号:{2}", sInnerLoc, sPltNo, sPltNo));
                    // ======================================================================================================================
                    dbConn.CommitTran();
                    break;

                case eLocSts.N:
                    bReady = true;
                    break;

                default:
                    sSql = string.Format(@"select Cmd_Sno from Cmd_Mst where Cmd_Mode='{0}' and Stn_No='{1}' and Loc='{2}' and Cmd_Sts <'8'",
                                         cCmdMode.L2L, sStnNo, sInnerLoc);
                    if (!dbConn.ExecQuery(sSql))
                    {
                        Log.WriteLog(cLog.RunLog, string.Format("内储位:{0} 状态:{1},不能做移库!", sInnerLoc, sLocSts));
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Log.WriteLog(ex);
            }
            return(bReady);
        }
Exemplo n.º 5
0
        private void modCmdBtn_Click(object sender, EventArgs e)
        {
            DataRow drCmd = null;

            //if (!Globals.bLogin) { MsgBox.Warning("请先到用户登录模块登录,谢谢!"); return; }
            if (!Globals.CtlValidate(cStnNoCtl, cTraceCtl, cPriCtl, cmbCSts))
            {
                MsgBox.Warning(StrTables.MSG_NOT_FULL);
                return;
            }
            if (MsgBox.Question("是否确认执行?") == DialogResult.No)
            {
                return;
            }

            try
            {
                string sSql = string.Format("select * from Cmd_Mst where Cmd_Sno='{0}'", GCtrl.C5Sno(cmbCmdSno.Text));
                if (!Globals.DB.ExecGetRow(sSql, ref drCmd) || drCmd == null)
                {
                    MsgBox.Warning("查无记录!");
                    return;
                }

                MakeSql mSql = new MakeSql("Cmd_Mst", SqlType.Update);
                mSql.AddStrWhere(drCmd, "Cmd_Sno");
                mSql.SetStrValue("Cmd_Sts", cmbCSts.Text.Split("-".ToCharArray())[0]);
                mSql.SetStrValue("Stn_No", cStnNoCtl.Text.Trim());
                mSql.SetStrValue("Trace", cTraceCtl.Text.Trim());
                mSql.SetStrValue("Prty", cPriCtl.Text.Trim());
                sSql = mSql.GetSql();

                if (Globals.DB.ExecSql(sSql))
                {
                    MsgBox.Information("操作成功!");
                }
            }
            catch (Exception ex)
            {
                Log.WriteLog(ex);
            }
            finally
            {
                flushCmdBtn_Click(null, null);
            }
        }