Browse Source

Merge branch 'master' of http://code.qiyue666.com/pengcong001/bbwy

pjzs_starttask_update
shanji 2 years ago
parent
commit
f208d9441a
  1. 2
      BBWY.Client/GlobalContext.cs
  2. 13
      BBWY.Client/ViewModels/Purchase/1688PreviewPurchaseViewModel.cs
  3. 4
      BBWY.Client/Views/PackTask/PrintWindow.xaml
  4. 92
      BBWY.Client/Views/PackTask/PrintWindow.xaml.cs
  5. 7
      BBWY.Client/Views/PackagingTask/PrintPackDetailWindow.xaml.cs
  6. 6
      BBWY.Server.API/Controllers/TestController.cs
  7. 25
      BBWY.Server.Business/TestBusiness.cs

2
BBWY.Client/GlobalContext.cs

@ -13,7 +13,7 @@ namespace BBWY.Client
{
ShopServiceGroupList = new List<string>();
ShopServiceGroupLowerList = new List<string>();
ClientVersion = "10221";
ClientVersion = "10223";
}

13
BBWY.Client/ViewModels/Purchase/1688PreviewPurchaseViewModel.cs

@ -76,6 +76,7 @@ namespace BBWY.Client.ViewModels
/// 扩展数据,暂用于拳探
/// </summary>
private string extensions;
private bool isSkuMatchError;
public _1688PreviewPurchaseViewModel(OneBoundAPIService oneBoundAPIService,
PurchaseService purchaseService,
@ -117,7 +118,7 @@ namespace BBWY.Client.ViewModels
protected override void Load()
{
IsLoading = true;
isSkuMatchError = false;
Task.Factory.StartNew(() => purchaseService.GetPurchaseSchemeList(order.ItemList.Select(osku => osku.Id).ToList(), purchaser.Id, globalContext.User.Shop.ShopId))
.ContinueWith(r =>
{
@ -150,7 +151,10 @@ namespace BBWY.Client.ViewModels
else
{
IsLoading = false;
App.Current.Dispatcher.Invoke(() => MessageBox.Show("采购方案商品加载失败,请重新打开预览窗口", "提示"));
if (isSkuMatchError)
App.Current.Dispatcher.Invoke(() => MessageBox.Show("采购方案与当前商品页的数据匹配失败,请删除旧采购方案后重新绑定采购方案", "提示"));
else
App.Current.Dispatcher.Invoke(() => MessageBox.Show("采购方案商品加载失败,请重新打开预览窗口", "提示"));
}
});
}
@ -195,6 +199,11 @@ namespace BBWY.Client.ViewModels
}
}
});
if (purchaseSchemeProduct.SelectedSkuIdList.Any(s => !data.Value.purchaseSchemeProductSkus.Any(s1 => s1.PurchaseSkuId == s)))
{
isSkuMatchError = true;
}
}
ewh.Set();

4
BBWY.Client/Views/PackTask/PrintWindow.xaml

@ -45,13 +45,13 @@
<TextBlock Margin="48,0,10,0" VerticalAlignment="Center" HorizontalAlignment="Left" Height="15" Width="43" Text="打印机:"/>
<Border BorderBrush="{StaticResource Border.Brush}" Height="30" BorderThickness="1">
<ComboBox x:Name="cbPrints" BorderThickness="0" Width="200" Height="30" VerticalAlignment="Top" HorizontalAlignment="Left" />
<ComboBox ItemsSource="{Binding PrintList}" Text="{Binding PrintName}" BorderThickness="0" Width="200" Height="30" VerticalAlignment="Top" HorizontalAlignment="Left" />
</Border>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0 10 0 10">
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Margin="60,0,0,0" Width="30" Height="15" Text="数量:"/>
<c:BTextBox x:Name="tbCount" Width="203" Margin="11,0,0,0" Height="30" VerticalAlignment="Top" HorizontalAlignment="Left"/>
<c:BTextBox Text="{Binding PrintCount}" Width="203" Margin="11,0,0,0" Height="30" VerticalAlignment="Top" HorizontalAlignment="Left"/>
</StackPanel>
<StackPanel Margin="0 10 0 0">

92
BBWY.Client/Views/PackTask/PrintWindow.xaml.cs

