|
|
|
|
using DevComponents.DotNetBar.SuperGrid;
|
|
|
|
|
using POSV.Card;
|
|
|
|
|
using POSV.Component;
|
|
|
|
|
using POSV.Utils;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace POSV.Stock
|
|
|
|
|
{
|
|
|
|
|
public partial class CostControlListForm : BusinessForm
|
|
|
|
|
{
|
|
|
|
|
public int Status = 0;//状态
|
|
|
|
|
public string No = null;//单号
|
|
|
|
|
public string TicketId = null;//选中的单据ID
|
|
|
|
|
public string TicktStatus = null;//选中的单据状态
|
|
|
|
|
|
|
|
|
|
public CostControlListForm()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
this.controlBox1.Text = "经营会计报表";
|
|
|
|
|
this.controlBox1.ShowApplicationVersion = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnLoad(e);
|
|
|
|
|
|
|
|
|
|
if (this.DesignMode) return;
|
|
|
|
|
//默认设置一周的查询时间
|
|
|
|
|
this.startPicker.Value = Convert.ToDateTime(DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd 00:00:00"));
|
|
|
|
|
this.endPicker.Value = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
|
|
|
|
|
radioButton2.Checked = true;
|
|
|
|
|
this.Focus();
|
|
|
|
|
this.noTextBox.Focus();
|
|
|
|
|
this.noTextBox.SelectAll();
|
|
|
|
|
this.ActiveControl = this.noTextBox;
|
|
|
|
|
//获得当前页
|
|
|
|
|
int cur = pagerControl1.CurrentPage;
|
|
|
|
|
//获得每页显示的记录数
|
|
|
|
|
int rows = pagerControl1.RowsPerPage;
|
|
|
|
|
|
|
|
|
|
CostControlListQuery(cur, rows);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void CostControlListQuery(int PageNum, int pageSize)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var request = new StoreCostTicketRequest();
|
|
|
|
|
request.StoreId = Global.Instance.Authc.StoreId;
|
|
|
|
|
request.No = this.noTextBox.Text;
|
|
|
|
|
request.PageNumber = PageNum;
|
|
|
|
|
request.PageSize = pageSize;
|
|
|
|
|
request.Status = Status;
|
|
|
|
|
request.StartTime = this.startPicker.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
request.EndTime = this.endPicker.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
|
|
|
|
var response = StockUtils.StoreCostTicket(request);
|
|
|
|
|
|
|
|
|
|
//成功
|
|
|
|
|
if (response.Item1)
|
|
|
|
|
{
|
|
|
|
|
List<StoreCostTicketResponse> storeCostTicketResponse = response.Item3.List;
|
|
|
|
|
foreach (StoreCostTicketResponse ticketResponse in storeCostTicketResponse)
|
|
|
|
|
{
|
|
|
|
|
switch (ticketResponse.Status)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
ticketResponse.StatusName = "待审核";
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
ticketResponse.StatusName = "已审核";
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
ticketResponse.StatusName = "已作废";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ticketResponse.StatusName = "其他";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.pagerControl1.TotalPage = response.Item3.PageCount;
|
|
|
|
|
this.pagerControl1.CurrentPage = response.Item3.PageNumber;
|
|
|
|
|
this.pagerControl1.RecordCount = response.Item3.TotalCount;
|
|
|
|
|
this.pagerControl1.RowsPerPage = response.Item3.PageSize;
|
|
|
|
|
ticketListTable.PrimaryGrid.DataSource = storeCostTicketResponse;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
List<AskgoodsTicketResponse> list = new List<AskgoodsTicketResponse>();
|
|
|
|
|
ticketListTable.PrimaryGrid.DataSource = list;
|
|
|
|
|
this.ShowToastNotify(this, response.Item2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
this.ShowToastNotify(this, "经营会计报表查询异常");
|
|
|
|
|
LOGGER.Error(ex, "经营会计报表查询异常");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Form_OnTicktQuery(object sender)
|
|
|
|
|
{
|
|
|
|
|
//获得当前页
|
|
|
|
|
int cur = pagerControl1.CurrentPage;
|
|
|
|
|
//获得每页显示的记录数
|
|
|
|
|
int rows = pagerControl1.RowsPerPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 添加
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void BtnAdd(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var addForm = new CostControlForm();
|
|
|
|
|
addForm.OnTicktQuery += Form_OnTicktQuery;
|
|
|
|
|
TransparentForm trans = new TransparentForm(this, addForm);
|
|
|
|
|
trans.Show(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 修改
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void BtnEdit(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 审核
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void BtnApply(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (!"待审核".Equals(TicktStatus))
|
|
|
|
|
{
|
|
|
|
|
this.ShowToastNotify(this, "只有[待审核]的要货单才能审核");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
StoreCostTicketUpdateStatusRequest request = new StoreCostTicketUpdateStatusRequest();
|
|
|
|
|
request.StoreId = Global.Instance.BusinessPlanLog.StoreId;
|
|
|
|
|
request.TicketId = this.TicketId;
|
|
|
|
|
request.Type = 1;
|
|
|
|
|
request.Operator = Global.Instance.BusinessPlanLog.WorkerNo;
|
|
|
|
|
var response = StockUtils.StoreCostTicketUpdateStatus(request);
|
|
|
|
|
//成功
|
|
|
|
|
if (response.Item1)
|
|
|
|
|
{
|
|
|
|
|
//获得当前页
|
|
|
|
|
int cur = pagerControl1.CurrentPage;
|
|
|
|
|
//获得每页显示的记录数
|
|
|
|
|
int rows = pagerControl1.RowsPerPage;
|
|
|
|
|
|
|
|
|
|
CostControlListQuery(cur, rows);
|
|
|
|
|
|
|
|
|
|
this.ShowToastNotify(this, response.Item2);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.ShowToastNotify(this, response.Item2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
this.ShowToastNotify(this, "经营会计报表审核异常");
|
|
|
|
|
|
|
|
|
|
LOGGER.Error(ex, "经营会计报表审核异常");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 取消
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void BtnCancel(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (!"待审核".Equals(TicktStatus))
|
|
|
|
|
{
|
|
|
|
|
this.ShowToastNotify(this, "只有[待审核]的要货单才能作废");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
StoreCostTicketUpdateStatusRequest request = new StoreCostTicketUpdateStatusRequest();
|
|
|
|
|
request.StoreId = Global.Instance.BusinessPlanLog.StoreId;
|
|
|
|
|
request.TicketId = this.TicketId;
|
|
|
|
|
request.Type = 2;
|
|
|
|
|
request.Operator = Global.Instance.BusinessPlanLog.WorkerNo;
|
|
|
|
|
var response = StockUtils.StoreCostTicketUpdateStatus(request);
|
|
|
|
|
//成功
|
|
|
|
|
if (response.Item1)
|
|
|
|
|
{
|
|
|
|
|
//获得当前页
|
|
|
|
|
int cur = pagerControl1.CurrentPage;
|
|
|
|
|
//获得每页显示的记录数
|
|
|
|
|
int rows = pagerControl1.RowsPerPage;
|
|
|
|
|
|
|
|
|
|
CostControlListQuery(cur, rows);
|
|
|
|
|
|
|
|
|
|
this.ShowToastNotify(this, response.Item2);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.ShowToastNotify(this, response.Item2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
this.ShowToastNotify(this, "经营会计报表作废异常");
|
|
|
|
|
|
|
|
|
|
LOGGER.Error(ex, "经营会计报表作废异常");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void BtnQuery(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
//获得当前页
|
|
|
|
|
int cur = pagerControl1.CurrentPage;
|
|
|
|
|
//获得每页显示的记录数
|
|
|
|
|
int rows = pagerControl1.RowsPerPage;
|
|
|
|
|
|
|
|
|
|
CostControlListQuery(cur, rows);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 退出
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void BtnExit(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
//先关闭父窗体
|
|
|
|
|
if (this.Owner != null)
|
|
|
|
|
{
|
|
|
|
|
this.Owner.Close();
|
|
|
|
|
}
|
|
|
|
|
//再关闭当前窗体
|
|
|
|
|
this.Close();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnControlBoxKeyboardClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
KeyboardType keyboardType = KeyboardType.数字;
|
|
|
|
|
Type type = this.ActiveControl.GetType();
|
|
|
|
|
PropertyInfo pinfo = type.GetProperty("Keyboard");
|
|
|
|
|
if (pinfo != null)
|
|
|
|
|
{
|
|
|
|
|
keyboardType = (KeyboardType)pinfo.GetValue(this.ActiveControl, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var keyboard = Application.OpenForms["VirtualKeyboard"];
|
|
|
|
|
if (keyboard == null)
|
|
|
|
|
{
|
|
|
|
|
keyboard = new VirtualKeyboard(keyboardType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
((VirtualKeyboard)keyboard).ShowVirtualKeyboard(this, keyboardType);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LOGGER.Error(ex, "打开屏幕键盘异常");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnCloseTouchClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
//先关闭父窗体
|
|
|
|
|
if (this.Owner != null)
|
|
|
|
|
{
|
|
|
|
|
this.Owner.Close();
|
|
|
|
|
}
|
|
|
|
|
//再关闭当前窗体
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnQueryPageChangeWithObject(object obj)
|
|
|
|
|
{
|
|
|
|
|
//获得当前页
|
|
|
|
|
int cur = pagerControl1.CurrentPage;
|
|
|
|
|
//获得每页显示的记录数
|
|
|
|
|
int rows = pagerControl1.RowsPerPage;
|
|
|
|
|
|
|
|
|
|
PagerControl pager = obj as PagerControl;
|
|
|
|
|
if (pager != null)
|
|
|
|
|
{
|
|
|
|
|
CostControlListQuery(cur, rows);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 选择
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void OnTicketRowActivated(object sender, DevComponents.DotNetBar.SuperGrid.GridRowActivatedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
GridPanel grid = e.GridPanel;
|
|
|
|
|
if (e.NewActiveRow != null)
|
|
|
|
|
{
|
|
|
|
|
//先清除其他表数据
|
|
|
|
|
GridRow row = e.NewActiveRow as GridRow;
|
|
|
|
|
grid.SetSelected(e.NewActiveRow, false);
|
|
|
|
|
grid.SetActiveRow(e.NewActiveRow);
|
|
|
|
|
var ticketId = StringUtils.GetString(row.Cells["id"].Value);
|
|
|
|
|
var statusName = StringUtils.GetString(row.Cells["statusName"].Value);
|
|
|
|
|
var ticketNo = StringUtils.GetString(row.Cells["no"].Value);
|
|
|
|
|
this.TicketId = ticketId;
|
|
|
|
|
this.No = ticketNo;
|
|
|
|
|
this.TicktStatus = statusName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 双击
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void OnTicketDoubleClick(object sender, DevComponents.DotNetBar.SuperGrid.GridRowDoubleClickEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if ("待审核".Equals(TicktStatus))
|
|
|
|
|
{
|
|
|
|
|
//var editForm = new AskGoodsEditForm(response, detailList);
|
|
|
|
|
//editForm.OnTicktQuery += Form_OnTicktQuery;
|
|
|
|
|
//TransparentForm trans = new TransparentForm(this, editForm);
|
|
|
|
|
//trans.Show(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|