Commit daece110 authored by 黄奎's avatar 黄奎

新增erp下单方法

parent e41509dd
......@@ -507,6 +507,95 @@ namespace Mall.WebApi.Controllers.MallBase
return orderModule.SetAppletGoodsOrderInfo(demodel);
}
/// <summary>
/// ERP下单
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetERPGoodsOrderInfo()
{
var req = RequestParm;
var userInfo = AppletUserInfo;
RB_Goods_Order_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Order_Extend>(req.msg.ToString());
if (demodel.IsFormShoppingCart == 1)
{
if (demodel.ShoppingCartIdList == null || !demodel.ShoppingCartIdList.Any())
{
return ApiResult.ParamIsNull("请传递购物车id");
}
}
if (string.IsNullOrEmpty(demodel.Consignee))
{
return ApiResult.ParamIsNull("请传递收件人");
}
if (string.IsNullOrEmpty(demodel.Mobile))
{
return ApiResult.ParamIsNull("请传递收件人手机号码");
}
if (demodel.DeliveryMethod != Common.Enum.Goods.OrderDeliveryMethodEnum.VerificationShop)
{
if ((demodel.District ?? 0) <= 0)
{
return ApiResult.ParamIsNull("收货地址有误");
}
if (string.IsNullOrEmpty(demodel.ShoppingAddress))
{
return ApiResult.ParamIsNull("收货详细地址不能为空");
}
}
if (demodel.DetailList == null || !demodel.DetailList.Any())
{
return ApiResult.ParamIsNull("请传递商品信息");
}
foreach (var item in demodel.DetailList)
{
if ((item.GoodsId ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请传递商品id");
}
if ((item.Number ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请传递商品数量");
}
if (item.SpecificationList == null || !item.SpecificationList.Any())
{
return ApiResult.ParamIsNull("请传递规格名SpecificationList");
}
item.Specification = JsonConvert.SerializeObject(item.SpecificationList);
}
if ((demodel.Income ?? 0) <= 0)
{
return ApiResult.ParamIsNull("订单金额不正确");
}
demodel.BuyerMessage ??= "";//买家留言
demodel.OrderSource ??= UserSourceEnum.WeiXin;
#region 赋默认值
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.Country ??= 2;
demodel.OrderStatus = Common.Enum.Goods.OrderStatusEnum.NonPayment;
demodel.CreateDate = DateTime.Now;
demodel.Fee ??= 0;
demodel.FreightMoney ??= 0;
demodel.HistoryOrderStatus ??= 0;
demodel.IsApplyForCancel ??= 2;
demodel.IsOrderCommission ??= 2;
demodel.MerchantsNo ??= "";
demodel.Recycled ??= 2;
demodel.Refund ??= 0;
demodel.Status = 0;
demodel.AnchorName ??= "";
demodel.UpdateDate = DateTime.Now;
demodel.UserId = userInfo.UserId;
demodel.SmallShopsId = req.SmallShopsId;
#endregion
return orderModule.SetAppletGoodsOrderInfo(demodel);
}
/// <summary>
/// 返佣初始化
/// </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment