48 lines
1.7 KiB
C#
48 lines
1.7 KiB
C#
using YLErp.Modules.ClientModule;
|
|
|
|
namespace YLErp.Web.Controllers
|
|
{
|
|
public class client_spanController : BaseController
|
|
{
|
|
readonly YLContext db = new YLContext();
|
|
|
|
public JsonResult UpdateWorstCastClientPayable(ClientMarginModifyRequestModel reqModel)
|
|
{
|
|
|
|
var client = DataCacheProvider.GetClientDataSource().GetData(reqModel.ClientId);
|
|
if (reqModel.HoldingDeposit < 0 && (client != null && client.MarginOptionType != 1 || client == null))
|
|
{
|
|
return JsonError("预付金占用不能输入负数");
|
|
}
|
|
|
|
//预付金占用,数据库存的负数,页面上显示的正数,需要做下取负处理,并且验证页面输入值为正
|
|
reqModel.HoldingDeposit = -reqModel.HoldingDeposit;
|
|
|
|
if (db.eodStatus.Any(x => x.ValueDate == reqModel.ValueDate && x.Status == "已收盘"))
|
|
{
|
|
new ClientSpanService(CurUser).UpdateWorstCastClientPayable(reqModel);
|
|
|
|
return JsonSuccess("更新成功");
|
|
}
|
|
else
|
|
{
|
|
return JsonError("请确保该交易日已收盘,收盘后才可以修改预付金占用");
|
|
}
|
|
}
|
|
|
|
public JsonResult UnlockWorstCastClientPayable(ClientMarginModifyRequestModel reqModel)
|
|
{
|
|
var result = new ClientSpanService(CurUser).UnlockWorstCastClientPayable(reqModel);
|
|
|
|
if (result)
|
|
{
|
|
return JsonSuccess("解锁成功,预付金占用将会在重新收盘后才会更新");
|
|
}
|
|
else
|
|
{
|
|
return JsonError("该交易日不存在锁定的修改记录,无需解锁");
|
|
}
|
|
}
|
|
}
|
|
}
|