public bool SuppliesAdd(string location, string name, string model, string price, string quantity, string unit, string create_time, string status, string keeper, string remark) { List <string> sqlList = new List <string>(); string sql = @"insert into office_supplies_list (location, name, model, price, quantity, unit, create_time, status, keeper, remark) values('" + location + "','" + name + "','" + model + "','" + price + "','" + quantity + "','" + unit + "','" + create_time + "','" + status + "','" + keeper + "','" + remark + "')"; sqlList.Add(sql); string sql2 = @"insert into supplies_flow_doc(supplies_id, location, status, keeper, create_time) values(SCOPE_IDENTITY(),'" + location + "','" + status + "','" + keeper + "','" + create_time + "')"; sqlList.Add(sql2); return(mysqlconn.ExecuteSqlTran(sqlList) > 0 ? true : false); }
/// <summary> /// 商品入库 /// </summary> /// <param name="list"></param> /// <returns></returns> public bool StockIn(List <Mo_StockInOrderDetail> list) { List <string> listSql = new List <string>(); string StockOrder = @"insert into stock_in_order (order_no, stock_in_date, operator) values('" + list[0].orderNo + "', '" + list[0].stockInDate + "', '" + list[0].operators + "') "; listSql.Add(StockOrder); foreach (Mo_StockInOrderDetail detail in list) { string detailStr = @"insert into stock_in_order_detail(location_id, product_id, quantity, price, total_price, supplier_id, order_no) values ('" + detail.locationId + "','" + detail.productId + "','" + detail.quantity + "','" + detail.price + "','" + detail.totalPrice + "','" + detail.supplierId + "','" + detail.orderNo + "')"; listSql.Add(detailStr); string updateStockInfo = @"insert into stock(order_no, product_id, location_id, supplier_id, quantity, price, total_price) values('" + detail.orderNo + "','" + detail.productId + "','" + detail.locationId + "', '" + detail.supplierId + "','" + detail.quantity + "','" + detail.price + "','" + detail.totalPrice + "')"; listSql.Add(updateStockInfo); } return(mySqlconn.ExecuteSqlTran(listSql) > 0?true:false); }
public bool StockOut(List <Mo_StockOutOrderDetail> list) { List <string> sqlList = new List <string>(); string StockOutOrder = @"insert into stock_out_order (out_order_no, stock_out_date, operator) values('" + list [0].out_order_no + "', getdate(), '" + list[0].operators + "')"; sqlList.Add(StockOutOrder); foreach (Mo_StockOutOrderDetail detail in list) { decimal outStockTotalPrice = Convert.ToInt32(detail.out_quantity) * Convert.ToDecimal(detail.price); string StockOutOrderDetail = @"insert into stock_out_order_detail(product_id, quantity, price, total_price, out_order_no,supplier_id, project_no) values('" + detail.product_id + "','" + detail.out_quantity + "','" + detail.price + "','" + outStockTotalPrice + "','" + detail.out_order_no + "','" + detail.supplier_id + "','" + detail.project_no + "')"; sqlList.Add(StockOutOrderDetail); string UpdateStock = @"update stock set quantity = quantity - " + Convert.ToInt32(detail.out_quantity) + @",total_price=total_price - " + outStockTotalPrice + @" where order_no = '" + detail.order_no + "' and product_id = '" + detail.product_id + "' and location_id = '" + detail.location_id + "' and supplier_id='" + detail.supplier_id + "'"; sqlList.Add(UpdateStock); } return(sqlconn.ExecuteSqlTran(sqlList) > 0?true:false); }