|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Web;
|
|
|
using System.Web.Mvc;
|
|
|
using Estsh.Web.Util;
|
|
|
using Estsh.Web.Service;
|
|
|
using System.Collections;
|
|
|
using Estsh.Web.Models;
|
|
|
using NPOI.HSSF.UserModel;
|
|
|
using System.IO;
|
|
|
using System.Data;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 作者:王勇
|
|
|
* 创建时间:2013.04.15
|
|
|
* 描述:客户订单维护
|
|
|
*
|
|
|
* *************************************************************************************************/
|
|
|
namespace Estsh.Core.Web.Controllers
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 客户订单维护
|
|
|
/// </summary>
|
|
|
public class FGController : Controller
|
|
|
{
|
|
|
private FGService service = new FGService();
|
|
|
|
|
|
//
|
|
|
// GET: /FG/
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取列表数据
|
|
|
/// </summary>
|
|
|
/// <param name="FGName">菜单名称</param>
|
|
|
/// <param name="pager">分页</param>
|
|
|
/// <param name="direction">排序方式</param>
|
|
|
/// <param name="sort">排序列</param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getFGListByPage(String order_no, String shift_name, String car_no, String type_id, String Date, Pager pager, String direction, String sort)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("pager.pageNo", pager.pageNo);
|
|
|
Hashtable dataHt = this.service.getFGListByPage(order_no, shift_name, car_no, type_id, Date, pager, direction, sort);
|
|
|
result.Add("rows", dataHt["dataList"]);
|
|
|
result.Add("pager.totalRows", dataHt["totalCount"]);
|
|
|
result.Add("sort", sort);
|
|
|
result.Add("direction", direction);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取下拉列表数据
|
|
|
/// </summary>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult getSelectFG()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
ArrayList FGList = this.service.getSelectFG();
|
|
|
result.Add("list", FGList);
|
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取下拉列表数据
|
|
|
/// </summary>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult getSelectFG_model_name()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
ArrayList FGList = this.service.getSelectFG_model_name();
|
|
|
result.Add("list", FGList);
|
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 保存数据
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult saveFG()
|
|
|
{
|
|
|
|
|
|
|
|
|
String sex_1 = Request["sex_1"].ToString();//日期
|
|
|
String Date = DateTime.Now.ToString("yyyy-MM-dd");//日期
|
|
|
if (!(string.IsNullOrEmpty(Request["Date"].ToString().ToString())))
|
|
|
{
|
|
|
Date = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
}
|
|
|
String BCi = Request["BCi"].ToString();//班次
|
|
|
String Number = Request["Number"].ToString();//编号
|
|
|
String Car_no = Request["Car_no"].ToString();//车号
|
|
|
String Model = Request["Model"].ToString();//配置
|
|
|
String ZCname = Request["ZCname"].ToString();//缺陷总成名称
|
|
|
String ZCDesc = Request["ZCDesc"].ToString();//缺陷总成描述
|
|
|
String FgUserSure = Request["FgUserSure"].ToString();//返工人员确认
|
|
|
String zn1 = Request["zn1"].ToString().ToString();//气囊条码
|
|
|
String zn3 = "";//保险带锁扣电阻值
|
|
|
if (string.IsNullOrEmpty(Request["zn3"].ToString().ToString()))
|
|
|
{
|
|
|
zn3 = "0";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
zn3 = Request["zn3"].ToString().ToString();
|
|
|
}
|
|
|
|
|
|
String zn2 = Request["zn2"].ToString();//面套条码
|
|
|
String zn4 = "";//SBR电阻值
|
|
|
if (string.IsNullOrEmpty(Request["zn4"].ToString().ToString()))
|
|
|
{
|
|
|
zn4 = "0";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
zn4 = Request["zn4"].ToString().ToString();
|
|
|
}
|
|
|
|
|
|
String JiaReZu ="";//加热垫电阻值
|
|
|
if (string.IsNullOrEmpty(Request["JiaReZu"].ToString().ToString()))
|
|
|
{
|
|
|
JiaReZu = "0";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
JiaReZu = Request["JiaReZu"].ToString().ToString();
|
|
|
}
|
|
|
String bn = "";//保险带扭矩
|
|
|
if (string.IsNullOrEmpty(Request["bn"].ToString().ToString()))
|
|
|
{
|
|
|
bn = "0";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
bn = Request["bn"].ToString().ToString();
|
|
|
}
|
|
|
String dateTimePicker =DateTime.Now.ToString("yyyy-MM-dd"); //返工/修时间
|
|
|
if (!(string.IsNullOrEmpty(Request["dateTimePicker"].ToString().ToString())))
|
|
|
{
|
|
|
dateTimePicker = Request["dateTimePicker"].ToString();
|
|
|
}
|
|
|
String an = "";//安全气囊扭矩
|
|
|
if (string.IsNullOrEmpty(Request["an"].ToString().ToString()))
|
|
|
{
|
|
|
an = "0";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
an = Request["an"].ToString().ToString();
|
|
|
}
|
|
|
String zk ="";//座靠结合扭矩
|
|
|
if (string.IsNullOrEmpty(Request["zk"].ToString().ToString()))
|
|
|
{
|
|
|
zk = "0";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
zk = Request["zk"].ToString().ToString();
|
|
|
}
|
|
|
String sex_2 = Request["sex_2"].ToString();//功能是否正常
|
|
|
if (sex_2 == "是")
|
|
|
{
|
|
|
sex_2 = "Y";
|
|
|
}
|
|
|
else if (sex_2 == "否")
|
|
|
{
|
|
|
sex_2 = "N";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sex_2 = "";
|
|
|
}
|
|
|
String sex_3 = Request["sex_3"].ToString();//外观是否合格
|
|
|
if (sex_3 == "是")
|
|
|
{
|
|
|
sex_3 = "Y";
|
|
|
}
|
|
|
else if (sex_3 == "否")
|
|
|
{
|
|
|
sex_3 = "N";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sex_3 = "";
|
|
|
}
|
|
|
String sex_4 = Request["sex_4"].ToString();//零件是否安装齐全
|
|
|
if (sex_4 == "是")
|
|
|
{
|
|
|
sex_4 = "Y";
|
|
|
}
|
|
|
else if (sex_4 == "否")
|
|
|
{
|
|
|
sex_4 = "N";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sex_4 = "";
|
|
|
}
|
|
|
String ZhiLiang = Request["ZhiLiang"].ToString();//质量最终确认
|
|
|
String FgUserSure2 = Request["FgUserSure2"].ToString();//返工人签名
|
|
|
String sex_5 = Request["sex_5"].ToString();//排序是否正确
|
|
|
if (sex_5 == "是")
|
|
|
{
|
|
|
sex_5 = "Y";
|
|
|
}
|
|
|
else if (sex_5 == "否")
|
|
|
{
|
|
|
sex_5 = "N";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sex_5 = "";
|
|
|
}
|
|
|
String srsuser = Request["srsuser"].ToString();//检查人签名
|
|
|
String ShengChanBanZuZhang = Request["ShengChanBanZuZhang"].ToString();//生产班组长签名
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Hashtable htParams = new Hashtable();
|
|
|
htParams.Add("@order_no", Number);
|
|
|
htParams.Add("@location", sex_1);
|
|
|
htParams.Add("@shift_name", BCi);
|
|
|
htParams.Add("@car_no", Car_no);
|
|
|
htParams.Add("@model_name", Model);
|
|
|
htParams.Add("@part_no", ZCname);
|
|
|
htParams.Add("@defect_desc", ZCDesc);
|
|
|
htParams.Add("@repair_emp", FgUserSure2);
|
|
|
htParams.Add("@repair_desc", "");
|
|
|
htParams.Add("@repair_time", dateTimePicker);
|
|
|
htParams.Add("@p1", zn1);
|
|
|
htParams.Add("@p2", zn2);
|
|
|
htParams.Add("@p3", zn3);
|
|
|
htParams.Add("@p4", zn4);
|
|
|
htParams.Add("@p5", JiaReZu);
|
|
|
htParams.Add("@p6", an);
|
|
|
htParams.Add("@p7", zk);
|
|
|
htParams.Add("@p8", bn);
|
|
|
htParams.Add("@fun_check", sex_2);
|
|
|
htParams.Add("@part_check", sex_4);
|
|
|
htParams.Add("@view_check", sex_3);
|
|
|
htParams.Add("@srs_check", sex_5);
|
|
|
htParams.Add("@srs_check_emp", srsuser);
|
|
|
htParams.Add("@prod_check_emp", ShengChanBanZuZhang);
|
|
|
htParams.Add("@isOK", 20);
|
|
|
htParams.Add("@message", 20);
|
|
|
|
|
|
|
|
|
|
|
|
String message = "";
|
|
|
|
|
|
try
|
|
|
{
|
|
|
this.service.saveFG(htParams);
|
|
|
message = "添加成功";
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
message = "添加失败!";
|
|
|
}
|
|
|
|
|
|
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("message", message);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 查看详情
|
|
|
/// </summary>
|
|
|
/// <param name="ruid"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getFG(String FG_id)
|
|
|
{
|
|
|
ArrayList FGInfo = this.service.getFG(FG_id);
|
|
|
Hashtable htFGInfo = (Hashtable)FGInfo[0];
|
|
|
ViewData.Add("part_id", htFGInfo["part_id"]);
|
|
|
ViewData.Add("cust_order", htFGInfo["cust_order"]);
|
|
|
ViewData.Add("ship_unit", htFGInfo["ship_unit"]);
|
|
|
|
|
|
return View("~/Views/FGManage/viewFG.aspx");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 编辑
|
|
|
/// </summary>
|
|
|
/// <param name="ruid"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult editFG(String part_id)
|
|
|
{
|
|
|
ArrayList FGInfo = this.service.getFG(part_id);
|
|
|
Hashtable htFGInfo = (Hashtable)FGInfo[0];
|
|
|
ViewData.Add("editType", "edit");
|
|
|
ViewData.Add("part_id", part_id);
|
|
|
ViewData.Add("cust_order", htFGInfo["cust_order"]);
|
|
|
ViewData.Add("ship_unit", htFGInfo["ship_unit"]);
|
|
|
|
|
|
return View("~/Views/FG/EditFG.aspx");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult deleteFG(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.deleteFG(ids);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 导出
|
|
|
/// </summary>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="txtOrderNo"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="isPage"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult ExportFG(String part_no, String cust_order, Pager pager, String sort, String direction, String isPage)
|
|
|
{
|
|
|
|
|
|
Boolean paging = false;
|
|
|
if (isPage == null || "".Equals(isPage))
|
|
|
{
|
|
|
paging = false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if ("1".Equals(isPage))
|
|
|
{
|
|
|
paging = true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
paging = false;
|
|
|
}
|
|
|
}
|
|
|
DataTable dataHt = this.service.getTableListByPage(part_no, cust_order, pager, direction, sort, paging);
|
|
|
HSSFWorkbook workbook = new HSSFWorkbook();
|
|
|
Stream outputStream = Response.OutputStream;
|
|
|
HSSFSheet sheet = (HSSFSheet)workbook.CreateSheet("客户订单号明细");
|
|
|
try
|
|
|
{
|
|
|
if (workbook != null)
|
|
|
{
|
|
|
HSSFRow headRow = (HSSFRow)sheet.CreateRow(0);
|
|
|
headRow.CreateCell(0).SetCellValue("总成零件号");
|
|
|
headRow.CreateCell(1).SetCellValue("零件描述");
|
|
|
headRow.CreateCell(2).SetCellValue("客户单号");
|
|
|
headRow.CreateCell(3).SetCellValue("出货单位");
|
|
|
}
|
|
|
|
|
|
for (int i = 0; i < dataHt.Rows.Count; i++)
|
|
|
{
|
|
|
int row = i + 1;
|
|
|
HSSFRow dataRow = (HSSFRow)sheet.CreateRow(row);
|
|
|
|
|
|
dataRow.CreateCell(0).SetCellValue(dataHt.Rows[i]["part_no"].ToString());
|
|
|
dataRow.CreateCell(1).SetCellValue(dataHt.Rows[i]["part_spec"].ToString());
|
|
|
dataRow.CreateCell(2).SetCellValue(dataHt.Rows[i]["cust_order"].ToString());
|
|
|
dataRow.CreateCell(3).SetCellValue(dataHt.Rows[i]["ship_unit"].ToString());
|
|
|
}
|
|
|
|
|
|
Response.Clear();
|
|
|
workbook.Write(outputStream);
|
|
|
|
|
|
Response.Buffer = true;
|
|
|
Response.AppendHeader("Content-Disposition", "attachment;filename=客户订单号明细.xls");
|
|
|
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
|
|
Response.ContentType = "application/vnd.ms-excel";
|
|
|
Response.Flush();
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
workbook = null;
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
}
|