You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
360 lines
12 KiB
C#
360 lines
12 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using System.Collections;
|
|
using Estsh.Web.Service;
|
|
using Com.Estsh.MES.App;
|
|
using System.Data;
|
|
using System.Threading;
|
|
using Estsh.Web.Models;
|
|
using Estsh.Web.Util;
|
|
|
|
namespace Estsh.Core.Web.Controllers
|
|
{
|
|
public class ProductionOrderEmergencyReleaseController : Controller
|
|
{
|
|
private ProductionOrderEmergencyReleaseService service = new ProductionOrderEmergencyReleaseService();
|
|
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取客户产线列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult GetCustPDLine()
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList list = this.service.GetCustPDLine();
|
|
result.Add("list", list);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据客户产线查询车型
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult GetMode_type(string CustPDLine)
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList list = this.service.GetMode_type(CustPDLine);
|
|
result.Add("list", list);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据车型编号查询座椅配置
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult GetModelList(int ModelType)
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList list = this.service.GetModelList(ModelType);
|
|
result.Add("list", list);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
///// <summary>
|
|
///// 获取配置名称
|
|
///// </summary>
|
|
///// <returns></returns>
|
|
//public ActionResult GetModelName()
|
|
//{
|
|
// Hashtable result = new Hashtable();
|
|
// ArrayList list = this.service.GetModelName();
|
|
// result.Add("list", list);
|
|
// return Json(result, JsonRequestBehavior.AllowGet);
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 获取班次
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult Getshift()
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList list = this.service.Getshift();
|
|
result.Add("list", list);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取生产类型
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult GetProdType()
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList list = this.service.GetProdType();
|
|
result.Add("list", list);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据配置编号获取总成清单
|
|
/// </summary>
|
|
/// <param name="modelID">配置编号</param>
|
|
/// <returns>总成清单</returns>
|
|
public ActionResult GetBomDetail(int cbModel)//,string isLoad)
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList list = this.service.GetBomDetail(cbModel);
|
|
result.Add("rows", list);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
//库存插单保存按钮
|
|
public bool isExist(string order_no)
|
|
{
|
|
return service.isExist(order_no);
|
|
}
|
|
|
|
//加载单据编号
|
|
public string GetOrderNo()
|
|
{
|
|
return service.GetOrderNo("StockOrder", "A");
|
|
}
|
|
|
|
//库存插单保存按钮
|
|
public bool Insert_g_stock_order(int model_type_id, int model_id, string order_no, string cust_pdline, int shift_id, int qty, string type,string document_data)
|
|
{
|
|
return service.Insert_g_stock_order(model_type_id, model_id, order_no, cust_pdline, shift_id, qty, type, document_data);
|
|
}
|
|
|
|
public bool Insert_g_stock_order_detail(string order_no, string model_id, string partNoList)
|
|
{
|
|
try
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
|
|
if (string.IsNullOrEmpty(partNoList) && string.IsNullOrEmpty(model_id.ToString()))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
//判断配置对应总成是否匹配
|
|
DataTable dt = new DataTable();
|
|
|
|
dt = service.GetBomDetailTable(Convert.ToInt32(model_id));
|
|
|
|
partNoList = partNoList.Remove(partNoList.Length - 1, 1);
|
|
|
|
string[] strList = partNoList.Split(',');
|
|
|
|
bool ifExist = false;
|
|
for (int j = 0; j < strList.Length; j++)
|
|
{
|
|
DataRow[] dr = dt.Select("part_no='" + strList[j] + "'");
|
|
if (dr.Length <= 0)
|
|
{
|
|
ifExist = false;
|
|
return ifExist;
|
|
}
|
|
}
|
|
|
|
for (int i = 0; i < strList.Length; i++)
|
|
{
|
|
string partId = service.getPartId(strList[i]).ToString();
|
|
ifExist = service.Insert_g_stock_order_detail(order_no, partId);
|
|
|
|
}
|
|
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
///<summary>
|
|
/// 调用存储过程 dbo.sys_release_stock_order 释放生产指令
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public string ReleaseStockOrder(string order_no,int ruid)
|
|
{
|
|
string mes = "";
|
|
order_no = order_no.Substring(0, order_no.Length - 1);
|
|
string[] str = order_no.Split(',');
|
|
|
|
for (int i = 0; i < str.Length; i++)
|
|
{
|
|
mes = service.ReleaseStockOrder(str[i].ToString(), ruid);
|
|
}
|
|
return mes;
|
|
}
|
|
|
|
///<summary>
|
|
/// 调用存储过程 dbo.sys_assign_stock_order 分配虚拟料架
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public string AssignStockOrder(string custPDLine)
|
|
{
|
|
return service.AssignStockOrder(custPDLine);
|
|
}
|
|
|
|
// /// <summary>
|
|
///// 初始化全局的静态变量
|
|
///// </summary>
|
|
///// <param name="proxy"></param>
|
|
//public string TrayPagePrintCount(string param)
|
|
//{
|
|
// return service.TrayPagePrintCount(param);
|
|
//}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取要打印的条码数据(前排)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult GetSN(string orderNo)
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList list = this.service.GetSN(orderNo);
|
|
result.Add("rows", list);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新条码的打印状态
|
|
/// </summary>
|
|
/// <param name="serialNumber">条码</param>
|
|
/// <returns>是否成功</returns>
|
|
//public bool UpdateSNPrintStatus(string serialNumber)
|
|
//{
|
|
// return service.UpdateSNPrintStatus(serialNumber);
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 获取要打印的条码数据(前排)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult GetBackSN(string orderNo)
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList list = this.service.GetBackSN(orderNo);
|
|
result.Add("rows", list);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
//条码补打
|
|
|
|
/// <summary>
|
|
/// 获取补打信息
|
|
/// </summary>
|
|
/// <param name="serialNumber">过程条码 OR 合格证条码</param>
|
|
/// <returns></returns>
|
|
public ActionResult GetReprintDataBySN(string type, string serialNumber, int count, bool isOrderByInLineTime)
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList list = this.service.GetReprintDataBySN(type, serialNumber, count, isOrderByInLineTime);
|
|
result.Add("rows", list);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取要 打印过程条码 信息
|
|
/// </summary>
|
|
/// <param name="serialNumber"></param>
|
|
//public void PrintSerialNumber(string serialNumber)
|
|
public ActionResult PrintSerialNumber(string serialNumber)
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList list = this.service.PrintSerialNumber(serialNumber);
|
|
result.Add("rows", list);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据配置编号获取过程条码打印的张数
|
|
/// </summary>
|
|
public int GetModelBarcodeCount(string serialNumber)
|
|
{
|
|
return service.GetModelBarcodeCount(serialNumber);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新条码的补打状态
|
|
/// </summary>
|
|
/// <param name="sn">条码</param>
|
|
/// <returns>是否更新成功</returns>
|
|
public bool UpdateSNReprintStatus(string serialNumber)
|
|
{
|
|
return service.UpdateSNReprintStatus(serialNumber);
|
|
}
|
|
|
|
// 打印合格证
|
|
/// <summary>
|
|
/// 根据配置编号获取合格证条码打印的张数
|
|
/// </summary>
|
|
public int GetModelQACount(string serialNumber)
|
|
{
|
|
return service.GetModelQACount(serialNumber);
|
|
}
|
|
|
|
//打印后排的的合格证条码
|
|
|
|
/// <summary>
|
|
/// 根据条码获取对应后排条码的打印信息
|
|
/// </summary>
|
|
/// <param name="serialNumber">条码</param>
|
|
/// <returns>后排条码的打印信息</returns>
|
|
public ActionResult GetBackSNs(string serialNumber)
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList list = this.service.GetBackSNs(serialNumber);
|
|
result.Add("rows", list);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 导入Bom Excel文件
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult importInstruction()
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
HttpPostedFileBase userDataFile = Request.Files[0];
|
|
UserInfo user = (UserInfo)Session["loginedUser"];
|
|
if (userDataFile == null)
|
|
{
|
|
return null;
|
|
}
|
|
result = service.ReadExcelFile(userDataFile.InputStream, user.empId);
|
|
return Json(result);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取列表数据
|
|
/// </summary>
|
|
/// <param name="CartonTrackName">菜单名称</param>
|
|
/// <param name="pager">分页</param>
|
|
/// <param name="direction">排序方式</param>
|
|
/// <param name="sort">排序列</param>
|
|
/// <returns></returns>
|
|
public ActionResult getProductionOrderListByPage(Pager pager, String direction, String sort, string cbCustPDLine)
|
|
{
|
|
string str = "";
|
|
|
|
if ((string.IsNullOrEmpty(cbCustPDLine)) || cbCustPDLine == "null")
|
|
{
|
|
//cbCustPDLine = "0";
|
|
return null;
|
|
}
|
|
|
|
Hashtable result = new Hashtable();
|
|
result.Add("pager.pageNo", pager.pageNo);
|
|
Hashtable dataHt = this.service.getProductionOrderListByPage(pager, direction, sort, cbCustPDLine);
|
|
result.Add("rows", dataHt["dataList"]);
|
|
result.Add("pager.totalRows", dataHt["totalCount"]);
|
|
result.Add("sort", sort);
|
|
result.Add("direction", direction);
|
|
return Json(result);
|
|
}
|
|
}
|
|
} |