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.
265 lines
8.5 KiB
C#
265 lines
8.5 KiB
C#
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;
|
|
using ApServerProvider;
|
|
|
|
/***************************************************************************************************
|
|
*
|
|
* 作者:黄飞
|
|
*
|
|
* *************************************************************************************************/
|
|
namespace Estsh.Core.Web.Controllers
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class SupplierProductionPlanPrintController : Controller
|
|
{
|
|
private SupplierProductionPlanPrintService service = new SupplierProductionPlanPrintService();
|
|
private RemotingProxy.RecordStatus _recordStatus = RemotingProxy.RecordStatus.Enable;
|
|
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取列表数据
|
|
/// </summary>
|
|
/// <param name="CartonTrackName">菜单名称</param>
|
|
/// <param name="pager">分页</param>
|
|
/// <param name="direction">排序方式</param>
|
|
/// <param name="sort">排序列</param>
|
|
/// <returns></returns>
|
|
public ActionResult getListByPage(Pager pager, String direction, String sort)
|
|
{
|
|
string str = "";
|
|
Hashtable result = new Hashtable();
|
|
|
|
result.Add("pager.pageNo", pager.pageNo);
|
|
Hashtable dataHt = this.service.getListByPage(_recordStatus, 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>
|
|
/// <returns></returns>
|
|
public ActionResult GetCustPDLine()
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList list = this.service.GetCustPDLine();
|
|
result.Add("list", list);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
public ActionResult GetPrint(string cbCustPDLine, string pdLine, string txtCreateDate)
|
|
{
|
|
string partLocation = "IN ('01','02')";
|
|
if (pdLine == "1000011")
|
|
{
|
|
pdLine = "100001";
|
|
}
|
|
if (pdLine == "1000012")
|
|
{
|
|
pdLine = "100001";
|
|
partLocation = "NOT IN ('01','02')";
|
|
}
|
|
if (pdLine == "100002")
|
|
{
|
|
partLocation = "NOT IN ('01','02')";
|
|
}
|
|
|
|
Hashtable result = new Hashtable();
|
|
ArrayList list = this.service.GetPrint(cbCustPDLine, pdLine, partLocation, txtCreateDate);
|
|
result.Add("list", list);
|
|
return Json(result);
|
|
}
|
|
|
|
public ActionResult GetSummary(string txtCreateDate)
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList list = this.service.GetSummary(txtCreateDate);
|
|
result.Add("list", list);
|
|
return Json(result);
|
|
}
|
|
|
|
|
|
public ActionResult adjustLine(string seq, string ruid, string a, string SequenceNumber, string CustPDLine, string prodType)
|
|
{
|
|
bool Bool = false;
|
|
Hashtable result = new Hashtable();
|
|
|
|
if (string.IsNullOrEmpty(seq) && string.IsNullOrEmpty(ruid) && string.IsNullOrEmpty(a))
|
|
{
|
|
result = new Hashtable();
|
|
result.Add("status", false);
|
|
return Json(result);
|
|
}
|
|
|
|
int _sequenceNumber = Convert.ToInt32(SequenceNumber);
|
|
//输入的顺序号如果大于系统中最大的seq则返回
|
|
if (service.maxSeq() < _sequenceNumber)
|
|
{
|
|
result = new Hashtable();
|
|
result.Add("status", false);
|
|
return Json(result);
|
|
}
|
|
|
|
//选中行信息
|
|
seq = seq.Substring(0, seq.Length - 1);
|
|
ruid = ruid.Substring(0, ruid.Length - 1);
|
|
string[] SeqArray = seq.Split(',');
|
|
|
|
List<int> abc = new List<int>();
|
|
for (int i = 0; i < SeqArray.Length; i++)
|
|
{
|
|
abc.Add(Convert.ToInt32(SeqArray[i]));
|
|
}
|
|
abc.Sort();
|
|
int maxSeq = Convert.ToInt32(abc[abc.Count - 1]);
|
|
|
|
//if (seq.Contains(","))
|
|
//{
|
|
// maxSeq = Convert.ToInt32(seq.Substring(seq.LastIndexOf(',') + 1));
|
|
//}
|
|
//else
|
|
//{
|
|
// maxSeq = Convert.ToInt32(seq);
|
|
//}
|
|
|
|
if (maxSeq > _sequenceNumber)
|
|
{
|
|
int addSeqNo = (maxSeq - _sequenceNumber) + 1;
|
|
|
|
Bool = this.service.adjustSeq(addSeqNo, _sequenceNumber, ruid, prodType);
|
|
}
|
|
else
|
|
{
|
|
int minSeq = Convert.ToInt32(abc[0]);
|
|
int minSeq22 = Convert.ToInt32(SeqArray[SeqArray.Length - 1]);
|
|
int addSeqNo = _sequenceNumber - minSeq + 1;
|
|
|
|
Bool = this.service.adjustSeq2(addSeqNo, _sequenceNumber, ruid, prodType);
|
|
}
|
|
|
|
//int VirtualOrder = Convert.ToInt32(a.Substring(0, a.Length - 1));
|
|
|
|
////查询所有待生产信息
|
|
//DataTable dt = this.service.selectAll(CustPDLine);
|
|
|
|
////目标行信息
|
|
//DataRow[] dr = dt.Select("seq = " + SequenceNumber + "", "seq");
|
|
|
|
|
|
//int objectOrder = Convert.ToInt32(dr[0]["a"]);
|
|
|
|
//if (Convert.ToInt32(VirtualOrder) > objectOrder)
|
|
//{
|
|
// for (int i = 0; i < VirtualOrder - objectOrder; i++)
|
|
// {
|
|
|
|
// dt = new DataTable();
|
|
// dt = this.service.selectAll(CustPDLine);
|
|
// DataRow[] dr_2 = dt.Select("a = " + (VirtualOrder - i) + "", "a");
|
|
// DataRow[] dr_3 = dt.Select("a = " + (Convert.ToInt32(VirtualOrder) - i - 1).ToString() + "", "a");
|
|
|
|
// int data_ruid_1 = Convert.ToInt32(dr_2[0]["ruid"]);
|
|
// int data_seq_1 = Convert.ToInt32(dr_2[0]["seq"]);
|
|
// int data_ruid_2 = Convert.ToInt32(dr_3[0]["ruid"]);
|
|
// int data_seq_2 = Convert.ToInt32(dr_3[0]["seq"]);
|
|
|
|
// Bool = this.service.upAll(data_ruid_1, data_seq_1, data_ruid_2, data_seq_2);
|
|
// }
|
|
//}
|
|
//else
|
|
//{
|
|
// result = new Hashtable();
|
|
// result.Add("status", false);
|
|
// return Json(result);
|
|
//}
|
|
|
|
result = new Hashtable();
|
|
result.Add("status", true);
|
|
return Json(result);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 删除BOMdetail数据
|
|
/// </summary>
|
|
/// <param name="ids"></param>
|
|
/// <returns></returns>
|
|
public ActionResult deleteOrder(string ruid, string prodType)
|
|
{
|
|
int delCount = 0;
|
|
Hashtable result = new Hashtable();
|
|
ruid = ruid.Substring(0, ruid.Length - 1);
|
|
|
|
try
|
|
{
|
|
delCount = this.service.deleteOrder(ruid, prodType);
|
|
if (delCount > 0)
|
|
{
|
|
result.Add("message", "删除成功!");
|
|
}
|
|
else
|
|
{
|
|
result.Add("message", "删除失败!");
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
delCount = -1;
|
|
}
|
|
|
|
|
|
return Json(result);
|
|
}
|
|
|
|
public ActionResult deleteOrderInfo(string seq, string prodType, string pdLine)
|
|
{
|
|
String[] array = seq.Split(',');
|
|
seq = array[0].ToString();
|
|
string custPdlineDesc = array[1].ToString();
|
|
|
|
int delCount = 0;
|
|
Hashtable result = new Hashtable();
|
|
|
|
try
|
|
{
|
|
delCount = this.service.deleteOrderInfo(seq, custPdlineDesc, prodType, pdLine);
|
|
if (delCount > 0)
|
|
{
|
|
result.Add("message", "删除成功!");
|
|
}
|
|
else
|
|
{
|
|
result.Add("message", "删除失败!");
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
delCount = -1;
|
|
}
|
|
|
|
|
|
return Json(result);
|
|
}
|
|
}
|
|
}
|