using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using H6Bll.Order;
using System.Text;
using LinqSql;
using H6Bll;
using System.Globalization;
using HZSoft.Common;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using FarPoint.Win.Spread;
namespace OrderH6Form.订单款式信息
{
public partial class FormImageShow : DevExpress.XtraEditors.XtraForm
{
public FormImageShow()
{
InitializeComponent();
}
private H6_OrderStyle modelOdrerStyle;
public H6_OrderStyle ModelOdrerStyle
{
get { return modelOdrerStyle; }
set { modelOdrerStyle = value; }
}
private void FormImageShow_Load(object sender, EventArgs e)
{
FarPoint.Win.Spread.StyleInfo align = new FarPoint.Win.Spread.StyleInfo();
align.VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Center;
align.HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
this.fpSpread.ActiveSheet.DefaultStyle = align;
fpSpread.ActiveSheet.Rows.Clear();//清理行
fpSpread.ActiveSheet.Rows.Count = 50;//重新添加行
fpSpread.ActiveSheet.AddSpanCell(1,1,1,3);//合并的功能
fpSpread.ActiveSheet.AddSpanCell(0,0, 1, 16);//合并的功能
fpSpread.ActiveSheet.AddSpanCell(1, 5, 1, 3);//合并的功能
fpSpread.ActiveSheet.AddSpanCell(1, 9, 1, 3);//合并的功能
fpSpread.ActiveSheet.AddSpanCell(1, 13, 1, 3);//合并的功能
fpSpread.ActiveSheet.Cells[0, 0].Text = "南通呈业订单汇总表";//加文字
fpSpread.ActiveSheet.Cells[1, 1].Text = modelOdrerStyle.MR.Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[1, 5].Text = modelOdrerStyle.StyleName.Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[1, 9].Text = modelOdrerStyle.ConsingDate.Hz_TypeChange_ToDateTime().ToShortDateString().Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[1, 13].Text = modelOdrerStyle.SelectDate.Hz_TypeChange_ToDateTime().ToShortDateString().Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[1, 0].Text = "MR";//加文字
fpSpread.ActiveSheet.Cells[1, 4].Text = "品名";//加文字
fpSpread.ActiveSheet.Cells[1, 8].Text = "交期";//加文字
fpSpread.ActiveSheet.Cells[1, 12].Text = "制单日期";//加文字
fpSpread.ActiveSheet.AddSpanCell(2, 13, 1, 3);//合并的功能
fpSpread.ActiveSheet.AddSpanCell(2, 1, 1, 3);//合并的功能
fpSpread.ActiveSheet.Cells[2, 0].Text = "款号";//加文字
fpSpread.ActiveSheet.Cells[2, 1].Text = modelOdrerStyle.StyleCode.Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[2, 4].Text = "组别";//加文字
fpSpread.ActiveSheet.Cells[2, 5].Text = modelOdrerStyle.Group.Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[2, 6].Text = "STYLE NO.";//加文字
fpSpread.ActiveSheet.Cells[2, 7].Text = modelOdrerStyle.StyleNo.Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[2, 8].Text = "季节";//加文字
fpSpread.ActiveSheet.Cells[2, 9].Text = modelOdrerStyle.Season.Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[2, 10].Text = "I NO.";//加文字
fpSpread.ActiveSheet.Cells[2, 11].Text = modelOdrerStyle.PINO.Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[2, 12].Text = "QC";//加文字
fpSpread.ActiveSheet.Cells[2, 13].Text = modelOdrerStyle.QC.Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.AddSpanCell(3, 0, 4, 1);//合并的功能
fpSpread.ActiveSheet.AddSpanCell(3, 1, 4, 13);//合并的功能
fpSpread.ActiveSheet.AddSpanCell(7, 1, 2, 13);//合并的功能
fpSpread.ActiveSheet.AddSpanCell(3, 14, 8, 2);//合并的功能
fpSpread.ActiveSheet.AddSpanCell(7, 0, 2, 1);//合并的功能
fpSpread.ActiveSheet.AddSpanCell(8, 1, 1, 11);//合并的功能
fpSpread.ActiveSheet.AddSpanCell(9, 1, 1, 13);//合并的功能
fpSpread.ActiveSheet.AddSpanCell(10, 1, 1, 13);//合并的功能
fpSpread.ActiveSheet.Cells[3, 0].Text = "品名描述";//加文字
FarPoint.Win.Spread.CellType.TextCellType textCellType1 = new FarPoint.Win.Spread.CellType.TextCellType();
textCellType1.TextOrientation = FarPoint.Win.TextOrientation.TextHorizontal;
textCellType1.Multiline = true;
textCellType1.WordWrap = true;
this.fpSpread.ActiveSheet.Cells.Get(3, 1).CellType = textCellType1;
this.fpSpread.ActiveSheet.Cells.Get(9, 1).CellType = textCellType1;
this.fpSpread.ActiveSheet.Cells.Get(10, 1).CellType = textCellType1;
fpSpread.ActiveSheet.Cells[3,1].HorizontalAlignment = CellHorizontalAlignment.Left;// .ceHorizontalAlignment = CellHorizontalAlignment.Center;
fpSpread.ActiveSheet.Cells[9, 1].HorizontalAlignment = CellHorizontalAlignment.Left;
fpSpread.ActiveSheet.Cells[10, 1].HorizontalAlignment = CellHorizontalAlignment.Left;
fpSpread.ActiveSheet.Cells[3, 1].Text = modelOdrerStyle.StyleDesc.Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[7, 1].Text = modelOdrerStyle.ProductionFactory.Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[9, 0].Text = "水洗指示";//加文字
fpSpread.ActiveSheet.Cells[9, 1].Text = modelOdrerStyle.WashIndicate.Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[10, 0].Text = "样衣指示";//加文字
fpSpread.ActiveSheet.Cells[10, 1].Text = modelOdrerStyle.SampleIndicate.Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[7, 0].Text = "生产工厂";//加文字
if (ModelOdrerStyle.Photo1 != null)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream(ModelOdrerStyle.Photo1.ToArray());
Image im = Image.FromStream(ms);
FarPoint.Win.Spread.CellType.ImageCellType imageCelltype = new FarPoint.Win.Spread.CellType.ImageCellType(FarPoint.Win.RenderStyle.StretchAndScale, Color.Black);
imageCelltype.Style = FarPoint.Win.RenderStyle.StretchAndScale;
fpSpread.ActiveSheet.Cells[3, 14].CellType = imageCelltype;
fpSpread.ActiveSheet.Cells[3, 14].Value = im;
}
fpSpread.ActiveSheet.Cells[11, 0].Text = "COLOR";//加文字
fpSpread.ActiveSheet.Cells[11, 1].Text = "颜色";//加文字
BllOrderStyle bllOrderStyle = new BllOrderStyle();
int sizeCount = 0;
int colorCount = 0;
DataTable dt = bllOrderStyle.GetOrderStyleSize(modelOdrerStyle.ID).Tables[0];
foreach(DataRow dr in dt.Rows)
{
//遍历列
for(int i=0;i<dt.Columns.Count;i++)
{
//fpSpread.ActiveSheet.Cells[12 + colorCount, 1].Text = dr[0].Hz_TypeChange_ToString(); //加文字
fpSpread.ActiveSheet.Cells[11, 2 + sizeCount].Text = dr[0].Hz_TypeChange_ToString();//加文字
sizeCount++;
}
}
DataTable dtColor = bllOrderStyle.GetOrderStyleColor(modelOdrerStyle.ID).Tables[0];
foreach (DataRow dr in dtColor.Rows)
{
//遍历列
for (int i = 0; i < dtColor.Columns.Count; i++)
{
fpSpread.ActiveSheet.Cells[12 + colorCount, 1].Text = dr[0].Hz_TypeChange_ToString();//加文字
colorCount++;
}
}
decimal sum = 0;
for (int i = 1; i <= sizeCount; i++)
{
for (int s = 1; s <=colorCount ; s++)
{
BllOrderStyle bllOrderStyleAmount = new BllOrderStyle();
DataRow dr0 = bllOrderStyleAmount.GetOrderStyleAmont(modelOdrerStyle.ID, fpSpread.ActiveSheet.Cells[11, 1 + s].Value.Hz_TypeChange_ToString(), fpSpread.ActiveSheet.Cells[11 + i, 1].Value.Hz_TypeChange_ToString()).Tables[0].Rows[0];
fpSpread.ActiveSheet.Cells[11 + i, 1 + s].Text = dr0[2].Hz_TypeChange_ToString();//加文字
sum += dr0[2].Hz_TypeChange_ToDecimal();
}
fpSpread.ActiveSheet.Cells[11 + i, sizeCount + 2].Text = sum.Hz_TypeChange_ToString();//加文字
sum = 0;
}
fpSpread.ActiveSheet.Cells[11,sizeCount+2].Text = "合计";//加文字
fpSpread.ActiveSheet.Cells[12+colorCount, 0].Text = "裁剪数量";//加文字
fpSpread.ActiveSheet.Cells[13+colorCount, 0].Text = "成衣重量";//加文字
fpSpread.ActiveSheet.AddSpanCell(14 - 2 + colorCount, 10, 1, 6);//合并的功能
fpSpread.ActiveSheet.Cells[14-2+colorCount, 10].Text = "注:单耗作采购用,并非实际单耗.但可供参考";//加文字
fpSpread.ActiveSheet.Cells[15 - 2 + colorCount, 10].Text = "单耗";//加文字
fpSpread.ActiveSheet.Cells[15 - 2 + colorCount, 11].Text = "数量";//加文字
fpSpread.ActiveSheet.Cells[15 - 2 + colorCount, 12].Text = "余量";//加文字
fpSpread.ActiveSheet.Cells[15 - 2 + colorCount, 13].Text = "计划数";//加文字
fpSpread.ActiveSheet.Cells[15 - 2 + colorCount, 14].Text = "进库数";//加文字
fpSpread.ActiveSheet.Cells[15 - 2 + colorCount, 15].Text = "备注";//加文字
BllOrderStyleBomFab bllOrderStyleBomFab = new BllOrderStyleBomFab();
List<string> liBomAcc = bllOrderStyleBomFab.GetOrderStyleBomAcc(modelOdrerStyle.ID);
for (int i = 0; i < liBomAcc.Count;i++)
{
BllMaterialAcc bllMaterialAcc = new BllMaterialAcc();
H6_MaterialAcc modelMaterialAcc=bllMaterialAcc.GetFirstAcc(liBomAcc);
DataTable dtAcc = bllMaterialAcc.GetOrderStyleAcc(modelOdrerStyle.ID, modelMaterialAcc.MaterialCode).Tables[0];
if (dtAcc.Rows.Count != 0)
{
DataRow dr = dtAcc.Rows[0];
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + i, 0].Text = modelMaterialAcc.CHName;//加文字
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + i, 1].Text = dr[0].Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + i, 10].Text = dr[1].Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + i, 11].Text = dr[2].Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + i, 11].Text = dr[3].Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + i, 15].Text = "呈业";//加文字
fpSpread.ActiveSheet.AddSpanCell(16 - 2 + colorCount + i, 1, 1, 9);//合并的功能
}
}
BllOrderStyleBomFab bllOrderStyleBomFabs = new BllOrderStyleBomFab();
List<string> liBomFabs = bllOrderStyleBomFabs.GetOrderStyleBomFab(modelOdrerStyle.ID);
for (int i = 0; i < liBomFabs.Count; i++)
{
BllMaterialAcc bllMaterialAcc = new BllMaterialAcc();
H6_MaterialFab modelMaterialFab = bllMaterialAcc.GetFirstFab(liBomFabs);
DataTable dtFab = bllMaterialAcc.GetOrderStyleFab(modelOdrerStyle.ID, modelMaterialFab.MaterialCode).Tables[0];
if (dtFab.Rows.Count != 0)
{
DataRow dr = dtFab.Rows[0];
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + i + liBomAcc.Count, 0].Text = modelMaterialFab.CHName;//加文字
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + i + liBomAcc.Count, 1].Text = dr[0].Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + i + liBomAcc.Count, 10].Text = dr[1].Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + i + liBomAcc.Count, 11].Text = dr[2].Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + i + liBomAcc.Count, 14].Text = dr[3].Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + i + liBomAcc.Count, 15].Text = "呈业";//加文字
fpSpread.ActiveSheet.AddSpanCell(16 - 2 + colorCount + i + liBomAcc.Count, 1, 1, 9);//合并的功能
}
}
BllOrderStyleTrademark bllOrderStyleTrademark = new BllOrderStyleTrademark();
List<H6_OrderStyleTrademark> li = bllOrderStyleTrademark.GetModelListByCol("OrderStyleID", ModelOdrerStyle.ID);
for (int i = 0; i < li.Count; i++)
{
H6_OrderStyleTrademark mode = li;
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + i + liBomAcc.Count + liBomFabs.Count, 0].Text = mode.ProcName.Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + i + liBomAcc.Count + liBomFabs.Count, 1].Text = mode.ProcDesc.Hz_TypeChange_ToString();//加文字
fpSpread.ActiveSheet.AddSpanCell(16 - 2 + colorCount + i + liBomAcc.Count + liBomFabs.Count, 1, 1, 9);//合并的功能
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + i + liBomAcc.Count + liBomFabs.Count, 15].Text = "工厂";//加文字
}
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + liBomAcc.Count + liBomFabs.Count + li.Count, 0].Text = "事记";//加文字
fpSpread.ActiveSheet.AddSpanCell(16 - 2 + colorCount + liBomAcc.Count + liBomFabs.Count + li.Count, 0, 2, 1);//合并的功能
fpSpread.ActiveSheet.AddSpanCell(15 - 2 + colorCount + liBomAcc.Count + liBomFabs.Count + li.Count + 1, 1, 2, 15);//合并的功能
BllOrderStyle bllOrderStyleGetUser= new BllOrderStyle();
if(modelOdrerStyle!=null)
{
fpSpread.ActiveSheet.Cells[16 - 2 + colorCount + liBomAcc.Count + liBomFabs.Count + li.Count, 1].Text = modelOdrerStyle.Remark.Hz_TypeChange_ToString();//加文字
}
HZ_User modelUser = bllOrderStyleGetUser.GetUserName(modelOdrerStyle.BuilderCode);
if (modelUser != null)
{
fpSpread.ActiveSheet.Cells[15 - 2 + colorCount + liBomAcc.Count + liBomFabs.Count + li.Count + 3, 15].Text = modelUser.Name.Hz_TypeChange_ToString();//加文字
}
fpSpread.ActiveSheet.Cells[15 - 2 + colorCount + liBomAcc.Count + liBomFabs.Count + li.Count + 3, 14].Text = "制单人:";//加文字
FarPoint.Win.LineBorder border = new FarPoint.Win.LineBorder(Color.Black, 1, false, false, true, true);//设置颜色
this.fpSpread.ActiveSheet.Cells[0, 0, 15 - 2 + colorCount + liBomAcc.Count + liBomFabs.Count + li.Count + 3, 15].Border = border;
}
private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
Close();
}
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
fpSpread.SaveExcel(saveFileDialog1.FileName, FarPoint.Win.Spread.Model.IncludeHeaders.BothCustomOnly);
}
}
}
} |
|