//手机修改价格 public int UpdatePriceWithMobile(List <TunnelInfoModel> lstTunnelInfo) { try { GenerateDal.BeginTransaction(); foreach (TunnelInfoModel tunnelInfo in lstTunnelInfo) { TunnelConfigModel tunnelConfig = new TunnelConfigModel(); tunnelConfig.MachineId = tunnelInfo.MachineId; tunnelConfig.CabinetId = tunnelInfo.CabinetId; tunnelConfig.TunnelId = tunnelInfo.TunnelId; tunnelConfig.CashPrices = tunnelInfo.Price; tunnelConfig.WpayPrices = tunnelInfo.Price; tunnelConfig.AlipayPrices = tunnelInfo.Price; tunnelConfig.IcPrices = tunnelInfo.Price; tunnelConfig.WaresId = tunnelInfo.WaresId; GenerateDal.Update(CommonSqlKey.UpdateTunnelPrice, tunnelConfig); } GenerateDal.CommitTransaction(); } catch (Exception e) { GenerateDal.RollBack(); return(0); } return(1); }
//机器端设置现金价格 public int PostCashPrice(List <PriceAndMaxStockModel> lstPriceAndStock, string machineId) { try { GenerateDal.BeginTransaction(); foreach (PriceAndMaxStockModel priceAndStock in lstPriceAndStock) { TunnelConfigModel tc = new TunnelConfigModel(); tc.MachineId = machineId; tc.TunnelId = priceAndStock.tid; tc.CashPrices = priceAndStock.p1; tc.IcPrices = priceAndStock.p1; tc.WpayPrices = priceAndStock.p1; tc.AlipayPrices = priceAndStock.p1; GenerateDal.Update(CommonSqlKey.UpdateCashPrice, tc); } PostToMachine(machineId, "p"); //操作日志 operationService.PostData(new OperationLogModel() { MachineId = machineId, OptContent = "机器端设置价格和库存" }); GenerateDal.CommitTransaction(); } catch (Exception e) { //GenerateDal.RollBack(); return(0); } return(1); }
public int UpdateData(TunnelConfigModel tunnelConfigInfo) { //操作日志 OperationLogService operationService = new OperationLogService(); operationService.PostData(new OperationLogModel() { MachineId = tunnelConfigInfo.MachineId, OptContent = "货道配置更新" }); return(GenerateDal.Update(CommonSqlKey.UpdateTunnelConfig, tunnelConfigInfo)); }
public ResultObj <List <TunnelConfigModel> > GetData(string machineId = "", string cabinetId = "") { // IProduct service = new ProductService(); //List<ProductModel> products = service.GetAllProducts(); TunnelConfigModel tunnelConfigInfo = new TunnelConfigModel(); tunnelConfigInfo.MachineId = machineId; tunnelConfigInfo.CabinetId = cabinetId; var tunnels = _IBase.GetAll(tunnelConfigInfo); return(Content(tunnels)); }
/// <summary> /// 删除用户 /// </summary> /// <returns></returns> public int DeleteData(string id) { TunnelConfigModel tunnelConfigInfo = new TunnelConfigModel(); tunnelConfigInfo.MachineId = id; //操作日志 OperationLogService operationService = new OperationLogService(); operationService.PostData(new OperationLogModel() { MachineId = id, OptContent = "货道配置删除" }); return(GenerateDal.Delete <TunnelConfigModel>(CommonSqlKey.DeleteTunnelConfig, tunnelConfigInfo)); }
private List <TunnelConfigModel> GenerateTunnelConfig(string cabinetId, string machineId) { List <TunnelConfigModel> lstTunnelConfig = new List <TunnelConfigModel>(); var conditions = new List <Condition>(); if (!string.IsNullOrEmpty(cabinetId)) { conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "CabinetId", DbColumnName = "cabinet_id", ParamValue = cabinetId, Operation = ConditionOperate.Equal, RightBrace = "", Logic = "" }); } List <CabinetConfigModel> lstCabinetConfig = GenerateDal.LoadByConditions <CabinetConfigModel>(CommonSqlKey.GetCabinetConfig, conditions); if (lstCabinetConfig == null || lstCabinetConfig.Count == 0) { return(null); } int layerNumber = lstCabinetConfig[0].LayerNumber; string cabinetDispaly = lstCabinetConfig[0].CabinetDisplay; string goodsNumber = lstCabinetConfig[0].LayerGoodsNumber; string[] arrGoodsNumber = goodsNumber.Split(','); for (int i = 1; i <= layerNumber; i++) { for (int j = 1; j <= Convert.ToInt32(arrGoodsNumber[i - 1]); j++) { TunnelConfigModel tunnelConfigModel = new TunnelConfigModel(); tunnelConfigModel.TunnelPosition = i + "-" + j; tunnelConfigModel.TunnelId = cabinetDispaly + (i < 10 ? "0" + i : i.ToString()) + (j < 10 ? "0" + j : j.ToString()); tunnelConfigModel.CabinetId = cabinetId; tunnelConfigModel.MachineId = machineId; lstTunnelConfig.Add(tunnelConfigModel); } } return(lstTunnelConfig); }
public List <TunnelConfigModel> GetAll(TunnelConfigModel tunnelConfigInfo) { int result = GetCount(tunnelConfigInfo); if (result > 0) { var conditions = new List <Condition>(); if (!string.IsNullOrEmpty(tunnelConfigInfo.MachineId)) { conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "MachineId", DbColumnName = "machine_id", ParamValue = tunnelConfigInfo.MachineId, Operation = ConditionOperate.Equal, RightBrace = "", Logic = "" }); } if (!string.IsNullOrEmpty(tunnelConfigInfo.CabinetId)) { conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "CabinetId", DbColumnName = "cabinet_id", ParamValue = tunnelConfigInfo.CabinetId, Operation = ConditionOperate.Equal, RightBrace = "", Logic = "" }); } return(GenerateDal.LoadByConditionsWithOrder <TunnelConfigModel>(CommonSqlKey.GetTunnelConfig, conditions, "tunnel_id", "asc")); } else { return(GenerateTunnelConfig(tunnelConfigInfo.CabinetId, tunnelConfigInfo.MachineId)); } }
public int GetCount(TunnelConfigModel tunnelConfigInfo) { var result = 0; var conditions = new List <Condition>(); if (!string.IsNullOrEmpty(tunnelConfigInfo.MachineId)) { conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "MachineId", DbColumnName = "machine_id", ParamValue = tunnelConfigInfo.MachineId, Operation = ConditionOperate.Equal, RightBrace = "", Logic = "" }); } if (!string.IsNullOrEmpty(tunnelConfigInfo.CabinetId)) { conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "CabinetId", DbColumnName = "cabinet_id", ParamValue = tunnelConfigInfo.CabinetId, Operation = ConditionOperate.Equal, RightBrace = "", Logic = "" }); } result = GenerateDal.CountByConditions(CommonSqlKey.GetTunnelConfigCount, conditions); return(result); }
//机器端设置最大库存 public int PostMaxPuts(List <PriceAndMaxStockModel> lstPriceAndStock, string machineId) { try { GenerateDal.BeginTransaction(); foreach (PriceAndMaxStockModel priceAndStock in lstPriceAndStock) { TunnelConfigModel tc = new TunnelConfigModel(); tc.MachineId = machineId; tc.TunnelId = priceAndStock.tid; tc.MaxPuts = priceAndStock.ms; GenerateDal.Update(CommonSqlKey.UpdateMaxPuts, tc); } GenerateDal.CommitTransaction(); } catch (Exception e) { //GenerateDal.RollBack(); return(0); } return(1); }
public ResultObj <int> PutData([FromBody] TunnelConfigModel tunnelConfigInfo) { return(Content(_IBase.UpdateData(tunnelConfigInfo))); }