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 { /// /// /// public class YYAdjustOrderController : Controller { private YYAdjustOrderService service = new YYAdjustOrderService(); private RemotingProxy.RecordStatus _recordStatus = RemotingProxy.RecordStatus.Enable; // // GET: /YYAdjustOrder/ public ActionResult Index() { return View(); } /// /// 获取列表数据 /// /// 菜单名称 /// 分页 /// 排序方式 /// 排序列 /// public ActionResult getYYAdjustOrderListByPage(Pager pager, String direction, String sort, string cbCustPDLine) { string str = ""; if ((string.IsNullOrEmpty(cbCustPDLine)) || cbCustPDLine == "null") { cbCustPDLine = "0"; } Hashtable result = new Hashtable(); result.Add("pager.pageNo", pager.pageNo); Hashtable dataHt = this.service.getYYAdjustOrderListByPage(_recordStatus, 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); } public ActionResult adjustLine(string seq, string ruid, string a, string SequenceNumber, string CustPDLine) { 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); } //选中行信息 seq = seq.Substring(0, seq.Length - 1); ruid = ruid.Substring(0, ruid.Length - 1); 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); } /// /// 删除BOMdetail数据 /// /// /// public ActionResult deleteOrder(string ruid) { int delCount = 0; Hashtable result = new Hashtable(); ruid = ruid.Substring(0, ruid.Length - 1); try { delCount = this.service.deleteOrder(ruid); if (delCount > 0) { result.Add("message", "删除成功!"); } else { result.Add("message", "删除失败!"); } } catch (Exception e) { delCount = -1; } return Json(result); } public ActionResult deleteOrderInfo(string ruid) { String[] array = ruid.Split(','); ruid = array[0].ToString(); string custPdlineDesc = array[1].ToString(); int delCount = 0; Hashtable result = new Hashtable(); try { delCount = this.service.deleteOrderInfo(ruid, custPdlineDesc); if (delCount > 0) { result.Add("message", "删除成功!"); } else { result.Add("message", "删除失败!"); } } catch (Exception e) { delCount = -1; } return Json(result); } } }