You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
834 lines
33 KiB
834 lines
33 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using ICSSoft.Base.Config.AppConfig;
|
|
using ICSSoft.Base.Config.DBHelper;
|
|
using System.IO;
|
|
using ICSSoft.Frame.Data.BLL;
|
|
using ICSSoft.Frame.Data.Entity;
|
|
|
|
namespace ICSSoft.Frame.APP
|
|
{
|
|
public partial class UserControlDrawingView : UserControl
|
|
{
|
|
public UserControlDrawingView()
|
|
{
|
|
InitializeComponent();
|
|
|
|
panelTuZhi.Dock = DockStyle.Fill;
|
|
pnlShiYa.Dock = DockStyle.Fill;
|
|
pnlZiJian.Dock = DockStyle.Fill;
|
|
|
|
pnlTechnology.Dock = DockStyle.Fill;
|
|
pnlProgram.Dock = DockStyle.Fill;
|
|
pnlVideo.Dock = DockStyle.Fill;
|
|
pnlItem.Dock = DockStyle.Fill;
|
|
|
|
panelTool.Dock = DockStyle.Fill;
|
|
panelparts.Dock = DockStyle.Fill;
|
|
}
|
|
public string LotNo;
|
|
public string ItemCode;
|
|
public string RouteCode;
|
|
public string OPCode;
|
|
public string OPDesc;
|
|
public string EQPCode;
|
|
public string EQPType;
|
|
private string Type;
|
|
private string Suffix = "pdf";
|
|
public string ItemStd;
|
|
public string MachineState;
|
|
|
|
public void init(string type)
|
|
{
|
|
Type = type;
|
|
if (type.Equals(FileDrawing.ZhuangPei) || type.Equals(FileDrawing.PengQi) || type.Equals(FileDrawing.QiLu) || type.Equals(FileDrawing.YanMo))
|
|
{
|
|
panelTuZhi.BringToFront();
|
|
panelparts.Visible = false;
|
|
if (!string.IsNullOrWhiteSpace(ItemCode))
|
|
{
|
|
BandData(ItemCode, Suffix, FileDrawing.TuZhi, axAcroPDFTZ);
|
|
}
|
|
pnlItem.BringToFront();
|
|
GetData(gridControl1, gridView1);
|
|
}
|
|
else if (type.Equals(FileDrawing.ShiYa))
|
|
{
|
|
pnlShiYa.BringToFront();
|
|
SYdtSource(LotNo);
|
|
pnlTechnology.BringToFront();
|
|
panelparts.Visible = false;
|
|
if (!string.IsNullOrWhiteSpace(ItemCode))
|
|
{
|
|
BandData(ItemCode, Suffix, FileDrawing.TuZhi, axAcroPDF);
|
|
}
|
|
}
|
|
else if (type.Equals(FileDrawing.ZiJian))
|
|
{
|
|
pnlZiJian.BringToFront();
|
|
selfCheckData(LotNo);
|
|
pnlTechnology.BringToFront();
|
|
panelparts.Visible = false;
|
|
if (!string.IsNullOrWhiteSpace(ItemCode))
|
|
{
|
|
BandData(ItemCode, Suffix, FileDrawing.TuZhi, axAcroPDF);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
#region LiewView显示控制
|
|
private void listViewZPMenu_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
string MainTypeCode = GetMainTypeCode(ItemCode);
|
|
MediaStop();
|
|
if (listViewZPMenu.SelectedItems.Count == 0)
|
|
return;
|
|
ListView listView = sender as ListView;
|
|
string text = listView.SelectedItems[0].Text;
|
|
if (text.Equals(FileDrawing.TuZhi)) //图纸
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(ItemCode))
|
|
{
|
|
if (Type.Equals(FileDrawing.ShiYa) || Type.Equals(FileDrawing.ZiJian))
|
|
{
|
|
pnlTechnology.BringToFront();
|
|
panelparts.Visible = false;
|
|
BandData(ItemCode, Suffix, FileDrawing.TuZhi, axAcroPDF);
|
|
}
|
|
else
|
|
BandData(ItemCode, Suffix, FileDrawing.TuZhi, axAcroPDFTZ);
|
|
}
|
|
}
|
|
else if (text.Equals(FileDrawing.CuJiaGong)) //规范
|
|
{
|
|
//pnlSpecs.BringToFront();
|
|
pnlTechnology.BringToFront();
|
|
panelparts.Visible = false;
|
|
|
|
if (!string.IsNullOrWhiteSpace(ItemCode + "-" + OPCode))
|
|
{
|
|
BandData(ItemCode + "-" + OPCode, Suffix, FileDrawing.CuJiaGong, axAcroPDF);
|
|
}
|
|
}
|
|
else if (text.Equals(FileDrawing.WuLiao)) //物料清单
|
|
{
|
|
pnlItem.BringToFront();
|
|
panelparts.Visible = false;
|
|
GetData(gridControl1, gridView1);
|
|
}
|
|
else if (text.Equals(FileDrawing.ZuoYeZhiDao)) //工艺
|
|
{
|
|
pnlTechnology.BringToFront();
|
|
panelparts.Visible = false;
|
|
if (!string.IsNullOrWhiteSpace(RouteCode) && !string.IsNullOrWhiteSpace(OPCode))
|
|
{
|
|
BandData(RouteCode + "_" + OPCode, Suffix, FileDrawing.ZuoYeZhiDao, axAcroPDF);
|
|
}
|
|
}
|
|
else if (text.Equals(FileDrawing.PeiXun)) //培训文件
|
|
{
|
|
pnlTechnology.BringToFront();
|
|
panelparts.Visible = false;
|
|
if (!string.IsNullOrWhiteSpace(RouteCode))
|
|
{
|
|
BandData(RouteCode, Suffix, FileDrawing.PeiXun, axAcroPDF);
|
|
}
|
|
}
|
|
else if (text.Equals(FileDrawing.ChengXu)) //程序
|
|
{
|
|
pnlProgram.BringToFront();
|
|
panelparts.Visible = false;
|
|
if (!string.IsNullOrWhiteSpace(ItemCode) && !string.IsNullOrWhiteSpace(OPCode))
|
|
{
|
|
string fileName = ItemCode + "_" + OPCode;
|
|
if (MachineState == "是")
|
|
{
|
|
fileName += "_N";
|
|
}
|
|
DataTable dt = FileDrawing.GetDrawingDT(fileName, "CNC", FileDrawing.ChengXu);
|
|
gridControl2.DataSource = dt;
|
|
gridView3.BestFitColumns();
|
|
// string fileName = FileDrawing.GetDrawing(ItemCode + "_" + OPCode, "CNC", FileDrawing.CHENGXU);
|
|
// StreamReader reader = new StreamReader(fileName, Encoding.Default);
|
|
// txtProgram.Text = reader.ReadToEnd();
|
|
// reader.Close();
|
|
}
|
|
}
|
|
else if (text.Equals(FileDrawing.ZhuYi)) //注意事项
|
|
{
|
|
pnlTechnology.BringToFront();
|
|
panelparts.Visible = false;
|
|
if (!string.IsNullOrWhiteSpace(RouteCode) && !string.IsNullOrWhiteSpace(OPCode))
|
|
{
|
|
BandData(RouteCode + "_" + OPCode, Suffix, FileDrawing.ZhuYi, axAcroPDF);
|
|
}
|
|
}
|
|
else if (text.Equals(FileDrawing.GuiFan))
|
|
{
|
|
pnlTechnology.BringToFront();
|
|
panelparts.Visible = false;
|
|
if (!string.IsNullOrWhiteSpace(OPCode))
|
|
{
|
|
BandData(OPCode, Suffix, FileDrawing.GuiFan, axAcroPDF);
|
|
}
|
|
}
|
|
else if (text.Equals(FileDrawing.WenTi))
|
|
{
|
|
pnlTechnology.BringToFront();
|
|
panelparts.Visible = false;
|
|
if (!string.IsNullOrWhiteSpace(MainTypeCode))
|
|
{
|
|
BandData(MainTypeCode, Suffix, FileDrawing.WenTi, axAcroPDF);
|
|
}
|
|
}
|
|
else if (text.Equals(FileDrawing.SZuoYeZhiDao))
|
|
{
|
|
pnlTechnology.BringToFront();
|
|
panelparts.Visible = false;
|
|
if (!string.IsNullOrWhiteSpace(EQPType))
|
|
{
|
|
BandData(EQPType, Suffix, FileDrawing.SZuoYeZhiDao, axAcroPDF);
|
|
}
|
|
}
|
|
else if (text.Equals(FileDrawing.SheBei))
|
|
{
|
|
pnlTechnology.BringToFront();
|
|
panelparts.Visible = false;
|
|
if (!string.IsNullOrWhiteSpace(EQPType))
|
|
{
|
|
BandData(EQPType, Suffix, FileDrawing.SheBei, axAcroPDF);
|
|
}
|
|
}
|
|
else if (text.Equals(FileDrawing.WPS))
|
|
{
|
|
pnlTechnology.BringToFront();
|
|
panelparts.Visible = false;
|
|
if (!string.IsNullOrWhiteSpace(ItemCode))
|
|
{
|
|
BandData(ItemCode, Suffix, FileDrawing.WPS, axAcroPDF);
|
|
}
|
|
}
|
|
else if (text.Equals(FileDrawing.ToolSpec))
|
|
{
|
|
panelTool.BringToFront();
|
|
panelparts.Visible = false;
|
|
//20181107
|
|
if (!string.IsNullOrWhiteSpace(EQPCode))
|
|
{
|
|
BandData(ItemCode, Suffix, FileDrawing.ToolSpec, axAcroPDF);
|
|
|
|
GetDataEQPTools(gridControlEQPTools, gridView2);
|
|
if (!string.IsNullOrWhiteSpace(ItemCode))
|
|
{
|
|
GetDataProTool(gridControlItemOpTools, gridView4);
|
|
|
|
GetDataProToolDifference(gridControl3, gridView5);
|
|
}
|
|
}
|
|
|
|
}
|
|
else if (text.Equals(FileDrawing.GongZhuang))
|
|
{
|
|
#region 工装信息
|
|
panelparts.Visible = true;
|
|
panelparts.BringToFront();
|
|
if (!string.IsNullOrWhiteSpace(ItemCode) && !string.IsNullOrWhiteSpace(OPCode))
|
|
{
|
|
GetPartsInfo(gridControl4, gridView6);
|
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 根据存货编码查询产品主分类编码
|
|
private string GetMainTypeCode(string itemCode)
|
|
{
|
|
try
|
|
{
|
|
string MainTypeCode = FileDrawing.GetMainTypeCode(itemCode);
|
|
return MainTypeCode;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message);
|
|
return "Error";
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 根据存货编码查询列表信息
|
|
private void BandData(string itemCode, string suffix, string type, AxAcroPDFLib.AxAcroPDF axAcroPDF)
|
|
{
|
|
try
|
|
{
|
|
string fileName = FileDrawing.GetDrawing(itemCode, suffix, type);
|
|
|
|
if (!string.IsNullOrEmpty(fileName))
|
|
{
|
|
axAcroPDF.LoadFile(fileName);
|
|
axAcroPDF.setShowToolbar(false);
|
|
axAcroPDF.setShowScrollbars(false);
|
|
axAcroPDF.setPageMode("thumbs");
|
|
axAcroPDF.setLayoutMode("SinglePage");
|
|
axAcroPDF.setView("Fit");
|
|
axAcroPDF.Show();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message);
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 视频
|
|
public void GetMedia(AxWMPLib.AxWindowsMediaPlayer axWindowsMediaPlayer)
|
|
{
|
|
//string fileName = @"C:\Users\Public\Videos\Sample Videos\ysdw.wmv";
|
|
if (string.IsNullOrWhiteSpace(RouteCode))
|
|
return;
|
|
string fileName = FileDrawing.GetDrawing(RouteCode, "mp4", FileDrawing.ShiPin);
|
|
|
|
if (!string.IsNullOrEmpty(fileName))
|
|
{
|
|
axWindowsMediaPlayer.windowlessVideo = false; //设为false后双击屏幕可以全屏
|
|
//axWindowsMediaPlayer.fullScreen = true; //设播放器全屏播放
|
|
axWindowsMediaPlayer.URL = fileName;
|
|
//axWindowsMediaPlayer.Ctlcontrols.play(); //播放
|
|
//axWindowsMediaPlayer.Ctlcontrols.stop(); //停止
|
|
//axWindowsMediaPlayer.Ctlcontrols.pause(); //暂停
|
|
}
|
|
}
|
|
public void MediaStop()
|
|
{
|
|
axWindowsMediaPlayer1.Ctlcontrols.stop(); //停止
|
|
}
|
|
#endregion
|
|
|
|
#region 物料清单
|
|
private void GetData(DevExpress.XtraGrid.GridControl gridControl, DevExpress.XtraGrid.Views.Grid.GridView gridView)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(ItemCode))
|
|
return;
|
|
string sql = @"SELECT DISTINCT a.ITEMCODE,
|
|
b.ItemName,
|
|
a.OBITEMCODE,
|
|
a.OBITEMNAME,
|
|
a.OBITEMQTY
|
|
from ICSOPBOMDETAIL a
|
|
left join Base_Inventory b on a.ITEMCODE=b.ITEMCODE
|
|
where a.ITEMCODE='" + ItemCode + "'";
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
|
|
gridControl.DataSource = dt;
|
|
gridView.BestFitColumns();
|
|
}
|
|
|
|
#region 列表
|
|
private void grvDetail_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
|
|
{
|
|
if (e.Info.IsRowIndicator && e.RowHandle >= 0)
|
|
e.Info.DisplayText = (e.RowHandle + 1).ToString();
|
|
}
|
|
#endregion
|
|
#endregion
|
|
|
|
private void SYdtSource(string lotno)
|
|
{
|
|
|
|
try
|
|
{
|
|
|
|
string sql = @" select distinct
|
|
a.ID,
|
|
a.ProjectCode,
|
|
a.PTModelCode,
|
|
a.TestSEQ,
|
|
list.TestName,
|
|
a.TestContent,
|
|
a.Data5,
|
|
|
|
cast(0 as bit) as TestResult
|
|
|
|
from ICSPressureTestData a
|
|
left join ICSPressureTestList list on a.PTModelCode=list.PTModelCode and a.TestSEQ=list.TestSEQ
|
|
inner join ICSMO b on a.ProjectCode=b.ProjectCode
|
|
inner join ICSMO2Lot c on b.MOCODE=c.MOCODE
|
|
|
|
WHERE c.LOTNO='" + lotno + "' order by a.TestSEQ";
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
if (dr["Data5"].ToString() != "" && dr["TestData"].ToString() != "")
|
|
{
|
|
if (decimal.Parse(dr["Data5"].ToString()) > decimal.Parse(dr["TestData"].ToString()))
|
|
{
|
|
dr["TestResult"] = "True";
|
|
|
|
}
|
|
else
|
|
{
|
|
dr["TestResult"] = "False";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (dr["Data5"].ToString() == "" && dr["TestData"].ToString() != "")
|
|
{
|
|
if (dr["TestData"].ToString() == "1")
|
|
{
|
|
dr["TestResult"] = "True";
|
|
}
|
|
if (dr["TestData"].ToString() == "0")
|
|
{
|
|
dr["TestResult"] = "0False";
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
gridControlsyks.DataSource = dt;
|
|
gridViewsyks.BestFitColumns();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message);
|
|
|
|
}
|
|
}
|
|
|
|
private void selfCheckData(string lotNo)
|
|
{
|
|
if (lotNo != "")
|
|
{
|
|
string sql = @"SELECT b.ProjectCode,c.ItemMainCategoryCode,a.LOTNO INTO #t1
|
|
FROM ICSMO2Lot a
|
|
INNER JOIN dbo.ICSMO b ON a.MOID = b.ID
|
|
INNER JOIN dbo.Base_Inventory c ON b.ITEMCODE = c.ItemCode
|
|
WHERE a.LOTNO = '" + lotNo + @"'
|
|
SELECT * FROM
|
|
(SELECT a.GUID,c.ProjectID,c.ProjectName,d.QCStandardSEQ,
|
|
d.QCStandardNAME,d.ID AS PROJECTSID,'' as NGLog,
|
|
'' as SelfCheckData,
|
|
CONVERT(BIT,1) AS ISOK FROM dbo.ICSQCPROJECTCLASS a
|
|
INNER JOIN #t1 b ON a.ItemClassCode = b.ItemMainCategoryCode
|
|
INNER JOIN dbo.ICSQCPROJECT c ON a.ProjectGUID = c.guid
|
|
INNER JOIN dbo.ICSQCPROJECTCLASSS d ON a.guid = d.guid
|
|
UNION ALL
|
|
SELECT a.GUID,c.ProjectID,c.ProjectName,d.QCStandardSEQ,
|
|
d.QCStandardNAME,d.ID AS PROJECTSID,'' as NGLog,
|
|
'' as SelfCheckData,
|
|
CONVERT(BIT,1) AS ISOK FROM dbo.ICSQCPROJECTCLASS a
|
|
INNER JOIN #t1 b ON a.ProjectCode = b.ProjectCode
|
|
INNER JOIN dbo.ICSQCPROJECT c ON a.ProjectGUID = c.guid
|
|
INNER JOIN dbo.ICSQCPROJECTCLASSS d ON a.guid = d.guid) a
|
|
ORDER BY convert(int,ProjectID),convert(int,QCStandardSEQ)
|
|
DROP TABLE #t1";
|
|
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
grdDetails.DataSource = dt;
|
|
grvDetails.BestFitColumns();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void btnEnlarge_Click(object sender, EventArgs e)
|
|
{
|
|
Button button = sender as Button;
|
|
switch (button.Name.ToString())
|
|
{
|
|
case "btnEnlargeTZ":
|
|
FileDrawing.Enlarge(axAcroPDFTZ);
|
|
break;
|
|
case "btnEnlarge":
|
|
FileDrawing.Enlarge(axAcroPDF);
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void fileRead_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
|
|
{
|
|
|
|
try
|
|
{
|
|
DevExpress.XtraGrid.Views.Grid.GridView view = ((DevExpress.XtraGrid.Views.Grid.GridView)(gridControl2.MainView));
|
|
int rowhandle = view.FocusedRowHandle;
|
|
DataRow dr = view.GetDataRow(rowhandle);
|
|
|
|
string connectionString = AppConfig.GetDataBaseConnectStringByKey("[DB.FTP]");
|
|
string[] ftps = connectionString.Split(';');
|
|
string ftpServerIP = ftps[0].Split('=')[1];
|
|
string ftpRemotePath = ftps[1].Split('=')[1];
|
|
string ftpUserID = ftps[2].Split('=')[1];
|
|
string ftpPassword = ftps[3].Split('=')[1];
|
|
//string ftpServerIP = System.Configuration.ConfigurationManager.AppSettings["FtpServerIP"];
|
|
//string ftpRemotePath = System.Configuration.ConfigurationManager.AppSettings["FtpRemotePath"];
|
|
//string ftpUserID = System.Configuration.ConfigurationManager.AppSettings["FtpUserID"];
|
|
//string ftpPassword = System.Configuration.ConfigurationManager.AppSettings["FtpPassword"];
|
|
//string viewerApp = System.Configuration.ConfigurationManager.AppSettings["ViewerApp"];
|
|
FtpWeb ftpWeb = new FtpWeb(ftpServerIP, ftpRemotePath, ftpUserID, ftpPassword);
|
|
string filePath = System.IO.Path.GetTempPath() + "\\tempfiles";
|
|
|
|
if (!Directory.Exists(filePath))
|
|
{
|
|
Directory.CreateDirectory(filePath);
|
|
}
|
|
|
|
//文件名称有 ID + “$” + 版本 + 文件格式组成
|
|
string fileName = dr["FileID"].ToString() + "$" + dr["FileVer"].ToString() + "." + dr["FileFormat"].ToString();
|
|
|
|
fileName = fileName.Replace("/", "");
|
|
ftpWeb.Download(filePath + "\\", fileName);
|
|
|
|
string filePathName = filePath + "\\" + fileName;
|
|
if (dr["FileFormat"].ToString().Equals("CNC"))
|
|
{
|
|
string downPath = "C:\\mesjk";
|
|
string downName = downPath + "\\NC.txt";
|
|
|
|
if (!Directory.Exists(downPath))
|
|
{
|
|
Directory.CreateDirectory(downPath);
|
|
}
|
|
|
|
if (!File.Exists(downName))
|
|
{
|
|
File.Create(downName).Close();
|
|
}
|
|
//产品跟踪单_工序_设备编号
|
|
//StreamReader reader = new StreamReader(filePathName, Encoding.Default);
|
|
//string text = reader.ReadToEnd();
|
|
//reader.Close();
|
|
StreamWriter writer = new StreamWriter(downName);
|
|
string text = LotNo + "_" + OPCode + "_" + EQPCode;
|
|
writer.Write(text);
|
|
writer.Close();
|
|
//using (FileStream fs = new FileStream(downName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))
|
|
//{
|
|
// StreamWriter sw = new StreamWriter(fs);
|
|
// string text = LotNo + "_" + OPCode + "_" + EQPCode;
|
|
// sw.Write(text);
|
|
// sw.Close();
|
|
// sw.Dispose(); //释放资源
|
|
|
|
//}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
//获取刀具基本信息20181107
|
|
private void GetDataEQPTools(DevExpress.XtraGrid.GridControl gridControl, DevExpress.XtraGrid.Views.Grid.GridView gridView)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(EQPCode))
|
|
return;
|
|
string sql = @"SELECT
|
|
a.ID,
|
|
a.EQPCode,
|
|
a.EQPName,
|
|
a.SPECCode,
|
|
a.[Size],
|
|
a.SPECName,
|
|
a.Trademark,
|
|
a.EATTRIBUTE1 as ToolNumber,
|
|
a.EATTRIBUTE2,
|
|
a.WorkPoint,
|
|
a.MUSER,
|
|
a.MUSERName,
|
|
a.MTIME
|
|
FROM ICSToolSizeAndEquipment a
|
|
where a.EQPCode='" + EQPCode + "' order by ToolNumber";
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
|
|
gridControl.DataSource = dt;
|
|
gridView.BestFitColumns();
|
|
}
|
|
|
|
//获取刀具配置20181107
|
|
private void GetDataProTool_bak20181115(DevExpress.XtraGrid.GridControl gridControl, DevExpress.XtraGrid.Views.Grid.GridView gridView)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(ItemCode) || string.IsNullOrWhiteSpace(OPCode))
|
|
return;
|
|
string sql = @"SELECT
|
|
a.ID,
|
|
a.ITEMCODE,
|
|
b.ItemName AS ITEMNAME,
|
|
a.OPCODE,
|
|
d.OPDESC AS OPNAME,
|
|
a.ToolSPECCode,
|
|
f.SPECName AS SPECNamez,
|
|
a.WorkPoint,
|
|
a.MUSER,
|
|
a.MUSERName,
|
|
a.ToolNo ,
|
|
|
|
a.CheckName,
|
|
a.CheckTime,
|
|
CAST(a.IsChecked AS BIT) AS IsCheck,
|
|
a.LotNo,
|
|
|
|
a.MTIME
|
|
FROM
|
|
dbo.ICSITEMROUTE2OPTool a
|
|
LEFT JOIN Base_Inventory b ON b.ItemCode = a.ITEMCODE
|
|
LEFT JOIN ICSOP d ON a.OPCODE = d.OPCODE
|
|
LEFT JOIN ICSToolSize f ON f.SPECCode = a.ToolSPECCode
|
|
WHERE
|
|
1 = 1
|
|
and a.ITEMCODE='" + ItemCode + "' and a.OPCODE='" + OPCode + "' ORDER BY CAST ( substring(a.ToolNo,2,LEN(a.ToolNo)-1) AS INT) ";
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
|
|
gridControlItemOpTools.DataSource = dt;
|
|
gridView4.BestFitColumns();
|
|
}
|
|
|
|
|
|
//获取刀具配置20181107
|
|
private void GetDataProTool(DevExpress.XtraGrid.GridControl gridControl, DevExpress.XtraGrid.Views.Grid.GridView gridView)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(ItemCode) || string.IsNullOrWhiteSpace(OPCode))
|
|
return;
|
|
string sql = @"SELECT
|
|
a.ID,
|
|
a.ITEMCODE,
|
|
b.ItemName AS ITEMNAME,
|
|
a.OPCODE,
|
|
d.OPDESC AS OPNAME,
|
|
a.ToolSPECCode,
|
|
f.SPECName AS SPECNamez,
|
|
a.WorkPoint,
|
|
a.MUSER,
|
|
a.MUSERName,
|
|
a.ToolNo,
|
|
a.CheckName,
|
|
a.CheckTime,
|
|
a.LotNo,
|
|
a.MTIME,
|
|
CAST (YY.IsChecked AS BIT) AS IsCheck
|
|
FROM
|
|
dbo.ICSITEMROUTE2OPTool a
|
|
LEFT JOIN Base_Inventory b ON b.ItemCode = a.ITEMCODE
|
|
LEFT JOIN ICSOP d ON a.OPCODE = d.OPCODE
|
|
LEFT JOIN ICSToolSize f ON f.SPECCode = a.ToolSPECCode
|
|
LEFT JOIN (
|
|
SELECT
|
|
tt.OPCODE,
|
|
tt.ToolNo,
|
|
tt.ITEMCODE,
|
|
tt.IsChecked
|
|
FROM
|
|
ICSITEMROUTE2OPTool tt
|
|
WHERE
|
|
1 = 1
|
|
AND tt.ITEMCODE = '" + ItemCode + " '" +
|
|
"AND tt.OPCODE = '" + OPCode + "' AND tt.LotNo = '" + LotNo + "'" +
|
|
") AS YY ON ( YY.ITEMCODE = a.ITEMCODE AND YY.OPCODE = a.OPCODE AND YY.ToolNo = a.ToolNo)" +
|
|
"WHERE 1 = 1 and a.ITEMCODE='" + ItemCode + "' and a.OPCODE='" + OPCode + "' ORDER BY CAST ( substring(a.ToolNo,2,LEN(a.ToolNo)-1) AS INT) ";
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
|
|
gridControlItemOpTools.DataSource = dt;
|
|
gridView4.BestFitColumns();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 保存产品刀具点检记录20181114
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//List<ICSITEMROUTE2OPTool> list = new List<ICSITEMROUTE2OPTool>();
|
|
|
|
//for (int j = 0; j < gridView4.RowCount; j++)
|
|
//{
|
|
// ICSITEMROUTE2OPTool ICSITEMROUTE2OPTool = new ICSITEMROUTE2OPTool();
|
|
|
|
// if (!string.IsNullOrWhiteSpace(gridView4.GetRowCellValue(j, colID).ToString()))
|
|
// {
|
|
// ICSITEMROUTE2OPTool.ID = gridView4.GetRowCellValue(j, colID).ToString();
|
|
// }
|
|
// if (!string.IsNullOrWhiteSpace(gridView4.GetRowCellValue(j, colOPCODE).ToString()))
|
|
// {
|
|
// ICSITEMROUTE2OPTool.OPCODE = gridView4.GetRowCellValue(j, colOPCODE).ToString();
|
|
// }
|
|
// else
|
|
// {
|
|
// ICSITEMROUTE2OPTool.OPCODE = string.Empty;
|
|
// }
|
|
// if (!string.IsNullOrWhiteSpace(gridView4.GetRowCellValue(j, colITEMCODE).ToString()))
|
|
// {
|
|
// ICSITEMROUTE2OPTool.ITEMCODE = gridView4.GetRowCellValue(j, colITEMCODE).ToString();
|
|
// }
|
|
// else
|
|
// {
|
|
// ICSITEMROUTE2OPTool.ITEMCODE = string.Empty;
|
|
// }
|
|
// if (!string.IsNullOrWhiteSpace(gridView4.GetRowCellValue(j, colToolSPECCode).ToString()))
|
|
// {
|
|
// ICSITEMROUTE2OPTool.ToolSPECCode = gridView4.GetRowCellValue(j, colToolSPECCode).ToString();
|
|
// }
|
|
// else
|
|
// {
|
|
// ICSITEMROUTE2OPTool.ToolSPECCode = string.Empty;
|
|
// }
|
|
// if (!string.IsNullOrWhiteSpace(gridView4.GetRowCellValue(j, colToolNo).ToString()))
|
|
// {
|
|
// ICSITEMROUTE2OPTool.ToolNo = gridView4.GetRowCellValue(j, colToolNo).ToString();
|
|
// }
|
|
// else
|
|
// {
|
|
// ICSITEMROUTE2OPTool.ToolNo = string.Empty;
|
|
// }
|
|
// ICSITEMROUTE2OPTool.CheckName = AppConfig.UserCode;
|
|
// ICSITEMROUTE2OPTool.CheckTime = DateTime.Parse(DateTime.Now.ToString());
|
|
// ICSITEMROUTE2OPTool.LotNo = LotNo;
|
|
// if (!string.IsNullOrWhiteSpace(gridView4.GetRowCellValue(j, colIsCheck).ToString()))
|
|
// {
|
|
// string a = gridView4.GetRowCellValue(j, colIsCheck).ToString();
|
|
// if (gridView4.GetRowCellValue(j, colIsCheck).ToString() == "True")
|
|
// {
|
|
// ICSITEMROUTE2OPTool.IsChecked = 1;
|
|
// }
|
|
// if (gridView4.GetRowCellValue(j, colIsCheck).ToString() == "False")
|
|
// {
|
|
// ICSITEMROUTE2OPTool.IsChecked = 0;
|
|
// }
|
|
// //ICSITEMROUTE2OPTool.IsChecked = Int32.Parse(gridView4.GetRowCellValue(j, colIsCheck).ToString());
|
|
// }
|
|
// else
|
|
// {
|
|
// ICSITEMROUTE2OPTool.IsChecked = 0;
|
|
// }
|
|
// list.Add(ICSITEMROUTE2OPTool);
|
|
//}
|
|
//ICSDrawingViewBLL.AddList(list, AppConfig.AppConnectString);
|
|
//ICSBaseSimpleCode.AppshowMessageBox(0, "保存成功");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox(ex.ToString());
|
|
}
|
|
//for (int i = 0; i < grvDetail.RowCount; i++)
|
|
//{
|
|
// strContent = grvDetail.GetRowCellValue(i, colContent).ToString();
|
|
// strContentList.Add(strContent);
|
|
//}
|
|
}
|
|
|
|
//获取差异数据20181114
|
|
private void GetDataProToolDifference(DevExpress.XtraGrid.GridControl gridControl, DevExpress.XtraGrid.Views.Grid.GridView gridView)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(ItemCode) || string.IsNullOrWhiteSpace(OPCode))
|
|
return;
|
|
//工序刀具
|
|
string OPToolTable = @"
|
|
SELECT
|
|
a.ToolSPECCode,
|
|
f.SPECName AS SPECNamez,
|
|
a.ToolNo
|
|
FROM dbo.ICSITEMROUTE2OPTool a
|
|
LEFT JOIN ICSToolSize f ON f.SPECCode = a.ToolSPECCode
|
|
WHERE 1 = 1
|
|
and a.ITEMCODE='" + ItemCode + "' and a.OPCODE='" + OPCode + "' ORDER BY CAST ( substring(a.ToolNo,2,LEN(a.ToolNo)-1) AS INT) ";
|
|
DataTable OPTooldt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, OPToolTable).Tables[0];
|
|
//设备刀具
|
|
string EQPToolTable = @"SELECT
|
|
a.SPECCode,
|
|
a.SPECName,
|
|
a.EATTRIBUTE1 as ToolNumber
|
|
FROM ICSToolSizeAndEquipment a
|
|
where a.EQPCode='" + EQPCode + "' ORDER BY CAST ( substring(a.EATTRIBUTE1,2,LEN(a.EATTRIBUTE1)-1) AS INT) ";
|
|
DataTable EQPTooldt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, EQPToolTable).Tables[0];
|
|
|
|
DataTable dt2 = new DataTable();
|
|
dt2.Columns.Add("ToolSPECCodeEnd", typeof(string));//
|
|
dt2.Columns.Add("ToolNo3", typeof(string));//
|
|
dt2.Columns["ToolSPECCodeEnd"].Caption = "刀具规格";
|
|
dt2.Columns["ToolNo3"].Caption = "刀号";
|
|
if (OPTooldt != null && OPTooldt.Rows.Count > 0)
|
|
{
|
|
foreach (DataRow row in OPTooldt.Rows)
|
|
{
|
|
string ToolSpecCode = row["ToolSPECCode"].ToString();
|
|
string SPECNamez = row["SPECNamez"].ToString();
|
|
string ToolNo = row["ToolNo"].ToString();
|
|
if (EQPTooldt != null && EQPTooldt.Rows.Count > 0)
|
|
{
|
|
//var a = from r in EQPTooldt.AsEnumerable()
|
|
// where r.Field<string>("ToolSPECCode") != ToolSpecCode
|
|
// select EQPTooldt;
|
|
if (EQPTooldt.Select("SPECCode" + "='" + ToolSpecCode + "'").Length > 0)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
DataRow dr2 = null;
|
|
dr2 = dt2.NewRow();
|
|
dr2["ToolSPECCodeEnd"] = ToolSpecCode;
|
|
dr2["ToolNo3"] = ToolNo;
|
|
|
|
dt2.Rows.Add(dr2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
gridControl3.DataSource = dt2;
|
|
gridView5.BestFitColumns();
|
|
}
|
|
|
|
//获取工装配置
|
|
private void GetPartsInfo(DevExpress.XtraGrid.GridControl gridControl, DevExpress.XtraGrid.Views.Grid.GridView gridView)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(OPCode) || string.IsNullOrWhiteSpace(ItemCode))
|
|
return;
|
|
string sql = @" SELECT DISTINCT
|
|
a.ITEMCODE,
|
|
f.EATTRIBUTE1,
|
|
a.PartsCode as 磅级,
|
|
e.ToolingManagementCode as 工装编码,
|
|
e.UseLevel as 使用描述,
|
|
e.PartsDesc as 备注,
|
|
e.EATTRIBUTE1 AS 工装名称
|
|
FROM
|
|
dbo.ICSITEMROUTE2OPTooling a
|
|
LEFT JOIN Base_Inventory b ON b.ItemCode = a.ITEMCODE
|
|
LEFT JOIN ICSITEMROUTE2OP c ON c.OPCODE = a.OPCODE
|
|
LEFT JOIN ICSOP d ON c.OPCODE = d.OPCODE
|
|
LEFT JOIN ICSPartsList e ON e.PartsCode = a.PartsCode AND a.ToolingManagementCode=e.ToolingManagementCode
|
|
LEFT JOIN ICSToolingManagement f ON f.ToolingManagementCode=e.ToolingManagementCode
|
|
WHERE
|
|
a.OPCODE='" + OPCode + "' AND a.ITEMCODE='" + ItemCode + "'";
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
|
|
gridControl4.DataSource = dt;
|
|
gridView6.BestFitColumns();
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|