private bool ExistsSameDetail(out string strMsg)
        {
            bool bolExists = false;

            strMsg = "";
            List <string> lstVerify = new List <string>();

            foreach (DataGridViewRow dgvr in this.grdMain.Rows)
            {
                long   lItemID        = LBConverter.ToInt64(dgvr.Cells["ItemID"].Value);
                long   lCarID         = LBConverter.ToInt64(dgvr.Cells["CarID"].Value);
                int    iCalculateType = LBConverter.ToInt32(dgvr.Cells["CalculateType"].Value);
                string strKey         = lItemID.ToString() + "-" + lCarID.ToString() + "-" + iCalculateType.ToString();
                if (!lstVerify.Contains(strKey))
                {
                    lstVerify.Add(strKey);
                }
                else
                {
                    if (strMsg != "")
                    {
                        strMsg += "\n";
                    }
                    strMsg   += "第" + (dgvr.Index + 1) + "行,存在重复的数据行!";
                    bolExists = true;
                }
            }
            return(bolExists);
        }
Пример #2
0
        private void btnPrintOutBill_Click(object sender, EventArgs e)
        {
            try
            {
                //允许补打磅单次数
                int iAllowPrintOutReportCount;
                SysConfigValue.GetSysConfig("AllowPrintOutReportCount", out iAllowPrintOutReportCount);

                if (iAllowPrintOutReportCount == 0)
                {
                    throw new Exception("系统设置不允许补打磅单!");
                }

                if (mlSaleCarOutBillID == 0)
                {
                    throw new Exception("请选择需要补打的数据行!");
                }

                DataTable dtOut = ExecuteSQL.CallView(124, "OutPrintCount", "SaleCarOutBillID=" + this.mlSaleCarOutBillID, "");
                if (dtOut.Rows.Count > 0)
                {
                    int iOutPrintCount = LBConverter.ToInt32(dtOut.Rows[0]["OutPrintCount"]);
                    if (iOutPrintCount >= iAllowPrintOutReportCount + 1)
                    {
                        throw new Exception("补打次数已超出系统设置的次数!");
                    }
                }

                LBPreviceReport.PreviceReport(mlSaleCarOutBillID, enWeightType.WeightOut, enRequestReportActionType.DirectPrint);
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Пример #3
0
        /// <summary>
        /// 读取控件参数值
        /// </summary>
        private void ReadFieldValue()
        {
            if (mlBackUpConfigID > 0)
            {
                DataTable dtBackUp = ExecuteSQL.CallView(108, "", "BackUpConfigID=" + mlBackUpConfigID, "");
                if (dtBackUp.Rows.Count > 0)
                {
                    DataRow drBackUp          = dtBackUp.Rows[0];
                    int     iBackUpType       = LBConverter.ToInt32(drBackUp["BackUpType"]);
                    int     iBackUpWeek       = LBConverter.ToInt32(drBackUp["BackUpWeek"]);
                    int     iBackUpHour       = LBConverter.ToInt32(drBackUp["BackUpHour"]);
                    int     iBackUpMinu       = LBConverter.ToInt32(drBackUp["BackUpMinu"]);
                    bool    bolIsEffect       = LBConverter.ToBoolean(drBackUp["IsEffect"]);
                    int     iBackUpFileMaxNum = LBConverter.ToInt32(drBackUp["BackUpFileMaxNum"]);
                    string  strBackUpPath     = LBConverter.ToString(drBackUp["BackUpPath"]);
                    string  strBackUpName     = LBConverter.ToString(drBackUp["BackUpName"]);

                    this.txtBackUpFileMaxNum.Text    = iBackUpFileMaxNum.ToString();
                    this.txtBackUpHour.Text          = iBackUpHour.ToString();
                    this.txtBackUpMinu.Text          = iBackUpMinu.ToString();
                    this.txtBackUpWeek.SelectedValue = iBackUpWeek;
                    this.txtBackUpType.SelectedValue = iBackUpType;
                    this.txtBackUpName.Text          = strBackUpName;
                    this.chkIsEffect.Checked         = bolIsEffect;
                }
            }
        }
Пример #4
0
        private void ReadFieldValue()
        {
            DataTable dtCamera = ExecuteSQL.CallView(122, "", "MachineName='" + LoginInfo.MachineName + "'", "");

            if (dtCamera.Rows.Count > 0)
            {
                DataRow dr = dtCamera.Rows[0];
                this.txtIP1.Text       = dr["IPAddress1"].ToString().TrimEnd();
                this.txtPort1.Text     = LBConverter.ToInt32(dr["Port1"]).ToString();
                this.txtAccount1.Text  = dr["Account1"].ToString().TrimEnd();
                this.txtPassword1.Text = dr["Password1"].ToString().TrimEnd();
                this.txtIP2.Text       = dr["IPAddress2"].ToString().TrimEnd();
                this.txtPort2.Text     = LBConverter.ToInt32(dr["Port2"]).ToString();
                this.txtAccount2.Text  = dr["Account2"].ToString().TrimEnd();
                this.txtPassword2.Text = dr["Password2"].ToString().TrimEnd();
                this.txtIP3.Text       = dr["IPAddress3"].ToString().TrimEnd();
                this.txtPort3.Text     = LBConverter.ToInt32(dr["Port3"]).ToString();
                this.txtAccount3.Text  = dr["Account3"].ToString().TrimEnd();
                this.txtPassword3.Text = dr["Password3"].ToString().TrimEnd();
                this.txtIP4.Text       = dr["IPAddress4"].ToString().TrimEnd();
                this.txtPort4.Text     = LBConverter.ToInt32(dr["Port4"]).ToString();
                this.txtAccount4.Text  = dr["Account4"].ToString().TrimEnd();
                this.txtPassword4.Text = dr["Password4"].ToString().TrimEnd();

                this.cbUserCamera1.Checked = LBConverter.ToBoolean(dr["UseCamera1"]);
                this.cbUserCamera2.Checked = LBConverter.ToBoolean(dr["UseCamera2"]);
                this.cbUserCamera3.Checked = LBConverter.ToBoolean(dr["UseCamera3"]);
                this.cbUserCamera4.Checked = LBConverter.ToBoolean(dr["UseCamera4"]);
            }
        }
Пример #5
0
        private void SaveOutSalesPicture(object objSaleCarReturnBillID)
        {
            long lSaleCarReturnBillID = LBConverter.ToInt64(objSaleCarReturnBillID);

            try
            {
                CameraInfo cameraInfo = new CameraInfo();
                if (GetCameraEvent != null)
                {
                    GetCameraEvent(this, cameraInfo);
                }

                byte[] bImg1 = cameraInfo.Image1;
                byte[] bImg2 = cameraInfo.Image2;
                byte[] bImg3 = cameraInfo.Image3;
                byte[] bImg4 = cameraInfo.Image4;

                LBDbParameterCollection parmCol = new LBDbParameterCollection();
                parmCol.Add(new LBParameter("SaleCarReturnBillID", enLBDbType.Int64, lSaleCarReturnBillID));
                parmCol.Add(new LBParameter("MonitoreImg1", enLBDbType.Bytes, bImg1));
                parmCol.Add(new LBParameter("MonitoreImg2", enLBDbType.Bytes, bImg2));
                parmCol.Add(new LBParameter("MonitoreImg3", enLBDbType.Bytes, bImg3));
                parmCol.Add(new LBParameter("MonitoreImg4", enLBDbType.Bytes, bImg4));
                DataSet dsReturn;
                Dictionary <string, object> dictValue;
                ExecuteSQL.CallSP(30004, parmCol, out dsReturn, out dictValue);
            }
            catch (Exception ex)
            {
                LBErrorLog.InsertErrorLog("保存出场图片时报错,退货单号:" + lSaleCarReturnBillID.ToString() + "\n错误信息:" + ex.Message);
            }
        }
Пример #6
0
        /// <summary>
        /// 预览报表
        /// </summary>
        public static void OpenReportDialog(enRequestReportActionType eActionType, ReportRequestArgs reportRequestArgs)
        {
            ProcessStep.AddStep("OpenReportDialog_Start", DateTime.Now.ToString("MMdd HH:mm:ss ") + DateTime.Now.Millisecond);
            //DataRow drReportTemplateConfig = GetReportTemplateRow(reportRequestArgs.ReportTemplateID);
            int iPrintCount = 1;

            DataTable dtReport = ReportHelper.GetReportTemplateByID4Print(reportRequestArgs.ReportTemplateID);

            if (dtReport.Rows.Count > 0)
            {
                DataRow drReportTemplateConfig = dtReport.Rows[0];
                if (eActionType == enRequestReportActionType.DirectPrint)
                {
                    iPrintCount = LBConverter.ToInt32(drReportTemplateConfig["PrintCount"]);
                    if (iPrintCount <= 0)
                    {
                        iPrintCount = 1;
                    }
                }

                ProcessStep.AddStep("GetReportTemplateRow", DateTime.Now.ToString("MMdd HH:mm:ss ") + DateTime.Now.Millisecond);
                reportRequestArgs.ReportTemplateConfig = drReportTemplateConfig;

                for (int i = 0; i < iPrintCount; i++)
                {
                    ShowReport(eActionType, reportRequestArgs);
                }
            }
            ProcessStep.AddStep("ShowReport_End", DateTime.Now.ToString("MMdd HH:mm:ss ") + DateTime.Now.Millisecond);
        }
Пример #7
0
        public void DBItemBase_Insert(FactoryArgs args, out t_BigID ItemID, t_BigID ItemTypeID,
                                      out t_String ItemCode, t_String K3ItemCode, t_String ItemName, t_String ItemMode, t_Float ItemRate,
                                      t_BigID UOMID, t_String Description, t_Bool IsForbid, t_Decimal ItemPrice)
        {
            ItemCode = new t_String();

            t_String MaxCode;

            _DALDBItemBase.GetMaxCode(args, out MaxCode);
            int CodeIndex = MaxCode.Value == null ? 0 : LBConverter.ToInt32(MaxCode.Value.Replace("S", ""));

            CodeIndex++;
            if (CodeIndex < 10)
            {
                ItemCode.SetValueWithObject("S00" + CodeIndex.ToString());
            }
            else if (CodeIndex < 100)
            {
                ItemCode.SetValueWithObject("S0" + CodeIndex.ToString());
            }
            else
            {
                ItemCode.SetValueWithObject("S" + CodeIndex.ToString());
            }


            _DALDBItemBase.Insert(args, out ItemID, ItemTypeID, ItemCode, K3ItemCode, ItemName, ItemMode,
                                  ItemRate, UOMID, Description, IsForbid, ItemPrice);
        }
Пример #8
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                long   lUOMID     = 0;
                string strUOMName = "";
                if (grdMain.CurrentRow != null)
                {
                    DataRowView drv = grdMain.CurrentRow.DataBoundItem as DataRowView;
                    lUOMID     = LBConverter.ToInt64(drv["UOMID"]);
                    strUOMName = drv["UOMName"].ToString().TrimEnd();
                }
                if (lUOMID == 0)
                {
                    return;
                }

                if (LB.WinFunction.LBCommonHelper.ConfirmMessage("是否确认删除计量单位:" + strUOMName + "?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    LBDbParameterCollection parmCol = new LBDbParameterCollection();
                    parmCol.Add(new LBParameter("UOMID", enLBDbType.Int64, lUOMID));
                    DataSet dsReturn;
                    Dictionary <string, object> dictValue;
                    ExecuteSQL.CallSP(20202, parmCol, out dsReturn, out dictValue);
                    LoadDataSource();
                }
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Пример #9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                int    HeaderXType              = LBConverter.ToInt32(this.txtHeaderXType.SelectedValue);
                int    TailXType                = LBConverter.ToInt32(this.txtTailXType.SelectedValue);
                int    FailYType                = LBConverter.ToInt32(this.txtFailYType.SelectedValue);
                int    SuccessYType             = LBConverter.ToInt32(this.txtSuccessYType.SelectedValue);
                int    IsAlermEffect            = this.chkAlermEffect.Checked ? 1 : 0;
                int    IsHeaderEffect           = this.chkHeaderEffect.Checked ? 1 : 0;
                int    IsTailEffect             = this.chkTailEffect.Checked ? 1 : 0;
                string strSerialName            = this.txtSerialName.SelectedValue == null?"": this.txtSerialName.SelectedValue.ToString();
                LBDbParameterCollection parmCol = new LBDbParameterCollection();
                parmCol.Add(new LBParameter("HeaderXType", enLBDbType.Int32, HeaderXType));
                parmCol.Add(new LBParameter("TailXType", enLBDbType.Int32, TailXType));
                parmCol.Add(new LBParameter("SuccessYType", enLBDbType.Int32, SuccessYType));
                parmCol.Add(new LBParameter("FailYType", enLBDbType.Int32, FailYType));
                parmCol.Add(new LBParameter("IsHeaderEffect", enLBDbType.Boolean, IsHeaderEffect));
                parmCol.Add(new LBParameter("IsTailEffect", enLBDbType.Boolean, IsTailEffect));
                parmCol.Add(new LBParameter("IsAlermEffect", enLBDbType.Boolean, IsAlermEffect));
                parmCol.Add(new LBParameter("MachineName", enLBDbType.String, LoginInfo.MachineName));
                parmCol.Add(new LBParameter("SerialName", enLBDbType.String, strSerialName));
                DataSet dsReturn;
                Dictionary <string, object> dictValue;
                ExecuteSQL.CallSP(14500, parmCol, out dsReturn, out dictValue);

                LBInFrareHelper.InitSerialPort();
                LB.WinFunction.LBCommonHelper.ShowCommonMessage("保存成功!");
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Пример #10
0
 public void UnCancel(FactoryArgs args, t_BigID ReceiveBillHeaderID)
 {
     using (DataTable dtHeader = _DALRPReceiveBillHeader.GetRPReceiveBillHeader(args, ReceiveBillHeaderID))
     {
         if (dtHeader.Rows.Count > 0)
         {
             DataRow drHeader     = dtHeader.Rows[0];
             bool    bolIsApprove = LBConverter.ToBoolean(drHeader["IsApprove"]);
             bool    bolIsCancel  = LBConverter.ToBoolean(drHeader["IsCancel"]);
             if (bolIsApprove)
             {
                 throw new Exception("该充值单未审核,无法执行取消审核!");
             }
             if (!bolIsCancel)
             {
                 throw new Exception("该充值单已作废,无法执行取消审核!");
             }
         }
         else
         {
             throw new Exception("该充值单已删除,无法执行取消审核!");
         }
     }
     _DALRPReceiveBillHeader.UnCancel(args, ReceiveBillHeaderID);
 }
Пример #11
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtCardCode.Text.TrimEnd() == "")
                {
                    throw new Exception("【编辑卡片】不能为空!");
                }

                string strCrrentCardCode = LBCardHelper.ReadCardCode();
                if (strCrrentCardCode == "")
                {
                    throw new Exception("请将卡片放置读卡器上,否则无法保存!");
                }

                if (strCrrentCardCode != this.txtCardCode.Text)
                {
                    if (LB.WinFunction.LBCommonHelper.ConfirmMessage("当前设置的卡号为【" + strCrrentCardCode + "】,是否确认改写为【" + this.txtCardCode.Text + "】?", "提示", MessageBoxButtons.YesNo) ==
                        DialogResult.No)
                    {
                        return;
                    }
                    else
                    {
                        //将卡号写入卡片
                        string strMsg;
                        bool   bolSuccess = LBCardHelper.WriteCardCode(this.txtCardCode.Text, out strMsg);
                        if (!bolSuccess)
                        {
                            throw new Exception("卡号写入失败,失败原因:" + strMsg);
                        }
                    }
                }


                int iSPType = 20500;
                if (mlCardID > 0)
                {
                    iSPType = 20501;
                }

                LBDbParameterCollection parmCol = new LBDbParameterCollection();
                parmCol.Add(new LBParameter("CardID", enLBDbType.Int64, mlCardID));
                parmCol.Add(new LBParameter("CardName", enLBDbType.String, this.txtCardName.Text));
                parmCol.Add(new LBParameter("CardCode", enLBDbType.String, this.txtCardCode.Text));
                DataSet dsReturn;
                Dictionary <string, object> dictValue;
                ExecuteSQL.CallSP(iSPType, parmCol, out dsReturn, out dictValue);
                if (dictValue.ContainsKey("CardID"))
                {
                    mlCardID = LBConverter.ToInt64(dictValue["CardID"]);
                }
                LB.WinFunction.LBCommonHelper.ShowCommonMessage("保存成功!");
                SetButtonStatus();
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Пример #12
0
        //选择车辆触发事件
        private void CarTextBox_TextChanged(object sender, EventArgs e)
        {
            try
            {
                string  strCarNum           = this.txtCarID.TextBox.Text.ToString();
                long    lCarID              = 0;
                decimal decDefaultCarWeight = 0;
                #region -- 读取车辆ID号 --
                using (DataTable dtCar = ExecuteSQL.CallView(117, "CarID,SupplierID,DefaultCarWeight", "CarNum='" + strCarNum + "'", ""))
                {
                    if (dtCar.Rows.Count > 0)
                    {
                        lCarID = LBConverter.ToInt64(dtCar.Rows[0]["CarID"]);
                        decDefaultCarWeight = LBConverter.ToInt64(dtCar.Rows[0]["DefaultCarWeight"]);
                    }
                }
                #endregion -- 读取车辆ID号 --

                if (lCarID > 0)//如果存在该车辆
                {
                    this.txtCarTare.Text = LBConverter.ToString(decDefaultCarWeight);
                }
                else
                {
                    this.txtCarTare.Text = "";
                }
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Пример #13
0
        private void btnChangeBillInfoDirect_Click(object sender, EventArgs e)
        {
            try
            {
                using (DataTable dtBill = ExecuteSQL.CallView(123, "", "SaleCarInBillID=" + mlSaleCarInBillID, ""))
                {
                    if (dtBill.Rows.Count > 0)
                    {
                        DataRow drBill      = dtBill.Rows[0];
                        int     iBillStatus = LBConverter.ToInt32(drBill["BillStatus"]);
                        if (iBillStatus == 2)
                        {
                            throw new Exception("该磅单已审核,请先【取消审核】,然后再进行改单!");
                        }
                    }
                }

                btnChangeBillInfoDirect.Visible     = false;
                this.txtItemID.TextBox.ReadOnly     = false;
                this.txtCarID.TextBox.ReadOnly      = false;
                this.txtCustomerID.TextBox.ReadOnly = false;
                this.txtDescription.ReadOnly        = false;
                txtPrice.ReadOnly             = false;
                btnChangeBillInfoSave.Visible = true;

                this.btnApprove.Visible   = false;
                this.btnUnApprove.Visible = false;
                this.btnCancel.Visible    = false;
                this.btnUnCancel.Visible  = false;
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Пример #14
0
 private void GrdMain_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
         {
             if (_BillStatus == enBillStatus.Add || _BillStatus == enBillStatus.Edit)
             {
                 string strColumn = this.grdMain.Columns[e.ColumnIndex].DataPropertyName;
                 if (strColumn.Equals("CarNum"))
                 {
                     long        lCustomerID = LBConverter.ToInt64(this.txtCustomerID.TextBox.SelectedItemID);
                     frmCarQuery frmCar      = new frmCarQuery(lCustomerID);
                     LBShowForm.ShowDialog(frmCar);
                     DataRowView drv = this.grdMain.Rows[e.RowIndex].DataBoundItem as DataRowView;
                     if (frmCar.LstReturn.Count > 0)
                     {
                         if (drv.Row.RowState == DataRowState.Unchanged)
                         {
                             drv.Row.SetModified();
                         }
                         drv["CarNum"] = frmCar.LstReturn[0]["CarNum"];
                         drv["CarID"]  = frmCar.LstReturn[0]["CarID"];
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
     }
 }
Пример #15
0
        public void Update(FactoryArgs args, t_BigID ModifyBillHeaderID, t_BigID CustomerID,
                           t_DTSmall BillDate, t_DTSmall EffectDate, t_String Description)
        {
            using (DataTable dtCustomer = _DALModifyBillHeader.GetCustomerByID(args, CustomerID))
            {
                if (dtCustomer.Rows.Count == 0)
                {
                    throw new Exception("所选客户不存在,保存不成功!");
                }
            }

            using (DataTable dtHeader = _DALModifyBillHeader.GetModifyBillHeader(args, ModifyBillHeaderID))
            {
                DataRow drHeader     = dtHeader.Rows[0];
                bool    bolIsApprove = LBConverter.ToBoolean(drHeader["IsApprove"]);
                bool    bolIsCancel  = LBConverter.ToBoolean(drHeader["IsCancel"]);
                if (bolIsApprove)
                {
                    throw new Exception("该调价单已审核,无法保存修改!");
                }

                if (bolIsCancel)
                {
                    throw new Exception("该调价单已作废,无法保存修改!");
                }
            }

            _DALModifyBillHeader.Update(args, ModifyBillHeaderID, CustomerID, BillDate, EffectDate, Description);
        }
Пример #16
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                this.VerifyTextBoxIsEmpty();//校验控件是否为空

                int iSPType = 14700;
                if (mlChargeTypeID > 0)
                {
                    iSPType = 14701;
                }
                LBDbParameterCollection parmCol = new LBDbParameterCollection();
                parmCol.Add(new LBParameter("ChargeTypeID", enLBDbType.Int64, mlChargeTypeID));
                parmCol.Add(new LBParameter("ChargeTypeCode", enLBDbType.String, ""));
                parmCol.Add(new LBParameter("ChargeTypeName", enLBDbType.String, this.txtChargeTypeName.Text));

                DataSet dsReturn;
                Dictionary <string, object> dictValue;
                ExecuteSQL.CallSP(iSPType, parmCol, out dsReturn, out dictValue);
                if (dictValue.ContainsKey("ChargeTypeID"))
                {
                    mlChargeTypeID = LBConverter.ToInt64(dictValue["ChargeTypeID"]);
                }
                if (dictValue.ContainsKey("ChargeTypeCode"))
                {
                    this.txtChargeTypeCode.Text = dictValue["ChargeTypeCode"].ToString();
                }
                LB.WinFunction.LBCommonHelper.ShowCommonMessage("保存成功!");
                SetButtonStatus();
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Пример #17
0
        public void Delete(FactoryArgs args, t_BigID ModifyBillHeaderID)
        {
            using (DataTable dtHeader = _DALModifyBillHeader.GetModifyBillHeader(args, ModifyBillHeaderID))
            {
                DataRow drHeader     = dtHeader.Rows[0];
                bool    bolIsApprove = LBConverter.ToBoolean(drHeader["IsApprove"]);
                bool    bolIsCancel  = LBConverter.ToBoolean(drHeader["IsCancel"]);
                if (bolIsApprove)
                {
                    throw new Exception("该调价单已审核,无法删除!");
                }

                if (bolIsCancel)
                {
                    throw new Exception("该调价单已作废,无法删除!");
                }
            }

            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                using (DataTable dtDetail = _DALModifyBillDetail.GetModifyBillDetailByHeaderID(argsInTrans, ModifyBillHeaderID))
                {
                    foreach (DataRow dr in dtDetail.Rows)
                    {
                    }
                }
                _DALModifyBillHeader.Delete(argsInTrans, ModifyBillHeaderID);
            };
            DBHelper.ExecInTrans(args, exec);
        }
Пример #18
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                int    iReadSerialBaud          = LBConverter.ToInt32(this.txtReadSerialBaud.Text);
                string strReadSerialName        = this.txtReadSerialName.SelectedValue == null?"": this.txtReadSerialName.SelectedValue.ToString();
                string strWriteSerialName       = this.txtWriteSerialName.SelectedValue == null ? "" : this.txtWriteSerialName.SelectedValue.ToString();
                LBDbParameterCollection parmCol = new LBDbParameterCollection();
                parmCol.Add(new LBParameter("ReadCardSerialCOM", enLBDbType.String, strReadSerialName));
                parmCol.Add(new LBParameter("WriteCardSerialCOM", enLBDbType.String, strWriteSerialName));
                parmCol.Add(new LBParameter("ReadCardBaud", enLBDbType.Int32, iReadSerialBaud));
                parmCol.Add(new LBParameter("MachineName", enLBDbType.String, LoginInfo.MachineName));
                parmCol.Add(new LBParameter("UseReadCard", enLBDbType.Int32, (this.cbUseReadCard.Checked?1:0)));
                parmCol.Add(new LBParameter("UseWriteCard", enLBDbType.Int32, (this.cbUseWriteCard.Checked ? 1 : 0)));
                parmCol.Add(new LBParameter("ConnectType", enLBDbType.Int32, (this.rbNet.Checked ? 1 : 0)));
                parmCol.Add(new LBParameter("IPAddress", enLBDbType.String, this.txtIPAddress.Text));
                parmCol.Add(new LBParameter("IPPort", enLBDbType.Int32, LBConverter.ToInt32(this.txtPort.Text)));
                DataSet dsReturn;
                Dictionary <string, object> dictValue;
                ExecuteSQL.CallSP(20503, parmCol, out dsReturn, out dictValue);

                LBCardHelper.StartSerial(enCardType.ReadCard);
                LB.WinFunction.LBCommonHelper.ShowCommonMessage("保存成功!");
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Пример #19
0
        private static void SetPrintSettings(FastReport.Report report, long lReportTemplateID)
        {
            DataRow   drReport         = null;
            DataTable dtReportTemplate = ReportHelper.GetReportTemplateByID(lReportTemplateID);

            if (dtReportTemplate.Rows.Count > 0)
            {
                drReport = dtReportTemplate.Rows[0];
            }
            //DataTable dtReportTemplate = ExecuteSQL.CallView(105, "", "ReportTemplateID=" + lReportTemplateID, "");
            if (drReport != null)
            {
                //DataRow drReport = dtReportTemplate.Rows[0];
                string strPrinterName    = drReport["PrinterName"].ToString().TrimEnd();
                string strPaperType      = drReport["PaperType"].ToString().TrimEnd();
                int    PaperSizeHeight   = LBConverter.ToInt32(drReport["PaperSizeHeight"]);
                int    PaperSizeWidth    = LBConverter.ToInt32(drReport["PaperSizeWidth"]);
                bool   IsManualPaperType = LBConverter.ToBoolean(drReport["IsManualPaperType"]); //自动识别纸张类型
                bool   IsManualPaperSize = LBConverter.ToBoolean(drReport["IsManualPaperSize"]); //自动识别纸张大小
                bool   IsPaperTransverse = LBConverter.ToBoolean(drReport["IsPaperTransverse"]); //是否纵向打印

                if (strPrinterName != "")
                {
                    report.PrintSettings.Printer = strPrinterName;
                }
            }
        }
Пример #20
0
 private void SetReceiveTypeVisible()
 {
     ReceiveType = LBConverter.ToInt32(this.txtReceiveType.SelectedValue);
     if (ReceiveType == 0)//现金
     {
         lblPayAmount.Visible = this.txtPayAmount.Visible = this.lblNeedPay.Visible = this.lblNeedPayAmount.Visible = false;
     }
     else if (ReceiveType == 1)//预付
     {
         lblPayAmount.Visible = this.txtPayAmount.Visible = true;
         if (decAmount - decCustomerLeftAmount > 0)
         {
             this.lblNeedPayAmount.Text = (decAmount - decCustomerLeftAmount).ToString("0.00");
             this.lblNeedPay.Visible    = this.lblNeedPayAmount.Visible = true;
         }
         else
         {
             this.lblNeedPay.Visible = this.lblNeedPayAmount.Visible = false;
         }
     }
     else if (ReceiveType == 2)//挂账
     {
         lblPayAmount.Visible = this.txtPayAmount.Visible = this.lblNeedPay.Visible = this.lblNeedPayAmount.Visible = false;
     }
 }
Пример #21
0
        private void btnReturn_Click(object sender, EventArgs e)
        {
            try
            {
                this.grdMain.EndEdit();
                this.grdMain.CurrentCell = null;
                foreach (DataGridViewRow dgvr in this.grdMain.Rows)
                {
                    bool bolSelected = LBConverter.ToBoolean(dgvr.Cells["LBSelected"].Value);
                    if (bolSelected)
                    {
                        DataRowView drv = dgvr.DataBoundItem as DataRowView;
                        LstReturn.Add(drv.Row);
                    }
                }

                if (LstReturn.Count == 0)
                {
                    throw new Exception("请选择有效的物料行!");
                }
                this.Close();
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Пример #22
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                IsSubmit    = true;
                ReceiveType = LBConverter.ToInt32(this.txtReceiveType.SelectedValue);
                decimal decPayAmount = 0; //充值金额
                if (ReceiveType == 0)     //现金
                {
                    decPayAmount = decAmount;
                }
                else if (ReceiveType == 1)//预付
                {
                    decimal.TryParse(this.txtPayAmount.Text, out decPayAmount);
                }
                else if (ReceiveType == 2)//挂账
                {
                    decimal.TryParse(this.txtPayAmount.Text, out decPayAmount);
                }

                if (decPayAmount > 0)
                {
                    CustomerPayAmount = decPayAmount;
                }

                this.Close();
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Пример #23
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            try
            {
                MainHelper.SetArgsValue(args);

                //args = new string[3];
                //args[0] = "ActionType=0";
                //args[1] = "Url=http://localhost:3060/LRB";
                //args[2] = "CardID=0";

                string       strActionType = MainHelper.GetValue("ActionType");
                int          iActionType   = LBConverter.ToInt32(strActionType);
                enActionType actionType    = (enActionType)iActionType;

                RemotingObject.DefaultIPAddress = MainHelper.GetValue("Url");
                if (actionType == enActionType.CardEdit)
                {
                    long lCardID = LBConverter.ToInt64(MainHelper.GetValue("CardID"));
                    Application.Run(new frmCardEdit(lCardID));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            //Application.Run(new MainForm());
        }
Пример #24
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                int WeightType = LBConverter.ToInt32(this.txtWeightType.SelectedValue);;

                LBDbParameterCollection parmCol = new LBDbParameterCollection();
                parmCol.Add(new LBParameter("WeightType", enLBDbType.Int32, WeightType));
                parmCol.Add(new LBParameter("MachineName", enLBDbType.String, LoginInfo.MachineName));
                DataSet dsReturn;
                Dictionary <string, object> dictValue;
                ExecuteSQL.CallSP(14200, parmCol, out dsReturn, out dictValue);

                if (_OrgWeightType != WeightType)
                {
                    IsChangeWeightType = true;
                    LB.WinFunction.LBCommonHelper.ShowCommonMessage("保存成功!修改后需要注销并重新登录系统!");
                    this.Close();
                }
                else
                {
                    LB.WinFunction.LBCommonHelper.ShowCommonMessage("保存成功!");
                }
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Пример #25
0
        private void CalWeight()
        {
            decimal decTotalWeight = LBConverter.ToDecimal(this.txtTotalWeight.Text);
            decimal decCarTare     = LBConverter.ToDecimal(this.txtCarTare.Text);

            this.txtSuttleWeight.Text = (decTotalWeight - decCarTare).ToString("0");
        }
Пример #26
0
        private void ReadFieldValue()
        {
            if (mlReceiveBillHeaderID > 0)
            {
                DataTable dtHeader = ExecuteSQL.CallView(111, "", "ReceiveBillHeaderID=" + mlReceiveBillHeaderID, "");
                if (dtHeader.Rows.Count > 0)
                {
                    DataRow drHeader                    = dtHeader.Rows[0];
                    bool    bolIsApprove                = LBConverter.ToBoolean(drHeader["IsApprove"]);
                    bool    bolIsCancel                 = LBConverter.ToBoolean(drHeader["IsCancel"]);
                    decimal decReceiveAmount            = LBConverter.ToDecimal(drHeader["ReceiveAmount"]);
                    decimal decSalesReceiveAmountAdd    = LBConverter.ToDecimal(drHeader["SalesReceiveAmountAdd"]);
                    decimal decSalesReceiveAmountReduce = LBConverter.ToDecimal(drHeader["SalesReceiveAmountReduce"]);
                    decimal decOriginalAmount           = LBConverter.ToDecimal(drHeader["OriginalAmount"]);
                    this.txtBillDate.Text   = LBConverter.ToString(drHeader["BillDate"]);
                    this.txtBillStatus.Text = bolIsApprove?"已审核":
                                              (bolIsCancel?"已作废":("未审核"));
                    this.txtCustomerID.TextBox.SelectedItemID = drHeader["CustomerID"].ToString();
                    this.txtDescription.Text     = drHeader["Description"].ToString();
                    this.txtReceiveAmount.Text   = decReceiveAmount.ToString("N0");
                    this.txtReceiveBillCode.Text = drHeader["ReceiveBillCode"].ToString();

                    this.txtChangedBy.Text   = drHeader["ChangedBy"].ToString();
                    this.txtChangeTime.Text  = drHeader["ChangeTime"].ToString();
                    this.txtApproveBy.Text   = drHeader["ApproveBy"].ToString();
                    this.txtApproveTime.Text = drHeader["ApproveTime"].ToString();
                    this.txtCancelBy.Text    = drHeader["CancelBy"].ToString();
                    this.txtCancelTime.Text  = drHeader["CancelTime"].ToString();
                    this.txtRPReceiveType.TextBox.SelectedItemID = drHeader["ChargeTypeID"];
                    this.txtReceiveBankID.TextBox.SelectedItemID = drHeader["ReceiveBankID"];
                }
            }
        }
Пример #27
0
 private void btnDeleteItemType_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.tvReportType.SelectedNode == null || this.tvReportType.SelectedNode.Tag == null)
         {
             return;
         }
         DataRow dr          = this.tvReportType.SelectedNode.Tag as DataRow;
         long    lItemTypeID = LBConverter.ToInt64(dr["ReportViewID"]);
         if (LB.WinFunction.LBCommonHelper.ConfirmMessage("是否确认删除改决策分析报表?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             if (lItemTypeID > 0)
             {
                 LBDbParameterCollection parmCol = new LBDbParameterCollection();
                 parmCol.Add(new LBParameter("ReportViewID", enLBDbType.Int64, lItemTypeID));
                 DataSet dsReturn;
                 Dictionary <string, object> dictValue;
                 ExecuteSQL.CallSP(14402, parmCol, out dsReturn, out dictValue);
             }
             BuildTree();
         }
     }
     catch (Exception ex)
     {
         LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
     }
 }
Пример #28
0
        private long SaveInBill()
        {
            long lCarID       = LBConverter.ToInt64(this.txtCarID.TextBox.SelectedItemID);
            long lItemID      = LBConverter.ToInt64(this.txtItemID.TextBox.SelectedItemID);
            long lCustomerID  = LBConverter.ToInt64(this.txtCustomerID.TextBox.SelectedItemID);
            int  iReceiveType = 1;

            using (DataTable dtCustomer = ExecuteSQL.CallView(112, "CustomerID,ReceiveType,TotalReceivedAmount,SalesReceivedAmount", "CustomerID=" + lCustomerID.ToString(), ""))
            {
                if (dtCustomer.Rows.Count > 0)
                {
                    lCustomerID = LBConverter.ToInt64(dtCustomer.Rows[0]["CustomerID"]);
                    //客户收款方式
                    iReceiveType = LBConverter.ToInt32(dtCustomer.Rows[0]["ReceiveType"]);
                }
            }

            Dictionary <string, double> dictTest = new Dictionary <string, double>();
            DateTime dt1 = DateTime.Now;
            DateTime dt2 = DateTime.Now;
            long     lSaleCarInBillID = 0;

            int     iCalculateType = LBConverter.ToInt32(this.txtCalculateType.SelectedValue);
            decimal decCarTare     = LBConverter.ToDecimal(this.txtCarTare.Text);
            string  strBillDateIn  = Convert.ToDateTime(this.txtBillDateIn.Text).ToString("yyyy-MM-dd") + " " +
                                     Convert.ToDateTime(this.txtBillTimeIn.Text).ToString("HH:mm:ss");

            if (decCarTare == 0)
            {
                throw new Exception("当前【皮重】值为0,无法保存!");
            }

            LBDbParameterCollection parmCol = new LBDbParameterCollection();

            parmCol.Add(new LBParameter("SaleCarInBillID", enLBDbType.Int64, 0));
            parmCol.Add(new LBParameter("SaleCarInBillCode", enLBDbType.String, ""));
            parmCol.Add(new LBParameter("BillDate", enLBDbType.DateTime, Convert.ToDateTime(strBillDateIn)));
            parmCol.Add(new LBParameter("CarID", enLBDbType.Int64, lCarID));
            parmCol.Add(new LBParameter("ItemID", enLBDbType.Int64, lItemID));
            parmCol.Add(new LBParameter("CustomerID", enLBDbType.Int64, lCustomerID));
            parmCol.Add(new LBParameter("Description", enLBDbType.String, this.txtAddReason.Text));
            parmCol.Add(new LBParameter("ReceiveType", enLBDbType.Int32, iReceiveType));
            parmCol.Add(new LBParameter("CalculateType", enLBDbType.Int32, iCalculateType));
            parmCol.Add(new LBParameter("CarTare", enLBDbType.Decimal, decCarTare));

            DataSet dsReturn;
            Dictionary <string, object> dictValue;

            ExecuteSQL.CallSP(14100, parmCol, out dsReturn, out dictValue);
            if (dictValue.ContainsKey("SaleCarInBillID"))
            {
                lSaleCarInBillID = LBConverter.ToInt64(dictValue["SaleCarInBillID"]);
            }
            if (dictValue.ContainsKey("SaleCarInBillCode"))
            {
                this.txtSaleCarInBillCode.Text = dictValue["SaleCarInBillCode"].ToString();
            }

            return(lSaleCarInBillID);
        }
Пример #29
0
        /// <summary>
        /// 读取控件参数值
        /// </summary>
        private void ReadFieldValue()
        {
            if (mlItemID > 0)
            {
                DataTable dtBackUp = ExecuteSQL.CallView(203, "", "ItemID=" + mlItemID, "");
                if (dtBackUp.Rows.Count > 0)
                {
                    DataRow dr             = dtBackUp.Rows[0];
                    string  strItemCode    = LBConverter.ToString(dr["ItemCode"]);
                    string  strK3ItemCode  = LBConverter.ToString(dr["K3ItemCode"]);
                    string  strItemName    = LBConverter.ToString(dr["ItemName"]);
                    string  strItemMode    = LBConverter.ToString(dr["ItemMode"]);
                    decimal dItemRate      = LBConverter.ToDecimal(dr["ItemRate"]);
                    long    lUOMID         = LBConverter.ToInt32(dr["UOMID"]);
                    long    lItemTypeID    = LBConverter.ToInt32(dr["ItemTypeID"]);
                    string  strDescription = LBConverter.ToString(dr["Description"]);
                    bool    bIsForbid      = LBConverter.ToBoolean(dr["IsForbid"]);
                    decimal decprice       = LBConverter.ToDecimal(dr["ItemPrice"]);

                    this.txtK3ItemCode.Text          = strK3ItemCode;
                    this.txtItemCode.Text            = strItemCode;
                    this.txtItemName.Text            = strItemName;
                    this.txtItemMode.Text            = strItemMode;
                    this.txtItemRate.Text            = dItemRate.ToString();
                    this.txtUOMID.SelectedValue      = lUOMID;
                    this.txtItemTypeID.SelectedValue = lItemTypeID;
                    this.txtDescription.Text         = strDescription;
                    this.chkIsForbid.Checked         = bIsForbid;
                    this.txtPrice.Text = decprice.ToString("0.000");
                }
            }
        }
        private void btnApprove_Click(object sender, EventArgs e)
        {
            try
            {
                List <DataRow> lstSelected = ReadSelectedRows();

                int iIsSynCount = 0;
                foreach (DataRow dr in lstSelected)
                {
                    if (LBConverter.ToBoolean(dr["IsSynchronousToK3OutBill"]) || LBConverter.ToBoolean(dr["IsSynchronousToK3Receive"]))
                    {
                        iIsSynCount++;
                    }
                }

                bool bolIsReSynBill = false;
                if (iIsSynCount > 0)
                {
                    if (LB.WinFunction.LBCommonHelper.ConfirmMessage("选中的单据中存在已同步过的单据,是否继续同步?", "提示", MessageBoxButtons.OKCancel)
                        == DialogResult.OK)
                    {
                        bolIsReSynBill = true;
                    }
                }

                frmSynK3Process frmProcess = new frmSynK3Process(lstSelected, _SynType, bolIsReSynBill);
                LBShowForm.ShowDialog(frmProcess);
                this.LoadAllSalesBill();
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }