diff --git a/Admin.Core.Api/Admin.Core.Model.xml b/Admin.Core.Api/Admin.Core.Model.xml index 17daf502..1b03ad83 100644 --- a/Admin.Core.Api/Admin.Core.Model.xml +++ b/Admin.Core.Api/Admin.Core.Model.xml @@ -493,7 +493,7 @@ - 条码下线信息 + 条码下线信息记录 diff --git a/Admin.Core.Model/Model_New/OffLineInfo.cs b/Admin.Core.Model/Model_New/OffLineInfo.cs index 58d1b911..64a9a4ca 100644 --- a/Admin.Core.Model/Model_New/OffLineInfo.cs +++ b/Admin.Core.Model/Model_New/OffLineInfo.cs @@ -8,9 +8,9 @@ using System.Threading.Tasks; namespace Admin.Core.Model.Model_New { /// - /// 条码下线信息 + /// 条码下线信息记录 /// - [SugarTable("OFF_LINEINFO", "AUCMA_MES")] + [SugarTable("PRODUCT_OFFLINE", "AUCMA_SCADA")] public class OffLineInfo { /// @@ -18,41 +18,43 @@ namespace Admin.Core.Model.Model_New /// [SugarColumn(ColumnName = "OBJ_ID", IsPrimaryKey = true, IsIdentity = true)] public int ObjId { get; set; } + [SugarColumn(ColumnName = "PRODUCT_FACTORY_CODE")] + public string ProductFactoryCode { get; set; } //计划工厂 + [SugarColumn(ColumnName = "PRODUCT_SNCODE")] + public string ProductSNCode { get; set; } //公司条码 + [SugarColumn(ColumnName = "PRODUCT_ORDER_NO")] + public string ProductOrderNo { get; set; }//工单号 + [SugarColumn(ColumnName = "PRODUCT_SALE_NO")] + public string ProductSaleNo { get; set; } //销售订单号 + [SugarColumn(ColumnName = "PRODUCT_SALE_LINE_NO")] + public string ProductSaleLineNo { get; set; } //销售行号 + [SugarColumn(ColumnName = "PRODUCT_CODE")] + public string ProductCode { get; set; }//物料编码 + [SugarColumn(ColumnName = "PRODUCT_MODEL")] + public string ProductModel{ get; set; }//产品型号 + [SugarColumn(ColumnName = "PRODUCT_NAME")] + public string ProductName { get; set; }//物料描述 + [SugarColumn(ColumnName = "PRODUCT_TYPE")] + public string ProductType { get; set; }//产品类型 + [SugarColumn(ColumnName = "PRODUCT_CHECK_INFO")] + public string ProductCheckInfo { get; set; }//验证组合 + [SugarColumn(ColumnName = "PRODUCT_REMARK")] + public string ProductRemark { get; set; } //标签特征 + [SugarColumn(ColumnName = "PRODUCT_BAR_NO")] + public string ProductBarNo { get; set; }//产品条码编码 + [SugarColumn(ColumnName = "PRODUCT_MASTER_MODEL")] + public string ProductMasterModel { get; set; }//主型号 + [SugarColumn(ColumnName = "PRODUCT_VERSION")] + public string ProductVersion { get; set; }//版本号 + [SugarColumn(ColumnName = "PRODUCT_USERINFO")] + public string ProductUseInfo { get; set; }//用途位 + [SugarColumn(ColumnName = "PRODUCT_CIRCULATE")] - public string ProductFactoryCode; //计划工厂 - public string ProductSNCode; //公司条码 - public string ProductOrderNo; //工单号 - public string ProductSaleNo; //销售订单号 - public string ProductSaleLineNo; //销售行号 - public string ProductCode;//物料编码 - public string ProductModel;//产品型号 - public string ProductName;//物料描述 - public string ProductType;//产品类型 - public string ProductCheckInfo;//验证组合 - public string ProductRemark; //标签特征 - public string ProductBarNo; //产品条码编码 - public string ProductMasterModel;//主型号 - public string ProductVersion;//版本号 - public string ProductUseInfo;//用途位 - public string ProductCirculate;//流通特性 - public string ProductCreateDate;//生成日期 - public string ProductScanTime; //扫描时间 - - - public bool ProductRefreshFlag; - public int ReadFlag; - public bool ProductDataFlag; - // 界面提示信息 - public string MsgInfo; - public bool MsgAlarmFlag; - public int OrderQty; - public int ActQty; - public string oneCode; - public string serialNumber; - public string rfid; - public string sim; - public string number1; - public bool ChkOut; + public string ProductCirculate { get; set; }//流通特性 + [SugarColumn(ColumnName = "PRODUCT_CREATEDATE")] + public string ProductCreateDate { get; set; }//生成日期 + [SugarColumn(ColumnName = "PRODUCT_SCANTIME")] + public DateTime ProductScanTime { get; set; } //扫描时间 } } diff --git a/Aucma.Core.ProductOffLine/Aucma.Core.ProductOffLine.csproj b/Aucma.Core.ProductOffLine/Aucma.Core.ProductOffLine.csproj index 4ca354a2..8c1f341f 100644 --- a/Aucma.Core.ProductOffLine/Aucma.Core.ProductOffLine.csproj +++ b/Aucma.Core.ProductOffLine/Aucma.Core.ProductOffLine.csproj @@ -85,6 +85,9 @@ + + Code + Code diff --git a/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs b/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs index 0245ac4d..b0d285ea 100644 --- a/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs +++ b/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs @@ -14,6 +14,7 @@ using System.Collections; using System.Collections.Generic; using System.Data; using System.Linq; +using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -39,14 +40,13 @@ namespace Aucma.Core.ProductOffLine.Business // public OffLineBusiness(){} #region 变量定义 - public static OffLineInfo TempOffLineInfo = new OffLineInfo(); - public static OffLineInfo FDOffLineInfo = new OffLineInfo(); + public static TempInfo TempOffLineInfo = new TempInfo(); + public static TempInfo FDOffLineInfo = new TempInfo(); // 河南工厂编码 private static string Werks = "1301"; #endregion - #region 接口引用 private static readonly log4net.ILog log = LogManager.GetLogger(typeof(OffLineBusiness)); @@ -91,110 +91,137 @@ namespace Aucma.Core.ProductOffLine.Business public async void test() { - - BaseOrderInfo order = await _baseOrderInfoServices.FirstAsync(); - Console.WriteLine(order); + //TempInfo info = new TempInfo(); + //string tt = "Y@1104@16160030000000910780@000010034895@@ @000000@000000009000000807@BCD-160C,家电下乡@@BCD-160C@皓月白-家电下乡@161601300@160@1-00版@家电下乡产品@默认@2010-09-01"; + //string[] FArrayList = tt.Split('@'); + //if (FArrayList[0].ToUpper() == "Y") //查询数据成功 + //{ + // #region 实体赋值 + // info.ProductFactoryCode = FArrayList[1]; + // info.ProductSNCode = FArrayList[2]; + // info.ProductOrderNo = DBToString(FArrayList[3]); + // info.ProductSaleNo = DBToString(FArrayList[4]); + // info.ProductSaleLineNo = DBToString(FArrayList[5]); + // info.ProductCheckInfo = DBToString(FArrayList[6]); //验证组合 + // info.ProductCode = DBToString(FArrayList[7]); + // info.ProductName = DBToString(FArrayList[8]); //产品描述 + // info.ProductType = FArrayList[9]; + // info.ProductModel = FArrayList[10]; //产品型号 + // info.ProductRemark = DBToString(FArrayList[11]); + // info.ProductBarNo = FArrayList[12]; + // info.ProductMasterModel = FArrayList[13]; //产品主型号 + // info.ProductVersion = FArrayList[14]; + // info.ProductUseInfo = FArrayList[15];//产品用途 + // info.ProductCirculate = FArrayList[16];//流通特性 + // info.ProductCreateDate = FArrayList[17]; + // #endregion + // info.ProductScanTime = System.DateTime.Now; + // info.number1 = "111"; + // OffLineInfo info11 = MapperTwo(info); + // int a = await _offLineInfoServices.AddAsync(info11); + // Console.WriteLine(a); + //} } - /// /// 处理条码 /// /// /// 扫码器方向 - private async void MaterialBarScanEvent(string code)//接收条码数据 - { - //1.扫描的SN条码去条码系统校验 - bool BackResult = await HandleMaterialBarCode(code.Trim()); //处理条码信息 - TempOffLineInfo.ReadFlag = 0; - if (BackResult == true) + public async void MaterialBarScanEvent(string code)//接收条码数据 { - TempOffLineInfo.ProductRefreshFlag = true; - // 更新mes数据库 - int a = await _offLineInfoServices.AddAsync(TempOffLineInfo); - log.Info(String.Format("订单号{0} 订单数量{1}", TempOffLineInfo.ProductOrderNo.Replace("0000", ""), TempOffLineInfo.OrderQty)); - if (a > 0) + //1.扫描的SN条码去条码系统校验 + bool BackResult = await HandleMaterialBarCode(code.Trim()); //处理条码信息 + TempOffLineInfo.ReadFlag = 0; + if (BackResult == true) { - // 先查询分垛方向A或者B eg:000000009001000718 - string direction = getDirectioneEvent?.Invoke(TempOffLineInfo.ProductCode.Replace("00000000", "")); + TempOffLineInfo.ProductRefreshFlag = true; + // 更新mes数据库 + + OffLineInfo info11 = MapperTwo(TempOffLineInfo); + int a = await _offLineInfoServices.AddAsync(info11); + log.Info(String.Format("订单号{0} 订单数量{1}", TempOffLineInfo.ProductOrderNo.Replace("0000", ""), TempOffLineInfo.OrderQty)); + if (a > 0) + { + // 先查询分垛方向A或者B eg:000000009001000718=>9001000718 + string direction = getDirectioneEvent?.Invoke(TempOffLineInfo.ProductCode.Replace("00000000", "")); - // DownLoadPassFlag(BackResult); //下发plc放行信号,分垛AB库 - TempOffLineInfo.ReadFlag = 1; //放行成功 + // DownLoadPassFlag(BackResult); //下发plc放行信号,分垛AB库 + TempOffLineInfo.ReadFlag = 1; //放行成功 + } + else + { + TempOffLineInfo.ReadFlag = 2; //保存条码失败 + } } else { - TempOffLineInfo.ReadFlag = 2; //保存条码失败 + log.Info("条码验证失败"); + TempOffLineInfo.ReadFlag = 3; // 条码验证失败 } - } - else - { - log.Info("条码验证失败"); - TempOffLineInfo.ReadFlag = 3; // 条码验证失败 + } - } + // // 如果校验失败,下发报警 + // if ("N".Equals(result.Substring(0, 1))) + //{ + // sendPlcError(); + // // 刷新页面提示信息 result.Substring(2) + // return false; + //} + + + //3.分垛A,B库逻辑(先左边读到的条码分A库,右边读到的B库==>预留分库逻辑) + + ////4.下发plc信号 + //bool flag = SendPlcPass(); + //if (!flag) + //{ + // log.Error("获取plc反馈失败"); + // return; + //} + //Console.WriteLine(code); + //return; + //5.调条码系统保存入库接口SaveBarcodeInfo + //string saveResult = await _productOffLineServices.SaveBarcodeInfo("333", "ILS_SORT", "11111", 1); + //if (string.IsNullOrEmpty(saveResult) || "E".Equals(saveResult.Substring(0, 1))) + //{ + // log.Error("条码系统保存接口出错"); + // sendPlcError(); + // return; + //} + ////6.更新mes数据库完成数量和时间(BASE_ORDERINFO,PRODUCT_PLANINFO) 注意:查询的字段可能需要修改,确保数据一致 + + ////6.1截取订单号去查询更新BASE_ORDERINFO,全放到service处理 + //string orderCode = "11215484"; + //List orders = await _baseOrderInfoServices.QueryAsync(x => x.OrderCode == orderCode); + //BaseOrderInfo order = orders.FirstOrDefault(); + //if (order.CompleteAmount == 0) + //{ + // order.CompleteAmount++; + // order.BeginDate = DateTime.Now; + //} + //if (order.CompleteAmount == order.OrderAmount) + //{ + // order.EndDate = DateTime.Now; + //} + //order.UpdatedTime = DateTime.Now; + //_baseOrderInfoServices.UpdateAsync(order); + ////6.2根据订单号去更新PRODUCT_PLANINFO + //List productInfos = await _productPlanInfoServices.QueryAsync(x => x.OrderCode == orderCode); + //ProductPlanInfo productInfo = productInfos.FirstOrDefault(); + //if (productInfo.CompleteAmount == 0) + //{ + // productInfo.CompleteAmount++; + // productInfo.BeginTime = DateTime.Now; + //} + //if (productInfo.CompleteAmount == productInfo.PlanAmount) + //{ + // productInfo.EndTime = DateTime.Now; + //} + //productInfo.UpdatedTime = DateTime.Now; + //await _productPlanInfoServices.UpdateAsync(productInfo); - // // 如果校验失败,下发报警 - // if ("N".Equals(result.Substring(0, 1))) - //{ - // sendPlcError(); - // // 刷新页面提示信息 result.Substring(2) - // return false; - //} - - - //3.分垛A,B库逻辑(先左边读到的条码分A库,右边读到的B库==>预留分库逻辑) - - ////4.下发plc信号 - //bool flag = SendPlcPass(); - //if (!flag) - //{ - // log.Error("获取plc反馈失败"); - // return; - //} - //Console.WriteLine(code); - //return; - //5.调条码系统保存入库接口SaveBarcodeInfo - //string saveResult = await _productOffLineServices.SaveBarcodeInfo("333", "ILS_SORT", "11111", 1); - //if (string.IsNullOrEmpty(saveResult) || "E".Equals(saveResult.Substring(0, 1))) - //{ - // log.Error("条码系统保存接口出错"); - // sendPlcError(); - // return; - //} - ////6.更新mes数据库完成数量和时间(BASE_ORDERINFO,PRODUCT_PLANINFO) 注意:查询的字段可能需要修改,确保数据一致 - - ////6.1截取订单号去查询更新BASE_ORDERINFO,全放到service处理 - //string orderCode = "11215484"; - //List orders = await _baseOrderInfoServices.QueryAsync(x => x.OrderCode == orderCode); - //BaseOrderInfo order = orders.FirstOrDefault(); - //if (order.CompleteAmount == 0) - //{ - // order.CompleteAmount++; - // order.BeginDate = DateTime.Now; - //} - //if (order.CompleteAmount == order.OrderAmount) - //{ - // order.EndDate = DateTime.Now; - //} - //order.UpdatedTime = DateTime.Now; - //_baseOrderInfoServices.UpdateAsync(order); - ////6.2根据订单号去更新PRODUCT_PLANINFO - //List productInfos = await _productPlanInfoServices.QueryAsync(x => x.OrderCode == orderCode); - //ProductPlanInfo productInfo = productInfos.FirstOrDefault(); - //if (productInfo.CompleteAmount == 0) - //{ - // productInfo.CompleteAmount++; - // productInfo.BeginTime = DateTime.Now; - //} - //if (productInfo.CompleteAmount == productInfo.PlanAmount) - //{ - // productInfo.EndTime = DateTime.Now; - //} - //productInfo.UpdatedTime = DateTime.Now; - //await _productPlanInfoServices.UpdateAsync(productInfo); - - /// /// 去条码系统查询校验并保存 @@ -206,9 +233,9 @@ namespace Aucma.Core.ProductOffLine.Business try { TempOffLineInfo.ProductSNCode = BarCode.Trim(); //SN码 - TempOffLineInfo.ProductScanTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + TempOffLineInfo.ProductScanTime = System.DateTime.Now; - TempOffLineInfo.ProductOrderNo = ""; + TempOffLineInfo.ProductOrderNo = ""; log.Info("条码验证开始:" + BarCode); //1.查询条码系统 @@ -321,7 +348,9 @@ namespace Aucma.Core.ProductOffLine.Business else { log.Info(BarCode + "条码重复,本地不存在,已上传中"); - await _offLineInfoServices.AddAsync(TempOffLineInfo); + + OffLineInfo info11 = MapperTwo(TempOffLineInfo); + await _offLineInfoServices.AddAsync(info11); } } return false; @@ -519,7 +548,7 @@ namespace Aucma.Core.ProductOffLine.Business /// /// /// - public bool TestBarCode(OffLineInfo TempOffLineInfo) + public bool TestBarCode(TempInfo TempOffLineInfo) { if (TempOffLineInfo.ProductCode.Replace("00000000", "") == "9002005518" || TempOffLineInfo.ProductCode.Replace("00000000", "") == "9002005517") { @@ -617,6 +646,44 @@ namespace Aucma.Core.ProductOffLine.Business return true; } - #endregion -} + + /// + /// 传入类型B的对象b,将b与a相同名称的值进行赋值给创建的a中 + /// + /// 类型A + /// 类型B + /// 类型为B的参数b + /// 拷贝b中相同属性的值的a + public OffLineInfo MapperTwo(TempInfo b) + { + OffLineInfo a = new OffLineInfo(); + try + { + a.ProductFactoryCode = b.ProductFactoryCode; + a.ProductSNCode = b.ProductSNCode; + a.ProductOrderNo = b.ProductOrderNo; + a.ProductSaleNo = b.ProductSaleNo; + a.ProductSaleLineNo = b.ProductSaleLineNo; + a.ProductCode = b.ProductCode; + a.ProductModel = b.ProductModel; + a.ProductName = b.ProductName; + a.ProductType = b.ProductType; + a.ProductCheckInfo = b.ProductCheckInfo; + a.ProductRemark = b.ProductRemark; + a.ProductBarNo = b.ProductBarNo; + a.ProductMasterModel = b.ProductMasterModel; + a.ProductVersion = b.ProductVersion; + a.ProductUseInfo = b.ProductUseInfo; + a.ProductCirculate = b.ProductCirculate; + a.ProductCreateDate = b.ProductCreateDate; + a.ProductScanTime = b.ProductScanTime; + } + catch (Exception ex) + { + return null; + } + return a; + } + #endregion + } } \ No newline at end of file diff --git a/Aucma.Core.ProductOffLine/Models/TempInfo.cs b/Aucma.Core.ProductOffLine/Models/TempInfo.cs new file mode 100644 index 00000000..47b83349 --- /dev/null +++ b/Aucma.Core.ProductOffLine/Models/TempInfo.cs @@ -0,0 +1,70 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Principal; +using System.Text; +using System.Threading.Tasks; + +namespace Aucma.Core.ProductOffLine.Models +{ + /// + /// 条码下线信息记录 + /// + public class TempInfo + { + + public string ProductFactoryCode { get; set; } //计划工厂 + + public string ProductSNCode { get; set; } //公司条码 + + public string ProductOrderNo { get; set; }//工单号 + + public string ProductSaleNo { get; set; } //销售订单号 + + public string ProductSaleLineNo { get; set; } //销售行号 + + public string ProductCode { get; set; }//物料编码 + + public string ProductModel { get; set; }//产品型号 + + public string ProductName { get; set; }//物料描述 + + public string ProductType { get; set; }//产品类型 + + public string ProductCheckInfo { get; set; }//验证组合 + + public string ProductRemark { get; set; } //标签特征 + + public string ProductBarNo { get; set; }//产品条码编码 + + public string ProductMasterModel { get; set; }//主型号 + + public string ProductVersion { get; set; }//版本号 + + public string ProductUseInfo { get; set; }//用途位 + + + public string ProductCirculate { get; set; }//流通特性 + + public string ProductCreateDate { get; set; }//生成日期 + + public DateTime ProductScanTime { get; set; } //扫描时间 + + + public bool ProductRefreshFlag { get; set; } + public int ReadFlag { get; set; } + public bool ProductDataFlag { get; set; } + // 界面提示信息 + public string MsgInfo { get; set; } + public bool MsgAlarmFlag { get; set; } + public int OrderQty { get; set; } + public int ActQty { get; set; } + public string oneCode { get; set; } + public string serialNumber { get; set; } + public string rfid { get; set; } + public string sim { get; set; } + public string number1 { get; set; } + public bool ChkOut { get; set; } + } +} diff --git a/Aucma.Core.ProductOffLine/ViewModels/QualityItemViewModel.cs b/Aucma.Core.ProductOffLine/ViewModels/QualityItemViewModel.cs new file mode 100644 index 00000000..06fbbf6b --- /dev/null +++ b/Aucma.Core.ProductOffLine/ViewModels/QualityItemViewModel.cs @@ -0,0 +1,128 @@ +using Admin.Core.IService; +using Admin.Core.Model; +using Admin.Core.Service; +using Aucma.Core.ProductOffLine.Models; +using Aucma.Core.ProductOffLine.Views; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using Microsoft.Extensions.DependencyInjection; +using NPOI.SS.Formula.Functions; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Documents; +using System.Windows.Input; + +namespace Aucma.Core.ProductOffLine.ViewModels +{ + public partial class QualityItemViewModel : ObservableObject + { + public RelayCommand CloseWindowCommand { get; set; } + + public RelayCommand SaveCommand { get; set; } + + + private readonly IBaseQualityInspectionItemInfoServices? _baseQualityInspectionItemInfoServices; + public QualityItemViewModel(QualityInspectionModel info) { + _baseQualityInspectionItemInfoServices = App.ServiceProvider.GetService(); + CloseWindowCommand = new RelayCommand(t => CloseWindow(t)); + SaveCommand = new RelayCommand(updateDirection); + PlanInfo = info; + if("是".Equals(info.IsInSpection)){ + IsSelectedOptionA = true; + } + else + { + IsSelectedOptionB = true; + } + } + + + + private QualityInspectionModel planInfo = new QualityInspectionModel(); + public QualityInspectionModel PlanInfo + { + get { return planInfo; } + set { + planInfo = value; + OnPropertyChanged(nameof(PlanInfo)); + } + } + + #region 单选框 + private bool _isSelectedOptionA; + public bool IsSelectedOptionA + { + get { return _isSelectedOptionA; } + set + { + if (_isSelectedOptionA != value) + { + _isSelectedOptionA = value; + OnPropertyChanged(nameof(IsSelectedOptionA)); + + // 如果选择了A选项,将B选项设为false + if (_isSelectedOptionA) + { + IsSelectedOptionB = false; + } + } + } + } + + private bool _isSelectedOptionB; + public bool IsSelectedOptionB + { + get { return _isSelectedOptionB; } + set + { + if (_isSelectedOptionB != value) + { + _isSelectedOptionB = value; + OnPropertyChanged(nameof(IsSelectedOptionB)); + + // 如果选择了B选项,将A选项设为false + if (_isSelectedOptionB) + { + IsSelectedOptionA = false; + } + } + } + } + #endregion + + //关闭窗口 + private void CloseWindow(object parameter) + { + var window = parameter as Window; + if (window != null) + { + window.Close(); + } + + } + private async void updateDirection() + { + BaseQualityInspectionItemInfo info = await _baseQualityInspectionItemInfoServices.FirstAsync(x=>x.ObjId==PlanInfo.ObjId); + if (IsSelectedOptionA) + { + info.IsInSpection = "1"; + } + else + { + info.IsInSpection = "0"; + } + bool result = await _baseQualityInspectionItemInfoServices.UpdateAsync(info); + if (result) + { + MessageBox.Show(info.QualityDefectName+"质检项修改成功"); + } + } + + + } +} diff --git a/Aucma.Core.ProductOffLine/ViewModels/SelectQualityViewModel.cs b/Aucma.Core.ProductOffLine/ViewModels/SelectQualityViewModel.cs index 969d9088..cb5d3be0 100644 --- a/Aucma.Core.ProductOffLine/ViewModels/SelectQualityViewModel.cs +++ b/Aucma.Core.ProductOffLine/ViewModels/SelectQualityViewModel.cs @@ -29,6 +29,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels { public ICommand QueryCommand { get; set; } + public RelayCommand MouseClickCommand { get; set; } public ICommand SaveCommand { get; set; } private readonly IBaseQualityInspectionItemInfoServices? _baseQualityInspectionItemInfoServices; @@ -37,6 +38,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels _baseQualityInspectionItemInfoServices = App.ServiceProvider.GetService(); QueryCommand = new RelayCommand(ExecuteQuery); + MouseClickCommand = new RelayCommand(MouseClick); SaveCommand = new RelayCommand(ExecuteSave); Init(); @@ -60,6 +62,18 @@ namespace Aucma.Core.ProductOffLine.ViewModels } } + public void MouseClick(object obj) + { + + var info = SelectedDataItem as QualityInspectionModel; + if (info != null) + { + QualityWindow quantityIssuedWindow = new QualityWindow(info); + quantityIssuedWindow.ShowDialog(); + } + + } + private async void ExecuteSave() { List list = new List(); @@ -94,6 +108,19 @@ namespace Aucma.Core.ProductOffLine.ViewModels + private QualityInspectionModel selectedDataItem; + public QualityInspectionModel SelectedDataItem + { + get { return selectedDataItem; } + set + { + selectedDataItem = value; + OnPropertyChanged(); + } + } + + + #region 初始化datagrid private ObservableCollection qualityItemGrid = new ObservableCollection(); public ObservableCollection QualityItemGrid diff --git a/Aucma.Core.ProductOffLine/ViewModels/StatisticsPageViewModel.cs b/Aucma.Core.ProductOffLine/ViewModels/StatisticsPageViewModel.cs index 6af330f1..341df3ad 100644 --- a/Aucma.Core.ProductOffLine/ViewModels/StatisticsPageViewModel.cs +++ b/Aucma.Core.ProductOffLine/ViewModels/StatisticsPageViewModel.cs @@ -22,16 +22,16 @@ namespace Aucma.Core.ProductOffLine.ViewModels #region 加载DataGrid数据 private void LoadData() { - MaterialDataGrid.Add(new MaterialComplateInfo() { No = 1, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 10 }); - MaterialDataGrid.Add(new MaterialComplateInfo() { No = 2, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 60, CompleteAmount = 40 }); - MaterialDataGrid.Add(new MaterialComplateInfo() { No = 3, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 10 }); - MaterialDataGrid.Add(new MaterialComplateInfo() { No = 4, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 40, CompleteAmount = 10 }); - MaterialDataGrid.Add(new MaterialComplateInfo() { No = 5, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 30, CompleteAmount = 10 }); - MaterialDataGrid.Add(new MaterialComplateInfo() { No = 6, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 20 }); - MaterialDataGrid.Add(new MaterialComplateInfo() { No = 7, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 10, CompleteAmount = 10 }); - MaterialDataGrid.Add(new MaterialComplateInfo() { No = 8, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 10 }); - MaterialDataGrid.Add(new MaterialComplateInfo() { No = 9, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 80, CompleteAmount = 10 }); - MaterialDataGrid.Add(new MaterialComplateInfo() { No = 10, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 10}); + //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 1, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 10 }); + //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 2, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 60, CompleteAmount = 40 }); + //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 3, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 10 }); + //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 4, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 40, CompleteAmount = 10 }); + //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 5, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 30, CompleteAmount = 10 }); + //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 6, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 20 }); + //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 7, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 10, CompleteAmount = 10 }); + //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 8, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 10 }); + //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 9, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 80, CompleteAmount = 10 }); + //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 10, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 10}); } #endregion diff --git a/Aucma.Core.ProductOffLine/Views/DirectionEditView.xaml b/Aucma.Core.ProductOffLine/Views/DirectionEditView.xaml index d68f3aac..bc334618 100644 --- a/Aucma.Core.ProductOffLine/Views/DirectionEditView.xaml +++ b/Aucma.Core.ProductOffLine/Views/DirectionEditView.xaml @@ -33,7 +33,7 @@ RowHeight="31" AutoGenerateColumns="False" RowHeaderWidth="0" GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Auto" BorderThickness="0" CanUserAddRows="False" - Foreground="#FFFFFF" SelectedItem="{Binding SelectedDataItem}" MouseLeftButtonDown="dataGrid_MouseLeftButtonDown"> + Foreground="#FFFFFF" SelectedItem="{Binding SelectedDataItem}" SelectionMode="Single" MouseLeftButtonDown="dataGrid_MouseLeftButtonDown"> - + @@ -31,34 +59,34 @@ - + - + - + - - - + + + -