You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
183 lines
6.7 KiB
C#
183 lines
6.7 KiB
C#
using DevComponents.DotNetBar.Controls;
|
|
using DevComponents.DotNetBar.SuperGrid;
|
|
using POSV.Card;
|
|
using POSV.Component;
|
|
using POSV.Entity;
|
|
using POSV.Template;
|
|
using POSV.Utils;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace POSV.Stock
|
|
{
|
|
public partial class StoreStockCheckSummaryForm : BusinessForm
|
|
{
|
|
private List<StoreStorage> storageList = new List<StoreStorage>();
|
|
private string storageId = null;
|
|
public StoreStockCheckSummaryForm()
|
|
{
|
|
InitializeComponent();
|
|
this.controlBox1.Text = "门店库存盘点分析";
|
|
this.controlBox1.ShowApplicationVersion = false;
|
|
}
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
base.OnLoad(e);
|
|
|
|
if (this.DesignMode) return;
|
|
this.Focus();
|
|
this.noTextBox.Focus();
|
|
this.noTextBox.SelectAll();
|
|
this.ActiveControl = this.noTextBox;
|
|
//默认设置三天以内的查询时间
|
|
this.startPicker.Value = Convert.ToDateTime(DateTime.Now.AddDays(-3).ToString("yyyy-MM-dd 00:00:00"));
|
|
this.endPicker.Value = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
|
|
//仓库列表
|
|
InitStorageMenu();
|
|
}
|
|
|
|
private void InitStorageMenu()
|
|
{
|
|
StoreStorage storeStorage = new StoreStorage();
|
|
storeStorage.Id = "";
|
|
storeStorage.No = "";
|
|
storeStorage.Name = "全部仓库";
|
|
storageList.Add(storeStorage);
|
|
try
|
|
{
|
|
using (var db = Global.Instance.OpenDataBase)
|
|
{
|
|
StringBuilder sqlBuf = new StringBuilder();
|
|
sqlBuf.Append(" select id,no,name from pos_store_storage ;");
|
|
storageList.AddRange(db.Fetch<StoreStorage>(sqlBuf.ToString()));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LOGGER.Error(ex);
|
|
}
|
|
RefreshMain();
|
|
}
|
|
|
|
private void RefreshMain()
|
|
{
|
|
this.comboBoxEx1.DisplayMember = "name";
|
|
this.comboBoxEx1.ValueMember = "id";
|
|
this.comboBoxEx1.DataSource = storageList;
|
|
this.comboBoxEx1.SelectedIndexChanged += OnStorageSelectedIndexChanged;
|
|
}
|
|
|
|
private void OnStorageSelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
var obj = sender as ComboBoxEx;
|
|
storageId = StringUtils.GetString(obj.SelectedValue);
|
|
}
|
|
|
|
private void OnCloseTouchClick(object sender, EventArgs e)
|
|
{
|
|
//先关闭父窗体
|
|
if (this.Owner != null)
|
|
{
|
|
this.Owner.Close();
|
|
}
|
|
//再关闭当前窗体
|
|
this.Close();
|
|
}
|
|
|
|
private void BtnQuery(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
var request = new StockCheckSummaryRequest();
|
|
request.StoreId = Global.Instance.Authc.StoreId;
|
|
request.No = this.noTextBox.Text;
|
|
request.StartTime = this.startPicker.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
|
request.EndTime = this.endPicker.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
|
request.StorageId = storageId;
|
|
request.TypeId = "";
|
|
request.Keyword = this.keywordTextBox.Text;
|
|
var response = StockUtils.StockCheckSummary(request);
|
|
|
|
//成功
|
|
if (response.Item1)
|
|
{
|
|
stockListTable.PrimaryGrid.DataSource = response.Item3.List;
|
|
}
|
|
else
|
|
{
|
|
List <StockCheckSummaryResponse> details = new List<StockCheckSummaryResponse>();
|
|
stockListTable.PrimaryGrid.DataSource = details;
|
|
this.ShowToastNotify(this, response.Item2);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
this.ShowToastNotify(this, "门店盘点分析查询异常");
|
|
LOGGER.Error(ex, "门店盘点分析查询异常");
|
|
}
|
|
}
|
|
|
|
private void BtnBack(object sender, EventArgs e)
|
|
{
|
|
//先关闭父窗体
|
|
if (this.Owner != null)
|
|
{
|
|
this.Owner.Close();
|
|
}
|
|
//再关闭当前窗体
|
|
this.Close();
|
|
}
|
|
|
|
private void OnTxtNoCustomClick(object sender, EventArgs e)
|
|
{
|
|
var obj = sender as NormalTextBox;
|
|
var txtForm = new TxtKeyboardForm(StringUtils.GetString(obj.Text));
|
|
txtForm.NotifyChanged += (o, args) =>
|
|
{
|
|
obj.Text = args.Data.ToString();
|
|
};
|
|
var trans = new TransparentForm(this, .5, txtForm);
|
|
trans.Show(this);
|
|
}
|
|
|
|
private void OnTxtMemoCustomClick(object sender, EventArgs e)
|
|
{
|
|
var obj = sender as NormalTextBox;
|
|
var txtForm = new TxtKeyboardForm(StringUtils.GetString(obj.Text));
|
|
txtForm.NotifyChanged += (o, args) =>
|
|
{
|
|
obj.Text = args.Data.ToString();
|
|
};
|
|
var trans = new TransparentForm(this, .5, txtForm);
|
|
trans.Show(this);
|
|
}
|
|
|
|
private void OnDataBindingComplete(object sender, DevComponents.DotNetBar.SuperGrid.GridDataBindingCompleteEventArgs e)
|
|
{
|
|
var rows = e.GridPanel.Rows;
|
|
foreach (GridRow row in rows)
|
|
{
|
|
row.Cells["sysPrice"].Value = StringUtils.FormatDataTwoDigit(Convert.ToDecimal(row.Cells["sysPrice"].Value));
|
|
row.Cells["sysAmount"].Value = StringUtils.FormatDataTwoDigit(Convert.ToDecimal(row.Cells["sysAmount"].Value));
|
|
row.Cells["checkAmount"].Value = StringUtils.FormatDataTwoDigit(Convert.ToDecimal(row.Cells["checkAmount"].Value));
|
|
row.Cells["differenceAmount"].Value = StringUtils.FormatDataTwoDigit(Convert.ToDecimal(row.Cells["differenceAmount"].Value));
|
|
row.Cells["sysMoney"].Value = StringUtils.FormatDataTwoDigit(Convert.ToDecimal(row.Cells["sysMoney"].Value));
|
|
row.Cells["checkMoney"].Value = StringUtils.FormatDataTwoDigit(Convert.ToDecimal(row.Cells["checkMoney"].Value));
|
|
row.Cells["differenceMoney"].Value = StringUtils.FormatDataTwoDigit(Convert.ToDecimal(row.Cells["differenceMoney"].Value));
|
|
}
|
|
}
|
|
|
|
private void OnMinimizedClick(object sender, EventArgs e)
|
|
{
|
|
this.WindowState = FormWindowState.Minimized;
|
|
}
|
|
}
|
|
}
|