Ejemplo n.º 1
0
        public async Task should_handle_null_bindingkeys_array_when_removing_subscriptions()
        {
            using (SystemDateTime.PauseTime())
            {
                var subscriptionsForTypes = new[] { new SubscriptionsForType(MessageUtil.GetTypeId(typeof(int)), null) };
                await _peerDirectory.RegisterAsync(_bus, _self, new[] { Subscription.Any <FakeCommand>() });

                await _peerDirectory.UpdateSubscriptionsAsync(_bus, subscriptionsForTypes);

                _repositoryMock.Verify(repo => repo.RemoveDynamicSubscriptionsForTypes(_self.Id, SystemDateTime.UtcNow, new[] { MessageUtil.GetTypeId(typeof(int)) }));
            }
        }
Ejemplo n.º 2
0
        public void should_handle_normal_nested_messages()
        {
            var messageTypeId = MessageUtil.GetTypeId(typeof(NakedMessage));

            messageTypeId.FullName.ShouldEqual("Abc.Zebus.Tests.MessageUtilTests+NakedMessage");
        }
Ejemplo n.º 3
0
        private void ConditionQuery()
        {
            try
            {
                PagetableInit();
                TableShowInit();

                #region 查询条件
                string strCondition = "";
                if (cbbToolType.Text != "全部")
                {
                    strCondition = "ToolType='" + cbbToolType.Text + "' ";
                }
                if (cbbToolName.Text != "全部")
                {
                    if (!string.IsNullOrEmpty(strCondition))
                    {
                        strCondition += " and ";
                    }
                    string str = "ToolName='" + cbbToolName.Text + "' ";
                    strCondition += str;
                }
                if (cbbStatusBr.Text != "全部")
                {
                    string str = "";
                    if (cbbStatusBr.Text == "已归还")
                    {
                        str = "ReturnTime<>'' ";
                    }
                    else if (cbbStatusBr.Text == "未归还")
                    {
                        str = "ReturnTime='' ";
                    }
                    if (!string.IsNullOrEmpty(strCondition))
                    {
                        strCondition += " and ";
                    }
                    strCondition += str;
                }
                if (cbbPeopleBorrow.Text != "全部")
                {
                    if (!string.IsNullOrEmpty(strCondition))
                    {
                        strCondition += " and ";
                    }
                    string str = "PeopleBorrow='" + cbbPeopleBorrow.Text + "' ";
                    strCondition += str;
                }

                #endregion

                string strStart = dtpStart.Value.ToString("yyyy-MM-dd HH:mm:ss");
                string strEnd   = dtpEnd.Value.ToString("yyyy-MM-dd HH:mm:ss");

                string strSql = "select top 1000 ID,ToolType,ToolName,ToolID,PeopleBorrow,BorrowTime,IsReturn,PeopleReturn,ReturnTime,BorrowDuration from tb_RecordBorrow " +
                                "where BorrowTime BETWEEN '" + strStart + "' and '" + strEnd + "' ";//
                if (!string.IsNullOrEmpty(strCondition))
                {
                    strSql += " and ";
                    strSql += strCondition;
                }
                strSql  += " Order By BorrowTime Desc";
                dtRecord = datalogic.GetDataTable(strSql);
                JudgeNoRetrun();


                #region  计算分页

                dtPage.Rows.Clear();
                sbtnPageDown.Enabled = false;
                sbtnPageUp.Enabled   = false;
                if (dtRecord.Rows.Count > 0)
                {
                    iAllCount = dtRecord.Rows.Count;
                    if (iAllCount > iPageSizes)
                    {
                        iShowStart = 0;
                        iShowEnd   = iPageSizes;
                        if (iAllCount > iShowEnd)
                        {
                            sbtnPageDown.Enabled = true;
                        }
                        for (int i = iShowStart; i < iShowEnd; i++)
                        {
                            DataRow dr = dtPage.NewRow();// ID
                            dr[0] = dtRecord.Rows[i]["ID"].ToString();
                            dr[1] = dtRecord.Rows[i]["ToolType"].ToString();
                            dr[2] = dtRecord.Rows[i]["ToolName"].ToString();
                            dr[3] = dtRecord.Rows[i]["ToolID"].ToString();
                            dr[4] = dtRecord.Rows[i]["PeopleBorrow"].ToString();
                            dr[5] = dtRecord.Rows[i]["BorrowTime"].ToString();
                            dr[6] = dtRecord.Rows[i]["IsReturn"].ToString();
                            dr[7] = dtRecord.Rows[i]["PeopleReturn"].ToString();
                            dr[8] = dtRecord.Rows[i]["ReturnTime"].ToString();
                            dr[9] = dtRecord.Rows[i]["BorrowDuration"].ToString();
                            dtPage.Rows.Add(dr);
                        }
                    }
                    else
                    {
                        for (int i = 0; i < iAllCount; i++)
                        {
                            DataRow dr = dtPage.NewRow();// ID ToolType ToolName ToolID PeopleBorrow  BorrowTime IsReturn  PeopleReturn ReturnTime BorrowDuration
                            dr[0] = dtRecord.Rows[i]["ID"].ToString();
                            dr[1] = dtRecord.Rows[i]["ToolType"].ToString();
                            dr[2] = dtRecord.Rows[i]["ToolName"].ToString();
                            dr[3] = dtRecord.Rows[i]["ToolID"].ToString();
                            dr[4] = dtRecord.Rows[i]["PeopleBorrow"].ToString();
                            dr[5] = dtRecord.Rows[i]["BorrowTime"].ToString();
                            dr[6] = dtRecord.Rows[i]["IsReturn"].ToString();
                            dr[7] = dtRecord.Rows[i]["PeopleReturn"].ToString();
                            dr[8] = dtRecord.Rows[i]["ReturnTime"].ToString();
                            dr[9] = dtRecord.Rows[i]["BorrowDuration"].ToString();
                            dtPage.Rows.Add(dr);
                        }
                    }
                    gridControl1.DataSource = dtPage;
                }

                #endregion
            }
            catch (Exception ex)
            {
                if (frmMain.blDebug)
                {
                    MessageUtil.ShowTips(ex.Message);
                }
            }
        }
Ejemplo n.º 4
0
 public void unknow_messages_should_be_persistent()
 {
     MessageUtil.IsMessageMarkedAsPersistent(new MessageTypeId("Abc.Unknown")).ShouldBeTrue();
 }
Ejemplo n.º 5
0
 public void non_infrastructure_messages_should_not_be_infrastructure()
 {
     MessageUtil.IsInfrastructure(new MessageTypeId(typeof(NakedMessage))).ShouldBeFalse();
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 判断文件是否存在
        /// 如果出错,则连续判断三次
        ///
        /// 此方法暂时放弃 xiecongwen 20150102
        /// </summary>
        /// <param name="path"></param>
        /// <param name="ms"></param>
        /// <returns></returns>
        private bool IsExistsInDB(string path, monitorServer ms)
        {
            bool isExists = false;
            int  i        = 2;
            bool isOk     = true;

            do
            {
                try
                {
                    DBService.MonitorFileListenService mflservice = new DBService.MonitorFileListenService();
                    string relativeFullPath = path.Substring(ms.monitorLocalPath.Length);
                    isExists = mflservice.IsPathExists(ms.id, relativeFullPath);
                    isOk     = true;
                }
                catch (Exception ex)
                {
                    Common.LogManager.WriteLog(Common.LogFile.Error, "Path:" + path + Environment.NewLine + MessageUtil.GetExceptionMsg(ex, ""));
                    isExists = false;
                    isOk     = false;
                }
            } while (!isOk && i-- > 0);

            return(isExists);
        }
Ejemplo n.º 7
0
 public void should_detect_transcient_message()
 {
     MessageUtil.IsMessageMarkedAsPersistent(new MessageTypeId(typeof(TranscientCommand))).ShouldBeFalse();
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 保存操作
        /// </summary>
        private void btnSaveClick(object sender, EventArgs e)
        {
            try
            {
                if (superValidator1.Validate() && checksaved())
                {
                    if (toolbar1.flag == 0)
                    {
                        tbserialnum.Text = WareInOutDbMgr.WareInOutSerialNum(Convert.ToInt16(sbtype.Value));
                        FH.strFGoodsID   = tbgoodsid.Text.Trim();
                        FH.strFGoodsName = tbGoodsname.Text.Trim();
                        FH.strFOperator  = tbOperator.Text;
                        FH.strFSerialNum = tbserialnum.Text;
                        FH.intFTYPE      = sbtype.Value ? 1 : 0;
                        FH.strFWareID    = cbwarehouse.SelectedValue.ToString();
                        FH.strFWorknum   = cbworknum.SelectedValue.ToString();
                        //FH.strFCarNO = tbCarno.Text.Trim();
                        FH.strFModelno  = tbModel.Text.Trim();
                        FH.strFMaterial = tbMaterial.SelectedValue.ToString();
                        FH.strFItemID   = tbitemid.Text.Trim();
                        FH.dFDate       = dFdate.Value;
                        FH.dFHGSL       = tbhgsl.Value;
                        //FH.dFKHSL = tbghsl.Value;
                        FH.dFPSSL = tbpssl.Value;
                        FH.dFPSL  = tbpsl.Value;
                        //FH.dFKLSL = tbklsl.Value;
                        FH.strFInvoiceType = cmbinvoicetype.SelectedValue.ToString();
                        FH.strFimagePath   = pictureBox1.ImageLocation;
                        if (WareInOutDbMgr.WareInOutADD(FH) == 1)
                        {
                            MessageUtil.ShowTips("保存成功!");
                        }
                        if (toolbar1.cbcontinue.Checked)
                        {
                            String ck = cbwarehouse.Text;
                            String bc = cbworknum.Text;
                            ClearControls();

                            ClearBindings();
                            tbGoodsname.Focus();
                            dFdate.Value     = System.DateTime.Now;
                            tbOperator.Text  = frmLogin.userName;
                            cbworknum.Text   = bc;
                            cbwarehouse.Text = ck;
                        }
                        FreshFh();
                    }
                    else
                    {
                        FH.strFSerialNum = tbserialnum.Text;
                        FH.strFGoodsID   = tbgoodsid.Text.Trim();
                        FH.strFOperator  = tbOperator.Text;
                        FH.strFSerialNum = tbserialnum.Text;
                        FH.strFWorknum   = cbworknum.SelectedValue.ToString();
                        // FH.strFCarNO = tbCarno.Text.Trim();
                        FH.intFTYPE     = Convert.ToInt16(sbtype.Value);
                        FH.strFWareID   = cbwarehouse.SelectedValue.ToString();
                        FH.strFModelno  = tbModel.Text.Trim();
                        FH.strFMaterial = tbMaterial.SelectedValue.ToString();
                        FH.strFItemID   = tbitemid.Text.Trim();
                        FH.dFDate       = dFdate.Value;
                        FH.dFHGSL       = tbhgsl.Value;
                        //FH.dFKHSL = tbghsl.Value;
                        FH.dFPSSL = tbpssl.Value;
                        FH.dFPSL  = tbpsl.Value;
                        //FH.dFKLSL = tbklsl.Value;
                        FH.strFInvoiceType = cmbinvoicetype.SelectedValue.ToString();
                        FH.strFimagePath   = pictureBox1.ImageLocation;
                        if (WareInOutDbMgr.WareInOutUpdate(FH) == 1)
                        {
                            MessageUtil.ShowTips("保存成功!");
                        }
                        FreshFh();
                        SetControlsReadOnly(true);
                    }
                }
                else
                {
                    throw new Exception("产品必须输入!");
                }
            }
            catch (Exception)
            {
                return;
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Register receiving returned instrument
        /// </summary>
        /// <param name="Con">Register condition object</param>
        /// <returns></returns>
        public ActionResult IVS030_cmdConfirm_Cont(IVS030ConfirmCond Con)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                IVS030_ScreenParameter prm = GetScreenObject <IVS030_ScreenParameter>();
                if (prm.ElemInstrument == null)
                {
                    prm.ElemInstrument = new List <IVS030INST>();
                }

                IInventoryHandler    InvH     = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                IInstallationHandler InstallH = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler;
                ICommonHandler       comh     = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;

                if (comh.IsSystemSuspending())
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049);
                    return(Json(res));
                }
                if (!CheckUserPermission(ScreenID.C_INV_SCREEN_ID_RECEIVE_RETURN, FunctionID.C_FUNC_ID_OPERATE))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053);
                    return(Json(res));
                }

                //4.6
                using (TransactionScope scope = new TransactionScope())
                {
                    List <tbt_InventorySlip> doTbt_InventorySlipForUpdate = null;

                    //Comment by Jutarat A. on 11022013 (Move to check before 4.8.1)
                    ////4.7.1
                    //if (!string.IsNullOrEmpty(prm.ContractCode) && prm.ServiceTypeCode == ServiceType.C_SERVICE_TYPE_SALE)
                    //{
                    //    //4.7.1.1
                    //    bool blnProcessStatus = InstallH.ReceiveReturnInstrument(prm.SlipNo, prm.office.OfficeCode);

                    //    //4.7.1.2
                    //    if (!blnProcessStatus)
                    //    {
                    //        //Rollback
                    //        return Json(res);
                    //    }

                    //    //4.7.1.3
                    //    res.ResultData = MessageUtil.GetMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4019);
                    //    return Json(res);
                    //}
                    //End Comment

                    //4.7.1
                    if (!string.IsNullOrEmpty(prm.ContractCode))
                    {
                        doTbt_InventorySlipForUpdate = InvH.GetTbt_InventorySlipForReceiveReturn(prm.SlipNo);
                    }
                    else
                    {
                        List <tbt_InventorySlip> doTbt_InventorySlip = InvH.GetTbt_InventorySlip(prm.SlipNo);

                        doTbt_InventorySlipForUpdate = new List <tbt_InventorySlip>();
                        doTbt_InventorySlipForUpdate.AddRange(doTbt_InventorySlip);
                    }

                    if (doTbt_InventorySlipForUpdate == null)
                    {
                        doTbt_InventorySlipForUpdate = new List <tbt_InventorySlip>();
                    }


                    //Add by Jutarat A. on 11022013 (Move to check before 4.8.1)
                    //4.7.2
                    if (!string.IsNullOrEmpty(prm.ContractCode) && prm.ServiceTypeCode == ServiceType.C_SERVICE_TYPE_SALE &&
                        (doTbt_InventorySlipForUpdate != null && doTbt_InventorySlipForUpdate.Count > 0 &&
                         doTbt_InventorySlipForUpdate[0].SourceLocationCode != InstrumentLocation.C_INV_LOC_WIP &&
                         doTbt_InventorySlipForUpdate[0].SourceLocationCode != InstrumentLocation.C_INV_LOC_PARTIAL_OUT))
                    {
                        //4.7.2.1
                        bool blnProcessStatus = InstallH.ReceiveReturnInstrument(prm.SlipNo, prm.office.OfficeCode);

                        //4.7.2.2
                        if (!blnProcessStatus)
                        {
                            //Rollback
                            return(Json(res));
                        }

                        //4.7.2.3
                        scope.Complete(); //Add by Jutarat A. on 11022013 (Commit)

                        res.ResultData = MessageUtil.GetMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4019);
                        return(Json(res));
                    }
                    //End Add

                    //4.8.1
                    foreach (tbt_InventorySlip i in doTbt_InventorySlipForUpdate)
                    {
                        //4.8.2.1
                        if (i.DestinationLocationCode == InstrumentLocation.C_INV_LOC_ELIMINATION)
                        {
                            List <tbt_InventorySlip> lstUpdateSlip = InvH.GetTbt_InventorySlip(i.SlipNo);
                            if (lstUpdateSlip.Count > 0)
                            {
                                lstUpdateSlip[0].SlipStatus = InventorySlipStatus.C_INV_SLIP_STATUS_COMPLETE;
                                if (!string.IsNullOrEmpty(prm.Memo))
                                {
                                    lstUpdateSlip[0].Memo = prm.Memo;
                                }
                                if (!string.IsNullOrEmpty(prm.ApproveNo))
                                {
                                    lstUpdateSlip[0].ApproveNo = prm.ApproveNo;
                                }
                                lstUpdateSlip[0].StockInDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;

                                //Comment by Jutarat A. on 30052013 (Set at UpdateTbt_InventorySlip())
                                //lstUpdateSlip[0].UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;
                                //lstUpdateSlip[0].UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo;
                                //End Comment

                                List <tbt_InventorySlip> doTbt_InventorySlip = InvH.UpdateTbt_InventorySlip(lstUpdateSlip);

                                if (doTbt_InventorySlip == null || doTbt_InventorySlip.Count <= 0)
                                {
                                    //Rollback
                                    return(Json(res));
                                }
                            }
                        }
                        else
                        {
                            //4.8.2.2
                            bool blnProcessUpdate = InvH.RegisterReceiveInstrument(i.SlipNo, prm.Memo, prm.ApproveNo);
                            if (!blnProcessUpdate)
                            {
                                //Rollback
                                return(Json(res));
                            }
                        }
                    }

                    string strSourceLocationCode = string.Empty;

                    //4.9
                    foreach (tbt_InventorySlip i in doTbt_InventorySlipForUpdate)
                    {
                        //4.9.1
                        if (i.DestinationLocationCode == InstrumentLocation.C_INV_LOC_ELIMINATION)
                        {
                            continue;
                        }

                        //4.9.2
                        if (i.SourceLocationCode == InstrumentLocation.C_INV_LOC_UNOPERATED_WIP ||
                            i.SourceLocationCode == InstrumentLocation.C_INV_LOC_WIP ||
                            i.SourceLocationCode == InstrumentLocation.C_INV_LOC_PROJECT_WIP ||
                            i.SourceLocationCode == InstrumentLocation.C_INV_LOC_PARTIAL_OUT    // New WIP concept @ 24-Feb-2015
                            )
                        {
                            strSourceLocationCode = InstrumentLocation.C_INV_LOC_WAITING_RETURN;
                        }
                        else
                        {
                            strSourceLocationCode = InstrumentLocation.C_INV_LOC_RETURN_WIP;
                        }

                        //4.9.3
                        if (InvH.CheckNewInstrument(i.SlipNo) == 1)
                        {
                            //4.9.3.1
                            List <doGroupNewInstrument> doGroupNewInstrument = InvH.GetGroupNewInstrument(i.SlipNo);

                            foreach (doGroupNewInstrument groupNewIns in doGroupNewInstrument)
                            {
                                //4.9.3.2
                                groupNewIns.SourceLocationCode = strSourceLocationCode;

                                //4.9.3.3
                                #region Monthly Price @ 2015
                                //decimal decMovingAveragePrice = InvH.CalculateMovingAveragePrice(groupNewIns);
                                var decMovingAveragePrice = InvH.GetMonthlyAveragePrice(groupNewIns.Instrumentcode, i.SlipIssueDate, InventoryAccountCode.C_INV_ACCOUNT_CODE_INPROCESS, SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_LOCAL, SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US);
                                #endregion

                                int? intReturnInprocess;                                                                                                                 // New WIP concept @ 24-Feb-2015
                                bool blnUpdate = InvH.UpdateAccountTransferNewInstrument(groupNewIns, Convert.ToDecimal(decMovingAveragePrice), out intReturnInprocess); // New WIP concept @ 24-Feb-2015

                                if (!blnUpdate)
                                {
                                    //Rollback
                                    return(Json(res));
                                }

                                #region // New WIP concept @ 24-Feb-2015
                                if ((intReturnInprocess ?? 0) > 0)
                                {
                                    List <tbt_AccountInprocess> accountInProcessList = InvH.GetTbt_AccountInProcess(
                                        groupNewIns.SourceLocationCode
                                        , groupNewIns.ContractCode ?? groupNewIns.ProjectCode
                                        , groupNewIns.Instrumentcode
                                        );
                                    tbt_AccountStockMoving accountStockMoving = new tbt_AccountStockMoving();
                                    accountStockMoving.SlipNo                      = i.SlipNo;
                                    accountStockMoving.TransferTypeCode            = i.TransferTypeCode;
                                    accountStockMoving.SourceAccountStockCode      = InventoryAccountCode.C_INV_ACCOUNT_CODE_INPROCESS;
                                    accountStockMoving.DestinationAccountStockCode = InventoryAccountCode.C_INV_ACCOUNT_CODE_INSTOCK;
                                    accountStockMoving.SourceLocationCode          = groupNewIns.SourceLocationCode;
                                    accountStockMoving.DestinationLocationCode     = groupNewIns.DestinationLocationCode;
                                    accountStockMoving.InstrumentCode              = groupNewIns.Instrumentcode;
                                    accountStockMoving.InstrumentQty               = intReturnInprocess;
                                    if (accountInProcessList.Count != 0)
                                    {
                                        accountStockMoving.InstrumentPrice = accountInProcessList[0].MovingAveragePrice.Value;
                                    }
                                    accountStockMoving.CreateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;
                                    accountStockMoving.CreateBy   = CommonUtil.dsTransData.dtUserData.EmpNo;
                                    accountStockMoving.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;
                                    accountStockMoving.UpdateBy   = CommonUtil.dsTransData.dtUserData.EmpNo;
                                    List <tbt_AccountStockMoving> targetAccountStockMovingList = new List <tbt_AccountStockMoving>();
                                    targetAccountStockMovingList.Add(accountStockMoving);
                                    List <tbt_AccountStockMoving> resultAccountStockMovingList = InvH.InsertAccountStockMoving(targetAccountStockMovingList);
                                    if (resultAccountStockMovingList.Count <= 0)
                                    {
                                        throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0148, new string[] { TableName.C_TBL_NAME_INV_ACC_STOCK_MOVING });
                                    } //end if/else
                                }
                                #endregion
                            }
                        }

                        //4.9.4
                        if (InvH.CheckSecondhandInstrument(i.SlipNo) == 1)
                        {
                            //4.9.4.1
                            List <doGroupSecondhandInstrument> doGroupSecondhandInstrument = InvH.GetGroupSecondhandInstrument(i.SlipNo);

                            //4.9.4.2
                            foreach (doGroupSecondhandInstrument doGroupSecond in doGroupSecondhandInstrument)
                            {
                                doGroupSecond.SourceLocationCode = strSourceLocationCode;

                                bool blnUpdate = InvH.UpdateAccountTransferSecondhandInstrument(doGroupSecond);

                                if (!blnUpdate)
                                {
                                    //Rollback
                                    return(Json(res));
                                }
                            }
                        }

                        //4.9.5
                        if (InvH.CheckSampleInstrument(i.SlipNo) == 1)
                        {
                            //4.9.5.1
                            List <doGroupSampleInstrument> doGroupSampleInstrument = InvH.GetGroupSampleInstrument(i.SlipNo);

                            //4.9.5.2
                            foreach (doGroupSampleInstrument dogroupSample in doGroupSampleInstrument)
                            {
                                dogroupSample.SourceLocationCode = strSourceLocationCode;

                                int? intReturnInprocess;                                                                                  // New WIP concept @ 24-Feb-2015
                                bool blnUpdate = InvH.UpdateAccountTransferSampleInstrument(dogroupSample, null, out intReturnInprocess); // New WIP concept @ 24-Feb-2015

                                if (!blnUpdate)
                                {
                                    //Rollback
                                    return(Json(res));
                                }

                                #region // New WIP concept @ 24-Feb-2015
                                if ((intReturnInprocess ?? 0) > 0)
                                {
                                    tbt_AccountStockMoving accountStockMoving = new tbt_AccountStockMoving();
                                    accountStockMoving.SlipNo                      = i.SlipNo;
                                    accountStockMoving.TransferTypeCode            = i.TransferTypeCode;
                                    accountStockMoving.SourceAccountStockCode      = InventoryAccountCode.C_INV_ACCOUNT_CODE_INPROCESS;
                                    accountStockMoving.DestinationAccountStockCode = InventoryAccountCode.C_INV_ACCOUNT_CODE_INSTOCK;
                                    accountStockMoving.SourceLocationCode          = dogroupSample.SourceLocationCode;
                                    accountStockMoving.DestinationLocationCode     = dogroupSample.DestinationLocationCode;
                                    accountStockMoving.InstrumentCode              = dogroupSample.Instrumentcode;
                                    accountStockMoving.InstrumentQty               = intReturnInprocess;
                                    accountStockMoving.InstrumentPrice             = InventoryConfig.C_INV_DEFAULT_SAMPLE_AMOUNT;
                                    accountStockMoving.CreateDate                  = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;
                                    accountStockMoving.CreateBy                    = CommonUtil.dsTransData.dtUserData.EmpNo;
                                    accountStockMoving.UpdateDate                  = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;
                                    accountStockMoving.UpdateBy                    = CommonUtil.dsTransData.dtUserData.EmpNo;
                                    List <tbt_AccountStockMoving> targetAccountStockMovingList = new List <tbt_AccountStockMoving>();
                                    targetAccountStockMovingList.Add(accountStockMoving);
                                    List <tbt_AccountStockMoving> resultAccountStockMovingList = InvH.InsertAccountStockMoving(targetAccountStockMovingList);
                                    if (resultAccountStockMovingList.Count <= 0)
                                    {
                                        throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0148, new string[] { TableName.C_TBL_NAME_INV_ACC_STOCK_MOVING });
                                    } //end if/else
                                }
                                #endregion
                            }
                        }
                    }

                    //4.10
                    if (prm.SlipSelectType == IVS030_ScreenParameter.SlipType.InstallationSlip)
                    {
                        bool blnProcessStatus = InstallH.ReceiveReturnInstrument(prm.SlipNo, prm.office.OfficeCode);

                        if (!blnProcessStatus)
                        {
                            //Rollback
                            return(Json(res));
                        }
                    }

                    //Genereate Invenotry Slip Report
                    var    srvInvDoc     = ServiceContainer.GetService <IInventoryDocumentHandler>() as IInventoryDocumentHandler;
                    string invslipnolist = string.Join(",", doTbt_InventorySlipForUpdate.Select(d => d.SlipNo));
                    srvInvDoc.GenerateIVR210FilePath(invslipnolist, null, CommonUtil.dsTransData.dtUserData.EmpNo, CommonUtil.dsTransData.dtOperationData.ProcessDateTime);

                    res.ResultData = new {
                        SlipNo  = prm.SlipNo,
                        Message = MessageUtil.GetMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4019)
                    };


                    scope.Complete();
                }

                return(Json(res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex); return(Json(res));
            }
        }
Ejemplo n.º 10
0
        private void sbtnDelete_Click(object sender, EventArgs e)
        {
            sbtnAdd.Enabled        = false;
            sbtnDelete.Enabled     = false;
            sbtnDeleteExit.Enabled = false;
            lblInfo.Visible        = true;

            if (MessageUtil.ShowYesNoAndTips("确定上传?") == DialogResult.Yes)
            {
                //所有选中的 工具柜
                bool blBox = true;
                foreach (DataRow dr in dtBoxSelect.Rows)
                {
                    string strChildId  = dr["tvChildId"].ToString();
                    string strParentId = dr["tvParent"].ToString();
                    string strBoxName  = dr["PlaceName"].ToString();
                    int    iCount      = listWg.Count;
                    if (iCount > 0)
                    {
                        for (int iIndex = 0; iIndex < iCount; iIndex++)
                        {
                            if (listWg[iIndex].StrChildId == strChildId)
                            {
                                wgControl.IntSn   = listWg[iIndex].IntSn;
                                wgControl.StrIp   = listWg[iIndex].StrIp;
                                wgControl.IntPort = listWg[iIndex].IntPort;
                                //MjRegisterCard mjrc = new MjRegisterCard();
                                bool blUser = true;
                                //所有选中的人
                                foreach (DataRow row in dtUserSelect.Rows)
                                {
                                    string strIcNo = row["IcNo"].ToString();
                                    //string strUserId = row["tvChildId"].ToString();
                                    //string strName = row["UserName"].ToString();
                                    //string strCardNo = row["CardNo"].ToString();
                                    if (wgControl.DeleteCardPower(strIcNo))
                                    {
                                        string strSql = "delete from tb_BoxIcPower where BoxChildId='" + strChildId + "' and IcNo='" + strIcNo + "'";
                                        datalogic.SqlComNonQuery(strSql);
                                    }
                                    else
                                    {
                                        blUser = false;
                                        break;
                                    }
                                    Thread.Sleep(20);
                                }
                                //人员中有授权错误
                                if (blUser == false)
                                {
                                    blBox = false;
                                }
                                break;
                            }
                        }
                    }
                    // 工具柜 有授权错误
                    if (blBox == false)
                    {
                        break;
                    }
                }
                if (blBox)
                {
                    MessageUtil.ShowTips("删除权限成功");
                }
                else
                {
                    MessageUtil.ShowTips("删除权限失败,请检查设备或网络连接");
                }
            }


            sbtnAdd.Enabled        = true;
            sbtnDelete.Enabled     = true;
            sbtnDeleteExit.Enabled = true;
            lblInfo.Visible        = false;
        }
