Beispiel #1
0
        public void NotifyStockOutSuccess(long sourceDeptId, long deptDeptId, long stockOutId)
        {
            GlobalMessage message = (GlobalMessage)GlobalUtility.GetObject("GlobalMessage");
            if(sourceDeptId!= CurrentDepartment.Get().DepartmentId)
            {
                return;
            }
            ClientUtility.Log(logger, deptDeptId + " phan hoi den " + sourceDeptId + " da nhap hang thanh cong.");
            try
            {
                DepartmentStockOutPK departmentStockOutPk = new DepartmentStockOutPK
                    {
                        DepartmentId = sourceDeptId,
                        StockOutId = stockOutId
                    };

                DepartmentStockOut deptStockOut = DepartmentStockOutLogic.FindById(departmentStockOutPk);
                if (deptStockOut != null && deptStockOut.OtherDepartmentId == deptDeptId)
                {
                    deptStockOut.ConfirmFlg = 0;
                    deptStockOut.UpdateDate = DateTime.Now;
                    DepartmentStockOutLogic.Update(deptStockOut);
                }

                message.PublishMessage(ChannelConstants.SUBSTOCK2DEPT_STOCKOUT, sourceDeptId + "đã xuất " + stockOutId+ " xuống " + deptDeptId + " thành công !");
                ClientUtility.Log(logger, " Xuat hang hoan tat.");
            }
            catch (Exception exp)
            {
                message.PublishError(ChannelConstants.SUBSTOCK2DEPT_STOCKOUT, sourceDeptId + "đã xuất " + stockOutId + " xuống " + deptDeptId + " thất bại !");
                ClientUtility.Log(logger, exp.Message);
            }
        }
        public void NotifyUpdateStockOutFlag(Department department, DepartmentStockIn stockIn, long stockOutId)
        {
            //ClientUtility.Log(logger, departmentId + " requesting stock-out information.");

            if(department.DepartmentId!= CurrentDepartment.Get().DepartmentId)
            {
                return;
            }
            ((MainForm)GlobalCache.Instance().MainForm).ServiceStatus.Text = " Đang nhận thông tin ...";
            DepartmentStockOutPK pk = new DepartmentStockOutPK
                                          {
                                             DepartmentId  = CurrentDepartment.Get().DepartmentId,
                                             StockOutId = stockOutId
                                          };

            DepartmentStockOut stockOut = DepartmentStockOutLogic.FindById(pk);
            if(stockOut == null)
            {
                ClientUtility.Log(logger, "Khong co phieu xuat hang: " + stockOutId.ToString() + " . Kiem tra lai ... ");
                return;
            }
            stockOut.ConfirmFlg = 0;
            DepartmentStockOutLogic.Update(stockOut);
            ((MainForm)GlobalCache.Instance().MainForm).ServiceStatus.Text = " Chờ lệnh ...";
            ClientUtility.Log(logger, "Cap nhat tra hang cho " + stockOutId.ToString());
        }