public void generateExcelToCheck(List <BgaOutStruct> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("MPN"); titleList.Add("BGA简称"); titleList.Add("BGA描述"); titleList.Add("库位"); titleList.Add("出库数量"); titleList.Add("备注"); titleList.Add("领用人"); titleList.Add("日期"); foreach (BgaOutStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.mpn); ct1.Add(stockcheck.bga_brief); ct1.Add(stockcheck.bga_describe); ct1.Add(stockcheck.stock_place); ct1.Add(stockcheck.out_number); ct1.Add(stockcheck.note); ct1.Add(stockcheck.taker); ct1.Add(stockcheck.input_date); ctest1.contentArray = ct1; contentList.Add(ctest1); } Untils.createExcel("D:\\BGA出库信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <ReceiveOrderStruct> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("订单号"); titleList.Add("跟踪条码"); titleList.Add("客户料号"); titleList.Add("8S码"); titleList.Add("DPK类型"); titleList.Add("MAC"); titleList.Add("MPN"); titleList.Add("MB描述"); foreach (ReceiveOrderStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.orderNo); ct1.Add(stockcheck.trackno); ct1.Add(stockcheck.customMaterialNo); ct1.Add(stockcheck.custom_serial_no); ct1.Add(stockcheck.dpktype); ct1.Add(stockcheck.mac); ct1.Add(stockcheck.mpn); ct1.Add(stockcheck.mbdescribe); ctest1.contentArray = ct1; contentList.Add(ctest1); } Untils.createExcel("D:\\收货单信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <StoreHouseStruct> StockCheckList) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("ID"); titleList.Add("库房"); titleList.Add("储位"); titleList.Add("存储料号"); titleList.Add("厂商"); titleList.Add("已存数量"); titleList.Add("描述"); foreach (StoreHouseStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.Id); ct1.Add(stockcheck.house); ct1.Add(stockcheck.place); ct1.Add(stockcheck.mpn); ct1.Add(stockcheck.vendor); ct1.Add(stockcheck.number); ct1.Add(stockcheck.describe); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("" + this.houseComboBox.Text + "信息导出" + DateTime.Now.ToString("yyyy-MM-dd") + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <TestInfoStruct> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("跟踪条码"); titleList.Add("测试人"); titleList.Add("测试时间"); titleList.Add("MB检测"); titleList.Add("站别"); foreach (TestInfoStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.track_serial_no); ct1.Add(stockcheck.tester); ct1.Add(Utils.modifyDataFormat(stockcheck.test_date)); ct1.Add(stockcheck.mb_brief); ct1.Add(stockcheck.station); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("测试查询信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); //Utils.createExcelList(titleList, contentList); }
public void generatecidExcelToCheck(List <cidSumStruct> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("还货时间"); titleList.Add("索赔订单"); titleList.Add("客户料号"); titleList.Add("MB简称"); titleList.Add("数量"); foreach (cidSumStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.returndate); ct1.Add(stockcheck.ramno); ct1.Add(stockcheck.custommaterialNo); ct1.Add(stockcheck.mb_brief); ct1.Add(stockcheck.returnNum.ToString()); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("CID还货清单" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <print8sStruct> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("ID"); titleList.Add("跟踪条码"); titleList.Add("客户序号"); titleList.Add("输入人"); titleList.Add("日期"); foreach (print8sStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.Id); ct1.Add(stockcheck.track_serial_no); ct1.Add(stockcheck.custom_serial_no); ct1.Add(stockcheck.inputer); ct1.Add(stockcheck.input_date); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("MB出货信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public static void generateExcelToCheck(List <StockCheck> StockCheckList) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("料号"); titleList.Add("数量"); titleList.Add("库房"); titleList.Add("储位"); titleList.Add("描述"); titleList.Add("真实数量"); foreach (StockCheck stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.material_no); ct1.Add(stockcheck.num); ct1.Add(stockcheck.house); ct1.Add(stockcheck.place); ct1.Add(stockcheck.describe); ct1.Add(""); ctest1.contentArray = ct1; contentList.Add(ctest1); } Untils.createExcel("D:\\test.xlsx", titleList, contentList); }
public void generateExcelToCheck(List <MaterialConsumeStruct> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("MPN"); titleList.Add("描述"); titleList.Add("存储位置"); titleList.Add("消耗数量"); titleList.Add("当前库存数量"); foreach (MaterialConsumeStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.mpn); ct1.Add(stockcheck.brief); ct1.Add(stockcheck.stock_place); ct1.Add(stockcheck.out_number); ct1.Add(stockcheck.left_number); ctest1.contentArray = ct1; contentList.Add(ctest1); } Untils.createExcel("D:\\材料消耗信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <CidStruct> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("跟踪条码"); titleList.Add("厂商"); titleList.Add("客户别"); titleList.Add("库别"); titleList.Add("订单编号"); titleList.Add("客户料号"); titleList.Add("客户序号"); titleList.Add("MB简称"); titleList.Add("MPN"); titleList.Add("收货日期"); titleList.Add("客责描述"); titleList.Add("客责类别"); titleList.Add("客责描述"); titleList.Add("短路电压"); titleList.Add("录入日期"); titleList.Add("录入人"); titleList.Add("联想维修站编号"); titleList.Add("联想客服序号"); foreach (CidStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.track_serial_no); ct1.Add(stockcheck.vendor); ct1.Add(stockcheck.product); ct1.Add(stockcheck.storehouse); ct1.Add(stockcheck.custom_order); ct1.Add(stockcheck.custommaterialNo); ct1.Add(stockcheck.custom_serial_no); ct1.Add(stockcheck.mb_brief); ct1.Add(stockcheck.mpn); ct1.Add(stockcheck.order_receive_date); ct1.Add(stockcheck.custom_fault); ct1.Add(stockcheck.custom_res_type); ct1.Add(stockcheck.customResponsibility); ct1.Add(stockcheck.short_cut); ct1.Add(stockcheck.inputdate); ct1.Add(stockcheck.inputer); ct1.Add(stockcheck.lenovo_maintenance_no); ct1.Add(stockcheck.lenovo_custom_service_no); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("Cid信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); //Utils.createExcelList(titleList, contentList); }
public void generateExcelToCheck2(List <repaire_history_data> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("年"); titleList.Add("厂商"); titleList.Add("house"); titleList.Add("product"); titleList.Add("custom_material_no"); titleList.Add("MPN"); titleList.Add("mb_brief"); titleList.Add("sum_year"); titleList.Add("sum_1"); titleList.Add("sum_2"); titleList.Add("sum_3"); titleList.Add("sum_4"); titleList.Add("sum_5"); titleList.Add("sum_6"); titleList.Add("sum_7"); titleList.Add("sum_8"); titleList.Add("sum_9"); titleList.Add("sum_10"); titleList.Add("sum_11"); titleList.Add("sum_12"); foreach (repaire_history_data stockcheck in StockCheckList) { //year_,vendor,house,product,custom_material_no,mpn,mb_brief,sum_year, sum_1 ,sum_2,sum_3,sum_4,sum_5,sum_6,sum_7,sum_8,sum_9,sum_10,sum_11,sum_12 ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.year_); ct1.Add(stockcheck.vendor); ct1.Add(stockcheck.house); ct1.Add(stockcheck.product); ct1.Add(stockcheck.custom_material_no); ct1.Add(stockcheck.mpn); ct1.Add(stockcheck.mb_brief); ct1.Add(stockcheck.sum_year); ct1.Add(stockcheck.sum_1); ct1.Add(stockcheck.sum_2); ct1.Add(stockcheck.sum_3); ct1.Add(stockcheck.sum_4); ct1.Add(stockcheck.sum_5); ct1.Add(stockcheck.sum_6); ct1.Add(stockcheck.sum_7); ct1.Add(stockcheck.sum_8); ct1.Add(stockcheck.sum_9); ct1.Add(stockcheck.sum_10); ct1.Add(stockcheck.sum_11); ct1.Add(stockcheck.sum_12); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("维修历史数据" + DateTime.Now.ToString ("yyyy-MM-dd").Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck2(List <FruReturnStruct> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("订单编号"); titleList.Add("厂商"); titleList.Add("客户别"); titleList.Add("客户料号"); titleList.Add("机型"); titleList.Add("名称"); titleList.Add("客户物料描述"); titleList.Add("配件序号"); titleList.Add("客户序号"); titleList.Add("客户故障"); titleList.Add("生产日期"); titleList.Add("保内/保外"); titleList.Add("保外备注"); titleList.Add("厂商料号"); titleList.Add("MPN1"); titleList.Add("还货人"); titleList.Add("还货日期"); titleList.Add("TAT"); titleList.Add("状态"); foreach (FruReturnStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.orderno); ct1.Add(stockcheck.vendor); ct1.Add(stockcheck.product); ct1.Add(stockcheck.customermaterialno); ct1.Add(stockcheck.machine_type); ct1.Add(stockcheck.name); ct1.Add(stockcheck.customermaterialdes); ct1.Add(stockcheck.peijian_no); ct1.Add(stockcheck.customer_serial_no); ct1.Add(stockcheck.custom_fault); ct1.Add(stockcheck.make_date); ct1.Add(stockcheck.gurantee); ct1.Add(stockcheck.gurantee_note); ct1.Add(stockcheck.vendor_material_no); ct1.Add(stockcheck.mpn1); ct1.Add(stockcheck.receiver); ct1.Add(Utils.modifyDataFormat(stockcheck.receive_date)); ct1.Add(stockcheck.tat); ct1.Add(stockcheck._status); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("Fru还货信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <MBOutStruct> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("ID"); titleList.Add("跟踪条码"); titleList.Add("厂商"); titleList.Add("客户别"); titleList.Add("MPN"); titleList.Add("MB简称"); titleList.Add("描述"); titleList.Add("客户序号"); titleList.Add("厂商序号"); titleList.Add("厂商料号"); titleList.Add("客户料号"); titleList.Add("DPK类型"); titleList.Add("DPKPN"); titleList.Add("库位"); titleList.Add("备注"); titleList.Add("领用人"); titleList.Add("输入人"); titleList.Add("日期"); foreach (MBOutStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.Id); ct1.Add(stockcheck.track_serial_no); ct1.Add(stockcheck.vendor); ct1.Add(stockcheck.product); ct1.Add(stockcheck.mpn); ct1.Add(stockcheck.mb_brief); ct1.Add(stockcheck.describe); ct1.Add(stockcheck.custom_serial_no); ct1.Add(stockcheck.vendor_serial_no); ct1.Add(stockcheck.vendormaterialNo); ct1.Add(stockcheck.custommaterialNo); ct1.Add(stockcheck.dpk_type); ct1.Add(stockcheck.dpkpn); ct1.Add(stockcheck.stock_place); ct1.Add(stockcheck.note); ct1.Add(stockcheck.taker); ct1.Add(stockcheck.inputer); ct1.Add(stockcheck.input_date); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("MB出货信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <DpkStruct> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("Id"); titleList.Add("订单号"); titleList.Add("DPK类别"); titleList.Add("KEYPN"); titleList.Add("KEYID"); titleList.Add("KEYSERIAL"); titleList.Add("上传日期"); titleList.Add("状态"); titleList.Add("烧录日期"); titleList.Add("客户序号"); // dpk_type NVARCHAR(128) NOT NULL, /*DPK类别*/ //KEYPN NVARCHAR(128) NOT NULL, /*KEYPN*/ //KEYID NVARCHAR(128) NOT NULL, /*KEYID*/ //KEYSERIAL NVARCHAR(128) NOT NULL, /*KEYSERIAL*/ //_status NVARCHAR(128) NOT NULL, /*状态*/ //burn_date date,/*烧录日期*/ //custom_serial_no NVARCHAR(128) /*客户序号*/ foreach (DpkStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.id); ct1.Add(stockcheck.dpk_order_no); ct1.Add(stockcheck.dpk_type); ct1.Add(stockcheck.KEYPN); ct1.Add(stockcheck.KEYID); ct1.Add(stockcheck.KEYSERIAL); ct1.Add((stockcheck.upload_date != null && stockcheck.upload_date != "")? stockcheck.upload_date.Substring(0, stockcheck.upload_date.IndexOf(" ")).Trim() : ""); ct1.Add(stockcheck._status); ct1.Add((stockcheck.burn_date != null && stockcheck.burn_date != "") ? stockcheck.burn_date.Substring(0, stockcheck.burn_date.IndexOf(" ")).Trim() : ""); ct1.Add(stockcheck.custom_serial_no); ctest1.contentArray = ct1; contentList.Add(ctest1); } string addtion = "使用日期"; if (this.inputdateradioButton.Checked) { addtion = "导入日期"; } Utils.createExcel("DPK信息" + addtion + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <BgaInStruct> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("ID"); titleList.Add("采购订单编号"); titleList.Add("厂商"); titleList.Add("采购类别"); titleList.Add("客户别"); titleList.Add("材料大类"); titleList.Add("MPN"); titleList.Add("厂商料号"); titleList.Add("描述"); titleList.Add("单价"); titleList.Add("BGA简述"); titleList.Add("订单数量"); titleList.Add("入库数量"); titleList.Add("BGASN"); titleList.Add("库位"); titleList.Add("备注"); titleList.Add("输入人"); titleList.Add("日期"); foreach (BgaInStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.Id); ct1.Add(stockcheck.buy_order_serial_no); ct1.Add(stockcheck.vendor); ct1.Add(stockcheck.buy_type); ct1.Add(stockcheck.product); ct1.Add(stockcheck.material_type); ct1.Add(stockcheck.mpn); ct1.Add(stockcheck.vendormaterialNo); ct1.Add(stockcheck.describe); ct1.Add(stockcheck.pricePer); ct1.Add(stockcheck.bga_describe); ct1.Add(stockcheck.order_number); ct1.Add(stockcheck.input_number); ct1.Add(stockcheck.bgasn); ct1.Add(stockcheck.stock_place); ct1.Add(stockcheck.note); ct1.Add(stockcheck.inputer); ct1.Add(stockcheck.input_date); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("BGA收货信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <whole_import_sheet> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("ID"); titleList.Add("厂商"); titleList.Add("客户别"); titleList.Add("MB简称"); titleList.Add("客户机型"); titleList.Add("整机PN"); titleList.Add("整机描述"); titleList.Add("MPN"); titleList.Add("MB描述"); titleList.Add("出货量"); titleList.Add("出货日期"); titleList.Add("保修期"); titleList.Add("上传日期"); titleList.Add("材料采购类别"); titleList.Add("备注"); foreach (whole_import_sheet stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.Id); ct1.Add(stockcheck.vendor); ct1.Add(stockcheck.product); ct1.Add(stockcheck.mb_brief); ct1.Add(stockcheck.custom_machine_type); ct1.Add(stockcheck.machine_pn); ct1.Add(stockcheck.machine_describe); ct1.Add(stockcheck.mpn); ct1.Add(stockcheck.mb_describe); ct1.Add(stockcheck.out_number); ct1.Add(Utils.modifyDataFormat(stockcheck.out_date)); ct1.Add(stockcheck.gurrante_period); ct1.Add(Utils.modifyDataFormat(stockcheck.upload_ddate)); ct1.Add(stockcheck.buy_type); ct1.Add(stockcheck.note); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("整机出货量信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck3(List <FruQianHuoStruct> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); //厂商 客户别 仓库别 订单编号 客户料号 MB简称 MPN DPK类型 收货数量 还货数量 欠货数量 titleList.Add("厂商"); titleList.Add("客户别"); titleList.Add("仓库别"); titleList.Add("订单编号"); titleList.Add("客户料号"); titleList.Add("MB简称"); titleList.Add("MPN1"); titleList.Add("收货数量"); titleList.Add("还货数量"); titleList.Add("欠货数量"); titleList.Add("在途天数"); foreach (FruQianHuoStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.vendor); ct1.Add(stockcheck.product); ct1.Add(stockcheck.storehouse); ct1.Add(stockcheck.orderno); ct1.Add(stockcheck.custom_material_no); ct1.Add(stockcheck.mb_brief); ct1.Add(stockcheck.mpn); ct1.Add(stockcheck.receiveNum); ct1.Add(stockcheck.returnNum); ct1.Add(stockcheck.diffNum); ct1.Add(stockcheck.tat); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("Fru欠货信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <DpkStruct> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("DPK类别"); titleList.Add("KEYPN"); titleList.Add("KEYID"); titleList.Add("KEYSERIAL"); titleList.Add("状态"); titleList.Add("烧录日期"); titleList.Add("客户序号"); // dpk_type NVARCHAR(128) NOT NULL, /*DPK类别*/ //KEYPN NVARCHAR(128) NOT NULL, /*KEYPN*/ //KEYID NVARCHAR(128) NOT NULL, /*KEYID*/ //KEYSERIAL NVARCHAR(128) NOT NULL, /*KEYSERIAL*/ //_status NVARCHAR(128) NOT NULL, /*状态*/ //burn_date date,/*烧录日期*/ //custom_serial_no NVARCHAR(128) /*客户序号*/ foreach (DpkStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.dpk_type); ct1.Add(stockcheck.KEYPN); ct1.Add(stockcheck.KEYID); ct1.Add(stockcheck.KEYSERIAL); ct1.Add(stockcheck._status); ct1.Add(stockcheck.burn_date); ct1.Add(stockcheck.custom_serial_no); ctest1.contentArray = ct1; contentList.Add(ctest1); } Untils.createExcel("D:\\DPK信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <FaultMbStruct> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("跟踪条码"); titleList.Add("厂商sn"); titleList.Add("厂商"); titleList.Add("客户别"); titleList.Add("MB简称"); titleList.Add("MPN"); titleList.Add("MB描述"); titleList.Add("状态"); titleList.Add("PCH描述"); titleList.Add("VGA描述"); titleList.Add("CPU描述"); titleList.Add("入库人"); titleList.Add("入库日期"); titleList.Add("库房"); titleList.Add("库位"); titleList.Add("类型"); titleList.Add("缺陷描述"); titleList.Add("缺陷位置"); titleList.Add("缺陷原因"); titleList.Add("确认人"); titleList.Add("确认日期"); titleList.Add("PCB Zhouqi"); titleList.Add("PCB类型"); foreach (FaultMbStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.track_serial_no); ct1.Add(stockcheck.vendor_sn); ct1.Add(stockcheck.vendor); ct1.Add(stockcheck.product); ct1.Add(stockcheck.mb_brief); ct1.Add(stockcheck.mpn); ct1.Add(stockcheck.mb_describe); ct1.Add(stockcheck._status); ct1.Add(stockcheck.pch_brief); ct1.Add(stockcheck.vga_brief); ct1.Add(stockcheck.cpu_brief); ct1.Add(stockcheck.repairer); ct1.Add(stockcheck.repair_date); ct1.Add(stockcheck.house); ct1.Add(stockcheck.place); ct1.Add("报废"); ct1.Add(stockcheck.fault_describe); ct1.Add(stockcheck.fault_place); ct1.Add(stockcheck.fault_reason); ct1.Add(stockcheck.confirmer); ct1.Add(stockcheck.confirm_date); ct1.Add(stockcheck.pcbzhouqi); ct1.Add(stockcheck.pcbtype); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("MB报废信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <ReturnOrderStruct> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("ID"); titleList.Add("厂商"); titleList.Add("客户别"); titleList.Add("还货文件编号"); titleList.Add("客户库别"); titleList.Add("收货时间"); titleList.Add("还货时间"); titleList.Add("订单编号"); titleList.Add("客户料号"); titleList.Add("MB简称"); titleList.Add("DPK状态"); titleList.Add("跟踪条码"); titleList.Add("客户序号"); titleList.Add("厂商序号"); titleList.Add("厂商料号"); titleList.Add("状态"); titleList.Add("客责类别"); titleList.Add("客责描述"); titleList.Add("联想维修站编号"); titleList.Add("联想维修单编号"); titleList.Add("TAT"); titleList.Add("客户故障"); titleList.Add("联想客服序号"); titleList.Add("还货人"); foreach (ReturnOrderStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.Id); ct1.Add(stockcheck.vendor); ct1.Add(stockcheck.product); ct1.Add(stockcheck.return_file_no); ct1.Add(stockcheck.storehouse); ct1.Add(stockcheck.receive_date); ct1.Add(stockcheck.return_date); ct1.Add(stockcheck.orderno); ct1.Add(stockcheck.custommaterialNo); ct1.Add(stockcheck.mb_brief); ct1.Add(stockcheck.dpkpn); ct1.Add(stockcheck.track_serial_no); ct1.Add(stockcheck.custom_serial_no); ct1.Add(stockcheck.vendor_serail_no); ct1.Add(stockcheck.vendormaterialNo); ct1.Add(stockcheck._status); ct1.Add(stockcheck.custom_res_type); ct1.Add(stockcheck.response_describe); ct1.Add(stockcheck.lenovo_maintenance_no); ct1.Add(stockcheck.lenovo_repair_no); ct1.Add(stockcheck.tat); //ct1.Add(stockcheck.inputuser); ct1.Add(stockcheck.custom_fault); ct1.Add(stockcheck.lenovo_custom_service_no); ct1.Add(stockcheck.inputuser); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("还货信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <MBBgaMaterialStruct> StockCheckList, List <bgaReport> bgas, string startTime, string endTime) { List <allContent> allcontentList = new List <allContent>(); allContent firstsheet = new allContent(); firstsheet.sheetName = "MBBga材料一览表"; firstsheet.titleList = new List <string>(); firstsheet.contentList = new List <object>(); firstsheet.titleList.Add("厂商"); firstsheet.titleList.Add("客户别"); firstsheet.titleList.Add("MB简称"); firstsheet.titleList.Add("MPN"); firstsheet.titleList.Add("MB描述");; firstsheet.titleList.Add("厂商PCH_MPN"); firstsheet.titleList.Add("PCH简述"); firstsheet.titleList.Add("PCH描述"); firstsheet.titleList.Add("厂商VGA_MPN"); firstsheet.titleList.Add("VGA简述"); firstsheet.titleList.Add("VGA描述"); firstsheet.titleList.Add("厂商CPU_MPN"); firstsheet.titleList.Add("CPU简述"); firstsheet.titleList.Add("CPU描述"); firstsheet.titleList.Add("DPK类型"); firstsheet.titleList.Add("保修期"); firstsheet.titleList.Add("客户机型"); firstsheet.titleList.Add("整机出货量"); firstsheet.titleList.Add("客户退修量"); firstsheet.titleList.Add("MB购买数量"); firstsheet.titleList.Add("MB报废数量"); firstsheet.titleList.Add("MB报废率"); firstsheet.titleList.Add("材料类别"); foreach (MBBgaMaterialStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.vendor); ct1.Add(stockcheck.product); ct1.Add(stockcheck.mb_brief); ct1.Add(stockcheck.mpn); ct1.Add(stockcheck.mb_descripe); ct1.Add(stockcheck.vendor_pch_mpn); ct1.Add(stockcheck.pcb_brief_describe); ct1.Add(stockcheck.pcb_describe); ct1.Add(stockcheck.vendor_vga_mpn); ct1.Add(stockcheck.vga_brief_describe); ct1.Add(stockcheck.vga_describe); ct1.Add(stockcheck.vendor_cpu_mpn); ct1.Add(stockcheck.cpu_brief); ct1.Add(stockcheck.cpu_describe); ct1.Add(stockcheck.dpk_type); ct1.Add(stockcheck.warranty_period); ct1.Add(stockcheck.custom_machine_type); ct1.Add(stockcheck.whole_out_num); ct1.Add(stockcheck.repaire_num); ct1.Add(stockcheck.mb_buy_in_num); ct1.Add(stockcheck.mb_fault_num); ct1.Add(stockcheck.mb_fault_rate); ct1.Add(stockcheck.eol); ctest1.contentArray = ct1; firstsheet.contentList.Add(ctest1); } allcontentList.Add(firstsheet); allContent secondsheet = new allContent(); secondsheet.sheetName = "BGAMB一览表"; secondsheet.titleList = new List <string>(); secondsheet.contentList = new List <object>(); secondsheet.titleList.Add("BGA_厂商MPN"); secondsheet.titleList.Add("BGA简述"); secondsheet.titleList.Add("BGA描述"); secondsheet.titleList.Add("BGA类别"); secondsheet.titleList.Add("厂商"); secondsheet.titleList.Add("客户别"); secondsheet.titleList.Add("MB简称"); secondsheet.titleList.Add("mpn"); secondsheet.titleList.Add("对应整机出货量"); secondsheet.titleList.Add("客户退修量"); secondsheet.titleList.Add("近1个月MB退修量"); secondsheet.titleList.Add("近2个月MB退修量"); secondsheet.titleList.Add("BGA更换数量"); secondsheet.titleList.Add("BGA不良率"); secondsheet.titleList.Add("材料类别"); foreach (bgaReport stockcheck in bgas) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.bgapn); ct1.Add(stockcheck.bga_brief); ct1.Add(stockcheck.bga_desc); ct1.Add(stockcheck.bga_type); ct1.Add(stockcheck.vendor); ct1.Add(stockcheck.product); ct1.Add(stockcheck.mb_brief); ct1.Add(stockcheck.mpn); ct1.Add(stockcheck.whole_out_num); ct1.Add(stockcheck.repaire_num); ct1.Add(stockcheck.repair_num_1_month); ct1.Add(stockcheck.repair_num_2_month); ct1.Add(stockcheck.bga_change_number); ct1.Add(stockcheck.bga_rate); ct1.Add(stockcheck.material_type); ctest1.contentArray = ct1; secondsheet.contentList.Add(ctest1); } allcontentList.Add(secondsheet); Utils.createMulitSheetsUsingNPOI("MBBga材料一览表" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xls", allcontentList); }
private void button1_Click(object sender, EventArgs e) { DateTime time1 = Convert.ToDateTime(this.dateTimePickerstart.Value.Date.ToString("yyyy/MM/dd", System.Globalization.DateTimeFormatInfo.InvariantInfo)); DateTime time2 = Convert.ToDateTime(this.dateTimePickerend.Value.Date.ToString("yyyy/MM/dd", System.Globalization.DateTimeFormatInfo.InvariantInfo)); if (DateTime.Compare(time1, time2) > 0) //判断日期大小 { MessageBox.Show("开始日期大于结束"); return; } string startTime = this.dateTimePickerstart.Value.ToString("yyyy/MM/dd", System.Globalization.DateTimeFormatInfo.InvariantInfo); string endTime = this.dateTimePickerend.Value.ToString("yyyy/MM/dd", System.Globalization.DateTimeFormatInfo.InvariantInfo); List <RequireMaterialStruct> receiveOrderList = new List <RequireMaterialStruct>(); try { SqlConnection mConn = new SqlConnection(Constlist.ConStr); mConn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = mConn; cmd.CommandType = CommandType.Text; cmd.CommandText = "select mb_brief,not_good_place,material_mpn,material_describe,number,requester,_date from request_fru_smt_to_store_table where _date between '" + startTime + "' and '" + endTime + "'"; SqlDataReader querySdr = cmd.ExecuteReader(); while (querySdr.Read()) { RequireMaterialStruct temp = new RequireMaterialStruct(); temp.material_type = querySdr[0].ToString(); temp.place = querySdr[1].ToString(); temp.materialNo = querySdr[2].ToString(); temp.materialdescribe = querySdr[3].ToString(); temp.input_number = querySdr[4].ToString(); temp.inputer = querySdr[5].ToString(); temp.input_date = querySdr[6].ToString(); receiveOrderList.Add(temp); } querySdr.Close(); mConn.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("机型"); titleList.Add("位置"); titleList.Add("料号"); titleList.Add("描述"); titleList.Add("输入数量"); titleList.Add("輸入人"); titleList.Add("时间"); foreach (RequireMaterialStruct stockcheck in receiveOrderList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.material_type); ct1.Add(stockcheck.place); string materialNo = stockcheck.materialNo; if (materialNo.Contains("_")) { materialNo = materialNo.Split('_')[0]; } ct1.Add(materialNo); ct1.Add(stockcheck.materialdescribe); ct1.Add(stockcheck.input_number); ct1.Add(stockcheck.inputer); ct1.Add(stockcheck.input_date.Replace("0:00:00", "")); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("SMT小材料申请购买信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <BgaUsedStruct> StockCheckList, string startTime, string endTime, List <bagUsedSumStruct> bagWaitSumList) { List <allContent> allcontentList = new List <allContent>(); allContent firstsheet = new allContent(); firstsheet.sheetName = "BGA待料信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-'); firstsheet.titleList = new List <string>(); firstsheet.contentList = new List <object>(); firstsheet.titleList.Add("跟踪条码"); firstsheet.titleList.Add("客户料号"); firstsheet.titleList.Add("厂商"); firstsheet.titleList.Add("客户别"); firstsheet.titleList.Add("来源"); firstsheet.titleList.Add("订单编号"); firstsheet.titleList.Add("收货日期"); firstsheet.titleList.Add("MB描述"); firstsheet.titleList.Add("MB简称"); firstsheet.titleList.Add("客户序号"); firstsheet.titleList.Add("厂商序号"); firstsheet.titleList.Add("MPN"); firstsheet.titleList.Add("MB生产日期"); firstsheet.titleList.Add("客户故障"); firstsheet.titleList.Add("ECO"); firstsheet.titleList.Add("bga类型"); firstsheet.titleList.Add("BGAPN"); firstsheet.titleList.Add("BGA描述"); firstsheet.titleList.Add("BGA简述"); firstsheet.titleList.Add("老sn"); firstsheet.titleList.Add("新sn"); firstsheet.titleList.Add("更换原因"); firstsheet.titleList.Add("短路电压"); firstsheet.titleList.Add("维修人"); firstsheet.titleList.Add("更换人"); firstsheet.titleList.Add("更换日期"); firstsheet.titleList.Add("CPU采购类别"); firstsheet.titleList.Add("CPU是否更换"); foreach (BgaUsedStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.track_serial_no); ct1.Add(stockcheck.customMaterialNo); ct1.Add(stockcheck.vendor); ct1.Add(stockcheck.product); ct1.Add(stockcheck.source); ct1.Add(stockcheck.orderno); ct1.Add(Utils.modifyDataFormat(stockcheck.receivedate)); ct1.Add(stockcheck.mb_describe); ct1.Add(stockcheck.mb_brief); ct1.Add(stockcheck.custom_serial_no); ct1.Add(stockcheck.vendor_serail_no); ct1.Add(stockcheck.mpn); ct1.Add(Utils.modifyDataFormat(stockcheck.mb_make_date)); ct1.Add(stockcheck.customFault); ct1.Add(stockcheck.ECO); ct1.Add(stockcheck.bgatype); ct1.Add(stockcheck.BGAPN); ct1.Add(stockcheck.BGA_describe); ct1.Add(stockcheck.bga_brief); ct1.Add(stockcheck.oldSn); ct1.Add(stockcheck.newSn); ct1.Add(stockcheck.change_reason); ct1.Add(stockcheck.shortcut); ct1.Add(stockcheck.repairer); ct1.Add(stockcheck.bga_repairer); ct1.Add(Utils.modifyDataFormat(stockcheck.change_date)); ct1.Add(stockcheck.cpu_buy_type); ct1.Add(stockcheck.cpu_change); ctest1.contentArray = ct1; firstsheet.contentList.Add(ctest1); } allcontentList.Add(firstsheet); allContent secondsheet = new allContent(); secondsheet.sheetName = "统计信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-'); secondsheet.titleList = new List <string>(); secondsheet.contentList = new List <object>(); secondsheet.titleList.Add("ECO"); secondsheet.titleList.Add("BGA类型"); secondsheet.titleList.Add("BGA简述"); secondsheet.titleList.Add("待货数量"); foreach (bagUsedSumStruct stockcheck in bagWaitSumList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.eco); ct1.Add(stockcheck.bga_type); ct1.Add(stockcheck.bga_brief); ct1.Add(stockcheck.returnNum + ""); ctest1.contentArray = ct1; secondsheet.contentList.Add(ctest1); } allcontentList.Add(secondsheet); Utils.createMulitSheetsUsingNPOI("BGA维修信息" + bgaRepair_resultcomboBox.Text.Trim() + "-" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xls", allcontentList); }
public void generateExcelToCheck( debitnotsSheet3 debitnots, List <allSumStruct> allSumStructListAIO, List <allSumStruct> allSumStructListNB, List <fruListSheet4> fruList, List <nb_aio_mblistSheet5_6> repairRecordListAIO, List <nb_aio_mblistSheet5_6> repairRecordListNB, string startTime, string endTime) { List <allContent> allcontentList = new List <allContent>(); //汇总AIO allContent sumContentAio = new allContent(); sumContentAio.sheetName = startTime + "到" + endTime + "汇总AIO"; sumContentAio.titleList = new List <string>(); sumContentAio.contentList = new List <object>(); sumContentAio.titleList.Add("Model"); sumContentAio.titleList.Add("数量"); if (allSumStructListAIO.Count == 0) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ctest1.contentArray = ct1; ct1.Add(""); ct1.Add(""); sumContentAio.contentList.Add(ctest1); } else { foreach (allSumStruct temp in allSumStructListAIO) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ctest1.contentArray = ct1; ct1.Add(temp.mb_brief); ct1.Add(temp.returnNum + ""); sumContentAio.contentList.Add(ctest1); } } allcontentList.Add(sumContentAio); //汇总NB allContent sumContentNB = new allContent(); sumContentNB.sheetName = startTime + "到" + endTime + "汇总NB"; sumContentNB.titleList = new List <string>(); sumContentNB.contentList = new List <object>(); sumContentNB.titleList.Add("Model"); sumContentNB.titleList.Add("数量"); if (allSumStructListNB.Count == 0) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ctest1.contentArray = ct1; ct1.Add(""); ct1.Add(""); sumContentNB.contentList.Add(ctest1); } else { foreach (allSumStruct temp in allSumStructListNB) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ctest1.contentArray = ct1; ct1.Add(temp.mb_brief); ct1.Add(temp.returnNum + ""); sumContentNB.contentList.Add(ctest1); } } allcontentList.Add(sumContentNB); //FRU记录 allContent fruContent = new allContent(); fruContent.sheetName = startTime + "到" + endTime + "FRU记录"; fruContent.titleList = new List <string>(); fruContent.contentList = new List <object>(); fruContent.titleList.Add("收料日期"); fruContent.titleList.Add("rma号码"); fruContent.titleList.Add("联想料号"); fruContent.titleList.Add("机型"); fruContent.titleList.Add("名称"); fruContent.titleList.Add("配件序号"); fruContent.titleList.Add("周期"); fruContent.titleList.Add("保内外"); fruContent.titleList.Add("料号71"); fruContent.titleList.Add("原材料号"); fruContent.titleList.Add("客户故障"); // fruContent.titleList.Add("是否收费"); fruContent.titleList.Add("charge "); if (fruList.Count == 0) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ctest1.contentArray = ct1; ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); //ct1.Add(""); ct1.Add(""); fruContent.contentList.Add(ctest1); } else { foreach (fruListSheet4 temp in fruList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ctest1.contentArray = ct1; ct1.Add(Utils.modifyDataFormat(temp.receive_date)); ct1.Add(temp.orderno); ct1.Add(temp.customermaterialno); ct1.Add(temp.machine_type); ct1.Add(temp.name); ct1.Add(temp.peijian_no); ct1.Add(Utils.modifyDataFormat(temp.make_date)); ct1.Add(temp.gurantee); ct1.Add(temp.vendor_material_no); ct1.Add(temp.mpn1); ct1.Add(temp.custom_fault); //ct1.Add(temp.eol); ct1.Add(temp.charge); fruContent.contentList.Add(ctest1); } } allcontentList.Add(fruContent); //维修记录AIO allContent repairRecordContentAIO = new allContent(); repairRecordContentAIO.sheetName = startTime + "到" + endTime + "维修记录AIO"; repairRecordContentAIO.titleList = new List <string>(); repairRecordContentAIO.contentList = new List <object>(); repairRecordContentAIO.titleList.Add("订单编号"); repairRecordContentAIO.titleList.Add("来源"); repairRecordContentAIO.titleList.Add("跟踪条码"); repairRecordContentAIO.titleList.Add("收货日期"); repairRecordContentAIO.titleList.Add("MB简称"); repairRecordContentAIO.titleList.Add("MB描述"); repairRecordContentAIO.titleList.Add("MPN"); repairRecordContentAIO.titleList.Add("厂商序号"); repairRecordContentAIO.titleList.Add("MB生产日期"); repairRecordContentAIO.titleList.Add("客户故障"); for (int i = 1; i <= 3; i++) { repairRecordContentAIO.titleList.Add("现象" + i); } for (int i = 1; i <= 1; i++) { repairRecordContentAIO.titleList.Add("mbfa" + i); } repairRecordContentAIO.titleList.Add("短路电压"); repairRecordContentAIO.titleList.Add("北桥"); repairRecordContentAIO.titleList.Add("南北桥料号"); repairRecordContentAIO.titleList.Add("南桥"); repairRecordContentAIO.titleList.Add("vga芯片料号"); repairRecordContentAIO.titleList.Add("显存"); repairRecordContentAIO.titleList.Add("CPU料号"); repairRecordContentAIO.titleList.Add("CPU底座"); for (int i = 1; i <= 3; i++) { repairRecordContentAIO.titleList.Add("其他" + i + "位置"); //repairRecordContentAIO.titleList.Add("其他" + i + "位置料号"); } repairRecordContentAIO.titleList.Add("断线氧化内短位置"); repairRecordContentAIO.titleList.Add("维修人"); repairRecordContentAIO.titleList.Add("测试人"); repairRecordContentAIO.titleList.Add("修复日期 "); repairRecordContentAIO.titleList.Add("工程变更 "); repairRecordContentAIO.titleList.Add("charge"); if (repairRecordListAIO.Count == 0) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); for (int i = 0; i < 3; i++) { ct1.Add(""); } for (int i = 0; i < 1; i++) { ct1.Add(""); } ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); for (int i = 0; i < 3; i++) { ct1.Add(""); } ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ctest1.contentArray = ct1; repairRecordContentAIO.contentList.Add(ctest1); } else { foreach (nb_aio_mblistSheet5_6 repaircheck in repairRecordListAIO) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(repaircheck.order_no); ct1.Add(repaircheck.source); ct1.Add(repaircheck.track_serial_no); ct1.Add(Utils.modifyDataFormat(repaircheck.receivedate)); ct1.Add(repaircheck.mb_brief); ct1.Add(repaircheck.mb_describe); ct1.Add(repaircheck.mpn); ct1.Add(repaircheck.vendor_serail_no); ct1.Add(Utils.modifyDataFormat(repaircheck.mb_make_date)); ct1.Add(repaircheck.custom_fault); for (int i = 0; i < 3; i++) { if (i < repaircheck.fault_describeList.Count) { ct1.Add(repaircheck.fault_describeList[i]); } else { ct1.Add(""); } } for (int i = 0; i < 1; i++) { if (i < repaircheck.mbfaList.Count) { ct1.Add(repaircheck.mbfaList[i]); } else { ct1.Add(""); } } ct1.Add(repaircheck.shortcut); ct1.Add(""); ct1.Add(repaircheck.pch); ct1.Add(""); ct1.Add(repaircheck.vga); ct1.Add(""); ct1.Add(repaircheck.cpu); ct1.Add(""); for (int i = 0; i < 3; i++) { if (i < repaircheck.smtRecords.Count) { ct1.Add(repaircheck.smtRecords[i].smtplace); // ct1.Add(repaircheck.smtRecords[i].smtMpn); } else { ct1.Add(""); // ct1.Add(""); } } ct1.Add(""); ct1.Add(repaircheck.repairer); ct1.Add(repaircheck.tester); ct1.Add(Utils.modifyDataFormat(repaircheck.repair_date)); ct1.Add(""); ct1.Add(repaircheck.charge); ctest1.contentArray = ct1; repairRecordContentAIO.contentList.Add(ctest1); } } allcontentList.Add(repairRecordContentAIO); //维修记录NB allContent repairRecordContentNB = new allContent(); repairRecordContentNB.sheetName = startTime + "到" + endTime + "维修记录NB"; repairRecordContentNB.titleList = new List <string>(); repairRecordContentNB.contentList = new List <object>(); repairRecordContentNB.titleList.Add("订单编号"); repairRecordContentNB.titleList.Add("来源"); repairRecordContentNB.titleList.Add("跟踪条码"); repairRecordContentNB.titleList.Add("收货日期"); repairRecordContentNB.titleList.Add("MB简称"); repairRecordContentNB.titleList.Add("MB描述"); repairRecordContentNB.titleList.Add("MPN"); repairRecordContentNB.titleList.Add("厂商序号"); repairRecordContentNB.titleList.Add("MB生产日期"); repairRecordContentNB.titleList.Add("客户故障"); for (int i = 1; i <= 3; i++) { repairRecordContentNB.titleList.Add("现象" + i); } for (int i = 1; i <= 1; i++) { repairRecordContentNB.titleList.Add("mbfa" + i); } repairRecordContentNB.titleList.Add("短路电压"); repairRecordContentNB.titleList.Add("北桥"); repairRecordContentNB.titleList.Add("南北桥料号"); repairRecordContentNB.titleList.Add("南桥"); repairRecordContentNB.titleList.Add("vga芯片料号"); repairRecordContentNB.titleList.Add("显存"); repairRecordContentNB.titleList.Add("CPU料号"); repairRecordContentNB.titleList.Add("CPU底座"); for (int i = 1; i <= 3; i++) { repairRecordContentNB.titleList.Add("其他" + i + "位置"); //repairRecordContentNB.titleList.Add("其他" + i + "位置料号"); } repairRecordContentNB.titleList.Add("断线氧化内短位置"); repairRecordContentNB.titleList.Add("维修人"); repairRecordContentNB.titleList.Add("测试人"); repairRecordContentNB.titleList.Add("修复日期 "); repairRecordContentNB.titleList.Add("工程变更 "); repairRecordContentNB.titleList.Add("charge"); if (repairRecordListNB.Count == 0) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); for (int i = 0; i < 3; i++) { ct1.Add(""); } for (int i = 0; i < 1; i++) { ct1.Add(""); } ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); for (int i = 0; i < 3; i++) { ct1.Add(""); } ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ctest1.contentArray = ct1; repairRecordContentNB.contentList.Add(ctest1); } else { foreach (nb_aio_mblistSheet5_6 repaircheck in repairRecordListNB) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(repaircheck.order_no); ct1.Add(repaircheck.source); ct1.Add(repaircheck.track_serial_no); ct1.Add(Utils.modifyDataFormat(repaircheck.receivedate)); ct1.Add(repaircheck.mb_brief); ct1.Add(repaircheck.mb_describe); ct1.Add(repaircheck.mpn); ct1.Add(repaircheck.vendor_serail_no); ct1.Add(Utils.modifyDataFormat(repaircheck.mb_make_date)); ct1.Add(repaircheck.custom_fault); for (int i = 0; i < 3; i++) { if (i < repaircheck.fault_describeList.Count) { ct1.Add(repaircheck.fault_describeList[i]); } else { ct1.Add(""); } } for (int i = 0; i < 1; i++) { if (i < repaircheck.mbfaList.Count) { ct1.Add(repaircheck.mbfaList[i]); } else { ct1.Add(""); } } ct1.Add(repaircheck.shortcut); ct1.Add(""); ct1.Add(repaircheck.pch); ct1.Add(""); ct1.Add(repaircheck.vga); ct1.Add(""); ct1.Add(repaircheck.cpu); ct1.Add(""); for (int i = 0; i < 3; i++) { if (i < repaircheck.smtRecords.Count) { ct1.Add(repaircheck.smtRecords[i].smtplace); // ct1.Add(repaircheck.smtRecords[i].smtMpn); } else { ct1.Add(""); // ct1.Add(""); } } ct1.Add(""); ct1.Add(repaircheck.repairer); ct1.Add(repaircheck.tester); ct1.Add(Utils.modifyDataFormat(repaircheck.repair_date)); ct1.Add(""); ct1.Add(repaircheck.charge); ctest1.contentArray = ct1; repairRecordContentNB.contentList.Add(ctest1); } } allcontentList.Add(repairRecordContentNB); exportxmlbutton.Enabled = true; Utils.createExcelListUsingNPOI("D:\\" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + "新维修数据.xls", debitnots, allcontentList); }
public void generateExcelToCheck(List <RepairRecordStruct> repairRecordList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("跟踪条码"); titleList.Add("厂商"); titleList.Add("客户别"); titleList.Add("收货日期"); titleList.Add("MB描述"); titleList.Add("MB简称"); titleList.Add("客户序号"); titleList.Add("厂商序号"); titleList.Add("MPN"); titleList.Add("维修人"); titleList.Add("维修次数"); int repairLenght = 5; int bgaLength = 3; int smtLength = 10; for (int i = 1; i <= repairLenght; i++) { titleList.Add("维修原因" + i); titleList.Add("维修动作" + i); titleList.Add("维修结果" + i); titleList.Add("维修日期" + i); } for (int i = 1; i <= bgaLength; i++) { titleList.Add("BGA MPN" + i); titleList.Add("BGA类型" + i); titleList.Add("BGA简称" + i); titleList.Add("BGA 位置" + i); titleList.Add("BGA_mbfa1" + i); titleList.Add("BGAShortCut" + i); } for (int i = 1; i <= smtLength; i++) { titleList.Add("SMT MPN" + i); titleList.Add("SMT位置" + i); titleList.Add("SMT数量" + i); } foreach (RepairRecordStruct repaircheck in repairRecordList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(repaircheck.track_serial_no); ct1.Add(repaircheck.vendor); ct1.Add(repaircheck.product); ct1.Add(repaircheck.receivedate); ct1.Add(repaircheck.mb_describe); ct1.Add(repaircheck.mb_brief); ct1.Add(repaircheck.custom_serial_no); ct1.Add(repaircheck.vendor_serail_no); ct1.Add(repaircheck.mpn); ct1.Add(repaircheck.repairer); ct1.Add(repaircheck.repair_Num); for (int i = 0; i < repairLenght; i++) { if (i < repaircheck.subRecords.Count) { ct1.Add(repaircheck.subRecords[i].fault_describe); ct1.Add(repaircheck.subRecords[i]._action); ct1.Add(repaircheck.subRecords[i].repair_result); ct1.Add(repaircheck.subRecords[i].repair_date); } else { ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); } } for (int i = 0; i < bgaLength; i++) { if (i < repaircheck.bgaRecords.Count) { ct1.Add(repaircheck.bgaRecords[i].bgampn); ct1.Add(repaircheck.bgaRecords[i].bgatype); ct1.Add(repaircheck.bgaRecords[i].bgabrief); ct1.Add(repaircheck.bgaRecords[i].bga_place); ct1.Add(repaircheck.bgaRecords[i].bgambfa1); ct1.Add(repaircheck.bgaRecords[i].bgashort_cut); } else { ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); ct1.Add(""); } } for (int i = 0; i < smtLength; i++) { if (i < repaircheck.smtRecords.Count) { ct1.Add(repaircheck.smtRecords[i].smtMpn); ct1.Add(repaircheck.smtRecords[i].smtplace); ct1.Add(repaircheck.smtRecords[i].smtNum); } else { ct1.Add(""); ct1.Add(""); ct1.Add(""); } } ctest1.contentArray = ct1; contentList.Add(ctest1); } Untils.createExcel("D:\\维修记录" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <DoaRecordStruct> repairRecordList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("Repair Center"); titleList.Add("Week"); titleList.Add("SP"); titleList.Add("RMA#"); titleList.Add("跟踪条码"); titleList.Add("Receive Date"); titleList.Add("Lenovo Model"); titleList.Add("LCFC model"); titleList.Add("FRU PN#"); titleList.Add("SN"); titleList.Add("Customer Symptom"); titleList.Add("上次故障问题"); titleList.Add("Repair Symptom"); titleList.Add("Customer Symptom & Repair Symptom Match or Not(Yes/No)"); titleList.Add("驻厂复判问题"); titleList.Add("驻厂复判状态"); titleList.Add("Repair Location"); titleList.Add("上次维修换件"); titleList.Add("RMA or FRU"); titleList.Add("RR Category(VFF/NTF/CID Repairable/Quality issue/CID Irreparable)"); titleList.Add("Root Cause"); titleList.Add("Recovery Action"); titleList.Add("上次跟踪条码"); titleList.Add("Last Shipped Date"); titleList.Add("Last Customer Symptom"); titleList.Add("Last Repair Symptom"); titleList.Add("Last Repair Location "); titleList.Add("CID Image"); titleList.Add("Last time OQC Photo 1"); titleList.Add("Last time OQC Photo 2"); titleList.Add("Last Time Test Pass Log"); foreach (DoaRecordStruct repaircheck in repairRecordList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(repaircheck.repair_center); ct1.Add(repaircheck.week); ct1.Add(repaircheck.sp); ct1.Add(repaircheck.rma); ct1.Add(repaircheck.trackno); ct1.Add(Utils.modifyDataFormat(repaircheck.receivedate)); ct1.Add(repaircheck.lenovomodel); ct1.Add(repaircheck.lcfcmodel); ct1.Add(repaircheck.frupn); ct1.Add(repaircheck.sn); ct1.Add(repaircheck.customersymptom); ct1.Add(repaircheck.lastfault); ct1.Add(repaircheck.repairsymptom); ct1.Add(repaircheck.csrsm); ct1.Add(repaircheck.recheckproblem); ct1.Add(repaircheck.recheckstatus); ct1.Add(repaircheck.repairlocation); ct1.Add(repaircheck.lastrepairplace); ct1.Add(repaircheck.rmaorfru); ct1.Add(repaircheck.rrcategory); ct1.Add(repaircheck.rootcause); ct1.Add(repaircheck.recoveryaction); ct1.Add(repaircheck.lasttrackno); ct1.Add(Utils.modifyDataFormat(repaircheck.lastshipdate)); ct1.Add(repaircheck.lastcustomersymptom); ct1.Add(repaircheck.lastrepairsymptom); ct1.Add(repaircheck.lastrepairlocation); ct1.Add(repaircheck.cidimage); ct1.Add(repaircheck.lasttimeoqcphoto1); ct1.Add(repaircheck.lasttimeoqcphoto2); ct1.Add(repaircheck.lasttimetestpasslog); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("DOA报表" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <ReceiveOrderStruct> StockCheckList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("厂商"); titleList.Add("客户别"); titleList.Add("来源"); titleList.Add("库别"); titleList.Add("订单编号"); titleList.Add("客户出库日期"); titleList.Add("收货日期"); titleList.Add("客户机型"); titleList.Add("mb简称"); titleList.Add("客户料号"); titleList.Add("DPK状态"); titleList.Add("跟踪条码"); titleList.Add("客户序号"); titleList.Add("厂商序号"); titleList.Add("UUID"); titleList.Add("MAC"); titleList.Add("厂商料号"); titleList.Add("mb描述"); titleList.Add("MB生产日期"); titleList.Add("保修期"); titleList.Add("客户故障"); titleList.Add("保内/外"); titleList.Add("客责描述"); titleList.Add("联想客服序号"); titleList.Add("联想维修站编号"); titleList.Add("联想维修单编号"); titleList.Add("整机序号"); titleList.Add("收货人"); foreach (ReceiveOrderStruct stockcheck in StockCheckList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.vendor); ct1.Add(stockcheck.product); ct1.Add(stockcheck.source_brief); ct1.Add(stockcheck.storehouse); ct1.Add(stockcheck.custom_order); ct1.Add(stockcheck.order_out_date); ct1.Add(stockcheck.order_receive_date); ct1.Add(stockcheck.custom_machine_type); ct1.Add(stockcheck.mb_brief); ct1.Add(stockcheck.custommaterialNo); ct1.Add(stockcheck.dpk_status); ct1.Add(stockcheck.track_serial_no); ct1.Add(stockcheck.custom_serial_no); ct1.Add(stockcheck.vendor_serail_no); ct1.Add(stockcheck.uuid); ct1.Add(stockcheck.mac); ct1.Add(stockcheck.mpn); ct1.Add(stockcheck.mb_describe); ct1.Add(stockcheck.mb_make_date); ct1.Add(stockcheck.warranty_period); ct1.Add(stockcheck.custom_fault); ct1.Add(stockcheck.guarantee); ct1.Add(stockcheck.customResponsibility); ct1.Add(stockcheck.lenovo_custom_service_no); ct1.Add(stockcheck.lenovo_maintenance_no); ct1.Add(stockcheck.lenovo_repair_no); ct1.Add(stockcheck.whole_machine_no); ct1.Add(stockcheck.inputuser); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("收货信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
public void generateExcelToCheck(List <StoreHouseStatisticsStruct> StockCheckList, Dictionary <string, bgaTypeStatistics> bgabriefdict, string startTime, string endTime) { List <allContent> allcontentList = new List <allContent>(); allContent firstsheet = new allContent(); firstsheet.sheetName = this.houseComboBox.Text + "平衡表信息导出" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-'); firstsheet.titleList = new List <string>(); firstsheet.contentList = new List <object>(); firstsheet.titleList.Add("ID"); firstsheet.titleList.Add("库房"); firstsheet.titleList.Add("储位"); firstsheet.titleList.Add("存储料号"); firstsheet.titleList.Add("类型"); firstsheet.titleList.Add("厂商"); firstsheet.titleList.Add("剩余数量"); firstsheet.titleList.Add("购买数量"); firstsheet.titleList.Add("出库数量"); firstsheet.titleList.Add("报废转卖"); firstsheet.titleList.Add("描述"); firstsheet.titleList.Add("BGA简称"); foreach (StoreHouseStatisticsStruct stockcheck in StockCheckList) { if (stockcheck.type != null && !stockcheck.type.Contains("SMT")) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(stockcheck.Id); ct1.Add(stockcheck.house); ct1.Add(stockcheck.place); ct1.Add(stockcheck.mpn); ct1.Add(stockcheck.type); ct1.Add(stockcheck.vendor); ct1.Add(stockcheck.leftnumber); ct1.Add(stockcheck.buynumber); ct1.Add(stockcheck.outnumber); ct1.Add(stockcheck.othernumber); ct1.Add(stockcheck.describe); ct1.Add(stockcheck.bga_brief); ctest1.contentArray = ct1; firstsheet.contentList.Add(ctest1); } } allcontentList.Add(firstsheet); allContent secondsheet = new allContent(); secondsheet.sheetName = "BGA简称" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-'); secondsheet.titleList = new List <string>(); secondsheet.contentList = new List <object>(); secondsheet.titleList.Add("BGA类型"); secondsheet.titleList.Add("剩余数量"); secondsheet.titleList.Add("购买数量"); secondsheet.titleList.Add("出货数量"); secondsheet.titleList.Add("报废转卖"); secondsheet.titleList.Add("描述"); secondsheet.titleList.Add("相关mpn"); foreach (string key in bgabriefdict.Keys) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); bgaTypeStatistics stockcheck = bgabriefdict[key]; ct1.Add(stockcheck.bga_brief); ct1.Add(stockcheck.leftnumber); ct1.Add(stockcheck.buynumber); ct1.Add(stockcheck.outnumber); ct1.Add(stockcheck.othernumber); ct1.Add(stockcheck.describe); ct1.Add(stockcheck.releatedMpn); ctest1.contentArray = ct1; secondsheet.contentList.Add(ctest1); } allcontentList.Add(secondsheet); Utils.createMulitSheetsUsingNPOI(string.Format("{0}平衡表信息导出{1}-{2}", this.houseComboBox.Text, startTime.Replace('/', '-'), endTime.Replace('/', '-')) + ".xls", allcontentList); }
public void generateExcelToCheck(List <RepairRecordStruct> repairRecordList, string startTime, string endTime) { List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("跟踪条码"); titleList.Add("厂商"); titleList.Add("客户别"); titleList.Add("来源"); titleList.Add("订单编号"); titleList.Add("收货日期"); titleList.Add("客户料号"); titleList.Add("客户序号"); titleList.Add("MB描述"); titleList.Add("MB简称"); titleList.Add("厂商序号"); titleList.Add("MPN"); titleList.Add("MB生产日期"); titleList.Add("客户故障"); titleList.Add("软体更新"); for (int i = 1; i <= 3; i++) { titleList.Add("现象" + i); } for (int i = 1; i <= 3; i++) { titleList.Add("mbfa" + i); } titleList.Add("短路电压"); titleList.Add("南北桥料号"); titleList.Add("南北桥位置"); titleList.Add("vga芯片料号"); titleList.Add("vga芯片位置"); titleList.Add("CPU料号"); titleList.Add("CPU芯片位置"); for (int i = 1; i <= 3; i++) { titleList.Add("其他" + i + "位置"); titleList.Add("其他" + i + "位置料号"); } titleList.Add("故障类别"); titleList.Add("维修人"); titleList.Add("测试人"); titleList.Add("测试日期"); titleList.Add("修复日期 "); titleList.Add("修复结果"); titleList.Add("联想维修站编号"); titleList.Add("是否退货"); foreach (RepairRecordStruct repaircheck in repairRecordList) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(repaircheck.track_serial_no); ct1.Add(repaircheck.vendor); ct1.Add(repaircheck.product); ct1.Add(repaircheck.source); ct1.Add(repaircheck.order_no); ct1.Add(Utils.modifyDataFormat(repaircheck.receivedate)); ct1.Add(repaircheck.custommaterialNo); ct1.Add(repaircheck.custom_serial_no); ct1.Add(repaircheck.mb_describe); ct1.Add(repaircheck.mb_brief); ct1.Add(repaircheck.vendor_serail_no); ct1.Add(repaircheck.mpn); ct1.Add(Utils.modifyDataFormat(repaircheck.mb_make_date)); ct1.Add(repaircheck.custom_fault); ct1.Add(repaircheck.software_update); for (int i = 0; i < 3; i++) { if (repaircheck.fault_describeList != null && i < repaircheck.fault_describeList.Count) { ct1.Add(repaircheck.fault_describeList[i]); } else { ct1.Add(""); } } for (int i = 0; i < 3; i++) { if (repaircheck.mbfaList != null && i < repaircheck.mbfaList.Count) { ct1.Add(repaircheck.mbfaList[i]); } else { ct1.Add(""); } } ct1.Add(repaircheck.shortcut); ct1.Add(repaircheck.pch); ct1.Add(repaircheck.pch_place); ct1.Add(repaircheck.vga); ct1.Add(repaircheck.vga_place); ct1.Add(repaircheck.cpu); ct1.Add(repaircheck.cpu_place); for (int i = 0; i < 3; i++) { if (repaircheck.smtRecords != null && i < repaircheck.smtRecords.Count) { ct1.Add(repaircheck.smtRecords[i].smtplace); ct1.Add(repaircheck.smtRecords[i].smtMpn); } else { ct1.Add(""); ct1.Add(""); } } ct1.Add(repaircheck.fault_type); ct1.Add(repaircheck.repairer); ct1.Add(repaircheck.tester); ct1.Add(Utils.modifyDataFormat(repaircheck.test_date)); ct1.Add(Utils.modifyDataFormat(repaircheck.repair_date)); ct1.Add(repaircheck.repair_result); ct1.Add(repaircheck.lenovo_maintenance_no); ct1.Add(repaircheck.is_cid); ctest1.contentArray = ct1; contentList.Add(ctest1); } Utils.createExcel("维修记录" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }
private void exportToExcel_Click(object sender, EventArgs e) { if (this.pathTextBox.Text == "") { MessageBox.Show("目的文件夹为空"); return; } if (this.datasourceComboBox.Text == "") { MessageBox.Show("源数据库为空!"); return; } DateTime start = Convert.ToDateTime(this.dateTimePickerstart.Value.Date.ToString("yyyy-MM-dd", System.Globalization.DateTimeFormatInfo.InvariantInfo)); DateTime end = Convert.ToDateTime(this.dateTimePickerend.Value.Date.ToString("yyyy-MM-dd", System.Globalization.DateTimeFormatInfo.InvariantInfo)); if (DateTime.Compare(start, end) > 0) //判断日期大小 { MessageBox.Show("开始日期大于结束"); return; } this.Cursor = Cursors.WaitCursor; string startTime = this.dateTimePickerstart.Value.ToString("yyyy-MM-dd", System.Globalization.DateTimeFormatInfo.InvariantInfo); string endTime = this.dateTimePickerend.Value.ToString("yyyy-MM-dd", System.Globalization.DateTimeFormatInfo.InvariantInfo); List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); string sqlCmd = "select * from " + currentTableName; if (currentTableName == "receiveOrder") { sqlCmd += " where receivedate between '" + start + "' and '" + end + "'"; titleList.Add("ID"); titleList.Add("厂商"); titleList.Add("客户别"); titleList.Add("订单编号"); titleList.Add("客户料号"); titleList.Add("客户物料描述"); titleList.Add("订单数量"); titleList.Add("MB简称"); titleList.Add("厂商料号"); titleList.Add("制单人"); titleList.Add("制单时间"); titleList.Add("收货数量"); titleList.Add("收货日期"); titleList.Add("订单状态"); titleList.Add("仓库别"); titleList.Add("还货数量"); titleList.Add("申报单位"); titleList.Add("报关单号"); titleList.Add("申请单号"); titleList.Add("Cid数量"); } else if (currentTableName == "cidRecord") { sqlCmd += " where inputdate between '" + start + "' and '" + end + "'"; titleList.Add("ID"); titleList.Add("跟踪条码"); titleList.Add("厂商"); titleList.Add("客户别"); titleList.Add("订单编号"); titleList.Add("客户料号"); titleList.Add("客户序号"); titleList.Add("MB简称"); titleList.Add("厂商料号"); titleList.Add("收货日期"); titleList.Add("客户故障"); titleList.Add("客责类别"); titleList.Add("客责描述"); titleList.Add("短路电压"); titleList.Add("录入人"); titleList.Add("录入日期"); } else if (currentTableName == "LCFC_MBBOM_table") { //sqlCmd = "select top 1000 * from " + currentTableName; titleList.Add("ID"); titleList.Add("日期"); titleList.Add("厂商"); titleList.Add("客户别"); titleList.Add("MB简称"); titleList.Add("MPN"); titleList.Add("材料MPN"); titleList.Add("料盒位置"); titleList.Add("物料描述"); titleList.Add("用料数量"); titleList.Add("L1"); titleList.Add("L2"); titleList.Add("L3"); titleList.Add("L4"); titleList.Add("L5"); titleList.Add("L6"); titleList.Add("L7"); titleList.Add("L8"); } else { MessageBox.Show("报表还没有制作!"); this.Cursor = Cursors.Default; return; } try { SqlConnection conn = new SqlConnection(Constlist.ConStr); conn.Open(); if (conn.State == ConnectionState.Open) { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = sqlCmd; SqlDataReader querySdr = cmd.ExecuteReader(); while (querySdr.Read()) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); if (currentTableName == "receiveOrder") { ct1.Add(querySdr[0].ToString()); ct1.Add(querySdr[1].ToString()); ct1.Add(querySdr[2].ToString()); ct1.Add(querySdr[3].ToString()); ct1.Add(querySdr[4].ToString()); ct1.Add(querySdr[5].ToString()); ct1.Add(querySdr[6].ToString()); ct1.Add(querySdr[7].ToString()); ct1.Add(querySdr[8].ToString()); ct1.Add(querySdr[9].ToString()); ct1.Add(querySdr[10].ToString()); ct1.Add(querySdr[11].ToString()); ct1.Add(querySdr[12].ToString()); ct1.Add(querySdr[13].ToString()); ct1.Add(querySdr[14].ToString()); ct1.Add(querySdr[15].ToString()); ct1.Add(querySdr[16].ToString()); ct1.Add(querySdr[17].ToString()); ct1.Add(querySdr[18].ToString()); ct1.Add(querySdr[19].ToString()); } else if (currentTableName == "cidRecord") { ct1.Add(querySdr[0].ToString()); ct1.Add(querySdr[1].ToString()); ct1.Add(querySdr[2].ToString()); ct1.Add(querySdr[3].ToString()); ct1.Add(querySdr[4].ToString()); ct1.Add(querySdr[5].ToString()); ct1.Add(querySdr[6].ToString()); ct1.Add(querySdr[7].ToString()); ct1.Add(querySdr[8].ToString()); ct1.Add(querySdr[9].ToString()); ct1.Add(querySdr[10].ToString()); ct1.Add(querySdr[11].ToString()); ct1.Add(querySdr[12].ToString()); ct1.Add(querySdr[13].ToString()); ct1.Add(querySdr[14].ToString()); ct1.Add(querySdr[15].ToString()); } else if (currentTableName == "LCFC_MBBOM_table") { ct1.Add(querySdr[0].ToString()); ct1.Add(querySdr[1].ToString()); ct1.Add(querySdr[2].ToString()); ct1.Add(querySdr[3].ToString()); ct1.Add(querySdr[4].ToString()); ct1.Add(querySdr[5].ToString()); ct1.Add(querySdr[6].ToString()); ct1.Add(querySdr[7].ToString()); ct1.Add(querySdr[8].ToString()); ct1.Add(querySdr[9].ToString()); ct1.Add(querySdr[10].ToString()); ct1.Add(querySdr[11].ToString()); ct1.Add(querySdr[12].ToString()); ct1.Add(querySdr[13].ToString()); ct1.Add(querySdr[14].ToString()); ct1.Add(querySdr[15].ToString()); ct1.Add(querySdr[16].ToString()); ct1.Add(querySdr[17].ToString()); } ctest1.contentArray = ct1; contentList.Add(ctest1); } querySdr.Close(); } else { MessageBox.Show("SaledService is not opened"); } conn.Close(); string path = this.pathTextBox.Text; if (path.EndsWith("\\") == false) { path += "\\"; } Utils.createExcel(path + this.datasourceComboBox.Text + ".xlsx", titleList, contentList); this.Cursor = Cursors.Default; } catch (Exception ex) { this.Cursor = Cursors.Default; MessageBox.Show(ex.ToString()); } }
private void exportxmlbutton_Click(object sender, EventArgs e) { DateTime time1 = Convert.ToDateTime(this.dateTimePickerstart.Value.Date.ToString("yyyy-MM-dd", System.Globalization.DateTimeFormatInfo.InvariantInfo)); DateTime time2 = Convert.ToDateTime(this.dateTimePickerend.Value.Date.ToString("yyyy-MM-dd", System.Globalization.DateTimeFormatInfo.InvariantInfo)); if (DateTime.Compare(time1, time2) > 0) //判断日期大小 { MessageBox.Show("开始日期大于结束"); return; } string startTime = this.dateTimePickerstart.Value.ToString("yyyy-MM-dd", System.Globalization.DateTimeFormatInfo.InvariantInfo); string endTime = this.dateTimePickerend.Value.ToString("yyyy-MM-dd", System.Globalization.DateTimeFormatInfo.InvariantInfo); List <string> titleList = new List <string>(); List <Object> contentList = new List <object>(); titleList.Add("ID"); titleList.Add("厂商"); titleList.Add("采购类别"); titleList.Add("客户别"); titleList.Add("材料大类"); titleList.Add("MPN"); titleList.Add("MB简称"); titleList.Add("材料名称"); titleList.Add("厂商料号"); titleList.Add("描述"); titleList.Add("出库数量"); titleList.Add("单价"); titleList.Add("库位"); titleList.Add("领用人"); titleList.Add("输入人"); titleList.Add("用途"); titleList.Add("备注"); titleList.Add("日期"); try { SqlConnection mConn = new SqlConnection(Constlist.ConStr); mConn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = mConn; cmd.CommandType = CommandType.Text; cmd.CommandText = "select * from fru_smt_out_stock where input_date between '" + startTime + "' and '" + endTime + "'"; SqlDataReader querySdr = cmd.ExecuteReader(); while (querySdr.Read()) { ExportExcelContent ctest1 = new ExportExcelContent(); List <string> ct1 = new List <string>(); ct1.Add(querySdr[0].ToString()); ct1.Add(querySdr[1].ToString()); ct1.Add(querySdr[2].ToString()); ct1.Add(querySdr[3].ToString()); ct1.Add(querySdr[4].ToString()); ct1.Add(querySdr[5].ToString()); ct1.Add(querySdr[6].ToString()); ct1.Add(querySdr[7].ToString()); ct1.Add(querySdr[8].ToString()); ct1.Add(querySdr[9].ToString()); ct1.Add(querySdr[10].ToString()); ct1.Add(querySdr[11].ToString()); ct1.Add(querySdr[12].ToString()); ct1.Add(querySdr[13].ToString()); ct1.Add(querySdr[14].ToString()); ct1.Add(querySdr[15].ToString()); ct1.Add(querySdr[16].ToString()); ct1.Add(querySdr[17].ToString()); ctest1.contentArray = ct1; contentList.Add(ctest1); } querySdr.Close(); mConn.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } Utils.createExcel("FRU_SMT出货信息" + startTime.Replace('/', '-') + "-" + endTime.Replace('/', '-') + ".xlsx", titleList, contentList); }