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.
2392 lines
90 KiB
2392 lines
90 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using DevExpress.XtraEditors;
|
|
using ICSSoft.Base.Language.Tool;
|
|
using ICSSoft.Base.UserControl.MessageControl;
|
|
using System.Data.SqlClient;
|
|
using ICSSoft.Base.Config.AppConfig;
|
|
using ICSSoft.Base.Report.Filter;
|
|
using ICSSoft.Base.Config.DBHelper;
|
|
using ICSSoft.Base.UserControl.FormControl;
|
|
using ICSSoft.Base.ReferForm.AppReferForm;
|
|
using ICSSoft.Base.Lable.PrintTool;
|
|
using System.IO;
|
|
using Newtonsoft.Json;
|
|
using System.Timers;
|
|
using DevExpress.XtraGrid.Views.Grid;
|
|
using Newtonsoft.Json.Linq;
|
|
using DevExpress.XtraBars.Helpers;
|
|
using DevExpress.LookAndFeel;
|
|
using System.Configuration;
|
|
using ICSSoft.Frame.APP.Model;
|
|
using ICSSoft.Frame.APP.Helper;
|
|
using DevExpress.XtraGrid.Columns;
|
|
using System.Media;
|
|
using System.Reflection;
|
|
using System.IO.Ports;
|
|
using FastReport;
|
|
using System.Threading;
|
|
using ICSSoft.Frame.APP;
|
|
|
|
namespace ICSSoft.Frame.APP
|
|
{
|
|
//ICSLOTSIMULATION 批次lotNo =>开工完工,其他信息无用
|
|
//ICSLOTONWIP 批次lotNo,工序OP =>开工完工
|
|
//ICSLOTONWIPDetail 批次lotNo,工序OP,人员User,每次 (多人多次)=>开工,完工,暂停
|
|
|
|
|
|
|
|
public partial class FormICSWorkReport : DevExpress.XtraEditors.XtraForm
|
|
{
|
|
System.Timers.Timer timerUser = new System.Timers.Timer();
|
|
System.Timers.Timer timerOP = new System.Timers.Timer();
|
|
|
|
#region 参数
|
|
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
|
|
|
|
static string OnwipIpAddress = ConfigurationManager.AppSettings["OnwipApiAddress"];
|
|
static string MixApiAddress = ConfigurationManager.AppSettings["MixApiAddress"];
|
|
static string OpApi = OnwipIpAddress + ConfigurationManager.AppSettings["OpApi"];
|
|
static string PotApi = OnwipIpAddress + ConfigurationManager.AppSettings["PotApi"];
|
|
static string EqpApi = OnwipIpAddress + ConfigurationManager.AppSettings["EqpApi"];
|
|
static string OnwipStartApi = OnwipIpAddress + ConfigurationManager.AppSettings["OnwipStartApi"];
|
|
static string OnwipEndApi = OnwipIpAddress + ConfigurationManager.AppSettings["OnwipEndApi"];
|
|
static string LotNoApi = OnwipIpAddress + ConfigurationManager.AppSettings["LotNoApi"];
|
|
static string UserApi = OnwipIpAddress + ConfigurationManager.AppSettings["UserApi"];
|
|
//static string CheckApi = OnwipIpAddress + ConfigurationManager.AppSettings["CheckApi"];
|
|
static string AuthenticateApi = ConfigurationManager.AppSettings["AuthenticateApi"];
|
|
static string Account = ConfigurationManager.AppSettings["Account"];
|
|
static string PassWord = ConfigurationManager.AppSettings["PassWord"];
|
|
static string Tenant = ConfigurationManager.AppSettings["Tenant"];
|
|
static string CancelLotOnWipBeginApi = OnwipIpAddress + ConfigurationManager.AppSettings["CancelLotOnWipBeginApi"];
|
|
static string FirtCheckApi = OnwipIpAddress + ConfigurationManager.AppSettings["FirtCheckApi"];
|
|
static string GetMixApi = MixApiAddress + ConfigurationManager.AppSettings["GetMixApi"];
|
|
static string GetCurrentConnectStrings = MixApiAddress + ConfigurationManager.AppSettings["GetCurrentConnectStrings"];
|
|
static string CreateOrUpdateIcsLot2OpMix = MixApiAddress + ConfigurationManager.AppSettings["CreateOrUpdateIcsLot2OpMix"];
|
|
static string CheckCreateOrUpdateIcsLot2OpMix = MixApiAddress + "CheckCanSl";
|
|
static string WmsDbLink = ConfigurationManager.AppSettings["WmsDbLink"];
|
|
static string WmsWorkpoint = ConfigurationManager.AppSettings["WmsWorkpoint"];
|
|
static string WmsUser = ConfigurationManager.AppSettings["WmsUser"];
|
|
static string LOTStockDown = ConfigurationManager.AppSettings["LOTStockDown"];
|
|
static string LotOnWipOpEnd = OnwipIpAddress + ConfigurationManager.AppSettings["LotOnWipOpEnd"];
|
|
static string UnLockEqpUrl = OnwipIpAddress + ConfigurationManager.AppSettings["UnLockEqpUrl"];
|
|
static string WmsLocationCode = ConfigurationManager.AppSettings["LOCATIONCODE"];
|
|
static string CustomPower= ConfigurationManager.AppSettings["CustomPower"];
|
|
|
|
static IcsOPListDto Op = new IcsOPListDto();
|
|
static SelectItemExt UserMes = new SelectItemExt();
|
|
static AuthenticateResultDto AuthenicateResult = new AuthenticateResultDto();//Tocken实体
|
|
static AuthenticateModel Authenticate = new AuthenticateModel();//认证实体
|
|
static IcsLotOnWipDto Onwip = new IcsLotOnWipDto();//报工实体
|
|
static IcsEquipmentDto EqpDto = new IcsEquipmentDto();//设备实体
|
|
static IcsPotListDto PoDto = new IcsPotListDto();//锅具实体
|
|
static string GetEcApi = ConfigurationManager.AppSettings["GetEcApi"];
|
|
static List<IcsLot2OpMixDetailsListDto> JbSources;//搅拌信息数据源
|
|
static List<IcsLot2OpMixDetailsListDto> JbDetails = new List<IcsLot2OpMixDetailsListDto>();//本次搅拌上料记录
|
|
static string Conns { get; set; }
|
|
static DataTable ItemLotNOMes { get; set; }
|
|
decimal revCounts = 0;
|
|
StringDtoEx chengMes { get; set; }
|
|
SerialPort port = new SerialPort();
|
|
ModelEnum model;
|
|
ModelEnum _model { get { return model; } set { OnModelChange(value); model = value; } }
|
|
|
|
System.Windows.Forms.Timer ColorTimer = new System.Windows.Forms.Timer();//定时器更新搅拌时间颜色
|
|
|
|
|
|
public void OnModelChange(ModelEnum model)
|
|
{
|
|
if (model != this.model)
|
|
{
|
|
if (model == ModelEnum.Default)
|
|
{
|
|
DefaultModel();
|
|
}
|
|
else if (model == ModelEnum.Custom)
|
|
{
|
|
CustomModel();
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region SystemOptition
|
|
/// <summary>
|
|
/// 操作权限
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public DataTable RightOfExute()
|
|
{
|
|
DataTable rData = new DataTable();
|
|
rData.Columns.Add("BtnName");
|
|
rData.Columns.Add("ActionName");
|
|
//查看权限(必须有)
|
|
DataRow seeRow = rData.NewRow();
|
|
seeRow["BtnName"] = "see";
|
|
seeRow["ActionName"] = "查看";
|
|
rData.Rows.Add(seeRow);
|
|
rData.AcceptChanges();
|
|
return rData;
|
|
}
|
|
/// <summary>
|
|
/// 数据权限
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public DataTable RightOfData()
|
|
{
|
|
DataTable rData = new DataTable();
|
|
rData.Columns.Add("BodyName");
|
|
rData.Columns.Add("ControlName");
|
|
rData.Columns.Add("ControlCaption");
|
|
|
|
rData.AcceptChanges();
|
|
return rData;
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
#region 构造函数
|
|
public FormICSWorkReport()
|
|
{
|
|
|
|
InitializeComponent();
|
|
this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
|
|
this.WindowState = FormWindowState.Maximized;
|
|
|
|
txtUserCode.Enabled = true;
|
|
txtLotNo.Enabled = false;
|
|
txtOPCode.Enabled = false;
|
|
xPage_JbSl.PageEnabled = false;
|
|
XPage_Pic.PageEnabled = false;
|
|
|
|
foreach (GridColumn column in grvDetail.Columns)
|
|
{
|
|
if (column.Tag?.ToString() == "是")
|
|
column.OptionsColumn.AllowEdit = false;
|
|
else
|
|
column.OptionsColumn.AllowEdit = true;
|
|
}
|
|
|
|
this.model = ModelEnum.Default;//默认称重模式
|
|
|
|
//禁用表头排序功能
|
|
foreach (GridColumn column in grvDetail.Columns)
|
|
{
|
|
column.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False;
|
|
}
|
|
|
|
//ColorTimer.Interval =2000;
|
|
//ColorTimer.Tick += (object sender1, EventArgs e1) =>
|
|
//{
|
|
// if (xPage_JbSl.PageEnabled)
|
|
// {
|
|
// if (JbSources != null)
|
|
// {
|
|
|
|
// JbSources.
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
//};
|
|
}
|
|
#endregion
|
|
|
|
string StringToHex(string input)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
foreach (char c in input)
|
|
{
|
|
sb.Append(Convert.ToInt32(c).ToString("X2")).Append(" ");
|
|
}
|
|
return sb.ToString();
|
|
}
|
|
|
|
|
|
|
|
|
|
// 判断字符串是否是十六进制格式
|
|
static bool IsHexFormat(string data)
|
|
{
|
|
foreach (char c in data)
|
|
{
|
|
if (!Uri.IsHexDigit(c))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 加载
|
|
private void FormICSWorkReport_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
try
|
|
{
|
|
pdfViewer1.Dock = DockStyle.Fill;
|
|
pdfViewer1.Visible = true;
|
|
btnPDFMax.Visible = true;
|
|
Authenticate.UserNameOrEmailAddress = Account;
|
|
Authenticate.Password = PassWord;
|
|
Authenticate.ClientType = "App";
|
|
Authenticate.PdaTenantName = Tenant;
|
|
if (string.IsNullOrEmpty(AuthenicateResult.AccessToken))//未认证
|
|
{
|
|
Login();
|
|
}
|
|
GetConns();
|
|
|
|
foreach (GridColumn column in grvDetail.Columns)
|
|
{
|
|
column.OptionsColumn.ReadOnly = true;
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message);
|
|
}
|
|
}
|
|
|
|
private void GetConns()
|
|
{
|
|
try
|
|
{
|
|
var returnDto = WebHelper.HttpGet<ReturnDto<string>>(GetCurrentConnectStrings, AuthenicateResult.AccessToken);
|
|
if (!returnDto.success)
|
|
throw new Exception(returnDto.error.message);
|
|
else
|
|
Conns = returnDto.result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
private void Login()
|
|
{
|
|
try
|
|
{
|
|
SetRichTextboxContent(RTBox_Log, "开始认证... ");
|
|
if (string.IsNullOrEmpty(Authenticate.UserNameOrEmailAddress))
|
|
throw new Exception("请维护认证账号信息!");
|
|
if (string.IsNullOrEmpty(Authenticate.Password))
|
|
throw new Exception("请维护认证账号密码!");
|
|
|
|
var returnDto = WebHelper.HttpPost<ReturnDto<AuthenticateResultDto>>(AuthenticateApi, JsonConvert.SerializeObject(Authenticate));
|
|
if (!returnDto.success)
|
|
throw new Exception(returnDto.error.message);
|
|
else
|
|
AuthenicateResult = returnDto.result;
|
|
|
|
SetRichTextboxContent(RTBox_Log, "认证成功... ");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message);
|
|
}
|
|
|
|
}
|
|
|
|
private void GetCustomPower()
|
|
{
|
|
string sql = $@"select EnumValue from SysEnumValue a
|
|
left join SysWorkPoint b on a.TenantId = b.TenantId
|
|
where EnumKey = '{CustomPower}' and b.TenantCode ='{Tenant}'";
|
|
var table=DBHelper.ExecuteDataset(Conns, CommandType.Text, sql).Tables[0];
|
|
|
|
if (!table.AsEnumerable().Select(a => a["EnumValue"].ToString()).ToList().Contains(UserMes.Value))
|
|
throw new Exception("你无权限做此操作!");
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region 重置
|
|
private void btnResetUI_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
SetLableText(lblMsg, "");
|
|
SetRichTextboxContent(RTBox_Log, "操作 => ", true, "点击 " + btnResetUI.Text);
|
|
Clear();
|
|
|
|
SetLableText(lblMsg, "重置!");
|
|
//LoadPrint();
|
|
}
|
|
#endregion
|
|
|
|
private void Clear()
|
|
{
|
|
|
|
SetLableText(lblMsg, "");
|
|
Onwip = new IcsLotOnWipDto();
|
|
Op = new IcsOPListDto();
|
|
UserMes = new SelectItemExt();
|
|
PoDto = new IcsPotListDto();
|
|
EqpDto = new IcsEquipmentDto();
|
|
|
|
txtUserCode.Enabled = true;
|
|
txtUserCode.Focus();
|
|
|
|
txtOPCode.Enabled = false;
|
|
txtLotNo.Enabled = false;
|
|
|
|
txtItemLotno.Enabled = true;
|
|
txtCheng.Enabled = false;
|
|
|
|
btnBigenOrSuspend.Text = "开工";
|
|
|
|
foreach (var Control in tabLPnl_Header.Controls)
|
|
{
|
|
if (Control is TextEdit)
|
|
{
|
|
(Control as TextEdit).Text = "";
|
|
}
|
|
}
|
|
|
|
xPage_JbSl.PageEnabled = false;
|
|
XPage_Pic.PageEnabled = false;
|
|
|
|
foreach (var Control in tableLayoutPanel_Jb.Controls)
|
|
{
|
|
if (Control is TextEdit)
|
|
{
|
|
(Control as TextEdit).Text = "";
|
|
}
|
|
}
|
|
grdDetail.DataSource = null;
|
|
|
|
ItemLotNOMes = null;
|
|
JbSources = null;
|
|
JbDetails.Clear(); revCounts = 0;
|
|
Reset();
|
|
this.model = ModelEnum.Default;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 工序结束(完工)
|
|
private void btnEndAll_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(Onwip.LotNo))
|
|
throw new Exception("未扫描跟踪单号!");
|
|
if (string.IsNullOrEmpty(Onwip.OpCode))
|
|
throw new Exception("未扫描工序!");
|
|
if (string.IsNullOrEmpty(Onwip.UserCode))
|
|
throw new Exception("未扫描报工人!");
|
|
if (string.IsNullOrEmpty(Onwip.EqpCode))
|
|
throw new Exception("未扫描设备!");
|
|
if (string.IsNullOrEmpty(Onwip.PotCode))
|
|
throw new Exception("未扫描锅具!");
|
|
if (string.IsNullOrEmpty(txtCurrentQty.Text))
|
|
throw new Exception("完工请填写流转数量!");
|
|
|
|
Onwip.CollectQty = Convert.ToDecimal(txtCurrentQty.Text);
|
|
Onwip.Memo = txtMemo.Text;
|
|
var returnDto = WebHelper.HttpPost<ReturnDto<IcsLotOnWipDto>>(OnwipEndApi, JsonConvert.SerializeObject(Onwip), AuthenicateResult.AccessToken);
|
|
if (!returnDto.success)
|
|
throw new Exception(returnDto.error.message);
|
|
else
|
|
Onwip = returnDto.result;
|
|
|
|
SetRichTextboxContent(RTBox_Log, "完工成功!", true);
|
|
SetLableText(lblMsg, "完工成功", true);
|
|
|
|
Clear();
|
|
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region TabPage初始化
|
|
private void tabPageArea_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (e.Page == xPage_JbSl)
|
|
{
|
|
if (grdDetail.DataSource == null)
|
|
LoadMixMsg();
|
|
}
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
tabPageArea.SelectedTabPageIndex = 0;
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
string msgKod = "";
|
|
#region tabPage主页
|
|
|
|
|
|
private void btnShowPDF_Click(object sender, EventArgs e)
|
|
{
|
|
if (!txtLotNo.Properties.ReadOnly || !txtOPCode.Properties.ReadOnly || !txtUserCode.Properties.ReadOnly || !txtEQPCode.Properties.ReadOnly)
|
|
{
|
|
return;
|
|
}
|
|
SimpleButton btn = sender as SimpleButton;
|
|
|
|
DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在加载...请稍等...");
|
|
try
|
|
{
|
|
_wait.Show();
|
|
//axAcroPDF.LoadFile("");
|
|
//axAcroPDF.Dock = DockStyle.Fill;
|
|
//axAcroPDF.Visible = true;
|
|
//pdfViewer1.LoadFile("");
|
|
pdfViewer1.Dock = DockStyle.Fill;
|
|
pdfViewer1.Visible = true;
|
|
btnPDFMax.Visible = true;
|
|
var tag = "";
|
|
|
|
|
|
|
|
if (tag.EndsWith(".pdf"))
|
|
{
|
|
//axAcroPDF.LoadFile(tag.local);
|
|
//axAcroPDF.setShowToolbar(false);
|
|
//axAcroPDF.setShowScrollbars(false);
|
|
//axAcroPDF.setPageMode("thumbs");
|
|
//axAcroPDF.setLayoutMode("SinglePage");
|
|
//axAcroPDF.setView("Fit");
|
|
//axAcroPDF.Show();
|
|
//try { File.Delete(tag.local); }
|
|
//catch { }
|
|
pdfViewer1.LoadFile(tag);
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
System.Diagnostics.Process.Start(tag);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
}
|
|
btnPDFMax.Tag = tag;
|
|
SetLableText(lblMsg, "成功!");
|
|
SetRichTextboxContent(RTBox_Log, "图纸查看成功! ", true);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
finally
|
|
{
|
|
_wait.Close();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region baseForm
|
|
#region 移动窗体
|
|
private const int WM_NCHITTEST = 0x84;
|
|
private const int HTCLIENT = 0x1;
|
|
private const int HTCAPTION = 0x2;
|
|
//首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
|
|
//系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
|
|
//假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
|
|
//同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
|
|
|
|
//重写窗体,使窗体可以不通过自带标题栏实现移动
|
|
protected override void WndProc(ref Message m)
|
|
{
|
|
//当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
|
|
//当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
|
|
//这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
|
|
//注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
|
|
switch (m.Msg)
|
|
{
|
|
case WM_NCHITTEST:
|
|
base.WndProc(ref m);
|
|
if ((int)m.Result == HTCLIENT)
|
|
m.Result = (IntPtr)HTCAPTION;
|
|
return;
|
|
}
|
|
//拦截双击标题栏、移动窗体的系统消息
|
|
if (m.Msg != 0xA3)
|
|
{
|
|
base.WndProc(ref m);
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 行号
|
|
private void gv_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
|
|
{
|
|
if (e.Info.IsRowIndicator && e.RowHandle > -1)
|
|
{
|
|
e.Info.DisplayText = (e.RowHandle + 1).ToString();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 退出
|
|
private void btnClose_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
AppConfig.CloseFormShow(this.Text);
|
|
this.Close();
|
|
}
|
|
|
|
private void btnExit_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
AppConfig.CloseFormShow(this.Text);
|
|
this.Close();
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
#region 获取枚举注解
|
|
static public string GetEnumDescription<TEnum>(object value)
|
|
{
|
|
Type enumType = typeof(TEnum);
|
|
if (!enumType.IsEnum)
|
|
throw new ArgumentException("不是枚举类型");
|
|
var name = Enum.GetName(enumType, value);
|
|
if (name == null)
|
|
return string.Empty;
|
|
object[] objs = enumType.GetField(name).GetCustomAttributes(typeof(DescriptionAttribute), false);
|
|
if (objs == null || objs.Length == 0)
|
|
return string.Empty;
|
|
DescriptionAttribute attr = objs[0] as DescriptionAttribute;
|
|
return attr.Description;
|
|
}
|
|
//static public string GetEnumDescriptionEn<TEnum>(object value)
|
|
//{
|
|
// Type enumType = typeof(TEnum);
|
|
// if (!enumType.IsEnum)
|
|
// throw new ArgumentException("不是枚举类型");
|
|
// var name = Enum.GetName(enumType, value);
|
|
// if (name == null)
|
|
// return string.Empty;
|
|
// object[] objs = enumType.GetField(name).GetCustomAttributes(typeof(DescriptionEn), false);
|
|
// if (objs == null || objs.Length == 0)
|
|
// return string.Empty;
|
|
// DescriptionEn attr = objs[0] as DescriptionEn;
|
|
// return attr.Description;
|
|
//}
|
|
//static public string GetEnumShowOnButton<TEnum>(object value)
|
|
//{
|
|
// Type enumType = typeof(TEnum);
|
|
// if (!enumType.IsEnum)
|
|
// throw new ArgumentException("不是枚举类型");
|
|
// var name = Enum.GetName(enumType, value);
|
|
// if (name == null)
|
|
// return string.Empty;
|
|
// object[] objs = enumType.GetField(name).GetCustomAttributes(typeof(ShowOnButton), false);
|
|
// if (objs == null || objs.Length == 0)
|
|
// return string.Empty;
|
|
// ShowOnButton attr = objs[0] as ShowOnButton;
|
|
// return attr.Description;
|
|
//}
|
|
//static public string GetEnumDBValue<TEnum>(object value)
|
|
//{
|
|
// Type enumType = typeof(TEnum);
|
|
// if (!enumType.IsEnum)
|
|
// throw new ArgumentException("不是枚举类型");
|
|
// var name = Enum.GetName(enumType, value);
|
|
// if (name == null)
|
|
// return string.Empty;
|
|
// object[] objs = enumType.GetField(name).GetCustomAttributes(typeof(DBValue), false);
|
|
// if (objs == null || objs.Length == 0)
|
|
// return string.Empty;
|
|
// DBValue attr = objs[0] as DBValue;
|
|
// return attr.Description;
|
|
//}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 随机获取double
|
|
/// </summary>
|
|
/// <param name="minimum"></param>
|
|
/// <param name="maximum"></param>
|
|
/// <param name="Len">小数位数</param>
|
|
/// <returns></returns>
|
|
public double GetRandomNumber(double minimum, double maximum, int Len)
|
|
{
|
|
Random random = new Random();
|
|
return Math.Round(random.NextDouble() * (maximum - minimum) + minimum, Len);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 只是简单的格式化,没啥判断
|
|
/// </summary>
|
|
/// <param name="str"></param>
|
|
/// <returns></returns>
|
|
private string ConvertJsonString(string str)
|
|
{
|
|
JsonSerializer serializer = new JsonSerializer();
|
|
TextReader tr = new StringReader(str);
|
|
JsonTextReader jtr = new JsonTextReader(tr);
|
|
object obj = serializer.Deserialize(jtr);
|
|
if (obj != null)
|
|
{
|
|
StringWriter textWriter = new StringWriter();
|
|
JsonTextWriter jsonWriter = new JsonTextWriter(textWriter)
|
|
{
|
|
Formatting = Formatting.Indented,
|
|
Indentation = 4,
|
|
IndentChar = ' '
|
|
};
|
|
serializer.Serialize(jsonWriter, obj);
|
|
return textWriter.ToString();
|
|
}
|
|
else
|
|
{
|
|
return str;
|
|
}
|
|
}
|
|
|
|
#region 界面消息
|
|
private void SetLableText(Label lbl, string txt, bool ok = true)
|
|
{
|
|
if (lbl.InvokeRequired)
|
|
{
|
|
lbl.Invoke(new Action(() => { SetLableText(lbl, txt, ok); }));
|
|
}
|
|
else
|
|
{
|
|
lbl.Text = txt;
|
|
lbl.ForeColor = Color.White;
|
|
lbl.BackColor = string.IsNullOrEmpty(txt) ? Color.White : (ok ? Color.Green : Color.Red);
|
|
}
|
|
}
|
|
|
|
//关键字颜色列表
|
|
List<Color> color = new List<Color>()
|
|
{
|
|
Color.BlueViolet,
|
|
Color.Orange,
|
|
Color.Black,
|
|
Color.Blue,
|
|
Color.YellowGreen
|
|
};
|
|
/// <summary>
|
|
/// RichTextBox记录
|
|
/// </summary>
|
|
/// <param name="rtb">RichTextBox</param>
|
|
/// <param name="txt1">基本信息</param>
|
|
/// <param name="ok">Pass Or Fail</param>
|
|
/// <param name="keys">特殊颜色所标识的关键字列表</param>
|
|
private void SetRichTextboxContent(RichTextBox rtb, string txt1, bool ok = true, params string[] keys)
|
|
{
|
|
if (rtb.InvokeRequired)
|
|
{
|
|
rtb.Invoke(new Action(() => { SetRichTextboxContent(rtb, txt1, ok, keys); }));
|
|
}
|
|
else
|
|
{
|
|
if (rtb.Lines.Length > 200)
|
|
{
|
|
rtb.Clear();
|
|
}
|
|
rtb.SelectionColor = Color.Black;
|
|
rtb.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff "));
|
|
rtb.SelectionColor = ok ? Color.LimeGreen : Color.Red;
|
|
rtb.AppendText(txt1);
|
|
for (int i = 0; i < keys.Length; i++)
|
|
{
|
|
rtb.SelectionColor = color[i];
|
|
rtb.AppendText(" " + keys[i]);
|
|
}
|
|
rtb.AppendText("\r\n");
|
|
rtb.SelectionStart = rtb.Text.Length;
|
|
rtb.ScrollToCaret();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
private void FormICSWorkReport_Activated(object sender, EventArgs e)
|
|
{
|
|
txtUserCode.Focus();
|
|
}
|
|
|
|
private void btnJianYanSave_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
string sjAgainCode = "";
|
|
|
|
|
|
#region 翻页
|
|
//private void rptPage_PageIndexChanged(object Sender, EventArgs e)
|
|
//{
|
|
// DataTable data = AppConfig.GetPageData(dataSource, rptPage.PageIndex, rptPage.PageSize).Copy();
|
|
// //DataTable data = AppConfig.GetPageDataByDb(tempTableName, "pagerowindex", rptPage.PageSize, rptPage.PageIndex, dataSource.Rows.Count);
|
|
// grdDetail.DataSource = data;
|
|
//}
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private void FormICSWorkReport_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
|
|
|
|
}
|
|
|
|
private void LoadPrint()
|
|
{
|
|
//FormPreview pre = new FormPreview();
|
|
//pre.ShowDialog();
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnPDFMax_Click(object sender, EventArgs e)
|
|
{
|
|
if (btnPDFMax.Tag == null)
|
|
{
|
|
return;
|
|
}
|
|
string local = btnPDFMax.Tag.ToString();
|
|
if (string.IsNullOrEmpty(local))
|
|
{
|
|
return;
|
|
}
|
|
FormPDFMax fmax = new FormPDFMax(local);
|
|
fmax.ShowDialog(this);
|
|
}
|
|
|
|
private void btnOpenKodTree_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
|
|
}
|
|
|
|
private void Common_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
if (e.KeyChar != (char)Keys.Enter || string.IsNullOrEmpty(((Control)sender).Text))
|
|
return;
|
|
|
|
try
|
|
{
|
|
revCounts = 0;
|
|
//权限认证
|
|
if (String.IsNullOrEmpty(AuthenicateResult.AccessToken))
|
|
throw new Exception("程序还未认证,请先认证!");
|
|
|
|
if (((Control)sender).Name == "txtUserCode")
|
|
txtUserCode_KeyPress(sender, e);
|
|
|
|
if (((Control)sender).Name == "txtOPCode")
|
|
txtOPCode_KeyPress(sender, e);
|
|
|
|
if (((Control)sender).Name == "txtLotNo")
|
|
txtLotNo_KeyPress(sender, e);
|
|
|
|
if (((Control)sender).Name == "txtEQPCode")
|
|
txtEQPCode_KeyPress(sender, e);
|
|
|
|
|
|
if (((Control)sender).Name == "txtPotCode")
|
|
txtPoCode_KeyPress(sender, e);
|
|
|
|
|
|
if (((Control)sender).Name == "txtItemLotno")
|
|
txtItemLotno_KeyPress(sender, e);
|
|
|
|
if (((Control)sender).Name == "txtCheng")
|
|
txtCheng_KeyPress(sender, e);
|
|
|
|
if (((Control)sender).Name == "txtUnLockEqp")
|
|
txtUnLockEqp_KeyPress(sender, e);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
|
|
}
|
|
|
|
private void txtPoCode_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//调用接口获取信息
|
|
var returnDto = WebHelper.HttpGet<ReturnDto<IcsPotListDto>>(PotApi + "?Value=" + txtPotCode.Text.Trim() + "", AuthenicateResult.AccessToken);
|
|
if (!returnDto.success)
|
|
throw new Exception(returnDto.error.message);
|
|
else
|
|
PoDto = returnDto.result;
|
|
|
|
Onwip.PotCode = PoDto.PotCode;
|
|
Onwip.PotName = PoDto.PotName;
|
|
txtPotName.Text = PoDto.PotName;
|
|
SetRichTextboxContent(RTBox_Log, "锅具信息获取成功", true);
|
|
SetLableText(lblMsg, "锅具信息获取成功", true);
|
|
StartJbSl();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void txtLotNo_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(UserMes.Value))
|
|
throw new Exception("请先扫描人员信息!");
|
|
if (string.IsNullOrEmpty(Op.opCode))
|
|
throw new Exception("请先扫描工序信息!");
|
|
|
|
var onwipCopy = JsonConvert.DeserializeObject<IcsLotOnWipDto>(JsonConvert.SerializeObject(Onwip));
|
|
onwipCopy.LotNo = txtLotNo.Text;
|
|
//获取条码信息
|
|
var returnDto = WebHelper.HttpPost<ReturnDto<IcsLotOnWipDto>>(LotNoApi, JsonConvert.SerializeObject(onwipCopy), AuthenicateResult.AccessToken);
|
|
if (!returnDto.success)
|
|
throw new Exception(returnDto.error.message);
|
|
else
|
|
{
|
|
if (string.IsNullOrEmpty(returnDto.result.EqpCode)&&!string.IsNullOrEmpty(Onwip.EqpCode))
|
|
{
|
|
returnDto.result.EqpCode = Onwip.EqpCode;
|
|
returnDto.result.EqpName = Onwip.EqpName;
|
|
returnDto.result.EqpType = Onwip.EqpType;
|
|
returnDto.result.EqpModel = Onwip.EqpModel;
|
|
}
|
|
Onwip = returnDto.result;
|
|
}
|
|
|
|
|
|
this.txtMOCode.Text = Onwip.MoCode;
|
|
this.txtItemCode.Text = Onwip.ItemCode;
|
|
this.txtItemName.Text = Onwip.ItemName;
|
|
this.txtLotQty.Text = Onwip.LotQty.ToString();
|
|
this.txtCurrentQty.Text = Onwip.CollectQty.ToString();
|
|
this.txtRemainOpQty.Text = Onwip.LeftCollectQty.ToString();
|
|
this.txtCurrentNgQty.Text = Onwip.NGQty.ToString();
|
|
this.txtItemOpPerCent.Text = Onwip.ItemOpTransRate.ToString();
|
|
this.txtOverPerCent.Text = Onwip.ItemBeyondRate.ToString();
|
|
this.txtMoSeq.Text = Onwip.MoSeq.ToString();
|
|
this.txtOpQty.Text = Onwip.OpQty.ToString();
|
|
this.txtIsFirstCheck.Text = Onwip.Default2;
|
|
this.txtBatchCode.Text = Onwip.TrackingCode;
|
|
|
|
|
|
|
|
|
|
|
|
SetRichTextboxContent(RTBox_Log, "跟踪单扫描成功", true);
|
|
txtLotNo.Enabled = false;
|
|
if (Onwip.CollectStatus == "Begin")
|
|
{
|
|
btnBigenOrSuspend.Text = "已开工";
|
|
}
|
|
else
|
|
{
|
|
btnBigenOrSuspend.Text = "开工";
|
|
}
|
|
|
|
txtPotCode.Focus();
|
|
/* StartJbSl(); *///当前工单是搅拌工单并且开工状态开启搅拌功能
|
|
if (string.IsNullOrEmpty(txtEQPCode.Text) && !string.IsNullOrEmpty(Onwip.EqpCode))
|
|
{
|
|
txtEQPCode.Text = Onwip.EqpCode;
|
|
txtEQPCode_KeyPress(null, null);
|
|
}
|
|
|
|
|
|
if (string.IsNullOrEmpty(txtPotCode.Text) && !string.IsNullOrEmpty(Onwip.PotCode))
|
|
{
|
|
this.txtPotCode.Text = Onwip.PotCode;
|
|
txtPoCode_KeyPress(null, null);
|
|
}
|
|
txtLotNo.Enabled = false;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void txtItemLotno_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
|
|
GetConns();
|
|
if (JbSources == null || JbSources.Count == 0)
|
|
throw new Exception("获取搅拌单对应的子件信息失败!");
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(Conns))
|
|
throw new Exception("获取数据库信息失败!");
|
|
|
|
string sql = @"SELECT W.INVCODE,W.QUANTITY,W.LOCATIONCODE,'' as INVUNIT,BATCHCODE FROM {1}.ICSWareHouseLotInfo W
|
|
LEFT JOIN {1}.ICSInventoryLot A
|
|
ON A.LOTNO=W.LOTNO AND A.WORKPOINT=W.WORKPOINT
|
|
LEFT JOIN {1}.ICSExtension b
|
|
ON a.ExtensionID=b.ID
|
|
WHERE W.Lotno='{0}' ";
|
|
|
|
sql = string.Format(sql, txtItemLotno.EditValue.ToString(), WmsDbLink);
|
|
var table = DBHelper.ExecuteDataset(Conns, CommandType.Text, sql).Tables[0];
|
|
|
|
if (table.Rows.Count <= 0)
|
|
throw new Exception("没有查询到该物料条码信息!");
|
|
|
|
if (table.Rows[0]["LOCATIONCODE"].ToString() != WmsLocationCode) //搅拌仓库判断
|
|
throw new Exception("该条码不是线边仓条码!");
|
|
|
|
//校验条码物料是否对用子件信息
|
|
var exist = JbSources.Where(a => a.LotOpMix.SbItemCode == table.Rows[0]["INVCODE"].ToString() && a.LotOpMix.MixStatus != "已上料").OrderBy(a => a.LotOpMix.SendSeq).FirstOrDefault();
|
|
if (exist == null)
|
|
throw new Exception("未查询到和该物料条码对应的未上料的P/N料号!");
|
|
if (exist.LotOpMix.SbItemUnit.ToUpper() != "KG" && exist.LotOpMix.SbItemUnit != "公斤" && exist.LotOpMix.SbItemUnit.ToUpper() != "G" && exist.LotOpMix.SbItemUnit.ToUpper() != "克")
|
|
throw new Exception("条码对应的物料单位不是重量单位!");
|
|
|
|
table.Rows[0]["INVUNIT"] = exist.LotOpMix.SbItemUnit;
|
|
var seq = exist.LotOpMix.SendSeq;//物料条码对应投料次序
|
|
var beforesources = JbSources.Where(a => a.LotOpMix.SendSeq < seq && string.IsNullOrEmpty(a.LotOpMix.Default3)).ToList();
|
|
if (beforesources.Where(a => a.LotOpMix.MixStatus != "已上料").FirstOrDefault() != null)
|
|
throw new Exception("存在前置P/N料号尚未投料完毕,请确认!");
|
|
|
|
if (beforesources.Count > 0)
|
|
{
|
|
var beforeSeq=JbSources.Where(a => a.LotOpMix.SendSeq < seq).OrderByDescending(a => a.LotOpMix.SendSeq).FirstOrDefault().LotOpMix.SendSeq;
|
|
var beforesource = JbSources.Where(a => a.LotOpMix.SendSeq == beforeSeq);
|
|
var tickValue = DateTime.Now.Ticks - (beforesource.Max(a => a.MixDate).Ticks);
|
|
TimeSpan span = new TimeSpan(tickValue);
|
|
if (beforesource.Count() > 0)
|
|
{
|
|
//var date= beforesource.Max(a => a.MixDate);
|
|
//var mixt = (double)beforesource.Where(a=>a.Default3=="搅拌").Sum(A => A.LotOpMix.MixTime);
|
|
if (span.TotalMinutes < (double)beforesource.Sum(A => A.LotOpMix.MixTime))
|
|
throw new Exception("距离前置P/N料号的上料时间小于搅拌时间,无法上料!");
|
|
}
|
|
}
|
|
|
|
|
|
ItemLotNOMes = table;
|
|
txtItemLotno.Enabled = false;
|
|
if (this.model == ModelEnum.Default)
|
|
{
|
|
txtCheng.Enabled = true;
|
|
txtCheng.Focus();
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
|
|
SetLableText(lblMsg, "物料条码扫描成功!", true);
|
|
SetRichTextboxContent(RTBox_Log, "物料条码扫描成功!", true);
|
|
this.txtItemlotNoQty.Text = table.Rows[0]["QUANTITY"].ToString();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
playSoundFromResource();
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void txtCheng_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (JbSources == null || JbSources.Count == 0)
|
|
throw new Exception("获取搅拌单对应的子件信息失败!");
|
|
|
|
//获取条码信息
|
|
chengMes = GetFormNameByChengNo(txtCheng.Text);
|
|
|
|
|
|
string FormName = chengMes.Parameter1;
|
|
if (String.IsNullOrEmpty(chengMes.Parameter7))
|
|
throw new Exception("未维护对应的串口端口信息!");
|
|
if (string.IsNullOrEmpty(chengMes.Parameter5))
|
|
throw new Exception("未维护对应的串口波特率信息!");
|
|
|
|
if (port.IsOpen)
|
|
port.Close();//防止串口处于占用状态
|
|
|
|
if (!port.IsOpen)
|
|
{
|
|
|
|
port.BaudRate = Convert.ToInt32(chengMes.Parameter5);
|
|
port.PortName = chengMes.Parameter7.ToUpper();
|
|
port.Parity = Parity.None;
|
|
port.StopBits = StopBits.One;
|
|
port.Handshake = Handshake.None;
|
|
port.DataBits = 8;
|
|
|
|
var fieldInfo = (typeof(SerialPort)).GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
|
|
var datarcv = fieldInfo.Where(a => a.Name == "DataReceived").FirstOrDefault();
|
|
var value = (Delegate)datarcv.GetValue(port);
|
|
if (value != null)
|
|
datarcv.SetValue(port, null);
|
|
|
|
|
|
port.DataReceived +=(object senderS, SerialDataReceivedEventArgs eS) =>
|
|
{
|
|
|
|
try
|
|
{
|
|
Thread.Sleep(500);
|
|
var returns = port.ReadExisting();
|
|
|
|
|
|
string weight = "";
|
|
SetRichTextboxContent(RTBox_Log, "接收:" + returns, true);
|
|
if (chengMes.Parameter3.StartsWith("天平")) //天平数据接收格式: +0009.11 G S
|
|
{
|
|
if (!returns.StartsWith("+") && !returns.StartsWith("-"))
|
|
return;
|
|
else
|
|
{
|
|
weight = returns.Replace("\r", "").Replace("\n", "").Replace(" ", "");
|
|
weight = weight.Substring(1, weight.ToUpper().IndexOf("G")); ;
|
|
}
|
|
|
|
}
|
|
//地秤数据接收格式: 一次称重发送八行数据 以第五行指令为准
|
|
//????:2020-01-01
|
|
//????:04:29:30
|
|
//????:33.65kg
|
|
//????:30.32kg
|
|
//????:3.33kg
|
|
//:
|
|
//:
|
|
//:
|
|
else
|
|
{
|
|
|
|
|
|
var lines = returns.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
weight = lines[4].Replace("\r", "").Replace("\n", "").Replace(" ", "").ToUpper();
|
|
|
|
if (!weight.ToUpper().EndsWith("G"))
|
|
return;
|
|
else
|
|
{
|
|
weight = weight.Substring(weight.IndexOf(":") + 1);
|
|
if (weight.StartsWith("+") || weight.StartsWith("-"))
|
|
weight = weight.Substring(1);
|
|
|
|
//if (revCounts == 2)
|
|
//{
|
|
// weight = weight.Substring(weight.IndexOf(":") + 1);
|
|
// if (weight.StartsWith("+") || weight.StartsWith("-"))
|
|
// weight = weight.Substring(1);
|
|
|
|
// revCounts = 0;
|
|
//}
|
|
//else
|
|
//{
|
|
// revCounts++;
|
|
// return;
|
|
//}
|
|
}
|
|
|
|
}
|
|
string invUnit = ItemLotNOMes.Rows[0]["INVUNIT"].ToString();
|
|
|
|
if (weight.ToUpper().EndsWith("KG"))
|
|
{
|
|
if (invUnit.ToUpper() == "KG" || invUnit.ToUpper() == "公斤")
|
|
{
|
|
this.txtCurrentUse.Invoke(new Action(() =>
|
|
{
|
|
this.txtCurrentUse.Text = Convert.ToDecimal(weight.ToUpper().Replace("KG", "").Trim()).ToString("n2");
|
|
}));
|
|
}
|
|
else
|
|
|
|
this.txtCurrentUse.Invoke(new Action(() =>
|
|
{
|
|
this.txtCurrentUse.Text = (Convert.ToDecimal(weight.ToUpper().Replace("KG", "").Trim()) * 1000).ToString("n2");//转为G
|
|
}));
|
|
|
|
}
|
|
else if (weight.ToUpper().EndsWith("G"))
|
|
{
|
|
if (invUnit.ToUpper() == "KG" || invUnit.ToUpper() == "公斤")
|
|
this.txtCurrentUse.Invoke(new Action(() =>
|
|
{
|
|
this.txtCurrentUse.Text =(Convert.ToDecimal(weight.ToUpper().Replace("G", "").Trim()) / 1000).ToString("n2");//转为KG
|
|
}));
|
|
|
|
else
|
|
this.txtCurrentUse.Invoke(new Action(() =>
|
|
{
|
|
this.txtCurrentUse.Text = (Convert.ToDecimal(weight.ToUpper().Replace("G", "").Trim())).ToString("n2");
|
|
}));
|
|
|
|
|
|
}
|
|
|
|
this.txtCurrentLose.Invoke(new Action(() =>
|
|
{
|
|
this.txtCurrentLose.Text = GetGbl(Convert.ToDecimal(this.txtCurrentUse.Text), ItemLotNOMes.Rows[0]["INVCODE"].ToString(), invUnit);
|
|
|
|
}));
|
|
|
|
SetLableText(lblMsg, "获取重量成功", true);
|
|
SetRichTextboxContent(RTBox_Log, "获取重量成功", true);
|
|
//port.DiscardInBuffer();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
playSoundFromResource();
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
};
|
|
|
|
port.Open();
|
|
|
|
|
|
//foreach (var type in Assembly.GetExecutingAssembly().GetTypes())
|
|
//{
|
|
// if (type.IsClass && type.Name == FormName)
|
|
// {
|
|
// var form = Assembly.GetExecutingAssembly().CreateInstance(type.FullName);
|
|
// if (form is Form)
|
|
// {
|
|
// if (!typeof(ComResult).IsAssignableFrom(type))
|
|
// throw new Exception("串口窗体错误,未维护result属性");
|
|
|
|
// if (((Form)form).ShowDialog() == DialogResult.OK)
|
|
// {
|
|
|
|
// var resPro = form.GetType().GetProperty("result");
|
|
// string value = resPro.GetValue(form, null).ToString();
|
|
// if (value.ToUpper().EndsWith("KG"))
|
|
// this.txtCurrentUse.Text = value.ToUpper().Replace("KG", "").Trim();
|
|
// else if (value.ToUpper().EndsWith("G"))
|
|
// this.txtCurrentUse.Text = (Convert.ToDecimal(value.ToUpper().Replace("G", "").Trim()) / 1000).ToString();//转为KG
|
|
// else
|
|
// throw new Exception("重量格式不正确,获取称重信息失败!");
|
|
|
|
// }
|
|
// else
|
|
// {
|
|
// SetLableText(lblMsg, "用户取消操作", false);
|
|
// SetRichTextboxContent(RTBox_Log, "用户取消操作", true);
|
|
// }
|
|
// }
|
|
// break;
|
|
// }
|
|
|
|
//}
|
|
}
|
|
SetLableText(lblMsg, "扫描成功,串口已打开", true);
|
|
SetRichTextboxContent(RTBox_Log, "扫描成功,串口已打开", true);
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
playSoundFromResource();
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void StartJbSl()
|
|
{
|
|
|
|
if (Onwip.SegCode == "01040104" && Onwip.CollectStatus == "Begin" && !string.IsNullOrEmpty(Onwip.PotCode) && !string.IsNullOrEmpty(Onwip.EqpCode))//当前工单是搅拌工单并且开工状态开启搅拌功能
|
|
{
|
|
SetLableText(lblMsg, "搅拌上料功能解锁");
|
|
xPage_JbSl.PageEnabled = true;
|
|
tabPageArea.SelectedTabPage = xPage_JbSl;
|
|
txtItemLotno.Focus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void txtOPCode_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(UserMes.Value))
|
|
throw new Exception("请先扫描人员信息!");
|
|
//调用接口获取信息
|
|
var returnDto = WebHelper.HttpGet<ReturnDto<IcsOPListDto>>(OpApi + "?Value=" + txtOPCode.Text.Trim() + "", AuthenicateResult.AccessToken);
|
|
if (!returnDto.success)
|
|
throw new Exception(returnDto.error.message);
|
|
else
|
|
Op = returnDto.result;
|
|
|
|
this.txtOPName.Text = Op.opName;
|
|
SetRichTextboxContent(RTBox_Log, "工序信息获取成功", true);
|
|
SetLableText(lblMsg, "工序信息获取成功", true);
|
|
txtEQPCode.Focus();
|
|
txtEQPCode.Enabled = true;
|
|
txtOPCode.Enabled = false;
|
|
txtLotNo.Enabled = true;
|
|
Onwip.OpCode = Op.opCode;
|
|
Onwip.OpName = Op.opName;
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
}
|
|
|
|
private void txtUserCode_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//调用接口获取信息
|
|
var returnDto = WebHelper.HttpGet<ReturnDto<SelectItemExt>>(UserApi + "?value=" + txtUserCode.Text + "", AuthenicateResult.AccessToken);
|
|
if (!returnDto.success)
|
|
throw new Exception(returnDto.error.message);
|
|
else
|
|
UserMes = returnDto.result;
|
|
|
|
this.txtUserName.Text = UserMes.Text;
|
|
SetRichTextboxContent(RTBox_Log, "人员信息获取成功", true);
|
|
SetLableText(lblMsg, "人员信息获取成功", true);
|
|
txtOPCode.Focus();
|
|
txtOPCode.Enabled = true;
|
|
txtUserCode.Enabled = false;
|
|
Onwip.UserCode = UserMes.Value;
|
|
Onwip.UserName = UserMes.Text;
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
}
|
|
|
|
private void txtEQPCode_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
|
|
|
|
//调用接口获取信息
|
|
var returnDto = WebHelper.HttpGet<ReturnDto<IcsEquipmentDto>>(EqpApi + "?value=" + txtEQPCode.Text.Trim() + "", AuthenicateResult.AccessToken);
|
|
if (!returnDto.success)
|
|
throw new Exception(returnDto.error.message);
|
|
else
|
|
EqpDto = returnDto.result;
|
|
|
|
this.txtEQPName.Text = EqpDto.EqpName;
|
|
Onwip.EqpCode = EqpDto.EqpCode;
|
|
Onwip.EqpName = EqpDto.EqpName;
|
|
Onwip.EqpType = EqpDto.EqpType;
|
|
Onwip.EqpModel = EqpDto.EqpModel;
|
|
|
|
SetRichTextboxContent(RTBox_Log, "设备信息获取成功", true);
|
|
SetLableText(lblMsg, "设备信息获取成功", true);
|
|
txtLotNo.Focus();
|
|
txtLotNo.Enabled = true;
|
|
txtEQPCode.Enabled = false;
|
|
StartJbSl();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
}
|
|
|
|
|
|
private void btnBigenOrSuspend_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(Onwip.LotNo))
|
|
throw new Exception("未扫描跟踪单号!");
|
|
if (string.IsNullOrEmpty(Onwip.OpCode))
|
|
throw new Exception("未扫描工序!");
|
|
if (string.IsNullOrEmpty(Onwip.UserCode))
|
|
throw new Exception("未扫描报工人!");
|
|
//if (string.IsNullOrEmpty(Onwip.EqpCode))
|
|
// throw new Exception("未扫描设备!");
|
|
//if (string.IsNullOrEmpty(Onwip.PotCode))
|
|
// throw new Exception("未扫描锅具!");
|
|
|
|
var returnDto = WebHelper.HttpPost<ReturnDto<IcsLotOnWipDto>>(OnwipStartApi, JsonConvert.SerializeObject(Onwip), AuthenicateResult.AccessToken);
|
|
if (!returnDto.success)
|
|
throw new Exception(returnDto.error.message);
|
|
else
|
|
Onwip = returnDto.result;
|
|
|
|
SetRichTextboxContent(RTBox_Log, "开工成功!", true);
|
|
SetLableText(lblMsg, "开工成功", true);
|
|
|
|
btnBigenOrSuspend.Text = "已开工";
|
|
|
|
StartJbSl();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
|
|
}
|
|
|
|
private void txtMemo_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void btnSendFirstCheck_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(Onwip.LotNo))
|
|
throw new Exception("未扫描跟踪单号!");
|
|
if (string.IsNullOrEmpty(Onwip.OpCode))
|
|
throw new Exception("未扫描工序!");
|
|
if (string.IsNullOrEmpty(Onwip.UserCode))
|
|
throw new Exception("未扫描报工人!");
|
|
//if (string.IsNullOrEmpty(Onwip.EqpCode))
|
|
// throw new Exception("未扫描设备!");
|
|
//if (string.IsNullOrEmpty(Onwip.PotCode))
|
|
// throw new Exception("未扫描锅具!");
|
|
|
|
var returnDto = WebHelper.HttpPost<ReturnDto<String>>(FirtCheckApi, JsonConvert.SerializeObject(Onwip), AuthenicateResult.AccessToken);
|
|
if (!returnDto.success)
|
|
throw new Exception(returnDto.error.message);
|
|
|
|
|
|
SetRichTextboxContent(RTBox_Log, "发送首检成功!", true);
|
|
SetLableText(lblMsg, "发送首检成功", true);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
|
|
}
|
|
|
|
private void btn_BackKg_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(Onwip.LotNo))
|
|
throw new Exception("未扫描跟踪单号!");
|
|
if (string.IsNullOrEmpty(Onwip.OpCode))
|
|
throw new Exception("未扫描工序!");
|
|
if (string.IsNullOrEmpty(Onwip.UserCode))
|
|
throw new Exception("未扫描报工人!");
|
|
//if (string.IsNullOrEmpty(Onwip.EqpCode))
|
|
// throw new Exception("未扫描设备!");
|
|
//if (string.IsNullOrEmpty(Onwip.PotCode))
|
|
// throw new Exception("未扫描锅具!");
|
|
|
|
var returnDto = WebHelper.HttpPost<ReturnDto<String>>(CancelLotOnWipBeginApi, JsonConvert.SerializeObject(Onwip), AuthenicateResult.AccessToken);
|
|
if (!returnDto.success)
|
|
throw new Exception(returnDto.error.message);
|
|
//else
|
|
// Onwip = returnDto.result;
|
|
|
|
SetRichTextboxContent(RTBox_Log, "撤销开工成功!", true);
|
|
SetLableText(lblMsg, "撤销开工成功", true);
|
|
|
|
Clear();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
|
|
}
|
|
|
|
private List<SelectItemExt> GetEcMes()
|
|
{
|
|
try
|
|
{
|
|
|
|
var returnDto = WebHelper.HttpGet<ReturnDto<List<SelectItemExt>>>(GetEcApi, AuthenicateResult.AccessToken);
|
|
if (!returnDto.success)
|
|
throw new Exception(returnDto.error.message);
|
|
|
|
return returnDto.result;
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
private void btnAuthor_Click(object sender, EventArgs e)
|
|
{
|
|
this.Login();
|
|
}
|
|
|
|
private void BtnNgSend_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(Onwip.LotNo))
|
|
throw new Exception("未扫描跟踪单号!");
|
|
if (string.IsNullOrEmpty(Onwip.OpCode))
|
|
throw new Exception("未扫描工序!");
|
|
if (string.IsNullOrEmpty(Onwip.UserCode))
|
|
throw new Exception("未扫描报工人!");
|
|
if (string.IsNullOrEmpty(Onwip.EqpCode))
|
|
throw new Exception("未扫描设备!");
|
|
if (string.IsNullOrEmpty(Onwip.PotCode))
|
|
throw new Exception("未扫描锅具!");
|
|
|
|
Onwip.lotEcDataDtos = Onwip.lotEcDataDtos ?? new List<IcsLotEcDataDto>();
|
|
|
|
FormEcAdd add = new FormEcAdd(() => GetEcMes(), JsonConvert.DeserializeObject<List<IcsLotEcDataDto>>(JsonConvert.SerializeObject(Onwip.lotEcDataDtos)));
|
|
if (add.ShowDialog() == DialogResult.OK)
|
|
{
|
|
|
|
var ecDtos = add.EcDatas;
|
|
Onwip.lotEcDataDtos = ecDtos;
|
|
Onwip.NGQty = ecDtos.Sum(a => a.OpNgQty);
|
|
this.txtCurrentNgQty.Text = Onwip.NGQty.ToString();
|
|
SetLableText(lblMsg, "不良录入成功", true);
|
|
SetRichTextboxContent(RTBox_Log, "不良录入成功", true);
|
|
}
|
|
else
|
|
{
|
|
SetLableText(lblMsg, "取消不良录入", true);
|
|
SetRichTextboxContent(RTBox_Log, "取消不良录入", true);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
}
|
|
|
|
private void tabPageArea_TabIndexChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void LoadMixMsg()
|
|
{
|
|
try
|
|
{
|
|
var returnDto = WebHelper.HttpGet<ReturnDto<List<IcsLot2OpMixDetailsListDto>>>(GetMixApi + "?ItemCode=" + Onwip.ItemCode + "&ProductQty=" + ((int)Onwip.LotQty) + "&LotNo="+txtLotNo.Text+ "&OpCode="+Onwip.OpCode+"", AuthenicateResult.AccessToken);
|
|
if (!returnDto.success)
|
|
throw new Exception(returnDto.error.message);
|
|
else
|
|
JbSources = returnDto.result.OrderBy(a => a.LotOpMix.SendSeq).ThenBy(a => a.LotOpMix.MixDetailId).ToList();
|
|
|
|
//JbDetails = MapHelper.Mapping(JbSources);
|
|
|
|
this.grdDetail.DataSource = JbSources;
|
|
this.txtTemperAture.Text = JbSources.FirstOrDefault().LotOpMix.TemperAture;
|
|
grvDetail.BestFitColumns();
|
|
grvDetail.RefreshData();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public void SendCommand(string command)
|
|
{
|
|
try
|
|
{
|
|
if (port.IsOpen)
|
|
{
|
|
port.WriteLine(command); // 发送指令
|
|
}
|
|
else
|
|
{
|
|
throw new Exception("串口未打开.");
|
|
}
|
|
SetRichTextboxContent(RTBox_Log, "发送:" + command, false);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SetRichTextboxContent(RTBox_Log, "发送指令时出错: " + ex.Message, false);
|
|
}
|
|
}
|
|
private void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(this.txtCurrentUse.Text))
|
|
{
|
|
|
|
throw new Exception("需要先连接秤获取本次用量!");
|
|
}
|
|
if (Convert.ToDecimal(this.txtCurrentUse.Text) <= 0)
|
|
throw new Exception("本次用量不能小于0!");
|
|
|
|
if (txtCurrentLose.Text == "")
|
|
throw new Exception("获取损耗量失败,如果是手动模式,请输入用量后按下Enter");
|
|
//if (Convert.ToDecimal(this.txtCurrentLose.Text) <= 0)
|
|
// throw new Exception("请在对应的搅拌损耗关系表中维护对应的损耗量,并重新称重!");
|
|
|
|
|
|
//var exist = JbDetails.Where(a => a.LotOpMix.Default1 == txtItemLotno.Text).FirstOrDefault();
|
|
|
|
//if (exist != null)
|
|
// throw new Exception("物料条码:" + txtItemLotno.Text + "已上料,请勿重复操作!");
|
|
|
|
|
|
var source = JbSources.Where(a => a.LotOpMix.SbItemCode == ItemLotNOMes.Rows[0]["INVCODE"].ToString()&&a.LotOpMix.MixStatus!="已上料").OrderBy(a=>a.LotOpMix.SendSeq).FirstOrDefault();
|
|
if (source.LotOpMix.TotalUseQty + source.UseQty + Convert.ToDecimal(txtCurrentUse.Text) > source.LotOpMix.MaxValue)
|
|
throw new Exception("P/N料号:" + ItemLotNOMes.Rows[0]["INVCODE"].ToString() + "上料后将超出最大用量,无法上料!");
|
|
|
|
if (source.LotOpMix.TotalUseQty + source.UseQty + Convert.ToDecimal(txtCurrentUse.Text) < source.LotOpMix.MinValue)
|
|
source.LotOpMix.MixStatus = "上料中";
|
|
if (source.LotOpMix.TotalUseQty + source.UseQty + Convert.ToDecimal(txtCurrentUse.Text) <= source.LotOpMix.MaxValue && source.LotOpMix.TotalUseQty + source.UseQty + Convert.ToDecimal(txtCurrentUse.Text) >= source.LotOpMix.MinValue)
|
|
source.LotOpMix.MixStatus = "已上料";
|
|
|
|
var nowdate = DateTime.Now; ;
|
|
//累计数量
|
|
source.LoseQty += Convert.ToDecimal(this.txtCurrentLose.Text);
|
|
source.UseQty += Convert.ToDecimal(this.txtCurrentUse.Text);
|
|
source.NewestMixDate = nowdate;
|
|
source.MixDate = nowdate;
|
|
source.Default4= ItemLotNOMes.Rows[0]["BATCHCODE"].ToString();
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(source.LotOpMix.BatchCodes))
|
|
source.LotOpMix.BatchCodes += ItemLotNOMes.Rows[0]["BATCHCODE"].ToString();
|
|
else
|
|
{
|
|
if (!source.LotOpMix.BatchCodes.Contains(ItemLotNOMes.Rows[0]["BATCHCODE"].ToString()))
|
|
source.LotOpMix.BatchCodes += "," + ItemLotNOMes.Rows[0]["BATCHCODE"].ToString();
|
|
}
|
|
|
|
|
|
|
|
//保存上料记录
|
|
var copy = MapHelper.Mapping(source);
|
|
copy.Default1 = txtItemLotno.Text;//上料条码
|
|
copy.MixDate = nowdate;
|
|
copy.LoseQty = Convert.ToDecimal(this.txtCurrentLose.Text);
|
|
copy.UseQty = Convert.ToDecimal(this.txtCurrentUse.Text);
|
|
copy.Default2 = txtEQPCode.Text;
|
|
copy.Default3 = txtPotCode.Text;
|
|
JbDetails.Add(copy);
|
|
|
|
//获取条码打印信息
|
|
var printModel=GetPrintMes(txtItemLotno.Text);
|
|
var printMes = JbDetails.Where(a => a.Default1 == txtItemLotno.Text).ToList();
|
|
decimal costValue = 0;
|
|
if (printModel != null)
|
|
{
|
|
foreach (var detail in printMes)
|
|
{
|
|
if (detail.LotOpMix.Default2 != detail.LotOpMix.SbItemUnit)
|
|
{
|
|
if (detail.LotOpMix.Default2.ToUpper() == "KG" || detail.LotOpMix.Default2.ToUpper() == "公斤")
|
|
{
|
|
if (detail.LotOpMix.SbItemUnit.ToUpper() == "G")
|
|
{
|
|
costValue += Math.Round((detail.UseQty + detail.LoseQty) / 1000, 5);
|
|
}
|
|
else if (detail.LotOpMix.SbItemUnit.ToUpper() == "KG")
|
|
{
|
|
costValue += (detail.UseQty + detail.LoseQty);
|
|
}
|
|
else
|
|
throw new Exception("搅拌单子阶物料维护的重量单位不正确!");
|
|
}
|
|
else if (detail.LotOpMix.Default2.ToUpper() == "G" || detail.LotOpMix.Default2.ToUpper() == "克")
|
|
{
|
|
if (detail.LotOpMix.SbItemUnit.ToUpper() == "G")
|
|
{
|
|
costValue += (detail.UseQty + detail.LoseQty);
|
|
}
|
|
else if (detail.LotOpMix.SbItemUnit.ToUpper() == "KG")
|
|
{
|
|
costValue+= ((detail.UseQty + detail.LoseQty) * 1000);
|
|
}
|
|
else
|
|
throw new Exception("搅拌单子阶物料维护的重量单位不正确!");
|
|
}
|
|
else
|
|
throw new Exception("子阶物料对应的物料单位不正确!");
|
|
|
|
}
|
|
else
|
|
{
|
|
costValue += (detail.UseQty + detail.LoseQty);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
printModel.Qty = (Convert.ToDecimal(printModel.Qty) - costValue).ToString();
|
|
FormPreview preView = new FormPreview(new List<PrintModel> { printModel });
|
|
preView.ShowDialog();
|
|
}
|
|
|
|
|
|
#region 发送清空指令,清空秤帮数据(待测试)
|
|
///天平发送指令:"T \r\n"
|
|
if (chengMes.Parameter3.StartsWith("天平"))
|
|
{
|
|
SendCommand("T " + "\r\n");
|
|
}
|
|
else
|
|
{
|
|
SendCommand("SZ" + "\r\n");
|
|
}
|
|
#endregion
|
|
|
|
Reset();
|
|
|
|
SetLableText(lblMsg, "保存成功!", true);
|
|
SetRichTextboxContent(RTBox_Log, "保存成功", true);
|
|
grvDetail.RefreshData();
|
|
|
|
txtItemLotno.Focus();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
playSoundFromResource();
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 音频提示
|
|
/// </summary>
|
|
private void playSoundFromResource()
|
|
{
|
|
using (Stream stream = Properties.Resources.chord)
|
|
{
|
|
SoundPlayer player = new SoundPlayer(stream);
|
|
player.Play();
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取上料条码打印信息
|
|
/// </summary>
|
|
/// <param name="Lotno"></param>
|
|
private PrintModel GetPrintMes(string itemLotNo)
|
|
{
|
|
try
|
|
{
|
|
string sql = @"select
|
|
a.LotNo,
|
|
a.InvCode AS ItemCode,
|
|
d.InvName AS ItemDesc,
|
|
d.InvStd AS ItemStd,
|
|
cc.Quantity AS Qty,
|
|
D.InvUnit AS ItemUnit,
|
|
convert(nvarchar(50), cc.InDate, 23) InDate,
|
|
convert(nvarchar(50), A.ExpirationDate, 23) AS ExpirationDate,
|
|
|
|
convert(nvarchar(50), a.ProductDate, 23) AS ProductDate,
|
|
f.BatchCode
|
|
FROM {1}.ICSInventoryLot a
|
|
left join {1}.ICSInventoryLotDetail b on a.LotNo = b.LotNo and a.WorkPoint = b.WorkPoint
|
|
LEFT JOIN {1}.ICSExtension f on a.ExtensionID = f.ID AND f.WorkPoint = a.WorkPoint
|
|
left join {1}.ICSMO c on b.TransCode = c.MOCode and b.TransSequence = c.Sequence and b.WorkPoint = c.WorkPoint
|
|
left join {1}.ICSInventory d on a.InvCode = d.InvCode and a.WorkPoint = d.WorkPoint
|
|
left join {1}.ICSWareHouseLotInfo cc on a.LotNo = cc.LotNo
|
|
where A.LOTNO ='{0}'";
|
|
|
|
sql = string.Format(sql, itemLotNo, WmsDbLink);
|
|
PrintModel model = null;
|
|
|
|
using ( var reader=DBHelper.ExecuteReader(Conns, CommandType.Text, sql))
|
|
{
|
|
if (reader.HasRows)
|
|
{
|
|
model = new PrintModel();
|
|
reader.Read();
|
|
model.LotNo = reader.GetString(0)?.ToString();
|
|
model.ItemCode= reader.GetValue(1)?.ToString();
|
|
model.ItemDesc = reader.GetValue(2)?.ToString();
|
|
model.ItemStd = reader.GetValue(3)?.ToString();
|
|
model.Qty = reader.GetValue(4)?.ToString();
|
|
model.ItemUnit = reader.GetValue(5)?.ToString();
|
|
model.InDate = reader.GetValue(6)?.ToString();
|
|
model.ExpirationDate = reader.GetValue(7)?.ToString();
|
|
model.ProductDate = reader.GetValue(8)?.ToString();
|
|
model.BatchCode = reader.GetValue(9)?.ToString();
|
|
}
|
|
}
|
|
return model;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 字符转16进制
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
//string StringToHex(string input)
|
|
//{
|
|
// StringBuilder sb = new StringBuilder();
|
|
// foreach (char c in input)
|
|
// {
|
|
// sb.Append(Convert.ToInt32(c).ToString("X2")).Append(" ");
|
|
// }
|
|
// return sb.ToString();
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 16进制转字符
|
|
/// </summary>
|
|
/// <param name="hex"></param>
|
|
/// <returns></returns>
|
|
string HexToString(string hex)
|
|
{
|
|
string[] hexValuesSplit = hex.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
|
StringBuilder sb = new StringBuilder();
|
|
foreach (string hexValue in hexValuesSplit)
|
|
{
|
|
sb.Append((char)Convert.ToInt32(hexValue, 16));
|
|
}
|
|
return sb.ToString();
|
|
}
|
|
|
|
|
|
|
|
public StringDtoEx GetFormNameByChengNo(string chengNo)
|
|
{
|
|
|
|
string sql = "select Cname as Parameter1,Ccode as Parameter2,Ctype as Parameter3,ComCode as Parameter4,ComBaudRate as Parameter5,CbarCode as Parameter6,ComNumber as Parameter7 from ICSMIXCHENG where Ccode='{0}'";
|
|
|
|
sql = string.Format(sql, chengNo);
|
|
DataTable table = DBHelper.ExecuteDataset(Conns, CommandType.Text, sql).Tables[0];
|
|
|
|
StringDtoEx stringDto = new StringDtoEx();
|
|
if (table.Rows.Count > 0)
|
|
{
|
|
var row = table.Rows[0];
|
|
stringDto.Parameter1 = row["Parameter1"].ToString();
|
|
stringDto.Parameter2 = row["Parameter2"].ToString();
|
|
stringDto.Parameter3 = row["Parameter3"].ToString();
|
|
stringDto.Parameter4 = row["Parameter4"].ToString();
|
|
stringDto.Parameter5 = row["Parameter5"].ToString();
|
|
stringDto.Parameter6 = row["Parameter6"].ToString();
|
|
stringDto.Parameter7 = row["Parameter7"].ToString();
|
|
}
|
|
|
|
return stringDto;
|
|
}
|
|
|
|
|
|
//查询挂壁量
|
|
public string GetGbl(decimal value, string itemCode,string MixUnit)
|
|
{
|
|
try
|
|
{
|
|
|
|
string gbl = "0";
|
|
string sql = @"SELECT WallQty as VALUE,USEMIN,USEMAX,WallUnit,UseRate
|
|
FROM IcsLossRelation WHERE ITEMCODE='{0}'";
|
|
sql = string.Format(sql, itemCode, value);
|
|
var table = DBHelper.ExecuteDataset(Conns, CommandType.Text, sql).Tables[0];
|
|
if (table.Rows.Count > 0)
|
|
{
|
|
|
|
|
|
if (MixUnit.ToUpper() == "KG" || MixUnit == "公斤")
|
|
{
|
|
var table_KG = table.AsEnumerable().Where(a => (a["WallUnit"].ToString() == "KG" || a["WallUnit"].ToString() == "公斤") && Convert.ToDecimal(a["USEMIN"]) <= value && Convert.ToDecimal(a["USEMAX"]) >= value).FirstOrDefault();
|
|
if (table_KG != null)
|
|
{
|
|
var tableValue = Convert.ToDecimal(table_KG["VALUE"]);
|
|
if (tableValue == 0)
|
|
tableValue = value *Convert.ToDecimal(table_KG["UseRate"])/100;
|
|
|
|
gbl = tableValue.ToString();
|
|
}
|
|
|
|
var table_G = table.AsEnumerable().Where(a => (a["WallUnit"].ToString() == "G" || a["WallUnit"].ToString() == "克") && Convert.ToDecimal(a["USEMIN"]) / 1000 <= value && Convert.ToDecimal(a["USEMAX"]) / 1000 >= value).FirstOrDefault();
|
|
if (table_G != null)
|
|
{
|
|
var tableValue = Convert.ToDecimal(table_G["VALUE"]);
|
|
if (tableValue == 0)
|
|
tableValue = value * Convert.ToDecimal(table_KG["UseRate"])/100;
|
|
else
|
|
tableValue = (tableValue / 1000);
|
|
|
|
gbl = tableValue.ToString();
|
|
}
|
|
}
|
|
else if (MixUnit.ToUpper() == "G" || MixUnit == "克")
|
|
{
|
|
var table_KG = table.AsEnumerable().Where(a => (a["WallUnit"].ToString() == "KG" || a["WallUnit"].ToString() == "公斤") && Convert.ToDecimal(a["USEMIN"]) * 1000 <= value && Convert.ToDecimal(a["USEMAX"]) * 1000 >= value).FirstOrDefault();
|
|
if (table_KG != null)
|
|
{
|
|
var tableValue = Convert.ToDecimal(table_KG["VALUE"]);
|
|
if (tableValue == 0)
|
|
tableValue = value * Convert.ToDecimal(table_KG["UseRate"])/100;
|
|
else
|
|
tableValue = tableValue * 1000;
|
|
|
|
gbl = tableValue.ToString();
|
|
}
|
|
|
|
|
|
var table_G = table.AsEnumerable().Where(a => (a["WallUnit"].ToString() == "G" || a["WallUnit"].ToString() == "克") && Convert.ToDecimal(a["USEMIN"]) <= value && Convert.ToDecimal(a["USEMAX"]) >= value).FirstOrDefault();
|
|
if (table_G != null)
|
|
{
|
|
var tableValue = Convert.ToDecimal(table_G["VALUE"]);
|
|
if (tableValue == 0)
|
|
tableValue = value * Convert.ToDecimal(table_KG["UseRate"]) / 100;
|
|
|
|
gbl = tableValue.ToString();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
return gbl;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
throw ex;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void btnFlash_Click(object sender, EventArgs e)
|
|
{
|
|
if (ICSBaseSimpleCode.AppshowMessageBoxRepose("当前未扣料的数据会丢失,确定刷新吗?") != DialogResult.OK)
|
|
return;
|
|
|
|
else
|
|
{
|
|
JbFlash();
|
|
SetLableText(lblMsg, "刷新成功", true);
|
|
SetRichTextboxContent(RTBox_Log, "刷新成功", true);
|
|
}
|
|
}
|
|
|
|
private void btnReset_Click(object sender, EventArgs e)
|
|
{
|
|
Reset();
|
|
}
|
|
|
|
private void Reset()
|
|
{
|
|
txtCheng.Enabled = false;
|
|
txtItemLotno.Enabled = true;
|
|
txtCheng.Text = "";
|
|
txtItemLotno.Text = "";
|
|
txtCurrentLose.Text = "";
|
|
txtCurrentUse.Text = "";
|
|
this.txtItemlotNoQty.Text = "";
|
|
revCounts = 0;
|
|
CloseCom();
|
|
}
|
|
|
|
private void JbFlash()
|
|
{
|
|
JbDetails.Clear();
|
|
LoadMixMsg();
|
|
|
|
}
|
|
|
|
private void btnDct_Click(object sender, EventArgs e)
|
|
{
|
|
DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在扣料...请稍等...");
|
|
try
|
|
{
|
|
if (JbDetails.Count <= 0)
|
|
throw new Exception("未获取到上料记录,无法扣料!");
|
|
|
|
|
|
JbDetails.ForEach(a =>
|
|
{
|
|
a.LotOpMix.LotNo = this.txtLotNo.Text;
|
|
a.LotOpMix.ProductQty = Convert.ToInt32(Onwip.LotQty);
|
|
a.LotOpMix.OpCode = this.txtOPCode.Text;
|
|
a.LotOpMix.ItemCode = this.txtItemCode.Text;
|
|
a.UserCode = this.txtUserCode.Text;
|
|
|
|
}
|
|
);
|
|
|
|
_wait.Show();
|
|
|
|
List<WmsStockDownDto> lists = new List<WmsStockDownDto>();
|
|
|
|
|
|
foreach (var detail in JbDetails)
|
|
{
|
|
|
|
|
|
var tup= GetTransIDAndSeq(detail.LotOpMix.SbItemCode); //获取备料单行号和ID
|
|
var dto = lists.Where(a => a.TransID == tup.Item1).FirstOrDefault();
|
|
bool isNew = false;
|
|
|
|
if (dto == null)
|
|
{
|
|
dto = new WmsStockDownDto();
|
|
dto.User = WmsUser;
|
|
dto.Workpoint = WmsWorkpoint;
|
|
dto.TransSequence = Onwip.MoSeq.ToString() + "~" + tup.Item2;
|
|
dto.TransCode = Onwip.MoCode.ToString();
|
|
dto.Quantity = Onwip.LotQty.ToString();
|
|
dto.TransType = "生产发料-生产订单备料表";
|
|
dto.MTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
dto.TransID = tup.Item1;
|
|
dto.Detail = new List<WmsStockDownDetailsDto>();
|
|
isNew = true;
|
|
}
|
|
|
|
|
|
WmsStockDownDetailsDto detaildto = new WmsStockDownDetailsDto();
|
|
detaildto.LotNo = detail.Default1;
|
|
if (detail.LotOpMix.Default2 != detail.LotOpMix.SbItemUnit)
|
|
{
|
|
if (detail.LotOpMix.Default2.ToUpper() == "KG" || detail.LotOpMix.Default2.ToUpper() == "公斤")
|
|
{
|
|
if (detail.LotOpMix.SbItemUnit.ToUpper() == "G")
|
|
{
|
|
detaildto.CurrentQuantity = Math.Round((detail.UseQty + detail.LoseQty) / 1000, 5).ToString();
|
|
}
|
|
else if (detail.LotOpMix.SbItemUnit.ToUpper() == "KG")
|
|
{
|
|
detaildto.CurrentQuantity = (detail.UseQty + detail.LoseQty).ToString();
|
|
}
|
|
else
|
|
throw new Exception("搅拌单子阶物料维护的重量单位不正确!");
|
|
}
|
|
else if (detail.LotOpMix.Default2.ToUpper() == "G" || detail.LotOpMix.Default2.ToUpper() == "克")
|
|
{
|
|
if (detail.LotOpMix.SbItemUnit.ToUpper() == "G")
|
|
{
|
|
detaildto.CurrentQuantity = (detail.UseQty + detail.LoseQty).ToString();
|
|
}
|
|
else if (detail.LotOpMix.SbItemUnit.ToUpper() == "KG")
|
|
{
|
|
detaildto.CurrentQuantity = ((detail.UseQty + detail.LoseQty) * 1000).ToString();
|
|
}
|
|
else
|
|
throw new Exception("搅拌单子阶物料维护的重量单位不正确!");
|
|
}
|
|
else
|
|
throw new Exception("子阶物料对应的物料单位不正确!");
|
|
|
|
}
|
|
else
|
|
{
|
|
detaildto.CurrentQuantity = (detail.UseQty + detail.LoseQty).ToString();
|
|
}
|
|
|
|
dto.Detail.Add(detaildto);
|
|
if(isNew)
|
|
lists.Add(dto);
|
|
}
|
|
|
|
|
|
SetLableText(lblMsg, "验证是否可以扣料", true);
|
|
var checkDto = WebHelper.HttpPost<ReturnDto<object>>(CheckCreateOrUpdateIcsLot2OpMix, JsonConvert.SerializeObject(JbDetails), AuthenicateResult.AccessToken);
|
|
if (!checkDto.success)
|
|
throw new Exception(checkDto.error.message);
|
|
SetRichTextboxContent(RTBox_Log, "验证成功!", true);
|
|
|
|
SetLableText(lblMsg, "开始扣料", true);
|
|
var returndto = WebHelper.HttpPost<WmsReturnDto>(LOTStockDown, JsonConvert.SerializeObject(lists));
|
|
|
|
if (returndto.Success)
|
|
SetLableText(lblMsg, "扣料成功!", true);
|
|
else
|
|
throw new Exception(returndto.Message);
|
|
|
|
|
|
SetLableText(lblMsg, "开始保存上料记录", true);
|
|
var returnDto = WebHelper.HttpPost<ReturnDto<object>>(CreateOrUpdateIcsLot2OpMix, JsonConvert.SerializeObject(JbDetails), AuthenicateResult.AccessToken);
|
|
if (!returnDto.success)
|
|
throw new Exception(returnDto.error.message);
|
|
SetRichTextboxContent(RTBox_Log, "上料记录保存成功!", true);
|
|
|
|
_wait.Close();
|
|
|
|
|
|
Reset();
|
|
JbFlash();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_wait.Close();
|
|
playSoundFromResource();
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
|
|
}
|
|
|
|
private void btnOpEnd_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(Onwip.LotNo))
|
|
throw new Exception("未扫描跟踪单号!");
|
|
if (string.IsNullOrEmpty(Onwip.OpCode))
|
|
throw new Exception("未扫描工序!");
|
|
if (string.IsNullOrEmpty(Onwip.UserCode))
|
|
throw new Exception("未扫描报工人!");
|
|
if (string.IsNullOrEmpty(Onwip.EqpCode))
|
|
throw new Exception("未扫描设备!");
|
|
if (string.IsNullOrEmpty(Onwip.PotCode))
|
|
throw new Exception("未扫描锅具!");
|
|
if (string.IsNullOrEmpty(txtCurrentQty.Text))
|
|
throw new Exception("完工请填写流转数量!");
|
|
|
|
if (xPage_JbSl.PageEnabled)//当前工单是搅拌工单并且开工状态开启搅拌功能
|
|
{
|
|
if (JbSources.Where(a => a.LotOpMix.MixStatus != "已上料"&&string.IsNullOrEmpty(a.LotOpMix.Default3)).FirstOrDefault() != null)
|
|
throw new Exception("当前跟踪单还未搅拌完毕,无法工序完工!");
|
|
|
|
}
|
|
|
|
Onwip.CollectQty = Convert.ToDecimal(txtCurrentQty.Text);
|
|
Onwip.Memo = txtMemo.Text;
|
|
var returnDto = WebHelper.HttpPost<ReturnDto<IcsLotOnWipDto>>(LotOnWipOpEnd, JsonConvert.SerializeObject(Onwip), AuthenicateResult.AccessToken);
|
|
if (!returnDto.success)
|
|
throw new Exception(returnDto.error.message);
|
|
else
|
|
Onwip = returnDto.result;
|
|
|
|
SetRichTextboxContent(RTBox_Log, "工序完工成功!", true);
|
|
SetLableText(lblMsg, "工序完工成功", true);
|
|
Clear();
|
|
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
}
|
|
|
|
private void btnOpenCom_Click(object sender, EventArgs e)
|
|
{
|
|
CloseCom();
|
|
SetRichTextboxContent(RTBox_Log, "串口关闭成功!", true);
|
|
}
|
|
|
|
private void CloseCom()
|
|
{
|
|
if (port.IsOpen)
|
|
{
|
|
port.Close();
|
|
revCounts = 0;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
private Tuple<string, string> GetTransIDAndSeq(string SbItemcode)
|
|
{
|
|
|
|
try
|
|
{
|
|
string sql = "select ID,Sequence From {0}.ICSMOPick WHERE PICKID=(SELECT DEFAULT1 FROM ICSMOBOM WHERE MOCODE='{1}' AND MOBITEMCODE='{2}' )";
|
|
sql = string.Format(sql, WmsDbLink, Onwip.MoCode, SbItemcode);
|
|
var table = DBHelper.ExecuteDataset(Conns, CommandType.Text, sql).Tables[0];
|
|
if (table.Rows.Count <= 0)
|
|
throw new Exception("获取WMS领料单对应的工单领料信息失败!");
|
|
|
|
return new Tuple<string, string>(table.Rows[0]["ID"].ToString(), table.Rows[0]["Sequence"].ToString());
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
throw ex;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void tabPageArea_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void btnCustomQty_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
|
|
try
|
|
{
|
|
if (this.model == ModelEnum.Default)
|
|
{
|
|
|
|
if (ICSBaseSimpleCode.AppshowMessageBoxRepose("该功能将开启手动输入用量功能且输入用量单位需和下方搅拌单明细\r\n表维护物料的单位一致,确定吗?") != DialogResult.OK)
|
|
return;
|
|
|
|
GetCustomPower();
|
|
|
|
this._model = ModelEnum.Custom;
|
|
SetLableText(lblMsg, "变更为手动输入模式", true);
|
|
SetRichTextboxContent(RTBox_Log, "变更为手动输入模式", true);
|
|
}
|
|
else
|
|
{
|
|
this._model = ModelEnum.Default;
|
|
SetLableText(lblMsg, "变更为称重模式", true);
|
|
SetRichTextboxContent(RTBox_Log, "变更为称重模式", true);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void CustomModel()
|
|
{
|
|
try
|
|
{
|
|
CloseCom();
|
|
txtCheng.Enabled = false;
|
|
txtCheng.Text = "";
|
|
txtCurrentUse.Properties.ReadOnly = false;
|
|
txtCurrentUse.Text = "";
|
|
txtCurrentUse.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
|
|
txtCurrentUse.Properties.Mask.EditMask = "n5";//输入框数字模式
|
|
this.btnCustomQty.Text = "称重模式";
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
private void DefaultModel()
|
|
{
|
|
try
|
|
{
|
|
this.btnCustomQty.Text = "手动模式";
|
|
txtCurrentUse.Properties.ReadOnly = true;
|
|
txtCurrentUse.Text = "";
|
|
txtCurrentUse.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None;
|
|
this.txtCheng.Enabled = !txtItemLotno.Enabled;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
private void txtCurrentUse_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
|
|
try
|
|
{
|
|
if (e.KeyChar != (char)(Keys.Enter))
|
|
return;
|
|
if (txtCurrentUse.EditValue == null || Convert.ToDecimal(txtCurrentUse.EditValue) == 0)
|
|
throw new Exception("请输入大于0的用量!");
|
|
|
|
|
|
txtCurrentLose.Text=GetGbl(Convert.ToDecimal(this.txtCurrentUse.Text), ItemLotNOMes.Rows[0]["INVCODE"].ToString(), ItemLotNOMes.Rows[0]["INVUNIT"].ToString());
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
|
|
}
|
|
|
|
private void lab22_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void txtUnLockEqp_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//调用接口获取信息
|
|
var returnDto = WebHelper.HttpPost<ReturnDto<string>>(UnLockEqpUrl,JsonConvert.SerializeObject(new { Value=txtUnLockEqp.Text.Trim() }), AuthenicateResult.AccessToken);
|
|
if (!returnDto.success)
|
|
throw new Exception(returnDto.error.message);
|
|
|
|
|
|
SetRichTextboxContent(RTBox_Log, "设备:"+txtUnLockEqp.Text+"解锁成功", true);
|
|
SetLableText(lblMsg, "设备:" + txtUnLockEqp.Text + "解锁成功", true);
|
|
|
|
txtUnLockEqp.Text = "";
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SetLableText(lblMsg, ex.Message, false);
|
|
SetRichTextboxContent(RTBox_Log, ex.Message, false);
|
|
}
|
|
}
|
|
|
|
private void grvDetail_RowCellStyle(object sender, RowCellStyleEventArgs e)
|
|
{
|
|
if (grvDetail.GetRowCellValue(e.RowHandle, colMixStatus).ToString() == "已上料")
|
|
e.Appearance.BackColor = Color.LightGreen;
|
|
|
|
}
|
|
|
|
private void tableLayoutPanel_Jb_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void btnPrintDemo_Click(object sender, EventArgs e)
|
|
{
|
|
FormDesign design = new FormDesign();
|
|
design.ShowDialog();
|
|
}
|
|
|
|
private void btnShowPDF_General_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
public enum ModelEnum
|
|
{
|
|
/// <summary>
|
|
/// 自定义手输
|
|
/// </summary>
|
|
Custom
|
|
,
|
|
/// <summary>
|
|
/// 默认称重模式
|
|
/// </summary>
|
|
Default
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|