/// <summary> /// 设置广告订单与门店关系 /// </summary> /// <param name="str">字符窜</param> /// <param name="customer_id">客户标识</param> /// <returns></returns> public bool SetAdvertiseOrderUnitInfoXML(string str, string customer_id) { bool bReturn = false; try { //反序列化 IList <AdvertiseOrderUnitInfo> advertiseOrderUnitInfoList = (IList <AdvertiseOrderUnitInfo>)cXMLService.Deserialize(str, typeof(List <cPos.Model.Advertise.AdvertiseOrderUnitInfo>)); foreach (AdvertiseOrderUnitInfo advertiseOrderadvertiseInfoInfo in advertiseOrderUnitInfoList) { advertiseOrderadvertiseInfoInfo.customer_id = customer_id; } //获取连接数据库信息 LoggingManager loggingManager = new cLoggingManager().GetLoggingManager(customer_id); bReturn = SetAdvertiseOrderUnitInfoList(loggingManager, advertiseOrderUnitInfoList, true); return(bReturn); } catch (Exception ex) { bReturn = false; throw (ex); } }
/// <summary> /// 更改上传标志 /// </summary> /// <param name="Customer_Id"></param> /// <param name="inoutInfo"></param> /// <returns></returns> public bool SetInoutIfFlagInfoWeb(string Customer_Id, InoutInfo inoutInfo) { LoggingManager loggingManager = new cLoggingManager().GetLoggingManager(Customer_Id); cSqlMapper.Instance(loggingManager).Update("Inout.UpdateUnDownloadIfFlag", inoutInfo); return(true); }
/// <summary> /// 设置应用系统 /// </summary> /// <param name="strXML"></param> /// <param name="Customer_Id"></param> /// <returns></returns> public bool SetAppSysInfo(string strXML, string Customer_Id) { bool bReturn = true; try { //反序列化 IList <AppSysModel> appSysInfoList = (IList <cPos.Model.AppSysModel>)cXMLService.Deserialize(strXML, typeof(List <cPos.Model.AppSysModel>)); //转成hash var args = new Hashtable { { "AppSysModels", appSysInfoList } }; //获取连接数据库信息 LoggingManager loggingManager = new cLoggingManager().GetLoggingManager(Customer_Id); //提交 cSqlMapper.Instance(loggingManager).Update("AppSys.InsertAppSys", args); } catch (Exception ex) { bReturn = false; throw (ex); } return(bReturn); }
/// <summary> /// 更新MonitorLog表打包标识方法 /// </summary> /// <param name="Customer_Id">客户标识</param> /// <param name="bat_id">批次标识</param> /// <param name="strError">错误信息返回</param> /// <returns></returns> public bool SetMonitorLogIfFlagInfoWeb(string Customer_Id, string bat_id, out string strError) { //获取连接数据库信息 LoggingManager loggingManager = new cLoggingManager().GetLoggingManager(Customer_Id); MonitorLogInfo monitorLogInfo = new MonitorLogInfo(); monitorLogInfo.bat_id = bat_id; cSqlMapper.Instance(loggingManager).Update("MonitorLog.UpdateUnDownloadIfFlag", monitorLogInfo); strError = "Success"; return(true); }
/// <summary> /// 获取未打包的监控日志数量 /// </summary> /// <param name="Customer_Id">客户标识</param> /// <param name="Unit_Id">组织标识</param> /// <returns></returns> public int GetMonitorLogNotPackagedCountWeb(string Customer_Id, string Unit_Id) { //获取连接数据库信息 LoggingManager loggingManager = new cLoggingManager().GetLoggingManager(Customer_Id); //获取参数 Hashtable _ht = new Hashtable(); _ht.Add("CustomerId", Customer_Id); _ht.Add("UnitId", Unit_Id); //连接数据库 return(cSqlMapper.Instance(loggingManager).QueryForObject <int>("MonitorLog.SelectUnDownloadCount", _ht)); }
/// <summary> /// 下载进出库单明细 /// </summary> /// <param name="Customer_Id">客户标识</param> /// <param name="Unit_Id">组织标识</param> /// <param name="inoutInfoList"></param> /// <returns></returns> public IList <InoutDetailInfo> GetInoutDetailListPackageWeb(string Customer_Id, string Unit_Id, List <InoutInfo> inoutInfoList) { try { LoggingManager loggingManager = new cLoggingManager().GetLoggingManager(Customer_Id); InoutInfo inoutInfo = new InoutInfo(); inoutInfo.InoutInfoList = inoutInfoList; return(cSqlMapper.Instance(loggingManager).QueryForList <InoutDetailInfo>("InoutDetail.SelectUnDownloadInoutDetail", inoutInfo)); } catch (Exception ex) { return(null); } }
/// <summary> /// 设置菜单信息 /// </summary> /// <param name="strXML">字符串</param> /// <param name="Customer_Id">客户标识1</param> /// <returns></returns> public bool SetMenuInfo(string strXML, string Customer_Id) { bool bReturn = true; try { //反序列化 IList <MenuModel> menuInfoList = (IList <cPos.Model.MenuModel>)cXMLService.Deserialize(strXML, typeof(List <cPos.Model.MenuModel>)); foreach (MenuModel menuInfo in menuInfoList) { menuInfo.customer_id = Customer_Id; } //转成hash var args = new Hashtable { { "MenuModels", menuInfoList } }; //获取连接数据库信息 LoggingManager loggingManager = new cLoggingManager().GetLoggingManager(Customer_Id); //提交 ISqlMapper sqlmap = cSqlMapper.Instance(loggingManager); try { sqlmap.BeginTransaction(); //同步菜单 sqlmap.Update("Menu.InsertMenu", args); //同步管理平台下的系统管理员的菜单 sqlmap.Update("RoleMenu.UpdateAdminRoleMenu", Customer_Id); sqlmap.CommitTransaction(); } catch (Exception ex) { sqlmap.RollBackTransaction(); throw ex; } } catch (Exception ex) { bReturn = false; throw (ex); } return(bReturn); }
/// <summary> /// 打包 /// </summary> /// <param name="Customer_Id">客户标识</param> /// <param name="Unit_Id">组织标识</param> /// <param name="maxRowCount">最大行数</param> /// <param name="startRowIndex">开始行号</param> /// <param name="bat_id">批次号</param> /// <returns></returns> public IList <MonitorLogInfo> GetMonitorLogListPackagedWeb(string Customer_Id, string Unit_Id, int maxRowCount, int startRowIndex, string bat_id) { //获取连接数据库信息 LoggingManager loggingManager = new cLoggingManager().GetLoggingManager(Customer_Id); //获取要传输的监控信息集合 Hashtable _ht = new Hashtable(); _ht.Add("StartRow", startRowIndex); _ht.Add("EndRow", startRowIndex + maxRowCount); _ht.Add("CustomerId", Customer_Id); _ht.Add("UnitId", Unit_Id); IList <MonitorLogInfo> MonitorlogInfoList = new List <MonitorLogInfo>(); MonitorlogInfoList = cSqlMapper.Instance(loggingManager).QueryForList <MonitorLogInfo>("MonitorLog.SelectUnDownload", _ht); //修改获取的监控信息批次号 MonitorLogInfo monitorlogInfo = new MonitorLogInfo(); monitorlogInfo.bat_id = bat_id; monitorlogInfo.monitorLogInfoList = MonitorlogInfoList; cSqlMapper.Instance(loggingManager).Update("MonitorLog.UpdateUnDownloadBatId", monitorlogInfo); return(MonitorlogInfoList); }
public bool SetMenuInfo(string strXML, string Customer_Id, bool IsTran) { bool bReturn = true; try { if (strXML.Equals("")) { throw new Exception("菜单字符窜为空失败"); } if (Customer_Id.Equals("")) { throw new Exception("客户标识为空为空失败"); } IList <MenuModel> menuInfoList = new List <MenuModel>(); //反序列化 try { menuInfoList = (IList <cPos.Model.MenuModel>)cXMLService.Deserialize(strXML, typeof(List <cPos.Model.MenuModel>)); } catch (Exception ex1) { throw (ex1); } foreach (MenuModel menuInfo in menuInfoList) { menuInfo.customer_id = Customer_Id; } //转成hash var args = new Hashtable { { "MenuModels", menuInfoList } }; //获取连接数据库信息 LoggingManager loggingManager = new cLoggingManager().GetLoggingManager(Customer_Id); //提交 if (IsTran) { cSqlMapper.Instance(loggingManager).BeginTransaction(); } try { if (IsTran) { cSqlMapper.Instance(loggingManager).BeginTransaction(); } //同步菜单 cSqlMapper.Instance(loggingManager).Update("Menu.InsertMenu", args); //同步管理平台下的系统管理员的菜单 cSqlMapper.Instance(loggingManager).Update("RoleMenu.UpdateAdminRoleMenu", Customer_Id); if (IsTran) { cSqlMapper.Instance(loggingManager).CommitTransaction(); } return(bReturn); } catch (Exception ex) { if (IsTran) { cSqlMapper.Instance(loggingManager).RollBackTransaction(); } throw ex; } } catch (Exception ex) { throw (ex); } }
public string GetPosNo(string customerID, string unitID, string posSN, bool IsTran) { this.Log(LogLevel.DEBUG, "", "", "GetPosNo", "cid", customerID); this.Log(LogLevel.DEBUG, "", "", "GetPosNo", "uid", unitID); this.Log(LogLevel.DEBUG, "", "", "GetPosNo", "pid", posSN); if (string.IsNullOrEmpty(customerID)) { throw new ArgumentNullException("customerID"); } if (string.IsNullOrEmpty(unitID)) { throw new ArgumentNullException("unitID"); } if (string.IsNullOrEmpty(posSN)) { throw new ArgumentNullException("posSN"); } string pos_no = ""; bool is_new_pos = false; PosInfo pos = null; //从POS的序列号中取第一位作为POS的类型 string pos_type = posSN.Substring(0, 1); LoggingManager loggingManager = new cLoggingManager().GetLoggingManager(customerID); this.Log(LogLevel.DEBUG, "", "", "GetPosNo", "cs", loggingManager.Connection_String); IBatisNet.DataMapper.ISqlMapper sqlMpper = cSqlMapper.Instance(loggingManager); try { if (IsTran) { sqlMpper.BeginTransaction(); } //根据终端序列号,在终端表中查找有没有被登记过 pos = sqlMpper.QueryForObject <PosInfo>("Pos.Pos.SelectPosBySN", posSN); //如果没有被登记过,则插入终端信息 if (pos == null) { is_new_pos = true; pos = new PosInfo(); pos.ID = this.NewGuid(); pos.Type = pos_type; pos.SN = posSN; sqlMpper.Insert("Pos.Pos.InsertPosFromCT", pos); //重新查询出 //pos = sqlMpper.QueryForObject<PosInfo>("Pos.Pos.SelectPosBySN", posSN); } PosUnitInfo pos_unit = new PosUnitInfo(pos); pos_unit.ID = this.NewGuid(); pos_unit.Unit.Id = unitID; pos_unit.Pos = pos; //如果不存在终端与门店的关系,则插入,并产生编号 sqlMpper.Insert("Pos.PosUnit.Insert", pos_unit); //取终端编号 pos_no = sqlMpper.QueryForObject <string>("Pos.PosUnit.GetPosNoByUnitIDAndPosID", pos_unit); if (IsTran) { sqlMpper.CommitTransaction(); } } catch (Exception ex) { if (IsTran) { sqlMpper.RollBackTransaction(); } throw ex; } //如果是新的终端,则传入管理平台 //if (is_new_pos) //{ // //提交至管理平台 // this.Log(LogLevel.DEBUG, "bs", "service", "GetPosNo", "is_new_pos", "true"); // this.synPosToAP(customerID, 1, pos); //} return(pos_no); }
/// <summary> /// 设置业务平台客户开户初始化 /// </summary> /// <param name="strCustomerInfo">客户信息字符窜</param> /// <param name="strUnitInfo">门店信息字符窜</param> /// <param name="typeId">处理类型typeId=1(总部与门店一起处理);typeId=2(只处理总部,不处理门店);typeId=3(只处理门店,不处理总部)</param> /// <returns></returns> public bool SetBSInitialInfo(string strCustomerInfo, string strUnitInfo, string strMenu, string typeId) { CustomerInfo customerInfo = new CustomerInfo(); #region 获取客户信息 if (!strCustomerInfo.Equals("")) { customerInfo = (cPos.Model.CustomerInfo)cXMLService.Deserialize(strCustomerInfo, typeof(cPos.Model.CustomerInfo)); if (customerInfo == null || customerInfo.ID.Equals("")) { throw new Exception("客户不存在或者没有获取合法客户信息"); } } else { throw new Exception("客户信息不存在."); } #endregion //获取连接数据库信息 LoggingManager loggingManager = new cLoggingManager().GetLoggingManager(customerInfo.ID); #region 判断客户是否已经建立总部 UnitInfo unitHeadInfo = new UnitService().GetUnitTopByCustomerId(loggingManager, customerInfo.ID); if (unitHeadInfo == null || unitHeadInfo.Id.Equals("")) { typeId = "1"; } else { typeId = "3"; } #endregion UnitInfo unitShopInfo = new UnitInfo();//门店 if (!strUnitInfo.Equals("")) { unitShopInfo = (cPos.Model.UnitInfo)cXMLService.Deserialize(strUnitInfo, typeof(cPos.Model.UnitInfo)); } else { throw new Exception("门店信息不存在."); } #region 门店是否存在 UnitInfo unitStoreInfo2 = new UnitInfo(); try { unitStoreInfo2 = new UnitService().GetUnitById(loggingManager, unitShopInfo.Id); } catch (Exception ex) { throw new Exception("用户插入管理平台失败:" + ex.ToString()); } if (unitStoreInfo2 != null && string.IsNullOrEmpty(unitStoreInfo2.Id)) { throw new Exception("门店信息已经存在."); } #endregion cSqlMapper.Instance(loggingManager).BeginTransaction(); //try //{ bool bReturn = false; #region 处理用户信息 cPos.Model.User.UserInfo userInfo = new Model.User.UserInfo(); if (typeId.Equals("1")) { userInfo.User_Id = NewGuid(); //用户标识 userInfo.customer_id = customerInfo.ID; //客户标识 userInfo.User_Code = "admin"; userInfo.User_Name = "管理员"; userInfo.User_Gender = "1"; userInfo.User_Password = "******"; userInfo.User_Status = "1"; userInfo.User_Status_Desc = "正常"; bReturn = new cUserService().SetUserTableInfo(loggingManager, userInfo); if (!bReturn) { throw new Exception("保存用户失败"); } } else { userInfo = new cUserService().GetUserDefaultByCustomerId(loggingManager, customerInfo.ID); } #endregion #region 处理新建客户总部 cPos.Model.UnitInfo unitInfo = new Model.UnitInfo(); if (typeId.Equals("1") || typeId.Equals("2")) { unitInfo.Id = NewGuid(); unitInfo.TypeId = "2F35F85CF7FF4DF087188A7FB05DED1D"; unitInfo.Code = customerInfo.Code + "总部"; unitInfo.Name = customerInfo.Name + "总部"; unitInfo.CityId = customerInfo.city_id; unitInfo.Status = "1"; unitInfo.Status_Desc = "正常"; unitInfo.CustomerLevel = 1; unitInfo.customer_id = customerInfo.ID; unitInfo.Parent_Unit_Id = "-99"; bReturn = new UnitService().SetUnitTableInfo(loggingManager, unitInfo, userInfo); if (!bReturn) { throw new Exception("新建客户总部失败"); } } else { unitInfo = new UnitService().GetUnitTopByCustomerId(loggingManager, customerInfo.ID); } #endregion #region 处理门店 cPos.Model.UnitInfo storeInfo = new UnitInfo(); storeInfo.Id = unitShopInfo.Id; storeInfo.TypeId = "EB58F1B053694283B2B7610C9AAD2742"; storeInfo.Code = customerInfo.Code; storeInfo.Name = customerInfo.Name; storeInfo.CityId = customerInfo.city_id; storeInfo.Status = "1"; storeInfo.Status_Desc = "正常"; storeInfo.CustomerLevel = 1; storeInfo.customer_id = customerInfo.ID; storeInfo.Parent_Unit_Id = unitInfo.Id; bReturn = new UnitService().SetUnitTableInfo(loggingManager, storeInfo, userInfo); if (!bReturn) { throw new Exception("新建门店失败"); } #endregion #region 新建角色 cPos.Model.RoleModel roleInfo = new RoleModel(); if (typeId.Equals("1")) { roleInfo.Role_Id = NewGuid(); roleInfo.Def_App_Id = "D8C5FF6041AA4EA19D83F924DBF56F93"; roleInfo.Role_Code = "Admin"; roleInfo.Role_Name = "管理员"; roleInfo.Role_Eng_Name = "administrator"; roleInfo.Is_Sys = 1; roleInfo.Status = 1; roleInfo.customer_id = customerInfo.ID; roleInfo.Create_User_Id = userInfo.User_Id; roleInfo.Create_Time = GetCurrentDateTime(); bReturn = new RoleService().SetRoleInfo(loggingManager, roleInfo); if (!bReturn) { throw new Exception("新建角色失败"); } } else { roleInfo = new RoleService().GetRoleDefaultByCustomerId(loggingManager, customerInfo.ID); } #endregion #region 插入用户与角色与客户总部关系 IList <cPos.Model.User.UserRoleInfo> userRoleInfoList = new List <cPos.Model.User.UserRoleInfo>(); if (typeId.Equals("1") || typeId.Equals("2")) { cPos.Model.User.UserRoleInfo userRoleInfo = new Model.User.UserRoleInfo(); userRoleInfo.Id = NewGuid(); userRoleInfo.UserId = userInfo.User_Id; userRoleInfo.RoleId = roleInfo.Role_Id; userRoleInfo.UnitId = unitInfo.Id; userRoleInfo.Status = "1"; userRoleInfo.DefaultFlag = 1; userRoleInfoList.Add(userRoleInfo); } cPos.Model.User.UserRoleInfo userRoleInfo1 = new Model.User.UserRoleInfo(); userRoleInfo1.Id = NewGuid(); userRoleInfo1.UserId = userInfo.User_Id; userRoleInfo1.RoleId = roleInfo.Role_Id; userRoleInfo1.UnitId = storeInfo.Id; userRoleInfo1.Status = "1"; userRoleInfo1.DefaultFlag = 1; userRoleInfoList.Add(userRoleInfo1); bReturn = new cUserService().SetUserRoleTableInfo(loggingManager, userRoleInfoList, userInfo); if (!bReturn) { throw new Exception("新建角色用户门店关系失败"); } #endregion #region 添加仓库以及仓库与门店关系 cPos.Model.Pos.WarehouseInfo warehouseInfo = new cPos.Model.Pos.WarehouseInfo(); warehouseInfo.ID = NewGuid(); warehouseInfo.Code = storeInfo.Code + "_wh"; warehouseInfo.Name = storeInfo.Name + "仓库"; warehouseInfo.IsDefault = 1; warehouseInfo.Status = 1; warehouseInfo.CreateUserID = userInfo.User_Id; warehouseInfo.CreateTime = Convert.ToDateTime(GetCurrentDateTime()); warehouseInfo.CreateUserName = userInfo.User_Name; warehouseInfo.Unit = storeInfo; cPos.Service.PosService posService = new PosService(); bReturn = posService.InsertWarehouse(loggingManager, warehouseInfo, false); if (!bReturn) { throw new Exception("新建仓库失败"); } #endregion #region 设置菜单信息 if (typeId.Equals("1") || typeId.Equals("2")) { if (!strMenu.Equals("")) { bReturn = new cMenuService().SetMenuInfo(strMenu, customerInfo.ID, false); if (!bReturn) { throw new Exception("新建菜单失败"); } } } #endregion #region 角色与流程关系 if (typeId.Equals("1")) { Hashtable _ht = new Hashtable(); _ht.Add("RoleId", roleInfo.Role_Id); bReturn = new cBillService().SetBatBillActionRole(_ht, loggingManager); if (!bReturn) { throw new Exception("创建角色与流程关系失败"); } } #endregion #region 管理平台--插入客户下的用户信息 //if (typeId.Equals("1")) //{ // try // { // bReturn = new cUserService().SetManagerExchangeUserInfo(loggingManager, userInfo, 1); // if (!bReturn) { throw new Exception("用户插入管理平台失败"); } // } // catch (Exception ex) { // cSqlMapper.Instance(loggingManager).RollBackTransaction(); // throw new Exception("用户插入管理平台失败:" + ex.ToString()); // } //} #endregion #region 管理平台--插入客户下的门店信息 //bReturn = new UnitService().SetManagerExchangeUnitInfo(loggingManager, storeInfo, 1); //if (!bReturn) { throw new Exception("门店插入管理平台失败"); } #endregion #region 中间层--插入用户,客户关系 //if (typeId.Equals("1")) //{ // try // { // string strError = string.Empty; // userInfo.customer_id = customerInfo.ID; // bReturn = new cUserService().SetDexUserCertificate(customerInfo.Code, userInfo, out strError); // if (!bReturn) { throw new Exception(strError); } // } // catch (Exception ex) // { // cSqlMapper.Instance(loggingManager).RollBackTransaction(); // throw new Exception("插入中间层失败:" + ex.ToString()); // } //} #endregion cSqlMapper.Instance(loggingManager).CommitTransaction(); return(bReturn); }
/// <summary> /// 获取Inout信息集合 /// </summary> /// <param name="orderSearchInfo"></param> /// <returns></returns> public IList <InoutInfo> GetInoutListPackagedWeb(OrderSearchInfo orderSearchInfo) { LoggingManager loggingManager = new cLoggingManager().GetLoggingManager(orderSearchInfo.customer_id); return(cSqlMapper.Instance(loggingManager).QueryForList <InoutInfo>("Inout.SelectUnDownloadInout", orderSearchInfo)); }
/// <summary> /// 获取Inout的未下载数据集合 /// </summary> /// <param name="orderSearchInfo">参数对像</param> /// <returns></returns> public int GetInoutNotPackagedCountWeb(OrderSearchInfo orderSearchInfo) { LoggingManager loggingManager = new cLoggingManager().GetLoggingManager(orderSearchInfo.customer_id); return(cSqlMapper.Instance(loggingManager).QueryForObject <int>("Inout.SelectUnDownloadCount", orderSearchInfo)); }