/// <summary> /// 加载销售计划信息和配件信息 /// </summary> /// <param name="sale_billing_id"></param> private void LoadInfo(string sale_billing_id) { if (!string.IsNullOrEmpty(sale_billing_id)) { //1.查看一条销售开单信息 DataTable dt = DBHelper.GetTable("查看一条销售开单信息", "tb_parts_sale_billing", "*", " sale_billing_id='" + sale_billing_id + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { CommonFuncCall.SetModlByDataTable(tb_salebill_Model, dt); CommonFuncCall.SetShowControlValue(this, tb_salebill_Model, ""); if (!string.IsNullOrEmpty(lblorder_date.Text)) { long ticks = Convert.ToInt64(lblorder_date.Text); lblorder_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } if (!string.IsNullOrEmpty(lblreceivables_date.Text)) { long ticks = Convert.ToInt64(lblreceivables_date.Text); lblreceivables_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } lblcreate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_salebill_Model.create_time.ToString())).ToString(); if (tb_salebill_Model.update_time > 0) { lblupdate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_salebill_Model.update_time.ToString())).ToString(); } } } }
/// <summary> 加载主单据信息 /// </summary> /// <param name="planId"></param> private void LoadInfo(string planId) { if (!string.IsNullOrEmpty(planId)) { //1.加载供应商档案主信息 DataTable dt = DBHelper.GetTable("查看一条采购计划单信息", "tb_parts_purchase_plan", "*", " plan_id='" + planId + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { CommonFuncCall.SetModlByDataTable(tb_purchase_Model, dt); CommonFuncCall.SetShowControlValue(this, tb_purchase_Model, ""); chkis_suspend.Checked = tb_purchase_Model.is_suspend == "0";//选中(中止):0,未选中(不中止):1 if (!string.IsNullOrEmpty(lblorder_date.Text)) { long ticks = Convert.ToInt64(lblorder_date.Text); lblorder_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } if (!string.IsNullOrEmpty(lblplan_start_time.Text)) { long ticks = Convert.ToInt64(lblplan_start_time.Text); lblplan_start_time.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } if (!string.IsNullOrEmpty(lblplan_end_time.Text)) { long ticks = Convert.ToInt64(lblplan_end_time.Text); lblplan_end_time.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } lblcreate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_purchase_Model.create_time.ToString())).ToString(); if (tb_purchase_Model.update_time > 0) { lblupdate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_purchase_Model.update_time.ToString())).ToString(); } } } }
/// <summary> /// 加载销售计划信息和配件信息 /// </summary> /// <param name="sale_billing_id"></param> private void LoadInfo(string sale_billing_id) { if (!string.IsNullOrEmpty(sale_billing_id)) { //1.查看一条销售开单信息 DataTable dt = DBHelper.GetTable("查看一条销售开单信息", "tb_parts_sale_billing", "*", " sale_billing_id='" + sale_billing_id + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { CommonFuncCall.SetModlByDataTable(tb_salebill_Model, dt); CommonFuncCall.SetShowControlValue(this, tb_salebill_Model, ""); if (!string.IsNullOrEmpty(lblorder_date.Text)) { long ticks = Convert.ToInt64(lblorder_date.Text); lblorder_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } if (!string.IsNullOrEmpty(lblreceivables_date.Text)) { long ticks = Convert.ToInt64(lblreceivables_date.Text); lblreceivables_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } lblcreate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_salebill_Model.create_time.ToString())).ToString(); if (tb_salebill_Model.update_time > 0) { lblupdate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_salebill_Model.update_time.ToString())).ToString(); } orderstatus = tb_salebill_Model.order_status; if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString()) { //已提交状态屏蔽提交、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString()) { //已审核时屏蔽提交、审核、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString() || orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString()) { //审核没通过时屏蔽审核按钮 base.btnVerify.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString()) { base.btnActivation.Caption = "激活"; base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; } } } }
private void buttonEx1_Click(object sender, EventArgs e) { try { List <string> listField = GetTestRecord(); if (listField.Count > 0) { if (listField.Count == 0) { MessageBoxEx.Show("请选择要发送的销售开单审核数据!"); return; } partsale partsalemodel = new partsale(); tb_parts_sale_billing sale_bill_model = new tb_parts_sale_billing(); DataTable dt_test = DBHelper.GetTable("查看一条销售开发订单信息", "tb_parts_sale_billing", "*", " sale_billing_id='" + listField[0] + "'", "", ""); CommonFuncCall.SetModlByDataTable(sale_bill_model, dt_test, 0); partsalemodel.sale_date = DateTime.Now.ToString(); partsalemodel.cust_name = sale_bill_model.contacts; partsalemodel.cust_phone = sale_bill_model.contacts_tel; partsalemodel.turner = string.Empty; partsalemodel.license_plate = string.Empty; partsalemodel.amount = sale_bill_model.allmoney.ToString(); partsalemodel.remark = sale_bill_model.remark; DataTable dt_parts_test = DBHelper.GetTable("查看一条销售开发订单的配件信息", "tb_parts_sale_billing_p", "*", " sale_billing_id='" + listField[0] + "'", "", ""); if (dt_parts_test != null && dt_parts_test.Rows.Count > 0) { partDetail partDetailmodel = new partDetail(); partsalemodel.partDetails = new partDetail[dt_parts_test.Rows.Count]; tb_parts_sale_billing_p sale_bill_p_model = new tb_parts_sale_billing_p(); for (int i = 0; i < dt_parts_test.Rows.Count; i++) { partDetailmodel = new partDetail(); sale_bill_p_model = new tb_parts_sale_billing_p(); CommonFuncCall.SetModlByDataTable(sale_bill_p_model, dt_parts_test, i); partDetailmodel.wh_code = sale_bill_p_model.wh_code; partDetailmodel.car_parts_code = sale_bill_p_model.car_factory_code; partDetailmodel.remark = sale_bill_p_model.remark; partDetailmodel.business_count = sale_bill_p_model.business_count.ToString(); partDetailmodel.business_price = sale_bill_p_model.business_price.ToString(); partDetailmodel.amount = sale_bill_p_model.valorem_together.ToString(); partDetailmodel.parts_remark = sale_bill_p_model.remark; partsalemodel.partDetails[i] = partDetailmodel; } } string mess = DBHelper.WebServHandler("调用销售开发订单信息", SYSModel.EnumWebServFunName.UpLoadPartSale, partsalemodel); if (!string.IsNullOrEmpty(mess)) { mess = "操作成功!"; } MessageBoxEx.Show(mess); } } catch (Exception ex) { } }
/// <summary> /// 加载供应商档案信息 /// </summary> private void LoadInfo(string supperId) { if (!string.IsNullOrEmpty(supperId)) { //1.加载供应商档案主信息 DataTable dt = DBHelper.GetTable("查看一条供应商档案信息", "tb_supplier", "*", " sup_id='" + supperId + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { CommonFuncCall.SetModlByDataTable(tb_supp_Model, dt); CommonFuncCall.SetShowControlValue(this, tb_supp_Model, ""); } } }
/// <summary> 加载销售计划信息和配件信息 /// </summary> /// <param name="planId"></param> private void LoadInfo(string planId) { if (!string.IsNullOrEmpty(planId)) { //1.查看一条销售计划单信息 DataTable dt = DBHelper.GetTable("查看一条销售计划单信息", "tb_parts_sale_plan", "*", " sale_plan_id='" + planId + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { CommonFuncCall.SetModlByDataTable(tb_purchase_Model, dt); CommonFuncCall.SetShowControlValue(this, tb_purchase_Model, ""); chkis_suspend.Checked = tb_purchase_Model.is_suspend == "0";//选中(中止):0,未选中(不中止):1 lblcreate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_purchase_Model.create_time.ToString())).ToString(); if (tb_purchase_Model.update_time > 0) { lblupdate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_purchase_Model.update_time.ToString())).ToString(); } orderstatus = tb_purchase_Model.order_status; if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString()) { //已提交状态屏蔽提交、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString()) { //已审核时屏蔽提交、审核、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString() || orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString()) { //审核没通过时屏蔽审核按钮 base.btnVerify.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString()) { base.btnActivation.Caption = "激活"; base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; } } } }
/// <summary> /// 加载供应商档案信息 /// </summary> private void LoadInfo(string supperId) { if (!string.IsNullOrEmpty(supperId)) { //1.加载供应商档案主信息 DataTable dt = DBHelper.GetTable("查看一条供应商档案信息", "tb_supplier", "*", " sup_id='" + supperId + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { tb_supplier model = new tb_supplier(); CommonFuncCall.SetModlByDataTable(model, dt); CommonFuncCall.SetShowControlValue(this, model, "View"); DataTable dt_bill = CommonFuncCall.GetDataTable(); if (!string.IsNullOrEmpty(model.sup_type)) { lblsup_type.Text = CommonFuncCall.GetBillNameByBillCode(dt_bill, model.sup_type); } if (!string.IsNullOrEmpty(model.unit_properties)) { lblunit_properties.Text = CommonFuncCall.GetBillNameByBillCode(dt_bill, model.unit_properties); } if (!string.IsNullOrEmpty(model.price_type)) { lblprice_type.Text = CommonFuncCall.GetBillNameByBillCode(dt_bill, model.price_type); } if (!string.IsNullOrEmpty(model.credit_class)) { lblcredit_class.Text = CommonFuncCall.GetBillNameByBillCode(dt_bill, model.credit_class); } if (!string.IsNullOrEmpty(model.county)) { lblsup_address.Text = CommonFuncCall.GetAddress(model.county) + " " + lblsup_address.Text; } else { if (!string.IsNullOrEmpty(model.city)) { lblsup_address.Text = CommonFuncCall.GetAddress(model.city) + " " + lblsup_address.Text; } else { if (!string.IsNullOrEmpty(model.province)) { lblsup_address.Text = CommonFuncCall.GetAddress(model.province) + " " + lblsup_address.Text; } } } } } }
/// <summary> /// 加载仓库档案信息 /// </summary> private void LoadInfo(string wareHouseId) { if (!string.IsNullOrEmpty(wareHouseId)) { //1.加载仓库档案主信息 DataTable dt = DBHelper.GetTable("查看一条仓库档案信息", "v_warehouse_companyname_username", "*", " wh_id='" + wareHouseId + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { CommonFuncCall.SetModlByDataTable(tb_warehouse_Model, dt); CommonFuncCall.SetShowControlValue(this, tb_warehouse_Model, ""); txtChooseCompanty.Text = dt.Rows[0]["com_name"].ToString(); txtChooseCompanty.Tag = dt.Rows[0]["com_id"].ToString(); txtChooseWhHead.Text = dt.Rows[0]["wh_head"].ToString(); } //2.加载仓库货位信息 //3.加载附件信息 } }
/// <summary> /// 加载供应商档案信息 /// </summary> private void LoadInfo(string workingTimeId) { if (!string.IsNullOrEmpty(workingTimeId)) { //1.加载工时档案主信息 DataTable dt = DBHelper.GetTable("查看一条工时档案信息", "v_workhours_users", "*", " whours_id='" + workingTimeId + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { tb_workhours tb_workhours_Model = new tb_workhours(); CommonFuncCall.SetModlByDataTable(tb_workhours_Model, dt); CommonFuncCall.SetShowControlValue(this, tb_workhours_Model, ""); if (tb_workhours_Model.whours_type == "1") { radIsWorkTime.Checked = true; } else if (tb_workhours_Model.whours_type == "2") { radIsQuota.Checked = true; } lblcreate_by.Text = dt.Rows[0]["create_username"].ToString(); lblupdate_by.Text = dt.Rows[0]["update_username"].ToString(); if (!string.IsNullOrEmpty(lblcreate_time.Text)) { long ticks = (long)Convert.ToInt64(lblcreate_time.Text); lblcreate_time.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } if (!string.IsNullOrEmpty(lblupdate_time.Text)) { long ticks = (long)Convert.ToInt64(lblupdate_time.Text); lblupdate_time.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } DataTable dt_bill = CommonFuncCall.GetDataTable(); if (!string.IsNullOrEmpty(tb_workhours_Model.repair_type)) { lblrepair_type.Text = CommonFuncCall.GetBillNameByBillCode(dt_bill, tb_workhours_Model.repair_type); } } } }
/// <summary> /// 加载供应商档案信息 /// </summary> private void LoadInfo(string workingTimeId) { if (!string.IsNullOrEmpty(workingTimeId)) { //1.加载工时档案主信息 DataTable dt = DBHelper.GetTable("查看一条工时档案信息", "tb_workhours", "*", " whours_id='" + workingTimeId + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { CommonFuncCall.SetModlByDataTable(tb_workhours_Model, dt); CommonFuncCall.SetShowControlValue(this, tb_workhours_Model, ""); if (tb_workhours_Model.whours_type == "1") { radIsWorkTime.Checked = true; } else if (tb_workhours_Model.whours_type == "2") { radIsQuota.Checked = true; } } } }
/// <summary> /// 加载采购计划信息和配件信息 /// </summary> /// <param name="order_id"></param> private void LoadInfo(string order_id) { if (!string.IsNullOrEmpty(order_id)) { //1.查看一条采购订单信息 DataTable dt = DBHelper.GetTable("查看一条采购订单信息", "tb_parts_purchase_order", "*", " order_id='" + order_id + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { CommonFuncCall.SetModlByDataTable(tb_partspurchaseorder_Model, dt); CommonFuncCall.SetShowControlValue(this, tb_partspurchaseorder_Model, ""); chkis_suspend.Checked = tb_partspurchaseorder_Model.is_suspend == "0";//选中(中止):0,未选中(不中止):1 if (!string.IsNullOrEmpty(lblorder_status.Text)) { DataSources.EnumAuditStatus enumDataSources = (DataSources.EnumAuditStatus)Convert.ToInt16(lblorder_status.Text); lblorder_status.Text = DataSources.GetDescription(enumDataSources, true); } if (!string.IsNullOrEmpty(lblorder_date.Text)) { long ticks = Convert.ToInt64(lblorder_date.Text); lblorder_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } if (!string.IsNullOrEmpty(lblvalid_till.Text)) { long ticks = Convert.ToInt64(lblvalid_till.Text); lblvalid_till.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } if (!string.IsNullOrEmpty(lblarrival_date.Text)) { long ticks = Convert.ToInt64(lblarrival_date.Text); lblarrival_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } lblcreate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_partspurchaseorder_Model.create_time.ToString())).ToString(); if (tb_partspurchaseorder_Model.update_time > 0) { lblupdate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_partspurchaseorder_Model.update_time.ToString())).ToString(); } } } }
/// <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> 加载采购计划信息和配件信息 /// </summary> /// <param name="purchase_order_yt_id"></param> private void LoadInfo(string purchase_order_yt_id) { if (!string.IsNullOrEmpty(purchase_order_yt_id)) { //1.查看一条宇通采购订单信息 DataTable dt = DBHelper.GetTable("查看一条宇通采购订单信息", "tb_parts_purchase_order_2", "*", " purchase_order_yt_id='" + purchase_order_yt_id + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { CommonFuncCall.SetModlByDataTable(yt_purchaseorder_model, dt); CommonFuncCall.SetShowControlValue(this, yt_purchaseorder_model, "View"); if (!string.IsNullOrEmpty(lblorder_date.Text)) { long ticks = Convert.ToInt64(lblorder_date.Text); lblorder_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } lblcreate_time1.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(yt_purchaseorder_model.create_time.ToString())).ToString(); if (yt_purchaseorder_model.update_time > 0) { lblupdate_time1.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(yt_purchaseorder_model.update_time.ToString())).ToString(); } } } }
/// <summary> /// 加载仓库档案信息 /// </summary> private void LoadInfo(string wareHouseId) { if (!string.IsNullOrEmpty(wareHouseId)) { //1.加载仓库档案主信息 DataTable dt = DBHelper.GetTable("查看一条仓库档案信息", "v_warehouse_companyname_username", "*", " wh_id='" + wareHouseId + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { tb_warehouse tb_warehouse_Model = new tb_warehouse(); CommonFuncCall.SetModlByDataTable(tb_warehouse_Model, dt); CommonFuncCall.SetShowControlValue(this, tb_warehouse_Model, "View"); lblcom_id.Text = dt.Rows[0]["com_name"].ToString(); DataSources.EnumDataSources enumDataSources = (DataSources.EnumDataSources)Convert.ToInt16(tb_warehouse_Model.data_source); lbldata_source.Text = DataSources.GetDescription(enumDataSources, true); if (!string.IsNullOrEmpty(tb_warehouse_Model.county)) { lblwh_address.Text = CommonFuncCall.GetAddress(tb_warehouse_Model.county) + " " + lblwh_address.Text; } else { if (!string.IsNullOrEmpty(tb_warehouse_Model.city)) { lblwh_address.Text = CommonFuncCall.GetAddress(tb_warehouse_Model.city) + " " + lblwh_address.Text; } else { if (!string.IsNullOrEmpty(tb_warehouse_Model.province)) { lblwh_address.Text = CommonFuncCall.GetAddress(tb_warehouse_Model.province) + " " + lblwh_address.Text; } } } } } }
/// <summary> 通过审核后向宇通发送宇通采购订单信息 /// </summary> /// <param name="listField">宇通采购订单号集合</param> void DealPurascherToYT(List <string> listField) { try { if (listField.Count > 0) { for (int a = 0; a < listField.Count; a++) { DataTable dt = DBHelper.GetTable("查看一条宇通采购订单信息", "tb_parts_purchase_order_2", "*", " purchase_order_yt_id='" + listField[a] + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { yt_purchaseorder_model = new tb_parts_purchase_order_2(); yt_purchaseorder_model.listDetails = new List <tb_parts_purchase_order_p_2>(); CommonFuncCall.SetModlByDataTable(yt_purchaseorder_model, dt); DataTable dt_parts = DBHelper.GetTable("查看宇通采购订单配件信息", "tb_parts_purchase_order_p_2", "*", " purchase_order_yt_id='" + listField[a] + "'", "", ""); if (dt_parts != null && dt_parts.Rows.Count > 0) { for (int i = 0; i < dt_parts.Rows.Count; i++) { yt_partsorder_model = new tb_parts_purchase_order_p_2(); CommonFuncCall.SetModlByDataTable(yt_partsorder_model, dt_parts, i); yt_purchaseorder_model.listDetails.Add(yt_partsorder_model); } } if (yt_purchaseorder_model.crm_bill_id == ".") { yt_purchaseorder_model.crm_bill_id = string.Empty; } DBHelper.WebServHandler("", EnumWebServFunName.UpLoadPartPurchase, yt_purchaseorder_model); } } } } catch (Exception ex) { } }
/// <summary> /// 加载采购开单信息和配件信息 /// </summary> /// <param name="purchase_billing_id"></param> private void LoadInfo(string purchase_billing_id) { if (!string.IsNullOrEmpty(purchase_billing_id)) { //1.查看一条采购订单信息 DataTable dt = DBHelper.GetTable("查看一条采购开单信息", "tb_parts_purchase_billing", "*", " purchase_billing_id='" + purchase_billing_id + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { CommonFuncCall.SetModlByDataTable(tb_partspurchasebill_Model, dt); CommonFuncCall.SetShowControlValue(this, tb_partspurchasebill_Model, "View"); //采购收货 if (tb_partspurchasebill_Model.order_type == "1") { storage_count.HeaderText = "入库数量"; } //采购退货 else if (tb_partspurchasebill_Model.order_type == "2") { storage_count.HeaderText = "出库数量"; } //采购换货 else if (tb_partspurchasebill_Model.order_type == "3") { storage_count.HeaderText = "出/入库数量"; } if (!string.IsNullOrEmpty(lblorder_date.Text)) { long ticks = Convert.ToInt64(lblorder_date.Text); lblorder_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } if (!string.IsNullOrEmpty(lblpayment_date.Text)) { long ticks = Convert.ToInt64(lblpayment_date.Text); lblpayment_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } lblcreate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_partspurchasebill_Model.create_time.ToString())).ToString(); if (tb_partspurchasebill_Model.update_time > 0) { lblupdate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_partspurchasebill_Model.update_time.ToString())).ToString(); } orderstatus = tb_partspurchasebill_Model.order_status; if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString()) { //已提交状态屏蔽提交、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString()) { //已审核时屏蔽提交、审核、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString() || orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString()) { //审核没通过时屏蔽审核按钮 base.btnVerify.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString()) { base.btnActivation.Caption = "激活"; base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; } } } }
/// <summary> /// 加载销售计划信息和配件信息 /// </summary> /// <param name="sale_billing_id"></param> private void LoadInfo(string sale_billing_id) { if (!string.IsNullOrEmpty(sale_billing_id)) { //1.查看一条销售开单信息 DataTable dt = DBHelper.GetTable("查看一条销售开单信息", "tb_parts_sale_billing", "*", " sale_billing_id='" + sale_billing_id + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { CommonFuncCall.SetModlByDataTable(tb_salebill_Model, dt); CommonFuncCall.SetShowControlValue(this, tb_salebill_Model, ""); //销售开单 if (tb_salebill_Model.order_type == "1") { library_count.HeaderText = "出库数量"; return_count.Visible = true; //退货数量 assisted_auxiliary_count.Visible = true; //辅助数量 is_loss.Visible = false; //是否报损(0:不报损,1:报损) loss_count.Visible = false; //已报损数量 } //销售退货 else if (tb_salebill_Model.order_type == "2") { library_count.HeaderText = "入库数量"; return_count.Visible = false; //退货数量 assisted_auxiliary_count.Visible = false; //辅助数量 is_loss.Visible = true; //是否报损(0:不报损,1:报损) loss_count.Visible = true; //已报损数量 } //销售换货 else if (tb_salebill_Model.order_type == "3") { library_count.HeaderText = "出/入库数量"; return_count.Visible = false; //退货数量 assisted_auxiliary_count.Visible = false; //辅助数量 is_loss.Visible = false; //是否报损(0:不报损,1:报损) loss_count.Visible = false; //已报损数量 } if (!string.IsNullOrEmpty(lblorder_date.Text)) { long ticks = Convert.ToInt64(lblorder_date.Text); lblorder_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } if (!string.IsNullOrEmpty(lblreceivables_date.Text)) { long ticks = Convert.ToInt64(lblreceivables_date.Text); lblreceivables_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } lblcreate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_salebill_Model.create_time.ToString())).ToString(); if (tb_salebill_Model.update_time > 0) { lblupdate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_salebill_Model.update_time.ToString())).ToString(); } orderstatus = tb_salebill_Model.order_status; if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString()) { //已提交状态屏蔽提交、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString()) { //已审核时屏蔽提交、审核、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString() || orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString()) { //审核没通过时屏蔽审核按钮 base.btnVerify.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString()) { base.btnActivation.Caption = "激活"; base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; } } } }
/// <summary> /// 审核通过后需要自动生成的单子的方法 /// </summary> void CreateBill(List <string> listField) { if (listField.Count > 0) { for (int i = 0; i < listField.Count; i++) { DataTable dt = DBHelper.GetTable("", "tb_parts_purchase_billing", "*", string.Format("purchase_billing_id='{0}'", listField[i]), "", ""); if (dt != null && dt.Rows.Count > 0) { tb_parts_purchase_billing model = new tb_parts_purchase_billing(); CommonFuncCall.SetModlByDataTable(model, dt); #region 当金额大于0时,自动生成预付款单 if (model.this_payment > 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.PAYMENT; a.org_id = model.org_id; b.billing_money = model.this_payment; //开单金额 b.documents_date = model.order_date; //单据日期 b.documents_id = model.purchase_billing_id; //单据ID b.documents_name = "采购开单"; //单据名称 b.documents_num = model.order_num; //单据编码 c.money = model.this_payment; //金额 c.balance_way = model.balance_way; //结算方式 c.check_number = model.check_number; //票号 DBOperation.AddBillReceivable(a, b, c); } #endregion #region 自动生产出入库单 #region 一:采购收货单-->自动生成入库单 if (model.order_type == DataSources.EnumPurchaseOrderType.PurchaseReceive.ToString()) { string stock_inout_id = string.Empty; //1.生成入库单 if (CreateIntoStock("入库单", model, ref stock_inout_id)) { //2.查询配件信息,生成配件信息入库单 DataTable dt_parts = DBHelper.GetTable("查询采购开单配件信息表", "tb_parts_purchase_billing_p", "*", " purchase_billing_id='" + model.purchase_billing_id + "'", "", ""); if (dt_parts != null && dt_parts.Rows.Count > 0) { for (int a = 0; a < dt_parts.Rows.Count; a++) { tb_parts_purchase_billing_p bill_p_model = new tb_parts_purchase_billing_p(); CommonFuncCall.SetModlByDataTable(bill_p_model, dt_parts, a); CreateIntoPartsStock(stock_inout_id, bill_p_model); } } } } #endregion #region 二:采购退货-->自动生成出库单 else if (model.order_type == DataSources.EnumPurchaseOrderType.PurchaseBack.ToString()) { string stock_inout_id = string.Empty; //1.生成出库单 if (CreateIntoStock("出库单", model, ref stock_inout_id)) { //2.查询配件信息,生成配件信息出库单 DataTable dt_parts = DBHelper.GetTable("查询采购开单配件信息表", "tb_parts_purchase_billing_p", "*", " purchase_billing_id='" + model.purchase_billing_id + "'", "", ""); if (dt_parts != null && dt_parts.Rows.Count > 0) { for (int a = 0; a < dt_parts.Rows.Count; a++) { tb_parts_purchase_billing_p bill_p_model = new tb_parts_purchase_billing_p(); CommonFuncCall.SetModlByDataTable(bill_p_model, dt_parts, a); CreateIntoPartsStock(stock_inout_id, bill_p_model); } } } } #endregion #region :采购换货-->自动生成出、入库单(数量大于0是入库,小于0是出库) else if (model.order_type == DataSources.EnumPurchaseOrderType.PurchaseExchange.ToString()) { string stock_in_id = string.Empty; string stock_out_id = string.Empty; //1.生成入库单 if (CreateIntoStock("入库单", model, ref stock_in_id)) { //2.查询配件入库数量大于0的,生成配件信息入库单 DataTable dt_parts = DBHelper.GetTable("查询采购开单配件信息表", "tb_parts_purchase_billing_p", "*", " purchase_billing_id='" + model.purchase_billing_id + "' and storage_count>0 ", "", ""); if (dt_parts != null && dt_parts.Rows.Count > 0) { for (int a = 0; a < dt_parts.Rows.Count; a++) { tb_parts_purchase_billing_p bill_p_model = new tb_parts_purchase_billing_p(); CommonFuncCall.SetModlByDataTable(bill_p_model, dt_parts, a); CreateIntoPartsStock(stock_in_id, bill_p_model); } } } //3.生成出库单 if (CreateIntoStock("出库单", model, ref stock_out_id)) { //4.查询配件入库数量小于0的,生成配件信息出库单 DataTable dt_parts = DBHelper.GetTable("查询采购开单配件信息表", "tb_parts_purchase_billing_p", "*", " purchase_billing_id='" + model.purchase_billing_id + "' and storage_count<0 ", "", ""); if (dt_parts != null && dt_parts.Rows.Count > 0) { for (int a = 0; a < dt_parts.Rows.Count; a++) { tb_parts_purchase_billing_p bill_p_model = new tb_parts_purchase_billing_p(); CommonFuncCall.SetModlByDataTable(bill_p_model, dt_parts, a); CreateIntoPartsStock(stock_out_id, bill_p_model); } } } } #endregion #endregion #region 向宇通发送配送单号 if (!string.IsNullOrEmpty(model.ration_send_code)) { //DBHelper.WebServHandler("审核通过入库时发送配送单号到宇通系统", EnumWebServFunName.UpLoadPartPutStore, model.ration_send_code); DBHelper.WebServHandler("", EnumWebServFunName.LoadPartInStore, model.ration_send_code); } #endregion } } } }
/// <summary> /// 审核通过后需要自动生成的单子的方法 /// </summary> void CreateBill(List <string> listField) { if (listField.Count > 0) { for (int i = 0; i < listField.Count; i++) { DataTable dt = DBHelper.GetTable("", "tb_parts_sale_billing", "*", string.Format("sale_billing_id='{0}'", listField[i]), "", ""); if (dt != null && dt.Rows.Count > 0) { tb_parts_sale_billing model = new tb_parts_sale_billing(); CommonFuncCall.SetModlByDataTable(model, dt); #region 当金额大于0时,自动生成预收款单 if (model.current_collect > 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.cust_id; //客户ID a.order_num = CommonUtility.GetNewNo(DataSources.EnumProjectType.RECEIVABLE); //订单号 a.order_type = (int)DataSources.EnumOrderType.RECEIVABLE; a.payment_type = (int)DataSources.EnumReceivableType.RECEIVABLE; a.org_id = model.org_id; b.billing_money = model.current_collect; //开单金额 b.documents_date = model.order_date; //单据日期 b.documents_id = model.org_id; //单据ID b.documents_name = "销售开单"; //单据名称 b.documents_num = model.order_num; //单据编码 c.money = model.current_collect; //金额 c.balance_way = model.balance_way; //结算方式 c.check_number = model.check_number; //票号 DBOperation.AddBillReceivable(a, b, c); } #endregion #region 自动生产出入库单 //1:销售开单-->自动生成出库单 if (model.order_type == DataSources.EnumSaleOrderType.SaleBill.ToString()) { string stock_inout_id = string.Empty; //1.生成出库单 if (CreateIntoStock("出库单", model, ref stock_inout_id)) { //2.查询配件信息,生成配件信息出库单 DataTable dt_parts = DBHelper.GetTable("查询销售开单配件信息表", "tb_parts_sale_billing_p", "*", " sale_billing_id='" + model.sale_billing_id + "'", "", ""); if (dt_parts != null && dt_parts.Rows.Count > 0) { for (int a = 0; a < dt_parts.Rows.Count; a++) { tb_parts_sale_billing_p bill_p_model = new tb_parts_sale_billing_p(); CommonFuncCall.SetModlByDataTable(bill_p_model, dt_parts, a); CreateIntoPartsStock(stock_inout_id, bill_p_model); } } } } //2:销售退货-->自动生成入库单 else if (model.order_type == DataSources.EnumSaleOrderType.SaleBack.ToString()) { string stock_inout_id = string.Empty; //1.生成入库单 if (CreateIntoStock("入库单", model, ref stock_inout_id)) { //2.查询配件信息,生成配件信息入库单 DataTable dt_parts = DBHelper.GetTable("查询销售开单配件信息表", "tb_parts_sale_billing_p", "*", " sale_billing_id='" + model.sale_billing_id + "'", "", ""); if (dt_parts != null && dt_parts.Rows.Count > 0) { for (int a = 0; a < dt_parts.Rows.Count; a++) { tb_parts_sale_billing_p bill_p_model = new tb_parts_sale_billing_p(); CommonFuncCall.SetModlByDataTable(bill_p_model, dt_parts, a); CreateIntoPartsStock(stock_inout_id, bill_p_model); } } } } //3:销售换货-->自动生成出、入库单(数量大于0是出库,小于0是入库) else if (model.order_type == DataSources.EnumSaleOrderType.SaleExchange.ToString()) { string stock_in_id = string.Empty; string stock_out_id = string.Empty; //1.生成入库单 if (CreateIntoStock("入库单", model, ref stock_in_id)) { //2.查询配件入库数量大于0的,生成配件信息入库单 DataTable dt_parts = DBHelper.GetTable("查询销售开单配件信息表", "tb_parts_sale_billing_p", "*", " sale_billing_id='" + model.sale_billing_id + "' and library_count<0 ", "", ""); if (dt_parts != null && dt_parts.Rows.Count > 0) { for (int a = 0; a < dt_parts.Rows.Count; a++) { tb_parts_sale_billing_p bill_p_model = new tb_parts_sale_billing_p(); CommonFuncCall.SetModlByDataTable(bill_p_model, dt_parts, a); CreateIntoPartsStock(stock_in_id, bill_p_model); } } } //3.生成出库单 if (CreateIntoStock("出库单", model, ref stock_out_id)) { //4.查询配件入库数量小于0的,生成配件信息出库单 DataTable dt_parts = DBHelper.GetTable("查询销售开单配件信息表", "tb_parts_sale_billing_p", "*", " sale_billing_id='" + model.sale_billing_id + "' and library_count>0 ", "", ""); if (dt_parts != null && dt_parts.Rows.Count > 0) { for (int a = 0; a < dt_parts.Rows.Count; a++) { tb_parts_sale_billing_p bill_p_model = new tb_parts_sale_billing_p(); CommonFuncCall.SetModlByDataTable(bill_p_model, dt_parts, a); CreateIntoPartsStock(stock_out_id, bill_p_model); } } } } #endregion } } } }
/// <summary> /// 加载采购计划信息和配件信息 /// </summary> /// <param name="order_id"></param> private void LoadInfo(string order_id) { if (!string.IsNullOrEmpty(order_id)) { //1.查看一条采购订单信息 DataTable dt = DBHelper.GetTable("查看一条采购订单信息", "tb_parts_purchase_order", "*", " order_id='" + order_id + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { CommonFuncCall.SetModlByDataTable(tb_partspurchaseorder_Model, dt); CommonFuncCall.SetShowControlValue(this, tb_partspurchaseorder_Model, ""); chkis_suspend.Checked = tb_partspurchaseorder_Model.is_suspend == "0";//选中(中止):0,未选中(不中止):1 if (!string.IsNullOrEmpty(lblorder_status.Text)) { DataSources.EnumAuditStatus enumDataSources = (DataSources.EnumAuditStatus)Convert.ToInt16(lblorder_status.Text); lblorder_status.Text = DataSources.GetDescription(enumDataSources, true); } if (!string.IsNullOrEmpty(lblorder_date.Text)) { long ticks = Convert.ToInt64(lblorder_date.Text); lblorder_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } if (!string.IsNullOrEmpty(lblvalid_till.Text)) { long ticks = Convert.ToInt64(lblvalid_till.Text); lblvalid_till.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } if (!string.IsNullOrEmpty(lblarrival_date.Text)) { long ticks = Convert.ToInt64(lblarrival_date.Text); lblarrival_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } lblcreate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_partspurchaseorder_Model.create_time.ToString())).ToString(); if (tb_partspurchaseorder_Model.update_time > 0) { lblupdate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_partspurchaseorder_Model.update_time.ToString())).ToString(); } orderstatus = tb_partspurchaseorder_Model.order_status.ToString(); if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString()) { //已提交状态屏蔽提交、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString()) { //已审核时屏蔽提交、审核、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString() || orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString()) { //审核没通过时屏蔽审核按钮 base.btnVerify.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString()) { base.btnActivation.Caption = "激活"; base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; } } } }