예제 #1
0
        public static void newRecord(string goods_id, int currentnode, int nextnode, int action)
        {
            object[] args = { goods_id, currentnode, nextnode, action, goods_id };
            string   sql  = string.Format("insert into record (cargo_id,time,currentnode,nextnode,action,send_id) values ('{0}',now(),{1},{2},{3},(select count(*) from record as b where cargo_id='{4}'))", args);

            DBO.execute(sql);
        }
예제 #2
0
        public void initSite()
        {
            DataSet ds = DBO.getNode();

            sendsite.DisplayMemberPath    = "name";
            sendsite.ItemsSource          = ds.Tables[0].AsDataView();
            receivesite.DisplayMemberPath = "name";
            receivesite.ItemsSource       = ds.Tables[0].AsDataView();
            sendsite.SelectedIndex        = 0;
            receivesite.SelectedIndex     = 1;
        }
예제 #3
0
        private List <String> getBillListByDate(int Location, int action, String date)
        {
            List <String> list    = new List <String>();
            DataSet       dataSet = DBO.getRecord(date, action, Location);

            foreach (DataRow row in dataSet.Tables["result"].Rows)
            {
                list.Add(row["cargo_id"].ToString());
            }
            return(list);
        }
예제 #4
0
        private List <String> getDateList(int Location, int action)
        {
            List <String> list    = new List <String>();
            DataSet       dataSet = DBO.getDate(Location, action);

            foreach (DataRow row in dataSet.Tables["result"].Rows)
            {
                list.Add(row["date"].ToString());
            }
            return(list);
        }
예제 #5
0
        private void label_settle_MouseUp(object sender, MouseButtonEventArgs e)
        {
            //label_settle.Background = new ImageBrush(new BitmapImage(
            //    new Uri("res\\button\\settle-hover.png", System.UriKind.Relative)));
            IntPtr      bitmap = global::Tracking.Properties.Resources.settle_hover.GetHbitmap();
            ImageSource source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
                bitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());

            label_settle.Background = new ImageBrush(source);

            //修改逻辑表项
            foreach (TreeModel t in arrivedCheckedList)
            {
                //写入数据库
                DBO.newRecord(t.Name, t.dst, t.dst, RES.SETTLED);
                //修改逻辑表,从勾选状态进入已结算状态
                //arrivedCheckedList.Remove(t);
                settledList.Add(t);
            }
            //修改UI表结构
            List <TreeModel> bills = new List <TreeModel>();

            foreach (ZsmTreeView[] trees in treeList)
            {
                ZsmTreeView tree = trees[2];
                for (int i = 1; i < tree.ItemsSourceData.Count(); i++)
                {
                    IList <TreeModel> childrenList = tree.ItemsSourceData.ElementAt <TreeModel>(i).Children;
                    foreach (TreeModel t in arrivedCheckedList)
                    {
                        if (childrenList.Contains(t))
                        {
                            childrenList.Remove(t);
                            tree.ItemsSourceData.ElementAt <TreeModel>(0).Children.Add(t);
                        }
                    }
                }
                tree.tvZsmTree.BeginInit();
                tree.tvZsmTree.EndInit();
            }
            //取消所有勾选
            //修改UI表项
            foreach (ZsmTreeView[] trees in treeList)
            {
                trees[2].menuUnSelectAll_Click(null, null);
            }
            arrivedCheckedList.RemoveRange(0, arrivedCheckedList.Count());
        }
예제 #6
0
        public logistics_info(string id)
        {
            InitializeComponent();

            try
            {
                goodsid.Text = id;
                DataSet   ds = DBO.getRecord(id);
                DataTable dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    string info = "";
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        DataRow dr = dt.Rows[i];
                        switch ((int)dr["action"])
                        {
                        case 0:
                            info += dr[0].ToString() + " 当前节点:" + (string)dr[1] + ", 包裹已入库\n";
                            break;

                        case 1:
                            info += dr[0].ToString() + " 包裹从" + (string)dr[1] + "发出,发往下一站: " + (string)dr[2] + "\n";
                            break;

                        case 2:
                            info += dr[0].ToString() + " 包裹已在" + (string)dr[1] + "签收\n";
                            break;

                        case 3:
                            info += dr[0].ToString() + "包裹已完成结算";
                            break;
                        }
                    }
                    info_textblock.Text = info;
                }
                else
                {
                    MessageBox.Show("暂时没有该包裹的记录,请核对物流编号", "系统提示");
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
        }