Ejemplo n.º 11
0
        private void ConditionQuery()
        {
            try
            {
                PagetableInit();
                TableShowInit();

                #region 查询条件

                string strCondition = "";
                if (cbbType.Text != "全部")
                {
                    strCondition = "Type='" + cbbType.Text + "' ";
                }

                #endregion

                string strStart = dtpStart.Value.ToString("yyyy-MM-dd HH:mm:ss");
                string strEnd   = dtpEnd.Value.ToString("yyyy-MM-dd HH:mm:ss");

                string strSql = "select top 1000 ID,Type,Point,EventContent,People,Time from tb_AlarmEvent " +
                                "where Time BETWEEN '" + strStart + "' and '" + strEnd + "' ";
                if (!string.IsNullOrEmpty(strCondition))
                {
                    strSql += " and ";
                    strSql += strCondition;
                }
                strSql  += " Order By Time Desc";
                dtRecord = datalogic.GetDataTable(strSql);

                #region  计算分页

                dtPage.Rows.Clear();
                sbtnPageDown.Enabled = false;
                sbtnPageUp.Enabled   = false;
                if (dtRecord.Rows.Count > 0)
                {
                    iAllCount = dtRecord.Rows.Count;
                    if (iAllCount > iPageSizes)
                    {
                        iShowStart = 0;
                        iShowEnd   = iPageSizes;
                        if (iAllCount > iShowEnd)
                        {
                            sbtnPageDown.Enabled = true;
                        }
                        for (int i = iShowStart; i < iShowEnd; i++)
                        {
                            DataRow dr = dtPage.NewRow();// ID
                            dr[0] = dtRecord.Rows[i]["ID"].ToString();
                            dr[1] = dtRecord.Rows[i]["Type"].ToString();
                            dr[2] = dtRecord.Rows[i]["Point"].ToString();
                            dr[3] = dtRecord.Rows[i]["EventContent"].ToString();
                            dr[4] = dtRecord.Rows[i]["People"].ToString();
                            dr[5] = dtRecord.Rows[i]["Time"].ToString();
                            dtPage.Rows.Add(dr);
                        }
                    }
                    else
                    {
                        for (int i = 0; i < iAllCount; i++)
                        {
                            DataRow dr = dtPage.NewRow();// ID  OpenType GroupName UserName OpenTime CloseTime DurationTime
                            dr[0] = dtRecord.Rows[i]["ID"].ToString();
                            dr[1] = dtRecord.Rows[i]["Type"].ToString();
                            dr[2] = dtRecord.Rows[i]["Point"].ToString();
                            dr[3] = dtRecord.Rows[i]["EventContent"].ToString();
                            dr[4] = dtRecord.Rows[i]["People"].ToString();
                            dr[5] = dtRecord.Rows[i]["Time"].ToString();
                            dtPage.Rows.Add(dr);
                        }
                    }
                    gridControl1.DataSource = dtPage;
                }

                #endregion
            }
            catch (Exception ex)
            {
                if (frmMain.blDebug)
                {
                    MessageUtil.ShowTips(ex.Message);
                }
            }
        }
