Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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");
                }
            }
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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;
                }
            }
        }
Ejemplo n.º 6
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"]);
            }
        }
Ejemplo n.º 7
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);
            }
        }
Ejemplo n.º 8
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());
        }
Ejemplo n.º 9
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);
            }
        }
Ejemplo n.º 10
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);
            }
        }
Ejemplo n.º 11
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;
     }
 }
Ejemplo n.º 12
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);
            }
        }
Ejemplo n.º 13
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);
            }
        }
Ejemplo n.º 14
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;
                }
            }
        }
Ejemplo n.º 15
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);
        }
Ejemplo n.º 16
0
        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);
        }
Ejemplo n.º 17
0
        private void ReadFeildValue()
        {
            string    strFilter = "SaleCarInBillID=" + mlSaleCarInBillID;
            DataTable dtBill    = ExecuteSQL.CallView(125, "", strFilter, "");

            if (dtBill.Rows.Count > 0)
            {
                DataRow drBill = dtBill.Rows[0];
                _drBillInfo                     = drBill;
                mlSaleCarOutBillID              = LBConverter.ToInt64(drBill["SaleCarOutBillID"]);
                this.lblBillDateIn.Text         = drBill["BillDateIn"].ToString().TrimEnd();
                this.lblBillDateOut.Text        = drBill["BillDateOut"].ToString().TrimEnd();
                this.txtSaleCarInBillCode.Text  = drBill["SaleCarInBillCode"].ToString().TrimEnd();
                this.txtSaleCarOutBillCode.Text = drBill["SaleCarOutBillCode"].ToString().TrimEnd();

                this.txtCalculateType.SelectedValue = drBill["CalculateType"];
                this.txtItemID.TextBox.Text         = drBill["ItemName"].ToString();
                this.txtCustomerID.TextBox.Text     = drBill["CustomerName"].ToString();
                this.txtCarID.TextBox.Text          = drBill["CarNum"].ToString();
                this.txtCarTare.Text              = drBill["CarTare"].ToString();
                this.txtDescription.Text          = drBill["Description"].ToString();
                this.txtReceiveType.SelectedValue = drBill["ReceiveType"];
                //this.txtSaleCarInBillID.Text = drv["SaleCarInBillID"].ToString().TrimEnd();
                //this.txtBillStatus.SelectedValue = drBill["BillStatus"];

                int iCalculateType = LBConverter.ToInt32(drBill["CalculateType"]);
                this.txtTotalWeight.Text  = drBill["TotalWeight"].ToString();
                this.txtCarTare.Text      = drBill["CarTare"].ToString();
                this.txtSuttleWeight.Text = drBill["SuttleWeight"].ToString();
                this.txtPrice.Text        = drBill["Price"].ToString();
                this.txtAmount.Text       = drBill["Amount"].ToString();
                this.lblPriceQty.Text     = iCalculateType == 0 ?
                                            drBill["SuttleWeight"].ToString() + "KG": "1 车";

                BillStatusStyle(
                    LBConverter.ToBoolean(drBill["IsCancel"]),
                    drBill["CancelBy"].ToString(),
                    drBill["CancelTime"].ToString(),
                    drBill["CancelDesc"].ToString(),
                    LBConverter.ToInt32(drBill["BillStatus"]));

                Thread thread = new Thread(ReadMonitoreImg);
                thread.Start();

                //读取退货单信息
                DataTable dtReturn = ExecuteSQL.CallView(137, "", strFilter, "");
                if (dtReturn.Rows.Count == 0)
                {
                    this.tabControl1.TabPages.Remove(this.tpReturnIn);
                    this.tabControl1.TabPages.Remove(this.tpReturnOut);
                }
                else
                {
                    long lSaleCarReturnBillID = LBConverter.ToInt64(dtReturn.Rows[0]["SaleCarReturnBillID"]);
                    thread = new Thread(ReadReturnImg);
                    thread.Start(lSaleCarReturnBillID);
                }
            }
        }
