| | |
| | | return result; |
| | | } |
| | | |
| | | internal static ReturnResult bindCntr(bindModel model) |
| | | { |
| | | ReturnResult result = new ReturnResult() {ResultCode = -1 }; |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | |
| | | if (TaskProcess.BindLocCntr(model.S_LOC_CODE, model.S_CNTR_CODE, model.S_ITEM_CODE, model.S_BATCH_CODE)) |
| | | { |
| | | int num = model.S_CNTR_CODE.Split(',').Count(); |
| | | var locInfo = db.Queryable<Location>().Where(a => a.S_CODE == model.S_LOC_CODE).First(); |
| | | if(locInfo != null) |
| | | { |
| | | locInfo.N_CURRENT_NUM = locInfo.N_CURRENT_NUM + num > locInfo.N_CAPACITY ? locInfo.N_CAPACITY : locInfo.N_CURRENT_NUM + num; |
| | | db.Updateable(locInfo).UpdateColumns(a => new { a.N_CURRENT_NUM }).ExecuteCommand(); |
| | | result.ResultCode = 0; |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | internal static ReturnResult unBindCntr(unBindModel model) |
| | | { |
| | | ReturnResult result = new ReturnResult() { ResultCode = -1 }; |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | var locInfo = db.Queryable<Location>().Where(a => a.S_CODE == model.S_LOC_CODE).First(); |
| | | if(locInfo != null) |
| | | { |
| | | var cntrList = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE == model.S_LOC_CODE).ToList(); |
| | | if(cntrList.Count > 0) |
| | | { |
| | | for (int i = cntrList.Count - 1; i >= 0; i --) |
| | | { |
| | | string cntrCode = cntrList[i].S_CNTR_CODE; |
| | | db.Deleteable<CntrItemRel>().Where(a => a.S_CNTR_CODE == cntrCode).ExecuteCommand(); |
| | | db.Deleteable<LocCntrRel>().Where(a => a.S_CNTR_CODE == cntrCode).ExecuteCommand(); |
| | | db.Deleteable<Container>().Where(a => a.S_CODE == cntrCode).ExecuteCommand(); |
| | | } |
| | | } |
| | | locInfo.N_CURRENT_NUM = locInfo.N_CURRENT_NUM - 1; |
| | | if (locInfo.N_CURRENT_NUM < 0) locInfo.N_CURRENT_NUM = 0; |
| | | db.Updateable(locInfo).UpdateColumns(a => new { a.N_CURRENT_NUM }).ExecuteCommand(); |
| | | result.ResultCode = 0; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | internal static ReturnResult JBIn(JBInModel model) |
| | | { |
| | | ReturnResult result = new ReturnResult() { ResultCode = -1 }; |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | string cntrCode = Guid.NewGuid().ToString("N"); |
| | | string batch = ""; |
| | | if (model.S_ITEM_TYPE == "小包装盖") |
| | | { |
| | | //小包装盖默认一层 |
| | | batch = "小包装盖"; |
| | | } |
| | | if (model.S_ITEM_TYPE == "瓶坯") |
| | | { |
| | | //瓶坯默认两层 |
| | | cntrCode = cntrCode + ","+ Guid.NewGuid().ToString("N"); |
| | | } |
| | | if (model.S_ITEM_TYPE == "大包装盖") |
| | | { |
| | | //大包装盖默认三层 |
| | | cntrCode = cntrCode + "," + Guid.NewGuid().ToString("N") + "," + Guid.NewGuid().ToString("N"); |
| | | batch = "大包装盖"; |
| | | } |
| | | //创建作业 |
| | | var locInfo = db.Queryable<Location>().Where(a => a.S_CODE == model.S_LOC_CODE && a.S_LOCK_STATE == "无").First(); |
| | | if(locInfo != null) |
| | | { |
| | | LogHelper.Info($"JBIn:{model.S_LOC_CODE},{cntrCode},{"指定库区-" + model.S_END_AREA}"); |
| | | if (WMSHelper.CreateOpTask(model.S_LOC_CODE, "", "入库", "接驳位入库", cntrCode, "指定库区-" + model.S_END_AREA)) |
| | | { |
| | | TaskProcess.BindLocCntr(model.S_LOC_CODE, cntrCode, model.S_ITEM_CODE, batch); |
| | | result.ResultCode = 0; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.ResultMsg = $"该点位不存在或者有锁,货位编码:{model.S_LOC_CODE}"; |
| | | } |
| | | |
| | | |
| | | return result; |
| | | } |
| | | |
| | | internal static ReturnResult PtpTask(PtpTaskModel model, ReturnResult result) |
| | | { |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | var startLoc = db.Queryable<Location>().Where(a => a.S_CODE == model.S_START_LOC).First(); |
| | | if(startLoc != null && startLoc.S_LOCK_STATE == "无") |
| | | { |
| | | string cntrCode = ""; |
| | | var cntrInfo = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE == startLoc.S_CODE).First(); |
| | | if(cntrInfo != null) |
| | | { |
| | | cntrCode = cntrInfo.S_CNTR_CODE; |
| | | } |
| | | else |
| | | { |
| | | cntrCode = Guid.NewGuid().ToString("N"); |
| | | } |
| | | var endLoc = db.Queryable<Location>().Where(a => a.S_CODE == model.S_END_LOC).First(); |
| | | if (endLoc != null && endLoc.S_LOCK_STATE == "无") |
| | | { |
| | | WMSHelper.CreateOpTask(model.S_START_LOC, model.S_END_LOC, "入库", "点到点转运", cntrCode, ""); |
| | | } |
| | | else |
| | | { |
| | | result.ResultMsg = $"终点货位不存在或者有锁,货位编码:{model.S_END_LOC}"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.ResultMsg = $"起点货位不存在或者有锁,货位编码:{model.S_START_LOC}"; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | //public class AddTaskModel |
| | | //{ |