Ejemplo n.º 12
0
        public void LoadBox()
        {
            try
            {
                #region  工具柜门禁

                string strSql = "select tvChildId,AreaName,PlaceName,DoorIp,DoorSn,BoxHasRfid,BoxRfidMain,wgPort from tb_Tools where  " +
                                "IsArea='" + ToolAreaType.工具柜.ToString() + "' and HasDoor='" + DeviceUsing.启用.ToString() + "'  ";
                DataTable dt = datalogic.GetDataTable(strSql);

                foreach (DataRow datarow in dt.Rows)
                {
                    string strChildId  = datarow["tvChildId"].ToString();
                    string strArea     = datarow["AreaName"].ToString();
                    string strName     = datarow["PlaceName"].ToString();
                    string strIp       = datarow["DoorIp"].ToString();
                    string strPort     = datarow["wgPort"].ToString();
                    string strSn       = datarow["DoorSn"].ToString();
                    string strHasRfid  = datarow["BoxHasRfid"].ToString();
                    string strRfidMain = datarow["BoxRfidMain"].ToString();
                    int    iSn         = 0;
                    int    iPort       = 60000;
                    if (!string.IsNullOrEmpty(strSn))
                    {
                        iSn = Convert.ToInt32(strSn);
                    }
                    else
                    {
                        MessageUtil.ShowTips(strName + " 工具柜门禁SN为空");
                    }
                    if (!string.IsNullOrEmpty(strPort))
                    {
                        iPort = Convert.ToInt32(strPort);
                    }
                    else
                    {
                        MessageUtil.ShowTips(strName + " 工具柜门禁 端口号 为空");
                    }

                    clsWgInfo wgInfo = new clsWgInfo(strIp, iPort, iSn);
                    //wgInfo.StrNameOfWg = strName;
                    //wgInfo.DoorOrBoxDoor = WgDoorType.工具柜;
                    wgInfo.StrChildId = strChildId;
                    clsDoorInfo door = new clsDoorInfo(strName, 1);
                    wgInfo.listDoor.Add(door);
                    listWg.Add(wgInfo);

                    //boxDoor.StrChildId = strChildId;
                    //boxDoor.StrHasRfid = strHasRfid;
                    //boxDoor.StrRfidMain = strRfidMain;
                }
                #endregion
            }
            catch (Exception ex)
            {
                if (frmMain.blDebug)
                {
                    MessageUtil.ShowTips(ex.Message);
                }
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 具体业务逻辑
        /// </summary>
        private void DO(CallBack action)
        {
            Signal.IsSystemStoping = false;

            try
            {
                Common.LogManager.WriteLog(LogFile.Bussiness, "Listen start");

                //判断是否有监视JOB端(即MAC机)
                foreach (var ms in new DBService.MonitorServerService().GetMonitorServerListWithAttached())
                {
                    Common.LogManager.WriteLog(LogFile.Bussiness, ms.id + " attend to Listening");

                    #region 建立监视
                    try
                    {
                        DirectoryInfo targetDirInfo = new DirectoryInfo(ms.monitorLocalPath);
                        #region 判断目标盘符是否有足够空间,并提示用户

                        //if (!FileListenHelper.CheckDisk(targetDirInfo))
                        //{
                        //    new System.Threading.Thread(() =>
                        //    {
                        //        //send mail
                        //        FileListenHelper.SendMail(targetDirInfo, ms);
                        //    }).Start();
                        //}
                        #endregion

                        //将当前已有文件系统信息同步到数据库,然后建立监控

                        /*
                         *  由于时间原因,暂时认为此程序先开启,然后再开启BudFileListen 20140704
                         *
                         *  当前逻辑是判断数据库中对应monitorserver是否为空 如果为空则扫描整个文件系统
                         *  并插入到数据库中 20140705
                         */
                        FileListenResolver flr = new FileListenResolver(ms);

                        /**
                         *
                         * 20150104 xiecongwen filelisten表中只保存一个星期的,每个星期维护一次;如有不妥,可改为一个月
                         * 文件下载 主要查询pathBK
                         */
                        //FileCheck(ms, flr);
                        #region 设置监视器
                        FileSystemWatcher fsw = new FileSystemWatcher()
                        {
                            //只监听文件创建、删除、文件大小变化,忽略目录变化
                            NotifyFilter = NotifyFilters.Size | NotifyFilters.FileName,
                            //Filter="*",
                            Path = ms.monitorLocalPath,
                            IncludeSubdirectories = true
                        };
                        //设置事件
                        flr.SetEvent(fsw);
                        fsw.EnableRaisingEvents = true;
                        fswlist.Add(fsw);
                        #endregion
                    }
                    catch (ArgumentException aex)
                    {
                        Common.LogManager.WriteLog(LogFile.Bussiness, ms.id + " error:" + aex.Message);
                        //回调错误处理函数
                        if (action(aex))
                        {
                            //用户选择退出时,当前线程直接退出,并新建一个线程去清理资源
                            ThreadPool.QueueUserWorkItem((x) => { Thread.Sleep(1000); ShutDown(); });
                            break;
                        }

                        continue;
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        action(ex);
                        break;
                    }

                    //日志 通知 此monitorserver已经建立监听
                    Common.LogManager.WriteLog(LogFile.Bussiness, ms.id + " Listening");
                    #endregion
                }

                //开启定时同步线程
                new System.Threading.Thread(() => SyncFileSystemAndDB()).Start();
                //开启日志清理线程
                new System.Threading.Thread(() => ClearOverdueLog()).Start();
            }
            catch (Exception ex)
            {
                logger.Error(MessageUtil.GetExceptionMsg(ex, ""));
                action(ex);
            }
            finally
            {
                //所有server 都处理了
                Common.LogManager.WriteLog(LogFile.Bussiness, "All servers have been processed");
            }
        }
Ejemplo n.º 14
0
        public async Task should_remove_peer_subscriptions_for_a_type_if_there_are_no_binding_keys()
        {
            using (SystemDateTime.PauseTime())
            {
                var subscriptionsForTypes = new[]
                {
                    new SubscriptionsForType(MessageUtil.GetTypeId(typeof(int))),
                    new SubscriptionsForType(MessageUtil.GetTypeId(typeof(double)), BindingKey.Empty)
                };
                await _peerDirectory.RegisterAsync(_bus, _self, Enumerable.Empty <Subscription>());

                _bus.ClearMessages();
                SubscriptionsForType[] addedSubscriptions    = null;
                MessageTypeId[]        removedMessageTypeIds = null;
                _repositoryMock.Setup(repo => repo.AddDynamicSubscriptionsForTypes(_self.Id, SystemDateTime.UtcNow, It.IsAny <SubscriptionsForType[]>()))
                .Callback((PeerId peerId, DateTime timestampUtc, SubscriptionsForType[] subs) => addedSubscriptions = subs);
                _repositoryMock.Setup(repo => repo.RemoveDynamicSubscriptionsForTypes(_self.Id, SystemDateTime.UtcNow, It.IsAny <MessageTypeId[]>()))
                .Callback((PeerId peerId, DateTime timestampUtc, MessageTypeId[] ids) => removedMessageTypeIds = ids);

                await _peerDirectory.UpdateSubscriptionsAsync(_bus, subscriptionsForTypes);

                var addedSubscription = addedSubscriptions.ExpectedSingle();
                addedSubscription.ShouldHaveSamePropertiesAs(new SubscriptionsForType(MessageUtil.GetTypeId(typeof(double)), BindingKey.Empty));
                var removedMessageTypeId = removedMessageTypeIds.ExpectedSingle();
                removedMessageTypeId.ShouldHaveSamePropertiesAs(MessageUtil.GetTypeId(typeof(int)));
                _bus.ExpectExactly(new PeerSubscriptionsForTypesUpdated(_self.Id, SystemDateTime.UtcNow, subscriptionsForTypes));
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 保存操作
        /// </summary>
        private void btnSaveClick(object sender, EventArgs e)
        {
            try
            {
                if (superValidator1.Validate() && checkSL())
                {
                    if (toolbar.flag == 0)
                    {
                        tbserialnum.Text   = JCHMethod.tb_JCSerialNum(1);
                        JCH.strJCGoodsID   = tbgoodsid.Text.Trim();
                        JCH.strJCGoodsName = tbGoodsname.Text.Trim();
                        JCH.strJCOperator  = tbOperator.Text;
                        JCH.strJCSerialNum = tbserialnum.Text;
                        JCH.intJCTYPE      = 1;
                        //JCH.strJCWareID = cbwarehouse.SelectedValue.ToString();
                        JCH.strFKilnNo    = cmbkilnno.SelectedValue.ToString();
                        JCH.strJCWorknum  = cbworknum.SelectedValue.ToString();
                        JCH.strJCCarNO    = tbCarno.Text.Trim();
                        JCH.strJCModelno  = tbModel.Text.Trim();
                        JCH.strJCMaterial = tbMaterial.SelectedValue.ToString();
                        JCH.strJCItemID   = tbitemid.Text.Trim();
                        JCH.dJCDate       = djcdate.Value;
                        JCH.dJCHGSL       = tbhgsl.Value;
                        JCH.dJCKHSL       = tbghsl.Value;
                        JCH.dJCPSSL       = tbpssl.Value;
                        JCH.dJCKLSL       = tbklsl.Value;
                        JCH.dFRYHGSL      = tbryhgsl.Value;
                        JCH.dFHGL         = tbhgl.Value;
                        JCH.iFZYID        = fzyid;
                        JCH.strFImagePath = pictureBox1.ImageLocation;
                        if (JCHMethod.tb_JCHADD(JCH) == 1)
                        {
                            MessageUtil.ShowTips("保存成功!");
                        }
                        if (toolbar.cbcontinue.Checked)
                        {
                            String ylbh = cmbkilnno.Text;
                            String bc   = cbworknum.Text;
                            String ych  = tbCarno.Text;
                            ClearControls();

                            ClearBindings();
                            tbGoodsname.Focus();
                            djcdate.Value   = System.DateTime.Now;
                            tbOperator.Text = frmLogin.userName;
                            cmbkilnno.Text  = ylbh;
                            cbworknum.Text  = bc;
                            tbCarno.Text    = ych;
                        }
                        FreshJch();
                    }
                    else
                    {
                        JCH.strJCSerialNum = tbserialnum.Text;
                        JCH.strJCGoodsID   = tbgoodsid.Text.Trim();
                        JCH.strJCGoodsName = tbGoodsname.Text.Trim();
                        JCH.strJCOperator  = tbOperator.Text;
                        JCH.strJCSerialNum = tbserialnum.Text;
                        JCH.strJCWorknum   = cbworknum.SelectedValue.ToString();
                        JCH.strFKilnNo     = cmbkilnno.SelectedValue.ToString();
                        JCH.strJCCarNO     = tbCarno.Text.Trim();
                        JCH.intJCTYPE      = 1;
                        //JCH.strJCWareID = cbwarehouse.SelectedValue.ToString();
                        JCH.strJCModelno  = tbModel.Text.Trim();
                        JCH.strJCMaterial = tbMaterial.SelectedValue.ToString();
                        JCH.strJCItemID   = tbitemid.Text.Trim();
                        JCH.dJCDate       = djcdate.Value;
                        JCH.dJCHGSL       = tbhgsl.Value;
                        JCH.dJCKHSL       = tbghsl.Value;
                        JCH.dJCPSSL       = tbpssl.Value;
                        JCH.dJCKLSL       = tbklsl.Value;
                        JCH.dFRYHGSL      = tbryhgsl.Value;
                        JCH.dFHGL         = tbhgl.Value;
                        JCH.strFImagePath = pictureBox1.ImageLocation;
                        if (JCHMethod.tb_JCHUpdate(JCH) == 1)
                        {
                            MessageUtil.ShowTips("保存成功!");
                        }
                        FreshJch();
                        SetControlsReadOnly(true);
                    }
                }
                else
                {
                    throw new Exception("产品必须输入!");
                }
            }
            catch (Exception)
            {
                return;
            }
        }
Ejemplo n.º 16
0
 public static Subscription CreateSubscription <TMessage>(BindingKey?bindingKey = null) where TMessage : IMessage
 {
     return(new Subscription(MessageUtil.TypeId <TMessage>(), bindingKey ?? BindingKey.Empty));
 }
Ejemplo n.º 17
0
        public void SendEmailWithSubject(string strAllInfo, string subject = "notice", string mailattachments = null, int toFlag = 0)
        {
            SmtpClient  client = new SmtpClient();
            MailMessage msg    = new MailMessage();

            DataSet ds = new DataSet();

            System.Text.Encoding encoding = System.Text.Encoding.UTF8;

            AppConfig ac = new AppConfig();

            try
            {
                logger.Info("Begin to get the head info of mail...");
                string username = ac.getEmailUser();
                string cc       = ac.getEmailDataSendCC();
                string password = ac.getEmailPwd();
                string smtp     = ac.getSMTP();
                string to       = ac.getEmailDataSendTo();

                logger.Info("Success to get the head info of mail.");

                logger.Info("Begin to get or set the SMTP info...");
                client.UseDefaultCredentials = false;
                client.Credentials           = new NetworkCredential(username, password);
                client.DeliveryMethod        = SmtpDeliveryMethod.Network;
                client.Host = smtp;//smtp
                client.Port = 587;

                client.Timeout = 20000;
                logger.Info("Success to get or set the SMTP info.");

                string[] toArr   = to.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                string[] toArrCC = cc.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                //根据toFlag,判断是否群发
                logger.Info("Begin to load the infos of receivers and cc...");
                if (toFlag == 0)
                {
                    for (int j = 0; j < toArr.Length; j++)
                    {
                        msg.To.Add(toArr[j]);//设置发送给谁
                    }
                    for (int k = 0; k < toArrCC.Length; k++)
                    {
                        msg.CC.Add(toArrCC[k]);//设置CC给谁
                    }
                }
                else
                {
                    msg.To.Add("*****@*****.**");
                }
                logger.Info("Success to load the infos of receivers and cc.");

                MailAddress address = new MailAddress(username); //from
                msg.From    = address;
                msg.Subject = subject;                           //主题设置
                if (!String.IsNullOrWhiteSpace(mailattachments) && System.IO.File.Exists(mailattachments))
                {
                    logger.Info("Begin to load attachments info...");
                    msg.Attachments.Add(new Attachment(mailattachments));
                    logger.Info("Success to load attachments info.");
                }
                else
                {
                    logger.Info("there is not a attachment to load.");
                }
                msg.Body = strAllInfo;
                logger.Info("Success to load the mail's body.");
                msg.SubjectEncoding = encoding;
                msg.BodyEncoding    = encoding;
                msg.IsBodyHtml      = false;
                logger.Info("Success to set the mail's subject and encoding format of body.");
                msg.Priority = MailPriority.High;
                logger.Info("Success to set the mail's priority.");
                object userState = msg;
                try
                {
                    logger.Info("Begin to send mail...");
                    client.Send(msg);
                    logger.Info("Success to send mail.");
                }
                catch (Exception ex)
                {
                    logger.Error("Fail to send mail. " + MessageUtil.GetExceptionMsg(ex, ""));
                }
            }
            catch (Exception ex1)
            {
                logger.Error("Error occurs where sending a mail. " + MessageUtil.GetExceptionMsg(ex1, ""));
            }
            finally
            {
                msg.Dispose();
            }
        }
Ejemplo n.º 18
0
        private void sbtnOk_Click(object sender, EventArgs e)
        {
            #region  输入 判断

            //string strHotRun = tbAirHotRun.Text.Trim();
            //string strHotStop = tbHotStop.Text.Trim();
            string strHumiRun  = tbHumiRun.Text.Trim();
            string strHumiStop = tbHumiStop.Text.Trim();
            string strHandTime = tbDisAuto.Text.Trim();

            string strAirCoolRun     = tbCoolRun.Text.Trim();
            string strAirCoolStop    = tbCoolStop.Text.Trim();
            string strAirCoolTempSet = tbCoolTempSet.Text.Trim();
            string strAirHotRun      = tbAirHotRun.Text.Trim();
            string strAirHotStop     = tbAirHotStop.Text.Trim();
            string strAirHotTempSet  = tbAirHotTempSet.Text.Trim();

            if (string.IsNullOrEmpty(strAirHotTempSet))
            {
                MessageUtil.ShowTips("空调制热温度设置值不可为空");
                return;
            }
            if (string.IsNullOrEmpty(strAirHotStop))
            {
                MessageUtil.ShowTips("空调制热停止值不可为空");
                return;
            }
            if (string.IsNullOrEmpty(strAirHotRun))
            {
                MessageUtil.ShowTips("空调制热启动值不可为空");
                return;
            }
            if (string.IsNullOrEmpty(strAirCoolTempSet))
            {
                MessageUtil.ShowTips("空调制冷温度设置值不可为空");
                return;
            }
            if (string.IsNullOrEmpty(strAirCoolStop))
            {
                MessageUtil.ShowTips("空调制冷停止值不可为空");
                return;
            }
            if (string.IsNullOrEmpty(strAirCoolRun))
            {
                MessageUtil.ShowTips("空调制冷启动值不可为空");
                return;
            }

            //if (string.IsNullOrEmpty(strHotRun))
            //{
            //    MessageUtil.ShowTips("加热启动阀值不可为空!");
            //    return;
            //}
            //if (string.IsNullOrEmpty(strHotStop ))
            //{
            //    MessageUtil.ShowTips("加热停止阀值不可为空!");
            //    return;
            //}
            if (string.IsNullOrEmpty(strHumiRun))
            {
                MessageUtil.ShowTips("除湿启动阀值不可为空");
                return;
            }
            if (string.IsNullOrEmpty(strHumiStop))
            {
                MessageUtil.ShowTips("除湿停止阀值不可为空");
                return;
            }
            if (string.IsNullOrEmpty(strHandTime))
            {
                MessageUtil.ShowTips("非自动控制保持时间不可为空!");
                return;
            }
            #endregion

            if (blHas)
            {// HotRun,HotStop,HumiRun,HumiStop HandKeepTime,AirCoolRun,AirCoolStop,AirCoolTempSet,AirHotRun,AirHotStop,AirHotTempSet
                string strSql = "update tb_SysDevice set HotRun='',HotStop='',HumiRun='" + strHumiRun + "'," +
                                "HumiStop='" + strHumiStop + "',HandKeepTime='" + strHandTime + "' ,AirCoolRun='" + strAirCoolRun + "'" +
                                ",AirCoolStop='" + strAirCoolStop + "',AirCoolTempSet='" + strAirCoolTempSet + "',AirHotRun='" + strAirHotRun + "'" +
                                ",AirHotStop='" + strAirHotStop + "',AirHotTempSet='" + strAirHotTempSet + "' where ID='" + strId + "' ";
                datalogic.SqlComNonQuery(strSql);
            }
            else
            {
                string strSql = "insert into tb_SysDevice (HotRun,HotStop,HumiRun,HumiStop,HandKeepTime,AirCoolRun,AirCoolStop,AirCoolTempSet," +
                                "AirHotRun,AirHotStop,AirHotTempSet)" +
                                "values ('','','" + strHumiRun + "','" + strHumiStop + "','" + strHandTime + "'" +
                                ",'" + strAirCoolRun + "','" + strAirCoolStop + "','" + strAirCoolTempSet + "','" + strAirHotRun + "'," +
                                "'" + strAirHotStop + "','" + strAirHotTempSet + "')";
                datalogic.SqlComNonQuery(strSql);
            }
            MessageUtil.ShowTips("设置成功");
        }
        /// <summary>
        /// Create the response message
        /// </summary>
        public MARC.Everest.Interfaces.IInteraction Create(MARC.Everest.Interfaces.IInteraction request, RegistryQueryResult results, List <IResultDetail> dtls)
        {
            // GEt the config services
            ISystemConfigurationService configService = Context.GetService(typeof(ISystemConfigurationService)) as ISystemConfigurationService;
            ILocalizationService        localeService = Context.GetService(typeof(ILocalizationService)) as ILocalizationService;

            var retHl7v3 = new List <MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.Subject1 <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201304UV02.Patient, object> >(results.Results.Count);

            UvDeComponentUtil dCompUtil = new UvDeComponentUtil();

            dCompUtil.Context = this.Context;

            PRPA_IN201309UV02 rqst = request as PRPA_IN201309UV02;

            // Convert results to HL7v3
            foreach (RegistrationEvent res in results.Results)
            {
                var retRec = new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.Subject1 <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201304UV02.Patient, object>(
                    false,
                    dCompUtil.CreateRegistrationEventDetail(res, dtls)
                    );
                if (retRec.RegistrationEvent == null)
                {
                    retRec = new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.Subject1 <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201304UV02.Patient, object>(
                        false,
                        new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.RegistrationEvent <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201304UV02.Patient, object>()
                    {
                        NullFlavor = NullFlavor.NoInformation
                    }
                        );
                }
                retHl7v3.Add(retRec);
            }

            if (retHl7v3.Count > 1)
            {
                dtls.Add(new InsufficientRepetitionsResultDetail(ResultDetailType.Warning, localeService.GetString("MSGE06E"), null));
            }

            // Create the response
            PRPA_IN201310UV02 response = new PRPA_IN201310UV02
                                         (
                Guid.NewGuid(),
                DateTime.Now,
                PRPA_IN201310UV02.GetInteractionId(),
                ProcessingID.Production,
                "T",
                AcknowledgementCondition.Never,
                MessageUtil.CreateReceiver(rqst.Sender),
                MessageUtil.CreateSenderUv(new Uri(rqst.Receiver[0].Telecom.Value), configService),
                null
                                         )
            {
                Acknowledgement = new List <MARC.Everest.RMIM.UV.NE2008.MCCI_MT100300UV01.Acknowledgement>()
                {
                    new MARC.Everest.RMIM.UV.NE2008.MCCI_MT100300UV01.Acknowledgement(
                        dtls.Count(a => a.Type == ResultDetailType.Error) == 0 ? AcknowledgementType.ApplicationAcknowledgementAccept : AcknowledgementType.ApplicationAcknowledgementError,
                        new MARC.Everest.RMIM.UV.NE2008.MCCI_MT100200UV01.TargetMessage(request.Id)
                        )
                }
            };

            response.controlActProcess = new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.ControlActProcess <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201307UV02.QueryByParameter, MARC.Everest.RMIM.UV.NE2008.PRPA_MT201304UV02.Patient, object>("EVN")
            {
                Id       = SET <II> .CreateSET(new II(configService.Custodianship.Id.Domain, Guid.NewGuid().ToString())),
                Code     = new CD <string>(PRPA_IN201310UV02.GetTriggerEvent().Code, PRPA_IN201310UV02.GetTriggerEvent().CodeSystem),
                QueryAck = new MARC.Everest.RMIM.UV.NE2008.QUQI_MT120001UV01.QueryAck(
                    rqst.controlActProcess.queryByParameter.QueryId,
                    "complete",
                    (AcknowledgementType)response.Acknowledgement[0].TypeCode == AcknowledgementType.ApplicationAcknowledgementError ? QueryResponse.ApplicationError : results.TotalResults == 0 ? QueryResponse.NoDataFound : QueryResponse.DataFound,
                    results.TotalResults,
                    results.Results.Count,
                    results.TotalResults - results.Results.Count - results.StartRecordNumber
                    ),
                queryByParameter = rqst.controlActProcess.queryByParameter
            };

            response.controlActProcess.LanguageCode = MessageUtil.GetDefaultLanguageCode(this.Context);
            if (retHl7v3.Count > 0)
            {
                response.controlActProcess.Subject.Add(retHl7v3[0]);
            }
            return(response);
        }
Ejemplo n.º 20
0
 public void ReceiveMessage(Message receivedMessage)
 {
     MessageUtil.ReceiveMessage <MessageSubType>(receivedMessage, mMessageActions);
 }
Ejemplo n.º 21
0
 public void non_transcient_messages_should_be_persistent()
 {
     MessageUtil.IsMessageMarkedAsPersistent(new MessageTypeId(typeof(NakedMessage))).ShouldBeTrue();
 }
Ejemplo n.º 22
0
            public void should_unsubscribe_to_batch()
            {
                AddInvoker <FakeRoutableCommand>(shouldBeSubscribedOnStartup: false);
                _bus.Start();
                var subscriptions = new List <Subscription>();

                subscriptions.Add(Subscription.ByExample(x => new FakeRoutableCommand(1, "name")));
                subscriptions.Add(Subscription.ByExample(x => new FakeRoutableCommand(1, "toto")));
                subscriptions.Add(Subscription.ByExample(x => new FakeRoutableCommand(2, "name")));
                var subscription           = _bus.Subscribe(subscriptions.ToArray());
                var directorySubscriptions = new List <SubscriptionsForType>();

                _directoryMock.CaptureEnumerable((IBus)_bus, (x, bus, items) => x.UpdateSubscriptionsAsync(bus, items), directorySubscriptions);

                subscription.Dispose();
                Wait.Until(() => directorySubscriptions.Count > 0, 2.Seconds());

                directorySubscriptions.ExpectedSingle().ShouldEqual(new SubscriptionsForType(MessageUtil.TypeId <FakeRoutableCommand>()));
            }
Ejemplo n.º 23
0
 public void should_detect_infrastructure_message()
 {
     MessageUtil.IsInfrastructure(new MessageTypeId(typeof(InfrastructureMessage))).ShouldBeTrue();
 }
Ejemplo n.º 24
0
            public void should_not_unsubscribe_static_subscription()
            {
                AddInvoker <FakeRoutableCommand>(shouldBeSubscribedOnStartup: true);
                _bus.Start();
                var subscription           = _bus.Subscribe(Subscription.ByExample(x => new FakeRoutableCommand(1, "name")));
                var directorySubscriptions = new List <SubscriptionsForType>();

                _directoryMock.CaptureEnumerable((IBus)_bus, (x, bus, items) => x.UpdateSubscriptionsAsync(bus, items), directorySubscriptions);

                subscription.Dispose();
                Wait.Until(() => directorySubscriptions.Count > 0, 2.Seconds());

                directorySubscriptions.ExpectedSingle().ShouldEqual(new SubscriptionsForType(MessageUtil.TypeId <FakeRoutableCommand>(), BindingKey.Empty));
            }
Ejemplo n.º 25
0
 public void unknow_messages_should_not_be_infrastructure()
 {
     MessageUtil.IsInfrastructure(new MessageTypeId("Abc.Unknown")).ShouldBeFalse();
 }
Ejemplo n.º 26
0
            private void SendParallelSubscriptionUpdates(int threadCount, int subscriptionCountPerThread)
            {
                var subscriptionVersion = 0;
                var subscribertasks     = Enumerable.Range(0, threadCount).Select(ite => Task.Run(async() =>
                {
                    for (var i = 0; i < subscriptionCountPerThread; ++i)
                    {
                        var currentVersion = Interlocked.Increment(ref subscriptionVersion);
                        await _bus.SubscribeAsync(new SubscriptionRequest(new[] { new Subscription(MessageUtil.TypeId <FakeRoutableCommand>(), new BindingKey(currentVersion.ToString(), string.Empty)) })
                        {
                            ThereIsNoHandlerButIKnowWhatIAmDoing = true
                        }).ConfigureAwait(false);
                    }
                })).ToArray();

                Task.WaitAll(subscribertasks);
            }
Ejemplo n.º 27
0
 public void should_not_handle_generic_messages_with_more_than_one_generic_type()
 {
     Assert.Throws <InvalidOperationException>(() => MessageUtil.GetTypeId(typeof(GenericEvent <List <string> >)));
 }
        /// <summary>
        /// Create the interaction type
        /// </summary>
        public MARC.Everest.Interfaces.IInteraction Create(MARC.Everest.Interfaces.IInteraction request, RegistryQueryResult results, List <IResultDetail> dtls)
        {
            // GEt the config services
            ISystemConfigurationService configService = Context.GetService(typeof(ISystemConfigurationService)) as ISystemConfigurationService;

            var retHl7v3 = new List <MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.Subject1 <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Patient, object> >();
            //List<MARC.Everest.RMIM.CA.R020403.MFMI_MT700746CA.Subject2<MARC.Everest.RMIM.CA.R020403.PRPA_MT101104CA.IdentifiedEntity>> retHl7v3 = new List<MARC.Everest.RMIM.CA.R020403.MFMI_MT700746CA.Subject2<MARC.Everest.RMIM.CA.R020403.PRPA_MT101104CA.IdentifiedEntity>>(results.Results.Count());
            UvDeComponentUtil dCompUtil = new UvDeComponentUtil();

            dCompUtil.Context = this.Context;

            PRPA_IN201305UV02 rqst = request as PRPA_IN201305UV02;

            // Convert results to HL7v3
            foreach (RegistrationEvent res in results.Results)
            {
                var retRec = new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.Subject1 <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Patient, object>(
                    true,
                    dCompUtil.CreateRegistrationEvent(res, dtls)
                    );
                if (retRec.RegistrationEvent == null)
                {
                    retRec = new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.Subject1 <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Patient, object>(
                        false,
                        new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.RegistrationEvent <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Patient, object>()
                    {
                        NullFlavor = NullFlavor.NoInformation
                    }
                        );
                }
                retHl7v3.Add(retRec);
            }

            // HACK: Sort by confidence score (if present)
            //retHl7v3.Sort((a, b) =>
            //    a != null && b != null &&
            //    a.RegistrationEvent != null && b.RegistrationEvent != null &&
            //    a.RegistrationEvent.Subject1 != null && b.RegistrationEvent.Subject1 != null &&
            //    a.RegistrationEvent.Subject1.registeredRole != null && b.RegistrationEvent.Subject1.registeredRole != null &&
            //    (a.RegistrationEvent.Subject1.registeredRole.SubjectOf1.Count > 0) && (b.RegistrationEvent.Subject1.registeredRole.SubjectOf1.Count > 0) ?
            //    (b.RegistrationEvent.Subject1.registeredRole.SubjectOf1[0].QueryMatchObservation.Value as INT).CompareTo((a.RegistrationEvent.Subject1.registeredRole.SubjectOf1[0].QueryMatchObservation.Value as INT)) : 0);

            // Create the response
            PRPA_IN201306UV02 response = new PRPA_IN201306UV02
                                         (
                Guid.NewGuid(),
                DateTime.Now,
                PRPA_IN201306UV02.GetInteractionId(),
                ProcessingID.Production,
                "T",
                AcknowledgementCondition.Never,
                MessageUtil.CreateReceiver(rqst.Sender),
                MessageUtil.CreateSenderUv(new Uri(rqst.Receiver[0].Telecom.Value), configService),
                null
                                         )
            {
                Acknowledgement = new List <MARC.Everest.RMIM.UV.NE2008.MCCI_MT100300UV01.Acknowledgement>()
                {
                    new MARC.Everest.RMIM.UV.NE2008.MCCI_MT100300UV01.Acknowledgement(
                        dtls.Count(a => a.Type == ResultDetailType.Error) == 0 ? AcknowledgementType.ApplicationAcknowledgementAccept : AcknowledgementType.ApplicationAcknowledgementError,
                        new MARC.Everest.RMIM.UV.NE2008.MCCI_MT100200UV01.TargetMessage(request.Id)
                        )
                }
            };

            response.controlActProcess = new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.ControlActProcess <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201306UV02.QueryByParameter, MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Patient, object>("EVN")
            {
                Id       = SET <II> .CreateSET(new II(configService.Custodianship.Id.Domain, Guid.NewGuid().ToString())),
                Code     = new CD <string>(PRPA_IN201306UV02.GetTriggerEvent().Code, PRPA_IN201306UV02.GetTriggerEvent().CodeSystem),
                QueryAck = new MARC.Everest.RMIM.UV.NE2008.QUQI_MT120001UV01.QueryAck(
                    rqst.controlActProcess.queryByParameter.QueryId,
                    "complete",
                    (AcknowledgementType)response.Acknowledgement[0].TypeCode == AcknowledgementType.ApplicationAcknowledgementError ? QueryResponse.ApplicationError : results.TotalResults == 0 ? QueryResponse.NoDataFound : QueryResponse.DataFound,
                    results.TotalResults,
                    results.Results.Count,
                    results.TotalResults - results.Results.Count - results.StartRecordNumber
                    ),
                queryByParameter = rqst.controlActProcess.queryByParameter
            };

            response.controlActProcess.LanguageCode = MessageUtil.GetDefaultLanguageCode(this.Context);

            if (retHl7v3.Count > 0)
            {
                response.controlActProcess.Subject.AddRange(retHl7v3);
            }
            return(response);
        }
Ejemplo n.º 29
0
        private void sbtnPageUp_Click(object sender, EventArgs e)
        {
            try
            {
                sbtnPageDown.Enabled = false;
                sbtnPageUp.Enabled   = false;
                if (iShowEnd >= iPageSizes)
                {
                    int iTemp = iShowEnd % iPageSizes;
                    if (iTemp == 0)
                    {
                        iShowEnd -= iPageSizes;
                    }
                    else
                    {
                        iShowEnd -= iTemp;
                    }
                }
                if (iShowStart >= iPageSizes)
                {
                    iShowStart -= iPageSizes;
                }
                if (iShowEnd > iAllCount)
                {
                    iShowEnd = iAllCount;
                }

                dtPage.Rows.Clear();
                for (int i = iShowStart; i < iShowEnd; i++)
                {
                    DataRow dr = dtPage.NewRow();//tb_RecordEvent ID,Area,Type,Addr,EventContent,Time
                    dr[0] = dtRecord.Rows[i]["ID"].ToString();
                    dr[1] = dtRecord.Rows[i]["ToolType"].ToString();
                    dr[2] = dtRecord.Rows[i]["ToolName"].ToString();
                    dr[3] = dtRecord.Rows[i]["ToolID"].ToString();
                    dr[4] = dtRecord.Rows[i]["PeopleBorrow"].ToString();
                    dr[5] = dtRecord.Rows[i]["BorrowTime"].ToString();
                    dr[6] = dtRecord.Rows[i]["IsReturn"].ToString();
                    dr[7] = dtRecord.Rows[i]["PeopleReturn"].ToString();
                    dr[8] = dtRecord.Rows[i]["ReturnTime"].ToString();
                    dr[9] = dtRecord.Rows[i]["BorrowDuration"].ToString();
                    dtPage.Rows.Add(dr);
                }
                gridControl1.DataSource = dtPage;
                if (iShowStart >= iPageSizes)
                {
                    sbtnPageUp.Enabled = true;
                }
                if (iAllCount > iShowEnd)
                {
                    sbtnPageDown.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                if (frmMain.blDebug)
                {
                    MessageUtil.ShowTips(ex.Message);
                }
            }
        }
Ejemplo n.º 30
0
        public async Task should_specify_datetime_kind_when_removing_subscriptions_for_a_type()
        {
            var subscriptionsForTypes = new[] { new SubscriptionsForType(MessageUtil.GetTypeId(typeof(int))) };
            await _peerDirectory.RegisterAsync(_bus, _self, new[] { Subscription.Any <FakeCommand>() });

            await _peerDirectory.UpdateSubscriptionsAsync(_bus, subscriptionsForTypes);

            _repositoryMock.Verify(repo => repo.RemoveDynamicSubscriptionsForTypes(_self.Id, It.Is <DateTime>(date => date.Kind == DateTimeKind.Utc), new[] { MessageUtil.GetTypeId(typeof(int)) }));
        }