Ejemplo n.º 18
0
        private void SetFieldValue()
        {
            DataTable dtDesc = ExecuteSQL.CallView(126, "", "MachineName='" + LoginInfo.MachineName + "'", "");

            if (dtDesc.Rows.Count > 0)
            {
                this.txtWeightType.SelectedValue = dtDesc.Rows[0]["WeightType"];
                _OrgWeightType = LBConverter.ToInt32(dtDesc.Rows[0]["WeightType"]);
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 读取客户最新的物料价格
        /// </summary>
        /// <param name="args"></param>
        /// <param name="CustomerID"></param>
        public void GetCustomerLastItemPrice(FactoryArgs args, t_BigID CustomerID)
        {
            DataTable dtResult;
            Dictionary <string, DataRow> dictResult = new Dictionary <string, DataRow>();

            using (DataTable dtModify = _DALModifyBillHeader.GetModifyBillHeaderByCustomer(args, CustomerID))
            {
                dtResult = dtModify.Clone();
                foreach (DataRow dr in dtModify.Rows)
                {
                    long lItemID        = LBConverter.ToInt64(dr["ItemID"]);
                    long lCarID         = LBConverter.ToInt64(dr["CarID"]);
                    int  iCalculateType = LBConverter.ToInt32(dr["CalculateType"]);

                    string strKey = lItemID.ToString() + "-" + lCarID.ToString() + "-" + iCalculateType.ToString();//唯一标识的主键
                    if (!dictResult.ContainsKey(strKey))
                    {
                        dictResult.Add(strKey, dr);
                    }
                    else
                    {
                        DateTime dtEffectDate = Convert.ToDateTime(dr["EffectDate"]);
                        DateTime dtNow        = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));
                        if (dtEffectDate.Subtract(dtNow).TotalDays <= 0)//调价生效日期比当前日期前,则生效
                        {
                            DataRow  drValue         = dictResult[strKey];
                            DateTime dtCurEffectDate = Convert.ToDateTime(drValue["EffectDate"]);

                            double dDiffDays = dtEffectDate.Subtract(dtCurEffectDate).TotalDays; //日期对比
                            if (dDiffDays > 0)                                                   //有更加新的生效日期,则将最新的记录替换旧的记录
                            {
                                dictResult[strKey] = dr;
                            }
                            else if (dDiffDays == 0)//如果两个日期一样,则对比审核时间,优先考虑最近的审核时间
                            {
                                DateTime dtApproveTime    = Convert.ToDateTime(dr["ApproveTime"]);
                                DateTime dtCurApproveTime = Convert.ToDateTime(drValue["ApproveTime"]);
                                if (dtApproveTime.Subtract(dtCurApproveTime).TotalSeconds > 0)
                                {
                                    dictResult[strKey] = dr;
                                }
                            }
                        }
                    }
                }

                foreach (KeyValuePair <string, DataRow> keyvalue in dictResult)
                {
                    dtResult.ImportRow(keyvalue.Value);
                }
            }
            args.SelectResult = dtResult;
        }
Ejemplo n.º 20
0
        public void Car_Insert(FactoryArgs args, out t_BigID CarID, out t_String CarCode, t_String CarNum,
                               t_BigID SupplierID, t_BigID CardID, t_String Description, t_Decimal DefaultCarWeight)
        {
            CarCode = new t_String();
            CarID   = new t_BigID();
            DefaultCarWeight.IsNullToZero();
            CardID.NullIfZero();
            SupplierID.NullIfZero();
            using (DataTable dtCar = _DALDbCar.GetCarByName(args, CarID, CarNum))
            {
                if (dtCar.Rows.Count > 0)
                {
                    throw new Exception("该车牌号码已存在!");
                }
            }

            t_BigID  CarID_temp   = new t_BigID();
            t_String CarCode_temp = new t_String();

            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                t_String MaxCode;
                _DALDbCar.GetMaxCarCode(argsInTrans, out MaxCode);
                int CodeIndex = MaxCode.Value == null ? 0 : LBConverter.ToInt32(MaxCode.Value.Replace("C", ""));
                CodeIndex++;
                if (CodeIndex < 10)
                {
                    CarCode_temp.SetValueWithObject("C000" + CodeIndex.ToString());
                }
                else if (CodeIndex < 100)
                {
                    CarCode_temp.SetValueWithObject("C00" + CodeIndex.ToString());
                }
                else if (CodeIndex < 1000)
                {
                    CarCode_temp.SetValueWithObject("C0" + CodeIndex.ToString());
                }
                else
                {
                    CarCode_temp.SetValueWithObject("C" + CodeIndex.ToString());
                }

                if (CardID.Value > 0)//取消卡片的车辆关联
                {
                    CancelRefCard(argsInTrans, CardID);
                }

                _DALDbCar.Car_Insert(argsInTrans, out CarID_temp, CarCode_temp, CarNum, Description, DefaultCarWeight, SupplierID, CardID);
            };
            DBHelper.ExecInTrans(args, exec);
            CarID.Value   = CarID_temp.Value;
            CarCode.Value = CarCode_temp.Value;
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 读取物料价格
        /// </summary>
        /// <param name="sender"></param>
        private void ReadPrice()
        {
            //if (sender == this.txtCustomerID.TextBox || sender == this.txtCarID.TextBox || sender == this.txtItemID.TextBox || sender == this.txtCalculateType)
            {
                this.txtPrice.Text = "0";

                string strCarNum       = this.txtCarID.TextBox.Text.ToString();
                string strItemName     = this.txtItemID.TextBox.Text.ToString();
                string strCustomerName = this.txtCustomerID.TextBox.Text.ToString();

                if (this.txtCustomerID.TextBox.SelectedRow != null)
                {
                    decimal decTotalReceivedAmount = LBConverter.ToDecimal(this.txtCustomerID.TextBox.SelectedRow["TotalReceivedAmount"]);
                    decimal decSalesReceivedAmount = LBConverter.ToDecimal(this.txtCustomerID.TextBox.SelectedRow["SalesReceivedAmount"]);
                }

                if (strCarNum == "" || strItemName == "")
                {
                    return;
                }

                long lCarID      = 0;
                long lItemID     = 0;
                long lCustomerID = 0;
                using (DataTable dtCar = ExecuteSQL.CallView(113, "CarID", "CarNum='" + strCarNum + "'", ""))
                {
                    if (dtCar.Rows.Count > 0)
                    {
                        lCarID = LBConverter.ToInt64(dtCar.Rows[0]["CarID"]);
                    }
                }
                using (DataTable dtItem = ExecuteSQL.CallView(203, "ItemID", "ItemName='" + strItemName + "'", ""))
                {
                    if (dtItem.Rows.Count > 0)
                    {
                        lItemID = LBConverter.ToInt64(dtItem.Rows[0]["ItemID"]);
                    }
                }

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

                ReadPrice(lCarID, lItemID, lCustomerID);
            }
        }
