Browse Source

1

AddValidOverTime
shanji 2 years ago
parent
commit
6f6a78510a
  1. 9
      BBWY.Client/Models/APIModel/Response/Logistics/StoreResponse.cs
  2. 35
      BBWY.Client/Models/QiKu/PackSkuConfig.cs
  3. 27
      BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseCreateNewOrderViewModel.cs
  4. 2
      BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml
  5. 12
      BBWY.Server.API/Controllers/VenderController.cs
  6. 20
      BBWY.Server.Business/Sync/StoreHouseSyncBusiness.cs
  7. 33
      BBWY.Server.Business/Vender/VenderBusiness.cs

9
BBWY.Client/Models/APIModel/Response/Logistics/StoreResponse.cs

@ -0,0 +1,9 @@
namespace BBWY.Client.Models
{
public class StoreResponse
{
public string StoreId { get; set; }
public string StoreName { get; set; }
}
}

35
BBWY.Client/Models/QiKu/PackSkuConfig.cs

@ -0,0 +1,35 @@
namespace BBWY.Client.Models.QiKu
{
public class PackSkuConfig : NotifyObject
{
private int splitCount;
public string SkuId { get; set; }
public string Logo { get; set; }
public string Title { get; set; }
/// <summary>
/// 采购数量
/// </summary>
public int PurchaseCount { get; set; }
/// <summary>
/// 分箱数量
/// </summary>
public int SplitCount { get => splitCount; set { Set(ref splitCount, value); } }
}
public class PackSkuSplitConfig : NotifyObject
{
private int packCount;
private StoreResponse store;
public int Index { get; set; }
public int PackCount { get => packCount; set { Set(ref packCount, value); } }
public StoreResponse Store { get => store; set { Set(ref store, value); } }
}
}

27
BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseCreateNewOrderViewModel.cs

@ -76,6 +76,8 @@ namespace BBWY.Client.ViewModels
public ICommand SubtractQuantityCommand { get; set; }
public ICommand NextCommand { get; set; }
public BatchPurchaseCreateNewOrderViewModel(PurchaseProductAPIService purchaseProductAPIService,
PurchaseService purchaseService,
GlobalContext globalContext,
@ -88,6 +90,7 @@ namespace BBWY.Client.ViewModels
ProductSkuWithSchemeList = new ObservableCollection<ProductSkuWithScheme>();
FastCreateOrderCommand = new RelayCommand(FastCreateOrder);
NextCommand = new RelayCommand(Next);
PreviewOrderCommand = new RelayCommand(PreviewOrder);
AddProductSkuCommand = new RelayCommand(AddProductSku);
DeleteProductSkuWithSchemeCommand = new RelayCommand<ProductSkuWithScheme>(DeleteProductSkuWithScheme);
@ -375,5 +378,29 @@ namespace BBWY.Client.ViewModels
if (purchaseSchemeProductSku.ItemTotal > 1)
purchaseSchemeProductSku.ItemTotal--;
}
private void Next()
{
if (IsLoading)
return;
if (TotalAmount == 0)
{
MessageBox.Show("总金额为0不能提交订单", "提示");
return;
}
if (string.IsNullOrEmpty(Mobile) ||
string.IsNullOrEmpty(Address) ||
string.IsNullOrEmpty(City) ||
string.IsNullOrEmpty(Province) ||
string.IsNullOrEmpty(County) ||
string.IsNullOrEmpty(Town) ||
string.IsNullOrEmpty(ContactName))
{
MessageBox.Show("收货人信息不全", "下单");
return;
}
}
}
}

2
BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml

@ -347,6 +347,8 @@
Command="{Binding PreviewOrderCommand}" Background="#1CC2A2"/>
<c:BButton Content="提交订单" Width="80" HorizontalAlignment="Right"
Command="{Binding FastCreateOrderCommand}" Margin="0,0,5,0"/>
<!--<c:BButton Content="下一步" Width="80" HorizontalAlignment="Right"
Command="{Binding NextCommand}" Margin="0,0,5,0"/>-->
</StackPanel>
</Grid>
</c:BWindow>

