using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; namespace SiaSun.LMS.Implement { /// /// 消息队列 申请类 /// public class Apply_Base : S_BaseService { /// 申请-模型 /// 申请-模型 /// private SiaSun.LMS.Model.IO_CONTROL_APPLY _io_control_apply; public SiaSun.LMS.Model.IO_CONTROL_APPLY IO_CONTROL_APPLY { get { return this._io_control_apply; } set { this._io_control_apply = value; } } /// /// 站台 /// private SiaSun.LMS.Model.WH_CELL _wh_cell; public SiaSun.LMS.Model.WH_CELL WH_CELL { get { return this._wh_cell; } set { this._wh_cell = value; } } public Apply_Base() { } public Apply_Base(SiaSun.LMS.Model.IO_CONTROL_APPLY mIO_CONTROL_APPLY) : this() { this.IO_CONTROL_APPLY = mIO_CONTROL_APPLY; } /// 校验 /// 校验 /// /// 返回结果 /// 返回原因 public virtual bool Check(out string sResult) { bool bResult = true; sResult = string.Empty; this.WH_CELL = this._P_WH_CELL.GetModel(this.IO_CONTROL_APPLY.DEVICE_CODE); bResult = null != this.WH_CELL; if (!bResult) { sResult = string.Format("设备编码{0}不存在", this.IO_CONTROL_APPLY.DEVICE_CODE); return bResult; } if (this.IO_CONTROL_APPLY.STOCK_BARCODE.TrimEnd() == string.Empty) { bResult = false; sResult = "未上报托盘条码"; return bResult; } return bResult; } /// 处理 /// 处理 /// /// /// public virtual bool Handel(out string sResult) { bool bResult = true; sResult = string.Empty; return bResult; } /// /// 生成异常处理任务(具体在子类) /// 生成任务申请历史记录 /// 错误信息发送LED /// /// /// public virtual void WriteLog(bool bSuccess, string sResult) { try { Model.IO_CONTROL_APPLY_HIS mIO_CONTROL_APPLY_HIS = new Model.IO_CONTROL_APPLY_HIS(); mIO_CONTROL_APPLY_HIS.CONTROL_ID = this.IO_CONTROL_APPLY.CONTROL_ID; mIO_CONTROL_APPLY_HIS.CONTROL_APPLY_TYPE = this.IO_CONTROL_APPLY.CONTROL_APPLY_TYPE; mIO_CONTROL_APPLY_HIS.WAREHOUSE_CODE = this.IO_CONTROL_APPLY.WAREHOUSE_CODE; mIO_CONTROL_APPLY_HIS.DEVICE_CODE = this.IO_CONTROL_APPLY.DEVICE_CODE; mIO_CONTROL_APPLY_HIS.STOCK_BARCODE = this.IO_CONTROL_APPLY.STOCK_BARCODE; mIO_CONTROL_APPLY_HIS.APPLY_TASK_STATUS = this.IO_CONTROL_APPLY.APPLY_TASK_STATUS; mIO_CONTROL_APPLY_HIS.CREATE_TIME = this.IO_CONTROL_APPLY.CREATE_TIME; mIO_CONTROL_APPLY_HIS.CONTROL_APPLY_REMARK = this.IO_CONTROL_APPLY.CONTROL_APPLY_REMARK; mIO_CONTROL_APPLY_HIS.MANAGE_ERROR_TEXT = sResult; this._P_IO_CONTROL_APPLY_HIS.Add(mIO_CONTROL_APPLY_HIS); this._P_IO_CONTROL_APPLY.Delete(this.IO_CONTROL_APPLY.CONTROL_APPLY_ID); if (!bSuccess) { //大屏幕显示错误信息 //this._S_Control.LedShow(this.IO_CONTROL_APPLY.DEVICE_CODE, sResult, out sResult); } } catch(Exception ex) { } } protected void CreateApplyExceptionTask(Model.IO_CONTROL_APPLY mIO_CONTROL_APPLY, string ExceptionStation) { try { SiaSun.LMS.Model.IO_CONTROL mIO_CONTROL = new SiaSun.LMS.Model.IO_CONTROL(); mIO_CONTROL.RELATIVE_CONTROL_ID = -1; mIO_CONTROL.MANAGE_ID = 0; mIO_CONTROL.STOCK_BARCODE = mIO_CONTROL_APPLY.STOCK_BARCODE; mIO_CONTROL.CONTROL_TASK_LEVEL = "0"; mIO_CONTROL.PRE_CONTROL_STATUS = string.Empty; mIO_CONTROL.CONTROL_TASK_TYPE = 3; mIO_CONTROL.START_DEVICE_CODE = mIO_CONTROL_APPLY.DEVICE_CODE; mIO_CONTROL.END_DEVICE_CODE = ExceptionStation; mIO_CONTROL.CONTROL_BEGIN_TIME = SiaSun.LMS.Common.StringUtil.GetDateTime(); mIO_CONTROL.CONTROL_STATUS = 0; mIO_CONTROL.START_WAREHOUSE_CODE = "1"; mIO_CONTROL.END_WAREHOUSE_CODE = "1"; this._P_IO_CONTROL.Add(mIO_CONTROL); } catch (Exception ex) { } } } }