예제 #7
0
        private void showmsg()
        {
            try
            {
                DataSet   ds = DBO.getRecord(goodsid.Text);
                DataTable dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    string info = "";
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        DataRow dr = dt.Rows[i];
                        switch ((int)dr["action"])
                        {
                        case 0:
                            info += dr[0].ToString() + " 当前节点:" + (string)dr[1] + ", 您的包裹已入库\n";
                            break;

                        case 1:
                            info += dr[0].ToString() + " 您的包裹从" + (string)dr[1] + "发出,发往下一站: " + (string)dr[2] + "\n";
                            break;

                        case 2:
                            info += dr[0].ToString() + " 您的包裹已在" + (string)dr[1] + "签收\n";
                            break;

                        case 3:
                            info += dr[0].ToString() + "您的包裹已完成结算";
                            break;
                        }
                    }
                    info_textblock.Text = info;
                }
                else
                {
                    //info_textblock.Text = "暂时没有该包裹的记录,请核对物流编号";
                    MessageBox.Show("暂时没有该包裹的记录,请核对物流编号", "系统提示");
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
        }
예제 #8
0
        private void submit_MouseUp(object sender, MouseButtonEventArgs e)
        {
            submit.Background = new ImageBrush(new BitmapImage(new Uri("res\\button\\post-hover.png", System.UriKind.Relative)));
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("sendername", sendername.Text);
            dic.Add("senderaddr", senderaddr.Text);
            dic.Add("senderphone", senderphone.Text);
            dic.Add("receivername", receivername.Text);
            dic.Add("receiveraddr", receiveraddr.Text);
            dic.Add("receiverphone", receiverphone.Text);
            dic.Add("sendsite", sendsite.SelectedIndex);
            dic.Add("receivesite", receivesite.SelectedIndex);
            dic.Add("price", "100");
            dic.Add("type", type.SelectedIndex);
            string id = DBO.newGoods(dic);

            DBO.newRecord(id, (int)dic["sendsite"], (int)dic["receivesite"], 0);
            MessageBox.Show("请记住运单编号:" + id, "发货成功");
        }