12
BBWY.Server.API/Controllers/VenderController.cs

@ -1,5 +1,6 @@
using BBWY.Common.Models;
using BBWY.Server.Business;
using BBWY.Server.Model.Db;
using BBWY.Server.Model.Dto;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
@ -113,5 +114,16 @@ namespace BBWY.Server.API.Controllers
{
return venderBusiness.GetServiceGroupList(request);
}
/// <summary>
/// 获取店铺关联的仓库列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
public IList<Storehouse> GetStoreHouseList([FromBody] PlatformRequest request)
{
return venderBusiness.GetStoreHouseList(request);
}
}
}

20
BBWY.Server.Business/Sync/StoreHouseSyncBusiness.cs

@ -78,14 +78,20 @@ namespace BBWY.Server.Business.Sync
}
}
var storeHouseIds = storeHouseList.Select(s => s.Id).ToArray();
var dbStoreIds = fsql.Select<Storehouse>(storeHouseIds).ToList(s => s.Id);
var exceptIds = storeHouseIds.Except(dbStoreIds);
if (exceptIds.Count() > 0)
//var storeHouseIds = storeHouseList.Select(s => s.Id).ToArray();
//var dbStoreIds = fsql.Select<Storehouse>(storeHouseIds).ToList(s => s.Id);
//var exceptIds = storeHouseIds.Except(dbStoreIds);
//if (exceptIds.Count() > 0)
//{
// var insertList = storeHouseList.Where(s => exceptIds.Contains(s.Id)).ToList();
// fsql.Insert(insertList).ExecuteAffrows();
//}
fsql.Transaction(() =>
{
var insertList = storeHouseList.Where(s => exceptIds.Contains(s.Id)).ToList();
fsql.Insert(insertList).ExecuteAffrows();
}
fsql.Delete<Storehouse>().Where(s => 1 == 1).ExecuteAffrows();
fsql.Insert(storeHouseList).ExecuteAffrows();
});
}
private void ResolveJDStoreHouse(JArray jarray, ShopResponse shop, IList<Storehouse> storeHouseList)

33
BBWY.Server.Business/Vender/VenderBusiness.cs

@ -7,6 +7,7 @@ using BBWY.Server.Model.Db.Mds;
using BBWY.Server.Model.Dto;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
@ -323,5 +324,37 @@ namespace BBWY.Server.Business
throw new BusinessException(response.Msg) { Code = response.Code };
return response.Data;
}
public IList<Storehouse> GetStoreHouseList(PlatformRequest request)
{
var restApiResult = restApiService.SendRequest(GetPlatformRelayAPIHost(request.Platform), "api/PlatformSDK/GetStoreHouseList", new PlatformRequest()
{
AppKey = request.AppKey,
AppSecret = request.AppSecret,
AppToken = request.AppToken,
Platform = request.Platform,
SaveResponseLog = false
}, GetYunDingRequestHeader(), HttpMethod.Post);
if (restApiResult.StatusCode != System.Net.HttpStatusCode.OK)
throw new Exception(restApiResult.Content);
var response = JsonConvert.DeserializeObject<ApiResponse<JArray>>(restApiResult.Content);
if (response.Data == null || response.Data.Count() == 0)
return null;
var storeHouseList = new List<Storehouse>();
foreach (var storeHouseJToken in response.Data)
{
var seq_num = storeHouseJToken.Value<string>("seq_num");
storeHouseList.Add(new Storehouse()
{
Id = seq_num,
Name = storeHouseJToken.Value<string>("name"),
Platform = request.Platform,
CreateTime = DateTime.Now,
Status = (Enums.StockStatus)storeHouseJToken.Value<int>("use_flag"),
Type = (Enums.StockType)storeHouseJToken.Value<int>("type")
});
}
return storeHouseList;
}
}
}

Loading…
Cancel
Save