tijian_tieying/web/dccdc/Controllers/kcController.cs

893 lines
33 KiB
C#
Raw Permalink Normal View History

2025-02-20 12:14:39 +08:00
using dccdc.BLL;
using dccdc.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using static dccdc.Controllers.DictionariesController;
namespace dccdc.Controllers
{
public class kcController : Controller
{
List<Droplist> kD = new List<Droplist>() { new Droplist { Value = "1", Title = "老库" }, new Droplist { Value = "2", Title = "应急仓库" } };
// GET: kc
public ActionResult Index()
{
return View();
}
#region
public ActionResult kcView()
{
ViewBag.kD = new SelectList(kD, "value", "title");
return View();
}
public ActionResult kcMessage(string id)
{
ViewData["wzlist"] = new SelectList(new wzBll().GetAllList(""), "id", "mc");
ViewBag.kD = new SelectList(kD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.kcBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
return View();
}
}
public JsonResult getkcPage(int page, int pagesize, string key, string sign)
{
var bll = new BLL.kcBll();
int count = bll.getCount(key, sign);
var models = bll.getPage(page, pagesize, key, sign);
return Json(new { Total = count, Rows = models });
}
public JsonResult savekc(kcModel model)
{
var bll = new BLL.kcBll();
return Json(bll.save(model));
}
#endregion
#region
public ActionResult rkdView()
{
ViewData["gyslist"] = new SelectList(new gyszdBll().GetAllList(""), "id", "mc");
var user = Session["loginUser"] as Models.ERPUser;
ViewData["userid"] = user.ID;
return View();
}
public ActionResult rkdMessage(string id)
{
ViewBag.gysD = new SelectList(new gyszdBll().GetAllList(""), "id", "mc");
ViewBag.wzlbD = new SelectList(new wzlbBll().GetAllList("", "1"), "id", "lbmc");
var list = new List<Droplist>() { new Droplist { Value = "0", Title = "未入库" }, new Droplist { Value = "1", Title = "已入库" } };
ViewBag.ztD = new SelectList(list, "value", "title", 1);
ViewBag.kD = new SelectList(kD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.rkdBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
return View();
}
}
public JsonResult getrkdPage(int page, int pagesize, string key)
{
var bll = new BLL.rkdBll();
int count = bll.getCount(key);
var models = bll.getPage(page, pagesize, key);
return Json(new { Total = count, Rows = models });
}
public JsonResult opSaveRkd(string id, string gysid, string gys, string rkje, string zt, string sign, string items, string sqdid, string last)
{
var user = Session["loginUser"] as Models.ERPUser;
if (string.IsNullOrEmpty(gysid) || string.IsNullOrEmpty(items))
return Json(new { State = 0, Message = "false" });
var bll = new rkdBll();
int isqdid = 0;
int.TryParse(sqdid, out isqdid);
// bool result;
if (id == "")
{
if (isqdid != 0 && last == "1") //last=="1" 最终入库
{
var model2 = new BLL.sqwzcgBll().GetAllList(sqdid).First();
//微信消息通知2
wxxx2(model2.id, model2.sqrid, "已入库", user.TrueName);
}
return Json(bll.opSave(id, gysid, gys, rkje, zt, sign, items, user.ID, user.TrueName, isqdid == 0 ? 2 : 1, isqdid, last));
//result = bll.opSave(id, gysid, gys, rkje, zt, items, user.ID, user.TrueName, 2, 0);
}
else
return Json(bll.opSave2(id, gysid, gys, rkje, zt, sign, items, user.ID, user.TrueName));
//result = bll.opSave2(id, gysid, gys, rkje, zt, items, user.ID, user.TrueName);
//return result;
}
//物资采购 采购 入库 通知本人
private void wxxx2(int id, int sqrid, string bz, string czr)
{
string sql = "";
var bll = new ERPUserBll();
string template_id = "";
string token = "";
//通知本人
sql = "select * from ERPUser where id = " + sqrid;
List<ERPUser> models2 = bll.getOpenids(sql);
if (models2.Count > 0)
{
//系统消息
ERPLanEmailModel modelxx = new ERPLanEmailModel();
modelxx.EmailTitle = "你的物资采购申请:" + bz;
modelxx.TimeStr = DateTime.Now;
modelxx.EmailContent = DateTime.Now.ToString("yyyy-MM-dd HH:mm") + " " + czr + " <br/>" + bz;
modelxx.FuJian = "";
modelxx.FromUser = "审核消息";
modelxx.ToUser = models2[0].UserName;
modelxx.EmailState = "未读";
modelxx.type = "";
new BLL.ERPLanEmailBll().save(modelxx);
if (!string.IsNullOrEmpty(models2[0].Openid))
{
template_id = "FsZ3HSb-NNxR3Qu13t3pTU-LV5wxeAv9wp6whyjQc28";
token = dccdc.Common.Global.getAccessToken.access_token;
if (models2[0].Openidtype == 1) //疫苗公众号
{
template_id = "Pa3LFO_jV4z4mbFyMtGVbI6warV7CFbCatGtLVgAqDY";
token = dccdc.Common.Global.getAccessTokenYM.access_token;
}
try
{
var data = new
{
touser = models2[0].Openid,
template_id = template_id,
url = "http://dc.51csharp.com/default.aspx?tjlogout=ok&yhid=" + models2[0].ID.ToString(),
miniprogram = new
{
appid = "wx85cc5d2f79a4ba6d",
pagepath = "pages/index/index?hyid=" + models2[0].ID.ToString(),
},
data = new
{
first = new { value = "你的物资采购申请:" + bz, color = "#173177" },
keyword1 = new { value = czr, color = "#173177" },
keyword2 = new { value = DateTime.Now.ToString("yyyy-MM-dd HH:mm"), color = "#173177" },
remark = new { value = bz, color = "#173177" },
}
};
WebClient wc = new WebClient();
byte[] responseBytes = wc.UploadData("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + token, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(data)));
string responseText = System.Text.Encoding.UTF8.GetString(responseBytes);
}
catch (Exception ex)
{
}
}
}
}
public JsonResult deleteRkd(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.rkdBll().delete(id));
}
public JsonResult getwzbykey(string key, string key1, string id)
{
var bll = new BLL.wzBll();
var models = bll.GetListByKey(key, key1);
//修改时 添加已有明细
if (!string.IsNullOrEmpty(id))
{
var bllmx = new BLL.rkdmxBll();
var modelmx = bllmx.GetListByParent(id);
wzModel mm;
foreach (rkdmxModel m in modelmx)
{
mm = new wzModel();
mm.id = m.wzid;
mm.mc = m.wzmc;
mm.dj = m.dj;
mm.sl = m.sl;
mm.sign = m.sign;
models.Add(mm);
}
}
return Json(new { Rows = models });
}
#endregion
#region
public JsonResult savewz2(string id, string dj)
{
var bll = new BLL.wzBll();
var model = bll.GetAllList(id).First();
if (model.dj == Convert.ToDecimal(dj))
return Json(new { State = 2, Message = "价格不变!" });
int haveid = bll.Getone(model.mc, model.ggxh, model.sccj, model.jldw, Convert.ToDecimal(dj));
if (haveid > 0)
return Json(new { State = 1, Message = "存在id", id = haveid });
var bm = bll.GetMaxBm() + 1;
if (bll.GetBm(bm.ToString()))
return Json(new { State = 0, Message = "编码重复!" });
model.id = 0; //0是添加标志
model.bm = bm.ToString(); //编码
model.dj = Convert.ToDecimal(dj); //单价
var user = Session["loginUser"] as Models.ERPUser;
model.tjr = user.TrueName;
model.tjsj = DateTime.Now;
return Json(bll.save2(model));
}
#endregion
#region 退
public ActionResult thdView()
{
ViewData["gyslist"] = new SelectList(new gyszdBll().GetAllList(""), "id", "mc");
var user = Session["loginUser"] as Models.ERPUser;
ViewData["userid"] = user.ID;
return View();
}
public ActionResult thdMessage(string id)
{
ViewBag.gysD = new SelectList(new gyszdBll().GetAllList(""), "id", "mc");
ViewBag.wzlbD = new SelectList(new wzlbBll().GetAllList("", "1"), "id", "lbmc");
ViewBag.kD = new SelectList(kD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.thdBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
return View();
}
}
public JsonResult getthdPage(int page, int pagesize, string key)
{
var bll = new BLL.thdBll();
int count = bll.getCount(key);
var models = bll.getPage(page, pagesize, key);
return Json(new { Total = count, Rows = models });
}
[AllowAnonymous]
public string getThdByThdh(string thdh)
{
var bll = new thdBll();
if (string.IsNullOrEmpty(thdh))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.getThdByThdh(thdh));
}
[AllowAnonymous]
public string getThdMxByThdId(string thdid)
{
var bll = new thdBll();
if (string.IsNullOrEmpty(thdid))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.getThdMxByThdId(thdid));
}
public JsonResult opSaveThd(string id, string gysid, string gys, string thje, string thyy, string items)
{
var bll = new thdBll();
var user = Session["loginUser"] as Models.ERPUser;
if (string.IsNullOrEmpty(gysid) || string.IsNullOrEmpty(items))
return Json(new { State = 0, Message = "false" });
//bool result = bll.opSave(id, gysid, gys, thje, thyy, items, user.ID, user.TrueName);
return Json(bll.opSave(id, gysid, gys, thje, thyy, items, user.ID, user.TrueName));
}
public JsonResult deleteThd(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.thdBll().delete(id));
}
public JsonResult getwzbykey2(string key, string key1, string sign, string id)
{
var bll = new BLL.wzBll();
List<wzModel> models = bll.GetListByKey(key, key1);
//修改时 添加已有明细
if (!string.IsNullOrEmpty(id))
{
var bllmx = new BLL.thdmxBll();
var modelmx = bllmx.GetListByParent(id);
wzModel mm;
foreach (thdmxModel m in modelmx)
{
mm = new wzModel();
mm.id = m.wzid;
mm.mc = m.wzmc;
mm.dj = m.dj;
mm.sl = m.sl;
mm.sign = m.sign;
models.Add(mm);
}
return Json(new { Rows = models });
}
else //获取库存数量 物资单价与库存熟练合并
{
List<wzModel> modelsResult = new List<wzModel>();
var bll2 = new BLL.kcBll();
var models2 = bll2.GetListByKey(key, sign);
foreach (wzModel model in models)
{
foreach (kcModel model2 in models2)
{
if (model2.wzid == model.id)
{
model.sl = model2.sl;
model.sign = model2.sign;
model.kcid = model2.id;
modelsResult.Add((wzModel)Common.Clone.CloneObject(model));
//break;
}
}
}
return Json(new { Rows = modelsResult });
}
}
#endregion
#region
public ActionResult ckdView()
{
ViewData["kslist"] = new SelectList(new ERPBuMenBll().GetAllList(""), "id", "bumenname");
var user = Session["loginUser"] as Models.ERPUser;
ViewData["userid"] = user.ID;
return View();
}
public ActionResult ckdMessage(string id)
{
ViewBag.ksD = new SelectList(new ERPBuMenBll().GetAllList(""), "id", "bumenname");
ViewBag.wzlbD = new SelectList(new wzlbBll().GetAllList("", "1"), "id", "lbmc");
List<string> ry = new List<string>();
ViewBag.lyrs = new SelectList(ry);
ViewBag.kD = new SelectList(kD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.ckdBll();
var model = bll.GetAllList(id).First();
ViewBag.lyrs = new SelectList(new ERPUserBll().getListByDepname(model.ksmc), "TrueName", "TrueName");
return View(model);
}
else
{
return View();
}
}
public JsonResult getlyrbybm(string bm)
{
if (bm != "德城区疾病预防控制中心")
return Json(new { lyrs = new ERPUserBll().getListByDepname(bm).Select(t => t.TrueName).ToList() });
else
{
List<string> lyrs = new List<string>();
var ls = new BLL.wzBll().getgylyrlist();
foreach (var r in ls)
{
lyrs.Add(r.xm);
}
return Json(new { lyrs = lyrs });
}
}
public JsonResult getckdPage(int page, int pagesize, string key)
{
var bll = new BLL.ckdBll();
int count = bll.getCount(key);
var models = bll.getPage(page, pagesize, key);
return Json(new { Total = count, Rows = models });
}
public JsonResult opSaveCkd(string id, string ksid, string ksmc, string lyr, string items, string ckje)
{
var user = Session["loginUser"] as Models.ERPUser;
if (string.IsNullOrEmpty(ksid) || string.IsNullOrEmpty(items))
return Json(new { State = 0, Message = "false" });
var bll = new ckdBll();
//bool result = bll.opSave(id, ksid, ksmc, lyr, items, user.ID, user.TrueName);
return Json(bll.opSave(id, ksid, ksmc, lyr, items, user.ID, user.TrueName, ckje));
}
[AllowAnonymous]
public string getCkdByCkdh(string ckdh)
{
var bll = new ckdBll();
if (string.IsNullOrEmpty(ckdh))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.getCkdByCkdh(ckdh));
}
[AllowAnonymous]
public string getCudMxByCkdId(string ckdid)
{
var bll = new ckdBll();
if (string.IsNullOrEmpty(ckdid))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.getCudMxByCkdId(ckdid));
}
public JsonResult deleteCkd(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.ckdBll().delete(id));
}
public JsonResult getwzbykey3(string key, string key1, string sign, string id)
{
var bll = new BLL.wzBll();
List<wzModel> models = bll.GetListByKey(key, key1);
//修改时 添加已有明细
if (!string.IsNullOrEmpty(id))
{
var bllmx = new BLL.ckdmxBll();
var modelmx = bllmx.GetListByParent(id);
wzModel mm;
foreach (ckdmxModel m in modelmx)
{
mm = new wzModel();
mm.id = m.wzid;
mm.mc = m.wzmc;
mm.dj = m.dj;
mm.sl = m.sl;
mm.sign = m.sign;
models.Add(mm);
}
return Json(new { Rows = models });
}
else //获取库存数量 物资单价与库存熟练合并
{
List<wzModel> modelsResult = new List<wzModel>();
var bll2 = new BLL.kcBll();
var models2 = bll2.GetListByKey(key, sign);
foreach (wzModel model in models)
{
foreach (kcModel model2 in models2)
{
if (model2.wzid == model.id)
{
model.sl = model2.sl;
model.sign = model2.sign;
model.kcid = model2.id;
modelsResult.Add((wzModel)Common.Clone.CloneObject(model));
//break;
}
}
}
return Json(new { Rows = modelsResult.Where(t => t.sl > 0).ToList() });
}
}
#endregion
#region 退
public ActionResult tkdView()
{
ViewData["kslist"] = new SelectList(new ERPBuMenBll().GetAllList(""), "id", "bumenname");
var user = Session["loginUser"] as Models.ERPUser;
ViewData["userid"] = user.ID;
return View();
}
public ActionResult tkdMessage(string id)
{
ViewBag.ksD = new SelectList(new ERPBuMenBll().GetAllList(""), "id", "bumenname");
ViewBag.wzlbD = new SelectList(new wzlbBll().GetAllList("", "1"), "id", "lbmc");
List<string> ry = new List<string>();
ViewBag.tkrys = new SelectList(ry);
ViewBag.kD = new SelectList(kD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.tkdBll();
var model = bll.GetAllList(id).First();
ViewBag.tkrys = new SelectList(new ERPUserBll().getListByDepname(model.ksmc), "TrueName", "TrueName");
return View(model);
}
else
{
return View();
}
}
public JsonResult gettkdPage(int page, int pagesize, string key)
{
var bll = new BLL.tkdBll();
int count = bll.getCount(key);
var models = bll.getPage(page, pagesize, key);
return Json(new { Total = count, Rows = models });
}
[AllowAnonymous]
public string getTkdByTkdh(string tkdh)
{
var bll = new tkdBll();
if (string.IsNullOrEmpty(tkdh))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.getTkdByTkdh(tkdh));
}
[AllowAnonymous]
public string getTkdMxByTkdId(string tkdid)
{
var bll = new tkdBll();
if (string.IsNullOrEmpty(tkdid))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.getTkdMxByTkdId(tkdid));
}
public JsonResult opSaveTkd(string id, string ksid, string ksmc, string tkry, string sign, string items, string tkje)
{
var bll = new tkdBll();
var user = Session["loginUser"] as Models.ERPUser;
if (string.IsNullOrEmpty(ksid) || string.IsNullOrEmpty(items))
return Json(new { State = 0, Message = "false" });
//bool result = bll.opSave(id, ksid, ksmc, tkry, items, user.ID, user.TrueName);
return Json(bll.opSave(id, ksid, ksmc, tkry, sign, items, user.ID, user.TrueName, tkje));
}
public JsonResult deleteTkd(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.tkdBll().delete(id));
}
public JsonResult getwzbykey4(string key, string key1, string id)
{
var bll = new BLL.wzBll();
List<wzModel> models = bll.GetListByKey(key, key1);
//修改时 添加已有明细
if (!string.IsNullOrEmpty(id))
{
var bllmx = new BLL.tkdmxBll();
var modelmx = bllmx.GetListByParent(id);
wzModel mm;
foreach (tkdmxModel m in modelmx)
{
mm = new wzModel();
mm.id = m.wzid;
mm.mc = m.wzmc;
mm.dj = m.dj;
mm.sl = m.sl;
mm.sign = m.sign;
models.Add(mm);
}
}
return Json(new { Rows = models });
}
#endregion
#region
public ActionResult pddView()
{
//ViewData["kslist"] = new SelectList(new ERPBuMenBll().GetAllList(""), "id", "bumenname");
var user = Session["loginUser"] as Models.ERPUser;
ViewData["userid"] = user.ID;
return View();
}
[AllowAnonymous]
public string getPddByPddh(string pddh)
{
var bll = new pddBll();
if (string.IsNullOrEmpty(pddh))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.getPddByPddh(pddh));
}
[AllowAnonymous]
public string getPddMxByPddId(string ppdid)
{
var bll = new pddBll();
if (string.IsNullOrEmpty(ppdid))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.getPddMxByPddId(ppdid));
}
public ActionResult pddMessage(string id)
{
//ViewBag.ksD = new SelectList(new ERPBuMenBll().GetAllList(""), "id", "bumenname");
ViewBag.wzlbD = new SelectList(new wzlbBll().GetAllList("", "1"), "id", "lbmc");
ViewBag.kD = new SelectList(kD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.pddBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
return View();
}
}
public JsonResult getpddPage(int page, int pagesize, string key)
{
var bll = new BLL.pddBll();
int count = bll.getCount(key);
var models = bll.getPage(page, pagesize, key);
return Json(new { Total = count, Rows = models });
}
public JsonResult opSavePdd(string id, string ksid, string ksmc, string bz, string items, string pdje)
{
var bll = new pddBll();
var user = Session["loginUser"] as Models.ERPUser;
if (string.IsNullOrEmpty(ksid) || string.IsNullOrEmpty(items))
return Json(new { State = 0, Message = "false" });
// bool result = bll.opSave(id, ksid, ksmc, bz, items, user.ID, user.TrueName);
return Json(bll.opSave(id, ksid, ksmc, bz, items, user.ID, user.TrueName, pdje));
}
public JsonResult deletePdd(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.pddBll().delete(id));
}
public JsonResult getwzbykey5(string key, string key1, string sign, string id)
{
var bll = new BLL.wzBll();
List<wzModel> models = bll.GetListByKey(key, key1);
//修改时 添加已有明细
if (!string.IsNullOrEmpty(id))
{
var bllmx = new BLL.pddmxBll();
var modelmx = bllmx.GetListByParent(id);
wzModel mm;
foreach (pddmxModel m in modelmx)
{
mm = new wzModel();
mm.id = m.wzid;
mm.mc = m.wzmc;
mm.dj = m.dj;
mm.sl = m.sl;
mm.sign = m.sign;
mm.oldsl = m.oldsl;
mm.newsl = m.oldsl + m.sl;
models.Add(mm);
}
return Json(new { Rows = models });
}
else //获取库存数量 物资单价与库存熟练合并
{
List<wzModel> modelsResult = new List<wzModel>();
var bll2 = new BLL.kcBll();
var models2 = bll2.GetListByKey(key, sign);
foreach (wzModel model in models)
{
foreach (kcModel model2 in models2)
{
if (model2.wzid == model.id)
{
model.sl = model2.sl;
model.sign = model2.sign;
model.kcid = model2.id;
modelsResult.Add((wzModel)Common.Clone.CloneObject(model));
//break;
}
}
}
return Json(new { Rows = modelsResult });
}
}
#endregion
#region
public ActionResult pdd2View()
{
//ViewData["kslist"] = new SelectList(new ERPBuMenBll().GetAllList(""), "id", "bumenname");
var user = Session["loginUser"] as Models.ERPUser;
ViewData["userid"] = user.ID;
return View();
}
[AllowAnonymous]
public string getPdd2ByPddh(string pddh)
{
var bll = new pdd2Bll();
if (string.IsNullOrEmpty(pddh))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.getPddByPddh(pddh));
}
[AllowAnonymous]
public string getPdd2MxByPddId(string ppdid)
{
var bll = new pdd2Bll();
if (string.IsNullOrEmpty(ppdid))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.getPddMxByPddId(ppdid));
}
public ActionResult pdd2Message(string id)
{
//ViewBag.ksD = new SelectList(new ERPBuMenBll().GetAllList(""), "id", "bumenname");
ViewBag.wzlbD = new SelectList(new wzlbBll().GetAllList("", "1"), "id", "lbmc");
var user = Session["loginUser"] as Models.ERPUser;
ViewBag.kD = new SelectList(kD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.pdd2Bll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
return View();
}
}
public JsonResult getpdd2Page(int page, int pagesize, string key)
{
var bll = new BLL.pdd2Bll();
int count = bll.getCount(key);
var models = bll.getPage(page, pagesize, key);
return Json(new { Total = count, Rows = models });
}
public JsonResult opSavePdd2(string id, string ksid, string ksmc, string bz, string items, string pdje)
{
var bll = new pdd2Bll();
var user = Session["loginUser"] as Models.ERPUser;
if (string.IsNullOrEmpty(ksid) || string.IsNullOrEmpty(items))
return Json(new { State = 0, Message = "false" });
// bool result = bll.opSave(id, ksid, ksmc, bz, items, user.ID, user.TrueName);
return Json(bll.opSave(id, ksid, ksmc, bz, items, user.ID, user.TrueName, pdje));
}
public JsonResult deletePdd2(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.pdd2Bll().delete(id));
}
public JsonResult getwzbykey6(string key, string key1, string sign, string id)
{
var bll = new BLL.wzBll();
List<wzModel> models = bll.GetListByKey(key, key1);
//修改时 添加已有明细
if (!string.IsNullOrEmpty(id))
{
var bllmx = new BLL.pdd2mxBll();
var modelmx = bllmx.GetListByParent(id);
wzModel mm;
foreach (pdd2mxModel m in modelmx)
{
mm = new wzModel();
mm.id = m.wzid;
mm.mc = m.wzmc;
mm.dj = m.dj;
mm.sl = m.sl;
mm.sign = m.sign;
mm.oldsl = m.oldsl;
mm.newsl = m.sl * -1;
models.Add(mm);
}
return Json(new { Rows = models });
}
else //获取库存数量 物资单价与库存熟练合并
{
List<wzModel> modelsResult = new List<wzModel>();
var bll2 = new BLL.kcBll();
var models2 = bll2.GetListByKey(key, sign);
foreach (wzModel model in models)
{
foreach (kcModel model2 in models2)
{
if (model2.wzid == model.id)
{
model.sl = model2.sl;
model.sign = model2.sign;
model.kcid = model2.id;
modelsResult.Add((wzModel)Common.Clone.CloneObject(model));
//break;
}
}
}
return Json(new { Rows = modelsResult });
}
}
#endregion
#region
[AllowAnonymous]
public string getBsdByBsd(string bsdh)
{
return Newtonsoft.Json.JsonConvert.SerializeObject(new BLL.pdd2Bll().getPddByPddh(bsdh));
}
[AllowAnonymous]
public string getBsdMxByBsdId(string bsdid)
{
return Newtonsoft.Json.JsonConvert.SerializeObject(new BLL.pdd2Bll().getPddMxByPddId(bsdid));
}
#endregion
#region
[AllowAnonymous]
public string getkcpdd(string kcid, string key, string wzlb)
{
return Newtonsoft.Json.JsonConvert.SerializeObject(new wzBll().getkcpdd(kcid, key, wzlb));
}
#endregion
#region
[AllowAnonymous]
public string getcbhs(string b, string e)
{
return Newtonsoft.Json.JsonConvert.SerializeObject(new wzBll().getcbhs(b, e));
}
#endregion
/// <summary>
/// 采购申请单页面
/// </summary>
/// <returns></returns>
public ActionResult selectCGSQD()
{
return View();
}
[HttpPost]
public string getcgxqd(string bt, string et)
{
var list = new DAL.sqwzcgDal().getcgxqd(bt, et);
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Total = 0, Rows = list }, new Newtonsoft.Json.JsonSerializerSettings { DateFormatString = "yyyy-MM-dd HH:mm:ss" });
}
[HttpPost]
public string getcgxqdmx(string id)
{
return Newtonsoft.Json.JsonConvert.SerializeObject(new DAL.sqwzcgmxDal().GetListByParent(id));
}
[HttpPost]
public string getwzmx(string id)
{
return Newtonsoft.Json.JsonConvert.SerializeObject(new DAL.wzDal().getwz(id));
}
}
}