Ejemplo n.º 22
0
        private static void SetPrintSettings(FastReport.Report report, long lReportTemplateID)
        {
            DataTable dtReportTemplate = ExecuteSQL.CallView(105, "", "ReportTemplateID=" + lReportTemplateID, "");

            if (dtReportTemplate.Rows.Count > 0)
            {
                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;

                    /*if (IsManualPaperType)
                     * {
                     *  System.Drawing.Printing.PrinterSettings mSelectedPrinter = new System.Drawing.Printing.PrinterSettings();
                     *  int iIndex = 0;
                     *  foreach (System.Drawing.Printing.PaperSize pageSize in mSelectedPrinter.PaperSizes)
                     *  {
                     *      if (pageSize.PaperName.Equals(strPaperType))
                     *      {
                     *          //report.PrintSettings.PaperSource = Convert.ToInt32(pageSize.Kind);
                     *          break;
                     *      }
                     *      iIndex++;
                     *  }
                     *
                     *  report.PrintSettings.PaperSource = iIndex;
                     * }
                     *
                     * if (IsManualPaperSize)
                     * {
                     *  report.PrintSettings.PrintOnSheetHeight = PaperSizeHeight;
                     *  report.PrintSettings.PrintOnSheetWidth = PaperSizeWidth;
                     * }
                     *
                     * report.PrintSettings.Duplex = IsPaperTransverse ? System.Drawing.Printing.Duplex.Vertical :
                     *   System.Drawing.Printing.Duplex.Horizontal;
                     */
                }
            }
        }
