| | |
| | | string S_ZONE_CLS_CODE = ""; |
| | | if (trayStatus == 0) |
| | | { |
| | | S_ZONE_CLS_CODE = "KGZ"; |
| | | S_ZONE_CLS_CODE = "KT"; |
| | | } |
| | | else if (trayStatus == 1) |
| | | { |
| | |
| | | .Where((a, b, c) => a.S_AREA_CODE.Trim() == item.S_AREA_CODE.Trim() && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y" && c.S_ZONE_CLS_CODE.Trim() == S_ZONE_CLS_CODE) |
| | | .OrderBy((a, b, c) => a.N_LAYER) |
| | | .First(); |
| | | if (location != null) |
| | | { |
| | | return location; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | .OrderBy((a, b, c) => a.N_LAYER) |
| | | .First(); |
| | | } |
| | | LogHelper.Info($"查询结束,立库终点货位:{location}","WMS"); |
| | | LogHelper.Info($"查询结束,立库终点货位:{JsonConvert.SerializeObject(location)}","WMS"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | |
| | | public static bool addAlarmRecord(string alarmType , string alarmLevel ,string alarmMsg ,string logSite = "WMS") { |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | bool result = true; |
| | | LogHelper.Info(alarmMsg, logSite); |
| | | AlarmRecord alarmRecord = new AlarmRecord() { |
| | | S_ALARM_CODE = GenerateAlarmNo(), |
| | | S_ALARM_TYPE = alarmType, |
| | | S_ALARM_LEVEL = alarmLevel, |
| | | S_ALARM_MSG = alarmMsg, |
| | | S_FILE_NAME = logSite, |
| | | }; |
| | | return db.Insertable<AlarmRecord>(alarmRecord).ExecuteCommand()>0; |
| | | var alarmRecord = db.Queryable<AlarmRecord>().Where(a => a.N_IS_READ == 0 && a.S_ALARM_MSG == alarmMsg).First(); |
| | | if (alarmRecord == null) |
| | | { |
| | | alarmRecord = new AlarmRecord() |
| | | { |
| | | S_ALARM_CODE = GenerateAlarmNo(), |
| | | S_ALARM_TYPE = alarmType, |
| | | S_ALARM_LEVEL = alarmLevel, |
| | | S_ALARM_MSG = alarmMsg, |
| | | S_FILE_NAME = logSite, |
| | | }; |
| | | result = db.Insertable<AlarmRecord>(alarmRecord).ExecuteCommand() > 0; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public static bool addRfidAnomalyRecord(string rfid ,int anomalyType ,string locCode ,string taskNo) |
| | |
| | | S_LOC_CODE = locCode, |
| | | S_TASK_NO = taskNo |
| | | }; |
| | | return db.Insertable<AlarmRecord>(anomalyRecord).ExecuteCommand() > 0; |
| | | return db.Insertable<RfidAnomalyRecord>(anomalyRecord).ExecuteCommand() > 0; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="areaCode">库区</param> |
| | | /// <param name="property">货位属性(1.直连 2.非直连)</param> |
| | | /// <param name="actType">动作类型(0.人工接驳位 1.入库接驳位 2.出库接驳位)</param> |
| | | /// <param name="type">动作类型(0.人工接驳位 1.入库接驳位 2.出库接驳位)</param> |
| | | /// <returns></returns> |
| | | public static Location GetTransfeRelevanceLoc(string areaCode ,int actType ,int property ) |
| | | public static Location GetTransfeRelevanceLoc(string areaCode ,int type ,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.N_PROPERTY == property && b.N_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_TYPE == type && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y") |
| | | .First(); |
| | | return loc; |
| | | } |
| | |
| | | /// 注:查询任务最少的接驳位 |
| | | /// </summary> |
| | | /// <param name="areaCode">库区</param> |
| | | /// <param name="property">货位属性 ( 0.人工 1.直连 2.非直连)</param> |
| | | /// <param name="actType">动作类型 (1.入库接驳位 2.出库接驳位)</param> |
| | | /// <param name="property">货位属性 ( 1.直连 2.非直连)</param> |
| | | /// <param name="type">动作类型 (1.入库接驳位 2.出库接驳位)</param> |
| | | /// <returns></returns> |
| | | public static Location GetMinTaskTransfeLoc(string areaCode ,int actType, int property) |
| | | public static Location GetMinTaskTransfeLoc(string areaCode ,int type, 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.N_ACT_TYPE == actType && b.N_PROPERTY == property && a.N_LOCK_STATE < 3 && a.C_ENABLE == "Y") |
| | | .Where((a, b, c) => b.S_RELE_AREA.Trim() == areaCode && b.N_TYPE == type && 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), |