using ButcherFactory.BO;
|
|
using ButcherFactory.BO.LocalBL;
|
|
using ButcherFactory.BO.Utils;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using WinFormControl;
|
|
|
|
namespace ButcherFactory.Dialogs
|
|
{
|
|
public partial class AddWeightRecord : Form
|
|
{
|
|
SaleOutStore_Detail mDetail;
|
|
long? mBatchID = null;
|
|
DateTime? mProductTime;
|
|
public AddWeightRecord(SaleOutStore_Detail detail,long? batchID,DateTime? productTime)
|
|
{
|
|
InitializeComponent();
|
|
mDetail = detail;
|
|
mBatchID = batchID;
|
|
numberInput.Text = "1";
|
|
goodsLabel.Text = mDetail.Goods_Name;
|
|
mProductTime = productTime;
|
|
}
|
|
|
|
private void okBtn_Click(object sender, EventArgs e)
|
|
{
|
|
decimal weight = 0;
|
|
if (!decimal.TryParse(weightInput.Text, out weight))
|
|
throw new Exception("请输入重量");
|
|
decimal number = 0;
|
|
if (!decimal.TryParse(numberInput.Text, out number))
|
|
throw new Exception("请输入数量");
|
|
if (number < 0)
|
|
throw new Exception("数量不能为负");
|
|
var record = new CarcassSaleOut_Detail();
|
|
record.BillID = mDetail.SaleOutStore_ID;
|
|
record.DetailID = mDetail.ID;
|
|
record.Filled = true;
|
|
record.ProductBatch_ID = mBatchID;
|
|
record.Goods_Code = mDetail.Goods_Code;
|
|
record.Goods_ID = mDetail.Goods_ID;
|
|
record.Goods_Name = mDetail.Goods_Name;
|
|
record.Number = number;
|
|
record.Weight = weight;
|
|
record.Operator = AppContext.Worker.Name;
|
|
var flag = mDetail.Goods_ID == 7318 ? -1 : 0; //套猪袋
|
|
CarcassSaleOutBL.AddAndUpdate(record, flag, mProductTime);
|
|
DialogResult = DialogResult.OK;
|
|
}
|
|
|
|
private void cancelBtn_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void helfBtn_Click(object sender, EventArgs e)
|
|
{
|
|
numberInput.Text = "0.5";
|
|
}
|
|
|
|
private void fullBtn_Click(object sender, EventArgs e)
|
|
{
|
|
numberInput.Text = "1";
|
|
}
|
|
|
|
private void weightInput_Click(object sender, EventArgs e)
|
|
{
|
|
var keyBoard = new NumberPad();
|
|
if (keyBoard.ShowDialog() == true)
|
|
(sender as TextBox).Text = keyBoard.Result;
|
|
}
|
|
}
|
|
}
|