### MyHouse V1.0.2502.0801 - *.[新增]适配新版接口。 ### SmartHouseAPI V1.0.2502.0801 - *.[新增]支持Docker部署,支持NAS。
93 lines
2.9 KiB
C#
93 lines
2.9 KiB
C#
using ryCommon;
|
|
using ryCommonDb;
|
|
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 MyHouse.DbOp
|
|
{
|
|
public partial class FrmGoodsEntry : RySkins.SKinForm
|
|
{
|
|
public ModalForm mr = null;
|
|
public string tableName = "Goods";
|
|
/// <summary>
|
|
/// true为入库,false为出库
|
|
/// </summary>
|
|
public bool IsAdd { get; set; } = true;
|
|
public string selectId = "-1";
|
|
public FrmGoodsEntry()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
#region 需要修改
|
|
public void GetInfo(string id)
|
|
{
|
|
selectId = id;
|
|
string post_str = "api=GetGoods&id=" + id;
|
|
var jsonResult = API.API.Post("Goods", "GetGoods", post_str);
|
|
if (jsonResult.IsOK)
|
|
{
|
|
DataTable data = jsonResult.List;
|
|
if (data.Rows.Count > 0)
|
|
{
|
|
DataRow reader = data.Rows[0];
|
|
TxtGoodsSN.Text = reader["SN"].ToString();
|
|
txtName.Text = reader["Name"].ToString();
|
|
TxtUnit.Text = reader["Unit"].ToString();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void BtnOK_Click(object sender, EventArgs e)
|
|
{
|
|
var count = NumCount.Value;
|
|
if (!IsAdd) { count = -count; }
|
|
if (count == 0)
|
|
{
|
|
MessageBox.Show("数量不能为0。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
return;
|
|
}
|
|
string post_str = "api=Entry&sn=" + RyWeb.WebDecode.UrlEncode(TxtGoodsSN.Text)+ "&Count="+NumCount.Value+ "&Des=" + RyWeb.WebDecode.UrlEncode(TxtDes.Text);
|
|
var jsonResult = API.API.Post("Goods", "Entry", post_str);
|
|
if (jsonResult.IsOK)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show(jsonResult.ResultText, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
}
|
|
ModalForm.SetDialogResult(this, mr, DialogResult.OK);
|
|
}
|
|
#endregion
|
|
|
|
private void BtnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
ModalForm.SetDialogResult(this, mr, DialogResult.Cancel);
|
|
}
|
|
|
|
private void FrmAdd_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void NumCount_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (IsAdd)
|
|
{
|
|
LblState.Text = "增加了 " + NumCount.Value + " " + TxtUnit.Text;
|
|
LblState.ForeColor = Color.Blue;
|
|
}
|
|
else
|
|
{
|
|
LblState.Text = "减少了 " + NumCount.Value + " " + TxtUnit.Text;
|
|
LblState.ForeColor = Color.Red;
|
|
}
|
|
}
|
|
}
|
|
}
|