|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
|
|
using DSWeb.Areas.TruckMng.DAL.MsWlTyreRep;
|
|
|
|
|
using DSWeb.Areas.TruckMng.Models.MsWlTyreRep;
|
|
|
|
|
using DSWeb.TruckMng.Comm.Cookie;
|
|
|
|
|
using DSWeb.TruckMng.Helper;
|
|
|
|
|
using DSWeb.TruckMng.Helper.Repository;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
using HcUtility.Core;
|
|
|
|
|
using DSWeb.SoftMng.Filter;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Areas.TruckMng.Controllers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 配件申领单
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonRequestBehavior]
|
|
|
|
|
public class MsWlTyreRepController : Controller
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// GET: /TruckMng/MsWlTyreRep/
|
|
|
|
|
|
|
|
|
|
public ActionResult Index()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET: /TruckMng/MsWlTyreRep/Edit
|
|
|
|
|
|
|
|
|
|
public ActionResult Edit()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET:/TruckMng/MsWlTyreRep/GetDataList
|
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition)
|
|
|
|
|
{
|
|
|
|
|
var dataList = MsWlTyreRepDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request));
|
|
|
|
|
|
|
|
|
|
var list = dataList.Skip(start).Take(limit);
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET:/TruckMng/MsWlTyreRep/GetData/
|
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
|
|
|
{
|
|
|
|
|
MsWlTyreRepHead headData = null;
|
|
|
|
|
|
|
|
|
|
if (handle == "edit")
|
|
|
|
|
{
|
|
|
|
|
var list = MsWlTyreRepDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request));
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
headData = list[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (headData == null)
|
|
|
|
|
{
|
|
|
|
|
headData = new MsWlTyreRepHead();
|
|
|
|
|
headData.OrgCode = CookieConfig.GetCookie_OrgCode(Request);
|
|
|
|
|
headData.CkCode = "*";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
|
|
new { Success = true, Message = "查询成功", data = headData });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET:/TruckMng/MsWlTyreRep/Save
|
|
|
|
|
|
|
|
|
|
public ContentResult Save(string opstatus, string data, string body, string delbody)
|
|
|
|
|
{
|
|
|
|
|
var headData = JsonConvert.Deserialize<MsWlTyreRepHead>(data);
|
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsWlTyreRepBody>>(body);
|
|
|
|
|
var bodyDelList = JsonConvert.Deserialize<List<MsWlTyreRepBody>>(delbody);
|
|
|
|
|
|
|
|
|
|
if (opstatus == "add")
|
|
|
|
|
{
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
headData.ModelUIStatus = "I";
|
|
|
|
|
|
|
|
|
|
headData.BillNo = PubSysDAL.GetBillNo("0114");
|
|
|
|
|
headData.UserCode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
|
|
headData.UserName = CookieConfig.GetCookie_UserName(Request);
|
|
|
|
|
headData.OrgCode = CookieConfig.GetCookie_OrgCode(Request);
|
|
|
|
|
headData.OrgName = CookieConfig.GetCookie_OrgName(Request);
|
|
|
|
|
|
|
|
|
|
headData.LrDate = DateTime.Now;
|
|
|
|
|
}
|
|
|
|
|
else if (opstatus == "edit")
|
|
|
|
|
{
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
|
|
headData.ModelUIStatus = "E";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
|
|
DBResult result = modb.Save(headData,
|
|
|
|
|
ModelObjectConvert<MsWlTyreRepBody>.ToModelObjectList(bodyList),
|
|
|
|
|
ModelObjectConvert<MsWlTyreRepBody>.ToModelObjectList(bodyDelList));
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
|
|
{
|
|
|
|
|
Success = result.Success,
|
|
|
|
|
Message = result.Message,
|
|
|
|
|
Data = MsWlTyreRepDAL.GetHeadDataByBillNo(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
|
|
|
|
//20130826 需要在产生更换记录的同时进行如下操作:
|
|
|
|
|
/* 1:增加一条出库记录,将换上的新胎出库
|
|
|
|
|
* 2:增加入库记录,将换下的旧胎挂顶入库
|
|
|
|
|
* 3:修改轮胎台账,将这些胎的相应状态更新
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET:/TruckMng/MsWlTyreRep/Delete
|
|
|
|
|
|
|
|
|
|
public ContentResult Delete(string data)
|
|
|
|
|
{
|
|
|
|
|
var headData = JsonConvert.Deserialize<MsWlTyreRepHead>(data);
|
|
|
|
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
DBResult result = modb.Delete(headData, "delete from tMsWlTyreRepBody where BillNo='" + headData.BillNo + "'");
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetBodyList(string billno)
|
|
|
|
|
{
|
|
|
|
|
var condition = " BillNo='" + billno + "' ";
|
|
|
|
|
List<MsWlTyreRepBody> list = MsWlTyreRepDAL.GetBodyList(condition);
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 参照部分
|
|
|
|
|
|
|
|
|
|
public ContentResult GetTruckNoList(string condition)
|
|
|
|
|
{
|
|
|
|
|
var list = MsWlTyreRepDAL.GetTruckNoList(Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request));
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = list.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|