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 LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm
{
public partial class ProcessExtensionSetSuperSmallForm : LYFZ.Software.UI.CameraControlBook.SuperSmallForm.ProcessExtensionSetSuperSmallForm
{
public ProcessExtensionSetSuperSmallForm()
{
}
///
/// 主订单号
///
public string StrNumber = "";
///
/// 副订单号
///
public string StrViceNumber = "";
///
/// 延期类型
/// 1.拍照
/// 2.拍完
/// 3.选片
/// 4.看样
/// 5.齐件
/// 6.取件
///
public string StrType = "";
public bool IsSaveed = false;
LYFZ.Model.Model_ErpOrderProcessMonitor modelpm = null;
LYFZ.BLL.BLL_ErpOrderProcessMonitor ordpmbll = new BLL.BLL_ErpOrderProcessMonitor();
///
/// 窗体加载事件
///
///
///
protected override void ProcessExtensionSetSuperSmallForm_Shown(object sender, EventArgs e)
{
this.Text = this.StrType;
List mlist = ordpmbll.GetModelList("Ordpm_Number = '" + this.StrNumber + "' and Ordpm_ViceNumber = '" + this.StrViceNumber + "' and Ordpm_ProcessType = '" + this.StrType + "'");
if (mlist.Count <= 0)
{ return; }
modelpm = mlist[0];
if (modelpm.ID <= 0)
{ return; }
this.txtODays.Text = modelpm.Ordpm_ProcessDays.ToString().Trim();
this.txtODate.Text = modelpm.Ordpm_ProcessDate.ToString("yyyy-MM-dd");
this.txtORemark.Text = modelpm.Ordpm_ProcessRemark.Trim();
this.Height = 610;
}
///
/// 天数输入限制
///
///
///
protected override void txtDays_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
{ e.Handled = true; }
}
///
/// 天数回车
///
///
///
protected override void txtDays_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{ GetDateDays(); }
}
void GetDateDays()
{
DateTime StrTime = SDateTime.Now;
DateTime strDateTime = StrTime.AddDays(Convert.ToInt32(this.txtDays.Text)).AddSeconds(-1);
this.txtDate.Text = strDateTime.ToString("yyyy-MM-dd");
this.txtDate.Tag = strDateTime;
}
///
/// 天数离开事件
///
///
///
protected override void txtDays_Leave(object sender, EventArgs e)
{
if (this.txtDays.Text.Trim() != "")
{ GetDateDays(); }
else { this.txtDate.Text = ""; }
}
///
/// 确定
///
///
///
protected override void btnOk_Click(object sender, EventArgs e)
{
if (this.txtDays.Text.Trim() == "")
{ MessageBoxCustom.Show("延期天数不能为空!"); return; }
if (this.txtRemark.Text.Trim() == "")
{ MessageBoxCustom.Show("延期原因不能为空!"); return; }
DateTime strTime = SDateTime.Now;
string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
if (modelpm != null)
{
modelpm.Ordpm_ProcessLOG = modelpm.Ordpm_ProcessLOG + "Ordpm_ProcessDays:≡" + modelpm.Ordpm_ProcessDays + "§Ordpm_ProcessDays≡" + modelpm.Ordpm_ProcessDays + "§Ordpm_ProcessDate≡" + modelpm.Ordpm_ProcessDate + "§Ordpm_ProcessRemark≡" + modelpm.Ordpm_ProcessRemark + "§Ordpm_UpdateDateTime≡" + modelpm.Ordpm_UpdateDateTime + "§Ordpm_UpdateName≡" + modelpm.Ordpm_UpdateName + "‖";
modelpm.Ordpm_ProcessDays = Convert.ToInt32(this.txtDays.Text);
modelpm.Ordpm_ProcessDate = Convert.ToDateTime(this.txtDate.Tag.ToString());
modelpm.Ordpm_ProcessRemark = modelpm.Ordpm_ProcessRemark + "\r\n" + this.txtRemark.Text.Trim();
modelpm.Ordpm_UpdateDateTime = strTime;
modelpm.Ordpm_UpdateName = strUserID;
if (!ordpmbll.Update(modelpm))
{ MessageBoxCustom.Show("保存失败"); return; }
}
else
{
modelpm = new Model.Model_ErpOrderProcessMonitor();
modelpm.Ordpm_Number = this.StrNumber;
modelpm.Ordpm_ViceNumber = this.StrViceNumber;
modelpm.Ordpm_ProcessType = this.StrType;
modelpm.Ordpm_ProcessDays = Convert.ToInt32(this.txtDays.Text);
modelpm.Ordpm_ProcessDate = Convert.ToDateTime(this.txtDate.Tag.ToString());
modelpm.Ordpm_ProcessRemark = this.txtRemark.Text.Trim();
modelpm.Ordpm_ProcessLOG = "";
modelpm.Ordpm_CreateDateTime = strTime;
modelpm.Ordpm_CreateName = strUserID;
modelpm.Ordpm_UpdateDateTime = strTime;
modelpm.Ordpm_UpdateName = strUserID;
if (!ordpmbll.Add(modelpm))
{ MessageBoxCustom.Show("保存失败"); return; }
}
this.IsSaveed = true;
MessageBoxCustom.Show("保存成功!");
this.Close();
}
///
/// 取消
///
///
///
protected override void btnCancel_Click(object sender, EventArgs e)
{ this.Close(); }
}
}