using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Windows.Forms;
|
using Pub_Class;
|
|
namespace SCM
|
{
|
public partial class Sc_PackUnionBillList : Form
|
{
|
public Sc_PackUnionBillList()
|
{
|
InitializeComponent();
|
}
|
public string ViewName = "h_v_ProductionLinePackagingList";
|
public string ModCaption = "生产包装单列表";
|
public const string ModRightName = "Sc_PackUnionBillList";
|
public string HSourceBillType = "";
|
SCM.WMSWeb.WebService1 oWeb = new SCM.WMSWeb.WebService1();
|
|
private void initGrid()
|
{
|
ClsPub1.initGridList(grdMain, this.Name);
|
grdMain.RowTemplate.Height = 60;//行高
|
grdMain.ColumnHeadersHeight = 60;//设置表头行高
|
grdMain.RowHeadersWidth = 260;
|
grdMain.RowsDefaultCellStyle.Font = new Font("宋体", 22);
|
grdMain.ReadOnly = true;
|
}
|
|
private void timer1_Tick(object sender, EventArgs e)
|
{
|
timer1.Enabled = false;
|
initGrid();
|
Display();
|
}
|
|
private void Sc_PackUnionBillList_Load(object sender, EventArgs e)
|
{
|
//设置动态URL
|
oWeb.Url = SCM.ClsPub1.WEBSURL;
|
//
|
//frmCondition = new frmBillQueryCondition_Base();
|
this.Text = ModCaption;
|
//lblCaption.Text = ModCaption;
|
//oSumGrid.ogrdMain = grdMain; //初始化 new
|
//oSumGrid.oGridsum = grdSum;
|
initGrid();
|
}
|
|
|
private void timer2_Tick(object sender, EventArgs e)
|
{
|
timer2.Enabled = false;
|
//cmbHSourceBillType.Text = HSourceBillType;
|
//txtHSourceBillNo.Focus();
|
//txtHSourceBillNo.SelectAll();
|
}
|
|
private void grdMain_Paint(object sender, PaintEventArgs e)
|
{
|
GraphicsGrid();
|
}
|
|
private void GraphicsGrid()
|
{
|
//画底线
|
DBUtility.Xt_BaseBillFun.GraphicsGrid(grdMain);
|
//画横线
|
//DBUtility.Xt_BaseBillFun.GraphicsRowGrid(grdMain, iTopRow, iTopRow + 50, Fun_GetCol("hmainid"));
|
}
|
|
private Int32 Fun_GetCol(string sCol)
|
{
|
return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdMain);
|
}
|
|
//保存列宽
|
private void bclk_Click(object sender, EventArgs e)
|
{
|
DBUtility.Xt_BaseBillFun.SaveGrid(grdMain, this.Name);
|
}
|
|
//默认列宽
|
private void mrlk_Click(object sender, EventArgs e)
|
{
|
DBUtility.Xt_BaseBillFun.DefaultGridView(grdMain, this.Name);
|
}
|
|
|
|
|
private void Display()
|
{
|
string sql = " where 1 = 1 ";
|
if (txtHSourceBillNo.Text.Trim() != "")
|
{
|
sql += " and 唯一条码 like '%" + txtHSourceBillNo.Text.Trim() + "%'";
|
}
|
if (txtHBarCode.Text.Trim() != "")
|
{
|
sql += " and 条码 like '%" + txtHBarCode.Text.Trim() + "%'";
|
}
|
//得到信息
|
string sql2 = "select * from " + ViewName + sql;/*+" order by 唯一条码 desc";*/
|
DataSet DS = oWeb.getDataSetBySQL(sql2, ViewName, ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DS==null || DS.Tables[0].Rows.Count == 0)
|
{
|
MessageBox.Show("没有找到相关源单信息!" + DBUtility.ClsPub.sExeReturnInfo);
|
return;
|
}
|
grdMain.DataSource = DS.Tables[0].DefaultView;
|
|
|
DBUtility.Xt_BaseBillFun.GetGrid(grdMain, this.Name);
|
int FrCol =0;
|
string s = "是";
|
ClsPub1.DisplayGrid(grdMain, this.Name, s, FrCol);
|
}
|
|
|
|
|
|
//双击列表
|
private void grdMain_DoubleClick(object sender, EventArgs e)
|
{
|
|
}
|
|
|
private void txtHSourceBillNo_TextChanged(object sender, EventArgs e)
|
{
|
|
}
|
|
private void Tool_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
|
{
|
|
}
|
|
private void btnOK_Click(object sender, EventArgs e)
|
{
|
Display();
|
}
|
|
private void btnTC_Click(object sender, EventArgs e)
|
{
|
this.Close();
|
}
|
|
private void cmbHSourceBillType_SelectedIndexChanged(object sender, EventArgs e)
|
{
|
|
}
|
|
//删除按钮
|
private void button1_Click(object sender, EventArgs e)
|
{
|
Sub_DeleteBill();
|
}
|
|
//删除
|
private void Sub_DeleteBill()
|
{
|
|
try
|
{
|
if (AllowRow())
|
{
|
if (MessageBox.Show("确定要删除当前项目?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
|
{
|
//得到HInterID
|
//long sHInterID;
|
//sHInterID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentCell.RowIndex].Cells[Fun_GetCol("hmainid")].Value);
|
//MessageBox.Show("id" + DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentCell.RowIndex].Cells[Fun_GetCol("HIntterID")].Value));
|
MessageBox.Show("单据号:" + DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.CurrentCell.RowIndex].Cells[Fun_GetCol("HInterID")].Value) + " 删除成功!(实际未成功,功能开发中。。。)", "提示");
|
|
//oWeb.getRunProc("Delete from Xs_SeOutStockBackBillMain where HInterID=" + sHInterID, ref DBUtility.ClsPub.sExeReturnInfo);
|
//oWeb.getRunProc("Delete from Xs_SeOutStockBackBillSub where HInterID=" + sHInterID, ref DBUtility.ClsPub.sExeReturnInfo);
|
//oWeb.getRunProc("insert into System_log values(GETDATE(),'" + DBUtility.ClsPub.CurUserName + "','" + DBUtility.ClsPub.CurUserName + "','删除单据:" + DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.CurrentCell.RowIndex].Cells[Fun_GetCol("单据号")].Value) + "' ,'退货通知单列表','','删除')", ref DBUtility.ClsPub.sExeReturnInfo);
|
}
|
}
|
//MessageBox.Show("单据号:" + DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentCell.RowIndex].Cells[Fun_GetCol("HInterID")].Value) + " 删除成功!", "提示");
|
//MessageBox.Show("id" + DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.CurrentCell.RowIndex].Cells[Fun_GetCol("HIntterID")].Value));
|
|
Display();
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
//选中行是否正常
|
private bool AllowRow()
|
{
|
if (grdMain.CurrentRow == null)
|
{
|
return false;
|
}
|
if (grdMain.CurrentRow.Index >= 0 && grdMain.CurrentRow.Index <= grdMain.RowCount - 1)
|
{
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
|
}
|
}
|