| | |
| | | return db.Insertable<AlarmRecord>(alarmRecord).ExecuteCommand()>0; |
| | | } |
| | | |
| | | public static bool addRfidAnomalyRecord(string rfid ,int anomalyType ,string locCode ,string taskNo) |
| | | { |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | RfidAnomalyRecord anomalyRecord = new RfidAnomalyRecord() |
| | | { |
| | | S_RFID = rfid, |
| | | N_ANOMALY_TYPE = anomalyType, |
| | | S_ANOMALY_TYPE = RfidAnomalyRecord.getAnomalyType(anomalyType), |
| | | S_LOC_CODE = locCode, |
| | | S_TASK_NO = taskNo |
| | | }; |
| | | return db.Insertable<AlarmRecord>(anomalyRecord).ExecuteCommand() > 0; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查询成型机线边 |
| | | /// </summary> |
| | |
| | | /// 1.查询异常区货位 |
| | | /// </summary> |
| | | /// <param name="areaCode">库区</param> |
| | | /// <param name="type">类型 1.立库接驳位 2.缓存位</param> |
| | | /// <param name="property">货位属性(1.直连 2.非直连 3.人工 4.固定站台)</param> |
| | | /// <param name="actType">动作类型(0.默认 1.入库 2.出库)</param> |
| | | /// <param name="property">货位属性(1.直连 2.非直连)</param> |
| | | /// <param name="actType">动作类型(0.人工接驳位 1.入库接驳位 2.出库接驳位)</param> |
| | | /// <returns></returns> |
| | | public static Location GetTransfeRelevanceLoc(string areaCode , string type ,string actType = "0" ,string property = "2" ) |
| | | public static Location GetTransfeRelevanceLoc(string areaCode ,int actType ,int property ) |
| | | { |
| | | Location loc = null; |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | loc = db.Queryable<Location>() |
| | | .LeftJoin<TransfeRelevance>((a,b)=> a.S_CODE == b.S_LOC_CODE) |
| | | .Where((a, b) => b.S_RELE_AREA.Trim() == areaCode && b.S_TYPE.Trim() == type && b.S_PROPERTY == property && b.S_ACT_TYPE == actType && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y") |
| | | .Where((a, b) => b.S_RELE_AREA.Trim() == areaCode && b.N_PROPERTY == property && b.N_ACT_TYPE == actType && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y") |
| | | .First(); |
| | | return loc; |
| | | } |
| | |
| | | /// 查询接驳位关联属性 |
| | | /// </summary> |
| | | /// <param name="locCode"></param> |
| | | /// <param name="property">货位属性 (1.直连 2.非直连、3.人工 、4.固定站台)</param> |
| | | /// <param name="isManual">货位属性 (0.非人工 1.人工)</param> |
| | | /// <returns></returns> |
| | | public static bool updateTransfeLocProperty(string locCode ,string property) |
| | | public static bool updateTransfeLocProperty(string locCode ,int isManual) |
| | | { |
| | | bool result = false; |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | result = db.Updateable<TransfeRelevance>().SetColumns(a => new TransfeRelevance() { S_PROPERTY = property } ).Where(a => a.S_LOC_CODE.Trim() == locCode).ExecuteCommand() > 0; |
| | | result = db.Updateable<TransfeRelevance>().SetColumns(a => new TransfeRelevance() { N_IS_MANUAL = isManual } ).Where(a => a.S_LOC_CODE.Trim() == locCode).ExecuteCommand() > 0; |
| | | return result; |
| | | } |
| | | |
| | |
| | | /// 注:查询任务最少的接驳位 |
| | | /// </summary> |
| | | /// <param name="areaCode">库区</param> |
| | | /// <param name="property">货位属性 (1.直连 2.非直连、3.人工 、4.固定站台)</param> |
| | | /// <param name="type">类型 1.立库接驳位 2.缓存位 3.机台下线位 4.异常库位</param> |
| | | /// <param name="actType">动作类型 1.入库 2.出库</param> |
| | | /// <param name="property">货位属性 ( 0.人工 1.直连 2.非直连)</param> |
| | | /// <param name="actType">动作类型 (1.入库接驳位 2.出库接驳位)</param> |
| | | /// <returns></returns> |
| | | public static Location GetMinTaskTransfeLoc(string areaCode , string type ,string actType, string property = "2") |
| | | public static Location GetMinTaskTransfeLoc(string areaCode ,int actType, int property) |
| | | { |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | var loc = db.Queryable<Location>() |
| | | .LeftJoin<TransfeRelevance>((a,b) => a.S_CODE == b.S_LOC_CODE) |
| | | .LeftJoin<WCSTask>((a,b,c) => a.S_CODE == c.S_END_LOC && c.N_B_STATE < 3) |
| | | .Where((a, b, c) => b.S_RELE_AREA.Trim() == areaCode && b.S_TYPE.Trim() == type && b.S_ACT_TYPE.Trim() == actType && b.S_PROPERTY.Trim() == property && a.N_LOCK_STATE < 3 && a.C_ENABLE == "Y") |
| | | .Where((a, b, c) => b.S_RELE_AREA.Trim() == areaCode && b.N_ACT_TYPE == actType && b.N_PROPERTY == property && a.N_LOCK_STATE < 3 && a.C_ENABLE == "Y") |
| | | .GroupBy((a, b, c) => a.S_CODE) |
| | | .Select((a, b, c) => new { |
| | | count = SqlFunc.AggregateCount(c.S_END_LOC), |