Ejemplo n.º 23
0
        private void ReadFieldValue()
        {
            if (mlCustomerID > 0)
            {
                DataTable dtHeader = ExecuteSQL.CallView(112, "", "CustomerID=" + mlCustomerID, "");
                if (dtHeader.Rows.Count > 0)
                {
                    DataRow drHeader = dtHeader.Rows[0];

                    this.txtK3CustomerCode.Text          = drHeader["K3CustomerCode"].ToString();
                    this.txtCustomerCode.Text            = drHeader["CustomerCode"].ToString();
                    this.txtCustomerName.Text            = drHeader["CustomerName"].ToString();
                    this.txtDescription.Text             = drHeader["Description"].ToString();
                    this.txtContact.Text                 = drHeader["Contact"].ToString();
                    this.txtPhone.Text                   = drHeader["Phone"].ToString();
                    this.txtAddress.Text                 = drHeader["Address"].ToString();
                    this.txtCreditAmount.Text            = drHeader["CreditAmount"].ToString();
                    this.txtAmountType.SelectedValue     = LBConverter.ToInt32(drHeader["AmountType"]);
                    this.txtReceiveType.SelectedValue    = LBConverter.ToInt32(drHeader["ReceiveType"]);
                    this.txtCustomerTypeID.SelectedValue = LBConverter.ToInt32(drHeader["CustomerTypeID"]);
                    this.txtAmountNotEnough.Text         = drHeader["AmountNotEnough"].ToString();

                    this.chkCarIsLimit.Checked      = LBConverter.ToBoolean(drHeader["CarIsLimit"]);
                    this.chkIsDisplayPrice.Checked  = LBConverter.ToBoolean(drHeader["IsDisplayPrice"]);
                    this.chkIsDisplayAmount.Checked = LBConverter.ToBoolean(drHeader["IsDisplayAmount"]);
                    this.chkIsPrintAmount.Checked   = LBConverter.ToBoolean(drHeader["IsPrintAmount"]);
                    this.chkIsAllowOverFul.Checked  = LBConverter.ToBoolean(drHeader["IsAllowOverFul"]);
                    this.chkIsAllowEmptyIn.Checked  = LBConverter.ToBoolean(drHeader["IsAllowEmptyIn"]);

                    this.txtCreateBy.Text   = drHeader["CreateBy"].ToString();
                    this.txtCreateTime.Text = drHeader["CreateTime"].ToString();
                    this.txtChangeBy.Text   = drHeader["ChangeBy"].ToString();
                    this.txtChangeTime.Text = drHeader["ChangeTime"].ToString();

                    decimal decSalesReceivedAmount = LBConverter.ToDecimal(drHeader["SalesReceivedAmount"]);
                    decimal decTotalReceivedAmount = LBConverter.ToDecimal(drHeader["TotalReceivedAmount"]);
                    decimal decOverRangeAmount     = decSalesReceivedAmount - decTotalReceivedAmount;
                    this.lblOverRangeAmount.Text = decOverRangeAmount > 0 ? decOverRangeAmount.ToString("0.00") : "0";
                    this.lblRemainAmount.Text    = decTotalReceivedAmount > decSalesReceivedAmount ? (decTotalReceivedAmount - decSalesReceivedAmount).ToString("0.00") : "0";

                    //是否禁用
                    bool bolIsForbid = LBConverter.ToBoolean(drHeader["IsForbid"]);
                    this.btnForbid.Visible   = !bolIsForbid;
                    this.btnUnForbid.Visible = bolIsForbid;
                    this.lblForbid.Visible   = bolIsForbid;
                }
            }
        }
Ejemplo n.º 24
0
        private void SetFieldValue()
        {
            DataTable dtDesc = ExecuteSQL.CallView(140, "", "MachineName='" + LoginInfo.MachineName + "'", "");

            if (dtDesc.Rows.Count > 0)
            {
                this.txtReadSerialName.SelectedValue  = dtDesc.Rows[0]["ReadCardSerialCOM"].ToString().TrimEnd();
                this.txtWriteSerialName.SelectedValue = dtDesc.Rows[0]["WriteCardSerialCOM"].ToString().TrimEnd();
                this.txtReadSerialBaud.Text           = LBConverter.ToInt32(dtDesc.Rows[0]["ReadCardBaud"]).ToString();
                this.cbUseReadCard.Checked            = LBConverter.ToInt32(dtDesc.Rows[0]["UseReadCard"]) == 1 ? true : false;
                this.cbUseWriteCard.Checked           = LBConverter.ToInt32(dtDesc.Rows[0]["UseWriteCard"]) == 1 ? true : false;
                this.rbNet.Checked     = LBConverter.ToInt32(dtDesc.Rows[0]["ConnectType"]) == 1 ? true : false;
                this.txtIPAddress.Text = dtDesc.Rows[0]["IPAddress"].ToString();
                this.txtPort.Text      = dtDesc.Rows[0]["IPPort"].ToString();
            }
        }