예제 #9
0
        private void OnTimerEvent(Object source, ElapsedEventArgs e)
        {
            this.Enabled = false;


            if (runningList.Count() <= 0)
            {
                return;
            }
            foreach (Distance d in nodes)
            {
                d.calcMinDistance();
            }
            List <TreeModel> toRemove = new List <TreeModel>();

            foreach (TreeModel t in runningList)
            {
                if (t.trackRoute == null)
                {
                    t.trackRoute = nodes[t.src].getNextNode(t.dst);
                }
                t.trackRoute.distance -= 100;
                if (t.trackRoute.distance <= 0)
                {
                    this.Enabled = false;
                    //到达目的地
                    if (t.trackRoute.next == t.dst)
                    {
                        NextNode n = t.trackRoute;
                        //写入数据库
                        DBO.newRecord(t.Name, t.trackRoute.current, t.trackRoute.next, RES.SENDING);
                        DBO.newRecord(t.Name, t.trackRoute.next, t.trackRoute.next, RES.ARRIVED);
                        //修改UI表项
                        ZsmTreeView currentTree = treeList[n.current][1];
                        ZsmTreeView nextTree    = treeList[n.next][2];
                        foreach (TreeModel dateNode in currentTree.ItemsSourceData)
                        {
                            if (dateNode.Children.Contains(t))
                            {
                                dateNode.Children.Remove(t);
                                IList <TreeModel> nextSource = nextTree.ItemsSourceData;
                                int dateIndex = nextSource.Count();
                                while (dateIndex-- > 0)
                                {
                                    TreeModel date2 = nextSource.ElementAt <TreeModel>(dateIndex);
                                    if (dateNode.Name.Equals(date2.Name))
                                    {
                                        break;
                                    }
                                }
                                if (dateIndex == -1)
                                {
                                    TreeModel newDate = new TreeModel(dateNode.Name);
                                    newDate.type     = TreeModel.DATE;
                                    newDate.Children = new List <TreeModel>();
                                    newDate.Children.Add(t);
                                    nextSource.Add(newDate);
                                }
                                else
                                {
                                    nextSource.ElementAt <TreeModel>(dateIndex).Children.Add(t);
                                }
                            }
                        }
                        toRemove.Add(t);
                        if (t.IsChecked)
                        {
                            context.moveToArrivedCheckedList(t);
                        }
                    }
                    //到达下一站
                    else
                    {
                        NextNode n = nodes[t.trackRoute.next].getNextNode(t.dst);
                        //写入数据库
                        DBO.newRecord(t.Name, t.trackRoute.current, t.trackRoute.next, RES.SENDING);
                        //修改UI表项
                        ZsmTreeView currentTree = treeList[n.current][1];
                        ZsmTreeView nextTree    = treeList[n.next][1];
                        foreach (TreeModel dateNode in treeList[t.trackRoute.current][1].ItemsSourceData)
                        {
                            if (dateNode.Children.Contains(t))
                            {
                                dateNode.Children.Remove(t);
                                IList <TreeModel> nextSource = treeList[t.trackRoute.next][1].ItemsSourceData;
                                int dateIndex = nextSource.Count();
                                while (dateIndex-- > 0)
                                {
                                    TreeModel date2 = nextSource.ElementAt <TreeModel>(dateIndex);
                                    if (dateNode.Name.Equals(date2.Name))
                                    {
                                        break;
                                    }
                                }
                                if (dateIndex == -1)
                                {
                                    TreeModel newDate = new TreeModel(dateNode.Name);
                                    newDate.type     = TreeModel.DATE;
                                    newDate.Children = new List <TreeModel>();
                                    newDate.Children.Add(t);
                                    nextSource.Add(newDate);
                                }
                                else
                                {
                                    nextSource.ElementAt <TreeModel>(dateIndex).Children.Add(t);
                                }
                            }
                        }
                        //进入下一节点
                        t.trackRoute = n;
                    }
                }
            }
            foreach (TreeModel t in toRemove)
            {
                runningList.Remove(t);
            }
            this.Enabled = true;
            foreach (ZsmTreeView[] trees in treeList)
            {
                foreach (ZsmTreeView tree in trees)
                {
                    sync.Post(context.startUpdateUI, tree);
                    sync.Post(context.endUpdateUI, tree);
                }
            }
        }
예제 #10
0
        public static DataSet getRecord(string time, int action, int cuttentnode)
        {
            string sql = string.Format("select * from record as a where a.currentnode= {0} and a.action={1} and DATE_FORMAT(time,'%Y-%m-%d') like'{2}%' and not exists (select * from record as b where a.cargo_id = b.cargo_id and b.send_id>a.send_id)", cuttentnode, action, time);

            return(DBO.execute(sql));
        }
예제 #11
0
        public static DataSet getDate(int currentnode, int action)
        {
            string sql = string.Format("select distinct DATE_FORMAT(a.time,'%Y-%m-%d') as date from record as a where a.action = {1} and a.currentnode= {0} and not exists (select * from record as b where a.cargo_id = b.cargo_id and b.send_id>a.send_id)", currentnode, action);

            return(DBO.execute(sql));
        }
예제 #12
0
        public static DataSet getRecord(string goods_id)
        {
            string sql = string.Format("select time,a.name,b.name,action from record,node as a,node as b where cargo_id = '{0}' and currentnode= a.id and nextnode=b.id order by send_id ", goods_id);

            return(DBO.execute(sql));
        }