| | |
| | | using HH.WCS.Mobox3.AnGang.models; |
| | | using HH.WCS.Mobox3.AnGang.config; |
| | | using Newtonsoft.Json; |
| | | using SqlSugar; |
| | | using System; |
| | |
| | | { |
| | | site = Location.S_AGV_SITE; |
| | | } |
| | | //if (Location.N_CURRENT_NUM == 1) |
| | | //{ |
| | | // site = Location.S_AGV_SITE2; |
| | | //} |
| | | //if (Location.N_CURRENT_NUM == 2) |
| | | //{ |
| | | // site = Location.S_AGV_SITE3; |
| | | //} |
| | | //if (Location.N_CURRENT_NUM == 3) |
| | | //{ |
| | | // site = Location.S_AGV_SITE4; |
| | | //} |
| | | //if (Location.N_CURRENT_NUM == 4) |
| | | //{ |
| | | // site = Location.S_AGV_SITE5; |
| | | //} |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | cntrs = lcrList.Select(a => a.S_CNTR_CODE).ToList(); |
| | | |
| | | |
| | | var log = JsonConvert.SerializeObject(cntrs); |
| | | var location = db.Queryable<TN_Location>().First(a => a.S_CODE == loc); |
| | | if (location != null) |
| | |
| | | location.S_LOCK_STATE = "无"; |
| | | location.N_LOCK_STATE = 0; |
| | | |
| | | var updateCgDetalList = db.Queryable<TN_CG_Detail>().Where(d => cntrs.Contains(d.S_CNTR_CODE)).ToList(); |
| | | if (updateCgDetalList.Count == 0) { |
| | | LogHelper.Info($"没有更新的物料列表"); |
| | | } |
| | | |
| | | using (var tran = db.Ado.UseTran()) |
| | | { |
| | | if (db.Deleteable<TN_Loc_Container>().Where(it => cntrs.Contains(it.S_CNTR_CODE) && it.S_LOC_CODE == loc).ExecuteCommand() > 0) |
| | | { |
| | | LogHelper.Info($"删除货位容器关系表成功,{log}"); |
| | | if (updateCgDetalList.Count > 0 && db.Updateable(updateCgDetalList).ExecuteCommand() <= 0) { |
| | | tran.RollbackTran(); |
| | | return "更新物料信息列表失败"; // ADD:补充针对PDA分拣 |
| | | } |
| | | else |
| | | |
| | | if (lcrList.Count > 0 && db.Deleteable<TN_Loc_Container>().Where(it => cntrs.Contains(it.S_CNTR_CODE) && it.S_LOC_CODE == loc).ExecuteCommand() <= 0) |
| | | { |
| | | tran.RollbackTran(); |
| | | |
| | |
| | | var bindLocCntList = new List<TN_Loc_Container>(); |
| | | foreach (var item in cntrs) |
| | | { |
| | | bindLocCntList.Add(new TN_Loc_Container() { S_LOC_CODE = loc, S_CNTR_CODE = item }); |
| | | // 补充逻辑:避免解绑导致的信息丢失 (N_LOCK_STATE与CG_Detail保持一致所以直接赋值就行;IMGURL货位移动了就删除,也很合理) |
| | | var cgDetail = db.Queryable<TN_CG_Detail>().Where(d => d.S_CNTR_CODE == item).First(); |
| | | if (cgDetail == null) { |
| | | bindLocCntList.Add(new TN_Loc_Container() { S_LOC_CODE = loc, S_CNTR_CODE = item, S_IMG_URL = "", N_LOCK_STATE = 0 }); |
| | | } |
| | | else { |
| | | bindLocCntList.Add(new TN_Loc_Container() { S_LOC_CODE = loc, S_CNTR_CODE = item, S_IMG_URL = cgDetail.S_EXT_ATTR5, N_LOCK_STATE = cgDetail.N_LOCK_STATE }); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | var log = JsonConvert.SerializeObject(bindLocCntList); |
| | | |
| | | var updateCgDetalList = db.Queryable<TN_CG_Detail>().Where(d => cntrs.Contains(d.S_CNTR_CODE)).ToList(); |
| | | if (updateCgDetalList.Count == 0) { |
| | | LogHelper.Info($"没有更新的物料列表"); |
| | | } |
| | | |
| | | using (var tran = db.Ado.UseTran()) |
| | | { |
| | | if (db.Insertable<TN_Loc_Container>(bindLocCntList).ExecuteCommand() > 0) |
| | | if (db.Insertable<TN_Loc_Container>(bindLocCntList).ExecuteCommand() > 0) |
| | | { |
| | | LogHelper.Info($"插入货位容器关系表成功,{log}"); |
| | | } |
| | | else |
| | | { |
| | | db.RollbackTran(); |
| | | tran.RollbackTran(); |
| | | LogHelper.Info($"插入货位容器关系表失败,{log}"); |
| | | return "货位绑定容器失败," + logs; |
| | | } |
| | | |
| | | if (updateCgDetalList.Count > 0 && db.Updateable(updateCgDetalList).ExecuteCommand() <= 0) { |
| | | tran.RollbackTran(); |
| | | return "更新物料信息列表失败"; |
| | | } |
| | | |
| | | |
| | | var location = db.Queryable<TN_Location>().First(a => a.S_CODE == loc); |
| | | if (location != null) |
| | |
| | | |
| | | if (db.Updateable(location).UpdateColumns(it => new { it.N_CURRENT_NUM, it.S_LOCK_STATE, it.N_LOCK_STATE }).ExecuteCommand() > 0) |
| | | { |
| | | db.CommitTran(); |
| | | tran.CommitTran(); |
| | | |
| | | LogHelper.Info($"更新货位表成功,{log}"); |
| | | } |
| | | else |
| | | { |
| | | db.RollbackTran(); |
| | | tran.RollbackTran(); |
| | | |
| | | LogHelper.Info($"更新货位表失败,{log}"); |
| | | |
| | |
| | | public class EmptyUnBindInfo |
| | | { |
| | | public string cntID { get; set; }//容器ID |
| | | } |
| | | |
| | | public class CancleTaskInfo |
| | | { |
| | | public string taskNO { get; set; }//任务号 |
| | | } |
| | | |
| | | public class PDAFullInAreaInfo |