Ejemplo n.º 25
0
        private void btnStart4_Click(object sender, EventArgs e)
        {
            try
            {
                viewCamera4.IPAddress = this.txtIP4.Text;
                viewCamera4.Port      = LBConverter.ToInt32(this.txtPort4.Text);
                viewCamera4.Account   = this.txtAccount4.Text;
                viewCamera4.Password  = this.txtPassword4.Text;

                viewCamera4.OpenCamera(9);
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Ejemplo n.º 26
0
 private void TxtWeightDeviceType_SelectedValueChanged(object sender, EventArgs e)
 {
     try
     {
         int iWeightDeviceType = LBConverter.ToInt32(this.txtWeightDeviceType.SelectedValue);
         if (iWeightDeviceType > 0)
         {
             LoadSerialData(iWeightDeviceType);
         }
         SetTextBoxEnable();
     }
     catch (Exception ex)
     {
         LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
     }
 }
Ejemplo n.º 27
0
        public void Customer_Insert(FactoryArgs args, out t_BigID CustomerID, out t_String CustomerCode, t_String CustomerName, t_String Contact, t_String Phone, t_String Address,
                                    t_Bool CarIsLimit, t_ID AmountType, t_String LicenceNum, t_String Description, t_ID ReceiveType,
                                    t_Decimal CreditAmount, t_Bool IsDisplayPrice, t_Bool IsDisplayAmount, t_Bool IsPrintAmount, t_Bool IsAllowOverFul,
                                    t_Bool IsAllowEmptyIn, t_Decimal AmountNotEnough, t_String K3CustomerCode, t_BigID CustomerTypeID)
        {
            CustomerTypeID.NullIfZero();
            CustomerCode = new t_String();
            CustomerID   = new t_BigID();
            IsAllowEmptyIn.IsNullToZero();

            using (DataTable dtCustomer = _DALDbCustomer.GetCustomerByName(args, CustomerID, CustomerName))
            {
                if (dtCustomer.Rows.Count > 0)
                {
                    throw new Exception("该客户名称已存在!");
                }
            }

            t_String MaxCode;

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

            CodeIndex++;
            if (CodeIndex < 10)
            {
                CustomerCode.SetValueWithObject("K000" + CodeIndex.ToString());
            }
            else if (CodeIndex < 100)
            {
                CustomerCode.SetValueWithObject("K00" + CodeIndex.ToString());
            }
            else if (CodeIndex < 1000)
            {
                CustomerCode.SetValueWithObject("K0" + CodeIndex.ToString());
            }
            else
            {
                CustomerCode.SetValueWithObject("K" + CodeIndex.ToString());
            }

            _DALDbCustomer.Customer_Insert(args, out CustomerID, CustomerCode, CustomerName, Contact, Phone, Address, CarIsLimit, AmountType, LicenceNum, Description,
                                           ReceiveType, CreditAmount, IsDisplayPrice, IsDisplayAmount, IsPrintAmount, IsAllowOverFul, IsAllowEmptyIn, AmountNotEnough,
                                           K3CustomerCode, CustomerTypeID);
        }
Ejemplo n.º 28
0
 private void GrdCarIn_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     try
     {
         if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
         {
             int iNotOutBillCount = LBConverter.ToInt32(this.grdCarIn["NotOutBillCount", e.RowIndex].Value);
             if (iNotOutBillCount > 0)
             {
                 e.CellStyle.BackColor = Color.OrangeRed;
             }
         }
     }
     catch (Exception ex)
     {
         LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
     }
 }
Ejemplo n.º 29
0
        private void CalAmount()
        {
            decimal decTotalWeight = LBConverter.ToDecimal(this.txtTotalWeight.Text);
            decimal decCarTare     = LBConverter.ToDecimal(this.txtCarTare.Text);
            int     iCalculateType = LBConverter.ToInt32(this.txtCalculateType.SelectedValue);//0按重量计算 1按车计算

            this.txtSuttleWeight.Text = (decTotalWeight - decCarTare).ToString("0");
            decimal decPrice = LBConverter.ToDecimal(this.txtPrice.Text);

            if (iCalculateType == 0)
            {
                this.txtAmount.Text = (decPrice * (decTotalWeight - decCarTare)).ToString("0.00");
            }
            else
            {
                this.txtAmount.Text = decPrice.ToString("0.00");
            }
        }
Ejemplo n.º 30
0
        private void LoadDataSource()
        {
            string strFilter = "";

            if (this.txtCustomerID.TextBox.Text != "")
            {
                if (strFilter != "")
                {
                    strFilter += " and ";
                }
                strFilter += "CustomerName like '%" + this.txtCustomerID.TextBox.Text + "%'";
            }

            if (this.txtAmountFrom.Text != "")
            {
                if (strFilter != "")
                {
                    strFilter += " and ";
                }
                strFilter += "RemainReceivedAmount >= " + this.txtAmountFrom.Text + "";
            }

            if (this.txtAmountTo.Text != "")
            {
                if (strFilter != "")
                {
                    strFilter += " and ";
                }
                strFilter += "RemainReceivedAmount <= " + this.txtAmountTo.Text + "";
            }

            if (this.txtReceiveType.SelectedValue != null && this.txtReceiveType.SelectedValue.ToString() != "")
            {
                if (strFilter != "")
                {
                    strFilter += " and ";
                }
                strFilter += "ReceiveType = " + LBConverter.ToInt32(this.txtReceiveType.SelectedValue) + "";
            }

            DataTable dtUser = ExecuteSQL.CallView(112, "", strFilter, "");

            this.grdMain.DataSource = dtUser.DefaultView;
        }