@ -9,6 +9,8 @@ using System.Threading.Tasks;
using System.Windows;
using System.Collections.ObjectModel;
using BBWY.Client.Extensions;
using System.Reflection;
using System.IO;
namespace BBWY.Client.Views.PackTask
{
@ -20,21 +22,17 @@ namespace BBWY.Client.Views.PackTask
public PrintWindow()
{
InitializeComponent();
this.Loaded += PrintWindow_Loaded;
}
InitPrintList();
this.DataContext = this;
private void PrintWindow_Loaded(object sender, RoutedEventArgs e)
{
LoadPrints();
}
/// <summary>
/// 获取打印机名称
/// </summary>
private void LoadPrints()
public void InitPrintList()
{
PrintList = new ObservableCollection<string>();
var printingNames = PrinterSettings.InstalledPrinters;//获取本机的打印机数据
int index = -1;
int selectIndex = 0;
@ -49,12 +47,30 @@ namespace BBWY.Client.Views.PackTask
{
selectIndex = index;
}
cbPrints.Items.Add(name);
PrintList.Add(name);
}
try
{
var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string printNames = System.IO.Path.Combine(applicationPath, "handPrintBarCerName.init");
if (File.Exists(printNames))
{
PrintName = File.ReadAllText(printNames);
}
else
{
if (PrintList.Count > 0)
{
PrintName = PrintList[0].ToString();
}
}
}
if (cbPrints.Items.Count > selectIndex)
catch (Exception)
{
cbPrints.SelectedIndex = selectIndex;
}
}
@ -81,43 +97,59 @@ namespace BBWY.Client.Views.PackTask
cer.Visibility = Visibility.Collapsed;
bar.Visibility = Visibility.Visible;
}
this.DataContext = this;
}
public CertificateModel[] CertificateModel { get; set; }
private CertificateModel[] certificateModel;
public CertificateModel[] CertificateModel { get => certificateModel; set { Set(ref certificateModel, value); } }
public BarCodeModel BarCodeModel { get; set; }
private BarCodeModel barCodeModel;
public BarCodeModel BarCodeModel { get=> barCodeModel; set {Set(ref barCodeModel,value); } }
private void BButton_Click(object sender, RoutedEventArgs e)
{
int printCount = 0;
try
{
printCount = Convert.ToInt32(tbCount.Text);
}
catch
{
new TipsWindow("请输入打印份数", 1).ShowDialog();
return;
}
string printName = cbPrints.Text;//选择的要打印的打印机名称
/// <summary>
/// 打印机列表
/// </summary>
public ObservableCollection<string> PrintList { get; set; }
public string PrintName { get; set; }
public int PrintCount { get => printCount; set { Set(ref printCount, value); } }
private int printCount = 1;
private void BButton_Click(object sender, RoutedEventArgs e)
{
Task.Factory.StartNew(() =>
{
if (BarCodeModel != null)
{
PrintData(printCount, printName,BarCodeModel);
PrintData(PrintCount, PrintName,BarCodeModel);
//MyPrintHelper.PrintBarcode(ref args, BarCodeModel, font);
}
if (CertificateModel != null&& CertificateModel.Count()>0)
{
foreach (var cer in CertificateModel)
{
PrintData(printCount, printName,null,cer);
PrintData(PrintCount, PrintName,null,cer);
System.Threading.Thread.Sleep(100);
}
}
var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string printNames = System.IO.Path.Combine(applicationPath, "handPrintBarCerName.init");
try
{
if (File.Exists(printNames))
{
File.Delete(printNames);
}
}
catch
{
}
File.WriteAllText(printNames, PrintName);
});
}

7
BBWY.Client/Views/PackagingTask/PrintPackDetailWindow.xaml.cs

@ -93,13 +93,6 @@ namespace BBWY.Client.Views.PackagingTask
}
private void BButton_Click(object sender, System.Windows.RoutedEventArgs e)
{
if (PrintName.IsNullOrEmpty())
{
MessageBox.Show("请选择打印设备");

6
BBWY.Server.API/Controllers/TestController.cs

@ -42,5 +42,11 @@ namespace BBWY.Server.API.Controllers
{
testBusiness.RepairOrderProfit();
}
[HttpPost]
public void RepairDFOrder()
{
testBusiness.RepairDFOrder();
}
}
}

25
BBWY.Server.Business/TestBusiness.cs

@ -15,6 +15,7 @@ using BBWY.Server.Business.Extensions;
using Newtonsoft.Json;
using System.Net.Http;
using System.Threading.Tasks;
using Org.BouncyCastle.Crypto.Signers;
namespace BBWY.Server.Business
{
@ -25,6 +26,7 @@ namespace BBWY.Server.Business
private IFreeSql fsql;
private OrderSyncBusiness orderSyncBusiness;
private TaskSchedulerManager taskSchedulerManager;
private PurchaseOrderBusiness purchaseOrderBusiness;
public TestBusiness(RestApiService restApiService,
IOptions<GlobalConfig> options,
FreeSqlMultiDBManager freeSqlMultiDBManager,
@ -32,13 +34,15 @@ namespace BBWY.Server.Business
YunDingBusiness yunDingBusiness,
IFreeSql fsql,
OrderSyncBusiness orderSyncBusiness,
TaskSchedulerManager taskSchedulerManager) : base(restApiService, options, yunDingBusiness)
TaskSchedulerManager taskSchedulerManager,
PurchaseOrderBusiness purchaseOrderBusiness) : base(restApiService, options, yunDingBusiness)
{
this.freeSqlMultiDBManager = freeSqlMultiDBManager;
this.venderBusiness = venderBusiness;
this.fsql = fsql;
this.orderSyncBusiness = orderSyncBusiness;
this.taskSchedulerManager = taskSchedulerManager;
this.purchaseOrderBusiness = purchaseOrderBusiness;
}
public void SyncVenderId()
@ -385,6 +389,25 @@ namespace BBWY.Server.Business
if (!response.Success)
throw new BusinessException(response.Msg);
}
public void RepairDFOrder()
{
var st = DateTime.Parse("2023-11-01");
var et = DateTime.Parse("2023-11-30 23:59:59");
var list = fsql.Select<Order, OrderDropShipping, OrderCostDetail>()
.InnerJoin((o, ods, ocd) => o.Id == ods.OrderId)
.InnerJoin((o, ods, ocd) => o.Id == ocd.OrderId)
.Where((o, ods, ocd) => o.ShopId == 12897067 && o.OrderState != Enums.OrderState. && o.StartTime >= st && o.StartTime <= et && o.StorageType == Enums.StorageType. && ocd.IsEnabled == true && ocd.SkuAmount == 0)
.ToList((o, ods, ocd) => ods.PurchaseOrderId).Distinct().ToList();
for (var i = 0; i < list.Count; i++)
{
Console.WriteLine($"{i + 1}/{list.Count()},{list[i]}");
var param = new { type = "ORDER_BUYER_VIEW_ORDER_PRICE_MODIFY", data = new { orderId = list[i] } };
purchaseOrderBusiness.CallbackFrom1688(JsonConvert.SerializeObject(param));
Thread.Sleep(1000);
}
}
}
public class JPCount

Loading…
Cancel
Save