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.

122 lines
3.6 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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 BOMReleaseController : Controller
{
private BOMReleaseService service = new BOMReleaseService();
//
// GET: /BOMRelease/
public ActionResult Index()
{
return View();
}
/// <summary>
/// 获取BOM数据
/// </summary>
/// <param name="part_no"></param>
/// <param name="cust_order"></param>
/// <param name="pager"></param>
/// <param name="direction"></param>
/// <param name="sort"></param>
/// <returns></returns>
public ActionResult getBOMReleaseListByPage(String part_no,string AENNR, Pager pager, String direction, String sort)
{
Hashtable result = new Hashtable();
result.Add("pager.pageNo", pager.pageNo);
Hashtable dataHt = this.service.getBOMReleaseListByPage(part_no, AENNR , 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>
/// 更新BOM版本
/// </summary>
/// <param name="part_no">零件号</param>
/// <param name="AENNR">版本</param>
/// <returns></returns>
public ActionResult UpdateBOM(String part_no, string AENNR)
{
int count = 0;
string partWhere = "";
if (!string.IsNullOrEmpty(part_no) && !part_no.Equals("可选请输入暂时不BOM生效的零件号分隔。"))
{
string _temp = "";
string[] arr = part_no.Trim().Split('');
foreach (string i in arr)
{
_temp += "'" + i + "',";
}
_temp = _temp.Substring(0, _temp.Length - 1);
partWhere += " AND MATNR not in (" + _temp + ")";
}
DataTable dt = new DataTable();
dt = service.getAllPart(partWhere, AENNR);
if (dt == null || dt.Rows.Count < 1)
{
count = -1;
}
else
{
foreach (DataRow dr in dt.Rows)
{
part_no = dr[0].ToString();
service.SyncSAPBOMByPartNo(part_no ,AENNR);
count += 1;
}
}
Hashtable result = new Hashtable();
result.Add("status", count);
return Json(result);
}
/// <summary>
/// 查询BOM版本
/// </summary>
/// <returns></returns>
public ActionResult getVersion()
{
Hashtable param = new Hashtable();
ArrayList versionList = service.getVersion();
param.Add("list", versionList);
return Json(param, JsonRequestBehavior.AllowGet);
}
}
}