示例#1
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);
            }
        }
示例#2
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"]);
            }
            string strCameraImageSavePath;

            SysConfigValue.GetSysConfig("CameraImageSavePath", out strCameraImageSavePath);
            this.txtImageAddress.Text = strCameraImageSavePath;
        }
示例#3
0
        public static void SynchronousCustomerFromServer()
        {
            DataTable dtAddCustomer;
            DataTable dtEditCustomer;

            CompareClientAndServer(out dtAddCustomer, out dtEditCustomer);

            UpdateClientCustomerData(dtAddCustomer, dtEditCustomer);

            SysConfigValue.SaveSysConfig("CustomerSynchronousTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
        }
示例#4
0
        /// <summary>
        /// 更新本地物料资料数据
        /// </summary>
        /// <param name="dtAddItem"></param>
        /// <param name="dtEditItem"></param>
        public static void UpdateClientItemData(DataTable dtAddItem, DataTable dtEditItem)
        {
            //添加物料
            DataSet   dsReturn;
            DataTable dtOut;

            ExecuteSQL.CallSP(20300, dtAddItem, out dsReturn, out dtOut);

            //更新本地物料
            ExecuteSQL.CallSP(20301, dtEditItem, out dsReturn, out dtOut);

            SysConfigValue.SaveSysConfig("ItemSynchronousTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
        }
示例#5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                LBDbParameterCollection parmCol = new LBDbParameterCollection();
                parmCol.Add(new LBParameter("MachineName", enLBDbType.String, LoginInfo.MachineName));
                parmCol.Add(new LBParameter("IPAddress1", enLBDbType.String, this.txtIP1.Text));
                parmCol.Add(new LBParameter("Port1", enLBDbType.Int32, LBConverter.ToInt32(this.txtPort1.Text)));
                parmCol.Add(new LBParameter("Account1", enLBDbType.String, this.txtAccount1.Text));
                parmCol.Add(new LBParameter("Password1", enLBDbType.String, this.txtPassword1.Text));
                parmCol.Add(new LBParameter("IPAddress2", enLBDbType.String, this.txtIP2.Text));
                parmCol.Add(new LBParameter("Port2", enLBDbType.Int32, LBConverter.ToInt32(this.txtPort2.Text)));
                parmCol.Add(new LBParameter("Account2", enLBDbType.String, this.txtAccount2.Text));
                parmCol.Add(new LBParameter("Password2", enLBDbType.String, this.txtPassword2.Text));
                parmCol.Add(new LBParameter("IPAddress3", enLBDbType.String, this.txtIP3.Text));
                parmCol.Add(new LBParameter("Port3", enLBDbType.Int32, LBConverter.ToInt32(this.txtPort3.Text)));
                parmCol.Add(new LBParameter("Account3", enLBDbType.String, this.txtAccount3.Text));
                parmCol.Add(new LBParameter("Password3", enLBDbType.String, this.txtPassword3.Text));
                parmCol.Add(new LBParameter("IPAddress4", enLBDbType.String, this.txtIP4.Text));
                parmCol.Add(new LBParameter("Port4", enLBDbType.Int32, LBConverter.ToInt32(this.txtPort4.Text)));
                parmCol.Add(new LBParameter("Account4", enLBDbType.String, this.txtAccount4.Text));
                parmCol.Add(new LBParameter("Password4", enLBDbType.String, this.txtPassword4.Text));
                parmCol.Add(new LBParameter("UseCamera1", enLBDbType.Boolean, this.cbUserCamera1.Checked?1:0));
                parmCol.Add(new LBParameter("UseCamera2", enLBDbType.Boolean, this.cbUserCamera2.Checked ? 1 : 0));
                parmCol.Add(new LBParameter("UseCamera3", enLBDbType.Boolean, this.cbUserCamera3.Checked ? 1 : 0));
                parmCol.Add(new LBParameter("UseCamera4", enLBDbType.Boolean, this.cbUserCamera4.Checked ? 1 : 0));
                DataSet dsReturn;
                Dictionary <string, object> dictValue;
                ExecuteSQL.CallSP(13900, parmCol, out dsReturn, out dictValue);


                SysConfigValue.SaveSysConfig("CameraImageSavePath", this.txtImageAddress.Text);

                LB.WinFunction.LBCommonHelper.ShowCommonMessage("保存成功!");
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
示例#6
0
        /// <summary>
        /// 更新本地客户资料数据
        /// </summary>
        /// <param name="dtAddCustomer"></param>
        /// <param name="dtEditCustomer"></param>
        public static void UpdateClientCarData(DataTable dtAddCar, DataTable dtEditCar)
        {
            //添加客户
            DataSet   dsReturn;
            DataTable dtOut;

            //将客户清空
            foreach (DataRow dr in dtAddCar.Rows)
            {
                dr["CustomerID"] = DBNull.Value;
            }
            ExecuteSQL.CallSP(13500, dtAddCar, out dsReturn, out dtOut);

            //更新本地客户
            //将客户清空
            foreach (DataRow dr in dtEditCar.Rows)
            {
                dr["CustomerID"] = DBNull.Value;
            }
            ExecuteSQL.CallSP(13501, dtEditCar, out dsReturn, out dtOut);

            SysConfigValue.SaveSysConfig("CarSynchronousTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
        }
示例#7
0
        /// <summary>
        /// 比较本地与服务器的客户资料,返回需要跟新本地的差异数据
        /// </summary>
        /// <returns></returns>
        public static void CompareClientAndServer(out DataTable dtAddCustomer, out DataTable dtEditCustomer)
        {
            //读取上次同步数据时间
            DateTime dtCustomerSynchronousTime = Convert.ToDateTime("1990-01-01");
            string   strCustomerSynchronousTime;

            SysConfigValue.GetSysConfig("CustomerSynchronousTime", out strCustomerSynchronousTime);
            if (strCustomerSynchronousTime != "")
            {
                DateTime.TryParse(strCustomerSynchronousTime, out dtCustomerSynchronousTime);
            }

            //先读取服务器客户资料
            DataTable dtServer = ExecuteSQL.CallView_Service(112, "", "ChangeTime>='" + dtCustomerSynchronousTime.ToString("yyyy-MM-dd HH:mm:ss") + "'", "CustomerID");
            //读取本地客户资料
            DataTable dtClient = ExecuteSQL.CallView(112);

            Dictionary <string, DataRow> dictServer = new Dictionary <string, DataRow>();
            Dictionary <string, DataRow> dictClient = new Dictionary <string, DataRow>();

            foreach (DataRow dr in dtServer.Rows)
            {
                string strKey = dr["CustomerName"].ToString().TrimEnd();
                if (!dictServer.ContainsKey(strKey))
                {
                    dictServer.Add(strKey, dr);
                }
            }

            foreach (DataRow dr in dtClient.Rows)
            {
                string strKey = dr["CustomerName"].ToString().TrimEnd();
                if (!dictClient.ContainsKey(strKey))
                {
                    dictClient.Add(strKey, dr);
                }
            }

            dtAddCustomer            = dtClient.Clone();
            dtAddCustomer.TableName  = "SP";
            dtEditCustomer           = dtClient.Clone();
            dtEditCustomer.TableName = "SP";
            foreach (KeyValuePair <string, DataRow> kvServer in dictServer)
            {
                if (!dictClient.ContainsKey(kvServer.Key))
                {
                    dtAddCustomer.ImportRow(kvServer.Value);
                }
                else
                {
                    DataRow drClient = dictClient[kvServer.Key];
                    foreach (DataColumn dc in dtServer.Columns)
                    {
                        if (!dc.ColumnName.Contains("SortLevel") && !dc.ColumnName.Contains("Time") && !dc.ColumnName.Contains("By") && dc.ColumnName != "CustomerCode" && dc.ColumnName != "CustomerID" && dtClient.Columns.Contains(dc.ColumnName))
                        {
                            if (kvServer.Value[dc.ColumnName].ToString().TrimEnd() != drClient[dc.ColumnName].ToString().TrimEnd())
                            {
                                dtEditCustomer.ImportRow(kvServer.Value);
                                dtEditCustomer.Rows[dtEditCustomer.Rows.Count - 1]["CustomerID"] = drClient["CustomerID"];
                                break;
                            }
                        }
                    }
                }
            }
        }
示例#8
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private static void SynchronousClientFromServer(out string strMsg, out bool bolIsAllSyn)
        {
            strMsg      = "";
            bolIsAllSyn = false;
            DataTable dtModifyHeaderServer = null;
            DataTable dtModifyDetailServer = null;
            //读取上次同步数据时间
            DateTime dtPriceSynchronousTime = Convert.ToDateTime("1990-01-01");
            string   strPriceSynchronousTime;

            SysConfigValue.GetSysConfig("PriceSynchronousTime", out strPriceSynchronousTime);
            //先读取服务器价格资料
            dtModifyHeaderServer = ExecuteSQL.CallView_Service(115, "", "IsApprove=1 and ApproveTime>='" + strPriceSynchronousTime + "'", "ApproveTime");

            string strModifyBillHeaderIDs = "";

            foreach (DataRow dr in dtModifyHeaderServer.Rows)
            {
                string strModifyBillHeaderID = dr["ModifyBillHeaderID"].ToString();
                if (strModifyBillHeaderIDs != "")
                {
                    strModifyBillHeaderIDs += ",";
                }
                strModifyBillHeaderIDs += strModifyBillHeaderID;
            }

            if (strModifyBillHeaderIDs != "")
            {
                dtModifyDetailServer = ExecuteSQL.CallView_Service(116, "", "ModifyBillHeaderID in (" + strModifyBillHeaderIDs + ")", "");
            }

            foreach (DataRow dr in dtModifyHeaderServer.Rows)
            {
                long      lServerModifyBillHeaderID = LBConverter.ToInt64(dr["ModifyBillHeaderID"]);
                DataTable dtCopy = dtModifyHeaderServer.Clone();

                //客户名称
                string strCustomerName_Server = dr["CustomerName"].ToString().TrimEnd();

                try
                {
                    //读取客户ID
                    long lCustomerIDClient;
                    bool bolExistsCustomer = GetCustomerIDFromClient(strCustomerName_Server, out lCustomerIDClient);
                    if (!bolExistsCustomer)//本地不存在该客户
                    {
                        throw new Exception("本地账套不存在该客户名称【" + strCustomerName_Server + "】!");
                    }
                    else
                    {
                        dr["CustomerID"] = lCustomerIDClient;
                        dtModifyDetailServer.DefaultView.RowFilter = "ModifyBillHeaderID = " + lServerModifyBillHeaderID.ToString();
                        foreach (DataRowView drvDetail in dtModifyDetailServer.DefaultView)
                        {
                            string strItemNameServer = drvDetail["ItemName"].ToString().TrimEnd();
                            string strCarNumServer   = drvDetail["CarNum"].ToString().TrimEnd();

                            if (strCarNumServer != "")
                            {
                                long lCarIDClient;
                                bool bolExistsCar = GetCarIDFromClient(strCarNumServer, out lCarIDClient);
                                if (!bolExistsCar)
                                {
                                    throw new Exception("本地账套不存在该车牌【" + strCarNumServer + "】!");
                                }
                                drvDetail["CarID"] = lCarIDClient;
                            }

                            if (strItemNameServer != "")
                            {
                                long lItemIDClient;
                                bool bolExistsItem = GetItemIDFromClient(strItemNameServer, out lItemIDClient);
                                if (!bolExistsItem)
                                {
                                    throw new Exception("本地账套不存在该物料【" + strItemNameServer + "】!");
                                }
                                drvDetail["ItemID"] = lItemIDClient;
                            }
                        }
                    }

                    dtCopy.ImportRow(dr);

                    int       iSPType = 13600;
                    DataSet   dsReturn;
                    DataTable dtOut;
                    ExecuteSQL.CallSP(iSPType, dtCopy, out dsReturn, out dtOut);
                    if (dtOut != null && dtOut.Rows.Count > 0)
                    {
                        if (dtOut.Columns.Contains("ModifyBillHeaderID"))
                        {
                            long lModifyBillHeaderID = LBConverter.ToInt64(dtOut.Rows[0]["ModifyBillHeaderID"]);
                            if (lModifyBillHeaderID > 0)
                            {
                                dtModifyDetailServer.DefaultView.RowFilter = "ModifyBillHeaderID = " + lServerModifyBillHeaderID.ToString();
                                DataTable dtModifyDetail = dtModifyDetailServer.DefaultView.ToTable();
                                foreach (DataRow drDetailClient in dtModifyDetail.Rows)
                                {
                                    drDetailClient["ModifyBillHeaderID"] = lModifyBillHeaderID;
                                }
                                DataTable dtOutDetail;
                                ExecuteSQL.CallSP(13700, dtModifyDetail, out dsReturn, out dtOutDetail);

                                LBDbParameterCollection parmCol = new LBDbParameterCollection();
                                parmCol.Add(new LBParameter("ModifyBillHeaderID", enLBDbType.Int64, lModifyBillHeaderID));

                                Dictionary <string, object> dictValue;
                                ExecuteSQL.CallSP(13603, parmCol, out dsReturn, out dictValue);//审核
                                SysConfigValue.SaveSysConfig("PriceSynchronousTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (strMsg != "")
                    {
                        strMsg += "\n";
                    }
                    strMsg     += ex.Message;
                    bolIsAllSyn = false;
                }
            }
        }