Commit 6f747e76 几米阳光

增加单盘入库功能

1 个父辈 7a872b9d
......@@ -40,6 +40,7 @@
this.label21 = new System.Windows.Forms.Label();
this.btnOutStore = new System.Windows.Forms.Button();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.btnSingleTrayIn = new System.Windows.Forms.Button();
this.lblBatchMsg = new System.Windows.Forms.Label();
this.btnOpenDoor = new System.Windows.Forms.Button();
this.lblWaitTragGo = new System.Windows.Forms.Label();
......@@ -259,9 +260,6 @@
this.清理日志ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator();
this.英文ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.btnTrayIn = new System.Windows.Forms.Button();
this.btnTrayOk = new System.Windows.Forms.Button();
this.lblTray = new System.Windows.Forms.Label();
this.contextMenuStrip1.SuspendLayout();
this.groupAuto.SuspendLayout();
this.groupBox6.SuspendLayout();
......@@ -452,9 +450,7 @@
//
this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox6.Controls.Add(this.lblTray);
this.groupBox6.Controls.Add(this.btnTrayIn);
this.groupBox6.Controls.Add(this.btnTrayOk);
this.groupBox6.Controls.Add(this.btnSingleTrayIn);
this.groupBox6.Controls.Add(this.lblBatchMsg);
this.groupBox6.Controls.Add(this.btnOpenDoor);
this.groupBox6.Controls.Add(this.lblWaitTragGo);
......@@ -473,6 +469,17 @@
this.groupBox6.TabStop = false;
this.groupBox6.Text = "批量上下料操作";
//
// btnSingleTrayIn
//
this.btnSingleTrayIn.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSingleTrayIn.Location = new System.Drawing.Point(487, 177);
this.btnSingleTrayIn.Name = "btnSingleTrayIn";
this.btnSingleTrayIn.Size = new System.Drawing.Size(155, 38);
this.btnSingleTrayIn.TabIndex = 236;
this.btnSingleTrayIn.Text = "启动单盘入库";
this.btnSingleTrayIn.UseVisualStyleBackColor = true;
this.btnSingleTrayIn.Click += new System.EventHandler(this.btnTrayIn_Click);
//
// lblBatchMsg
//
this.lblBatchMsg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
......@@ -499,20 +506,20 @@
this.lblWaitTragGo.AutoSize = true;
this.lblWaitTragGo.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblWaitTragGo.ForeColor = System.Drawing.Color.Red;
this.lblWaitTragGo.Location = new System.Drawing.Point(193, 99);
this.lblWaitTragGo.Location = new System.Drawing.Point(171, 99);
this.lblWaitTragGo.Name = "lblWaitTragGo";
this.lblWaitTragGo.Size = new System.Drawing.Size(250, 22);
this.lblWaitTragGo.Size = new System.Drawing.Size(298, 22);
this.lblWaitTragGo.TabIndex = 231;
this.lblWaitTragGo.Text = "请拿走料盘,并点击左侧按钮确认";
this.lblWaitTragGo.Text = "请拿走或放入料盘,并点击左侧按钮确认";
//
// btnWaitTrgGo
//
this.btnWaitTrgGo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnWaitTrgGo.Location = new System.Drawing.Point(11, 92);
this.btnWaitTrgGo.Location = new System.Drawing.Point(11, 91);
this.btnWaitTrgGo.Name = "btnWaitTrgGo";
this.btnWaitTrgGo.Size = new System.Drawing.Size(155, 38);
this.btnWaitTrgGo.TabIndex = 230;
this.btnWaitTrgGo.Text = "门口料盘已拿出";
this.btnWaitTrgGo.Text = "料盘已拿出/放入";
this.btnWaitTrgGo.UseVisualStyleBackColor = true;
this.btnWaitTrgGo.Click += new System.EventHandler(this.btnWaitTrgGo_Click);
//
......@@ -575,9 +582,9 @@
//
this.lblOutInfo.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblOutInfo.ForeColor = System.Drawing.Color.Green;
this.lblOutInfo.Location = new System.Drawing.Point(22, 99);
this.lblOutInfo.Location = new System.Drawing.Point(11, 99);
this.lblOutInfo.Name = "lblOutInfo";
this.lblOutInfo.Size = new System.Drawing.Size(584, 22);
this.lblOutInfo.Size = new System.Drawing.Size(631, 22);
this.lblOutInfo.TabIndex = 234;
this.lblOutInfo.Text = "累积出库信息";
this.lblOutInfo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
......@@ -2943,41 +2950,6 @@
this.英文ToolStripMenuItem.Text = "英文";
this.英文ToolStripMenuItem.Click += new System.EventHandler(this.开启DEBUGToolStripMenuItem_Click);
//
// btnTrayIn
//
this.btnTrayIn.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnTrayIn.Location = new System.Drawing.Point(487, 177);
this.btnTrayIn.Name = "btnTrayIn";
this.btnTrayIn.Size = new System.Drawing.Size(155, 38);
this.btnTrayIn.TabIndex = 236;
this.btnTrayIn.Text = "启动单盘入库";
this.btnTrayIn.UseVisualStyleBackColor = true;
this.btnTrayIn.Visible = false;
this.btnTrayIn.Click += new System.EventHandler(this.btnTrayIn_Click);
//
// btnTrayOk
//
this.btnTrayOk.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnTrayOk.Location = new System.Drawing.Point(11, 176);
this.btnTrayOk.Name = "btnTrayOk";
this.btnTrayOk.Size = new System.Drawing.Size(155, 38);
this.btnTrayOk.TabIndex = 235;
this.btnTrayOk.Text = "料盘已放入";
this.btnTrayOk.UseVisualStyleBackColor = true;
this.btnTrayOk.Visible = false;
//
// lblTray
//
this.lblTray.AutoSize = true;
this.lblTray.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblTray.ForeColor = System.Drawing.Color.Red;
this.lblTray.Location = new System.Drawing.Point(193, 183);
this.lblTray.Name = "lblTray";
this.lblTray.Size = new System.Drawing.Size(250, 22);
this.lblTray.TabIndex = 237;
this.lblTray.Text = "请放入料盘,并点击左侧按钮确认";
this.lblTray.Visible = false;
//
// FrmStoreBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
......@@ -3268,9 +3240,7 @@
public System.Windows.Forms.Label label30;
private System.Windows.Forms.GroupBox groupAuto;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Button btnTrayIn;
private System.Windows.Forms.Button btnTrayOk;
private System.Windows.Forms.Label lblTray;
private System.Windows.Forms.Button btnSingleTrayIn;
}
}
......@@ -403,7 +403,7 @@ namespace OnlineStore.AutoInOutStore
btnBatchInStore.Enabled = map[ParamDefine.startBatchIn].Equals(ParamDefine.enable);
btnGetOutTray.Enabled = map[ParamDefine.takeOutReel].Equals(ParamDefine.enable);
btnCloseDoor.Enabled = map[ParamDefine.closeLock].Equals(ParamDefine.enable);
btnSingleTrayIn.Enabled = map[ParamDefine.singleReelIn].Equals(ParamDefine.enable);
lblDoorStatus.Text = map[ParamDefine.doorStatus];
lblOutInfo.Visible = !lblWaitTragGo.Visible;
lblOutInfo.Text = ResourceCulture.GetString(ResourceCulture.InstoreInfo,"批量出入库信息: 入库:" )+ AutomaticBaiting.BatchInStoreCount + "," + AutomaticBaiting.BatchInStoreHeight + "mm," +
......@@ -1754,19 +1754,12 @@ namespace OnlineStore.AutoInOutStore
private void btnTrayIn_Click(object sender, EventArgs e)
{
string defaultPosId = ConfigAppSettings.GetValue(Setting_Init.SinglePosId).Trim();
if (store.PositionNumList.Contains(defaultPosId))
{
bool result = store.StartInStoreMove(new InOutStoreParam("", defaultPosId), false, true);
if (!result)
{
MessageBox.Show("启动单盘出库失败:" + store.CodeOrInoutMsg);
}
}
else
string msg = AutomaticBaiting.doSingleReelIn();
if (!msg.Equals(""))
{
MessageBox.Show("请先正确配置 " + Setting_Init.SinglePosId);
MessageBox.Show(msg);
}
}
}
}
......@@ -899,10 +899,10 @@
<value>Open doorlock</value>
</data>
<data name="FrmStoreBox_lblWaitTragGo_Text" xml:space="preserve">
<value>Take reel,click left to confirm</value>
<value>Take/Put In reel,click left to confirm</value>
</data>
<data name="FrmStoreBox_btnWaitTrgGo_Text" xml:space="preserve">
<value>Portal reel taken</value>
<value>Portal reel taken/put in</value>
</data>
<data name="FrmStoreBox_lblBatchStatus_Text" xml:space="preserve">
<value>Wait to start</value>
......
......@@ -895,10 +895,10 @@
<value>打开门锁</value>
</data>
<data name="FrmStoreBox_lblWaitTragGo_Text" xml:space="preserve">
<value>请拿走料盘,并点击左侧按钮确认</value>
<value>请拿走/放入料盘,并点击左侧按钮确认</value>
</data>
<data name="FrmStoreBox_btnWaitTrgGo_Text" xml:space="preserve">
<value>门口料盘已拿出</value>
<value>料盘已拿出/放入</value>
</data>
<data name="FrmStoreBox_lblBatchStatus_Text" xml:space="preserve">
<value>等待启动</value>
......
......@@ -191,8 +191,10 @@ IO模块读取时间改为可配置。
PRO,(轴五)上料轴出库上升最大高度,BatchAxis_OutMaxValue,1600000,,,,,,,
20190529:增加单盘入库功能
增加配置:
<add key="SinglePosId" value="1#AC2_2_1_1" />
......
......@@ -225,6 +225,10 @@ namespace OnlineStore.Common
/// 门口料盘已取出
/// </summary>
public static string confirmReelOut = "confirmReelOut";
/// <summary>
/// 单盘入库按钮
/// </summary>
public static string singleReelIn = "singleReelIn";
public static string doorStatus = "doorStatus";
......
......@@ -12,6 +12,7 @@ using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Collections.Generic;
using OnlineStore.Common;
namespace Asa.IOModule
{
......@@ -598,14 +599,20 @@ namespace Asa.IOModule
{
while (true)
{
if (_receive.TryDequeue(out byte[] buff))
try
{
if (buff[7] == 1)
ReadDO(buff);
else if (buff[7] == 2)
ReadDI(buff);
else if (buff[7] == 5)
ReadSingle(buff);
if (_receive.TryDequeue(out byte[] buff))
{
if (buff[7] == 1)
ReadDO(buff);
else if (buff[7] == 2)
ReadDI(buff);
else if (buff[7] == 5)
ReadSingle(buff);
}
}catch(Exception ex)
{
LogUtil.error("AIOBOX2 Receive出错:" + ex.ToString());
}
Thread.Sleep(10);
}
......
......@@ -12,6 +12,12 @@ namespace OnlineStore.DeviceLibrary
public delegate string GetStringDelegate(string id, string defaultStr, params object[] param);
public static event GetStringDelegate GetStringEvent;
public static string GetMsgStr(string value)
{
string result = GetStrEvent?.Invoke(value, value);
return result;
}
public static string GetString(string id, string defaultStr)
{
string result = GetStrEvent?.Invoke(id, defaultStr);
......
......@@ -125,12 +125,12 @@ PRO,硕科步进电机(压紧轴)控制端口号,CompressAxis_PortName,COM6,,,,,,,
PRO,硕科步进电机(压紧轴)控制波特率,CompressAxis_PortBaudrate,9600,,,,,,,
PRO,硕科步进电机(压紧轴)控制奇偶校验,CompressAxis_PortParity,0,,,,,,,
PRO,硕科步进电机(压紧轴)控制停止位,CompressAxis_StopBits,1,,,,,,,
PRO,硕科步进电机(压紧轴)控制初速度,CompressAxis_StartSpeed,60000,,,,,,,
PRO,硕科步进电机(压紧轴)控制最大速度,CompressAxis_MaxSpeed,100000,,,,,,,
PRO,硕科步进电机(压紧轴)控制末速度,CompressAxis_EndSpeed,100000,,,,,,,
PRO,硕科步进电机(压紧轴)控制初速度,CompressAxis_StartSpeed,40000,,,,,,,
PRO,硕科步进电机(压紧轴)控制最大速度,CompressAxis_MaxSpeed,70000,,,,,,,
PRO,硕科步进电机(压紧轴)控制末速度,CompressAxis_EndSpeed,70000,,,,,,,
PRO,硕科步进电机(压紧轴)控制加速度,CompressAxis_AddSpeed,40000,,,,,,,
PRO,硕科步进电机(压紧轴)控制减速度,CompressAxis_DelSpeed,40000,,,,,,,
PRO,硕科步进电机(压紧轴)原点返回速度,CompressAxis_HomeSpeed,10000,,,,,,,
PRO,硕科步进电机(压紧轴)原点返回速度,CompressAxis_HomeSpeed,30000,,,,,,,
PRO,硕科步进电机轴地址(压紧轴),CompressAxis_Slv,1,,,,,, ,
,,,,,,,,,,
PRO,(轴五)上料轴目标速度,BatchAxis_TargetSpeed,800,,,,,,,
......
......@@ -527,7 +527,7 @@ namespace OnlineStore.DeviceLibrary
return false;
}
InOutStoreParam param = new InOutStoreParam("", PositionNumList[0]);
if (LoadParamPosition(param, false))
if (LoadParamPosition(param))
{
StoreMove.MoveParam = param;
StoreMove.NextMoveStep(StoreMoveStep.BOX_R41_InoutToP4);
......@@ -1839,6 +1839,11 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info(StoreName + "收到服务器命令:confirmReelOut=doit");
AutomaticBaiting.doConfirmReelGo();
} else if (dataMap.ContainsKey(ParamDefine.singleReelIn) && dataMap[ParamDefine.singleReelIn].Equals(ParamDefine.doit))
{
LogUtil.info(StoreName + "收到服务器命令:SingleReelIn=doit");
result = AutomaticBaiting.doSingleReelIn();
}
if (!result.Equals(""))
{
......@@ -1846,7 +1851,7 @@ namespace OnlineStore.DeviceLibrary
CodeOrInoutMsg = result;
}
}
}
}
private void ProcessHumidityCMD(Operation resultOperation)
{
Dictionary<string, string> data = resultOperation.data;
......
......@@ -38,7 +38,7 @@ namespace OnlineStore.DeviceLibrary
private int CurrInOutCount = 0;
private int CurrInOutACount = 0;
private bool LoadParamPosition(InOutStoreParam param, bool IsBatch)
private bool LoadParamPosition(InOutStoreParam param )
{
if (param == null)
{
......@@ -308,7 +308,7 @@ namespace OnlineStore.DeviceLibrary
}
if (storeRunStatus == StoreRunStatus.Runing)
{
if (!LoadParamPosition(param, false))
if (!LoadParamPosition(param))
{
UpdateInOutMsg(logMsg + "失败,找不到库位信息");
return false;
......@@ -605,7 +605,7 @@ namespace OnlineStore.DeviceLibrary
protected void SingleInStoreProcess()
{
LineMoveP moveP = StoreMove.MoveParam.MoveP;
LineMoveP moveP = StoreMove.MoveParam.MoveP;
if (StoreMove.MoveStep.Equals(StoreMoveStep.SIS_31_ToDoor))
{
InStoreLog("入库:SIS_32 单盘入库:叉子走到门口位置P4, 打开仓门 ,压紧轴到P3");
......@@ -613,7 +613,8 @@ namespace OnlineStore.DeviceLibrary
ACAxisMove(Config.InOut_Axis, moveP.InOut_P4, Config.InOutAxis_P2_Speed);
ComMoveToPosition(moveP.ComPress_P3);
OpenDoorAndWait();
}else if (StoreMove.MoveStep.Equals(StoreMoveStep.SIS_32_InoutToDoor))
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.SIS_32_InoutToDoor))
{
InStoreLog("入库:SIS_33 等待操作人员放入料盘 ");
StoreMove.NextMoveStep(StoreMoveStep.SIS_33_WaitTray);
......@@ -640,7 +641,7 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep.Equals(StoreMoveStep.SIS_35_InoutBack))
{
InStoreLog("入库:SIS_36 升降轴下降到扫码位置P2 ");
StoreMove.NextMoveStep(StoreMoveStep.SIS_36_UpdownDown);
StoreMove.NextMoveStep(StoreMoveStep.SIS_36_UpdownDown);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_OutHigh_P2, Config.UpDownAxis_P2_Speed);
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.SIS_36_UpdownDown))
......@@ -651,30 +652,57 @@ namespace OnlineStore.DeviceLibrary
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.SIS_37_InoutToP2))
{
InStoreLog("入库:SIS_38 扫码,最多等待6000 ");
InStoreLog("入库:SIS_38 ,清理扫码信息,开始扫码,最多等待6000 ");
AutomaticBaiting.ClearInStoreInfo();
StoreMove.NextMoveStep(StoreMoveStep.SIS_38_ScanCode);
StoreMove.OneWaitCanEndStep = true;
StoreMove.WaitList.Add(WaitResultInfo.WaitCodeOK());
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(6000));
GetCameraCode();
AutomaticBaiting.GetCameraCode();
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.SIS_38_ScanCode))
{
InStoreLog("入库:SIS_39 获取入库库位号 ");
StoreMove.NextMoveStep(StoreMoveStep.SIS_39_GetPosId);
SingleInStorePosId = GetAutoPosid();
if (AutomaticBaiting.LastCode.Equals(""))
{
SingleSendOut("未扫到二维码");
}
else
{
InStoreLog("入库:SIS_39 获取入库库位号 ");
StoreMove.NextMoveStep(StoreMoveStep.SIS_39_GetPosId);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(10000));//最多等待十秒
InOutStoreParam param = AutomaticBaiting.GetInStoreParam("单盘入库", AutomaticBaiting.ProcessMsg());
if (param == null)
{
SingleSendOut("从服务器获取入库信息失败");
}
else if (!LoadParamPosition(param))
{
SingleSendOut("加载入库" + param.PositionNum + "参数失败");
}
else
{
//更改当前入库参数
storeRunStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute;
StoreMove.NewMove(StoreMoveType.InStore, param);
lastMoveType = StoreMoveType.InStore;
StoreMove.IsBatchInOutStore = true;
StoreMove.IsNeedInStore = true;
StoreMove.NextMoveStep(StoreMoveStep.SI_01_LocationCylinderDown);
}
}
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.SIS_39_GetPosId))
{
InStoreLog("入库:SIS_40 启动新的入库 ");
StoreMove.NextMoveStep(StoreMoveStep.SIS_40_StartInStore);
SingleSendOut("启动入库超时 ");
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.SIS_40_StartInStore))
{
InStoreLog("入库:SIS_32 开始送出料盘 ,叉子后退 ");
InStoreLog("入库:SIS_41 开始送出料盘 ,叉子后退 ");
StoreMove.NextMoveStep(StoreMoveStep.SIS_41_StartSendTrayOut);
ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Position);
}
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.SIS_41_StartSendTrayOut))
{
StoreMove.IsNeedInStore = false;
......@@ -684,20 +712,16 @@ namespace OnlineStore.DeviceLibrary
}
}
private void GetCameraCode()
private void SingleSendOut(string msg)
{
IOManager.IOMove(IO_Type.CameraLight_Power, IO_VALUE.HIGH);
Thread.Sleep(1000);
IOManager.IOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
StoreMove.IsBatchInOutStore = true;
StoreMove.IsNeedInStore = false ;
InStoreLog( msg+",将料盘送出,叉子后退");
StoreMove.NextMoveStep(StoreMoveStep.SIS_41_StartSendTrayOut);
ACAxisMove(Config.InOut_Axis, StoreMove.MoveParam.MoveP.InOut_P1, Config.InOutAxis_P1_Position);
}
private string GetAutoPosid()
{
return ConfigAppSettings.GetValue(Setting_Init.SinglePosId);
}
string SingleInStorePosId = "";
#endregion
......@@ -718,7 +742,7 @@ namespace OnlineStore.DeviceLibrary
}
if (storeRunStatus == StoreRunStatus.Runing)
{
if (!LoadParamPosition(param, IsBatchWork))
if (!LoadParamPosition(param))
{
UpdateInOutMsg(logMsg + "失败,找不到库位信息");
return false;
......
......@@ -23,7 +23,7 @@ namespace OnlineStore.DeviceLibrary
private static int LastHeight = 0;
private static int LastWidth = 0;
private static List<string> LastCodeList = new List<string>();
private static string LastCode = "";
public static string LastCode = "";
private static string LastPosId = "";
public static int AxisChangeValue = ConfigAppSettings.GetIntValue(Setting_Init.AxisChangeValue);
public static string WarnMsg = "";
......@@ -101,7 +101,7 @@ namespace OnlineStore.DeviceLibrary
BatchInStoreCount = 0;
BatchInStoreHeight = 0;
}
private static void ClearInStoreInfo()
public static void ClearInStoreInfo()
{
LastCode = "";
LastCodeList = new List<string>();
......
......@@ -377,7 +377,7 @@ namespace OnlineStore.DeviceLibrary
IOManager.IOMove(highType, IO_VALUE.HIGH);
}
private static string ProcessMsg()
public static string ProcessMsg()
{
string msg = "";
//string[] codeArray = LastCode.Split(new string[] { spiltStr});
......@@ -432,99 +432,21 @@ namespace OnlineStore.DeviceLibrary
}
else
{
message = ScanCodeManager.ReplaceCode(message);
if (message.Equals("") || string.IsNullOrEmpty(message))
InOutStoreParam param = GetInStoreParam(Name, message);
if (param == null)
{
CodeMsg = "没有收到二维码信息,请重新放入料盘";
LogUtil.info(Name + "没有收到二维码信息,请重新放入料盘");
return;
}
if (StoreManager.Store.storeRunStatus.Equals(StoreRunStatus.Wait))
{
LogUtil.info(Name + "【 " + message + "】,设备未启动,不需要发送服务器");
return;
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
if (StoreManager.Store.CanStarInOut())
{
bool result = StoreManager.Store.StartInStoreMove(param, true);
//如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil.info(Name + " 收到服务器入库命令:库位号【" + param.PositionNum + "】二维码【" + message + "】 开始入库!");
}
//开启服务器日志
//HttpHelper.isLog = 1;
LogUtil.info(Name + "【 " + message + "】,发送给服务器获取入库PosID");
//发送扫码内容到服务器进行入库操作
Operation operation = StoreManager.Store.getLineBoxStatus();
operation.op = 1;
operation.data.Add("code", message);
operation.data.Add("boxId", StoreManager.Store.StoreID.ToString());
string autoposId = StoreManager.Store.GetAutoPosid(true);
if (StoreManager.Store.autoNext && (!String.IsNullOrEmpty(autoposId)))
else
{
operation.data.Add(ParamDefine.inPos, autoposId);
LogUtil.debug("添加自动入库库位号:"+autoposId);
}
string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), operation, false);
if (resultOperation == null)
{
LogUtil.info(Name + "二维码【" + message + "】没有收到服务器反馈!");
return;
}
else if (!string.IsNullOrEmpty(resultOperation.msg))
{
LogUtil.info(Name + "服务器反馈 二维码【" + message + "】【"+ autoposId + "】 :" + resultOperation.msg);
return;
}
Dictionary<string, string> data = resultOperation.data;
if (data != null && data.ContainsKey(ParamDefine.posId) && data.ContainsKey(ParamDefine.plateH) && data.ContainsKey(ParamDefine.plateW))
{
//服务器返回时有:posId库位编号,plateW:料盘宽度,plateH:料盘高度,
//postId格式BoxId#位置
string posId = data[ParamDefine.posId];
try
{
int plateW = Convert.ToInt32(data[ParamDefine.plateW]);
int plateH = Convert.ToInt32(data[ParamDefine.plateH]);
string singleOut = data[ParamDefine.singleOut];
//bool isSingleOut = singleOut.ToLower().Equals("true");
string[] posArray = posId.Split('#');
if (!(posArray.Length == 2))
{
WarnMsg = Name + ResourceControl.GetString(ResourceControl.InStoreError, "入库库位格式错误:") + "【" + message + "】【" + posId + "】";
LogUtil.error("服务器反馈 入库库位格式错误:二维码【" + message + "】库位【" + posId + "】");
return;
}
int storeId = int.Parse(posArray[0]);
//根据发送的posId获取位置列表
AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(posId);
if (position == null)
{ //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = ResourceControl.GetString(ResourceControl.InStoreNoPosition, "入库未找到库位:") + "【" + message + "】【" + posId + "】 ";
LogUtil.error("服务器反馈 入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
return;
}
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
if (StoreManager.Store.CanStarInOut())
{
LastPosId = posId;
InOutStoreParam param = new InOutStoreParam(message, posId, plateH, plateW);
bool result = StoreManager.Store.StartInStoreMove(param, true);
//如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil.info(Name + " 收到服务器入库命令:库位号【" + posId + "】二维码【" + message + "】 开始入库!");
}
else
{
LogUtil.info(Name + " 收到服务器入库命令:库位号【" + posId + "】二维码【" + message + "】 正在忙碌中,无法入库!");
}
}
catch (Exception ex)
{
LogUtil.error(Name + "解析服务发送的入库【" + posId + "】出错" + ex.StackTrace);
}
LogUtil.info(Name + " 收到服务器入库命令:库位号【" + param.PositionNum + "】二维码【" + message + "】 正在忙碌中,无法入库!");
}
}
}
......@@ -534,6 +456,99 @@ namespace OnlineStore.DeviceLibrary
}
}
public static InOutStoreParam GetInStoreParam(string LogName, string message)
{
message = ScanCodeManager.ReplaceCode(message);
if (message.Equals("") || string.IsNullOrEmpty(message))
{
CodeMsg = "没有收到二维码信息,请重新放入料盘";
LogUtil.info(LogName + "没有收到二维码信息,请重新放入料盘");
return null;
}
if (StoreManager.Store.storeRunStatus.Equals(StoreRunStatus.Wait))
{
LogUtil.info(LogName + "【 " + message + "】,设备未启动,不需要发送服务器");
return null;
}
LogUtil.info(LogName + "【 " + message + "】,发送给服务器获取入库PosID");
Operation operation = StoreManager.Store.getLineBoxStatus();
operation.op = 1;
operation.data.Add("code", message);
operation.data.Add("boxId", StoreManager.Store.StoreID.ToString());
if (LastHeight.Equals(0) && LastWidth.Equals(0))
{
//singleIn 单盘入库
operation.data.Add("singleIn", "true");
}
else
{
operation.data.Add("singleIn", "false");
}
string autoposId = StoreManager.Store.GetAutoPosid(true);
if (StoreManager.Store.autoNext && (!String.IsNullOrEmpty(autoposId)))
{
operation.data.Add(ParamDefine.inPos, autoposId);
LogUtil.debug("添加自动入库库位号:" + autoposId);
}
string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), operation, false);
if (resultOperation == null)
{
LogUtil.info(LogName + "二维码【" + message + "】没有收到服务器反馈!");
return null;
}
else if (!string.IsNullOrEmpty(resultOperation.msg))
{
LogUtil.info(LogName + "服务器反馈 二维码【" + message + "】【" + autoposId + "】 :" + resultOperation.msg);
return null;
}
Dictionary<string, string> data = resultOperation.data;
if (data != null && data.ContainsKey(ParamDefine.posId) && data.ContainsKey(ParamDefine.plateH) && data.ContainsKey(ParamDefine.plateW))
{
//服务器返回时有:posId库位编号,plateW:料盘宽度,plateH:料盘高度,
//postId格式BoxId#位置
string posId = data[ParamDefine.posId];
try
{
int plateW = Convert.ToInt32(data[ParamDefine.plateW]);
int plateH = Convert.ToInt32(data[ParamDefine.plateH]);
string singleOut = data[ParamDefine.singleOut];
//bool isSingleOut = singleOut.ToLower().Equals("true");
string[] posArray = posId.Split('#');
if (!(posArray.Length == 2))
{
WarnMsg = Name + ResourceControl.GetString(ResourceControl.InStoreError, "入库库位格式错误:") + "【" + message + "】【" + posId + "】";
LogUtil.error("服务器反馈 入库库位格式错误:二维码【" + message + "】库位【" + posId + "】");
return null;
}
int storeId = int.Parse(posArray[0]);
//根据发送的posId获取位置列表
AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(posId);
if (position == null)
{ //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = ResourceControl.GetString(ResourceControl.InStoreNoPosition, "入库未找到库位:") + "【" + message + "】【" + posId + "】 ";
LogUtil.error("服务器反馈 入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
return null;
}
LastPosId = posId;
InOutStoreParam param = new InOutStoreParam(message, posId, plateH, plateW);
return param;
}
catch (Exception ex)
{
LogUtil.error(LogName + "解析服务发送的入库【" + posId + "】出错" + ex.StackTrace);
}
}return null;
}
public static Dictionary<string, string> GetBtnStatus()
{
......@@ -543,6 +558,7 @@ namespace OnlineStore.DeviceLibrary
map.Add(ParamDefine.closeLock, ParamDefine.disable);
map.Add(ParamDefine.takeOutReel, ParamDefine.disable);
map.Add(ParamDefine.confirmReelOut, ParamDefine.disable);
map.Add(ParamDefine.singleReelIn, ParamDefine.disable);
if ( DoorStatus.Equals(2))
{
map.Add(ParamDefine.doorStatus, ResourceControl.GetString(ResourceControl.doorClose, "Door lock close"));
......@@ -567,7 +583,8 @@ namespace OnlineStore.DeviceLibrary
}
else
{
map[ParamDefine.openLock] = ParamDefine.enable;
map[ParamDefine.openLock] = ParamDefine.enable;
map[ParamDefine.singleReelIn] = ParamDefine.enable;
}
}
else
......@@ -639,15 +656,31 @@ namespace OnlineStore.DeviceLibrary
Reset(false,false);
return "";
}
public static bool doConfirmReelGo()
{
LogUtil.info(ResourceControl.GetString(ResourceControl.TakeTrayOut, "Take out reel manually"));
IsWaitTragGo = false;
IsGetTrayGo = true;
IsWaitTragGo = false;
IsGetTrayGo = true;
return true;
}
public static string doSingleReelIn()
{
string defaultPosId = ConfigAppSettings.GetValue(Setting_Init.SinglePosId).Trim();
if (StoreManager.Store.PositionNumList.Contains(defaultPosId))
{
bool result = StoreManager.Store.StartInStoreMove(new InOutStoreParam("", defaultPosId), false, true);
if (!result)
{
return ResourceControl.GetMsgStr("启动单盘入库失败:") + StoreManager.Store.CodeOrInoutMsg;
}
}
else
{
return (ResourceControl.GetMsgStr("请先正确配置:") + Setting_Init.SinglePosId);
}
return "";
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!