static public bool InWarehouse(Inflow inflow, out string msg) { List <string> list = new List <string>(); list.Add(string.Format(" insert into Inflow (cagNum,storeID,date,userNum,quantity,price,batchNum,batchNum2,suppliers) values ('{0}',{1},'{2}','{3}',{4},{5},'{6}','{7}','{8}')", inflow.cagNum, inflow.storeID, inflow.date, inflow.userNum, inflow.quantity, inflow.price, inflow.batchNum, inflow.batchNum2, inflow.suppliers)); if (StockDAL.QueryByCagNum(inflow.cagNum, inflow.storeID, out msg) == null) { Stock stock = new Stock(inflow.cagNum, inflow.storeID, 0, 0); list.Add(string.Format("insert into Stock (cagNum,storeID,quantity,money) values ('{0}',{1},{2},{3})", stock.cagNum, stock.storeID, stock.quantity, stock.money)); } list.Add(string.Format("update Stock set cagNum = '{0}', storeID = {1}, quantity = quantity+{2}, money = money+{2}*{3} where id in (select id as stockId from Stock where cagNum = '{0}' and storeID = {1}) ", inflow.cagNum, inflow.storeID, inflow.quantity, inflow.price)); list.Add(string.Format("insert into Indetail (stockID,batchNum,date,quantity,price,batchNum2,suppliers,note) values ((select id as stockId from Stock where cagNum = '{0}' and storeID = {1}),'{2}','{3}',{4},{5},'{6}','{7}','{8}') ", inflow.cagNum, inflow.storeID, inflow.batchNum, inflow.date, inflow.quantity, inflow.price, inflow.batchNum2, inflow.suppliers, inflow.notes)); bool bol = SQL.ExecuteTransaction(list, out msg); if (bol) { msg = "入库成功"; } else { return(false); } return(true); }
public override int GetHashCode() { unchecked { var hash = 17; hash = hash * 23 + Date.GetHashCode(); hash = hash * 23 + Payee.GetHashCode(); hash = hash * 23 + Memo.GetHashCode(); hash = hash * 23 + Inflow.GetHashCode(); hash = hash * 23 + OutFlow.GetHashCode(); return(hash); } }
static public bool Add(Inflow inflow, out string msg) { string command = $"insert into Inflow (cagNum,storeID,date,userNum,quantity,price,batchNum,batchNum2,suppliers) values ('{inflow.cagNum}','{inflow.storeID}','{inflow.date}','{inflow.userNum}','{inflow.quantity}','{inflow.price}','{inflow.batchNum}','{inflow.batchNum2}','{inflow.suppliers}')"; try { msg = null; return(SQL.Excute(command)); } catch (SqlException ex) { if (ex.Number == 2627) { msg = "添加失败,批号重复"; return(false); } msg = ex.Message; return(false); } }
public NewInflowRecorded(Guid fromAccountId, Guid toAccountId, Inflow inflow) { FromAccountId = fromAccountId; ToAccountId = toAccountId; Inflow = inflow; }
void Awake() { instance = this; }