/// <summary> /// 函数说明:入库操作,返回影响的行数 /// </summary> /// /// <returns>int</returns> public static bool Storage(string itemCode, string vendorCode, string SN, string locationCode, string plineCode, float itemQTY) { LineSideStockEntity item = new LineSideStockEntity() { COMPANY_CODE = LoginInfo.UserInfo.COMPANY_CODE, LOCATION_CODE = locationCode, ITEM_CODE = itemCode, VENDOR_CODE = vendorCode, PLINE_CODE = plineCode, ITEM_QTY = itemQTY }; LineSideStockEntity temp = new LineSideStockEntity(); LineSideStockDal lsDal = new LineSideStockDal(); temp = lsDal.GetByItem(locationCode, plineCode, itemCode); if (temp == null) { lsDal.Insert(item); return(true); } else { temp.ITEM_QTY += item.ITEM_QTY; lsDal.Update(temp); return(true); } }
/// <summary> /// 函数说明:入库操作,返回影响的行数 /// </summary> /// /// <returns>int</returns> public static int Storage(LineSideStockEntity item) { int result; LineSideStockEntity temp = new LineSideStockEntity(); LineSideStockDal lsDal = new LineSideStockDal(); temp = lsDal.GetByItem(item.LOCATION_CODE, item.PLINE_CODE, item.ITEM_CODE); if (temp == null) { lsDal.Insert(item); result = 1; } else { temp.ITEM_QTY += item.ITEM_QTY; result = lsDal.Update(temp); } //插入收料流水 IssueReceivedEntity ent = new IssueReceivedEntity() { COMPANY_CODE = item.COMPANY_CODE, WORKSHOP_CODE = item.WORKSHOP_CODE, PLINE_CODE = item.PLINE_CODE, LOCATION_CODE = item.LOCATION_CODE, LINESIDE_STOCK_CODE = item.STORE_CODE, ITEM_CODE = item.ITEM_CODE, ITEM_NAME = item.ITEM_NAME, ITEM_QTY = item.ITEM_QTY, WORK_TIME = DateTime.Now, USER_ID = LoginInfo.UserInfo.USER_ID }; new IssueReceivedDal().Insert(ent); return(result); }
/// <summary> /// 函数说明:批量入库操作,返回影响的行数 /// </summary> /// /// <returns>int</returns> public static int Storage(List <LineSideStockEntity> itemList) { int result = 0; LineSideStockDal lsDal = new LineSideStockDal(); lsDal.DataBase.BeginTransaction(); foreach (LineSideStockEntity lsEntity in itemList) { LineSideStockEntity temp = new LineSideStockEntity(); temp = lsDal.GetByItem(lsEntity.LOCATION_CODE, lsEntity.PLINE_CODE, lsEntity.ITEM_CODE); if (temp == null) { lsDal.Insert(lsEntity); result += 1; } else { temp.ITEM_QTY += lsEntity.ITEM_QTY; result += lsDal.Update(temp); } } lsDal.DataBase.CompleteTransaction(); return(result); }