using System; using System.Collections.Generic; using System.Text; namespace Model { /// /// 手工任务结构体 /// public struct HandTask { /// /// 设备索引 /// public int _deviceIndex; /// /// 起始设备索引 /// public int _begindeviceIndex; /// /// 设备指令 /// public int _deviceOrder; /// /// 位置:“立库货位”,或者输送机的目标位置 /// public string _arrowLocation; /// /// 起始货位编码 /// public string _cellcodeBegin; /// /// 终止货位编码 /// public string _cellcodeEnd; /// /// 多货叉序号:0,1,2,3,4,5.。。。。距离控制柜由近及远;单叉为0 /// public int _forkNo; /// /// 携带的关联任务货叉组,单叉或者不携带任务为""举例:1叉携带“2,3”,【规则:只能携带_forkNo值大于自己的货叉】 /// public string _correlTaskForks; public HandTask(int deviceIndex, int deviceOrder, int beginDeviceIndex, string arrowLocation, string cellcodeBegin, string cellcodeEnd, int forkNo, string correlTaskForks) { _begindeviceIndex = beginDeviceIndex; _deviceIndex = deviceIndex; _deviceOrder = deviceOrder; _arrowLocation = arrowLocation; _cellcodeBegin = cellcodeBegin; _cellcodeEnd = cellcodeEnd; _forkNo = forkNo; _correlTaskForks = correlTaskForks; } } /// /// 管理下达的自动任务 /// public struct AutoTask { /// /// 控制任务类型:1入库,2出库,3倒库 /// public int _controlType; /// /// 托盘或者周转箱条码 /// public string _palletBarcode; /// /// 起始位置 /// public string _startDevice; /// /// 起始货位 /// public string _startCell; /// /// 终止位置 /// public string _endDevice; /// /// 终止货位 /// public string _endCell; public bool _enableStartCell, _enableEndCell; public int _inWorkbench; public AutoTask(int controlType, string palletBarcode, string startDevice, string startCell, string endDevice, string endCell,bool enableStartCell,bool enableEndCell,int inWorkbench) { _controlType = controlType; _palletBarcode = palletBarcode; _startDevice = startDevice; _startCell = startCell; _endDevice = endDevice; _endCell = endCell; _enableStartCell = enableStartCell; _enableEndCell = enableEndCell; _inWorkbench = inWorkbench; } } /// /// 20130817richard /// public struct MonitorInfo { public bool Obtaintask; public bool Orderturnon; public Dictionary S7connectOnline; public Dictionary FloorError; public Dictionary TcpIPInitCount;//添加TCP设备连接状态 20170720 public Dictionary FINSTcpIPInitCount;//添加TCP设备连接状态 20210617 //public Dictionary FINSTCPIP.ClientCommunication.IfInit; public MonitorInfo(bool obtaintask, bool orderturnon, Dictionary s7connectOnline, Dictionary floorError, Dictionary tcpipInitCount) { Obtaintask = obtaintask; Orderturnon = orderturnon; S7connectOnline = s7connectOnline; FloorError = floorError; TcpIPInitCount = tcpipInitCount; FINSTcpIPInitCount = null; } } public struct Monitor_Task { public int _manfid; //必填 public int _mankind; //必填 public int _mindex; //必填 public string _level; //必填 public string _device; //必填 public string _command; //必填 public string _routeid; //必填 public string _status; //必填 public string _starttime; public string _param1; public string _param2; public string _param3; public string _param4; public string _param5; public string _param6; public string _txtparam; public string _aheaddetect; public string _useAwayFork; public string _runningLock; public string _aGVNextTask; public string _aheadTrigger; public string _priorMonitor; public string _agvNo; public string _agvTask; public string GetInsertMonitorSQL() { StringBuilder sql = new StringBuilder(); if (_manfid == 0) return null; if (_mankind == 0) return null; if (_mindex == 0) return null; sql.Append("INSERT INTO T_Monitor_Task (F_ManageTaskIndex,F_ManageTASKKINDINDEX, F_MonitorIndex, F_MonitorTaskLevel, F_DeviceIndex,F_DeviceCommandIndex,F_RouteID, F_Status") .Append(_param1 == null ? " " : ",F_NumParam1") .Append(_param2 == null ? " " : ",F_NumParam2") .Append(_param3 == null ? " " : ",F_NumParam3") .Append(_param4 == null ? " " : ",F_NumParam4") .Append(_param5 == null ? " " : ",F_NumParam5") .Append(_param6 == null ? " " : ",F_NumParam6") .Append(_txtparam == null ? " " : ",F_TxtParam") .Append(_aheaddetect == null ? " " : ",F_AheadDetect") .Append(_runningLock == null ? " " : ",F_RunningLock") .Append(_aheadTrigger == null ? " " : ",F_AheadTrigger") .Append(_useAwayFork == null ? " " : ",F_UseAwayFork") .Append(_starttime == null ? " " : ",F_StartTime") .Append(_priorMonitor == null ? " " : ",F_PriorMonitor") .Append(_aGVNextTask == null ? " " : ",F_AGVNextTask") .Append(_agvTask == null ? " " : ",F_AgvTask") .Append(_agvNo == null ? " " : ",F_AgvNo") .Append(") VALUES (") .Append("'" + _manfid + "'").Append(",'" + _mankind + "'").Append(",'" + _mindex + "'").Append(",'" + _level + "'").Append(",'" + _device + "'").Append(",'" + _command + "'").Append(",'" + _routeid + "'").Append(",'" + _status + "'") .Append(_param1 == null ? " " : ",'" + _param1 + "'") .Append(_param2 == null ? " " : ",'" + _param2 + "'") .Append(_param3 == null ? " " : ",'" + _param3 + "'") .Append(_param4 == null ? " " : ",'" + _param4 + "'") .Append(_param5 == null ? " " : ",'" + _param5 + "'") .Append(_param6 == null ? " " : ",'" + _param6 + "'") .Append(_txtparam == null ? " " : ",'" + _txtparam + "'") .Append(_aheaddetect == null ? " " : ",'" + _aheaddetect + "'") .Append(_runningLock == null ? " " : ",'" + _runningLock + "'") .Append(_aheadTrigger == null ? " " : ",'" + _aheadTrigger + "'") .Append(_useAwayFork == null ? " " : ",'" + _useAwayFork + "'") .Append(_starttime == null ? " " : ",'" + _starttime + "'") .Append(_priorMonitor == null ? " " : ",'" + _priorMonitor + "'") .Append(_aGVNextTask == null ? " " : ",'" + _aGVNextTask + "'") .Append(_agvTask == null ? " " : ",'" + _agvTask + "'") .Append(_agvNo == null ? " " : ",'" + _agvNo + "'") .Append(")"); return sql.ToString(); } } public struct Manage_Task { public int _fid; //必填 public int _mantaskkindid; //必填 public int _manid; //必填 public string _relativeid; // public string _palletcode; // public string _mantasktype; // public string _controltype; //必填 public string _tasklevel; //必填 public string _startdevice; public string _startcell; public string _enddevice; public string _endcell; public string _status; public string _begintime; public string _intostepok; public string _laneway; public string _stack; public string _remark; public string _cellmodel; public string _useawayfork; public string _controlbatch; public string _logicarea; public string _startcol; public string _startlayer; public string _endcol; public string _endlayer; public string _startucode; public string _enducode; public string _goodnum; public string _goodbarcode; public string _isclear; public string _ispackage; public string _itemcount; public string GetInsertManageSQL() { StringBuilder sql = new StringBuilder(); if (_fid == 0) return null; if (_mantaskkindid == 0) return null; //if (_manid == 0) return null; //"INSERT INTO T_Manage_Task (CONTROL_APPLY_TYPE,DEVICE_CODE, STOCK_BARCODE, APPLY_TASK_STATUS, CREATE_TIME,CONTROL_APPLY_REMARK,WAREHOUSE_CODE,CONTROL_APPLY_PARA01,CONTROL_APPLY_PARAMETER," + // "CONTROL_APPLY_PARA_PRODUCT_TYPE,CONTROL_APPLY_PARA_ERROR_DEVICE,CONTROL_APPLY_PARA_PALLET_COUNT,CONTROL_APPLY_PARA_NO_CONTROL" sql.Append("INSERT INTO T_Manage_Task (FID,F_ManageTaskKindIndex, FMANAGEID, F_RELATIVECONTORLID, FPALLETBARCODE,FMANAGETASKTYPE,FCONTROLTASKTYPE, FTASKLEVEL") //.Append(_startwa == null ? " " : ", FSTARTWAREHOUSE" ) .Append(_startcell == null ? " " : ", FSTARTCELL") .Append(_startdevice == null ? " " : ", FSTARTDEVICE") //.Append(_endwarhouse == null ? " " : ",FENDWAREHOUSE" ) .Append(_endcell == null ? " " : ", FENDCELL") .Append(_enddevice == null ? " " : ",FENDDEVICE") .Append(_status == null ? " " : ", FSTATUS") .Append(_begintime == null ? " " : ", FBEGTIME") //.Append(_endtime == null ? " " : ", FENDTIME") .Append(_intostepok == null ? " " : ",FIntoStepOK") .Append(_remark == null ? " " : ",FREMARK") .Append(_laneway == null ? " " : ",FLANEWAY") .Append(_stack == null ? " " : ",FSTACK") .Append(_useawayfork == null ? " " : ",FUseAwayFork") .Append(_controlbatch == null ? " " : ",FCONTORL_BATCH") .Append(_logicarea == null ? " " : ",FLOGIC_AREA") .Append(_startcol == null ? " " : ",FStartCol") .Append(_startlayer == null ? " " : ",FStartLayer") .Append(_endcol == null ? " " : ",FEndCol") .Append(_endlayer == null ? " " : ",FEndLayer") .Append(_startucode == null ? " " : ",FSTARTUCODE") .Append(_enducode == null ? " " : ",FENDUCODE") .Append(_cellmodel == null ? " ": ",CELL_MODEL") .Append(_goodnum == null ? " " : ",GOODS_NUM") .Append(_goodbarcode == null ? " " : ",GOODS_Barcode") .Append(",IS_CLEAR") .Append(",IS_Package") .Append(",ITEM_COUNT") .Append(") VALUES (") .Append("'" + _fid + "'").Append(",'" + _mantaskkindid + "'").Append(",'" + _manid + "'").Append(",'" + _relativeid + "'") .Append(",'" + _palletcode + "'").Append(",'" + _mantasktype + "'").Append(",'" + _controltype + "'").Append(",'" + _tasklevel + "'") //.Append(_startwa == null ? " " : ", '" + _startwa + "'") .Append(_startcell == null ? " " : ", '" + _startcell + "'") .Append(_startdevice == null ? " " : ", '" + _startdevice + "'") //.Append(_endwarhouse == null ? " " : ",'" + _endwarhouse + "'") .Append(_endcell == null ? " " : ", '" + _endcell + "'") .Append(_enddevice == null ? " " : ",'" + _enddevice + "'") .Append(_status == null ? " " : ", '" + _status + "'") .Append(_begintime == null ? " " : ",'" + _begintime + "'") //.Append(_endtime == null ? " " : ", FENDTIME") .Append(_intostepok == null ? " " : ",'" + _intostepok + "'") .Append(_remark == null ? " " : ",'" + _remark + "'") .Append(_laneway == null ? " " : ",'" + _laneway + "'") .Append(_stack == null ? " " : ",'" + _stack + "'") .Append(_useawayfork == null ? " " : ",'" + _useawayfork + "'") .Append(_controlbatch == null ? " " : ",'" + _controlbatch + "'") .Append(_logicarea == null ? " " : ",'" + _logicarea + "'") .Append(_startcol == null ? " " : ",'" + _startcol + "'") .Append(_startlayer == null ? " " : ",'" + _startlayer + "'") .Append(_endcol == null ? " " : ",'" + _endcol + "'") .Append(_endlayer == null ? " " : ",'" + _endlayer + "'") .Append(_startucode == null ? " " : ",'" + _startucode + "'") .Append(_enducode == null ? " " : ",'" + _enducode + "'") .Append(_cellmodel == null ? " " : ",'" + _cellmodel + "'") .Append(_goodnum == null ? " " : ",'" + _goodnum + "'") .Append(_goodbarcode == null ? " " : ",'" + _goodbarcode + "'") .Append(_isclear == null ? ",0" : ",'" + _isclear + "'") .Append(_ispackage == null ? ",0" : ",'" + _ispackage + "'") .Append(_itemcount == null ? ",0" : ",'" + _itemcount + "'") .Append(")"); return sql.ToString(); } } }