//一键补货操作 public int GetFullfilGood(string machineId) { try { TunnelInfoModel tunnelInfo = new TunnelInfoModel(); tunnelInfo.MachineId = machineId; //int delResult = GenerateDal.Delete<TunnelInfoModel>(CommonSqlKey.DeleteTunnelStatusByMachine, tunnelInfo); var conditions = new List <Condition>(); conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "MachineId", DbColumnName = "machine_id", ParamValue = machineId, Operation = ConditionOperate.Equal, RightBrace = "", Logic = "" }); int resultStatusCount = GenerateDal.CountByConditions(CommonSqlKey.IsExistTunnelInfo, conditions); int resultConfigCount = GenerateDal.CountByConditions(CommonSqlKey.GetTunnelConfigCount, conditions); if (resultStatusCount == resultConfigCount) { GenerateDal.Execute <TunnelInfoModel>(CommonSqlKey.UpdateFullfilGoodsOneKey, tunnelInfo); } else { GenerateDal.Delete <TunnelInfoModel>(CommonSqlKey.DeleteTunnelStatusByMachine, tunnelInfo); GenerateDal.Execute <TunnelInfoModel>(CommonSqlKey.FullfilGoodsOneKey, tunnelInfo); } //往机器下行表里插入库存改变的数据 PostToMachine(machineId, "st"); //机器管理操作日志 operationService.PostData(new OperationLogModel() { MachineId = machineId, OptContent = "一键补货" }); /* * GenerateDal.BeginTransaction(); * TunnelInfoModel tunnelInfo = new TunnelInfoModel(); * tunnelInfo.MachineId = machineId; * GenerateDal.Delete<TunnelInfoModel>(CommonSqlKey.DeleteTunnelStatusByMachine, tunnelInfo); * GenerateDal.Execute<TunnelInfoModel>(CommonSqlKey.FullfilGoodsOneKey, tunnelInfo); * * GenerateDal.CommitTransaction(); */ } catch (Exception e) { //GenerateDal.RollBack(); return(0); } return(1); }
//支付后更新减库存 private void UpdateCurrStock(string machineId, string tunnelId, int saleNumber) { TunnelInfoModel tunnelInfo = new TunnelInfoModel(); tunnelInfo.MachineId = machineId; tunnelInfo.GoodsStuId = tunnelId; tunnelInfo.CurrStock = saleNumber; GenerateDal.Execute(CommonSqlKey.UpdateCurrStock, tunnelInfo); }
//补货单生成 public ResultObj <List <TunnelInfoModel> > GetFullfilAll(string machineId = "", string cabinetId = "", int pageIndex = 1, int pageSize = 10) { IFullfilBill ifullfilBill = new TunnelInfoService(); TunnelInfoModel tunnelConfigInfo = new TunnelInfoModel(); tunnelConfigInfo.MachineId = machineId; tunnelConfigInfo.CabinetId = cabinetId; tunnelConfigInfo.PageIndex = pageIndex; tunnelConfigInfo.PageSize = pageSize; var fullfilInfo = ifullfilBill.GetFullfilAll(tunnelConfigInfo); int totalcount = ifullfilBill.GetFullfilCount(tunnelConfigInfo); var pagination = new Pagination { PageSize = pageSize, PageIndex = pageIndex, StartIndex = 0, TotalRows = totalcount, TotalPage = 0 }; return(Content(fullfilInfo, pagination)); }
public ResultObj <List <TunnelInfoModel> > GetData(string machineId = "", string cabinetId = "", int pageIndex = 1, int pageSize = 10) { // IProduct service = new ProductService(); //List<ProductModel> products = service.GetAllProducts(); TunnelInfoModel tunnelConfigInfo = new TunnelInfoModel(); tunnelConfigInfo.MachineId = machineId; tunnelConfigInfo.CabinetId = cabinetId; tunnelConfigInfo.PageIndex = pageIndex; tunnelConfigInfo.PageSize = pageSize; var tunnels = _IBase.GetAll(tunnelConfigInfo); int totalcount = _IBase.GetCount(tunnelConfigInfo); var pagination = new Pagination { PageSize = pageSize, PageIndex = pageIndex, StartIndex = 0, TotalRows = totalcount, TotalPage = 0 }; return(Content(tunnels, pagination)); }
public ResultObj <int> PutData([FromBody] TunnelInfoModel tunnelConfigInfo) { return(Content(_IBase.UpdateData(tunnelConfigInfo))); }
//按货道更新 public int GetFullfilGoodByTunnel(KeyJsonModel keyJsonModel) { try { GenerateDal.BeginTransaction(); foreach (KeyTunnelModel keyTunnelInfo in keyJsonModel.t) { TunnelInfoModel tunnelInfo = new TunnelInfoModel(); tunnelInfo.MachineId = keyJsonModel.m; tunnelInfo.GoodsStuId = keyTunnelInfo.tid; if (!string.IsNullOrEmpty(keyTunnelInfo.n)) { tunnelInfo.CurrStock = Convert.ToInt32(keyTunnelInfo.n); } if (string.IsNullOrEmpty(keyTunnelInfo.s)) { tunnelInfo.CurrStatus = "1"; } else { tunnelInfo.CurrStatus = keyTunnelInfo.s; } tunnelInfo.UpdateDate = DateTime.Now; tunnelInfo.CabinetId = GetCabinetIdByMachine(keyJsonModel.m); /* * var conditions = new List<Condition>(); * * conditions.Add(new Condition * { * LeftBrace = " AND ", * ParamName = "MachineId", * DbColumnName = "machine_id", * ParamValue = tunnelInfo.MachineId, * Operation = ConditionOperate.Equal, * RightBrace = "", * Logic = "" * }); * * conditions.Add(new Condition * { * LeftBrace = " AND ", * ParamName = "GoodsStuId", * DbColumnName = "goods_stu_id", * ParamValue = tunnelInfo.GoodsStuId, * Operation = ConditionOperate.Equal, * RightBrace = "", * Logic = "" * }); * * conditions.Add(new Condition * { * LeftBrace = " AND ", * ParamName = "CabinetId", * DbColumnName = "cabinet_id", * ParamValue = tunnelInfo.CabinetId, * Operation = ConditionOperate.Equal, * RightBrace = "", * Logic = "" * }); * * int resultStatusCount = GenerateDal.CountByConditions(CommonSqlKey.IsExistTunnelInfo, conditions); * if (resultStatusCount > 0) * { * * } * else * { * GenerateDal.Create<TunnelInfoModel>(tunnelInfo); * } */ GenerateDal.Delete <TunnelInfoModel>(CommonSqlKey.DeleteTunnelStatusByMachineAndTunnel, tunnelInfo); GenerateDal.Create <TunnelInfoModel>(tunnelInfo); } //往机器下行表里插入库存改变的数据 PostToMachine(keyJsonModel.m, "st"); //操作日志 operationService.PostData(new OperationLogModel() { MachineId = keyJsonModel.m, OptContent = "按货道补货" }); GenerateDal.CommitTransaction(); } catch (Exception e) { GenerateDal.RollBack(); return(0); } return(1); }