| | |
| | | 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(); |
| | | } |
| | | } |
| | | 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; |
| | | } |
| | | |
| | | |
| | | //public class AddTaskModel |
| | | //{ |