using System;
using System.Data;
using System.Windows.Forms;
using CoreFS.CA06;
using Core.Mes.Client.Comm.Server;
using Core.Mes.Client.Comm.Control;
using Infragistics.Win.UltraWinGrid;
using Core.StlMes.Client.YdmBase;
using System.Linq;
using System.Collections;
using System.Drawing;
using Infragistics.Win.UltraWinEditors;
using Core.Mes.Client.Comm.Tool;
using Infragistics.Win;
using Core.StlMes.Client.YdmPipeManage.Controls;
using Core.StlMes.Client.YdmPipeManage.Tool;
using Core.StlMes.Client.YdmPipeManage;
namespace Core.StlMes.Client.YdmPipeManage
{
public partial class frmPipeInTemp : FrmBase
{
UltraComboEditor uceReson = new UltraComboEditor();
public frmPipeInTemp()
{
InitializeComponent();
this.IsLoadUserView = true;
}
///
/// 重写基类方法
///
///
///
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "DataMatch":
DataMatch();
break;
case "Maint":
doMaint();
break;
case "Query":
QueryOrder();
break;
case "Query1":
QueryMatData();
break;
case "Query2":
QueryPipedData();
break;
case"QueryInList":
QueryInList();
break;
case "PipeIn":
DoPipeIn();
break;
case "PipeIn1":
DoForcePipeIn();
break;
case "CanclePipe":
DoCanclePipeIn();
break;
case "Refresh":
QueryMatData();
break;
case "updateStoreNo":
updateStoreNo();
break;
case "updateCarryOverDate":
updateCarryOverDate();
break;
case"pipRed":
pipRed();
break;
case"adjustStoreButress":
adjustStoreButress();
break;
case"updateStaus":
updateStaus();
break;
case"updateMemo":
updatePipMemo();
break;
case "updateFinishedProduct":
updateFinishedProduct();
break;
case"getRealTimeStore":
getRealTimeStore();
break;
case"Export":
Export();
break;
case "Close":
this.Close();
break;
}
}
///
/// 获取实时库存
///
private void getRealTimeStore()
{
string time = DateTime.Now.ToString("dd");
string bathYear = DateTime.Now.ToString("yyyyMM");
string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob);
if (!time.Equals("01"))
{
MessageUtil.ShowTips("此按钮只允许每月一号进行操作!");
return;
}
DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.selectNowInial", new object[] { arr,bathYear }, ob);
if (int.Parse(ds.Rows[0][0].ToString()) > 0)
{
}
else
{
MessageUtil.ShowTips("无本月期初数据,不允许获取期初库存!");
return;
}
int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getRealTimeStore", new object[] { arr, bathYear }, ob);
if (count > 0)
{
MessageUtil.ShowTips("获取实时期末库存成功!");
}
}
///
/// 导出
///
private void Export()
{
if (ultraTabControl1.SelectedTab.Key == "1")
{
GridHelper.ulGridToExcel(ultraGrid1,"质保数据");
}
else if (ultraTabControl1.SelectedTab.Key == "2")
{
GridHelper.ulGridToExcel(ultraGrid2, "库存实绩明细");
}
else
{
GridHelper.ulGridToExcel(ultraGrid4, "缴库实绩明细");
}
}
///
/// 缴库红冲
///
private void pipRed()
{
int m = 0;
UltraGridRow rows = null;
foreach (UltraGridRow row in ultraGrid1.Rows)
{
if(Convert.ToBoolean(row.Cells["CHK"].Text) == true)
{
if (row.Cells["CXSTUPP"].Text.Trim() == "")
{
MessageUtil.ShowTips("您选择的质保信息未匹配,不能进行缴库红冲!");
return;
}
if (row.Cells["CXSTUPP"].Text.Trim() == "物料不匹配")
{
MessageUtil.ShowTips("您选择的质保信息物料不匹配,不能进行缴库红冲!");
return;
}
if (int.Parse(row.Cells["hgunit"].Text.Trim()) > 0)
{
MessageUtil.ShowTips("选择的数据支数大于零,不能进行缴库红冲!");
return;
}
if (!row.Cells["ordername"].Text.Contains("/"))
{
MessageUtil.ShowTips("合同号不规范,不允许缴库红冲!");
return;
}
m++;
rows = row;
}
}
if (m > 1)
{
MessageUtil.ShowTips("不允许多炉缴库红冲!");
return;
}
if (m < 1)
{
MessageUtil.ShowTips("请勾选需要缴库红冲的质保数据!");
return;
}
if (this.cmbFactory.Text.ToString() == "")
{
factoryCode = "";
factoryNo = "";
}
else
{
factoryCode = this.cmbFactory.Value.ToString();
factoryNo = this.cmbFactory.Text.ToString();
}
if (this.cmbSteel.Text.ToString() == "")
{
steelCode = "";
steelName = "";
}
else
{
steelCode = this.cmbSteel.Value.ToString();
steelName = this.cmbSteel.Text.ToString();
}
frmPipRedDashed redDas = new frmPipRedDashed(this.ob);
redDas.Rccid = rows.Cells["rcdid"].Text;
redDas.PlineCode = factoryCode;
redDas.PlineName = factoryNo;
redDas.GradeCode = steelCode;
redDas.GradeName = steelName;
redDas.ShowDialog();
if (redDas.buttonValue == "1")
{
QueryMatData();
MessageUtil.ShowTips("缴库红冲成功!");
}
}
///
/// 修改结转年月
///
private void updateCarryOverDate()
{
ultraGrid4.UpdateData();
ArrayList parmList = new ArrayList();
string userName = UserInfo.GetUserName();
int m = 0;
int count = 0;
int n = 0;
//string moth = DateTime.Now.AddMonths(1).ToString("yyyyMM");
string moth = "";
string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,ob);
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid4.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
{
if (uRow.Cells["BAL_YEAR_MONTH"].Text.Trim() == "")
{
n++;
}
m++;
//if (uRow.Cells["BAL_YEAR_MONTH"].Text.Trim().Length != 6)
//{
// MessageUtil.ShowTips("结算日期只能是6位,请重新输入!");
// return;
//}
//if (!isDateTime(uRow.Cells["BAL_YEAR_MONTH"].Text.Trim()))
//{
// MessageUtil.ShowTips("结算日期输入格式不正确!");
// return;
//}
}
}
if (m < 1)
{
MessageUtil.ShowTips("请选择需要操作的数据!");
return;
}
if (n > 0)
{
MessageUtil.ShowTips("结转年月不能为空!");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("是否修改选择的数据?") == DialogResult.No)
{
return;
}
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid4.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
{
ArrayList list = new ArrayList();
ArrayList _list = new ArrayList();
moth = DateTime.Parse(uRow.Cells["BAL_YEAR_MONTH"].Text).AddMonths(1).ToString("yyyyMM");
//if (int.Parse(uRow.Cells["BAL_YEAR_MONTH"].Text.Substring(0, 4) + uRow.Cells["BAL_YEAR_MONTH"].Text.Substring(5, 2)) < int.Parse(DateTime.Now.ToString("yyyyMM")))
//{
// MessageUtil.ShowTips("调整结转年月不能小于当前年月!");
// return;
//}
//_list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text);
//_list.Add(uRow.Cells["BATCH_NO"].Text);
//_list.Add(uRow.Cells["BATCH_GROUD_NO"].Text);
_list.Add(moth);
DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeAdjust.selectYearMoth", new object[] { _list, arr }, ob);
if (int.Parse(ds.Rows[0]["ACOUNT"].ToString()) > 0)
{
MessageUtil.ShowTips("此炉" + uRow.Cells["JUDGE_STOVE_NO"].Text + "已进行结转,不允许调整结转年月!");
return;
}
list.Add(uRow.Cells["BAL_YEAR_MONTH"].Text.Substring(0, 4) + uRow.Cells["BAL_YEAR_MONTH"].Text.Substring(5,2));
list.Add(uRow.Cells["ORDER_NO"].Text);
list.Add(uRow.Cells["ORDER_SEQ"].Text);
list.Add(uRow.Cells["DELIVERY_NO"].Text);
list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text);
list.Add(uRow.Cells["BATCH_NO"].Text);
list.Add(uRow.Cells["PRODUCNAME"].Text);
//list.Add(uRow.Cells["STD_NAME"].Text);
list.Add(uRow.Cells["STEELNAME"].Text);
list.Add(uRow.Cells["SPEC_NAME"].Text);
list.Add(uRow.Cells["MODEL_DESC"].Text);
list.Add(userName);
list.Add(uRow.Cells["ACT_LEN_MIN"].Text);
list.Add(uRow.Cells["ACT_LEN_MAX"].Text);
list.Add(uRow.Cells["BATCH_GROUD_NO"].Text);
list.Add(uRow.Cells["INSTOCK_DOC"].Text);
parmList.Add(list);
}
}
count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.updateCarryOverDate", new Object[] { parmList }, this.ob);
if (count > 0)
{
QueryInList();
MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
///
/// 修改库存位置
///
private void updateStoreNo()
{
ultraGrid2.UpdateData();
ArrayList parmList = new ArrayList();
string orderNo = "";//合同号
string orderSeqNo = "";//合同行
string order_No = "";//交货行
string heatNo = "";//炉号
string batchNo = "";//批号
string producName = "";//品名
string std_Name = "";//标准名称
string steelName = "";//钢级
string specName = "";//规格
string mescCode = "";//扣型
string storeNo = "";//仓库号
string userName = UserInfo.GetUserName();
int m = 0;
int count = 0;
int n = 0;
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
{
if (uRow.Cells["STORAGE_NO"].Text.Trim() == "")
{
n++;
}
m++;
}
}
if (m < 1)
{
MessageUtil.ShowTips("请选择需要操作的数据!");
return;
}
if (n > 0)
{
MessageUtil.ShowTips("仓库名称不能为空!");
return;
}
if(MessageUtil.ShowYesNoAndQuestion("是否修改选择的数据?") == DialogResult.No)
{
return;
}
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
{
if (uRow.Cells["MAT_STATUS"].Value.ToString() != "80150301" && uRow.Cells["MAT_STATUS"].Value.ToString() != "80150202" && uRow.Cells["MAT_STATUS"].Value.ToString() != "80150203"&&uRow.Cells["MAT_STATUS"].Value.ToString() != "80150204"&&uRow.Cells["MAT_STATUS"].Value.ToString() != "80150205")
{
MessageUtil.ShowTips("材料状态已被改变,不允许修改库存地点!");
return;
}
ArrayList list = new ArrayList();
list.Add(uRow.Cells["STORAGE_NO"].Value.ToString());
//list.Add(uceReson.Value.ToString());
list.Add(uRow.Cells["ORDER_NO"].Text.Trim());
list.Add(uRow.Cells["ORDER_SEQ"].Text.Trim());
list.Add(uRow.Cells["ORDER_SEQ_NO"].Text.Trim());
list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.Trim());
list.Add(uRow.Cells["BATCH_NO"].Text.Trim());
list.Add(uRow.Cells["PRODUCNAME"].Text.Trim());
//list.Add(uRow.Cells["STD_NAME"].Text.Trim());
list.Add(uRow.Cells["STEELNAME"].Text.Trim());
list.Add(uRow.Cells["SPEC_NAME"].Text.Trim());
list.Add(uRow.Cells["MODEL_DESC"].Text.Trim());
list.Add(userName);
list.Add(uRow.Cells["ACT_LEN_MIN"].Text.Trim());
list.Add(uRow.Cells["ACT_LEN_MAX"].Text.Trim());
list.Add(uRow.Cells["BATCH_GROUD_NO"].Text.Trim());
if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "商品")
{
list.Add("801403");
}
else if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "成品")
{
list.Add("801402");
}
else
{
list.Add("801401");
}
//list.Add(uRow.Cells["MAT_STATUS"].Value.ToString());
parmList.Add(list);
}
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
ccp.MethodName = "updateStoreNo";
ccp.ServerParams = new object[] { parmList };
ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
//count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.updateStoreNo", new Object[] { parmList }, this.ob);
if (ccp.ReturnCode != -1)
{
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("修改成功!"))
{
QueryPipedData();
// MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
///
/// 修改入库备注
///
private void updatePipMemo()
{
ultraGrid2.UpdateData();
ArrayList parmList = new ArrayList();
string userName = UserInfo.GetUserName();
int m = 0;
foreach (UltraGridRow uRow in ultraGrid2.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
{
m++;
}
}
if (m < 1)
{
MessageUtil.ShowTips("请选择需要操作的数据!");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("是否修改选择的数据?") == DialogResult.No)
{
return;
}
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
{
if (uRow.Cells["MAT_STATUS"].Value.ToString() != "80150301" && uRow.Cells["MAT_STATUS"].Value.ToString() != "80150202" && uRow.Cells["MAT_STATUS"].Value.ToString() != "80150203" && uRow.Cells["MAT_STATUS"].Value.ToString() != "80150204" && uRow.Cells["MAT_STATUS"].Value.ToString() != "80150205")
{
MessageUtil.ShowTips("材料状态已被改变,不允许修改入库备注!");
return;
}
ArrayList list = new ArrayList();
list.Add(uRow.Cells["PIPMEMO"].Value.ToString());
//list.Add(uceReson.Value.ToString());
list.Add(uRow.Cells["ORDER_NO"].Text.Trim());
list.Add(uRow.Cells["ORDER_SEQ"].Text.Trim());
list.Add(uRow.Cells["ORDER_SEQ_NO"].Text.Trim());
list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.Trim());
list.Add(uRow.Cells["BATCH_NO"].Text.Trim());
list.Add(uRow.Cells["PRODUCNAME"].Text.Trim());
//list.Add(uRow.Cells["STD_NAME"].Text.Trim());
list.Add(uRow.Cells["STEELNAME"].Text.Trim());
list.Add(uRow.Cells["SPEC_NAME"].Text.Trim());
list.Add(uRow.Cells["MODEL_DESC"].Text.Trim());
list.Add(userName);
list.Add(uRow.Cells["ACT_LEN_MIN"].Text.Trim());
list.Add(uRow.Cells["ACT_LEN_MAX"].Text.Trim());
list.Add(uRow.Cells["BATCH_GROUD_NO"].Text.Trim());
if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "商品")
{
list.Add("801403");
}
else if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "成品")
{
list.Add("801402");
}
else
{
list.Add("801401");
}
//list.Add(uRow.Cells["MAT_STATUS"].Value.ToString());
parmList.Add(list);
}
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
ccp.MethodName = "updatePipMemo";
ccp.ServerParams = new object[] { parmList };
ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
//count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.updateStoreNo", new Object[] { parmList }, this.ob);
if (ccp.ReturnCode != -1)
{
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("修改成功!"))
{
QueryPipedData();
// MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
///
/// 修改成品区分
///
private void updateFinishedProduct()
{
ultraGrid2.UpdateData();
ArrayList parmList = new ArrayList();
string userName = UserInfo.GetUserName();
int m = 0;
foreach (UltraGridRow uRow in ultraGrid2.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
{
m++;
}
}
if (m < 1)
{
MessageUtil.ShowTips("请选择需要操作的数据!");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("是否修改选择的数据?") == DialogResult.No)
{
return;
}
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
{
if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "商品")
{
MessageUtil.ShowTips("材料类别为商品的,不允许修改成品区分!");
return;
}
ArrayList list = new ArrayList();
list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.Trim());
list.Add(uRow.Cells["BATCH_NO"].Text.Trim());
list.Add(uRow.Cells["BATCH_GROUD_NO"].Text.Trim());
//list.Add(uRow.Cells["PRODUCNAME"].Text.Trim());
//list.Add(uRow.Cells["STEELNAME"].Text.Trim());
//list.Add(uRow.Cells["SPEC_NAME"].Text.Trim());
//list.Add(uRow.Cells["MODEL_DESC"].Text.Trim());
//list.Add(userName);
//list.Add(uRow.Cells["ACT_LEN_MIN"].Text.Trim());
//list.Add(uRow.Cells["ACT_LEN_MAX"].Text.Trim());
if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "商品")
{
list.Add("801403");
}
else if (uRow.Cells["PRODUCT_FLAG"].Text.Trim() == "成品")
{
list.Add("801402");
}
else
{
list.Add("801401");
}
list.Add(uRow.Cells["PIPMEMO"].Value.ToString());
list.Add(uRow.Cells["IN_MOLD"].Value.ToString());
list.Add(uRow.Cells["FINISHPRO_MOLD"].Value.ToString2());
parmList.Add(list);
}
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmFinishAfrim";
ccp.MethodName = "updateFinishedProduct";
ccp.ServerParams = new object[] { parmList };
ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("修改成功!"))
{
QueryPipedData();
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
///
/// 批量调整位置
///
private void adjustStoreButress()
{
ultraGrid2.UpdateData();
int n = 0;
int m = -1;
ArrayList list = new ArrayList();
string heatNo = "";
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
{
heatNo = uRow.Cells["JUDGE_STOVE_NO"].Value.ToString();
list.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString());
list.Add(uRow.Cells["BATCH_NO"].Value.ToString());
list.Add(uRow.Cells["BATCH_GROUD_NO"].Value.ToString());
if (uRow.Cells["PRODUCT_FLAG"].Value.ToString().Equals("商品"))
{
list.Add("801403");
}else
{
list.Add("801402");
}
list.Add(uRow.Cells["ORDER_NO"].Value.ToString());
list.Add(uRow.Cells["ORDER_SEQ"].Value.ToString());
list.Add(uRow.Cells["ORDER_SEQ_NO"].Value.ToString());
list.Add(uRow.Cells["FINISHPRO_MOLD"].Value.ToString());
list.Add(uRow.Cells["MAT_STATUS"].Value.ToString());
n++;
m = uRow.Index;
}
}
if (n < 1)
{
MessageUtil.ShowTips("请选择主信息进行批量调整位置!");
return;
}
if(n>1)
{
MessageUtil.ShowTips("批量调整位置不允许多条调整库存位置!");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("是否批量修改选择数据的库存位置?") == DialogResult.No)
{
return;
}
DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipupdateStoreButress.selectMatStu", new object[] { list }, ob);
if (int.Parse(dt.Rows[0]["ACOUNT"].ToString()) > 0)
{
MessageUtil.ShowTips("此炉【"+heatNo+"】物料状态有改变,不允许调整位置!");
return;
}
DataTable ds = new DataTable();
ds.Clear();
ds = dataTable2.Clone();
ds.ImportRow(dataTable2.Rows[m]);
frmPipeMoveStoreButress moveButress = new frmPipeMoveStoreButress(this.ob);
moveButress.Dt = ds;
moveButress.ShowDialog();
if (moveButress.buttonValue == "1")
{
QueryPipedData();
MessageUtil.ShowTips("修改成功!");
}
}
///
/// 缴库实绩查询
///
private void QueryInList()
{
string heatNo = "";
string orderNo = "";
string storgeNo = "";
string startTim = "";
string endTim = "";
string bathYear = "";
ArrayList list = new ArrayList();
if (ultraCheckEditor5.Checked)
{
startTim = StartTime.Value.ToString("yyyy-MM-dd");
endTim = EndTime.Value.ToString("yyyy-MM-dd");
}
if (chkJudge.Checked)
{
if (this.cmbJudge.Text == "")
{
MessageUtil.ShowTips("请选择炉号!");
return;
}else
{
heatNo = this.cmbJudge.Text.Trim();
}
}
if (chkOrder.Checked)
{
if (this.cmbOrder.Text == "")
{
MessageUtil.ShowTips("请选择合同号!");
return;
}
else
{
orderNo = this.cmbOrder.Text.Trim();
}
}
if (chkStrong.Checked)
{
if (this.cmbStorager.Text == "")
{
MessageUtil.ShowTips("请选择仓库!");
return;
}
else
{
storgeNo = this.cmbStorager.Value.ToString();
}
}
if (chkBathYear.Checked)
{
bathYear = this.dtBathYear.Value.ToString("yyyyMM");
}
list.Add(heatNo);
list.Add(orderNo);
list.Add(storgeNo);
list.Add(bathYear);
//string arr = UserInfo.GetDeptid();
string areaNo = "";
string userName = UserInfo.GetUserName();
//if (!userName.Equals("admin"))
//{
// DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.querySaleOrg", new object[] { arr }, this.ob);
// if (ds.Rows.Count > 0)
// {
// areaNo = ds.Rows[0][0].ToString();
// }
//}
string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, this.ob);
//DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryInList", new object[] { list, userName, areaNo }, this.ob);
DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryInList", new object[] { list, arr, startTim, endTim }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref dataTable4,true);
//GridHelper.RefreshAndAutoSize(this.ultraGrid4);
}
ArrayList storageParm = new ArrayList();//库位
ArrayList matParm = new ArrayList();//材料表
ArrayList statusUpdate = new ArrayList();//质保
ArrayList plnSpale = new ArrayList();//销售合同提报
string storageno = "";
string storagetype = "";
string storagetypedesc = "";
string manageno = "";
string managedesc="";
string strInbound = "800701";//入库类型
string strIndoc = "";//入库单号
string strInMemo = "";
string factoryNo = "";
string factoryCode = "";
string steelCode = "";
string steelName = "";
string sourceCode = "";
string sourceName = "";
string ks = "";
UltraComboEditor ucePro = new UltraComboEditor();
UltraComboEditor uceSpec = new UltraComboEditor();
UltraComboEditor uceSteel = new UltraComboEditor();
UltraComboEditor uceModel = new UltraComboEditor();
UltraComboEditor uceFinished = new UltraComboEditor();
///
/// 初始化
///
///
///
private void frmPipeInTemp_Load(object sender, EventArgs e)
{
//cmbSteel.Enabled = false;
//StartTime.Value =DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
//StartTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01" + " 00:00:00");
StartTime.Value = DateTime.Parse("2015-10-01" + " 00:00:00");
//DateTime.Today.AddDays(-7);
//DateTime.Today.AddDays(-7).ToString("yyyy-MM-dd") + " 00:00:00";
//EndTime.Value = DateTime.Parse(DateTime.Now.AddMonths(1).AddDays(1 - DateTime.Now.Day).ToString("yyyy-MM-dd") + " 23:59:59");
DateTime d1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
EndTime.Value = DateTime.Parse(d1.AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd") + " 23:59:59");
dtBathYear.Value = DateTime.Parse(DateTime.Today.ToString("yyyy-MM"));
//DateTime.Today.AddDays(1).AddSeconds(-1);
//DateTime.Today.ToString("yyyy-MM-dd") + " 23:59:59";
this.StartTime.Enabled = false;
this.EndTime.Enabled = false;
this.ultraCheckEditor5.Checked = true;
InitStorage();
InitBindColumn();
YdmBaseClass.InitComboEditor(uceReson, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
YdmBaseClass.BindColumn(uceReson, "STORAGE_NO", this.Controls, this.ultraGrid2, 0);
YdmBaseClass.InitComboEditor(uceFinished, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFinishedProduct", "BASECODE", this.ob, false);
YdmBaseClass.BindColumn(uceFinished, "FINISHPRO_MOLD", this.Controls, this.ultraGrid2, 0);
//this.ultraGrid4.DisplayLayout.Bands[0].Columns["BAL_YEAR_MONTH"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DateTime;
//this.ultraGrid4.DisplayLayout.Bands[0].Columns["BAL_YEAR_MONTH"].MaskInput = "yyyymm";
this.cmbStorager.Enabled = false;
}
private void InitBindColumn()
{
//材料状态
this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150101", "材料产出等待");
this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150102", "材料管理封锁");
this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150103", "材料质量封锁");
this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150104", "材料可编计划");
this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150105", "材料已编计划");
this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150106", "材料为余材");
this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150201", "材料产出等待(未综合判定)");
this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150202", "材料产出(已综合判定");
this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150203", "材料为余材(已综合判定)");
this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150204", "材料脱单余材(销售组织脱单)");
this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150205", "材料缴库余材(销售组织缴库)");
this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150301", "材料可编提单");
this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150302", "材料已编提单");
this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150303", "销售出厂");
//string[] arr = new string[3] { "801501", "801502", "801503" };
//DataTable dt = ClsLoad.GetValueListDataTable(arr, this.ob);
//this.ultraGrid2.DisplayLayout.Bands[0].Columns["MAT_STATUS"].ValueList = ClsLoad.GeneralValuelist(ref dt, "BASECODE", "BASENAME");
this.ultraGrid2.DisplayLayout.ValueLists[1].ValueListItems.Add("801701", "超合同量");
this.ultraGrid2.DisplayLayout.ValueLists[1].ValueListItems.Add("801702", "无合同");
this.ultraGrid2.DisplayLayout.ValueLists[1].ValueListItems.Add("801703", "按合同");
this.ultraGrid2.DisplayLayout.ValueLists[1].ValueListItems.Add("801704", "退货");
this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801705", "压库");
this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801706", "合同长尺");
this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801707", "合同短尺");
}
///
/// 下拉框绑定数据
///
private void InitStorage()
{
string time = DateTime.Now.ToString();
string time1 = DateTime.Now.AddDays(-15).ToString();
BaseMethod.InitSourse(cmbSource, this.ob);
YdmBaseClass.InitComboEditor(cmbSteel, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getGradeDetail", "GRADECODE", this.ob, false);
//YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFactoryDetail", "PLINE_CODE", this.ob, false);
YdmBaseClass.InitComboEditor(cmbStorager, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
YdmBaseClass.InitComboEditor(cmbStorage, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
//YdmBaseClass.InitComboEditorWithParm(cmbJudge, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStoveNo", "lcode", this.ob, false,new object []{time1,time});
//YdmBaseClass.InitComboEditor(cmbOrder, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getOrderNo", "ORDER_NO", this.ob, false);
YdmBaseClass.InitComboEditor(ucePro, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getKind", "PRODUCCODE", this.ob, true);
YdmBaseClass.InitComboEditor(uceSpec, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSpec", "SPEC_CODE", this.ob, true);
YdmBaseClass.InitComboEditor(uceSteel, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSteel", "STEELCODE", this.ob, true);
YdmBaseClass.InitComboEditor(uceModel, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getModel", "MODEL_CODE", this.ob, true);
YdmBaseClass.BindColumn(ucePro, "CXKIND", this.Controls, ultraGrid1, 0);
YdmBaseClass.BindColumn(uceSpec, "CXGG", this.Controls, ultraGrid1, 0);
YdmBaseClass.BindColumn(uceSteel, "CXSTEELLEVEL", this.Controls, ultraGrid1, 0);
YdmBaseClass.BindColumn(uceModel, "CXTYPEOFTHREAD", this.Controls, ultraGrid1, 0);
}
///
/// 品种维护
///
private void doMaint()
{
FrmVarietie var = new FrmVarietie(ob, "2010-01-01 00:00:00");
var.AutoSize = true;
var.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
var.WindowState = FormWindowState.Maximized;
var.Show();
}
///
/// 数据匹配
///
private void DataMatch()
{
ultraGrid1.UpdateData();
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null) return;
int counm = 0;
string strOrder = "";
string strOrderSeq = "";//合同行号
string strKind = "";//品种
string strTeel = "";//钢级
string strSpec = "";//规格
string strMode = "";//扣型
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
{
counm += 1;
}
}
if (counm == 0)
{
MessageUtil.ShowWarning("请选择需要匹对的质保判定数据!");
return;
}
if (counm > 50)
{
MessageUtil.ShowWarning("一次只能选50条记录进行匹配!");
return;
}
try
{
this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
if (Constant.WaitingForm == null)
{
Constant.WaitingForm = new WaitingForm();
}
Constant.WaitingForm.ShowToUser = true;
Constant.WaitingForm.Show();
Constant.WaitingForm.Update();
string strMatch = "";//是否匹配
ArrayList pram = new ArrayList();
DataTable dtkind = new DataTable();
DataTable dtSteel = new DataTable();
DataTable dtSpec = new DataTable();
DataTable dtModel = new DataTable();
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
{
ArrayList list = new ArrayList();
strOrder = uRow.Cells["ordername"].Text;
//if (YdmBaseClass.WordsIScn(strOrder))
//{
// MessageUtil.ShowTips("合同号有中文字符!");
// break;
//}
//strVarieties = uRow.Cells["kind"].Text + "、" + uRow.Cells["steellevel"].Text + "、" + uRow.Cells["spec"].Text + "、" + uRow.Cells["typeofThread"].Text;
//strKind = uRow.Cells["KIND"].Text.Trim();
//strTeel = uRow.Cells["STEELLEVEL"].Text.Trim();
//strSpec = uRow.Cells["GG"].Text.Trim();
//strMode = uRow.Cells["TYPEOFTHREAD"].Text.Trim();
#region 物料对应
ArrayList listSave = new ArrayList();
listSave.Clear();
listSave.Add(uRow.Cells["kind"].Text);
dtkind.Clear();
dtkind = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQueryKind1", new object[] { listSave }, this.ob);
if (dtkind.Rows.Count > 0)
{
strKind = dtkind.Rows[0]["PRODUCCODE"].ToString().Trim();
}
else
{
strKind = "";
}
listSave.Clear();
listSave.Add(uRow.Cells["steellevel"].Text);
dtSteel.Clear();
dtSteel = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQuerySteel1", new object[] { listSave }, this.ob);
if (dtSteel.Rows.Count > 0)
{
strTeel = dtSteel.Rows[0]["STEELCODE"].ToString().Trim();
}
else
{
strTeel = "";
}
listSave.Clear();
listSave.Add(uRow.Cells["GG"].Text);
dtSpec.Clear();
dtSpec = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQuerySpec1", new object[] { listSave }, this.ob);
if (dtSpec.Rows.Count > 0)
{
strSpec = dtSpec.Rows[0]["SPEC_CODE"].ToString().Trim();
}
else
{
strSpec = "";
}
listSave.Clear();
if (uRow.Cells["typeofThread"].Text.Trim() == "")
{
listSave.Add("/");
}
else
{
listSave.Add(uRow.Cells["typeofThread"].Text);
}
dtModel.Clear();
dtModel = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQueryModel1", new object[] { listSave }, this.ob);
if (dtModel.Rows.Count > 0)
{
strMode = dtModel.Rows[0]["MODEL_CODE"].ToString().Trim();
}
else
{
strMode = "";
}
#endregion
if (strKind != "" && strTeel != "" && strSpec != "" && strMode != "")
{
strMatch = "01";//(物料匹配)
}
else
{
strMatch = "02";//(物料不匹配)
}
list.Add(strMatch);
list.Add(strKind);
list.Add(strTeel);
list.Add(strSpec);
list.Add(strMode);
list.Add(uRow.Cells["rcdid"].Text);
list.Add(uRow.Cells["lcode"].Text);
list.Add(uRow.Cells["lotno"].Text);
list.Add(uRow.Cells["ordername"].Text);
pram.Add(list);
}
}
int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getUpdateZbMatch", new object[] { pram }, this.ob);
this.Cursor = Cursors.Default;
Constant.WaitingForm.ShowToUser = false;
Constant.WaitingForm.Close();
Constant.WaitingForm = null;
QueryMatData();
}
catch (Exception e)
{
this.Cursor = Cursors.Default;
Constant.WaitingForm.ShowToUser = false;
Constant.WaitingForm.Close();
Constant.WaitingForm = null;
}
}
///
/// 合同查询
///
private void QueryOrder()
{
string strStratTime = "";
string strEndTime = "";
string orderno = "";
string orderSeq = "";
if (this.ultraCheckEditor5.Checked)
{
if (DateTime.Parse(StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
{
MessageUtil.ShowTips("开始时间不能大于结束时间!");
return;
}
else
{
strStratTime = StartTime.Value.ToString();
strEndTime = EndTime.Value.ToString();
}
}
if (chkOrder.Checked)
{
if (cmbOrder.Text.Trim() != "")
{
orderno = cmbOrder.Text.Trim();
int dex = orderno.IndexOf("/");
if (dex > 0)
{
orderno = orderno.Substring(0, dex);
orderSeq = cmbOrder.Text.Trim().Substring(dex + 1);
if (orderSeq.Length < 3)
{
orderSeq = orderSeq.PadLeft(3, '0');
}
}
}
else
{
MessageUtil.ShowTips("请选择合同号!");
return;
}
}
//string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,this.ob);
string[] arr = this.ValidDataPurviewIds;
DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrder", new Object[] { orderno, orderSeq, arr }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid3.DisplayLayout.Bands[0].Columns["LEN_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["PSC_DESC"],
ultraGrid3.DisplayLayout.Bands[0].Columns["MSC_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["STD_NAME"] };
GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid3, col);
this.ultraGrid3.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
}
///
/// 材料查询
///
private void QueryMatData()
{
string judgetimeStart = ""; //判定起始时间
string judgetimeEnd = ""; //判定结束时间
string stoveno = ""; //炉号
string batchno = ""; //批号
string order = "";
string stu="";//匹配状态
string departNo = ClsBaseInfo.GetDepartIdBySectionId(UserInfo.GetDeptid(), this.ob);
string departMent = "";
if (chkJudge.Checked)
{
if (this.cmbJudge.Text == "")
{
MessageUtil.ShowTips("请选择炉号!");
return;
}
else
{
stoveno = cmbJudge.Text.Trim();
}
}
if (chkOrder.Checked)
{
if (this.cmbOrder.Text == "")
{
MessageUtil.ShowTips("请选择合同号!");
return;
}
else
{
order = cmbOrder.Text.Trim();
}
}
if (this.ultraCheckEditor5.Checked)
{
if (DateTime.Parse(StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
{
MessageUtil.ShowTips("开始时间不能大于结束时间!");
return;
}
else
{
judgetimeStart= StartTime.Value.ToString();
judgetimeEnd = EndTime.Value.ToString();
}
}
else
{
if (this.cmbOrder.Text == "" && this.cmbJudge.Text == "")
{
MessageUtil.ShowTips("炉号或者合同号条件需要选择一个!");
return;
}
}
if (ultraCheckEditor1.Checked && cmbMatch.Text.Trim() != "")
{
stu=cmbMatch.Value.ToString();
}
//if (YdmBaseClass.getMonth(DateTime.Parse(StartTime.Value.ToString()), DateTime.Parse(EndTime.Value.ToString()))>1)
//{
// MessageUtil.ShowTips("请选择一个月之内的时间!");
// return;
//}
ArrayList list = new ArrayList();
list.Add(judgetimeStart);
list.Add(judgetimeEnd);
list.Add(stoveno);
//list.Add(batchno);
list.Add(order);
list.Add(stu);
string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, this.ob);
//string[] _arr = new string[3];
//string sore = "";
//for (int i = 0; i < arr.Length; i++)
//{
// sore = arr[i];
// if (sore.Equals("100101") || sore.Equals("100102"))
// {
// sore = "";
// }
// else if (sore.Equals("100103"))
// {
// sore = "国贸";
// }
//}
try
{
this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
if (Constant.WaitingForm == null)
{
Constant.WaitingForm = new WaitingForm();
}
Constant.WaitingForm.ShowToUser = true;
Constant.WaitingForm.Show();
Constant.WaitingForm.Update();
DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryMatData", new Object[] { list, arr }, this.ob);//MatData
//if (dt.Rows.Count > 0)
//{
// for (int i = 0; i < dt.Rows.Count; i++)
// {
// if (dt.Rows[i]["CXSTUPP"].ToString() == "物料不匹配")
// {
// this.ultraGrid1.DisplayLayout.Bands[i].Columns["CXSTUPP"].ce.CellAppearance.BackColor = Color.Red;
// }
// }
//}
GridHelper.CopyDataToDatatable(ref dt, ref dataTable3, true);
// UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid1.DisplayLayout.Bands[0].Columns["remark"], ultraGrid1.DisplayLayout.Bands[0].Columns["standard"]
//,ultraGrid1.DisplayLayout.Bands[0].Columns["testidea"] };
// GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, col);
// this.ultraGrid1.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
this.Cursor = Cursors.Default;
Constant.WaitingForm.ShowToUser = false;
Constant.WaitingForm.Close();
Constant.WaitingForm = null;
}
catch (Exception e)
{
this.Cursor = Cursors.Default;
Constant.WaitingForm.ShowToUser = false;
Constant.WaitingForm.Close();
Constant.WaitingForm = null;
}
this.chkAll.Checked = false;
}
///
/// 把负质保数据置走
///
private void updateStaus()
{
ultraGrid1.UpdateData();
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null) return;
int m = 0;
foreach (UltraGridRow uRow in ultraGrid1.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
{
if (!(uRow.Cells["hgunit"].Text.Contains("-")) && !(uRow.Cells["hgunit"].Text == "") && !(uRow.Cells["hgweight"].Text.Contains("-")) && !(uRow.Cells["hgweight"].Text == ""))
{
m++;
}
}
}
if(m>0)
{
MessageUtil.ShowTips("不允许剔除正常的质保数据!");
return;
}
ArrayList parm = new ArrayList();
foreach (UltraGridRow uRow in ultraGrid1.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHK"].Value))
{
ArrayList list = new ArrayList();
list.Add(uRow.Cells["rcdid"].Value.ToString());
parm.Add(list);
}
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
ccp.MethodName = "updateStaus";
ccp.ServerParams = new object[] { parm };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("剔除成功!"))
{
QueryMatData();
}
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
///
/// 强制缴库
///
private void DoForcePipeIn()
{
ultraGrid3.UpdateData();
ultraGrid1.UpdateData();
storageParm = new ArrayList();
matParm = new ArrayList();
statusUpdate = new ArrayList();
plnSpale = new ArrayList();
ArrayList listdt = new ArrayList();
int conu = 0;
string buttonValue = "";//返回的按钮值
string frmcount = "";//返回的支数
string frmWgt = "";//返回的重量值
string frmFinishedCode = "";
int count = 0;
UltraGridRow ugr3 = ultraGrid3.ActiveRow;
UltraGridRow row = ultraGrid1.ActiveRow;
//if (ugr3 == null) { MessageUtil.ShowTips("待缴库无数据,不能进行此操作"); return; }
if (row == null) { MessageUtil.ShowTips("无质保判定炉信息,不能进行此操作"); return; }
string[] arr = this.ValidDataPurviewIds;
double strWgt = 0;//炉重
double endWgt = 0;//已缴库量
double orderWgt = 0;//合同量
int m = 0;
int number = 0;
string orderType = "";
foreach (UltraGridRow row5 in ultraGrid3.Rows)
{
if (Convert.ToBoolean(row5.Cells["CHK"].Text) == true)
{
number++;
}
}
foreach (UltraGridRow row1 in ultraGrid1.Rows)
{
if (Convert.ToBoolean(row1.Cells["CHK"].Text) == true)
{
if (row1.Cells["hgweight"].Text == "")
{
MessageUtil.ShowTips("该炉还未生产,无法缴库!");
return;
}
if (double.Parse(row1.Cells["hgweight"].Text) < 0)
{
MessageUtil.ShowWarning("已缴库量无法进行冲销!");
return;
}
strWgt += double.Parse(row1.Cells["hgweight"].Value.ToString());
m++;
}
}
if (m < 1)
{
MessageUtil.ShowTips("请勾选需要强制缴库的质保数据!");
return;
}
if (m > 1)
{
MessageUtil.ShowTips("缴库时不允许多炉同时缴库!");
return;
}
//endWgt = double.Parse(ugr3.Cells["PAYDOWNWEIGHT"].Value.ToString());
//orderWgt = double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString());
//string strRANGE_MIN = ugr3.Cells["DELVRY_RANGE_MIN"].Text.Trim();//交货量差下限
//string strRANGE_MAX = ugr3.Cells["DELVRY_RANGE_MAX"].Text.Trim();//交货量差上限
//double dbQtyMin = double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) - double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) * (double.Parse(strRANGE_MIN) / 100);//交货量差下限值
//double dbQtyMax = double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) + double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//交货量差上限值
string _length = "";//长度范围
int d = 0;
double downLength = 0;//下限
double upLength = 0;//上限
DataTable ds = new DataTable();
string prouceName = "";//品名
string steelLev = "";//钢级
string guige = "";//规格
string modelDesc = "";//扣型
DataTable dtOrder = new DataTable();
string ordername = "";//判定数据合同号
string orderNo = "";//判定数据拆分合同号
string orderSeQ = "";//判定数据拆分合同行号
string[] wgtList = new string[3];
int dex = 0;
string orderUnit = "";//长度单位
double reckonWgt = 0;//估算量上限
string gSwgt = "";//合同估算总量
string pipSwgt = "";//合同缴库总量
string dSwgt = "";//订货总量
foreach (UltraGridRow row2 in ultraGrid1.Rows)
{
if (Convert.ToBoolean(row2.Cells["CHK"].Text) == true)
{
if (row2.Cells["CXSTUPP"].Text.Trim() == "")
{
MessageUtil.ShowTips("您选择的质保信息未匹配,不能进行缴库!");
return;
}
ds.Clear();
ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSqlServerStaus", new object[] { row2.Cells["ordername"].Text.Trim(), row2.Cells["lcode"].Text.Trim(), row2.Cells["lotno"].Text.Trim(), row2.Cells["hgunit"].Text.Trim(), row2.Cells["hgweight"].Text.Trim(), row2.Cells["rcdid"].Text.Trim() }, this.ob);
if (ds.Rows[0][0].ToString() == "20")
{
MessageUtil.ShowTips("您选中的【" + row2.Cells["lcode"].Text.Trim() + "】这炉已缴库,请重新选择!");
return;
}
ordername = row2.Cells["ordername"].Text.Trim();
if (!ordername.Contains("/"))
{
MessageUtil.ShowTips("此判定数据合同号异常,不允许缴库!");
return;
}
dex = ordername.IndexOf("/");
orderNo = ordername.Substring(0, dex);
orderSeQ = ordername.Substring(dex + 1).PadLeft(4, '0');
DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrder1", new object[] { orderNo, orderSeQ }, this.ob);
if (dt.Rows.Count > 0)
{
if (dt.Rows[0]["ORDER_UNIT"].ToString().Equals("吨") || dt.Rows[0]["ORDER_UNIT"].ToString().Equals("支"))
{
if (double.Parse(dt.Rows[0]["PAYDOWNWEIGHT"].ToString()) < (double.Parse(dt.Rows[0]["ORDER_QTY"].ToString()) + double.Parse(dt.Rows[0]["ORDER_QTY"].ToString()) * (double.Parse(dt.Rows[0]["DELVRY_RANGE_MAX"].ToString()) / 100)))
{
MessageUtil.ShowTips("此判定物料有对应合同号合同行号数据存在,不允许强制缴库!");
return;
}
}
else if (dt.Rows[0]["ORDER_UNIT"].ToString().Equals("英尺") || dt.Rows[0]["ORDER_UNIT"].ToString().Equals("米"))
{
if (double.Parse(dt.Rows[0]["PAYDOWNWEIGHT"].ToString()) < (double.Parse(dt.Rows[0]["ORDERWEIGHT"].ToString()) + double.Parse(dt.Rows[0]["ORDERWEIGHT"].ToString()) * (double.Parse(dt.Rows[0]["DELVRY_RANGE_MAX"].ToString()) / 100)))
{
MessageUtil.ShowTips("此判定物料有对应合同号合同行号数据存在,不允许强制缴库!");
return;
}
}
}
else
{
ArrayList list = new ArrayList();
prouceName = row2.Cells["cxkind"].Text.Trim();
steelLev = row2.Cells["cxsteellevel"].Text.Trim();
guige = row2.Cells["cxstandard"].Text.Trim();
modelDesc = row2.Cells["cxtypeofthread"].Text.Trim();
list.Add(prouceName);
list.Add(steelLev);
list.Add(guige);
list.Add(modelDesc);
dtOrder = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getMatchOrderNo", new object[] { list}, this.ob);
if (dtOrder.Rows.Count > 0)
{
for (int i = 0; i < dtOrder.Rows.Count; i++)
{
if (dtOrder.Rows[i]["ORDER_NO"].ToString() == orderNo && int.Parse(dtOrder.Rows[i]["ORDER_SEQ"].ToString()) == int.Parse(orderSeQ))
{
if (dt.Rows[0]["ORDER_UNIT"].ToString().Equals("吨") || dt.Rows[0]["ORDER_UNIT"].ToString().Equals("支"))
{
if (double.Parse(dt.Rows[0]["PAYDOWNWEIGHT"].ToString()) < (double.Parse(dt.Rows[0]["ORDER_QTY"].ToString()) + double.Parse(dt.Rows[0]["ORDER_QTY"].ToString()) * (double.Parse(dt.Rows[0]["DELVRY_RANGE_MAX"].ToString()) / 100)))
{
MessageUtil.ShowTips("当前判定合同【" + ordername + "】在产销系统中有对应合同,需正常缴库!");
return;
}
}
else if (dt.Rows[0]["ORDER_UNIT"].ToString().Equals("英尺") || dt.Rows[0]["ORDER_UNIT"].ToString().Equals("米"))
{
if (double.Parse(dt.Rows[0]["PAYDOWNWEIGHT"].ToString()) < (double.Parse(dt.Rows[0]["ORDERWEIGHT"].ToString()) + double.Parse(dt.Rows[0]["ORDERWEIGHT"].ToString()) * (double.Parse(dt.Rows[0]["DELVRY_RANGE_MAX"].ToString()) / 100)))
{
MessageUtil.ShowTips("当前判定合同【" + ordername + "】在产销系统中有对应合同,需正常缴库!");
return;
}
}
}
}
}
}
}
}
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row3 in ultraGrid1.Rows)
{
if (Convert.ToBoolean(row3.Cells["CHK"].Text) == true)
{
if (double.Parse(row3.Cells["hgweight"].Text.Trim()) < 0)
{
if (double.Parse(row3.Cells["hgweight"].Text.Trim()) + double.Parse(ugr3.Cells["PAYDOWNWEIGHT"].Text.Trim()) < 0)
{
MessageUtil.ShowTips("冲销的重量不能比已缴库重量大!");
return;
}
else
{
if (int.Parse(row3.Cells["hgunit"].Text.Trim()) > int.Parse(ugr3.Cells["PAYDOWN_NUM"].Text.Trim()))
{
MessageUtil.ShowTips("冲销支数不能比已缴库支数多!");
return;
}
}
}
}
}
if (cmbStorage.SelectedItem == null)
{
MessageBox.Show("请选择要存放的仓库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
else
{
storageno = this.cmbStorage.Value.ToString();
}
if (this.cmbFactory.Text.ToString() == "")
{
//MessageUtil.ShowTips("产线不允许为空!");
//return;
factoryCode = "";
factoryNo = "";
}
else
{
factoryCode = this.cmbFactory.Value.ToString();
factoryNo = this.cmbFactory.Text.ToString();
}
//if (this.cmbSteel.Text.ToString() == "")
//{
// //MessageUtil.ShowTips("钢种不允许为空!");
// //return;
// steelCode = "";
// steelName = "";
//}
//else
//{
// steelCode = this.cmbSteel.Value.ToString();
// steelName = this.cmbSteel.Text.ToString();
//}
if (this.cmbSource.Text.ToString() == "")
{
sourceCode = "";
sourceName = "";
}
else
{
sourceCode = this.cmbSource.Value.ToString();
sourceName = this.cmbSource.Text.ToString();
}
if (this.txt_Ks.Value == null)
{
ks = "0";
}
else
{
ks = this.txt_Ks.Value.ToString();
}
string strOrder = "";
if (ugr3 != null)
{
strOrder = ugr3.Cells["ORDER_NO"].Text.Trim() + "/" + ugr3.Cells["ORDER_SEQ"].Text.Trim().PadLeft(4,'0');
}
double delPla = 0;//已缴库量
UltraGridRow[] rows = ultraGrid3.Rows.AsQueryable().Where(a => bool.Parse(a.Cells["CHK"].Value.ToString()))
.OrderBy(a => a.Cells["DELIVERY_NO"].Value.ToString()).ToArray();
double dbDelvry = 0;
double dbweigh = 0;
double dbcount = 0;
double endweigth = 0;
string strRANGE_MIN = "";
string strRANGE_MAX = "";
double dbQtyMin = 0;
double dbQtyMax = 0;
double dbJhMax = 0;
#region 强制缴库有合同时
if (number > 0)
{
UltraGridRow grid3Row =null;
foreach (UltraGridRow row6 in ultraGrid3.Rows)
{
if (Convert.ToBoolean(row6.Cells["CHK"].Text) == true)
{
//if (row6.Cells["PORDERSTATUS"].Text.Trim().Equals("生产中"))
//{
// MessageUtil.ShowTips("待缴库合同在生产中,不能进行强制缴库!");
// return;
//}
if (row6.Cells["MATCHORDER"].Text.Trim().Contains("合同物料不匹配"))
{
MessageUtil.ShowTips("物料不匹配不允许缴库!");
return;
}
orderUnit = row6.Cells["ORDER_UNIT"].Text.Trim();
endWgt = double.Parse(row6.Cells["PAYDOWNWEIGHT"].Value.ToString());
orderWgt = double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString());
strRANGE_MIN = row6.Cells["DELVRY_RANGE_MIN"].Text.Trim();//交货量差下限
strRANGE_MAX = row6.Cells["DELVRY_RANGE_MAX"].Text.Trim();//交货量差上限
dbQtyMin = double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) - double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MIN) / 100);//合同行下限值
dbQtyMax = double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//合同行上限值
dbJhMax = double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(row6.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//交货量差上限值
wgtList = getOrderWgt(row6.Cells["ORDER_NO"].Text.ToString());
if (wgtList.Length > 0)
{
gSwgt = wgtList[0];
pipSwgt = wgtList[1];
dSwgt = wgtList[2];
}
grid3Row = row6;
}
}
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
{
ArrayList matList = new ArrayList();
ArrayList plnList = new ArrayList();
//if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米") || grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
//{
// if (uRow.Cells["hgm"].Text.Trim() == "")
// {
// MessageUtil.ShowTips("此合同不是按吨交货,长度为空不能缴库!");
// return;
// }
//}
orderType = doQueryOrderType(uRow.Cells["ordername"].Text.Trim().Substring(0, uRow.Cells["ordername"].Text.Trim().IndexOf("/")));
if (orderType.Equals("120103"))
{
MessageUtil.ShowTips("该合同为研发合同,不允许缴库!");
return;
}
else if (orderType.Equals("120104"))
{
MessageUtil.ShowTips("该合同为预排合同,只允许缴库成成品!");
return;
}
_length = uRow.Cells["leng"].Text.Trim();
if (_length != "")
{
d = _length.IndexOf("-");
downLength = double.Parse(_length.Substring(0, d));
upLength = double.Parse(_length.Substring(d + 1));
if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米"))
{
if (!(compareToValue(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim()), double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim()), downLength) && compareToValue(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim()), double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim()), upLength)))
{
if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + uRow.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + grid3Row.Cells["LEN"].Text + "】,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
else if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
{
if (!(compareToValue(FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())), FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())), downLength) && compareToValue(FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())), FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())), upLength)))
{
if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())).ToString() + "-" + FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())).ToString() + "】(英尺换算),是否缴库?") == DialogResult.No)
{
return;
}
}
}
}
else
{
MessageUtil.ShowTips("强制缴库到对应合同中,长度上下限不允许为空!");
return;
}
if (strWgt > 0)
{
if (orderUnit.Equals("吨") || orderUnit.Equals("支"))
{
if (endWgt > dbJhMax)
{
//MessageUtil.ShowTips("此合同行缴库量已超出交货量上限,不允许缴库!");
//return;
if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
{
return;
}
}else
{
if ((strWgt + endWgt) > dbJhMax)
{
frmBatchesPip frm = new frmBatchesPip(ob);
frm.AllCount = uRow.Cells["hgunit"].Text.Trim();
frm.AllWgt = uRow.Cells["hgweight"].Text.Trim();
frm.SxWgt = (dbQtyMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
frm.ShowDialog();
buttonValue = frm.buttonValue;
frmcount = frm.count;
frmWgt = frm.outWgt;
frmFinishedCode = frm.finishedProduct;
if (!frm.flag)
{
return;
}
if (buttonValue == "0")
{
return;
}
if (buttonValue == "2")
{
if (int.Parse(frmcount) > int.Parse(uRow.Cells["hgunit"].Text.Trim()))
{
MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
return;
}
if (double.Parse(frmWgt) + endWgt > dbJhMax)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
{
return;
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
if (buttonValue == "1")
{
if ((strWgt + endWgt) > dbJhMax)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
}
}
else if (orderUnit.Equals("英尺") || orderUnit.Equals("米"))
{
if (grid3Row.Cells["ORDERWEIGHT"].Value.ToString() == "")
{
MessageUtil.ShowTips("此合同【" + strOrder + "】是以英尺为交货单位!,估算量为空不能缴库!");
return;
}
reckonWgt = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//估算量上限
if (endWgt > reckonWgt)
{
//MessageUtil.ShowTips("此合同行缴库量已超出交货量上限,不允许缴库!");
//return;
if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
{
return;
}
}else
{
if ((strWgt + endWgt) > reckonWgt)
{
frmBatchesPip frm = new frmBatchesPip(ob);
frm.AllCount = uRow.Cells["hgunit"].Text.Trim();
frm.AllWgt = uRow.Cells["hgweight"].Text.Trim();
frm.SxWgt = (reckonWgt - double.Parse(ugr3.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
frm.ShowDialog();
buttonValue = frm.buttonValue;
frmcount = frm.count;
frmWgt = frm.outWgt;
frmFinishedCode = frm.finishedProduct;
if (!frm.flag)
{
return;
}
if (buttonValue == "0")
{
return;
}
if (buttonValue == "2")
{
if (int.Parse(frmcount) > int.Parse(row.Cells["hgunit"].Text.Trim()))
{
MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
return;
}
if (double.Parse(frmWgt) + endWgt > reckonWgt)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
{
return;
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
if (buttonValue == "1")
{
if ((strWgt + endWgt) > reckonWgt)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
}
}
}
}
double stWeight = double.Parse(uRow.Cells["hgweight"].Value.ToString());//炉(重量)
double dbunit = double.Parse(uRow.Cells["hgunit"].Value.ToString());//炉(支数)
ArrayList storageList = new ArrayList(); //仓库位置参数
storageList.Add(uRow.Cells["lcode"].Text.Trim());
storageList.Add(uRow.Cells["lotno"].Text.Trim());
storageList.Add(uRow.Cells["hgunit"].Text.Trim());
storageList.Add(storageno);
storageList.Add(storageno + "10101");
storageList.Add(storagetype);
storageList.Add(storagetypedesc);
//storageList.Add(manageno);
//storageList.Add(managedesc);
storageList.Add(this.UserInfo.GetUserName());
storageList.Add(uRow.Cells["hgweight"].Value.ToString());
storageList.Add(this.UserInfo.GetDeptid());
storageList.Add(this.UserInfo.GetDepartment());
storageList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
storageList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
storageParm.Add(storageList);
#region 要缴库的每一炉重量小于要缴库的重量
matList.Add(uRow.Cells["lcode"].Text.Trim()); //炉号
matList.Add(uRow.Cells["lotno"].Text.Trim());//批号
matList.Add(uRow.Cells["hgunit"].Text.Trim());//支数
matList.Add(grid3Row.Cells["PRODUCCODE"].Value.ToString());//品名代码
matList.Add(grid3Row.Cells["PRODUCNAME"].Value.ToString());//品名名称
if (uRow.Cells["cxsteellevel"].Text == "N80Q")
{
matList.Add(uRow.Cells["cxsteellevel"].Value.ToString());
matList.Add(uRow.Cells["cxsteellevel"].Text);
}
else
{
matList.Add(grid3Row.Cells["STEELCODE"].Value.ToString());//钢级(牌号)代码
matList.Add(grid3Row.Cells["STEELNAME"].Value.ToString());//钢级名称
}
matList.Add(grid3Row.Cells["SPEC_CODE"].Value.ToString());//产品规格代码
matList.Add(grid3Row.Cells["SPEC_NAME"].Value.ToString());//产品规格描述
matList.Add(grid3Row.Cells["MODEL_CODE"].Value.ToString());//扣型代码
matList.Add(grid3Row.Cells["MODEL_DESC"].Value.ToString());//扣型描述 10
matList.Add(grid3Row.Cells["STD_CODE"].Value.ToString());//标准代码
matList.Add(grid3Row.Cells["STD_NAME"].Value.ToString());//标准名称
matList.Add(grid3Row.Cells["CREATE_DEPT"].Value.ToString());
matList.Add(grid3Row.Cells["DEPARTNAME"].Value.ToString());
matList.Add(grid3Row.Cells["STD_STYLE"].Value.ToString());//标准类别代码
matList.Add(grid3Row.Cells["STD_STYLE_DESC"].Value.ToString());//标准类别描述
matList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());//合同号
matList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());//合同行号
matList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());//交货行号
matList.Add(grid3Row.Cells["ORD_PK"].Value.ToString());//合同主键
matList.Add(grid3Row.Cells["ORD_LN_PK"].Value.ToString());//合同行主键
matList.Add(grid3Row.Cells["ORD_LN_DLY_PK"].Value.ToString());//交货行主键
matList.Add(grid3Row.Cells["DIMATER"].Value.ToString());// 外径
matList.Add(grid3Row.Cells["HEIGHT"].Value.ToString());//壁厚
matList.Add(grid3Row.Cells["LEN_NO"].Value.ToString());//长度编码(订货)
matList.Add(grid3Row.Cells["LEN_DESC"].Value.ToString());//长度描述(订货)
matList.Add(grid3Row.Cells["LEN_UNIT"].Value.ToString());//长度单位 27
string length = uRow.Cells["leng"].Text.Trim();
if (length != "")
{
int n = length.IndexOf("-");
string lengMin = length.Substring(0, n);
string lengMax = length.Substring(n + 1);
matList.Add(lengMin);//下限
matList.Add(lengMax);//上限
}
else
{
matList.Add("");//下限
matList.Add("");//上限
}
matList.Add(this.UserInfo.GetUserName());//操作人
matList.Add("0");
matList.Add("1");
matList.Add(uRow.Cells["testidea"].Value.ToString());//备注
matList.Add(uRow.Cells["HGWEIGHT"].Value.ToString());
double weight = Convert.ToDouble(uRow.Cells["HGWEIGHT"].Value.ToString());
double unit = Convert.ToDouble(uRow.Cells["HGUNIT"].Value.ToString());
DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
if (dtMemo.Rows.Count >= 1)
{
strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
}
//strIndoc = PipeManageClass.NextNumber(str, strInMemo, "00001");
matList.Add(strInMemo);
matList.Add(this.UserInfo.GetDeptid());
matList.Add(this.UserInfo.GetDepartment());//37
matList.Add(strInbound);
matList.Add(this.cmbStorage.Value.ToString());//仓库号
matList.Add(grid3Row.Cells["SALE_ORG"].Value.ToString());
matList.Add(grid3Row.Cells["SALE_ORG_DESC"].Value.ToString());
if (buttonValue == "2")
{
matList.Add(frmcount);//42
}
else
{
matList.Add(uRow.Cells["hgunit"].Value.ToString());
}
// matList.Add(uRow.Cells["hgunit"].Value.ToString());
matList.Add(uRow.Cells["rcdid"].Value.ToString());
matList.Add(uRow.Cells["hgm"].Value.ToString());//长度
matList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
matList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
matList.Add(uRow.Cells["standard"].Value.ToString());//判定标准
//matList.Add(uRow.Cells["testdate"].Value.ToString().Substring(0, 4) + row.Cells["testdate"].Value.ToString().Substring(5, 2));//判定时间
matList.Add(uRow.Cells["testdate"].Value.ToString());//判定时间
matList.Add(factoryCode);
matList.Add(factoryNo);
//matList.Add(steelCode);
//matList.Add(steelName);
matList.Add("");
matList.Add(uRow.Cells["steelgrade"].Text.ToString());
matList.Add(this.txtMemo.Text.Trim());
matList.Add(uRow.Cells["ordername"].Value.ToString());//质保合同号
matList.Add(sourceCode);//材料来源代码
matList.Add(sourceName);//材料名称
matList.Add(ks);
if (buttonValue == "1")
{
matList.Add("801703");//成品区分
}
else if (buttonValue == "2")
{
matList.Add("801701");//成品区分
}
matParm.Add(matList);
plnList.Add(stWeight.ToString("f3"));
plnList.Add(dbunit.ToString());
plnList.Add(this.UserInfo.GetUserName());
plnList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());
plnList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());
plnList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());
plnSpale.Add(plnList);
//break;
#endregion
ArrayList statusList = new ArrayList();
statusList.Add(uRow.Cells["lcode"].Text.Trim());
statusList.Add(uRow.Cells["lotno"].Text.Trim());
statusList.Add(uRow.Cells["factory"].Value.ToString());
statusList.Add(uRow.Cells["testdate"].Value.ToString());
statusList.Add(uRow.Cells["hgunit"].Value.ToString()); //支数
statusList.Add(uRow.Cells["hgweight"].Value.ToString());//重量
statusList.Add(uRow.Cells["RCDID"].Value.ToString());
statusUpdate.Add(statusList);
}
}
}
#endregion
else
{
#region 无合同时
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
{
orderType = doQueryOrderType(uRow.Cells["ordername"].Text.Trim().Substring(0, uRow.Cells["ordername"].Text.Trim().IndexOf("/")));
if (orderType.Equals("120103"))
{
MessageUtil.ShowTips("该合同为研发合同,不允许缴库!");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("此炉号【" + uRow.Cells["lcode"].Text.Trim() + "】是否全部缴库为计划外的成品?") == DialogResult.No)
{
return;
}
ArrayList matList = new ArrayList();
ArrayList plnList = new ArrayList();
double stWeight = double.Parse(uRow.Cells["hgweight"].Value.ToString());//炉(重量)
double dbunit = double.Parse(uRow.Cells["hgunit"].Value.ToString());//炉(支数)
ArrayList storageList = new ArrayList(); //仓库位置参数
storageList.Add(uRow.Cells["lcode"].Value.ToString());
storageList.Add(uRow.Cells["lotno"].Value.ToString());
storageList.Add(uRow.Cells["hgunit"].Value.ToString());
storageList.Add(storageno);
storageList.Add(storageno + "10101");
storageList.Add(storagetype);
storageList.Add(storagetypedesc);
//storageList.Add(manageno);
//storageList.Add(managedesc);
storageList.Add(this.UserInfo.GetUserName());
storageList.Add(uRow.Cells["hgweight"].Value.ToString());
storageList.Add(this.UserInfo.GetDeptid());
storageList.Add(this.UserInfo.GetDepartment());
storageList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
storageList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
storageParm.Add(storageList);
#region 要缴库的每一炉重量小于要缴库的重量
matList.Add(uRow.Cells["lcode"].Value.ToString()); //炉号
matList.Add(uRow.Cells["lotno"].Value.ToString());//批号
matList.Add(uRow.Cells["hgunit"].Value.ToString());//支数
matList.Add(uRow.Cells["cxkind"].Value.ToString());//品名代码
matList.Add(uRow.Cells["cxkind"].Text.ToString());//品名名称
matList.Add(uRow.Cells["cxsteellevel"].Value.ToString());//钢级(牌号)代码
matList.Add(uRow.Cells["cxsteellevel"].Text.ToString());//钢级名称
matList.Add(uRow.Cells["cxgg"].Value.ToString());//产品规格代码
matList.Add(uRow.Cells["cxgg"].Text.ToString());//产品规格描述
matList.Add(uRow.Cells["cxtypeofthread"].Value.ToString());//扣型代码
matList.Add(uRow.Cells["cxtypeofthread"].Text.ToString());//扣型描述 10
matList.Add("");//标准代码
matList.Add("");//标准名称
matList.Add("");
matList.Add("");
matList.Add("");//标准类别代码
matList.Add(uRow.Cells["STDSTYLE"].Value.ToString());//标准类别描述
matList.Add("");//合同号
matList.Add("");//合同行号
matList.Add("");//交货行号
matList.Add("");//合同主键
matList.Add("");//合同行主键
matList.Add("");//交货行主键
DataTable ts = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getDiamter", new object[] { uRow.Cells["cxgg"].Value.ToString() }, this.ob);
if (ts.Rows.Count > 0)
{
matList.Add(ts.Rows[0]["DIMATER"].ToString());// 外径
matList.Add(ts.Rows[0]["HEIGHT"].ToString());//壁厚
}
else
{
MessageUtil.ShowTips("此产品规格【" + uRow.Cells["cxgg"].Value.ToString() + "】未维护外径壁厚,无法缴库");
return;
}
matList.Add("");//长度编码(订货)
matList.Add("");//长度描述(订货)
matList.Add("");//长度单位 27
string length = row.Cells["leng"].Text.Trim();
if (length != "")
{
int n = length.IndexOf("-");
string lengMin = length.Substring(0, n);
string lengMax = length.Substring(n + 1);
matList.Add(lengMin);//下限
matList.Add(lengMax);//上限
}
else
{
matList.Add("");//下限
matList.Add("");//上限
}
matList.Add(this.UserInfo.GetUserName());//操作人
matList.Add("0");
matList.Add("1");
matList.Add(uRow.Cells["testidea"].Value.ToString());//备注
matList.Add(uRow.Cells["HGWEIGHT"].Value.ToString());
double weight = Convert.ToDouble(uRow.Cells["HGWEIGHT"].Value.ToString());
double unit = Convert.ToDouble(uRow.Cells["HGUNIT"].Value.ToString());
DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
if (dtMemo.Rows.Count >= 1)
{
strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
}
//strIndoc = PipeManageClass.NextNumber(str, strInMemo, "00001");
matList.Add(strInMemo);
matList.Add(this.UserInfo.GetDeptid());
matList.Add(this.UserInfo.GetDepartment());//37
matList.Add(strInbound);
matList.Add(this.cmbStorage.Value.ToString());//仓库号
if (uRow.Cells["DEPARTM"].Text.ToString().Contains("国贸"))
{
matList.Add("100102");//销售组织代码
matList.Add("国贸公司");
}
else
{
matList.Add("100101");//销售组织代码
matList.Add("销售公司");
}
matList.Add(uRow.Cells["hgunit"].Value.ToString());
matList.Add(uRow.Cells["rcdid"].Value.ToString());
matList.Add(uRow.Cells["hgm"].Value.ToString());//长度
matList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
matList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
matList.Add(uRow.Cells["standard"].Value.ToString());//判定标准
//matList.Add(uRow.Cells["testdate"].Value.ToString().Substring(0, 4) + uRow.Cells["testdate"].Value.ToString().Substring(5, 2));//判定时间
matList.Add(uRow.Cells["testdate"].Value.ToString());//判定时间
matList.Add(factoryCode);
matList.Add(factoryNo);
//matList.Add(steelCode);
//matList.Add(steelName);
matList.Add("");
matList.Add(uRow.Cells["steelgrade"].Text.ToString());
matList.Add(this.txtMemo.Text.Trim());
matList.Add(uRow.Cells["ordername"].Value.ToString());//质保合同号
matList.Add(sourceCode);//材料来源代码
matList.Add(sourceName);//材料名称
matList.Add(ks);
matList.Add("801702");//成品区分
matParm.Add(matList);
plnList.Add(stWeight.ToString("f3"));
plnList.Add(dbunit.ToString());
plnList.Add(this.UserInfo.GetUserName());
plnList.Add("");
plnList.Add("");
plnList.Add("");
plnSpale.Add(plnList);
//break;
#endregion
ArrayList statusList = new ArrayList();
statusList.Add(uRow.Cells["lcode"].Value.ToString());
statusList.Add(uRow.Cells["lotno"].Value.ToString());
statusList.Add(uRow.Cells["factory"].Value.ToString());
statusList.Add(uRow.Cells["testdate"].Value.ToString());
statusList.Add(uRow.Cells["hgunit"].Value.ToString()); //支数
statusList.Add(uRow.Cells["hgweight"].Value.ToString());//重量
statusList.Add(uRow.Cells["RCDID"].Value.ToString());
statusUpdate.Add(statusList);
}
}
#endregion
}
//count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doPipeIn", new Object[] { storageParm, matParm, statusUpdate, plnSpale }, this.ob);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
ccp.MethodName = "doPipeIn";
ccp.ServerParams = new object[] { storageParm, matParm, statusUpdate, plnSpale };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("缴库成功!"))
{
QueryMatData();
this.cmbSteel.Text = "";
this.cmbFactory.Text = "";
this.txt_Ks.Value = "0";
if (ugr3 != null)
{
QueryOrder(ugr3.Cells["ORDER_NO"].Text.Trim(), ugr3.Cells["ORDER_SEQ"].Text.Trim());
}
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
///
/// 缴库
///
private void DoPipeIn()
{
ultraGrid3.UpdateData();
ultraGrid1.UpdateData();
string buttonValue = "";//返回的按钮值
string frmcount = "";//返回的支数
string frmWgt = "";//返回的重量值
string frmFinishedCode = "";
storageParm = new ArrayList();
matParm = new ArrayList();
statusUpdate = new ArrayList();
plnSpale = new ArrayList();
ArrayList listdt = new ArrayList();
string[] wgtList = new string[3];
int conu = 0;
string orderType = "";
int count = 0;
UltraGridRow ugr3 = ultraGrid3.ActiveRow;
UltraGridRow row = ultraGrid1.ActiveRow;
if (ugr3 == null) { MessageUtil.ShowTips("待缴库无合同数据,不能进行此操作"); return; }
if (row == null) { MessageUtil.ShowTips("无质保判定炉信息,不能进行此操作"); return; }
double strWgt = 0;//炉重
double endWgt = 0;//已缴库量
double orderWgt = 0;//合同量
int m = 0;
int nn = 0;
foreach (UltraGridRow row1 in ultraGrid1.Rows)
{
if (Convert.ToBoolean(row1.Cells["CHK"].Text) == true)
{
if (row1.Cells["hgweight"].Text == "")
{
MessageUtil.ShowTips("该炉还未生产,无法缴库!");
return;
}
if (double.Parse(row1.Cells["hgweight"].Text) < 0)
{
MessageUtil.ShowWarning("已缴库量无法进行冲销!");
return;
}
strWgt += double.Parse(row1.Cells["hgweight"].Value.ToString());
m++;
}
}
if (m < 1)
{
MessageUtil.ShowTips("请勾选需要操作的记录!");
return;
}
if (m > 1)
{
MessageUtil.ShowTips("缴库时不允许多炉同时缴库!");
return;
}
foreach (UltraGridRow row7 in ultraGrid3.Rows)
{
if (Convert.ToBoolean(row7.Cells["CHK"].Text) == true)
{
nn++;
}
}
if (nn < 1)
{
MessageUtil.ShowTips("请勾选待缴库合同数据!");
return;
}
double delPla = 0;//已缴库量
string _length = "";//长度范围
int d = 0;
double downLength = 0;//下限
double upLength = 0;//上限
string orderUnit = "";//长度单位
double reckonWgt = 0;//估算量上限
string gSwgt = "";//合同估算总量
string pipSwgt = "";//合同缴库总量
string dSwgt = "";//订货总量
if (cmbStorage.Text.ToString() == "")
{
MessageBox.Show("请选择要存放的仓库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
else
{
storageno = this.cmbStorage.Value.ToString();
}
if (this.cmbFactory.Text.ToString() == "")
{
//MessageUtil.ShowTips("产线不允许为空!");
//return;
factoryCode = "";
factoryNo = "";
}
else
{
factoryCode = this.cmbFactory.Value.ToString();
factoryNo = this.cmbFactory.Text.ToString();
}
//if (this.cmbSteel.Text.ToString() == "")
//{
// //MessageUtil.ShowTips("钢种不允许为空!");
// //return;
// steelCode = "";
// steelName = "";
//}
//else
//{
// steelCode = this.cmbSteel.Value.ToString();
// steelName = this.cmbSteel.Text.ToString();
//}
if (this.cmbSource.Text.ToString() == "")
{
//MessageUtil.ShowTips("钢种不允许为空!");
//return;
sourceCode = "";
sourceName = "";
}
else
{
sourceCode = this.cmbSource.Value.ToString();
sourceName = this.cmbSource.Text.ToString();
}
if (this.txt_Ks.Value == null)
{
ks = "0";
}
else
{
ks = this.txt_Ks.Value.ToString();
}
DataTable ds = new DataTable();
UltraGridRow grid3Row = null;
string strRANGE_MIN = "";
string strRANGE_MAX = "";
double dbQtyMin = 0;
double dbQtyMax = 0;
double dbJhMax = 0;//估算量上限
double dbOrderMax = 0;//合同订货量上限
string strOrder = "";
//int dex = 0;
//string ordername = "";
//string orderNo = "";
//string orderSeQ = "";
foreach (UltraGridRow row5 in ultraGrid3.Rows)
{
if (Convert.ToBoolean(row5.Cells["CHK"].Text) == true)
{
if (row5.Cells["MATCHORDER"].Text.Trim().Contains("合同物料不匹配"))
{
MessageUtil.ShowTips("合同物料不匹配不允许缴库!");
return;
}
if (row5.Cells["MATCHORDER"].Text.Trim().Contains("合同不匹配"))
{
MessageUtil.ShowTips("合同不匹配不允许缴库,可强制缴库!");
return;
}
strOrder = ugr3.Cells["ORDER_NO"].Text.Trim() + "/" + ugr3.Cells["ORDER_SEQ"].Text.Trim().PadLeft(4,'0');
orderUnit = ugr3.Cells["ORDER_UNIT"].Text.Trim();
endWgt = double.Parse(ugr3.Cells["PAYDOWNWEIGHT"].Value.ToString());
orderWgt = double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString());
strRANGE_MIN = ugr3.Cells["DELVRY_RANGE_MIN"].Text.Trim();//交货量差下限
strRANGE_MAX = ugr3.Cells["DELVRY_RANGE_MAX"].Text.Trim();//交货量差上限
dbQtyMin = double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) - double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MIN) / 100);//合同行下限值
dbQtyMax = double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//合同行上限值
dbJhMax = double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(ugr3.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//交货量差上限值
if (orderUnit.Contains("支") || orderUnit.Equals("吨"))
{
dbOrderMax = double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) + double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);
}
else if (orderUnit.Contains("磅"))
{
dbOrderMax = Math.Round(double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString())*0.45359/1000 + double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString())*0.45359/1000 * (double.Parse(strRANGE_MAX) / 100),3);
}
wgtList = getOrderWgt(ugr3.Cells["ORDER_NO"].Text.ToString());
if (wgtList.Length > 0)
{
gSwgt = wgtList[0];
pipSwgt = wgtList[1];
dSwgt = wgtList[2];
}
grid3Row = row5;
}
}
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row3 in ultraGrid1.Rows)
{
if (Convert.ToBoolean(row3.Cells["CHK"].Text) == true)
{
if (Convert.ToBoolean(row3.Cells["CHK"].Text) == true)
{
if (row3.Cells["CXSTUPP"].Text.Trim() == "")
{
MessageUtil.ShowTips("您选择的质保信息未匹配,不能进行缴库!");
return;
}
if (row3.Cells["CXSTUPP"].Text.Trim() == "物料不匹配")
{
MessageUtil.ShowTips("您选择的质保信息物料不匹配,不能进行缴库!");
return;
}
ds.Clear();
ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSqlServerStaus", new object[] { row3.Cells["ordername"].Text.Trim(), row3.Cells["lcode"].Text.Trim(), row3.Cells["lotno"].Text.Trim(), row3.Cells["hgunit"].Text.Trim(), row3.Cells["hgweight"].Text.Trim(), row3.Cells["rcdid"].Text.Trim() }, this.ob);
if (ds.Rows[0][0].ToString() == "20")
{
MessageUtil.ShowTips("您选中的【" + row3.Cells["lcode"].Text.Trim() + "】这炉已缴库,请重新选择!");
return;
}
//ordername = row3.Cells["ordername"].Text.Trim();
//dex = ordername.IndexOf("/");
//orderNo = ordername.Substring(0, dex);
//orderSeQ = ordername.Substring(dex + 1).PadLeft(3, '0');
//DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrder", new object[] { orderNo, orderSeQ }, this.ob);
//if (dt.Rows.Count > 0)
//{
// MessageUtil.ShowTips("此缴库合同号有对应合同号合同行号数据存在,请勾选相应待缴合同!");
// return;
//}
//if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米") || grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
//{
// if (row3.Cells["hgm"].Text.Trim() == "")
// {
// MessageUtil.ShowTips("此合同不是按吨交货,长度为空不能缴库!");
// return;
// }
//}
_length = row3.Cells["leng"].Text.Trim();
if (_length != "")
{
d = _length.IndexOf("-");
downLength = double.Parse(_length.Substring(0, d));
upLength = double.Parse(_length.Substring(d + 1));
if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米"))
{
if (!(compareToValue(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim()), double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim()), downLength) && compareToValue(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim()), double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim()), upLength)))
{
if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row3.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + grid3Row.Cells["LEN"].Text + "】米,是否缴库?") == DialogResult.No)
{
return;
}
}
}
else if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
{
if (!(compareToValue(FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())), FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())), downLength) && compareToValue(FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())), FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())), upLength)))
{
//if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + ugr3.Cells["LEN"].Text + "】英尺,是否缴库?") == DialogResult.No)
//{
// return;
//}
if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())).ToString() + "-" + FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())).ToString() + "】(英尺换算),是否缴库?") == DialogResult.No)
{
return;
}
}
}
}
else
{
MessageUtil.ShowTips("长度上下限为空,不允许缴库可进行强制缴库!");
return;
}
}
string newSql_no = "";
//conu += 1;
int index = row3.Cells["ordername"].Text.Trim().IndexOf("/");
string sql_no = row3.Cells["ordername"].Text.Trim().Substring(index + 1);
if (sql_no.Length < 4)
{
sql_no = sql_no.PadLeft(4, '0');
}
if (strOrder != (row3.Cells["ordername"].Text.Trim().Substring(0, index) + "/" + sql_no))
{
MessageUtil.ShowTips("质保数据合同号" + (row3.Cells["ordername"].Text.Trim().Substring(0, index) + "/" + sql_no) + "信息与待缴合同" + strOrder + "信息不一致,不能缴库可强制缴库!");
return;
}
delPla += double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Text.Trim());
orderType = doQueryOrderType(row3.Cells["ordername"].Text.Trim().Substring(0, index));
if (orderType.Equals("120103"))
{
MessageUtil.ShowTips("该合同为研发合同,不允许缴库!");
return;
}
else if (orderType.Equals("120104"))
{
MessageUtil.ShowTips("该合同为预排合同,只允许强制缴库成成品!");
return;
}
if (strWgt > 0)
{
if (orderUnit.Equals("吨") || orderUnit.Equals("支") || orderUnit.Contains("磅"))
{
if (endWgt > dbOrderMax)
{
if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
{
//MessageUtil.ShowTips("此合同行缴库量已超出交货量上限,不允许缴库!");
return;
}
frmBatchesPip frm = new frmBatchesPip(ob);
frm.AllCount = row3.Cells["hgunit"].Text.Trim();
frm.AllWgt = row3.Cells["hgweight"].Text.Trim();
if (dbOrderMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString()) < 0)
{
frm.SxWgt = "0";
}
else
{
frm.SxWgt = (dbOrderMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
}
frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
frm.ShowDialog();
buttonValue = frm.buttonValue;
frmcount = frm.count;
frmWgt = frm.outWgt;
frmFinishedCode = frm.finishedProduct;
if (!frm.flag)
{
return;
}
if (buttonValue == "0")
{
return;
}
if (buttonValue == "2")
{
if (int.Parse(frmcount) > int.Parse(row3.Cells["hgunit"].Text.Trim()))
{
MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
return;
}
if (double.Parse(frmWgt) + endWgt > dbOrderMax)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
{
return;
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
if (buttonValue == "1")
{
if ((strWgt + endWgt) > dbOrderMax)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
}
else
{
if ((strWgt + endWgt) > dbOrderMax)
{
frmBatchesPip frm = new frmBatchesPip(ob);
frm.AllCount = row3.Cells["hgunit"].Text.Trim();
frm.AllWgt = row3.Cells["hgweight"].Text.Trim();
frm.SxWgt = (dbOrderMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
frm.ShowDialog();
buttonValue = frm.buttonValue;
frmcount = frm.count;
frmWgt = frm.outWgt;
frmFinishedCode = frm.finishedProduct;
if (!frm.flag)
{
return;
}
if (buttonValue == "0")
{
return;
}
if (buttonValue == "2")
{
if (int.Parse(frmcount) > int.Parse(row3.Cells["hgunit"].Text.Trim()))
{
MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
return;
}
if (double.Parse(frmWgt) + endWgt > dbJhMax)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
{
return;
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
if (buttonValue == "1")
{
if ((strWgt + endWgt) > dbJhMax)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
}
}
else if (orderUnit.Equals("英尺") || orderUnit.Equals("米"))
{
if (grid3Row.Cells["ORDERWEIGHT"].Value.ToString() == "")
{
MessageUtil.ShowTips("此合同【" + strOrder + "】是以英尺为交货单位!,估算量为空不能缴库!");
return;
}
reckonWgt = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//估算量上限
if (endWgt > reckonWgt)
{
//MessageUtil.ShowTips("此合同行缴库量已超出交货量上限,不允许缴库!");
//return;
if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
{
return;
}
frmBatchesPip frm = new frmBatchesPip(ob);
frm.AllCount = row3.Cells["hgunit"].Text.Trim();
frm.AllWgt = row3.Cells["hgweight"].Text.Trim();
if (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString()) < 0)
{
frm.SxWgt = "0";
}
else
{
frm.SxWgt = (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
}
frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
frm.ShowDialog();
buttonValue = frm.buttonValue;
frmcount = frm.count;
frmWgt = frm.outWgt;
frmFinishedCode = frm.finishedProduct;
if (!frm.flag)
{
return;
}
if (buttonValue == "0")
{
return;
}
if (buttonValue == "2")
{
//if (int.Parse(frmcount).Equals(0))
//{
// MessageUtil.ShowTips("合同上限已满,不能按合同上限入库!");
// return;
//}
if (int.Parse(frmcount) > int.Parse(row3.Cells["hgunit"].Text.Trim()))
{
MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
return;
}
if (double.Parse(frmWgt) + endWgt > reckonWgt)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
{
return;
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
if (buttonValue == "1")
{
if ((strWgt + endWgt) > reckonWgt)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
{
return;
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
}
}
else
{
if ((strWgt + endWgt) > reckonWgt)
{
frmBatchesPip frm = new frmBatchesPip(ob);
frm.AllCount = row3.Cells["hgunit"].Text.Trim();
frm.AllWgt = row3.Cells["hgweight"].Text.Trim();
frm.SxWgt = (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
frm.ShowDialog();
buttonValue = frm.buttonValue;
frmcount = frm.count;
frmWgt = frm.outWgt;
frmFinishedCode = frm.finishedProduct;
if (!frm.flag)
{
return;
}
if (buttonValue == "0")
{
return;
}
if (buttonValue == "2")
{
//if (int.Parse(frmcount).Equals(0))
//{
// MessageUtil.ShowTips("合同上限已满,不能按合同上限入库!");
// return;
//}
if (int.Parse(frmcount) > int.Parse(row3.Cells["hgunit"].Text.Trim()))
{
MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
return;
}
if (double.Parse(frmWgt) + endWgt > reckonWgt)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
{
return;
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
if (buttonValue == "1")
{
if ((strWgt + endWgt) > reckonWgt)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
{
return;
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
}
}
}
}
}
}
}
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row4 in ultraGrid1.Rows)
{
if (Convert.ToBoolean(row4.Cells["CHK"].Text) == true)
{
if (double.Parse(row4.Cells["hgweight"].Text.Trim()) < 0)
{
if (double.Parse(row4.Cells["hgweight"].Text.Trim()) + double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Text.Trim()) < 0)
{
MessageUtil.ShowTips("冲销的重量不能比已缴库重量大!");
return;
}
else
{
if (int.Parse(row4.Cells["hgunit"].Text.Trim()) > int.Parse(grid3Row.Cells["PAYDOWN_NUM"].Text.Trim()))
{
MessageUtil.ShowTips("冲销支数不能比已缴库支数多!");
return;
}
}
}
}
}
UltraGridRow[] rows = ultraGrid3.Rows.AsQueryable().Where(a => bool.Parse(a.Cells["CHK"].Value.ToString()))
.OrderBy(a => a.Cells["DELIVERY_NO"].Value.ToString()).ToArray();
double dbDelvry = 0;
double dbweigh = 0;
double dbcount = 0;
double endweigth = 0;
//DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryIn", new Object[] { storageParm, matParm, statusUpdate, plnSpale, row.Cells["hgunit"].Value.ToString() }, this.ob);
if (MessageUtil.ShowYesNoAndQuestion("是否确认缴库?") == DialogResult.No) return;
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
{
ArrayList matList = new ArrayList();
ArrayList plnList = new ArrayList();
double stWeight = 0;
double dbunit = 0;
//DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doPipeIn", new Object[] {}, this.ob);
//if (grid3Row.Cells["PORDERSTATUS"].Text.Trim().Equals("生产中"))
//{
// MessageUtil.ShowTips("待缴库合同在生产中,不能进行缴库!");
// return;
//}
if (buttonValue == "2")
{
stWeight = double.Parse(frmWgt);
dbunit = double.Parse(frmcount);
}
else
{
stWeight = double.Parse(uRow.Cells["hgweight"].Value.ToString());//已缴库量+炉(重量)
dbunit = double.Parse(uRow.Cells["hgunit"].Value.ToString());//已缴库支数+炉(支数)
}
ArrayList storageList = new ArrayList(); //仓库位置参数
storageList.Add(uRow.Cells["lcode"].Text.Trim());
storageList.Add(uRow.Cells["lotno"].Text.Trim());
storageList.Add(uRow.Cells["hgunit"].Text.Trim());
storageList.Add(storageno);
storageList.Add(storageno + "10101");
storageList.Add(storagetype);
storageList.Add(storagetypedesc);
//storageList.Add(manageno);
//storageList.Add(managedesc);
storageList.Add(this.UserInfo.GetUserName());
storageList.Add(uRow.Cells["hgweight"].Value.ToString());
storageList.Add(this.UserInfo.GetDeptid());
storageList.Add(this.UserInfo.GetDepartment());
storageList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
storageList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
storageParm.Add(storageList);
#region 要缴库的每一炉重量小于要缴库的重量
matList.Add(uRow.Cells["lcode"].Text.Trim()); //炉号
matList.Add(uRow.Cells["lotno"].Text.Trim());//批号
matList.Add(uRow.Cells["hgunit"].Text.Trim());//支数
matList.Add(grid3Row.Cells["PRODUCCODE"].Value.ToString());//品名代码
matList.Add(grid3Row.Cells["PRODUCNAME"].Value.ToString());//品名名称
if (uRow.Cells["cxsteellevel"].Text == "N80Q")
{
matList.Add(uRow.Cells["cxsteellevel"].Value.ToString());
matList.Add(uRow.Cells["cxsteellevel"].Text);
}
else
{
matList.Add(grid3Row.Cells["STEELCODE"].Value.ToString());//钢级(牌号)代码
matList.Add(grid3Row.Cells["STEELNAME"].Value.ToString());//钢级名称
}
matList.Add(grid3Row.Cells["SPEC_CODE"].Value.ToString());//产品规格代码
matList.Add(grid3Row.Cells["SPEC_NAME"].Value.ToString());//产品规格描述
matList.Add(grid3Row.Cells["MODEL_CODE"].Value.ToString());//扣型代码
matList.Add(grid3Row.Cells["MODEL_DESC"].Value.ToString());//扣型描述 10
matList.Add(grid3Row.Cells["STD_CODE"].Value.ToString());//标准代码
//matList.Add("");//标准代码
//matList.Add(uRow.Cells["standard"].Value.ToString());
matList.Add(grid3Row.Cells["STD_NAME"].Value.ToString());//标准名称
matList.Add(grid3Row.Cells["CREATE_DEPT"].Value.ToString());
matList.Add(grid3Row.Cells["DEPARTNAME"].Value.ToString());
matList.Add(grid3Row.Cells["STD_STYLE"].Value.ToString());//标准类别代码
matList.Add(grid3Row.Cells["STD_STYLE_DESC"].Value.ToString());//标准类别描述
matList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());//合同号
matList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());//合同行号
matList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());//交货行号
matList.Add(grid3Row.Cells["ORD_PK"].Value.ToString());//合同主键
matList.Add(grid3Row.Cells["ORD_LN_PK"].Value.ToString());//合同行主键
matList.Add(grid3Row.Cells["ORD_LN_DLY_PK"].Value.ToString());//交货行主键
matList.Add(grid3Row.Cells["DIMATER"].Value.ToString());// 外径
matList.Add(grid3Row.Cells["HEIGHT"].Value.ToString());//壁厚
matList.Add(grid3Row.Cells["LEN_NO"].Value.ToString());//长度编码(订货)
matList.Add(grid3Row.Cells["LEN_DESC"].Value.ToString());//长度描述(订货)
matList.Add(grid3Row.Cells["LEN_UNIT"].Value.ToString());//长度单位 27
string length = uRow.Cells["leng"].Text.Trim();
int n = length.IndexOf("-");
string lengMin = length.Substring(0, n);
string lengMax = length.Substring(n + 1);
matList.Add(lengMin);//下限
matList.Add(lengMax);//上限
matList.Add(this.UserInfo.GetUserName());//操作人30
matList.Add("0");
matList.Add("1");
matList.Add(uRow.Cells["testidea"].Value.ToString());//备注
matList.Add(uRow.Cells["HGWEIGHT"].Value.ToString());
double weight = Convert.ToDouble(uRow.Cells["HGWEIGHT"].Value.ToString());
double unit = Convert.ToDouble(uRow.Cells["HGUNIT"].Value.ToString());
//生成入库单号
//ArrayList pram = new ArrayList();
//pram.Add(DateTime.Now.ToString("yyyy/MM/dd"));
//pram.Add(strInbound);
//DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getInListDoc", new object[] { pram }, ob);
//string str = "";
//if (dt.Rows.Count >= 1)
//{
// str = dt.Rows[0]["INSTOCK_DOC"].ToString();
//}
DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
if (dtMemo.Rows.Count >= 1)
{
strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
}
//strIndoc = PipeManageClass.NextNumber(str, strInMemo, "00001");
matList.Add(strInMemo);
matList.Add(this.UserInfo.GetDeptid());
matList.Add(this.UserInfo.GetDepartment());//37
matList.Add(strInbound);
matList.Add(this.cmbStorage.Value.ToString());//仓库号851731
matList.Add(grid3Row.Cells["SALE_ORG"].Value.ToString());
matList.Add(grid3Row.Cells["SALE_ORG_DESC"].Value.ToString());
if (buttonValue == "2")
{
matList.Add(frmcount);//42
}
else
{
matList.Add(uRow.Cells["hgunit"].Value.ToString());
}
matList.Add(uRow.Cells["rcdid"].Value.ToString());
matList.Add(uRow.Cells["hgm"].Value.ToString());//长度
matList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(),this.ob));
matList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
matList.Add(uRow.Cells["standard"].Value.ToString());//判定标准
//matList.Add(uRow.Cells["testdate"].Value.ToString().Substring(0, 4) + row.Cells["testdate"].Value.ToString().Substring(5, 2));// 判定时间
matList.Add(uRow.Cells["testdate"].Value.ToString());//判定时间
matList.Add(factoryCode);
matList.Add(factoryNo);//50
//matList.Add(steelCode);
//matList.Add(steelName);
matList.Add("");
matList.Add(uRow.Cells["steelgrade"].Text.ToString());
matList.Add(this.txtMemo.Text.Trim());//手动输入的备注
matList.Add(uRow.Cells["ordername"].Value.ToString());//质保合同号
matList.Add(sourceCode);//材料来源代码
matList.Add(sourceName);//材料名称
matList.Add(ks);//捆数
if (buttonValue == "1")
{
matList.Add("801703");//成品区分
}
else if (buttonValue == "2")
{
matList.Add("801701");//成品区分
}
matParm.Add(matList);
plnList.Add(stWeight.ToString("f3"));
if (double.Parse(uRow.Cells["hgweight"].Value.ToString()) > 0)
{
plnList.Add(dbunit.ToString());
}
else
{
plnList.Add(int.Parse(ugr3.Cells["hgunit"].Text.Trim()).ToString());
}
plnList.Add(this.UserInfo.GetUserName());
plnList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());
plnList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());
plnList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());
plnSpale.Add(plnList);
//break;
#endregion
//}
//else
//{
// return;
//}
ArrayList statusList = new ArrayList();
statusList.Add(uRow.Cells["lcode"].Text.Trim());
statusList.Add(uRow.Cells["lotno"].Text.Trim());
statusList.Add(uRow.Cells["factory"].Value.ToString());
statusList.Add(uRow.Cells["testdate"].Value.ToString());
statusList.Add(uRow.Cells["hgunit"].Value.ToString()); //支数
statusList.Add(uRow.Cells["hgweight"].Value.ToString());//重量
statusList.Add(uRow.Cells["RCDID"].Value.ToString());
statusUpdate.Add(statusList);
}
}
//count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doPipeIn", new Object[] { storageParm, matParm, statusUpdate, plnSpale }, this.ob);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
ccp.MethodName = "doPipeIn";
ccp.ServerParams = new object[] { storageParm, matParm, statusUpdate, plnSpale };
ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("缴库成功!"))
{
QueryMatData();
this.cmbSteel.Text = "";
this.cmbFactory.Text = "";
this.txt_Ks.Value = "0";
QueryOrder(grid3Row.Cells["ORDER_NO"].Text.Trim(), grid3Row.Cells["ORDER_SEQ"].Text.Trim());
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
///
/// 查询合同类型
///
///
///
private string doQueryOrderType(string orderNo)
{
string orderType = "";
//判断合同类型
DataTable orderDs = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doQueryOrderType", new object[] { orderNo }, ob);
if (orderDs.Rows.Count > 0)
{
orderType = orderDs.Rows[0]["ORDER_TYP"].ToString();
}
return orderType;
}
///
/// 按合同号、合同行号查询已缴库合同
///
///
///
private void QueryOrder(string orderNo, string orderSeqNo)
{
DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrder1", new object[] { orderNo, orderSeqNo }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
}
///
/// 撤销缴库
///
private void DoCanclePipeIn()
{
ultraGrid4.UpdateData();
UltraGridRow ugr = ultraGrid4.ActiveRow;
if (ugr == null)
return;
ArrayList list = new ArrayList();
ArrayList list1 = new ArrayList();
ArrayList list2 = new ArrayList();
int n = 0;
string moth = "";
string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,ob);
foreach(UltraGridRow us in ultraGrid4.Rows)
{
if (Convert.ToBoolean(us.Cells["CHK"].Text) == true)
{
n++;
}
}
if (n < 1)
{
MessageBox.Show("请选择要操作的数据!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);
return;
}
int m = 0;
foreach (UltraGridRow pro in ultraGrid4.Rows)
{
if (Convert.ToBoolean(pro.Cells["CHK"].Value))
{
if (double.Parse(pro.Cells["ACT_WEIGHT"].Text.Trim()) > 0)
{
if (pro.Cells["PRODUCT_FLAG"].Text.Trim() == "成品" || pro.Cells["PRODUCT_FLAG"].Text.Trim() == "在制品")
{
ArrayList prolist = new ArrayList();
prolist.Add(pro.Cells["INSTOCK_DOC"].Value.ToString());
prolist.Add(pro.Cells["JUDGE_STOVE_NO"].Value.ToString());
prolist.Add(pro.Cells["BATCH_NO"].Value.ToString());
prolist.Add(pro.Cells["BATCH_GROUD_NO"].Value.ToString());
DataTable prodt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doQueryProFlag", new object[] { prolist }, ob);
if (int.Parse(prodt.Rows[0]["ACOUNT"].ToString()) > 0)
{
m = m + 1;
}
}
}
}
}
if (m > 0)
{
MessageUtil.ShowTips("请勾选类别为商品的数据撤销!");
return;
}
foreach (UltraGridRow row in ultraGrid4.Rows)
{
if (Convert.ToBoolean(row.Cells["CHK"].Value))
{
//if (double.Parse(row.Cells["ACT_WEIGHT"].Text.Trim()) > 0)
//{
// if (row.Cells["PRODUCT_FLAG"].Text.Trim() == "成品" || row.Cells["PRODUCT_FLAG"].Text.Trim() == "在制品")
// {
// ArrayList prolist = new ArrayList();
// prolist.Add(row.Cells["INSTOCK_DOC"].Value.ToString());
// prolist.Add(row.Cells["JUDGE_STOVE_NO"].Value.ToString());
// prolist.Add(row.Cells["BATCH_NO"].Value.ToString());
// prolist.Add(row.Cells["BATCH_GROUD_NO"].Value.ToString());
// DataTable prodt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doQueryProFlag", new object[] { prolist }, ob);
// if (int.Parse(prodt.Rows[0]["ACOUNT"].ToString()) > 0)
// {
// m = m + 1;
// }
// MessageUtil.ShowTips("请勾选类别为商品的数据撤销!");
// return;
// }
//}
//DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.querySendPlan", new Object[] { row.Cells["ORDER_NO"].Value.ToString(), row.Cells["ORDER_SEQ"].Value.ToString(), row.Cells["DELIVERY_NO"].Value.ToString() }, this.ob);
//if (dt.Rows.Count > 0)
//{
// MessageUtil.ShowWarning("[合同号为:" + row.Cells["ORDER_NO"].Value.ToString() + "、合同行号为:" + row.Cells["ORDER_SEQ"].Value.ToString() + "、交货行为:" + row.Cells["DELIVERY_NO"].Value.ToString() + "]的数据已做计划,无法撤销!");
// return;
//}
DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryMatNoStatus", new object[] { row.Cells["ORDER_NO"].Value.ToString(), row.Cells["ORDER_SEQ"].Value.ToString(), row.Cells["DELIVERY_NO"].Value.ToString(), row.Cells["JUDGE_STOVE_NO"].Value.ToString(), row.Cells["BATCH_NO"].Value.ToString(), row.Cells["BATCH_GROUD_NO"].Value.ToString(), row.Cells["INSTOCK_DOC"].Text }, this.ob);
if (ds.Rows.Count == 0)
{
MessageUtil.ShowTips("此炉批组已发运,不允许撤销!");
return;
}
else if (ds.Rows.Count == 1)
{
if (ds.Rows[0].ToString().Equals("80150302"))
{
MessageUtil.ShowWarning("该炉批组的数据不是可编提单状态,无法撤销!");
return;
}
}
else if (ds.Rows.Count > 1)
{
for (int i = 0; i < ds.Rows.Count; i++)
{
if (ds.Rows[i].ToString().Equals("80150302"))
{
MessageUtil.ShowWarning("该炉批组的数据不是可编提单状态,无法撤销!");
return;
}
}
}
DataTable dd = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getLockFlag", new object[] { row.Cells["JUDGE_STOVE_NO"].Text, row.Cells["BATCH_NO"].Text, row.Cells["BATCH_GROUD_NO"].Text }, ob);
if (int.Parse(dd.Rows[0]["ACOUNT"].ToString()) > 0)
{
MessageUtil.ShowTips("炉号:" + row.Cells["JUDGE_STOVE_NO"].Text + "、批号:" + row.Cells["BATCH_NO"].Text + "的数据有被封锁的,不能撤销!");
return;
}
ArrayList parm = new ArrayList();
moth = DateTime.Parse(row.Cells["BAL_YEAR_MONTH"].Text).AddMonths(1).ToString("yyyyMM");
parm.Add(moth);
DataTable dg = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeAdjust.selectYearMoth", new object[] { parm, arr }, ob);
if (int.Parse(dg.Rows[0]["ACOUNT"].ToString()) > 0)
{
MessageUtil.ShowTips("此炉【" + row.Cells["JUDGE_STOVE_NO"].Text + "】已进行结转,不允许撤销!");
return;
}
ArrayList pram = new ArrayList();
ArrayList pram1 = new ArrayList();
ArrayList pram2 = new ArrayList();
pram1.Add(row.Cells["JUDGE_STOVE_NO"].Value.ToString());
pram1.Add(row.Cells["BATCH_NO"].Value.ToString());
DataTable td = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSumWgt", new object[] { row.Cells["INSTOCK_DOC"].Text.Trim() }, this.ob);
pram1.Add(td.Rows[0]["ACT_COUNT"].ToString());
pram1.Add(td.Rows[0]["ACT_WEIGHT"].ToString());
pram1.Add(row.Cells["ZB_RCDID"].Value.ToString());
pram1.Add(row.Cells["SPEC_NAME"].Value.ToString());
pram1.Add(row.Cells["MODEL_DESC"].Value.ToString());
pram1.Add(row.Cells["STD_NAME"].Value.ToString());
pram1.Add(row.Cells["ACT_LEN_MIN"].Value.ToString());
pram1.Add(row.Cells["ACT_LEN_MAX"].Value.ToString());
pram1.Add(row.Cells["INSTOCK_DOC"].Value.ToString());
pram1.Add(row.Cells["BATCH_GROUD_NO"].Value.ToString());
list1.Add(pram1);
pram.Add(row.Cells["ORDER_NO"].Value.ToString());
pram.Add(row.Cells["ORDER_SEQ"].Value.ToString());
pram.Add(row.Cells["DELIVERY_NO"].Value.ToString());
pram.Add(row.Cells["ACT_COUNT"].Value.ToString());
pram.Add(row.Cells["ORDER_NO"].Value.ToString());
pram.Add(row.Cells["ORDER_SEQ"].Value.ToString());
pram.Add(row.Cells["DELIVERY_NO"].Value.ToString());
pram.Add(row.Cells["ACT_WEIGHT"].Value.ToString());
//pram.Add(this.UserInfo.GetUserName());
pram.Add(row.Cells["ORDER_NO"].Value.ToString());
pram.Add(row.Cells["ORDER_SEQ"].Value.ToString());
pram.Add(row.Cells["DELIVERY_NO"].Value.ToString());
if (row.Cells["PRODUCT_FLAG"].Value.ToString() == "成品")
{
pram.Add("801402");//类别
}
else if (row.Cells["PRODUCT_FLAG"].Value.ToString() == "商品")
{
pram.Add("801403");//类别
}
list.Add(pram);
pram2.Add(row.Cells["INSTOCK_DOC"].Value.ToString());
pram2.Add(row.Cells["JUDGE_STOVE_NO"].Value.ToString());
pram2.Add(row.Cells["BATCH_NO"].Value.ToString());
pram2.Add(row.Cells["BATCH_GROUD_NO"].Value.ToString());
list2.Add(pram2);
}
}
if (MessageBox.Show("是否确认撤销缴库?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
return;
int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.canclePipein", new Object[] { list1, list,list2 }, this.ob);
if (count > 0)
{
QueryInList();
MessageBox.Show("撤销缴库成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
///
/// 库存查询
///
private void QueryPipedData()
{
ArrayList pram = new ArrayList();
string intimeStart = ""; //缴库起始时间
string intimeEnd = ""; //缴库结束时间
string stoveno = ""; //炉号
string order = "";
string stroage = "";
if (ultraCheckEditor5.Checked)
{
intimeStart = StartTime.Value.ToString();
intimeEnd = EndTime.Value.ToString();
}
if (chkJudge.Checked)
{
if (cmbJudge.Text.Trim()=="")
{
MessageUtil.ShowTips("炉号不能为空,请选择!");
return;
}
stoveno = cmbJudge.Text.Trim();
}
if (chkOrder.Checked)
{
if (cmbOrder.Text.Trim()=="")
{
MessageUtil.ShowTips("合同号不能为空,请选择!");
return;
}
order = cmbOrder.Text.Trim();
}
if (DateTime.Parse(StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
{
MessageUtil.ShowTips("开始时间不能大于结束时间!");
return;
}
if (chkStrong.Checked)
{
if (cmbStorager.Text.Trim() == "")
{
MessageUtil.ShowTips("仓库不能为空,请选择!");
return;
}
stroage = cmbStorager.Value.ToString();
}
//pram.Add(stoveno);
//pram.Add(stoveno);
pram.Add(stoveno);
//pram.Add(order);
//pram.Add(order);
pram.Add(order);
//pram.Add(stroage);
//pram.Add(stroage);
pram.Add(stroage);
//string arr = UserInfo.GetDeptid();
string areaNo = "";
string userName = UserInfo.GetUserName();
string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, this.ob);
//if (!userName.Equals("admin"))
//{
// DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.querySaleOrg", new object[] { arr }, this.ob);
// if (ds.Rows.Count > 0)
// {
// areaNo = ds.Rows[0][0].ToString();
// }
//}
DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryMat", new object[] { pram, arr, intimeStart, intimeEnd }, this.ob);//MatData
GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
//padWgt(ultraGrid2, "ACT_WEIGHT");
//UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid2.DisplayLayout.Bands[0].Columns["LEN_DESC"], ultraGrid2.DisplayLayout.Bands[0].Columns["STD_NAME"] };
//GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid2, col);
//this.ultraGrid2.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
}
///
/// 补充重量小数位
///
///
///
public void padWgt(UltraGrid urd,string colums)
{
foreach (UltraGridRow ugr in urd.Rows)
{
if (!StringUtil.IsInt(ugr.Cells[colums].Value.ToString()))
{
int d = ugr.Cells[colums].Value.ToString().IndexOf(".");
if (ugr.Cells[colums].Value.ToString().Substring(d + 1).Length > 0)
{
if (ugr.Cells[colums].Value.ToString().Substring(d + 1).Length < 3)
{
ugr.Cells[colums].Value = ugr.Cells[colums].Value.ToString().Substring(0, d + 1) + ugr.Cells[colums].Value.ToString().Substring(d + 1).PadRight(3, '0');
}
}
}
else
{
ugr.Cells[colums].Value = ugr.Cells[colums].Value.ToString() + ".000";
}
}
}
///
/// CheckBox选择事件
///
///
///
private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
{
if (chkJudge.Checked)
cmbJudge.Enabled = true;
else
{
cmbJudge.Enabled = false;
//cmbJudge.Text = "";
}
if (chkOrder.Checked)
cmbOrder.Enabled = true;
else
{
cmbOrder.Enabled = false;
//cmbOrder.Text = "";
}
if (ultraCheckEditor1.Checked)
cmbMatch.Enabled = true;
else
{
cmbMatch.Enabled = false;
//cmbMatch.Text = "";
}
}
private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
{
if (toolMenu == null) return;
if (ultraTabControl1.SelectedTab.Key == "2")
{
if (toolMenu.Toolbars[0].Tools.Exists("PipeIn"))
{
toolMenu.Toolbars[0].Tools["PipeIn"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("PipeIn1"))
{
toolMenu.Toolbars[0].Tools["PipeIn1"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("Query"))
{
toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
{
toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("DataMatch"))
{
toolMenu.Toolbars[0].Tools["DataMatch"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("Maint"))
{
toolMenu.Toolbars[0].Tools["Maint"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("Refresh"))
{
toolMenu.Toolbars[0].Tools["Refresh"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("Query2"))
{
toolMenu.Toolbars[0].Tools["Query2"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("CanclePipe"))
{
toolMenu.Toolbars[0].Tools["CanclePipe"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("QueryInList"))
{
toolMenu.Toolbars[0].Tools["QueryInList"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateStoreNo"))
{
toolMenu.Toolbars[0].Tools["updateStoreNo"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateCarryOverDate"))
{
toolMenu.Toolbars[0].Tools["updateCarryOverDate"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("pipRed"))
{
toolMenu.Toolbars[0].Tools["pipRed"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("adjustStoreButress"))
{
toolMenu.Toolbars[0].Tools["adjustStoreButress"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateStaus"))
{
toolMenu.Toolbars[0].Tools["updateStaus"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateMemo"))
{
toolMenu.Toolbars[0].Tools["updateMemo"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateFinishedProduct"))
{
toolMenu.Toolbars[0].Tools["updateFinishedProduct"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("getRealTimeStore"))
{
toolMenu.Toolbars[0].Tools["getRealTimeStore"].InstanceProps.Visible = DefaultableBoolean.False;
}
chkStrong.Visible = true;
cmbStorager.Visible = true;
ultraCheckEditor1.Visible = false;
cmbMatch.Visible = false;
ultraCheckEditor5.Enabled = true;
this.ultraCheckEditor5.Text = "入库时间";
chkBathYear.Visible = false;
dtBathYear.Visible = false;
}
else if (ultraTabControl1.SelectedTab.Key == "1")
{
if (toolMenu.Toolbars[0].Tools.Exists("DataMatch"))
{
toolMenu.Toolbars[0].Tools["DataMatch"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("Maint"))
{
toolMenu.Toolbars[0].Tools["Maint"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("Refresh"))
{
toolMenu.Toolbars[0].Tools["Refresh"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("PipeIn"))
{
toolMenu.Toolbars[0].Tools["PipeIn"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("PipeIn1"))
{
toolMenu.Toolbars[0].Tools["PipeIn1"].InstanceProps.Visible = DefaultableBoolean.True;
}
//toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.True;
if (toolMenu.Toolbars[0].Tools.Exists("Query"))
{
toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
{
toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("Query2"))
{
toolMenu.Toolbars[0].Tools["Query2"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("CanclePipe"))
{
toolMenu.Toolbars[0].Tools["CanclePipe"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("QueryInList"))
{
toolMenu.Toolbars[0].Tools["QueryInList"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateStoreNo"))
{
toolMenu.Toolbars[0].Tools["updateStoreNo"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateCarryOverDate"))
{
toolMenu.Toolbars[0].Tools["updateCarryOverDate"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("pipRed"))
{
toolMenu.Toolbars[0].Tools["pipRed"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("adjustStoreButress"))
{
toolMenu.Toolbars[0].Tools["adjustStoreButress"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateStaus"))
{
toolMenu.Toolbars[0].Tools["updateStaus"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateMemo"))
{
toolMenu.Toolbars[0].Tools["updateMemo"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateFinishedProduct"))
{
toolMenu.Toolbars[0].Tools["updateFinishedProduct"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("getRealTimeStore"))
{
toolMenu.Toolbars[0].Tools["getRealTimeStore"].InstanceProps.Visible = DefaultableBoolean.True;
}
chkStrong.Visible = false;
cmbStorager.Visible = false;
chkBathYear.Visible = false;
dtBathYear.Visible = false;
this.ultraCheckEditor5.Enabled = true;
this.ultraCheckEditor1.Enabled = true;
ultraCheckEditor1.Visible = true;
cmbMatch.Visible = true;
this.ultraCheckEditor5.Text = "判定时间";
}
else
{
if (toolMenu.Toolbars[0].Tools.Exists("PipeIn"))
{
toolMenu.Toolbars[0].Tools["PipeIn"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("PipeIn1"))
{
toolMenu.Toolbars[0].Tools["PipeIn1"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("Query"))
{
toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
{
toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("DataMatch"))
{
toolMenu.Toolbars[0].Tools["DataMatch"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("Maint"))
{
toolMenu.Toolbars[0].Tools["Maint"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("Refresh"))
{
toolMenu.Toolbars[0].Tools["Refresh"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("Query2"))
{
toolMenu.Toolbars[0].Tools["Query2"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("CanclePipe"))
{
toolMenu.Toolbars[0].Tools["CanclePipe"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("QueryInList"))
{
toolMenu.Toolbars[0].Tools["QueryInList"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateStoreNo"))
{
toolMenu.Toolbars[0].Tools["updateStoreNo"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateCarryOverDate"))
{
toolMenu.Toolbars[0].Tools["updateCarryOverDate"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("pipRed"))
{
toolMenu.Toolbars[0].Tools["pipRed"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("adjustStoreButress"))
{
toolMenu.Toolbars[0].Tools["adjustStoreButress"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateStaus"))
{
toolMenu.Toolbars[0].Tools["updateStaus"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateMemo"))
{
toolMenu.Toolbars[0].Tools["updateMemo"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateFinishedProduct"))
{
toolMenu.Toolbars[0].Tools["updateFinishedProduct"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("getRealTimeStore"))
{
toolMenu.Toolbars[0].Tools["getRealTimeStore"].InstanceProps.Visible = DefaultableBoolean.False;
}
this.ultraCheckEditor1.Enabled = false;
chkStrong.Visible = true;
cmbStorager.Visible = true;
chkBathYear.Visible = true;
dtBathYear.Visible = true;
this.ultraCheckEditor5.Text = "入库时间";
ultraCheckEditor1.Visible = false;
cmbMatch.Visible = false;
}
}
///
/// 选择仓库之后获取对应的信息
///
///
///
private void ultraComboEditor4_ValueChanged(object sender, EventArgs e)
{
storageno = cmbStorage.Value.ToString();
DataRow[] dr = ((DataTable)cmbStorage.DataSource).Select("STORAGE_NO='" + storageno+ "'");
if (dr.Length > 0)
{
storagetype=dr[0]["STORAGE_TYPE_NO"].ToString();
storagetypedesc=dr[0]["STORAGE_TYPE_NAME"].ToString();
manageno=dr[0]["MANAGEMENT_NO"].ToString();
managedesc=dr[0]["MANAGEMENT_NAME"].ToString();
}
}
///
/// 根据质保合同号,合同行号查询待缴库合同
///
///
private void GetOrderNo(UltraGridRow ugr)
{
ultraGrid1.UpdateData();
if (ugr == null)
return;
string orderNm = ugr.Cells["ordername"].Text.Trim();
string prodceName = ugr.Cells["cxkind"].Value.ToString();
string steelName = ugr.Cells["cxsteellevel"].Value.ToString();
string specName = ugr.Cells["cxgg"].Value.ToString();
string modelDesc = ugr.Cells["cxtypeofthread"].Value.ToString();
string styleDesc = ugr.Cells["STDSTYLE"].Text;
ArrayList list = new ArrayList();
list.Add(prodceName);
list.Add(steelName);
list.Add(specName);
list.Add(modelDesc);
string orderSeq = "";
//string[] arr = this.ValidDataPurviewIds;
string[] arr = YdmBaseClass.Section(this.ValidDataPurviewIds,this.ob);
string strMatchOrder = "";
string strMactchMat = "";
if (orderNm != "")
{
if (!orderNm.Contains("/"))
{
MessageUtil.ShowTips("此判定数据合同号异常,不允许缴库!");
return;
}
int i = orderNm.IndexOf("/");
if (i == -1) return;
orderSeq = orderNm.Substring(i + 1, orderNm.Length - i - 1).PadLeft(4, '0');
orderNm = orderNm.Substring(0, i);
}
else
{
MessageUtil.ShowTips("判定数据合同号为空!,数据异常!");
return;
}
if (ugr.Cells["CXSTUPP"].Text.Trim() == "物料不匹配")
{
//string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,this.ob);
DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrderClick", new Object[] { orderNm, orderSeq, arr }, this.ob);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
if (dt.Rows[i]["ORDER_NO"].ToString() == orderNm && dt.Rows[i]["ORDER_SEQ"].ToString().PadLeft(4,'0') == orderSeq)
{
dt.Rows[i]["MATCHORDER"] = "合同匹配,物料不匹配";
}
//if(dt.Rows[i][""].ToString() == ugr.Cells[""])
}
}
else
{
}
GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid3.DisplayLayout.Bands[0].Columns["LEN_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["PSC_DESC"],
ultraGrid3.DisplayLayout.Bands[0].Columns["MSC_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["STD_NAME"] };
GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid3, col);
this.ultraGrid3.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
}
else if (ugr.Cells["CXSTUPP"].Text.Trim() == "物料匹配")
{
if (orderNm != "")
{
DataTable dd = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrder2", new object[] { orderNm, orderSeq }, this.ob);//查询合同是否存在 不存在在找物料
if (dd.Rows.Count > 0)
{
DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrderClick", new Object[] { orderNm, orderSeq, arr }, this.ob);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
if (dt.Rows[i]["ORDER_NO"].ToString() == orderNm && dt.Rows[i]["ORDER_SEQ"].ToString().PadLeft(4, '0') == orderSeq)
{
//dt.Rows[i]["MATCHORDER"] = "合同匹配,物料匹配";
strMatchOrder = "1";
}
else
{
strMatchOrder = "0";
}
if (steelName.Equals("C335"))
{
if (dt.Rows[i]["STEELCODE"].ToString() == "C333")
{
if (dt.Rows[i]["PRODUCCODE"].ToString().Equals(prodceName) && dt.Rows[i]["SPEC_CODE"].ToString().Equals(specName) && dt.Rows[i]["MODEL_CODE"].ToString().Equals(modelDesc) && dt.Rows[i]["STD_STYLE_DESC"].ToString().Equals(styleDesc))
{
strMactchMat = "1";
}
else
{
strMactchMat = "0";
}
}
else
{
if (dt.Rows[i]["PRODUCCODE"].ToString().Equals(prodceName) && dt.Rows[i]["STEELCODE"].ToString().Equals(steelName) && dt.Rows[i]["SPEC_CODE"].ToString().Equals(specName) && dt.Rows[i]["MODEL_CODE"].ToString().Equals(modelDesc) && dt.Rows[i]["STD_STYLE_DESC"].ToString().Equals(styleDesc))
{
strMactchMat = "1";
}
else
{
strMactchMat = "0";
}
}
}
else
{
if (dt.Rows[i]["PRODUCCODE"].ToString().Equals(prodceName) && dt.Rows[i]["STEELCODE"].ToString().Equals(steelName) && dt.Rows[i]["SPEC_CODE"].ToString().Equals(specName) && dt.Rows[i]["MODEL_CODE"].ToString().Equals(modelDesc) && dt.Rows[i]["STD_STYLE_DESC"].ToString().Equals(styleDesc))
{
strMactchMat = "1";
}
else
{
strMactchMat = "0";
}
}
if (strMatchOrder == "1" && strMactchMat == "1")
{
//dt.Rows[i]["MATCHORDER"] = "合同匹配,合同物料匹配";
dt.Rows[i]["MATCHORDER"] = "OK";
}
else if (strMatchOrder == "1" && strMactchMat == "0")
{
dt.Rows[i]["MATCHORDER"] = "合同匹配,合同物料不匹配";
}
else if (strMatchOrder == "0" && strMactchMat == "1")
{
dt.Rows[i]["MATCHORDER"] = "合同不匹配,合同物料匹配";
}
else
{
dt.Rows[i]["MATCHORDER"] = "合同不匹配,合同物料不匹配";
}
}
GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid3.DisplayLayout.Bands[0].Columns["LEN_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["PSC_DESC"],
ultraGrid3.DisplayLayout.Bands[0].Columns["MSC_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["STD_NAME"] };
GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid3, col);
this.ultraGrid3.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
if (dt.Rows.Count == 1)
{
foreach (UltraGridRow row in ultraGrid3.Rows)
{
if (row.Cells["MATCHORDER"].Text == "OK")
{
row.Cells["CHK"].Value = true;
}
}
}
}
else
{
this.dataTable1.Clear();
}
}
else
{
DataTable ds = new DataTable();
if (steelName.Equals("C335"))
{
ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrderCxN", new object[] { list,arr }, this.ob);
}
else
{
ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryOrderCx", new Object[] { list, arr }, this.ob);
}
if (ds.Rows.Count > 0)
{
for (int i = 0; i < ds.Rows.Count; i++)
{
if (ds.Rows[i]["ORDER_NO"].ToString() == orderNm && ds.Rows[i]["ORDER_SEQ"].ToString().PadLeft(4,'0') == orderSeq)
{
//ds.Rows[i]["MATCHORDER"] = "合同匹配,合同物料匹配";
ds.Rows[i]["MATCHORDER"] = "OK";
}
else
{
ds.Rows[i]["MATCHORDER"] = "合同不匹配,合同物料匹配";
}
}
}
GridHelper.CopyDataToDatatable(ref ds, ref dataTable1, true);
UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid3.DisplayLayout.Bands[0].Columns["LEN_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["PSC_DESC"],
ultraGrid3.DisplayLayout.Bands[0].Columns["MSC_DESC"], ultraGrid3.DisplayLayout.Bands[0].Columns["STD_NAME"] };
GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid3, col);
this.ultraGrid3.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter;
}
}
}
else
{
dataTable1.Clear();
}
}
///
/// 获取产销产线
///
///
private void getFactory(UltraGridRow ugr)
{
if (ugr == null)
{
return;
}
string factory = ugr.Cells["factory"].Text;
DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFactory", new object[] { factory }, this.ob);
if (dt.Rows.Count > 0)
{
this.cmbFactory.Text = dt.Rows[0]["PLINE_NAME"].ToString();
//this.cmbFactory.DataSource = dt;
//this.cmbFactory.SelectedIndex = 0;
}
else
{
this.cmbFactory.Text = "";
}
}
///
/// 获取产销钢种
///
///
private void getGrade(UltraGridRow ugr)
{
if (ugr == null)
{
return;
}
string grade = ugr.Cells["steelgrade"].Text;
DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getGrade", new object[] { grade }, this.ob);
if (dt.Rows.Count > 0)
{
this.cmbSteel.Text = dt.Rows[0]["GRADENAME"].ToString();
//this.cmbFactory.DataSource = dt;
//this.cmbFactory.SelectedIndex = 0;
}
else
{
this.cmbSteel.Text = grade;
}
}
///
/// 获取合同总量、已缴库总量、估算总量
///
///
///
private string[] getOrderWgt(string orderNo)
{
string[] str = new string[3];
DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getOrderWgt", new object[] { orderNo }, this.ob);
if (dt.Rows.Count > 0)
{
str[0] = dt.Rows[0]["ORDERWEIGHT"].ToString();//估算量
str[1] = dt.Rows[0]["PAYDOWNWEIGHT"].ToString();//已缴库量
str[2] = dt.Rows[0]["ORDER_QTY"].ToString();//订货量
}
return str;
}
///
/// ultraGrid1内置按钮点击事件
///
///
///
private void ultraGrid1_ClickCellButton(object sender, CellEventArgs e)
{
ultraGrid3.UpdateData();
ultraGrid1.UpdateData();
string buttonValue = "";//返回的按钮值
string frmcount = "";//返回的支数
string frmWgt = "";//返回的重量值
string frmFinishedCode = "";
storageParm = new ArrayList();
matParm = new ArrayList();
statusUpdate = new ArrayList();
plnSpale = new ArrayList();
ArrayList listdt = new ArrayList();
string[] wgtList = new string[3];
int conu = 0;
string orderType = "";
int count = 0;
UltraGridRow ugr3 = ultraGrid3.ActiveRow;
UltraGridRow row = ultraGrid1.ActiveRow;
if (ugr3 == null) { MessageUtil.ShowTips("待缴库无合同数据,不能进行此操作"); return; }
if (row == null) { MessageUtil.ShowTips("无质保判定炉信息,不能进行此操作"); return; }
double strWgt = 0;//炉重
double endWgt = 0;//已缴库量
double orderWgt = 0;//合同量
int nn = 0;
foreach (UltraGridRow row7 in ultraGrid3.Rows)
{
if (Convert.ToBoolean(row7.Cells["CHK"].Text) == true)
{
nn++;
}
}
if (nn < 1)
{
MessageUtil.ShowTips("请勾选待缴库合同数据!");
return;
}
if (row.Cells["hgweight"].Text == "")
{
MessageUtil.ShowTips("该炉还未生产,无法缴库!");
return;
}
if (double.Parse(row.Cells["hgweight"].Text) < 0)
{
MessageUtil.ShowWarning("已缴库量无法进行冲销!");
return;
}
strWgt += double.Parse(row.Cells["hgweight"].Value.ToString());
UltraGridRow grid3Row = null;
foreach (UltraGridRow row8 in ultraGrid3.Rows)
{
if (Convert.ToBoolean(row8.Cells["CHK"].Text) == true)
{
grid3Row = row8;
}
}
string strOrder = grid3Row.Cells["ORDER_NO"].Text.Trim() + "/" + grid3Row.Cells["ORDER_SEQ"].Text.Trim().PadLeft(4,'0');
double delPla = 0;//已缴库量
string _length = "";//长度范围
int d = 0;
double downLength = 0;//下限
double upLength = 0;//上限
string orderUnit = "";//长度单位
double dbOrderMax = 0;
double reckonWgt = 0;//估算量上限
string gSwgt = "";//合同估算总量
string pipSwgt = "";//合同缴库总量
string dSwgt = "";//订货总量
DataTable ds = new DataTable();
if (row.Cells["CXSTUPP"].Text.Trim() == "")
{
MessageUtil.ShowTips("您选择的质保信息未匹配,不能进行缴库!");
return;
}
if (row.Cells["CXSTUPP"].Text.Trim() == "物料不匹配")
{
MessageUtil.ShowTips("您选择的质保信息物料不匹配,不能进行缴库!");
return;
}
if (grid3Row.Cells["MATCHORDER"].Text.Trim().Contains("合同物料不匹配"))
{
MessageUtil.ShowTips("合同物料不匹配不允许缴库!");
return;
}
if (grid3Row.Cells["MATCHORDER"].Text.Trim().Contains("合同不匹配"))
{
MessageUtil.ShowTips("合同不匹配不允许缴库,可强制缴库!");
return;
}
ds.Clear();
ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.getSqlServerStaus", new object[] { row.Cells["ordername"].Text, row.Cells["lcode"].Text, row.Cells["lotno"].Text, row.Cells["hgunit"].Text, row.Cells["hgweight"].Text, row.Cells["rcdid"].Text }, this.ob);
if (ds.Rows[0][0].ToString() == "20")
{
MessageUtil.ShowTips("您选中的【" + row.Cells["lcode"].Text.Trim() + "】这炉已缴库,请重新选择!");
return;
}
if (cmbStorage.Text.ToString() == "")
{
MessageBox.Show("请选择要存放的仓库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
else
{
storageno = cmbStorage.Value.ToString();
}
if (this.cmbFactory.Text.ToString() == "")
{
//MessageUtil.ShowTips("产线不允许为空!");
//return;
factoryCode = "";
factoryNo = "";
}
else
{
factoryCode = this.cmbFactory.Value.ToString();
factoryNo = this.cmbFactory.Text.ToString();
}
//if (this.cmbSteel.Text.ToString() == "")
//{
// //MessageUtil.ShowTips("钢种不允许为空!");
// //return;
// steelCode = "";
// steelName = "";
//}
//else
//{
// steelCode = this.cmbSteel.Value.ToString();
// steelName = this.cmbSteel.Text.ToString();
//}
if (this.cmbSource.Text.ToString() == "")
{
sourceCode = "";
sourceName = "";
}
else
{
sourceCode = this.cmbSource.Value.ToString();
sourceName = this.cmbSource.Text.ToString();
}
//if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米") || grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
//{
// if (row.Cells["hgm"].Text.Trim() == "")
// {
// MessageUtil.ShowTips("此合同是按长度交货,长度为空不能缴库!");
// return;
// }
//}
if (this.txt_Ks.Value == null)
{
ks = "0";
}
else
{
ks = this.txt_Ks.Value.ToString();
}
_length = row.Cells["leng"].Text.Trim();
if (_length != "")
{
d = _length.IndexOf("-");
downLength = double.Parse(_length.Substring(0, d));
upLength = double.Parse(_length.Substring(d + 1));
if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("米"))
{
if (!(compareToValue(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim()), double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim()), downLength) && compareToValue(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim()), double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim()), upLength)))
{
if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + ugr3.Cells["LEN"].Text + "】米,是否缴库?") == DialogResult.No)
{
return;
}
}
}
else if (grid3Row.Cells["LEN_UNIT"].Text.Trim().Contains("英尺"))
{
if (!(compareToValue(FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())), FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())), downLength) && compareToValue(FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())),FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())), upLength)))
{
//if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + ugr3.Cells["LEN"].Text + "】英尺,是否缴库?") == DialogResult.No)
//{
// return;
//}
if (MessageUtil.ShowYesNoAndQuestion("当前炉【" + row.Cells["lcode"].Text + "】缴库长度【" + _length + "】不满足合同长度【" + FootoMi(double.Parse(grid3Row.Cells["LEN_MIN"].Text.Trim())).ToString() + "-" + FootoMi(double.Parse(grid3Row.Cells["LEN_MAX"].Text.Trim())).ToString() + "】(英尺换算),是否缴库?") == DialogResult.No)
{
return;
}
}
}
}
else
{
MessageUtil.ShowTips("长度上下限为空,不允许缴库可进行强制缴库!");
return;
}
string newSql_no = "";
//conu += 1;
int index = row.Cells["ordername"].Text.Trim().IndexOf("/");
string sql_no = row.Cells["ordername"].Text.Trim().Substring(index + 1);
if (sql_no.Length < 4)
{
sql_no = sql_no.PadLeft(4, '0');
}
if (strOrder != (row.Cells["ordername"].Text.Trim().Substring(0, index) + "/" + sql_no))
{
MessageUtil.ShowTips("质保数据合同号" + (row.Cells["ordername"].Text.Trim().Substring(0, index) + "/" + sql_no) + "信息与待缴合同" + strOrder + "信息不一致,不能缴库可强制缴库!");
return;
}
delPla += double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Text.Trim());
orderType = doQueryOrderType(row.Cells["ordername"].Text.Trim().Substring(0, index));
if (orderType.Equals("120103"))
{
MessageUtil.ShowTips("该合同为研发合同,不允许缴库!");
return;
}else if(orderType.Equals("120104"))
{
MessageUtil.ShowTips("该合同为预排合同,只允许强制缴库成成品!");
return;
}
if (strWgt > 0)
{
orderUnit = grid3Row.Cells["ORDER_UNIT"].Text.Trim();
endWgt = double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString());
orderWgt = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString());
string strRANGE_MIN = grid3Row.Cells["DELVRY_RANGE_MIN"].Text.Trim();//交货量差下限
string strRANGE_MAX = grid3Row.Cells["DELVRY_RANGE_MAX"].Text.Trim();//交货量差上限
double dbQtyMin = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) - double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MIN) / 100);//合同行下限值
double dbQtyMax = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//合同行上限值
double dbJhMax = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//交货量差上限值
if (orderUnit.Contains("支") || orderUnit.Equals("吨"))
{
dbOrderMax = double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) + double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);
}
else if (orderUnit.Contains("磅"))
{
dbOrderMax = Math.Round(double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) * 0.45359 / 1000 + double.Parse(ugr3.Cells["ORDER_QTY"].Value.ToString()) * 0.45359 / 1000 * (double.Parse(strRANGE_MAX) / 100), 3);
}
wgtList = getOrderWgt(grid3Row.Cells["ORDER_NO"].Text.ToString());
if (wgtList.Length > 0)
{
gSwgt = wgtList[0];
pipSwgt = wgtList[1];
dSwgt = wgtList[2];
}
if (orderUnit.Equals("吨")||orderUnit.Equals("支")||orderUnit.Contains("磅"))
{
if (endWgt > dbOrderMax)
{
if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
{
return;
}
frmBatchesPip frm = new frmBatchesPip(ob);
frm.AllCount = row.Cells["hgunit"].Text.Trim();
frm.AllWgt = row.Cells["hgweight"].Text.Trim();
if (dbOrderMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString()) < 0)
{
frm.SxWgt = "0";
}
else
{
frm.SxWgt = (dbQtyMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
}
frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
frm.ShowDialog();
buttonValue = frm.buttonValue;
frmcount = frm.count;
frmWgt = frm.outWgt;
frmFinishedCode = frm.finishedProduct;
if (!frm.flag)
{
return;
}
if (buttonValue == "0")
{
return;
}
if (buttonValue == "2")
{
if (int.Parse(frmcount) > int.Parse(row.Cells["hgunit"].Text.Trim()))
{
MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
return;
}
if (double.Parse(frmWgt) + endWgt > dbOrderMax)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
{
return;
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
if (buttonValue == "1")
{
if ((strWgt + endWgt) > dbOrderMax)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
}
else
{
if ((strWgt + endWgt) > dbOrderMax)
{
frmBatchesPip frm = new frmBatchesPip(ob);
frm.AllCount = row.Cells["hgunit"].Text.Trim();
frm.AllWgt = row.Cells["hgweight"].Text.Trim();
frm.SxWgt = (dbOrderMax - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
frm.ShowDialog();
buttonValue = frm.buttonValue;
frmcount = frm.count;
frmWgt = frm.outWgt;
frmFinishedCode = frm.finishedProduct;
if (!frm.flag)
{
return;
}
if (buttonValue == "0")
{
return;
}
if (buttonValue == "2")
{
if (int.Parse(frmcount) > int.Parse(row.Cells["hgunit"].Text.Trim()))
{
MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
return;
}
if (double.Parse(frmWgt) + endWgt > dbOrderMax)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
{
return;
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
if (buttonValue == "1")
{
if ((strWgt + endWgt) > dbOrderMax)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(dSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
}
}
}
else if (orderUnit.Equals("英尺") || orderUnit.Equals("米"))
{
if (grid3Row.Cells["ORDERWEIGHT"].Value.ToString() == "")
{
MessageUtil.ShowTips("此合同【" + strOrder + "】是以英尺为交货单位!,估算量为空不能缴库!");
return;
}
reckonWgt = double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) + double.Parse(grid3Row.Cells["ORDERWEIGHT"].Value.ToString()) * (double.Parse(strRANGE_MAX) / 100);//估算量上限
if (endWgt > reckonWgt)
{
//MessageUtil.ShowTips("此合同行缴库量已超出交货量上限,不允许缴库!");
//return;
if (MessageUtil.ShowYesNoAndQuestion("此合同行缴库量已超出交货量上限,是否继续缴库?") == DialogResult.No)
{
return;
}
frmBatchesPip frm = new frmBatchesPip(ob);
frm.AllCount = row.Cells["hgunit"].Text.Trim();
frm.AllWgt = row.Cells["hgweight"].Text.Trim();
if (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString()) < 0)
{
frm.SxWgt = "0";
}else
{
frm.SxWgt = (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
}
frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
frm.ShowDialog();
buttonValue = frm.buttonValue;
frmcount = frm.count;
frmWgt = frm.outWgt;
frmFinishedCode = frm.finishedProduct;
if (!frm.flag)
{
return;
}
if (buttonValue == "0")
{
return;
}
if (buttonValue == "2")
{
if (int.Parse(frmcount) > int.Parse(row.Cells["hgunit"].Text.Trim()))
{
MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
return;
}
if (double.Parse(frmWgt) + endWgt > reckonWgt)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
{
return;
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
if (buttonValue == "1")
{
if ((strWgt + endWgt) > reckonWgt)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
}
else
{
if ((strWgt + endWgt) > reckonWgt)
{
frmBatchesPip frm = new frmBatchesPip(ob);
frm.AllCount = row.Cells["hgunit"].Text.Trim();
frm.AllWgt = row.Cells["hgweight"].Text.Trim();
frm.SxWgt = (reckonWgt - double.Parse(grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString())).ToString();
frm.PipWgt = grid3Row.Cells["PAYDOWNWEIGHT"].Value.ToString();
frm.ShowDialog();
buttonValue = frm.buttonValue;
frmcount = frm.count;
frmWgt = frm.outWgt;
frmFinishedCode = frm.finishedProduct;
if (!frm.flag)
{
return;
}
if (buttonValue == "0")
{
return;
}
if (buttonValue == "2")
{
if (int.Parse(frmcount) > int.Parse(row.Cells["hgunit"].Text.Trim()))
{
MessageUtil.ShowTips("分批缴库支数不能大于现有支数!");
return;
}
if (double.Parse(frmWgt) + endWgt > reckonWgt)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库量还是大于合同行交货量差上线,是否继续缴库?") == DialogResult.No)
{
return;
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
if (buttonValue == "1")
{
if ((strWgt + endWgt) > reckonWgt)
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同行总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
if ((strWgt + double.Parse(pipSwgt)) > double.Parse(gSwgt))
{
if (MessageUtil.ShowYesNoAndQuestion("缴库总量大于合同总量,是否继续缴库?") == DialogResult.No)
{
return;
}
}
}
}
}
}
}
//foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row3 in ultraGrid1.Rows)
//{
// if (Convert.ToBoolean(row3.Cells["CHK"].Text) == true)
// {
// if (double.Parse(row3.Cells["hgweight"].Text.Trim()) < 0)
// {
// if (double.Parse(row3.Cells["hgweight"].Text.Trim()) + double.Parse(ugr3.Cells["PAYDOWNWEIGHT"].Text.Trim()) < 0)
// {
// MessageUtil.ShowTips("冲销的重量不能比已缴库重量大!");
// return;
// }
// else
// {
// if (int.Parse(row3.Cells["hgunit"].Text.Trim()) > int.Parse(ugr3.Cells["PAYDOWN_NUM"].Text.Trim()))
// {
// MessageUtil.ShowTips("冲销支数不能比已缴库支数多!");
// return;
// }
// }
// }
// }
//}
UltraGridRow[] rows = ultraGrid3.Rows.AsQueryable().Where(a => bool.Parse(a.Cells["CHK"].Value.ToString()))
.OrderBy(a => a.Cells["DELIVERY_NO"].Value.ToString()).ToArray();
double dbDelvry = 0;
double dbweigh = 0;
double dbcount = 0;
double endweigth = 0;
//DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.queryIn", new Object[] { storageParm, matParm, statusUpdate, plnSpale, row.Cells["hgunit"].Value.ToString() }, this.ob);
if (MessageUtil.ShowYesNoAndQuestion("是否确认缴库?") == DialogResult.No) return;
ArrayList matList = new ArrayList();
ArrayList plnList = new ArrayList();
double stWeight = 0;
double dbunit = 0;
//DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doPipeIn", new Object[] {}, this.ob);
//if (grid3Row.Cells["PORDERSTATUS"].Text.Trim().Equals("生产中"))
//{
// MessageUtil.ShowTips("待缴库合同在生产中,不能进行缴库!");
// return;
//}
if (buttonValue == "2")
{
stWeight = double.Parse(frmWgt);
dbunit = double.Parse(frmcount);
}
else
{
stWeight = double.Parse(row.Cells["hgweight"].Value.ToString());//已缴库量+炉(重量)
dbunit = double.Parse(row.Cells["hgunit"].Value.ToString());//已缴库支数+炉(支数)
}
ArrayList storageList = new ArrayList(); //仓库位置参数
storageList.Add(row.Cells["lcode"].Text.Trim());
storageList.Add(row.Cells["lotno"].Text.Trim());
storageList.Add(row.Cells["hgunit"].Text.Trim());
storageList.Add(storageno);
storageList.Add(storageno + "10101");
storageList.Add(storagetype);
storageList.Add(storagetypedesc);
//storageList.Add(manageno);
//storageList.Add(managedesc);
storageList.Add(this.UserInfo.GetUserName());
storageList.Add(row.Cells["hgweight"].Value.ToString());
storageList.Add(this.UserInfo.GetDeptid());
storageList.Add(this.UserInfo.GetDepartment());//37
storageList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
storageList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
storageParm.Add(storageList);
#region 要缴库的每一炉重量小于要缴库的重量
matList.Add(row.Cells["lcode"].Text.Trim()); //炉号
matList.Add(row.Cells["lotno"].Text.Trim());//批号
matList.Add(row.Cells["hgunit"].Text.Trim());//支数
matList.Add(grid3Row.Cells["PRODUCCODE"].Value.ToString());//品名代码
matList.Add(grid3Row.Cells["PRODUCNAME"].Value.ToString());//品名名称
if (row.Cells["cxsteellevel"].Text == "N80Q")
{
matList.Add(row.Cells["cxsteellevel"].Value.ToString());
matList.Add(row.Cells["cxsteellevel"].Text);
}
else
{
matList.Add(grid3Row.Cells["STEELCODE"].Value.ToString());//钢级(牌号)代码
matList.Add(grid3Row.Cells["STEELNAME"].Value.ToString());//钢级名称
}
matList.Add(grid3Row.Cells["SPEC_CODE"].Value.ToString());//产品规格代码
matList.Add(grid3Row.Cells["SPEC_NAME"].Value.ToString());//产品规格描述
matList.Add(grid3Row.Cells["MODEL_CODE"].Value.ToString());//扣型代码
matList.Add(grid3Row.Cells["MODEL_DESC"].Value.ToString());//扣型描述 10
matList.Add(grid3Row.Cells["STD_CODE"].Value.ToString());//标准代码
//matList.Add("");
//matList.Add(row.Cells["standard"].Value.ToString());
matList.Add(grid3Row.Cells["STD_NAME"].Value.ToString());//标准名称
matList.Add(grid3Row.Cells["CREATE_DEPT"].Value.ToString());
matList.Add(grid3Row.Cells["DEPARTNAME"].Value.ToString());
matList.Add(grid3Row.Cells["STD_STYLE"].Value.ToString());//标准类别代码
matList.Add(grid3Row.Cells["STD_STYLE_DESC"].Value.ToString());//标准类别描述
matList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());//合同号
matList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());//合同行号
matList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());//交货行号
matList.Add(grid3Row.Cells["ORD_PK"].Value.ToString());//合同主键
matList.Add(grid3Row.Cells["ORD_LN_PK"].Value.ToString());//合同行主键
matList.Add(grid3Row.Cells["ORD_LN_DLY_PK"].Value.ToString());//交货行主键
matList.Add(grid3Row.Cells["DIMATER"].Value.ToString());// 外径
matList.Add(grid3Row.Cells["HEIGHT"].Value.ToString());//壁厚
matList.Add(grid3Row.Cells["LEN_NO"].Value.ToString());//长度编码(订货)
matList.Add(grid3Row.Cells["LEN_DESC"].Value.ToString());//长度描述(订货)
matList.Add(grid3Row.Cells["LEN_UNIT"].Value.ToString());//长度单位 27
string length = row.Cells["leng"].Text.Trim();
int n = length.IndexOf("-");
string lengMin = length.Substring(0, n);
string lengMax = length.Substring(n + 1);
matList.Add(lengMin);//下限
matList.Add(lengMax);//上限
matList.Add(this.UserInfo.GetUserName());//操作人
matList.Add("0");
matList.Add("1");
matList.Add(row.Cells["testidea"].Value.ToString());//备注
matList.Add(row.Cells["HGWEIGHT"].Value.ToString());
double weight = Convert.ToDouble(row.Cells["HGWEIGHT"].Value.ToString());
double unit = Convert.ToDouble(row.Cells["HGUNIT"].Value.ToString());
DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
if (dtMemo.Rows.Count >= 1)
{
strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
}
matList.Add(strInMemo);
matList.Add(this.UserInfo.GetDeptid());
matList.Add(this.UserInfo.GetDepartment());//37
matList.Add(strInbound);
matList.Add(this.cmbStorage.Value.ToString());//仓库号
matList.Add(grid3Row.Cells["SALE_ORG"].Value.ToString());//片区
matList.Add(grid3Row.Cells["SALE_ORG_DESC"].Value.ToString());//销售组织
if (buttonValue == "2")
{
matList.Add(frmcount);//42
}
else
{
matList.Add(row.Cells["hgunit"].Value.ToString());
}
matList.Add(row.Cells["rcdid"].Value.ToString());
matList.Add(row.Cells["hgm"].Value.ToString());//长度
matList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
matList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
matList.Add(row.Cells["standard"].Value.ToString());//判定标准
//matList.Add(row.Cells["testdate"].Value.ToString().Substring(0, 4) + row.Cells["testdate"].Value.ToString().Substring(5, 2));// 判定时间
matList.Add(row.Cells["testdate"].Value.ToString());//判定时间
matList.Add(factoryCode);
matList.Add(factoryNo);
//matList.Add(steelCode);
//matList.Add(steelName);
matList.Add("");
matList.Add(row.Cells["steelgrade"].Text.ToString());
matList.Add(this.txtMemo.Text.Trim());
matList.Add(row.Cells["ordername"].Value.ToString());//质保合同号
matList.Add(sourceCode);//材料来源代码
matList.Add(sourceName);//材料名称
matList.Add(ks);
if (buttonValue == "1")
{
matList.Add("801703");//成品区分
}
else if (buttonValue == "2")
{
matList.Add("801701");//成品区分
}
matParm.Add(matList);
plnList.Add(stWeight.ToString("f3"));
if (double.Parse(row.Cells["hgweight"].Value.ToString()) > 0)
{
plnList.Add(dbunit.ToString());
}
else
{
plnList.Add(int.Parse(ugr3.Cells["hgunit"].Text.Trim()).ToString());
}
plnList.Add(this.UserInfo.GetUserName());
plnList.Add(grid3Row.Cells["ORDER_NO"].Value.ToString());
plnList.Add(grid3Row.Cells["ORDER_SEQ"].Value.ToString());
plnList.Add(grid3Row.Cells["DELIVERY_NO"].Value.ToString());
plnSpale.Add(plnList);
//break;
#endregion
//}
//else
//{
// return;
//}
ArrayList statusList = new ArrayList();
statusList.Add(row.Cells["lcode"].Value.ToString());
statusList.Add(row.Cells["lotno"].Value.ToString());
statusList.Add(row.Cells["factory"].Value.ToString());
statusList.Add(row.Cells["testdate"].Value.ToString());
statusList.Add(row.Cells["hgunit"].Value.ToString()); //支数
statusList.Add(row.Cells["hgweight"].Value.ToString());//重量
statusList.Add(row.Cells["RCDID"].Value.ToString());
statusUpdate.Add(statusList);
//count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.CorePipeInTemp.doPipeIn", new Object[] { storageParm, matParm, statusUpdate, plnSpale }, this.ob);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.ydm.pipemanage.CorePipeInTemp";
ccp.MethodName = "doPipeIn";
ccp.ServerParams = new object[] { storageParm, matParm, statusUpdate, plnSpale };
ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("缴库成功!"))
{
QueryMatData();
this.cmbSteel.Text = "";
this.cmbFactory.Text = "";
this.txt_Ks.Value = "0";
QueryOrder(grid3Row.Cells["ORDER_NO"].Text.Trim(), grid3Row.Cells["ORDER_SEQ"].Text.Trim());
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
///
/// ultraGrid1 托选
///
///
///
private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
{
try
{
ultraGrid1.UpdateData();
foreach (UltraGridRow r in ultraGrid1.Rows)
{
r.Cells["CHK"].Value = r.Selected;
}
}
catch { }
}
///
/// ultraGrid3 托选
///
///
///
private void ultraGrid3_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
{
try
{
ultraGrid3.UpdateData();
foreach (UltraGridRow r in ultraGrid3.Rows)
{
r.Cells["CHK"].Value = r.Selected;
}
}
catch { }
}
private void frmPipeInTemp_Shown(object sender, EventArgs e)
{
if (toolMenu.Toolbars[0].Tools.Exists("DataMatch"))
{
toolMenu.Toolbars[0].Tools["DataMatch"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("Maint"))
{
toolMenu.Toolbars[0].Tools["Maint"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("Refresh"))
{
toolMenu.Toolbars[0].Tools["Refresh"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("PipeIn"))
{
toolMenu.Toolbars[0].Tools["PipeIn"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("PipeIn1"))
{
toolMenu.Toolbars[0].Tools["PipeIn1"].InstanceProps.Visible = DefaultableBoolean.True;
}
//toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.True;
if (toolMenu.Toolbars[0].Tools.Exists("Query"))
{
toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
{
toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
{
toolMenu.Toolbars[0].Tools["Query2"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("CanclePipe"))
{
toolMenu.Toolbars[0].Tools["CanclePipe"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("QueryInList"))
{
toolMenu.Toolbars[0].Tools["QueryInList"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateStoreNo"))
{
toolMenu.Toolbars[0].Tools["updateStoreNo"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateCarryOverDate"))
{
toolMenu.Toolbars[0].Tools["updateCarryOverDate"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("adjustStoreButress"))
{
toolMenu.Toolbars[0].Tools["adjustStoreButress"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateStaus"))
{
toolMenu.Toolbars[0].Tools["updateStaus"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateMemo"))
{
toolMenu.Toolbars[0].Tools["updateMemo"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("updateFinishedProduct"))
{
toolMenu.Toolbars[0].Tools["updateFinishedProduct"].InstanceProps.Visible = DefaultableBoolean.False;
}
this.chkBathYear.Visible = false;
this.dtBathYear.Visible = false;
}
private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
{
string strqux = "";
iSelectG3Row = -1;
UltraGridRow uRow = ultraGrid1.ActiveRow;
if (uRow == null) return;
strqux = "炉号:" + uRow.Cells["lcode"].Text.Trim() +" "+ "去向:" + uRow.Cells["destination"].Text.Trim() + " " + "产线:" + uRow.Cells["factory"].Text.Trim() + " " + "备注:" + uRow.Cells["testidea"].Text.Trim();
ultraLabel1.Text = strqux;
//if (uRow.Cells["destination"].Text.Trim() != "")
//{
// this.cmbStorage.Text = uRow.Cells["destination"].Text.Trim();
//}
GetOrderNo(uRow);
getFactory(uRow);
getGrade(uRow);
}
///
/// 仓库号选中条件
///
///
///
private void chkStrong_CheckedChanged(object sender, EventArgs e)
{
//if (chkStrong.Checked)
//{
// cmbStorager.ReadOnly = false;
//}
//else
//{
// cmbStorager.ReadOnly = true;
// cmbStorager.Text = "";
//}
this.cmbStorager.Enabled = this.chkStrong.Checked;
}
//全选
private void chkAll_CheckedChanged(object sender, EventArgs e)
{
int chkint = 0;
if (chkAll.Checked)
{
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
{
if (uRow.Cells["CXSTUPP"].Value.ToString().Equals(""))
{
chkint += 1;
if (chkint > 50) return;
uRow.Cells["CHK"].Value = true;
}
}
}
else
{
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows)
{
uRow.Cells["CHK"].Value = false;
}
}
}
private void ultraGrid2_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
{
foreach (UltraGridRow uRow in ultraGrid2.Selected.Rows)
{
if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
{
uRow.Cells["CHOOSE"].Value = true;
}
}
}
private void ultraCheckEditor5_CheckedChanged(object sender, EventArgs e)
{
StartTime.Enabled = this.ultraCheckEditor5.Checked;
this.EndTime.Enabled = this.ultraCheckEditor5.Checked;
}
private void ultraGrid1_ClickCell(object sender, ClickCellEventArgs e)
{
string strqux = "";
UltraGridRow uRow = ultraGrid1.ActiveRow;
if (uRow == null) return;
strqux = "炉号:" + uRow.Cells["lcode"].Text.Trim() +" "+ "去向:" + uRow.Cells["destination"].Text.Trim() + " " + "产线:" + uRow.Cells["factory"].Text.Trim() + " " + "备注:" + uRow.Cells["testidea"].Text.Trim();
ultraLabel1.Text = strqux;
//if (uRow.Cells["destination"].Text.Trim() != "")
//{
// this.cmbStorage.Text = uRow.Cells["destination"].Text.Trim();
//}
GetOrderNo(uRow);
getFactory(uRow);
getGrade(uRow);
// QueryOrder();
}
private void ultraGrid4_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
{
foreach (UltraGridRow uRow in ultraGrid4.Selected.Rows)
{
if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
{
uRow.Cells["CHK"].Value = true;
}
}
}
///
/// 判断值在某范围内
///
///
///
///
///
private bool compareToValue(double min,double max,double value)
{
if(value>=min && max>=value)
{
return true;
}else
{
return false;
}
}
int iSelectG3Row = -1;
private void ultraGrid3_CellChange(object sender, CellEventArgs e)
{
ultraGrid3.UpdateData();
if (e.Cell.Column.Key.ToString().ToUpper() == "CHK")
{
if (e.Cell.Value.ToString().ToUpper() == "TRUE")
{
if (iSelectG3Row != -1)
ultraGrid3.Rows[iSelectG3Row].Cells["CHK"].Value = false;
iSelectG3Row = e.Cell.Row.Index;
}
else
{
iSelectG3Row = -1;
}
}
//bool chk = (bool)e.Cell.Value;
//UltraGridRow[] rows = GridHelper.GetRowsWithKey(ultraGrid2,
// new string[] { "CHK" }, new string[] { "True" });
//foreach (UltraGridRow row in rows)
//{
// if (e.Cell.Row.Equals(row)) continue;
// row.Cells["CHK"].Value = false;
//}
}
/// 单位英尺长度转米
///
/// 英尺长度
/// 米长度
public static double FootoMi(double lenth)
{
double converate = 0.3048; //换算率
return Math.Round((lenth * converate), 2);
}
private void cmbJudge_KeyDown(object sender, KeyEventArgs e)
{
if (ultraTabControl1.SelectedTab.Key == "1")
{
if (e.KeyValue == 13)
{
QueryMatData();
}
}
else if (ultraTabControl1.SelectedTab.Key == "2")
{
if (e.KeyValue == 13)
{
QueryPipedData();
}
}
else
{
if (e.KeyValue == 13)
{
QueryInList();
}
}
}
private void cmbOrder_KeyDown(object sender, KeyEventArgs e)
{
if (ultraTabControl1.SelectedTab.Key == "1")
{
if (e.KeyValue == 13)
{
QueryMatData();
}
}
else if (ultraTabControl1.SelectedTab.Key == "2")
{
if (e.KeyValue == 13)
{
QueryPipedData();
}
}
else
{
if (e.KeyValue == 13)
{
QueryInList();
}
}
}
private void cmbMatch_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyValue == 13)
{
QueryMatData();
}
}
//private void ultraGrid4_CellChange(object sender, CellEventArgs e)
//{
// ultraGrid4.UpdateData();
// UltraGridRow ugr = this.ultraGrid4.ActiveRow;
// string ss = ugr.Cells["BAL_YEAR_MONTH"].Text;
// if (ss.Length == 6)
// {
// string dd = ss.Substring(0, 4);
// string gg = ss.Substring(4, 2);
// if (dd.Length < 4 || int.Parse(dd) > 2015)
// {
// MessageUtil.ShowTips("年份输入不正确");
// return;
// }
// if (gg.Length < 2 || int.Parse(gg) > 12 || int.Parse(gg) < 1)
// {
// MessageUtil.ShowTips("月份输入不正确");
// return;
// }
// if (!StringUtil.IsNotDateTime(dd))
// {
// MessageUtil.ShowTips("输入的值不为日期格式,请重新输入!");
// return;
// }
// }
// else
// {
// MessageUtil.ShowTips("结算日期输入不正确!");
// }
//}
private void ultraGrid4_KeyUp(object sender, KeyEventArgs e)
{
BaseMethod.setGridCopyActColumn(ultraGrid4, e, "BAL_YEAR_MONTH");
}
private void ultraGrid2_KeyUp(object sender, KeyEventArgs e)
{
BaseMethod.setGridCopyActColumn1(ultraGrid2, e, "STORAGE_NO");
}
private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
{
//BandUnitDepartments(e);
if (e.Row.Cells["CXSTUPP"].Value.ToString().Equals("物料不匹配"))
{
e.Row.Appearance.ForeColor = Color.Red;
}
}
///
/// 连动
///
///
///
private void cmbSource_ValueChanged(object sender, EventArgs e)
{
if (this.cmbSource.Text != "")
{
if (this.cmbSource.Value.ToString() == "801302")//产线
{
YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFactoryDetail", "PLINE_CODE", this.ob, false);
}
else if (this.cmbSource.Value.ToString() == "801301")//外购
{
YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getWg", "BASE_CODE", this.ob, false);
}
else if (this.cmbSource.Value.ToString() == "801303")//倒库
{
YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getDk", "BASE_CODE", this.ob, false);
}
else if (this.cmbSource.Value.ToString() == "801304")//外委
{
YdmBaseClass.InitComboEditor(cmbFactory, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getWw", "BASE_CODE", this.ob, false);
}
}
}
private void chkBathYear_CheckedChanged(object sender, EventArgs e)
{
this.dtBathYear.Enabled = this.chkBathYear.Checked;
}
}
}