private void Redo(PfOrder allocateOrder) { if (this.RedoClick != null) { this.RedoClick(allocateOrder, this); } }
private void dataGridView1_SelectionChanged(object sender, EventArgs e) { try { PfOrder order = (PfOrder)this.dataGridView1.CurrentRow.DataBoundItem; if (order != null && order != curOrder) { List <PfOrderDetail> curInboundDetailList = CommonGlobalCache.ServerProxy.GetPfOrderDetails(order.ID); if (curInboundDetailList != null) { foreach (var item in curInboundDetailList) { Costume costume = CommonGlobalCache.GetCostume(item.CostumeID); item.BrandName = CommonGlobalCache.GetBrandName(costume.BrandID); item.CostumeName = costume.Name; } } dataGridViewPagingSumCtrl1.BindingDataSource(curInboundDetailList); curOrder = order; } } catch (Exception ex) { // CommonGlobalUtil.ShowError(ex); } }
private void Pick(PfOrder allocateOrder) { if (this.PickClick != null) { this.PickClick(allocateOrder, this); } }
private void LoadOrder(PfOrder order) { if (order != null) { //冲单重做 skinComboBox_PfCustomer.SelectedValue = order.PfCustomerID; dateTimePicker_Start.Value = order.CreateTime; numericTextBoxMoney.Value = order.PayMoney; SetPayType(order.PayType); skinComboBoxShopID.SelectedValue = order.ShopID; curInboundDetailList = GlobalCache.ServerProxy.GetPfOrderDetails(order.ID); if (curInboundDetailList != null) { foreach (var item in curInboundDetailList) { Costume costume = CommonGlobalCache.GetCostume(item.CostumeID); item.CostumeName = costume.Name; item.CustomerID = order.PfCustomerID; item.BrandName = CommonGlobalCache.GetBrandName(costume.BrandID); item.CustomerName = PfCustomerCache.GetPfCustomerName(item.CustomerID); } } skinTextBox_Remarks.Text = order.Remarks; } this.BindingInboundDetailSource(); }
private void TiDanForm_HangedOrderSelected(PfOrder hangedOrder) { action = OperationEnum.Pick; order = hangedOrder; LoadOrder(hangedOrder); BindingInboundDetailSource(); }
public WholesaleOrderDetailCtrl(PfOrder order) { InitializeComponent(); skinLabel2.Text = order.PayTypeName; dataGridViewPagingSumCtrl = new DataGridViewPagingSumCtrl(dataGridView1, new String[] { xSDataGridViewTextBoxColumn.DataPropertyName, sDataGridViewTextBoxColumn.DataPropertyName, mDataGridViewTextBoxColumn.DataPropertyName, lDataGridViewTextBoxColumn.DataPropertyName, xLDataGridViewTextBoxColumn.DataPropertyName, xL2DataGridViewTextBoxColumn.DataPropertyName, xL3DataGridViewTextBoxColumn.DataPropertyName, xL4DataGridViewTextBoxColumn.DataPropertyName, xL5DataGridViewTextBoxColumn.DataPropertyName, xL6DataGridViewTextBoxColumn.DataPropertyName, fDataGridViewTextBoxColumn.DataPropertyName, sumMoneyDataGridViewTextBoxColumn.DataPropertyName, sumCountDataGridViewTextBoxColumn.DataPropertyName }); dataGridViewPagingSumCtrl.Initialize(); this.curReturnOrder = order; this.Initialize(); MenuPermission = RolePermissionMenuEnum.批发发货退货单查询; }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (!DataGridViewUtil.CheckPerrmisson(this, sender, e)) { return; } if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } try { List <PfOrder> curReturnOrderListSource = (List <PfOrder>) this.dataGridView1.DataSource; PfOrder item = curReturnOrderListSource[e.RowIndex]; if (Column1.Index == e.ColumnIndex) { this.skinSplitContainer1.Panel2Collapsed = false; this.DetailClick?.Invoke(item, this.skinSplitContainer1.Panel2, false); } else if (Column2.Index == e.ColumnIndex) { this.DetailClick?.Invoke(item, this.skinSplitContainer1.Panel2, true); } else if (ColumnCancel.Index == e.ColumnIndex) { this.Cancel(item); } else if (ColumnRedo.Index == e.ColumnIndex) { this.Redo(item); } else if (ColumnPick.Index == e.ColumnIndex) { this.Pick(item); } else if (Column4.Index == e.ColumnIndex) { string fileName = ""; if (item.IsRefundOrder) { fileName = "批发退货单"; } else { fileName = "批发发货单"; } path = CJBasic.Helpers.FileHelper.GetPathToSave("保存文件", fileName + item.ID + new Date(DateTime.Now).ToDateInteger() + ".xls", Environment.GetFolderPath(Environment.SpecialFolder.Personal)); if (String.IsNullOrEmpty(path)) { return; } DetailExcept?.Invoke(item, this.skinSplitContainer1.Panel2, path); } } catch (Exception ex) { GlobalUtil.WriteLog(ex); } }
private void Search(PfOrder record) { try { if (GlobalUtil.EngineUnconnectioned(this)) { return; } skinLabelOrder.Text = record.ID; //List<BoundDetail> listPage = GlobalCache.ServerProxy. //GetDetail4SupplierAccountRecord(record.SourceOrderID); List <PfCustomerRetailDetail> listitems = new List <PfCustomerRetailDetail>(); listitems = GlobalCache.ServerProxy.GetPfCustomerRetailDetails(record.ID); /* List<PfOrderDetail> pfListItems=new List<PfOrderDetail>(); * // * if (record.IsRetail) * { * } * else * {*/ // pfListItems = GlobalCache.ServerProxy.GetPfOrderDetails(record.ID); // } //GetPfCustomerRetailDetails /* if (listitems != null) * { * int totalCount = 0; * decimal totalPrice = 0; * for (int i = 0; i < listitems.Count; i++) * { * totalCount += listitems[i].BuyCount; * //totalPrice += listitems[i].; * } * skinLabelCount.Text = totalCount.ToString(); * skinLabelPrice.Text = totalPrice.ToString(); * foreach (var item in listitems) * { * item.CostumeName = CommonGlobalCache.GetCostumeName(item.CostumeID); * * } * this.dataGridViewPagingSumCtrl.BindingDataSource<BoundDetail>(DataGridViewUtil.ToDataTable(listitems)); * }*/ if (listitems != null) { this.dataGridViewPagingSumCtrl.BindingDataSource <BoundDetail>(DataGridViewUtil.ToDataTable(listitems)); } } catch (Exception ee) { GlobalUtil.ShowError(ee); } finally { GlobalUtil.UnLockPage(this); } }
public WholesaleReturnCtrl(PfOrder order, OperationEnum action = OperationEnum.Add) { InitializeComponent(); Init(); if (!HasPermission(RolePermissionMenuEnum.批发发货退货单查询, RolePermissionEnum.重做_单据时间)) { dateTimePicker_Start.Enabled = false; } this.action = action; this.order = order; }
public void ShowDialog(PfOrder record) { try { this.record = record; this.ShowDialog(); } catch (Exception ex) { CommonGlobalUtil.ShowError(ex); } }
public DialogResult ShowDialog(PfOrder record) { this.record = record; if (record.IsRefundOrder) { this.Text = "批发退货单明细"; } else { this.Text = "批发发货单明细"; } return(ShowDialog()); }
private void baseButton3_Click(object sender, EventArgs e) { if (GlobalMessageBox.Show("确定清空下表数据吗?", "友情提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { dataGridView2.DataSource = null; curInboundDetailList?.Clear(); dataGridView2.Refresh(); if (action == OperationEnum.Pick) { order = null; action = OperationEnum.Add; } } }
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { try { if (e.RowIndex < -1 || e.ColumnIndex < -1) { return; } if (e.Value == null) { return; } DataGridView view = sender as DataGridView; PfOrder order = view.Rows[e.RowIndex].DataBoundItem as PfOrder; if (e.ColumnIndex == ColumnPick.Index) { if ((PfOrderStateEnum)order.State == PfOrderStateEnum.Normal) { e.Value = null; } } if (e.ColumnIndex == ColumnCancel.Index) { if (order.IsCancel || (PfOrderStateEnum)order.State == PfOrderStateEnum.HangUp) { e.Value = null; } } else if (e.ColumnIndex == ColumnRedo.Index) { if (!order.IsCancel || (PfOrderStateEnum)order.State == PfOrderStateEnum.HangUp) { e.Value = null; } } else if (e.ColumnIndex == ColumnPick.Index) { if ((PfOrderStateEnum)order.State == PfOrderStateEnum.Normal) { e.Value = null; } } } catch { } }
private void Search(PfOrder record) { try { if (GlobalUtil.EngineUnconnectioned(this)) { return; } skinLabelOrder.Text = record.ID; skinLabelOpreator.Text = record.AdminUserName; skinLabelSupplier.Text = record.PfCustomerName; //List<BoundDetail> listPage = GlobalCache.ServerProxy. //GetDetail4SupplierAccountRecord(record.SourceOrderID); //GetPfOrderDetails //ShowMessage(record.OrderType); this.Text = record.OrderType + "单明细"; List <PfOrderDetail> pflistPage = GlobalCache.ServerProxy.GetPfOrderDetails(record.ID); if (pflistPage != null) { int totalCount = 0; decimal totalPrice = 0; for (int i = 0; i < pflistPage.Count; i++) { totalCount += pflistPage[i].SumCount; totalPrice += pflistPage[i].SumCost; } skinLabelCount.Text = totalCount.ToString(); skinLabelPrice.Text = totalPrice.ToString(); foreach (var item in pflistPage) { item.CostumeName = CommonGlobalCache.GetCostumeName(item.CostumeID); } } this.dataGridViewPagingSumCtrl.BindingDataSource <BoundDetail>(DataGridViewUtil.ToDataTable(pflistPage)); } catch (Exception ee) { GlobalUtil.ShowError(ee); } finally { GlobalUtil.UnLockPage(this); } }
private void Cancel(PfOrder allocateOrder) { try { if (GlobalMessageBox.Show("是否确认操作?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } InteractResult result = null; allocateOrder.CancelUserID = CommonGlobalCache.CurrentUserID; if (allocateOrder.IsRefundOrder) { result = GlobalCache.ServerProxy.CancelPfReturn(allocateOrder.ID, CommonGlobalCache.CurrentUserID); } else { result = GlobalCache.ServerProxy.CancelPfDelivery(allocateOrder.ID, CommonGlobalCache.CurrentUserID); } switch (result?.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("冲单成功!"); break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } this.RefreshPage(); } catch (Exception ee) { ShowError(ee); } finally { UnLockPage(); } }
private void dataGridView_RetailDetail_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } try { PfOrder item = dataGridView_RetailDetail.Rows[e.RowIndex].DataBoundItem as PfOrder; if (e.ColumnIndex == iDDataGridViewTextBoxColumn.Index) { ShowForm(item); } } catch (Exception ee) { CommonGlobalUtil.ShowError(ee); } }
public WholesaleDeliveryCtrl1(PfOrder order, OperationEnum action = OperationEnum.Add) { InitializeComponent(); Init(); // IsShowOnePage = true; this.order = order; this.action = action; if (action == OperationEnum.Redo) { if (!HasPermission(RolePermissionMenuEnum.批发发货退货单查询, RolePermissionEnum.重做_单据时间)) { dateTimePicker_Start.Enabled = false; } } // this.skinTextBox_Remarks.Text = order.Remarks; }
private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.ColumnIndex < 0 || e.RowIndex < 0) { return; } try { DataGridView view = sender as DataGridView; PfOrder order = view.CurrentRow.DataBoundItem as PfOrder; curOrder = order; BaseButton_Select_Click(null, null); } catch (Exception ex) { // CommonGlobalUtil.ShowError(ex); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (!DataGridViewUtil.CheckPerrmisson(this, sender, e)) { return; } if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } List <PfOrder> list = (List <PfOrder>) this.dataGridView1.DataSource; PfOrder item = (PfOrder)list[e.RowIndex]; if (e.ColumnIndex == SourceOrderID.Index) { try { if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } if (item.IsRetail) { RetailCostumeOrderDetailForm form = new RetailCostumeOrderDetailForm(); form.ShowDialog(item); } else { PFCostumeOrderDetailForm Pfform = new PFCostumeOrderDetailForm(); Pfform.ShowDialog(item); } } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } } }
private void dataGridView_HangedOrder_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (!DataGridViewUtil.CheckPerrmisson(this, sender, e)) { return; } try { if (e.RowIndex > -1 && e.ColumnIndex > -1) { List <PfOrder> orders = dataGridView1.DataSource as List <PfOrder>; if (e.ColumnIndex == Column2.Index) { DialogResult dialogResult = GlobalMessageBox.Show("确定删除该条数据?", "提示", MessageBoxButtons.OKCancel); if (dialogResult != DialogResult.OK) { return; } PfOrder order = dataGridView1.Rows[e.RowIndex].DataBoundItem as PfOrder; InteractResult result = GlobalCache.ServerProxy.DeleteHangUpPf(order?.ID); switch (result.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("删除成功!"); DeleteSelectedHangedOrder(order); break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } } } catch (Exception ee) { GlobalUtil.ShowError(ee); } }
public WholesaleOrderDetailCtrl(String orderID) { InitializeComponent(); dataGridViewPagingSumCtrl = new DataGridViewPagingSumCtrl(dataGridView1, new String[] { xSDataGridViewTextBoxColumn.DataPropertyName, sDataGridViewTextBoxColumn.DataPropertyName, mDataGridViewTextBoxColumn.DataPropertyName, lDataGridViewTextBoxColumn.DataPropertyName, xLDataGridViewTextBoxColumn.DataPropertyName, xL2DataGridViewTextBoxColumn.DataPropertyName, xL3DataGridViewTextBoxColumn.DataPropertyName, xL4DataGridViewTextBoxColumn.DataPropertyName, xL5DataGridViewTextBoxColumn.DataPropertyName, xL6DataGridViewTextBoxColumn.DataPropertyName, fDataGridViewTextBoxColumn.DataPropertyName, sumMoneyDataGridViewTextBoxColumn.DataPropertyName, sumCountDataGridViewTextBoxColumn.DataPropertyName }); dataGridViewPagingSumCtrl.Initialize(); GetPfOrderPagePara para = new GetPfOrderPagePara() { PfOrderID = orderID, PageIndex = 0, PageSize = 1 }; PfOrderPage listPage = CommonGlobalCache.ServerProxy.GetPfOrderPage(para); if (listPage != null && listPage.PfOrders.Count == 1) { //获取order this.curReturnOrder = listPage.PfOrders[0]; } this.Initialize(); }
private void ShowForm(PfOrder order) { try { if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } CustomerOrderDetailForm form = new CustomerOrderDetailForm(); // form.BaseModifyCostumeID = para.CostumeID; form.ShowDialog(order); /* if (order.Type == "调拨") * { * //采购进货明细 * CostumeStoreTrackSearchTurnOutDetailForm form * = new CostumeStoreTrackSearchTurnOutDetailForm(); * form.BaseModifyCostumeID = para.CostumeID; * // form.ShowDialog(order); * } * else * { * CostumeStoreTrackSearchTurnOutDetailWholeSaleForm form = new CostumeStoreTrackSearchTurnOutDetailWholeSaleForm(); * form.BaseModifyCostumeID = para.CostumeID; * form.ShowDialog(order); * }*/ } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void TiDanForm_HangedOrderSelected(PfOrder hangedOrder) { action = OperationEnum.Pick; order = hangedOrder; LoadOrder(hangedOrder); }
private PfInfo Build() { if ( this.curInboundDetailList == null || this.curInboundDetailList.Count == 0) { return(null); } int totalCount = 0; decimal totalPrice = 0; decimal totalCost = 0; List <PfOrderDetail> details = new List <PfOrderDetail>(); //使用补货申请单的店铺ID信息 // Shop shop = GlobalCache.ShopList.Find(t => t.ID == this.curReplenishOrder.ShopID); Shop shop = (Shop)this.skinComboBoxShopID.SelectedItem; string id = IDHelper.GetID(OrderPrefix.PfDelivery, shop.AutoCode); if (action == OperationEnum.Pick) { id = order?.ID; } // string pOrderID = IDHelper.GetID(OrderPrefix.PurchaseOrder, shop.AutoCode); foreach (PfOrderDetail detail in this.curInboundDetailList) { if (detail.SumCount <= 0) { continue; } totalCount += detail.SumCount; totalPrice += detail.SumMoney; totalCost += detail.SumCost; detail.PfOrderID = id; details.Add(detail); } PfOrder pOrder = new PfOrder() { ShopID = shop.ID, PfCustomerID = selectedSupplierID,// ValidateUtil.CheckEmptyValue(this.skinComboBox_SupplierID.SelectedValue), ID = id, AdminUserID = GlobalCache.CurrentUserID, CreateTime = dateTimePicker_Start.Value, EntryTime = DateTime.Now, TotalCount = totalCount, TotalPrice = totalPrice, TotalPfPrice = totalCost, Remarks = this.skinTextBox_Remarks.SkinTxt.Text // InboundOrderID= }; return(new PfInfo() { PfOrder = pOrder, PfOrderDetails = details }); }
private void Export(PfOrder item) { }
//简单打印示例 public static void Print(PfOrder item, DataGridView dataGridView2, int times = 1) { InteractResult <PrintTemplateInfo> result; if (item.IsRefundOrder) { result = CommonGlobalCache.ServerProxy.GetPrintTemplateInfo(PrintTemplateType.PfTOrder); } else { result = CommonGlobalCache.ServerProxy.GetPrintTemplateInfo(PrintTemplateType.PfOrder); } if (result.ExeResult == ExeResult.Success) { PrintTemplateInfo CurrentPTemplate = result.Data; for (int c = 0; c < CurrentPTemplate.PrintCount; c++) { GoldPrinter.MisGoldPrinter misGoldPrinter = new GoldPrinter.MisGoldPrinter(false, new PrinterMargins(20, 20, 20, 20, 800, 1129)); if (CurrentPTemplate.OrderName != "") { misGoldPrinter.Title = CurrentPTemplate.OrderName; //主标题(C#用\n表示换行) } misGoldPrinter.Caption = ""; double headRow = Math.Round(Convert.ToSingle(CurrentPTemplate.SystemVariables.Count / 2)); Header header = new Header(Convert.ToInt32(headRow) + 1, 2); header.IsDrawAllPage = true; CommonGlobalUtil.WriteLog("变量总数=" + CurrentPTemplate.SystemVariables.Count + "\r\n" + "应显示行号=" + headRow + 1); //GoldPrinter.MisGoldPrinter misGoldPrinter = new GoldPrinter.MisGoldPrinter(false, new PrinterMargins(20, 20, 20, 20, 787, 1129)); // if (item.IsRefundOrder) // { // misGoldPrinter.Title = "批发退货单"; // } // else // { // misGoldPrinter.Title = "批发发货单"; // } //// misGoldPrinter.Title = "批发单"; //主标题(C#用\n表示换行) // misGoldPrinter.Caption = ""; //副标题 // //misGoldPrinter.Top = "单号:" + item.AllocateOrder.ID + "|收货方:" + CommonGlobalCache.GetShopName(item.AllocateOrder.DestShopID) + "|开单日期:" + item.AllocateOrder.CreateTime; //抬头,一行三列的文字说明,用|分隔 for (int i = 0; i < CurrentPTemplate.SystemVariables.Count; i++) { int curR = 0; if (i < 2) { curR = 0; } else { double resRow = i / 2; curR = Convert.ToInt32(Math.Round(resRow)); } string KeyStr = ""; if (CurrentPTemplate.SystemVariables[i] == "单号") { KeyStr = "批发单号:"; header.SetText(curR, i % 2, CurrentPTemplate.SystemVariables[i] + item.ID); } else if (CurrentPTemplate.SystemVariables[i] == "客户") { KeyStr = "客 户:"; header.SetText(curR, i % 2, KeyStr + PfCustomerCache.GetUserNameWithPf(item.PfCustomerID)); } else if (CurrentPTemplate.SystemVariables[i] == "开单时间") { KeyStr = "开单时间:"; header.SetText(curR, i % 2, KeyStr + item.CreateTime.GetDateTimeFormats('f')[0].ToString()); } else if (CurrentPTemplate.SystemVariables[i] == "操作人") { KeyStr = "操 作 人:"; header.SetText(curR, i % 2, KeyStr + CommonGlobalCache.GetUserName(item.AdminUserID)); } else if (CurrentPTemplate.SystemVariables[i] == "付款方式") { KeyStr = "付款方式:"; header.SetText(curR, i % 2, KeyStr + item.PayTypeName); } else if (CurrentPTemplate.SystemVariables[i] == "总数量") { KeyStr = "总 数 量:"; header.SetText(curR, i % 2, KeyStr + item.TotalCount.ToString()); } else if (CurrentPTemplate.SystemVariables[i] == "上欠金额") { KeyStr = "上欠金额:"; header.SetText(curR, i % 2, KeyStr + item.PaymentBalanceOld.ToString()); } else if (CurrentPTemplate.SystemVariables[i] == "本次应收金额") { KeyStr = "本次应收金额:"; header.SetText(curR, i % 2, KeyStr + item.TotalPfPrice.ToString()); } else if (CurrentPTemplate.SystemVariables[i] == "应收总额") { KeyStr = "应收总额:"; header.SetText(curR, i % 2, KeyStr + item.PaymentBalance.ToString()); } else if (CurrentPTemplate.SystemVariables[i] == "单据备注") { KeyStr = "备 注:"; header.SetText(curR, i % 2, KeyStr + item.Remarks.ToString()); } } // Header header = new Header(4, 3); //行列数基本不受限制,但超过一页失去意义,因为以Body为主,以其它为辅 // header.IsDrawAllPage = true; //可以指定每页是否重复打印 //header.SetText(0, 0, "批发单号:" + item.ID); //header.SetText(0, 1, "客 户:" + PfCustomerCache.GetUserNameWithPf(item.PfCustomerID)); //header.SetText(0, 2, "开单时间:" + item.CreateTime.GetDateTimeFormats('f')[0].ToString()); //DataSource可以是字符串、一维数组、二维数组、DataTable、WinDataGrid、WebDataGrid、ListView\ListView、 //header.SetText(1, 0, "操 作 人:" + CommonGlobalCache.GetUserName(item.AdminUserID)); //header.SetText(1, 1, "付款方式:" + item.PayTypeName); //同仁们还可以根据实际应用对GridBase的DataSource进行扩展 //header.SetText(1, 2, String.Empty); //header.SetText(2, 0, "总 数 量:" + item.TotalCount.ToString()); //header.SetText(2, 1, "批发总额:" + item.TotalPfPrice.ToString()); //同仁们还可以根据实际应用对GridBase的DataSource进行扩展 //header.SetText(2, 2, String.Empty); //header.SetText(3, 0, "备 注:" ); //header.SetText(3, 1, item.Remarks); //同仁们还可以根据实际应用对GridBase的DataSource进行扩展 //header.SetText(3, 2, String.Empty); misGoldPrinter.Header = header; List <PrintColumnInfo> dataGV = CurrentPTemplate.PrintColumnInfos; string ColumnsList = string.Empty; foreach (PrintColumnInfo itemC in dataGV) { ColumnsList += itemC.Name + ","; } CommonGlobalUtil.WriteLog("模板设置打印列表头为=" + ColumnsList + "\r\n"); bool isflag = false; if (dataGV.Count == 0) { isflag = true; } // DataTable dt = dataGridView2.DataSource as DataTable; // DataTable newDt = new DataTable(); List <int> columnCount = new List <int>(); int pinrtColNum = 0; string dataGridColumnsList = string.Empty; for (int i = 0; i < dataGridView2.Columns.Count; i++) { DataGridViewColumn column = dataGridView2.Columns[i]; //if (column.HeaderText == "F" || column.HeaderText == "XS" || column.HeaderText == "S" || column.HeaderText == "M" || column.HeaderText == "L" // || column.HeaderText == "XL" || column.HeaderText == "XL2" || column.HeaderText == "XL3" || column.HeaderText == "XL4" || column.HeaderText == "XL5" // || column.HeaderText == "XL6") //{ // if (dataGV.FindAll(t => t.Name == "尺码列").Count > 0) // { // columnCount.Add(i); // } // else // { // column.Visible = false; // } //} //else //{ if (dataGV.FindAll(t => t.Name == column.HeaderText).Count > 0) { columnCount.Add(i); dataGridColumnsList += column.HeaderText + ","; pinrtColNum++; } else { if (dataGV.FindAll(t => t.Name == column.DataPropertyName).Count > 0) { columnCount.Add(i); column.HeaderText = column.HeaderText.Replace("\r\n", " "); dataGridColumnsList += column.DataPropertyName + ","; pinrtColNum++; } else { if (column.DataPropertyName.Contains("XL")) { string name = column.DataPropertyName; //XL3 //3XL string newname = name.Replace("XL", ""); string checkstr = newname + "XL"; if (dataGV.FindAll(t => t.Name == checkstr).Count > 0) { columnCount.Add(i); column.HeaderText = column.HeaderText.Replace("\r\n", " "); dataGridColumnsList += column.DataPropertyName + ","; pinrtColNum++; } else { column.Visible = false; } } else { column.Visible = false; } } } //} CommonGlobalUtil.WriteLog("DataGridView能打印的列为=" + dataGridColumnsList); if (isflag) { if (i == 0) { columnCount.Add(i); column.Visible = true; column.HeaderText = ""; DataTable dt = new DataTable(); DataColumn c1 = new DataColumn(); c1.ColumnName = "HeaderText"; dt.Columns.Add(c1); dataGridView2.DataSource = null; dataGridView2.DataSource = dt; } } } misGoldPrinter.DataSource = DataGridViewUtil.ToStringArray(dataGridView2, true, true); if (!Directory.Exists(CommonGlobalUtil.SystemDir + "EXPORTS\\")) { Directory.CreateDirectory(CommonGlobalUtil.SystemDir + "EXPORTS\\"); } misGoldPrinter.FileName = CommonGlobalUtil.SystemDir + "EXPORTS\\" + item.ID + ".jpg"; ((GoldPrinter.Body)(misGoldPrinter.Body)).Font = dataGridView2.Font; /* int[] widths = new int[] { * 80,100,50,40, 50, * 30,30,30,30,30,30,30,30,30,30,30 * ,40,50,50 * };*/ int[] widths = new int[CurrentPTemplate.PrintColumnInfos.Count]; CommonGlobalUtil.WriteLog("widths长度" + widths.Length); CommonGlobalUtil.WriteLog("实际打印数量=" + pinrtColNum + "\r\n" + "设置能打印的列数量=" + widths.Length.ToString()); for (int j = 0; j < CurrentPTemplate.PrintColumnInfos.Count; j++) { widths[j] = Convert.ToInt32(CurrentPTemplate.PrintColumnInfos[j].Rate); } List <int> widthList = new List <int>(); for (int i = 0; i < CurrentPTemplate.PrintColumnInfos.Count; i++) { DataGridViewColumn column = dataGridView2.Columns[columnCount[i]]; if (column.Visible && !String.IsNullOrEmpty(column.HeaderText)) { widthList.Add(widths[i]); } else { /* if (column.Visible && !String.IsNullOrEmpty(column.DataPropertyName)) * { * widthList.Add(widths[i]); * }*/ } } if (isflag) { widths = new int[1]; widths[0] = 100; widthList.Add(widths[0]); } widths = widthList.ToArray(); int newWidth = 800; /* int totalWidth = 0; * for (int i = 0; i < widths.Length; i++) * { * totalWidth += widths[i]; * }*/ for (int i = 0; i < widths.Length; i++) { widths[i] = decimal.ToInt32(Math.Round((widths[i] * newWidth * (decimal)0.1), 0, MidpointRounding.AwayFromZero)); // widths[i] = decimal.ToInt32(Math.Round((widths[i] * newWidth * (decimal)1.0 / totalWidth), 0, MidpointRounding.AwayFromZero)); } ((GoldPrinter.Body)(misGoldPrinter.Body)).ColsWidth = widths; //((GoldPrinter.Body)(misGoldPrinter.Body)).RowHeight = 100; misGoldPrinter.Preview(); misGoldPrinter.Dispose(); misGoldPrinter = null; } } } }
private void DeleteSelectedHangedOrder(PfOrder order) { orders.Remove(order); dataGridViewPagingSumCtrl.BindingDataSource(orders); }