schangxiang@126.com
2024-11-21 60735779c303c2dd10feea45d7fd761103b225e0
SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs
@@ -132,7 +132,7 @@
                    msg = string.Format("向Station{0},起点{1},目标点{2},写入任务号{3}失败,返回结果:" + b2.resMsg, this.View.DeviceName, sourcePlce, toPlace, taskId);
                    return false;
                }
                return true;
            }
@@ -179,18 +179,37 @@
        /// <summary>
        /// 1015重新扫码
        /// 写入齐套结果
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="value"></param>
        /// <param name="value">true:表示 齐套。false:不齐套</param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public bool Write1015ReScan(int deviceId, bool value, out string msg)
        public bool WriteQiTaoInfo(string stationCode, bool value, out string msg)
        {
            try
            {
                msg = "";
                MessageModel b2 = this.plcService.WriteValuePoint(this.DBBlockForWrite.W_1015_ReScan, value, this.View.W_1015_ReScan);
                var stationObj = this.DBBlockForWrite.W_StationForWriteCommList.Where(x => x.StationCode == stationCode).FirstOrDefault();
                var view_stationObj = this.View.W_StationForWriteCommList.Where(x => x.StationCode == stationCode).FirstOrDefault();
                MessageModel b2 = this.plcService.WriteValuePoint(stationObj.W_DataFinish, true, view_stationObj.W_DataFinish);
                if (!b2.result)
                {
                    msg = string.Format("向Station地址{0} 写  " + true + "失败,返回结果:" + b2.resMsg,
                        this.DBBlockForWrite.W_1015_ReScan);
                    return false;
                }
                int i_result = 0;
                if (value)
                {
                    i_result = 998;
                }
                else
                {
                    i_result = 999;
                }
                b2 = this.plcService.WriteValuePoint(stationObj.W_KittingInfo, i_result, view_stationObj.W_KittingInfo);
                if (!b2.result)
                {
                    msg = string.Format("向Station地址{0} 写  " + value + "失败,返回结果:" + b2.resMsg,
@@ -209,37 +228,65 @@
            }
        }
        /// <summary>
        /// 1019重新扫码
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="value"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public bool Write1019ReScan(int deviceId, bool value, out string msg)
        public bool WriteInStoreTaskInfo(string stationCode, string toPlaceNo, short length, short width, short height, out string msg)
        {
            try
            {
                msg = "";
                MessageModel b2 = this.plcService.WriteValuePoint(this.DBBlockForWrite.W_1019_ReScan, value, this.View.W_1019_ReScan);
                var stationObj = this.DBBlockForWrite.W_StationForWriteCommList.Where(x => x.StationCode == stationCode).FirstOrDefault();
                var view_stationObj = this.View.W_StationForWriteCommList.Where(x => x.StationCode == stationCode).FirstOrDefault();
                MessageModel b2 = this.plcService.WriteValuePoint(stationObj.W_DataFinish, true, view_stationObj.W_DataFinish);
                if (!b2.result)
                {
                    msg = string.Format("向Station地址{0} 写  " + value + "失败,返回结果:" + b2.resMsg,
                        this.DBBlockForWrite.W_1019_ReScan);
                    msg = string.Format("向Station地址{0} 写 读码解析完成 " + true + "失败,返回结果:" + b2.resMsg,
                        this.DBBlockForWrite.W_1015_ReScan);
                    return false;
                }
                b2 = this.plcService.WriteValuePoint(stationObj.W_Destination_In, Convert.ToInt32(toPlaceNo), view_stationObj.W_Destination_In);
                if (!b2.result)
                {
                    msg = string.Format("向Station地址{0} 写 库位号 " + toPlaceNo + "失败,返回结果:" + b2.resMsg,
                        this.DBBlockForWrite.W_1015_ReScan);
                    return false;
                }
                b2 = this.plcService.WriteValuePoint(stationObj.W_Length, length, view_stationObj.W_Length);
                if (!b2.result)
                {
                    msg = string.Format("向Station地址{0} 写 长度 " + length + "失败,返回结果:" + b2.resMsg,
                        this.DBBlockForWrite.W_1015_ReScan);
                    return false;
                }
                b2 = this.plcService.WriteValuePoint(stationObj.W_Width, width, view_stationObj.W_Width);
                if (!b2.result)
                {
                    msg = string.Format("向Station地址{0} 写 宽度 " + width + "失败,返回结果:" + b2.resMsg,
                        this.DBBlockForWrite.W_1015_ReScan);
                    return false;
                }
                b2 = this.plcService.WriteValuePoint(stationObj.W_Height, height, view_stationObj.W_Height);
                if (!b2.result)
                {
                    msg = string.Format("向Station地址{0} 写 高度 " + height + "失败,返回结果:" + b2.resMsg,
                        this.DBBlockForWrite.W_1015_ReScan);
                    return false;
                }
                return true;
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                var logcontext = string.Format("向Station地址{0}  " + value + "出现异常:" + JsonConvert.SerializeObject(ex),
                        this.DBBlockForWrite.W_1019_ReScan);
                var logcontext = string.Format("WriteInStoreTaskInfo出现异常:" + JsonConvert.SerializeObject(ex),
                        "");
                Log4NetHelper.WriteErrorLog(Station_CacheEntity.curLogType, logcontext, ex);
                return false;
            }
        }
        /// <summary>
        ///  Station的任务完成ACK赋值
        /// </summary>