using BLL;
|
using Common;
|
using Model;
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web.Mvc;
|
using System.Web.Script.Serialization;
|
using Json;
|
using Lib;
|
|
namespace WMS.Areas.Business.Controllers
|
{
|
public class MovePosAjaxController : AjaxPage
|
{
|
// GET: Business/MovePosAjax
|
public ActionResult GetList()
|
{
|
var dd = Request["ajaxdata"];
|
|
var models = new JavaScriptSerializer().Deserialize<AjaxMoveList>(dd);
|
|
|
|
if (models != null)
|
{
|
PageInfo pageInfo = new PageInfo() { PageIndex = models.pageIndex, PageSize = models.pageSize };
|
|
|
IDALMove provider = new DALMove();
|
List<MovePos> entity = provider.GetList(models, ref pageInfo).ToList();
|
|
|
string json = JsonHelper.IListToJson<MovePos>(entity, "List");
|
string pjson = ConvertJson.Serializer(pageInfo);
|
|
ReturnJson.AddProperty("Result", new JsonObject(json));
|
ReturnJson.AddProperty("PageInfo", new JsonObject(pjson));
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "响应成功");
|
ReturnJson.AddProperty("SubCode", 0);
|
ReturnJson.AddProperty("SubMessage", "");
|
|
return Content(this.ReturnJson.ToString());
|
|
|
}
|
return Content(null);
|
}
|
|
|
public ActionResult Add()
|
{
|
var dd = Request["Entity"];
|
|
var models = new JavaScriptSerializer().Deserialize<MovePos>(dd);
|
|
if (models != null)
|
{
|
List<MoveMat> list = Session["TEMPDATA_CACHE_MOVEPOSDETAIL"] as List<MoveMat>;
|
|
IDALMove dalErp = new DALMove();
|
models.CreateUser = this.LoginUserCode;
|
models.Statu = "ER04";
|
models.AuditStatu = "AD01";
|
models.AuditUser = "";
|
bool value = false;
|
if (string.IsNullOrEmpty(models.MDNo))
|
{
|
value = dalErp.Add(models, list);
|
if (value)
|
{
|
Session["TEMPDATA_CACHE_MOVEPOSDETAIL"] = null;
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "添加成功");
|
}
|
else
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "添加失败");
|
}
|
|
ReturnJson.AddProperty("SubCode", 0);
|
ReturnJson.AddProperty("SubMessage", "");
|
}
|
else
|
{
|
value = dalErp.Update(models, list);
|
if (value)
|
{
|
Session["TEMPDATA_CACHE_MOVEPOSDETAIL"] = null;
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "编辑成功");
|
}
|
else
|
{
|
ReturnJson.AddProperty("Code", -1);
|
ReturnJson.AddProperty("Message", "编辑失败");
|
}
|
ReturnJson.AddProperty("SubCode", 0);
|
ReturnJson.AddProperty("SubMessage", "");
|
}
|
|
return Content(this.ReturnJson.ToString());
|
|
|
}
|
return Content(null);
|
}
|
|
// GET: Business/ErpInAjax
|
public ActionResult LoadPalno()
|
{
|
List<MoveMat> list = Session["TEMPDATA_CACHE_MOVEPOSDETAIL"] as List<MoveMat>;
|
list = list.IsEmpty() ? new List<MoveMat>() : list;
|
this.ReturnJson.AddProperty("Result", new JsonObject(JsonHelper.ListToJson<MoveMat>(list, "List")));
|
return Content(this.ReturnJson.ToString());
|
}
|
|
public ActionResult GetPalno(string MDNo)
|
{
|
|
if (!string.IsNullOrEmpty(MDNo))
|
{
|
IDALMoveDetail detail = new DALMoveDetail();
|
List<MoveMat> entity = detail.GetList(MDNo).ToList();
|
|
string json = JsonHelper.IListToJson<MoveMat>(entity, "List");
|
ReturnJson.AddProperty("Result", new JsonObject(json));
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "响应成功");
|
ReturnJson.AddProperty("SubCode", 0);
|
ReturnJson.AddProperty("SubMessage", "");
|
|
return Content(this.ReturnJson.ToString());
|
}
|
|
return Content(null);
|
}
|
// GET: Business/ErpInAjax
|
public ActionResult AddPalno()
|
{
|
var dd = Request["Entity"];
|
ArrayList alist = new JavaScriptSerializer().Deserialize<ArrayList>(dd);
|
if (alist != null)
|
{
|
List<MoveMat> listt = Session["TEMPDATA_CACHE_MOVEPOSDETAIL"] as List<MoveMat>;
|
|
if (listt == null) listt = new List<MoveMat>();
|
|
for (int i = 0;i< alist.Count;i++)
|
{
|
var models = new JavaScriptSerializer().Deserialize<MoveMat>(alist[i].ToString());
|
|
if (models != null)
|
{
|
|
if (!listt.Exists(a => a.Palno == models.Palno || a.StopAddre == models.StopAddre))
|
listt.Add(models);
|
else
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "该托盘已存在或货位地址重复分配");
|
ReturnJson.AddProperty("SubCode", 0);
|
ReturnJson.AddProperty("SubMessage", "");
|
}
|
|
|
}
|
}
|
if (listt != null)
|
{
|
Session["TEMPDATA_CACHE_MOVEPOSDETAIL"] = listt;
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "响应成功");
|
ReturnJson.AddProperty("SubCode", 0);
|
ReturnJson.AddProperty("SubMessage", "");
|
}
|
}
|
else
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "没有选中需移库的托盘");
|
ReturnJson.AddProperty("SubCode", 0);
|
ReturnJson.AddProperty("SubMessage", "");
|
}
|
return Content(this.ReturnJson.ToString());
|
}
|
|
public ActionResult DelPalno()
|
{
|
string dd = Request["Palno"];
|
|
if (!string.IsNullOrEmpty(dd))
|
{
|
List<MoveMat> listMat = Session["TEMPDATA_CACHE_MOVEPOSDETAIL"] as List<MoveMat>;
|
|
|
Predicate<MoveMat> match1 = (MoveMat s) => { return s.Palno == dd; };
|
listMat.RemoveAll(match1);
|
//Session["TEMPDATA_CACHE_MOVEPOSDETAIL"] = listMat;
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "删除物料成功");
|
ReturnJson.AddProperty("SubCode", 0);
|
ReturnJson.AddProperty("SubMessage", "");
|
|
|
return Content(this.ReturnJson.ToString());
|
}
|
return Content(null);
|
}
|
|
|
public ActionResult Delete()
|
{
|
string dd = Request["list"];
|
ArrayList models = new JavaScriptSerializer().Deserialize<ArrayList>(dd);
|
string[] list = (string[])models.ToArray(typeof(string));
|
|
if (models != null)
|
{
|
IDALMove dalErp = new DALMove();
|
bool value = false;
|
|
value = dalErp.BatchDelete(list);
|
if (value)
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "删除订单成功");
|
}
|
else
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "删除订单失败");
|
}
|
|
ReturnJson.AddProperty("SubCode", 0);
|
ReturnJson.AddProperty("SubMessage", "");
|
|
return Content(this.ReturnJson.ToString());
|
|
|
}
|
return Content(null);
|
}
|
|
public ActionResult Audit()
|
{
|
string dd = Request["ajaxdata"];
|
var models = new JavaScriptSerializer().Deserialize<MovePos>(dd);
|
|
if (models != null)
|
{
|
IDALMove dalErp = new DALMove();
|
|
bool value = false;
|
models.AuditUser = this.LoginUserCode;
|
value = dalErp.UpdateAudit(models);
|
if (value)
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "删除订单成功");
|
}
|
else
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "删除订单失败");
|
}
|
|
ReturnJson.AddProperty("SubCode", 0);
|
ReturnJson.AddProperty("SubMessage", "");
|
|
return Content(this.ReturnJson.ToString());
|
|
|
}
|
return Content(null);
|
}
|
|
public ActionResult Close()
|
{
|
string dd = Request["list"];
|
ArrayList models = new JavaScriptSerializer().Deserialize<ArrayList>(dd);
|
string[] list = (string[])models.ToArray(typeof(string));
|
|
if (models != null)
|
{
|
IDALErpIn dalErp = new DALErpIn();
|
|
bool value = false;
|
|
value = dalErp.UpdateClose(list, "ER03");
|
if (value)
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "删除订单成功");
|
}
|
else
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "删除订单失败");
|
}
|
|
ReturnJson.AddProperty("SubCode", 0);
|
ReturnJson.AddProperty("SubMessage", "");
|
|
return Content(this.ReturnJson.ToString());
|
|
|
}
|
return Content(null);
|
}
|
|
public ActionResult Send()
|
{
|
string dd = Request["list"];
|
ArrayList models = new JavaScriptSerializer().Deserialize<ArrayList>(dd);
|
string[] list = (string[])models.ToArray(typeof(string));
|
|
if (models != null)
|
{
|
IDALErpIn dalErp = new DALErpIn();
|
|
bool value = false;
|
|
value = dalErp.UpdateClose(list, "ER03");
|
if (value)
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "删除订单成功");
|
}
|
else
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "删除订单失败");
|
}
|
|
ReturnJson.AddProperty("SubCode", 0);
|
ReturnJson.AddProperty("SubMessage", "");
|
|
return Content(this.ReturnJson.ToString());
|
|
|
}
|
return Content(null);
|
}
|
|
|
}
|
}
|