/// <summary>
        /// 编辑情况下组装sql的方法
        /// </summary>
        /// <param name="listSql"></param>
        /// <param name="order_id"></param>
        /// <param name="model"></param>
        private void EditPurchaseOrderSqlString(List<SysSQLString> listSql, string order_id, tb_parts_purchase_order model, string HandleType)
        {
            SysSQLString sysStringSql = new SysSQLString();
            sysStringSql.cmdType = CommandType.Text;
            Dictionary<string, string> dicParam = new Dictionary<string, string>();//参数

            int business_counts=0;
            decimal payment=0;
            decimal tax=0;
            decimal valorem_together=0;
            GetBuesinessMoney(ref business_counts, ref payment, ref tax, ref valorem_together);

            CommonFuncCall.SetModelObjectValue(this, model);
            model.sup_id = sup_id;
            model.sup_code = txtsup_code1.Text.Trim();
            model.sup_name = txtsup_name.Caption.Trim();
            model.sup_code = txtsup_code1.Text;
            model.closing_unit = txtclosing_unit1.Text;
            model.update_by = GlobalStaticObj.UserID;
            model.update_name = GlobalStaticObj.UserName;
            model.update_time = Common.LocalDateTimeToUtcLong(DateTime.Now);
            model.operators = GlobalStaticObj.UserID;
            model.operator_name = GlobalStaticObj.UserName;
            model.is_suspend = chkis_suspend.Checked ? "0" : "1";//选中(中止):0,未选中(不中止):1
            model.suspend_reason = txtsuspend_reason.Caption.Trim();//中止原因
            model.order_quantity = business_counts;//订货数量
            model.payment = payment;//货款
            model.tax = tax;//税款
            model.money = valorem_together;//金额

            model.enable_flag = "1";
            if (HandleType == "保存")
            {
                model.order_status = Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT);
                model.order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.DRAFT, true);
            }
            else if (HandleType == "提交")
            {
                model.order_status = Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT);
                model.order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.SUBMIT, true);
            }

            if (!string.IsNullOrEmpty(ddltrans_mode.SelectedValue.ToString()))
            {
                model.trans_mode = ddltrans_mode.SelectedValue.ToString();
                model.trans_mode_name = ddltrans_mode.SelectedItem.ToString();
            }
            if (!string.IsNullOrEmpty(ddlclosing_way.SelectedValue.ToString()))
            {
                model.closing_way = ddlclosing_way.SelectedValue.ToString();
                model.closing_way_name = ddlclosing_way.SelectedItem.ToString();
            }
            if (!string.IsNullOrEmpty(ddlorg_id.SelectedValue.ToString()))
            {
                model.org_id = ddlorg_id.SelectedValue.ToString();
                model.org_name = ddlorg_id.SelectedItem.ToString();
            }
            if (!string.IsNullOrEmpty(ddlhandle.SelectedValue.ToString()))
            {
                model.handle = ddlhandle.SelectedValue.ToString();
                model.handle_name = ddlhandle.SelectedItem.ToString();
            }
            if (model != null)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append(" Update tb_parts_purchase_order Set ");
                bool isFirstValue = true;
                foreach (PropertyInfo info in model.GetType().GetProperties())
                {
                    string name = info.Name;
                    object value = info.GetValue(model, null);
                    if (isFirstValue)
                    {
                        isFirstValue = false;
                        sb.Append(name);
                        sb.Append("=");
                        sb.Append("@" + name);
                    }
                    else
                    {
                        sb.Append("," + name);
                        sb.Append("=");
                        sb.Append("@" + name);
                    }
                    dicParam.Add(name, value == null ? "" : value.ToString());
                }
                sb.Append(" where order_id='" + order_id + "';");
                sysStringSql.sqlString = sb.ToString();
                sysStringSql.Param = dicParam;
                listSql.Add(sysStringSql);
            }
        }
        /// <summary> 当金额不为0,审核通过时,自动生产预/应收单、预/应付单
        /// </summary>
        void AddBillPayReceive(List<string> listField)
        {
            if (listField.Count > 0)
            {
                for (int i = 0; i < listField.Count; i++)
                {
                    DataTable dt = DBHelper.GetTable("", "tb_parts_purchase_order", "*", string.Format("order_id='{0}'", listField[i]), "", "");
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        tb_parts_purchase_order model = new tb_parts_purchase_order();
                        CommonFuncCall.SetModlByDataTable(model, dt);
                        if (model.prepaid_money > 0)
                        {
                            tb_bill_receivable a = new tb_bill_receivable();
                            tb_balance_documents b = new tb_balance_documents();
                            tb_payment_detail c = new tb_payment_detail();

                            a.cust_id = model.sup_id;//供应商ID
                            a.order_num = CommonUtility.GetNewNo(DataSources.EnumProjectType.PAYMENT);//订单号
                            a.order_type = (int)DataSources.EnumOrderType.PAYMENT;
                            a.payment_type = (int)DataSources.EnumPaymentType.ADVANCES;
                            a.org_id = model.org_id;

                            b.billing_money = model.prepaid_money;//开单金额
                            b.documents_date = model.order_date;//单据日期
                            b.documents_id = model.order_id;//单据ID
                            b.documents_name = "采购订单";//单据名称
                            b.documents_num = model.order_num;//单据编码

                            c.money = model.prepaid_money;
                            c.balance_way = model.closing_way;//结算方式
                            //c.check_number = model.check_number;//票号

                            DBOperation.AddBillReceivable(a, b, c);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 添加情况下组装sql的方法
        /// </summary>
        /// <param name="listSql"></param>
        /// <param name="order_id"></param>
        private void AddPurchaseOrderSqlString(List<SysSQLString> listSql, string order_id, string HandleType)
        {
            SysSQLString sysStringSql = new SysSQLString();
            sysStringSql.cmdType = CommandType.Text;
            Dictionary<string, string> dicParam = new Dictionary<string, string>();//参数

            int business_counts = 0;
            decimal payment = 0;
            decimal tax = 0;
            decimal valorem_together = 0;
            GetBuesinessMoney(ref business_counts, ref payment, ref tax, ref valorem_together);

            ddtorder_date.Value = Convert.ToDateTime(ddtorder_date.Value.ToShortDateString() + " 23:59:59");
            ddtvalid_till.Value = Convert.ToDateTime(ddtvalid_till.Value.ToShortDateString() + " 23:59:59");
            ddtarrival_date.Value = Convert.ToDateTime(ddtarrival_date.Value.ToShortDateString() + " 23:59:59");
            tb_parts_purchase_order model = new tb_parts_purchase_order();
            CommonFuncCall.SetModelObjectValue(this, model);
            model.sup_id = sup_id;
            model.sup_code = txtsup_code1.Text.Trim();
            model.sup_name = txtsup_name.Caption.Trim();
            model.closing_unit = txtclosing_unit1.Text;
            model.order_id = order_id;
            model.create_by = GlobalStaticObj.UserID;
            model.create_name = GlobalStaticObj.UserName;
            model.create_time = Common.LocalDateTimeToUtcLong(DateTime.Now);
            model.operators = GlobalStaticObj.UserID;
            model.operator_name = GlobalStaticObj.UserName;
            model.is_suspend = chkis_suspend.Checked ? "0" : "1";//选中(中止):0,未选中(不中止):1

            model.suspend_reason = txtsuspend_reason.Caption.Trim();//中止原因
            model.com_id = GlobalStaticObj.CurrUserCom_Id;//公司ID
            model.com_code = GlobalStaticObj.CurrUserCom_Code;//公司编码
            model.com_name = GlobalStaticObj.CurrUserCom_Name;//公司名称
            model.order_quantity = business_counts;//订货数量
            model.payment = payment;//货款
            model.tax = tax;//税款
            model.money = valorem_together;//金额
            model.is_occupy = "0";
            model.is_lock = "0";
            model.enable_flag = "1";
            if (HandleType == "保存")
            {
                model.order_status = Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT);
                model.order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.DRAFT, true);
            }
            else if (HandleType == "提交")
            {
                model.order_status = Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT);
                model.order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.SUBMIT, true);
            }

            if (!string.IsNullOrEmpty(ddltrans_mode.SelectedValue.ToString()))
            {
                model.trans_mode = ddltrans_mode.SelectedValue.ToString();
                model.trans_mode_name = ddltrans_mode.SelectedItem.ToString();
            }
            if (!string.IsNullOrEmpty(ddlclosing_way.SelectedValue.ToString()))
            {
                model.closing_way = ddlclosing_way.SelectedValue.ToString();
                model.closing_way_name = ddlclosing_way.SelectedItem.ToString();
            }
            if (!string.IsNullOrEmpty(ddlorg_id.SelectedValue.ToString()))
            {
                model.org_id = ddlorg_id.SelectedValue.ToString();
                model.org_name = ddlorg_id.SelectedItem.ToString();
            }
            if (!string.IsNullOrEmpty(ddlhandle.SelectedValue.ToString()))
            {
                model.handle = ddlhandle.SelectedValue.ToString();
                model.handle_name = ddlhandle.SelectedItem.ToString();
            }
            if (model != null)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append(" Insert Into tb_parts_purchase_order( ");
                StringBuilder sp = new StringBuilder();
                StringBuilder sb_prame = new StringBuilder();
                foreach (PropertyInfo info in model.GetType().GetProperties())
                {
                    string name = info.Name;
                    object value = info.GetValue(model, null);
                    sb_prame.Append("," + name);
                    sp.Append(",@" + name);
                    dicParam.Add(name, value == null ? "" : value.ToString());
                }
                sb.Append(sb_prame.ToString().Substring(1, sb_prame.ToString().Length - 1) + ") Values (");
                sb.Append(sp.ToString().Substring(1, sp.ToString().Length - 1) + ")").Append(";");
                sysStringSql.sqlString = sb.ToString();
                sysStringSql.Param = dicParam;
                listSql.Add(sysStringSql);
            }
        }