100 lines
2.9 KiB
C#
100 lines
2.9 KiB
C#
using YLErp.Modules.ClientCashModule;
|
|
|
|
namespace YLErp.Web.Controllers
|
|
{
|
|
public class variety_mapping_deductController : BaseController
|
|
{
|
|
public ActionResult variety_mapping_deductEdit(string enid)
|
|
{
|
|
if (string.IsNullOrEmpty(enid))
|
|
{
|
|
return View(new variety_mapping_deduct());
|
|
}
|
|
var intid = DecryptInt(enid);
|
|
var varietyMappingDeduct = yldb.variety_mapping_deduct.Find(intid);
|
|
return View(varietyMappingDeduct);
|
|
}
|
|
|
|
[HttpPost]
|
|
public JsonResult varietyMappingDeductEditJson(variety_mapping_deduct req)
|
|
{
|
|
if (req == null)
|
|
{
|
|
return JsonError("数据不能为空");
|
|
}
|
|
|
|
try
|
|
{
|
|
var r = new VarietyMappingDeductService(CurUser).SaveClientVarietyConfig(req);
|
|
|
|
return JsonSuccess("更新成功", r);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
LogFactory.GetLogger("交易保存").Error(e);
|
|
return JsonError("保存失败:" + e.GetBaseException().Message, e.ToJson());
|
|
}
|
|
}
|
|
|
|
[HttpPost]
|
|
public JsonResult deleteVarietyMappingDeduct(string enid)
|
|
{
|
|
var intid = DecryptInt(enid);
|
|
var r = yldb.variety_mapping_deduct.Find(intid);
|
|
if (r == null)
|
|
{
|
|
return JsonError("该数据已不存在");
|
|
}
|
|
yldb.variety_mapping_deduct.Remove(r);
|
|
yldb.SaveChanges();
|
|
|
|
return JsonSuccess("删除成功");
|
|
}
|
|
|
|
public ActionResult variety_mapping_deductList()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult variety_mapping_deductUpload()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult Uploadvariety_mapping_deduct()
|
|
{
|
|
if (Request.Form.Files.Count == 0)
|
|
{
|
|
return JsonError("上传文件不存在");
|
|
}
|
|
|
|
var file = Request.Form.Files[0];
|
|
|
|
if (!Path.GetExtension(file.FileName).Equals(".xlsx", StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
return JsonError("请上传Excel(.xlsx)格式文件");
|
|
}
|
|
|
|
using var stream = file.OpenReadStream();
|
|
new VarietyMappingDeductService(CurUser).ImportVarietyMappingDeductFromExcel(stream, out var TotalNum, out var SuccessNum);
|
|
|
|
return Json(new
|
|
{
|
|
success = true,
|
|
totalNum = TotalNum,
|
|
successNum = SuccessNum,
|
|
});
|
|
}
|
|
|
|
[HttpPost]
|
|
public JsonResult variety_mapping_deductQuery(VarietyMappingDeductReq req)
|
|
{
|
|
var service = new VarietyMappingDeductService(CurUser);
|
|
|
|
var sList = service.SearchVarietyMappingDeductList(req);
|
|
|
|
return Json(sList);
|
|
}
|
|
}
|
|
}
|