public OperationResult <Channel> GetById(int siteId, int id) { Channel info = ChannelDao.GetById(siteId, id); var result = new OperationResult <Channel>(info, (info != null)); return(result); }
private void StockInRequest(string cigaretteCode) { using (PersistentManager pm = new PersistentManager()) { StockInBatchDao stockInBatchDao = new StockInBatchDao(); SupplyDao supplyDao = new SupplyDao(); ChannelDao channelDao = new ChannelDao(); DataTable stockInBatchTable = stockInBatchDao.FindStockInBatch(cigaretteCode); DataTable channelTable = channelDao.FindChannelForCigaretteCode(cigaretteCode); int stockRemainQuantity = Convert.ToInt32(channelTable.Rows[0]["REMAINQUANTITY"]); DataTable cigaretteTable = supplyDao.FindCigarette(cigaretteCode, stockRemainQuantity.ToString()); if (stockInBatchTable.Rows.Count == 0 && cigaretteTable.Rows.Count != 0) { DataRow row = cigaretteTable.Rows[0]; if (Convert.ToInt32(row["Quantity"]) >= Convert.ToInt32(Context.Attributes["StockInCapacityQuantity"])) { StockInRequest(row["CigaretteCode"].ToString(), Convert.ToInt32(Context.Attributes["StockInCapacityQuantity"]), 0); Logger.Info(row["CigaretteName"].ToString() + "生成入库任务成功"); } else if (Convert.ToInt32(row["Quantity"]) > 0) { StockInRequest(row["CigaretteCode"].ToString(), Convert.ToInt32(row["Quantity"]), 0); Logger.Info(row["CigaretteName"].ToString() + "生成入库任务成功"); } WriteToProcess("LEDProcess", "Refresh", null); } } }
public void Page_Load(object sender, EventArgs e) { channelId = Utils.ToInt(Request.QueryString["channelId"]); if (!IsPostBack && channelId > 0) { var channelInfo = ChannelDao.GetChannelInfo(SiteId, channelId); var departmentIdList = InteractManager.GetDepartmentIdList(channelInfo); var userNameArrayList = new ArrayList(); foreach (var departmentId in departmentIdList) { userNameArrayList.AddRange(AdministratorDao.GetUserNameArrayList(departmentId, true)); } string userA, userB; for (int i = 0; i < userNameArrayList.Count - 1; i++) { userA = userNameArrayList[i].ToString(); for (int j = userNameArrayList.Count - 1; j > i; j--) { userB = userNameArrayList[j].ToString(); if (userA == userB) { userNameArrayList.Remove(userNameArrayList[j]); j--; } } } DgContents.DataSource = userNameArrayList; DgContents.ItemDataBound += DgContents_ItemDataBound; DgContents.DataBind(); } }
internal OperationResult <List <Channel> > GetAllList(int siteId) { List <Channel> list = ChannelDao.GetAllList(siteId); var result = new OperationResult <List <Channel> >(list, (list != null)); return(result); }
internal OperationResult <List <Channel> > GetShowIndexChannels(int channelCount, int siteId) { List <Channel> list = ChannelDao.GetShowIndexChannels(channelCount, siteId); var result = new OperationResult <List <Channel> >(list, (list == null)); return(result); }
private void AddFirstBatch() { using (PersistentManager pm = new PersistentManager()) { SupplyDao supplyDao = new SupplyDao(); ChannelDao channelDao = new ChannelDao(); DataTable cigaretteTable = supplyDao.FindCigarette(); if (cigaretteTable.Rows.Count != 0) { foreach (DataRow row in cigaretteTable.Rows) { DataTable channelTable = channelDao.FindChannelForCigaretteCode(row["CigaretteCode"].ToString()); int stockRemainQuantity = Convert.ToInt32(channelTable.Rows[0]["REMAINQUANTITY"]); if (Convert.ToInt32(row["Quantity"]) + stockRemainQuantity >= Convert.ToInt32(Context.Attributes["StockInCapacityQuantity"])) { StockInRequest(row["CigaretteCode"].ToString(), Convert.ToInt32(Context.Attributes["StockInCapacityQuantity"]), stockRemainQuantity); } else if (Convert.ToInt32(row["Quantity"]) + stockRemainQuantity > 0) { StockInRequest(row["CigaretteCode"].ToString(), Convert.ToInt32(row["Quantity"]) + stockRemainQuantity, stockRemainQuantity); } } Logger.Info("生产第一批次入库任务成功"); WriteToProcess("LEDProcess", "Refresh", null); } } }
/// <summary> /// 分配缓存道,插入缓存到表。并返回缓存道ID。 /// </summary> /// <param name="TaskID"></param> /// <returns></returns> public string InsertChannel(string TaskID, string Bill_No) { using (PersistentManager pm = new PersistentManager()) { string strChannel_No = ""; TaskDao dao = new TaskDao(); DataTable dt = dao.TaskInfo(string.Format("TASK_ID='{0}'", TaskID)); string Line_No = dt.Rows[0]["TARGET_CODE"].ToString().Trim(); string BillNo = dt.Rows[0]["BILL_NO"].ToString(); ChannelDao Cdao = new ChannelDao(); dt = Cdao.ChannelInfo(Line_No); if (!Cdao.HasTaskInChannel(TaskID)) { switch (Line_No) { case "01": case "02": strChannel_No = Cdao.GetChannelNoByBillNo(BillNo); if (strChannel_No == "") { DataRow[] drs = dt.Select("QTY=0 AND QTY<CACHE_QTY", "ORDERNO"); if (drs.Length > 0) { strChannel_No = drs[0]["CHANNEL_NO"].ToString(); } } else { DataRow[] drs = dt.Select(string.Format("QTY<CACHE_QTY and CHANNEL_NO='{0}'", strChannel_No), "ORDERNO"); if (drs.Length == 0) { drs = dt.Select("QTY=0 AND QTY<CACHE_QTY", "ORDERNO"); if (drs.Length > 0) { strChannel_No = drs[0]["CHANNEL_NO"].ToString(); } } } break; case "03": if (int.Parse(dt.Rows[0]["CACHE_QTY"].ToString()) - int.Parse(dt.Rows[0]["QTY"].ToString()) > 15) { strChannel_No = dt.Rows[0]["CHANNEL_NO"].ToString(); } break; } if (strChannel_No != "") { Cdao.InsertChannel(TaskID, Bill_No, strChannel_No); } } return(strChannel_No); } }
public void Save(string channelID, string cigaretteCode, string cigaretteName, string status) { using (PersistentManager pm = new PersistentManager()) { ChannelDao channelDao = new ChannelDao(); channelDao.UpdateEntity(channelID, cigaretteCode, cigaretteName, status); } }
/// <summary> /// 更新出库 /// </summary> public void UpdateOutChannelTime(string TaskID) { using (PersistentManager pm = new PersistentManager()) { ChannelDao dao = new ChannelDao(); dao.UpdateOutChannelTime(TaskID); } }
public DataTable GetChannelUSED() { using (PersistentManager pm = new PersistentManager()) { ChannelDao channelDao = new ChannelDao(); return(channelDao.FindChannelUSED()); } }
internal DataTable GetEmptyChannelUSED(string lineCode, string channelCode, int channelGroup, string channelType) { using (PersistentManager pm = new PersistentManager()) { ChannelDao channelDao = new ChannelDao(); return(channelDao.FindEmptyChannel(lineCode, channelCode, channelGroup, channelType)); } }
internal DataTable GetChannelUSED(string lineCode, string channelCode) { using (PersistentManager pm = new PersistentManager()) { ChannelDao channelDao = new ChannelDao(); return(channelDao.FindChannelUSED(lineCode, channelCode)); } }
/// <summary> /// 获取分配的缓存道 /// </summary> /// <param name="TaskNO"></param> /// <param name="BillNo"></param> /// <returns></returns> public string GetChannelFromTask(string TaskNO, string BillNo) { using (PersistentManager pm = new PersistentManager()) { ChannelDao dao = new ChannelDao(); return(dao.GetChannelFromTask(TaskNO, BillNo)); } }
private void StockInRequest(string cigaretteCode, int quantity, int stockRemainQuantity) { using (PersistentManager pm = new PersistentManager()) { StockInBatchDao stockInBatchDao = new StockInBatchDao(); StockInDao stockInDao = new StockInDao(); ChannelDao channelDao = new ChannelDao(); stockInBatchDao.SetPersistentManager(pm); stockInDao.SetPersistentManager(pm); channelDao.SetPersistentManager(pm); pm.BeginTransaction(); try { DataTable cigaretteTable = channelDao.FindChannelForCigaretteCode(cigaretteCode); if (cigaretteTable.Rows.Count != 0) { DataRow row = cigaretteTable.Rows[0]; bool isStockIn = row["ISSTOCKIN"].ToString() == "1" ? true : false; int batchNo = stockInBatchDao.FindMaxBatchNo() + 1; stockInBatchDao.InsertBatch(batchNo, row["CHANNELCODE"].ToString(), cigaretteCode, row["CIGARETTENAME"].ToString(), quantity, isStockIn ? stockRemainQuantity : 0); int stockInID = stockInDao.FindMaxInID(); for (int i = 1; i <= quantity; i++) { stockInID = stockInID + 1; stockInDao.Insert(stockInID, batchNo, row["CHANNELCODE"].ToString(), cigaretteCode, row["CIGARETTENAME"].ToString(), row["BARCODE"].ToString(), (isStockIn && stockRemainQuantity-- > 0) ? "1" : "0"); } pm.Commit(); try { using (PersistentManager pmWES = new PersistentManager("WESConnection")) { StockInBatchDao stockInBatchDaoWES = new StockInBatchDao(); stockInBatchDaoWES.SetPersistentManager(pmWES); stockInBatchDaoWES.InsertBatch(batchNo, row["CHANNELCODE"].ToString(), cigaretteCode, row["CIGARETTENAME"].ToString(), quantity, isStockIn ? stockRemainQuantity : 0); } } catch (Exception e) { Logger.Error("上传入库计划失败,详情:" + e.Message); } } } catch (Exception ex) { pm.Rollback(); Logger.Error("生成入库计划失败,详情:" + ex.Message); } } }
/// <summary> /// 判断是否已经在缓存道中,true 存在 /// </summary> /// <param name="TaskID"></param> /// <returns></returns> public bool HasTaskInChannel(string TaskID) { using (PersistentManager pm = new PersistentManager()) { bool blnValue = false; ChannelDao dao = new ChannelDao(); blnValue = dao.HasTaskInChannel(TaskID); return(blnValue); } }
public void Page_Load(object sender, EventArgs e) { _channelId = Utils.ToInt(Request.QueryString["channelId"]); if (!IsPostBack && _channelId > 0) { var channelInfo = ChannelDao.GetChannelInfo(SiteId, _channelId); LtlDepartmentTree.Text = GetDepartmentTreeHtml(channelInfo); } }
public CustomerBusiness(MardisContext mardisContext) : base(mardisContext) { _customerDao = new CustomerDao(mardisContext); _sequenceBusiness = new SequenceBusiness(mardisContext); _channelDao = new ChannelDao(mardisContext); _typeBusinessDao = new TypeBusinessDao(mardisContext); _productCategoryDao = new ProductCategoryDao(mardisContext); _statusCustomerDao = new StatusCustomerDao(mardisContext); _typeCustomerDao = new TypeCustomerDao(mardisContext); }
public DataTable GetAll(int pageIndex, int pageSize, string filter) { DataTable table = null; using (PersistentManager pm = new PersistentManager()) { ChannelDao channelDao = new ChannelDao(); table = channelDao.FindAll((pageIndex - 1) * pageSize, pageSize, filter); } return(table); }
public int GetCount(string filter) { int count = 0; using (PersistentManager pm = new PersistentManager()) { ChannelDao channelDao = new ChannelDao(); count = channelDao.FindCount(filter); } return(count); }
/// <summary> /// 根据单号,获取最近入库的缓存道编号。 /// </summary> /// <param name="BillNo"></param> /// <returns></returns> public string GetChannelNoByBillNo(string BillNo) { using (PersistentManager pm = new PersistentManager()) { string strChannelNo = ""; ChannelDao dao = new ChannelDao(); strChannelNo = dao.GetChannelNoByBillNo(BillNo); return(strChannelNo); } }
public void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { channelId = Utils.ToInt(Request.QueryString["channelId"]); var channelInfo = ChannelDao.GetChannelInfo(SiteId, channelId); channelInfo.DepartmentIdCollection = Request.Form["DepartmentIDCollection"]; ChannelDao.Update(channelInfo); LayerUtils.Close(Page); } }
/// <summary> /// 手工补货优化 /// </summary> /// <param name="orderDate"></param> /// <param name="batchNo"></param> public void GenHandleSupplySchedule(string orderDate, int batchNo) { using (PersistentManager pm = new PersistentManager()) { HandleSupplyOptimize handleSupplyOptimize = new THOK.Optimize.HandleSupplyOptimize(); ScOrderDao scOrderDao = new ScOrderDao(); ChannelDao channelDao = new ChannelDao(); Dao.LineScheduleDao lineDao = new LineScheduleDao(); DataTable lineTable = lineDao.FindAllLine(orderDate, batchNo).Tables[0]; int currentCount = 0; int totalCount = lineTable.Rows.Count; foreach (DataRow lineRow in lineTable.Rows) { string lineCode = lineRow["LINECODE"].ToString(); DataTable handSupplyOrders = scOrderDao.FindHandleSupplyOrder(orderDate, batchNo, lineCode); DataTable multiBrandChannel = channelDao.FindMultiBrandChannel(lineCode); AddColumnForChannelTable(multiBrandChannel, multiBrandChannel.Rows.Count); //返回新的手工补货订单表 DataTable newSupplyOrders = handleSupplyOptimize.Optimize(handSupplyOrders, multiBrandChannel); //保存烟道空仓作业的SortNo channelDao.Update(multiBrandChannel, orderDate, batchNo); //删除sc_order原来的手工补货定单 scOrderDao.DeleteOldSupplyOrders(orderDate, batchNo, lineCode); //在sc_order中插入新的手工补货定单 scOrderDao.InsertNewSupplyOrders(newSupplyOrders); //在AS_SC_HANDLESUPPLY中插入新的手工补货定单 scOrderDao.InsertHandSupplyOrders(newSupplyOrders); if (OnSchedule != null) { OnSchedule(this, new ScheduleEventArgs(8, "正在优化" + lineRow["LINECODE"].ToString() + "分拣线手工补货定单订单", ++currentCount, totalCount)); } } } }
public static void Reset() { _dataApi = null; _administratorDao = null; _administratorsInRolesDao = null; _areaDao = null; _channelDao = null; _channelGroupDao = null; _configDao = null; _contentCheckDao = null; _contentDao = null; _contentGroupDao = null; _countDao = null; _databaseDao = null; _dbCacheDao = null; _departmentDao = null; _errorLogDao = null; _keywordDao = null; _logDao = null; _permissionsInRolesDao = null; _pluginConfigDao = null; _pluginDao = null; _recordDao = null; _relatedFieldDao = null; _relatedFieldItemDao = null; _roleDao = null; _siteDao = null; _siteLogDao = null; _sitePermissionsDao = null; _specialDao = null; _tableDao = null; _tableMatchDao = null; _tableMetadataDao = null; _tableStyleDao = null; _tableStyleItemDao = null; _tagDao = null; _templateDao = null; _templateLogDao = null; _templateMatchDao = null; _userDao = null; _userLogDao = null; }
public static void Reset() { _databaseApi = null; _accessTokenDao = null; _administratorDao = null; _administratorsInRolesDao = null; _channelDao = null; _channelGroupDao = null; _configDao = null; _contentCheckDao = null; _contentDao = null; _contentGroupDao = null; _databaseDao = null; _dbCacheDao = null; _errorLogDao = null; _keywordDao = null; _libraryGroupDao = null; _libraryImageDao = null; _libraryTextDao = null; _logDao = null; _permissionsInRolesDao = null; _pluginConfigDao = null; _pluginDao = null; _relatedFieldDao = null; _relatedFieldItemDao = null; _roleDao = null; _siteDao = null; _siteLogDao = null; _sitePermissionsDao = null; _specialDao = null; _tableStyleDao = null; _tableStyleItemDao = null; _tagDao = null; _templateDao = null; _templateLogDao = null; _templateMatchDao = null; _userDao = null; _userGroupDao = null; _userLogDao = null; _userMenuDao = null; }
/// <summary> /// 更新进入缓存道时间,及ORDER_NO /// </summary> /// <returns></returns> public int UpdateInChannelTime(string TaskID, string Bill_No, string ChannelNo) { using (PersistentManager pm = new PersistentManager()) { int strValue = 0; ChannelDao dao = new ChannelDao(); int count = dao.ProductCount(Bill_No); TaskDao tdao = new TaskDao(); int taskCount = tdao.TaskCount(Bill_No); if (count == 0) { strValue = 1; } if (count == taskCount - 1) { strValue = 2; } dao.UpdateInChannelTime(TaskID, Bill_No, ChannelNo); return(strValue); } }
public void BindGrid() { _nodeId = Utils.ToInt(DdlChannelId.SelectedValue); var departmentIdList = new List <int>(); if (_nodeId > 0) { var channelInfo = ChannelDao.GetChannelInfo(SiteId, _nodeId); departmentIdList = DepartmentDao.GetDepartmentIdListByFirstDepartmentIdList(InteractManager.GetDepartmentIdList(channelInfo)); } if (departmentIdList.Count == 0) { departmentIdList = DepartmentManager.GetDepartmentIdList(); } RptContents.DataSource = departmentIdList; RptContents.ItemDataBound += RptContents_ItemDataBound; RptContents.DataBind(); }
public void ExechangeChannelUSED(string lineCode, string sourceChannel, string targetChannel) { using (PersistentManager pm = new PersistentManager()) { ChannelDao channelDao = new ChannelDao(); SupplyDao supplyDao = new SupplyDao(); try { pm.BeginTransaction(); DataTable channelTableSource = channelDao.FindChannelUSED(lineCode, sourceChannel); DataTable channelTableTarget = channelDao.FindChannelUSED(lineCode, targetChannel); channelDao.UpdateChannelUSED(lineCode, targetChannel, channelTableSource.Rows[0]["CIGARETTECODE"].ToString(), channelTableSource.Rows[0]["CIGARETTENAME"].ToString(), Convert.ToInt32(channelTableSource.Rows[0]["QUANTITY"]), channelTableSource.Rows[0]["SORTNO"].ToString()); channelDao.UpdateChannelUSED(lineCode, sourceChannel, channelTableTarget.Rows[0]["CIGARETTECODE"].ToString(), channelTableTarget.Rows[0]["CIGARETTENAME"].ToString(), Convert.ToInt32(channelTableTarget.Rows[0]["QUANTITY"]), channelTableTarget.Rows[0]["SORTNO"].ToString()); supplyDao.UpdateChannelUSED(lineCode, sourceChannel, "0000", channelTableTarget.Rows[0]["GROUPNO"].ToString()); supplyDao.UpdateChannelUSED(lineCode, targetChannel, sourceChannel, channelTableSource.Rows[0]["GROUPNO"].ToString()); supplyDao.UpdateChannelUSED(lineCode, "0000", targetChannel, channelTableTarget.Rows[0]["GROUPNO"].ToString()); pm.Commit(); } catch { pm.Rollback(); } } }
public ChannelService(DbConnection myDbCon) { dao = new ChannelDao(myDbCon); }
public ChannelService() { dao = new ChannelDao(null); }
/// <summary> /// 下载数据 最后修改日期 2010-10-30 /// </summary> private void DownloadData() { try { using (PersistentManager pm = new PersistentManager()) { ChannelDao channelDao = new ChannelDao(); StockOutBatchDao stockOutBatchDao = new StockOutBatchDao(); StockInBatchDao stockInBatchDao = new StockInBatchDao(); StockOutDao stockOutDao = new StockOutDao(); StockInDao stockInDao = new StockInDao(); SupplyDao supplyDao = new SupplyDao(); if (supplyDao.FindCount() != stockOutDao.FindOutQuantity()) { if (DialogResult.Cancel == MessageBox.Show("还有未处理的数据,您确定要重新下载数据吗?", "询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)) { return; } } using (PersistentManager pmServer = new PersistentManager("ServerConnection")) { ServerDao serverDao = new ServerDao(); serverDao.SetPersistentManager(pmServer); //ORDER BY ORDERDATE,BATCHNO 查找第一批次(符合已优化,并已上传一号工程,未下载的批次) DataTable table = serverDao.FindBatch(); if (table.Rows.Count != 0) { using (PersistentManager pmWES = new PersistentManager("WESConnection")) { StockInBatchDao stockInBatchDaoWES = new StockInBatchDao(); stockInBatchDaoWES.SetPersistentManager(pmWES); stockInBatchDaoWES.Delete(); } string batchID = table.Rows[0]["BATCHID"].ToString(); string orderDate = table.Rows[0]["ORDERDATE"].ToString(); string batchNo = table.Rows[0]["BATCHNO"].ToString(); Context.ProcessDispatcher.WriteToProcess("monitorView", "ProgressState", new ProgressState("清空作业表", 5, 1)); channelDao.Delete(); stockOutBatchDao.Delete(); stockOutDao.Delete(); stockInBatchDao.Delete(); stockInDao.Delete(); supplyDao.Delete(); System.Threading.Thread.Sleep(100); Context.ProcessDispatcher.WriteToProcess("monitorView", "ProgressState", new ProgressState("下载补货烟道表", 5, 2)); table = serverDao.FindStockChannel(orderDate, batchNo); channelDao.InsertChannel(table); System.Threading.Thread.Sleep(100); Context.ProcessDispatcher.WriteToProcess("monitorView", "ProgressState", new ProgressState("下载补货混合烟道表", 5, 3)); table = serverDao.FindMixChannel(orderDate, batchNo); channelDao.InsertMixChannel(table); System.Threading.Thread.Sleep(100); Context.ProcessDispatcher.WriteToProcess("monitorView", "ProgressState", new ProgressState("下载分拣烟道表", 5, 4)); table = serverDao.FindChannelUSED(orderDate, batchNo); channelDao.InsertChannelUSED(table); System.Threading.Thread.Sleep(100); Context.ProcessDispatcher.WriteToProcess("monitorView", "ProgressState", new ProgressState("下载补货计划表", 5, 5)); table = serverDao.FindSupply(orderDate, batchNo); supplyDao.Insert(table); System.Threading.Thread.Sleep(100); serverDao.UpdateBatchStatus(batchID); Context.ProcessDispatcher.WriteToProcess("monitorView", "ProgressState", new ProgressState()); Logger.Info("数据下载完成"); //初始化PLC数据(叠垛线PLC,补货线PLC) Context.ProcessDispatcher.WriteToService("StockPLC_01", "RestartData", 3); Context.ProcessDispatcher.WriteToService("StockPLC_02", "RestartData", 1); //初始化入库扫码器 Context.ProcessDispatcher.WriteToProcess("ScanProcess", "Init", null); //初始化状态管理器 Context.ProcessDispatcher.WriteToProcess("LedStateProcess", "Init", null); Context.ProcessDispatcher.WriteToProcess("OrderDataStateProcess", "Init", null); Context.ProcessDispatcher.WriteToProcess("ScannerStateProcess", "Init", null); //生成入库请求任务数据 Context.ProcessDispatcher.WriteToProcess("StockInRequestProcess", "FirstBatch", null); //生成补货请求任务数据 //Context.ProcessDispatcher.WriteToProcess("SupplyFirstRequestProcess", "FirstBatch", null); } else { MessageBox.Show("没有补货计划数据!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } catch (Exception e) { Logger.Error("数据下载处理失败,原因:" + e.Message); } }