混乱的代码
来源:互联网 发布:广州天翼模型店 淘宝 编辑:程序博客网 时间:2024/04/29 05:00
Columns[i].Name
//#region 查询出货主货物能修改的列
/// <summary>
/// 查询出货主货物能修改的列
/// </summary>
/// <param name="CompanyId"></param>
bool ControlVisibleColumns(int CompanyId)
{
VisibleAllColumn();
try
{
IRemotingWMS_GoodsInfo IWMS_GoodsInfo = (IRemotingWMS_GoodsInfo)RemotingObject.GetRemotingObject(typeof(IRemotingWMS_GoodsInfo), "WMS_GoodsInfo");
ZJS_WMSDataSet ds8 = (ZJS_WMSDataSet)IWMS_GoodsInfo.Get_GoodsColumnIsNotUpdate(CompanyId, userinfo.validateGuid);
if (ds8.WMS_ClientCompanyIni.Rows.Count > 0)
{
foreach (DataRow dr in ds8.WMS_ClientCompanyIni.Rows)
//for (int i = 0; i < ds8.WMS_ClientCompanyIni.Rows.Count; i++)
{
myDataGridView1.Columns[dr["GoodsColumnCode"].ToString().Trim()].ReadOnly = true;
if (Convert.ToInt32(dr["UseState"].ToString().Trim()) == 1 || Convert.ToInt32(dr["IsInPut"].ToString().Trim()) == 1)
{
myDataGridView1.Columns[dr["GoodsColumnCode"].ToString().Trim()].HeaderText = dr["ColumnName"].ToString().Trim();
myDataGridView1.Columns[dr["GoodsColumnCode"].ToString().Trim()].Visible = true;
myDataGridView1.Columns[dr["GoodsColumnCode"].ToString().Trim()].ReadOnly = true;
}
}
}
else
{
return false;
}
}
catch (Exception ex)
{
MessageBox.Show(WrongMessage.GetWrongMessage(ex.Message), "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
if (myDataGridView1.RowCount > 0)
{
DataTable dt = new DataTable();
myDataGridView1.DataSource = dt;
}
return false;
}
return true;
}
//#endregion
private void DataBindDataGrid( int PageNo)
{
int iRecordCount = 0;
int iPageCount = 0;
DataTable dt = ModuleHelper.GetSearchDataTable("Explanation_VWRecommendation","orders","","",this.AspNetPager1.PageSize,PageNo,1,out iPageCount,out iRecordCount);
dgCommend.DataKeyField = "id";
dgCommend.DataSource = dt.DefaultView;
this.AspNetPager1.RecordCount=iRecordCount;
this.AspNetPager1.CurrentPageIndex=PageNo;
if(iPageCount<PageNo)
{
PageNo=iPageCount;
DataBindDataGrid(PageNo);
}
dgCommend.DataBind();
foreach(DataGridItem d in this.dgCommend.Items)
{
if(d.ItemIndex == 0 && this.AspNetPager1.CurrentPageIndex==1)
{
LinkButton lnkbtnUp = (LinkButton)this.dgCommend.Items[d.ItemIndex].Cells[6].FindControl("lnkbtnUp");
lnkbtnUp.Enabled = false;
LinkButton lnkbtnTop = (LinkButton)this.dgCommend.Items[d.ItemIndex].Cells[6].FindControl("lnkbtnTop");
lnkbtnTop.Enabled = false;
}
else if(d.ItemIndex == this.dgCommend.Items.Count-1 && this.AspNetPager1.CurrentPageIndex == this.AspNetPager1.PageCount)
{
LinkButton lnkbtnDown = (LinkButton)this.dgCommend.Items[d.ItemIndex].Cells[6].FindControl("lnkbtnDown");
lnkbtnDown.Enabled = false;
LinkButton lnkbtnLast = (LinkButton)this.dgCommend.Items[d.ItemIndex].Cells[6].FindControl("lnkbtnLast");
lnkbtnLast.Enabled = false;
}
}
AspNetPager1.CustomInfoText ="记录总数:<font color=/"blue/"><b>"+AspNetPager1.RecordCount.ToString()+"</b>";
AspNetPager1.CustomInfoText += " 总页数:<font color=/"blue/"><b>"+AspNetPager1.PageCount.ToString()+"</b>";
AspNetPager1.CustomInfoText += " 当前页:<font color=/"red/"><b>"+PageNo.ToString()+"</b>";
}
/// <summary>
/// Retrieves the set of SqlParameters appropriate for the stored procedure
/// </summary>
/// <param name="connection">A valid SqlConnection object</param>
/// <param name="spName">The name of the stored procedure</param>
/// <param name="includeReturnValueParameter">A bool value indicating whether the return value parameter should be included in the results</param>
/// <returns>An array of SqlParameters</returns>
public static SqlParameter[] GetSpParameterSetInternal(SqlConnection connection, string spName, bool includeReturnValueParameter)
{
if (connection == null) throw new ArgumentNullException("connection");
if (spName == null || spName.Length == 0) throw new ArgumentNullException("spName");
string hashKey = connection.ConnectionString + ":" + spName + (includeReturnValueParameter ? ":include ReturnValue Parameter" : "");
SqlParameter[] cachedParameters;
cachedParameters = paramCache[hashKey] as SqlParameter[];
if (cachedParameters == null)
{
SqlParameter[] spParameters = DiscoverSpParameterSet(connection, spName, includeReturnValueParameter);
paramCache[hashKey] = spParameters;
cachedParameters = spParameters;
}
return CloneParameters(cachedParameters);
}
/// <summary>
/// 根据验证得到用户Id
/// </summary>
/// <param name="ValidateGuid">验证Guid</param>
/// <returns>用户Id</returns>
public static string GetUserIdFormGuid(Guid ValidateGuid)
{
string sqlstr = "select EmployeeCode from PUB_EmployeePopedomConnection where ValidateGuid=@ValidateGuid ";
SqlParameter[] sqlpar = new SqlParameter[1];
sqlpar[0] = new SqlParameter("@ValidateGuid", ValidateGuid);
return (string )SqlExec.ExecuteScalar(SystemType.PUB, CommandType.Text, sqlstr, sqlpar);
}
/// <summary>
/// 验证guid
/// </summary>
/// <param name="ValidateGuid"> 验证guid</param>
/// <returns> 用户id ,空时验证失败</returns>
public static string Validate(Guid ValidateGuid)
{
//验证码为空
if (ValidateGuid ==Guid.Empty )
{
return string.Empty; ;
}
else
{
//先在Cache中查找
UserCache usercache = UserCache.getusercache();
if (usercache.IsExist(ValidateGuid))
{
return usercache.GetUserId(ValidateGuid) ;
}
else
{
//到数据库中查找
string userid;
userid = PUB_Employee.GetUserIdFormGuid(ValidateGuid);
if (ZJS.Tool.PublicStringTool.IsEmpty(userid))
{
//未找到
ExceptionManage ex = new ExceptionManage();
ex.ThrowException(102,SystemType.PUB );
return string.Empty ;
}
//找到,加入到缓存
else
{
usercache.Add(userid,ValidateGuid );
return userid;
}
}
}
}
//#region 根据货物编号和货主名称判断该货主存在不存在
/// <summary>
/// 根据货物编号和货主名称判断该货主存在不存在
/// </summary>
/// <param name="CompanyCode">货主代码</param>
/// <param name="CompanyName">货主名称</param>
/// <param name="ValidateGuid">验证码</param>
/// <returns>返回true为存在 false为不存在</returns>
public bool validateClientCompany(string CompanyCode, string CompanyName, Guid ValidateGuid)
{
string yzuserid = ValidateCode.Validate(ValidateGuid);
if (!PublicStringTool.IsEmpty(yzuserid))
{
return WMS_ClientCompany.validateClientCompany(CompanyCode,CompanyName);
}
return false;
}
//#endregion
E:/MyCode/ZJSWMS/DataAccess/WMSDataAccess/WMS_ClientCompany.cs
//#region 根据货物编号和货主名称判断该货主存在不存在
/// <summary>
/// 根据货物编号和货主名称判断该货主存在不存在
/// </summary>
/// <param name="CompanyCode">货主代码</param>
/// <param name="CompanyName">货主名称</param>
/// <returns>返回true为存在 false为不存在</returns>
public static bool validateClientCompany(string CompanyCode, string CompanyName)
{
string sqlstr = "select count(*) from WMS_ClientCompany where CompanyCode=@CompanyCode and CompanyName=@CompanyName and state=0 ";
SqlParameter[] sqlpar = new SqlParameter[2];
sqlpar[0] = new SqlParameter("@CompanyCode", CompanyCode.ToString().Trim());
sqlpar[1] = new SqlParameter("@CompanyName", CompanyName.ToString().Trim());
if ((int)SqlExec.ExecuteScalar(SystemType.WMS, CommandType.Text, sqlstr, sqlpar) > 0)
{
return true;
}
else
{
return false;
}
}
//#endregion
//#region 保存按钮出发事件
private void myButton8_Click(object sender, EventArgs e)
{
//#region 窗体添加入库信息
if (PublicStringTool.IsEmpty( myTextBox1.Text.ToString().Trim()))
{
MessageBox.Show("货主代码不能为空!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
myTextBox1.Focus();
return;
}
if (PublicStringTool.IsEmpty(myTextBox2.Text.ToString().Trim()))
{
MessageBox.Show("货主名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
myTextBox2.Focus();
return;
}
if (PublicStringTool.IsEmpty( myTextBox3.Text.ToString().Trim()))
{
MessageBox.Show("货主订单号不能为空!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
myTextBox3.Focus();
return;
}
//if (PublicStringTool.IsEmpty(myTextBox9.Text.ToString().Trim()))
//{
// MessageBox.Show("入库类型不能为空!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
// myTextBox9.Focus();
// return;
//}
//#region 验证货主信息的一致性
//try
//{
// IInStorage = (IRemotingWMS_InStorage)RemotingObject.GetRemotingObject(typeof(IRemotingWMS_InStorage), "WMS_InStorage");
//IClientCompany = (IRemotingWMS_ClientCompany)RemotingObject.GetRemotingObject(typeof(IRemotingWMS_ClientCompany), "WMS_ClientCompany");
//bool IsExist = (bool)IClientCompany.validateClientCompany(this.myTextBox1.Text.ToString().Trim(), "", userinfo.validateGuid);
//if (IsExist == false)
//{
// MessageBox.Show("货主代码和名称信息不一致,请重新添加货主信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
// myTextBox1.Focus();
// return;
//}
if (CompanyId == 0)
{
MessageBox.Show("请添加正确的货主代码和名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
myTextBox1.Focus();
return;
}
//}
//catch (Exception ex)
//{
// MessageBox.Show(WrongMessage.GetWrongMessage(ex.Message),"警告",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
// return;
//}
//#endregion
if (IStorageDt.Rows.Count == 0)
{
MessageBox.Show("请输入货物明细!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
//#region 验证数据是否为空并提示用户
//#region 检测所填写的货物数量是不是为空
for (int goodsnumber = 0; goodsnumber < IStorageDt.Rows.Count; goodsnumber++)
{
if (PublicStringTool.IsEmpty( IStorageDt.Rows[goodsnumber]["SKU"].ToString().Trim() ))
{
MessageBox.Show("SKU不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (PublicStringTool.IsEmpty( IStorageDt.Rows[goodsnumber]["GoodsName"].ToString().Trim()))
{
MessageBox.Show("货物名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (PublicStringTool.IsEmpty( IStorageDt.Rows[goodsnumber]["Number"].ToString().Trim() ))
{
MessageBox.Show(IStorageDt.Rows[goodsnumber]["GoodsName"].ToString().Trim() + "的数量不能为空,请填写数量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
else
{
try
{
int number= Convert.ToInt32( IStorageDt.Rows[goodsnumber]["Number"].ToString().Trim());
if (number==0)
{
MessageBox.Show("第" + Convert.ToString(goodsnumber + 1) + "行," + IStorageDt.Rows[goodsnumber]["GoodsName"].ToString().Trim() + "的预入数量只能为正整数,请重新写货物数量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (number > 100001)
{
MessageBox.Show("第" + Convert.ToString(goodsnumber + 1) + "行," + IStorageDt.Rows[goodsnumber]["GoodsName"].ToString().Trim() + "的预入数量不能超过100000,请重新写货物数量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
catch
{
MessageBox.Show("第" + Convert.ToString(goodsnumber + 1) + "行," + IStorageDt.Rows[goodsnumber]["GoodsName"].ToString().Trim() + "的预入数量只能为正整数,请重新写货物数量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
if (PublicStringTool.IsEmpty(IStorageDt.Rows[goodsnumber]["NumberOK"].ToString().Trim()))
{
IStorageDt.Rows[goodsnumber]["NumberOK"] = "0";
}
else
{
try
{
int A = Convert.ToInt32(IStorageDt.Rows[goodsnumber]["NumberOK"].ToString().Trim());
//if (A > 100001)
//{
// MessageBox.Show("第" + Convert.ToString(goodsnumber + 1) + "行," + IStorageDt.Rows[goodsnumber]["GoodsName"].ToString().Trim() + "的数量不能超过100000,请重新写货物数量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
// return;
//}
}
catch
{
MessageBox.Show("第" + Convert.ToString(goodsnumber + 1) + "行," + IStorageDt.Rows[goodsnumber]["GoodsName"].ToString().Trim() + "的实入数量只能为正整数,请重新写货物实入数量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
if (PublicStringTool.IsEmpty(IStorageDt.Rows[goodsnumber]["RegionalCode1"].ToString().Trim()))
{
IStorageDt.Rows[goodsnumber]["RegionalId"] = 0;
}
}
//#endregion
////#region 验证货物功能区域是否为空
//for (int goodsnumber1 = 0; goodsnumber1 < myDataGridView1.Rows.Count; goodsnumber1++)
//{
// if (myDataGridView1["RegionalCode1", goodsnumber1].FormattedValue.ToString().Trim() == "")
// {
// // MessageBox.Show(IStorageDt.Rows[goodsnumber1]["GoodsName"].ToString().Trim() + "的的功能分区不能为空,请填写货物数量!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
// // return;
// IStorageDt.Rows[goodsnumber1]["RegionalId"] = 0;
// }
//}
////#endregion
//#endregion
string sb = "";
//#region 验证数据是否有重复(解决比较所有字段 只比较已经配置的字段)
if (!myCheckBox1.Checked)
{
goodsColumnLists = GoodsListInfo();
if (IStorageDt.Rows.Count > 1)
{
for (int i = 0; i < myDataGridView1.Rows.Count; i++)
{
for (int j = i + 1; j < myDataGridView1.Rows.Count; j++)
{
if (i != j)
{
if (!CheckGoodsList(i, j))
{
sb += "第" + (i + 1).ToString().Trim() + "行和第" + (j + 1).ToString().Trim() + "行数据可以进行合并!/n";
}
}
}
}
}
}
if (!PublicStringTool.IsEmpty(sb))
{
MessageBox.Show(sb, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
//#endregion
//#region 验证数据是否重复原始方法
////#region 验证数据是否有重复
//if (IStorageDt.Rows.Count > 1)
//{
// for (int i = 0; i < myDataGridView1.Rows.Count; i++)
// {
// for (int j = i+1; j < myDataGridView1.Rows.Count; j++)
// {
// if (i != j)
// {
// if (myDataGridView1["RegionalId", i].FormattedValue.ToString().Trim() == myDataGridView1["RegionalId", j].FormattedValue.ToString().Trim()
// && myDataGridView1["RegionalCode1", i].FormattedValue.ToString().Trim().ToUpper() == myDataGridView1["RegionalCode1", j].FormattedValue.ToString().Trim().ToUpper()
// && myDataGridView1["GoodsId", i].FormattedValue.ToString().Trim() == myDataGridView1["GoodsId", j].FormattedValue.ToString().Trim()
// && myDataGridView1["SKU", i].FormattedValue.ToString().Trim().ToUpper() == myDataGridView1["SKU", j].FormattedValue.ToString().Trim().ToUpper()
// && myDataGridView1["GoodsName", i].FormattedValue.ToString().Trim().ToUpper() == myDataGridView1["GoodsName", j].FormattedValue.ToString().Trim().ToUpper()
// && myDataGridView1["GoodsType", i].FormattedValue.ToString().Trim() == myDataGridView1["GoodsType", j].FormattedValue.ToString().Trim()
// && myDataGridView1["Price", i].FormattedValue.ToString().Trim() == myDataGridView1["Price", j].FormattedValue.ToString().Trim()
// && myDataGridView1["Color", i].FormattedValue.ToString().Trim() == myDataGridView1["Color", j].FormattedValue.ToString().Trim()
// && myDataGridView1["Spec", i].FormattedValue.ToString().Trim() == myDataGridView1["Spec", j].FormattedValue.ToString().Trim()
// && myDataGridView1["Model", i].FormattedValue.ToString().Trim() == myDataGridView1["Model", j].FormattedValue.ToString().Trim()
// && myDataGridView1["SN", i].FormattedValue.ToString().Trim() == myDataGridView1["SN", j].FormattedValue.ToString().Trim()
// && myDataGridView1["ProduceTime", i].FormattedValue.ToString().Trim() == myDataGridView1["ProduceTime", j].FormattedValue.ToString().Trim()
// && myDataGridView1["BatchNumber", i].FormattedValue.ToString().Trim() == myDataGridView1["BatchNumber", j].FormattedValue.ToString().Trim()
// && myDataGridView1["ValidityTime", i].FormattedValue.ToString().Trim() == myDataGridView1["ValidityTime", j].FormattedValue.ToString().Trim()
// && myDataGridView1["Property1", i].FormattedValue.ToString().Trim() == myDataGridView1["Property1", j].FormattedValue.ToString().Trim()
// && myDataGridView1["Property2", i].FormattedValue.ToString().Trim() == myDataGridView1["Property2", j].FormattedValue.ToString().Trim()
// && myDataGridView1["Property3", i].FormattedValue.ToString().Trim() == myDataGridView1["Property3", j].FormattedValue.ToString().Trim()
// && myDataGridView1["Property4", i].FormattedValue.ToString().Trim() == myDataGridView1["Property4", j].FormattedValue.ToString().Trim()
// && myDataGridView1["Property5", i].FormattedValue.ToString().Trim() == myDataGridView1["Property5", j].FormattedValue.ToString().Trim()
// && myDataGridView1["Property6", i].FormattedValue.ToString().Trim() == myDataGridView1["Property6", j].FormattedValue.ToString().Trim()
// && myDataGridView1["Property7", i].FormattedValue.ToString().Trim() == myDataGridView1["Property7", j].FormattedValue.ToString().Trim()
// && myDataGridView1["Property8", i].FormattedValue.ToString().Trim() == myDataGridView1["Property8", j].FormattedValue.ToString().Trim()
// )
// {
// sb += "第" + (i + 1).ToString().Trim() + "行和第" + (j + 1).ToString().Trim() + "行数据可以进行合并!/n";
// //MessageBox.Show("第" + (i + 1).ToString().Trim() + "行和第" + (j + 1).ToString().Trim() + "行数据可以进行合并!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
// //return;
// }
// }
// }
// }
//}
//if (!ZJS.Tool.PublicStringTool.IsEmpty(sb))
//{
// MessageBox.Show(sb, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
// return;
//}
////#endregion
//#endregion
//#region 库存预警相关处理(已提交到中间层处理)
/**********************************************************************************************************/
//OutList_Object olo = new OutList_Object();
//OutNumber_OK_Object ooo = new OutNumber_OK_Object();
//ZJS_WMSDataSet.WMS_InStorageListDataTable InStorageLast = Get_Collect();
//ZJS_WMSDataSet.WMS_InStorageListDataTable InStorageCopy = Get_CollectCopy() ;
//IRemotingGoodsDown IGoodsDown;
//WMS_WarnerReturnQueryObject warnerObject = new WMS_WarnerReturnQueryObject();
//WMS_WarnerReturnQueryObject warnerObjectResult = new WMS_WarnerReturnQueryObject();
//IRemotingWMS_Warner IWarner = (IRemotingWMS_Warner)RemotingObject.GetRemotingObject(typeof(IRemotingWMS_Warner), "WMS_Warner");
//if (InStorageLast.Rows.Count > 0)
//{
// for (int i = 0; i < InStorageLast.Rows.Count; i++)
// {
// olo.CompanyId = companyid; //Convert.ToInt32(InStorageLast.Rows[i]["CompanyId"]);
// olo.SKU = InStorageLast.Rows[i]["SKU"].ToString().Trim();
// IGoodsDown = (IRemotingGoodsDown)RemotingObject.GetRemotingObject(typeof(IRemotingGoodsDown), "GoodsDown");
// ooo = IGoodsDown.GetOutNumber_OK(olo, userinfo.validateGuid);
// warnerObject.CompanyId = companyid;// Convert.ToInt32(InStorageLast.Rows[i]["CompanyId"]);
// warnerObject.GoodsId = Convert.ToInt32(InStorageLast.Rows[i]["GoodsId"]);
// warnerObjectResult = IWarner.queryWarnerValue(warnerObject, userinfo.validateGuid);
// int StoreNumber = Convert.ToInt32(ooo.number_A - ooo.number_L - ooo.number_W);
// int GoodsNumber = Convert.ToInt32(InStorageLast.Rows[i]["number"].ToString().Trim());
// int InStorageWarning = Convert.ToInt32(warnerObjectResult.WarnerMax);
// int NoUpNumber = Convert.ToInt32(IInStorage.Get_GoodsNumberNoUp(companyid, Convert.ToInt32(InStorageLast.Rows[i]["GoodsId"]),InStorage_Id, userinfo.validateGuid));
// if (InStorageWarning != 0)
// {
// if (GoodsNumber + StoreNumber + NoUpNumber > InStorageWarning)
// {
// MessageBox.Show("SKU为" + IStorageDt.Rows[i]["SKU"].ToString() + "的货物达到入库最大上线,最多还能入库数量为:" + Convert.ToString(InStorageWarning - StoreNumber - NoUpNumber), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
// return;
// }
// }
// }
//}
/************************************************************************************************************/
//#endregion
//#region 保存主要方法
///////////////////通过List对象把要入库信息提交到中间层后进行数据处理////////////////////////////////
AddInOrderInfo addInorder = new AddInOrderInfo();
addInorder.InStorageObject = new WMS_InStorageObject();
addInorder.InStorageListObject = new List<WMS_InStorageListObject>();
addInorder.InStorage_SendObject = new WMS_InStorage_SendObject();
/////////////////////////////////////////////////////////////////////////////////////////////////////
addInorder.FormState = FormState;
addInorder.GoodsCompanyId = CompanyId;
DataTable dt = ((DataTable)myDataGridView1.DataSource).Copy();
if (IStorageDt.Rows.Count > 0)
{
IStorageDt.Rows.Clear();
}
else
{
IStorageDt = new ZJS_WMSDataSet.WMS_InStorageListDataTable();
}
foreach (DataRow dr in dt.Rows)
{
IStorageDt.ImportRow(dr);
}
WMS_InStorageObject InStorageObject = new WMS_InStorageObject();
//if (FormState == 0)
//{
//#endregion
//#region 添加入库订单主表信息
InStorageObject.ZjsId = userinfo.CompanyID;
InStorageObject.CompanyId = companyid;
InStorageObject.OrderNumber = myTextBox3.Text.Trim().ToString();
InStorageObject.CompanyCode = myTextBox1.Text.Trim().ToString();
InStorageObject.CompanyName = myTextBox2.Text.Trim().ToString();
InStorageObject.Address = myTextBox4.Text.Trim().ToString();
InStorageObject.Postalcode = myTextBox8.Text.Trim().ToString();
InStorageObject.Tel = myTextBox5.Text.Trim().ToString();
InStorageObject.LinkMan = myTextBox6.Text.Trim().ToString();
InStorageObject.Remark = myTextBox7.Text.Trim().ToString();
InStorageObject.RecordUserName = userinfo.UserName.ToString();
InStorageObject.RecordUserId = Convert.ToInt32(userinfo.UserId.Trim());
InStorageObject.OrderTerm =myDateTimePicker1.Value.Date;
addInorder.GoodsCompanyId = CompanyId;
InStorageObject.InType = myTextBox9.Text.ToString();
//if (myCheckBox5.Checked == true)
{
//InStorageObject.IsIncludeSend = 1;
//InStorageObject.IsIncludeAccept = 1;
//if (PublicStringTool.IsEmpty( Instorage_Send.A_CompanyName ))
//{
// MessageBox.Show("送货方名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
// return;
//}
}
//if (myCheckBox5.Checked == false)
{
InStorageObject.IsIncludeSend = 0;
InStorageObject.IsIncludeAccept = 0;
}
addInorder.InStorageObject = InStorageObject;
//if (myCheckBox5.Checked == true)
{
addInorder.InStorage_SendObject = Instorage_Send;
}
//}
//#endregion
//#region 添加入库订单明细表信息
//if (FormState == 0)
//{
// // InStorageListObject.InStorage_Id = BillCode;
//}
//if (FormState == 1)
//{
// IInStorage.DeleteWMS_InStorageList(InStorage_Id, userinfo.validateGuid);
// InStorageListObject.InStorage_Id = InStorage_Id.ToString().Trim();
if (myCheckBox1.Checked == true)//是否作废
{
WMS_InStorageObject myInstorage = new WMS_InStorageObject();
myInstorage.OffUserId = Convert.ToInt32(userinfo.UserId.Trim());
myInstorage.OffUserName = userinfo.UserName.ToString().Trim();
myInstorage.OffRemark = myTextBox12.Text.Trim().ToString();
myInstorage.InStorage_Id = InStorage_Id.ToString().Trim();
//IInStorage.CancelWMS_InStorage(myInstorage, userinfo.validateGuid);
}
//}
if (IStorageDt.Rows.Count > 0)
{
foreach (DataRow dr in IStorageDt.Rows)
{
WMS_InStorageListObject InStorageListObject = new WMS_InStorageListObject();
if (FormState == 0)
{
}
if (FormState == 1)
{
addInorder.InStorage_Id = InStorage_Id.ToString().Trim();
}
InStorageListObject.RegionalId = Convert.ToInt32(dr["RegionalId"].ToString().Trim());//myDataGridView1["RegionalCode1", i].Value);
InStorageListObject.CompanyId = companyid;
InStorageListObject.GoodsId = Convert.ToInt32(dr["GoodsId"].ToString().Trim());
InStorageListObject.SKU =dr ["SKU"].ToString().Trim();
InStorageListObject.GoodsName = dr["GoodsName"].ToString().Trim();
InStorageListObject.Number = Convert.ToInt32(dr["Number"].ToString().Trim());
if (PublicStringTool.IsEmpty(dr["NumberOK"].ToString().Trim()))
{
InStorageListObject.NumberOK = 0;
}
else
{
InStorageListObject.NumberOK = Convert.ToInt32(dr["NumberOK"].ToString().Trim());
}
InStorageListObject.Remark = dr["Remark"].ToString().Trim();
InStorageListObject.Length = Convert.ToDecimal(dr["Length"].ToString().Trim());
InStorageListObject.Width = Convert.ToDecimal(dr["Width"].ToString().Trim());
InStorageListObject.Height = Convert.ToDecimal(dr["Height"].ToString().Trim());
InStorageListObject.Weight = Convert.ToDecimal(dr["Weight"].ToString().Trim());
InStorageListObject.GoodsType = dr["GoodsType"].ToString().Trim();
InStorageListObject.Price = Convert.ToDecimal(dr["Price"].ToString().Trim());
InStorageListObject.Color = dr["Color"].ToString().Trim();
InStorageListObject.SN = dr["SN"].ToString().Trim();
InStorageListObject.Spec = dr["Spec"].ToString().Trim();
InStorageListObject.Model = dr["Model"].ToString().Trim();
InStorageListObject.ProduceTime = Convert.ToDateTime(dr["ProduceTime"].ToString().Trim());
InStorageListObject.BatchNumber = dr["BatchNumber"].ToString().Trim();
InStorageListObject.ValidityTime = Convert.ToDateTime(dr["ValidityTime"].ToString().Trim());
InStorageListObject.Property1 = dr["Property1"].ToString().Trim();
InStorageListObject.Property2 = dr["Property2"].ToString().Trim();
InStorageListObject.Property3 = Convert.ToDateTime(dr["Property3"].ToString().Trim());
InStorageListObject.Property4 = Convert.ToDateTime(dr["Property4"].ToString().Trim());
InStorageListObject.Property5 = Convert.ToInt32(dr["Property5"].ToString().Trim());
InStorageListObject.Property6 = Convert.ToInt32(dr["Property6"].ToString().Trim());
InStorageListObject.Property7 = Convert.ToDecimal(dr["Property7"].ToString().Trim());
InStorageListObject.Property8 = Convert.ToDecimal(dr["Property8"].ToString().Trim());
InStorageListObject.IsRepeat = Convert.ToInt32(dr["IsRepeat"].ToString().Trim());
// IInStorage.InsertWMS_InStorageList(InStorageListObject, userinfo.validateGuid);
addInorder.InStorageListObject.Add(InStorageListObject);
}
addInorder.ds = new DataSet();
addInorder.ds.Tables.Clear();
DataTable dt1 = IStorageDt.Copy();
dt1.TableName = "IStorageDt";
DataTable dt2 = IStorageDtCopy.Copy();
dt2.TableName = "IStorageDtCopy";
addInorder.ds.Tables.Add(dt1);
addInorder.ds.Tables.Add(dt2);
/////////////////////////多线程提交数据/////////////////////////
IprogressBar pb1 = new CprogressBar();
if (FormState == 0)
{
pb1.Exec_Function += new ResultDelegate(SaveInstorageInfo);
}
else
{
pb1.Exec_Function += new ResultDelegate(pb1_Exec_Function);
}
ErrorMesseage error = (ErrorMesseage)pb1.Start(addInorder, "正在保存数据,请等待");
////////////////////////////////////////////////////////////////
// string a = IInStorage.AddInOrderInfo(addInorder, userinfo.validateGuid);
if (FormState == 0)
{
if (error != null)
{
if (!PublicStringTool.IsEmpty(error.UpDownLimitMessage))
{
MessageBox.Show(error.UpDownLimitMessage, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
else
{
if (PublicStringTool.IsEmpty(error.StorageMessage))
{
MessageBox.Show("保存成功,单号:" + error.InStorage_Id, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
//myButton5.Enabled = true;
//myButton6.Enabled = false;
IStorageDt.TableName = "WMS_InStorageList";
//IStorageDtCopy.TableName = "WMS_InStorageList";
}
else
{
MessageBox.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
}
else
{
MessageBox.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
if (FormState == 1)
{
if (error != null)
{
if (!PublicStringTool.IsEmpty(error.UpDownLimitMessage))
{
MessageBox.Show(error.UpDownLimitMessage, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
else
{
if (PublicStringTool.IsEmpty(error.StorageMessage))
{
MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
//myButton6.Enabled = true;
//myButton5.Enabled = false;
IStorageDt.TableName = "WMS_InStorageList";
}
else
{
MessageBox.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
}
else
{
MessageBox.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
if (FormState == 1)
{
//myButton6.Enabled = true;
//myButton5.Enabled = false;
if (myCheckBox1.Checked == true)
{
myCheckBox1.Enabled = true;
myTextBox12.Enabled = false;
}
}
if (myCheckBox1.Checked == true)
{
//myButton6.Enabled = false;
}
//myButton3.Enabled = false;
//myButton4.Enabled = false;
//myButton8.Enabled = false;
IsEnable(true);
myDataGridView1.ReadOnly = true;
//myCheckBox5.Enabled = false;
//myButton9.Enabled = false;
//myButton10.Enabled = false;
}
else
{
MessageBox.Show("请输入要货物信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
//#endregion
//#endregion
}
//#region 提交数据用到相关方法
//#region 修改提前到货通知单
object pb1_Exec_Function(object parameter)
{
try
{
return IInStorage.UpdateInstorage_Info((AddInOrderInfo)parameter, userinfo.validateGuid);
}
catch (Exception ex)
{
MessageBox.Show(WrongMessage.GetWrongMessage(ex.Message), "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return null;
}
}
//#endregion
//#region 新增提前到货通知单
object SaveInstorageInfo(object parameter)
{
try
{
return IInStorage.InsertWMS_InstorageAlls((AddInOrderInfo)parameter, userinfo.validateGuid);
}
catch (Exception ex)
{
MessageBox.Show(WrongMessage.GetWrongMessage(ex.Message), "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return null;
}
}
//#endregion
//#endregion
//#endregion
//#region 填写数据是否重复的监测
private List<string> GoodsListInfo()
{
List<string> goodsColumnList = new List<string>();
try
{
IGoodsInfo = (IRemotingWMS_GoodsInfo)RemotingObject.GetRemotingObject(typeof(IRemotingWMS_GoodsInfo), "WMS_GoodsInfo");
ds8 = (ZJS_WMSDataSet)IGoodsInfo.Get_GoodsColumnIsNotUpdate(CompanyId, userinfo.validateGuid);
if (ds8.WMS_ClientCompanyIni.Rows.Count > 0)
{
for (int i = 0; i < ds8.WMS_ClientCompanyIni.Rows.Count; i++)
{
if (Convert.ToInt32(ds8.WMS_ClientCompanyIni.Rows[i]["IsInPut"].ToString().Trim()) == 1)
{
goodsColumnList.Add(ds8.WMS_ClientCompanyIni.Rows[i]["GoodsColumnCode"].ToString().Trim());
}
}
}
}
catch
{
return goodsColumnList;
}
return goodsColumnList;
}
private bool CheckGoodsList(int i, int j)
{
if (myDataGridView1["SKU", i].FormattedValue.ToString().ToUpper().Trim() != myDataGridView1["SKU", j].FormattedValue.ToString().ToUpper().Trim())
{
return true;
}
foreach (string goodsColumn in goodsColumnLists)
{
if (ClientTool.ToDBC(myDataGridView1[goodsColumn, i].FormattedValue.ToString().ToUpper().Trim()) != ClientTool.ToDBC(myDataGridView1[goodsColumn, j].FormattedValue.ToString().ToUpper().Trim()))
{
return true;
}
}
return false;
}
//#endregion
myDataGridView1.CurrentCell.RowIndex]["inbz"]) == 0 myDataGridView1.CurrentCell.RowIndex==-1
myDataGridView1["Number", e.RowIndex]
int goodsskuid=Convert.ToInt32(myDataGridView1["goodsskuid",myDataGridView1.CurrentCell.RowIndex].Value)
if (Convert.ToInt32(ds_main.WMS_UpOp.Rows[myDataGridView1.CurrentCell.RowIndex]["inbz"]) == 0)
if (myDataGridView1.CurrentCell != null && myDataGridView1.Columns[myDataGridView1.CurrentCell.ColumnIndex].Name == "number")
ds_main.WMS_UpOp.Rows.InsertAt(dr, myDataGridView1.CurrentCell.RowIndex + 1);
if (myDataGridView1.CurrentCell.RowIndex == myDataGridView1.Rows.Count - 1)
dr[myDataGridView1.Columns[i].Name] = myDataGridView1[myDataGridView1.Columns[i].Name, myDataGridView1.CurrentCell.RowIndex].Value;
int Savestate = Convert.ToInt32(myDataGridView1["upstate", myDataGridView1.CurrentCell.RowIndex].Value) + 1;
if (myDataGridView1.Columns[myDataGridView1.CurrentCell.ColumnIndex].Name == "placecode" && !myDataGridView1.CurrentCell.ReadOnly)
rowidex = myDataGridView1.CurrentCell.RowIndex;
if (myDataGridView1.Columns[myDataGridView1.CurrentCell.ColumnIndex].Name == "placecode" && !myDataGridView1.CurrentCell.ReadOnly)
drow["property8"] = (decimal)ds_a.WMS_InStorageList.Rows[myDataGridView2.CurrentCell.RowIndex]["property8"];
if (ds_a.WMS_InStorageList.Rows[myDataGridView2.CurrentCell.RowIndex]["weight"] != System.DBNull.Value)
string opuser = myDataGridView1["OperationUser", myDataGridView1.CurrentCell.RowIndex].Value.ToString();
int companyid = Convert.ToInt32(myDataGridView1["CompanyId", myDataGridView1.CurrentCell.RowIndex].Value);
int i = Convert.ToInt32(myDataGridView1.CurrentCell.RowIndex)
CompanyName = WMS_RegioalClient.Rows[myDataGridView1.CurrentCell.RowIndex]["CompanyName"].ToString();
PlaceInfoObject.Width = Convert.ToDecimal(WMS_PlaceInfo.Rows[myDataGridView3.CurrentCell.RowIndex]["Width"].ToString());
if (myDataGridView1.CurrentCell.RowIndex != -1)
myDataGridView1.CurrentCell = myDataGridView1["RegionalCode", myDataGridView1.Rows.Count - 1];
myDataGridView1.CurrentCell = myDataGridView1["SKU", myDataGridView1.CurrentCell.RowIndex];
if (PublicStringTool.IsEmpty( myDataGridView1["SKU", myDataGridView1.CurrentCell.RowIndex].FormattedValue.ToString().Trim()) && PublicStringTool.IsEmpty( myDataGridView1["GoodsName", myDataGridView1.CurrentCell.RowIndex].FormattedValue.ToString().Trim()))
myDataGridView1.CurrentCell = myDataGridView1["SKU", myDataGridView1.CurrentCell.RowIndex];
MessageBox.Show("未查到货物名称为:" + myDataGridView1["GoodsName", myDataGridView1.CurrentCell.RowIndex].FormattedValue.ToString().Trim() + ", SKU为:" + myDataGridView1["SKU", myDataGridView1.CurrentCell.RowIndex].FormattedValue.ToString().Trim() + "的货物。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
if (!PublicStringTool.IsEmpty( myDataGridView1["SKU", myDataGridView1.CurrentCell.RowIndex].FormattedValue.ToString().Trim() ) && !PublicStringTool.IsEmpty( myDataGridView1["GoodsName", myDataGridView1.CurrentCell.RowIndex].FormattedValue.ToString().Trim() ))
ds3 = (ZJS_WMSDataSet)IWMS_InStorage.GetWMS_GoodsInfoFromSKU(myDataGridView1["SKU", myDataGridView1.CurrentCell.RowIndex].FormattedValue.ToString().Trim(), myDataGridView1["GoodsName", myDataGridView1.CurrentCell.RowIndex].FormattedValue.ToString().Trim(), CompanyId2, userinfo.validateGuid);
MessageBox.Show("分区代码:" + myDataGridView1["RegionalCode", myDataGridView1.CurrentCell.RowIndex].FormattedValue.ToString().Trim() + "不存在,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
E:/MyCode/ZJSWMS/Client/ShareUI/WMSShareUI/OutOrder.cs(2670):
MessageBox.Show("分区代码:" + myDataGridView1["RegionalCode", myDataGridView1.CurrentCell.RowIndex].FormattedValue.ToString().Trim() + "不存在,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
E:/MyCode/ZJSWMS/Client/ShareUI/WMSShareUI/OutOrder.cs(2670):
- 混乱的代码
- 混乱的代码
- 混乱你的代码
- 混乱代码
- 混乱到让人近乎抓狂的代码
- vim黏贴代码格式混乱的解决方法
- vim黏贴代码格式混乱的解决方法
- vim黏贴代码格式混乱的解决方法
- 怎样去除JAXBElement引起的混乱代码
- vim黏贴代码格式混乱的解决方法
- PHP中代码的混乱问题
- 为什么你的android代码这么混乱
- c混乱代码大赛
- 混乱代码大赛
- c/c++ 混乱代码
- 混乱代码-helloworld
- 谁说使用Python你就写不出混乱的代码?
- 解决vim黏贴代码格式混乱的方案
- 隐藏文件的另一个方法
- rhel5 配置yum源笔记
- 怎样才能删除SQL Server 2000所有的危险扩展?
- JS数组方法汇总
- vc中 windows 常用的数据类型
- 混乱的代码
- 浅析大型网站的架构
- 网页设计基础知识
- 将z-blog改成英文blog所遇到的问题
- LocalConnection的具体实现
- 图灵机杂思(转)
- [转]Symbian 对话框的使用
- Windows Socket五种I/O模型——代码全攻略
- fact table 和dimension table的区别