/// <summary>
 /// 按钮点击事件-模具移库
 /// </summary>
 /// <param name="sender">事件源</param>
 /// <param name="e">事件参数</param>
 private void OKBtn_Click(object sender, RoutedEventArgs e)
 {
     StorageManageServiceClient client = new StorageManageServiceClient();
     Message msg = client.MoldMoveStore(MoldNrLab.Content.ToString(), Settings.Default.WarehouseNr, CurrentPosiLab.Content.ToString(), DesiPosiNRTB.Text);
      MessageBox.Show(msg.Content);
      if (msg.MsgType == MsgType.OK)
      {
          this.Close();
      }
 }
        /// <summary>
        /// 按钮点击事件-模具移库
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void OKBtn_Click(object sender, RoutedEventArgs e)
        {
            StorageManageServiceClient client = new StorageManageServiceClient();
            Message msg = client.MoldMoveStore(MoldNrLab.Content.ToString(), Settings.Default.WarehouseNr, CurrentPosiLab.Content.ToString(), DesiPosiNRTB.Text);

            MessageBox.Show(msg.Content);
            if (msg.MsgType == MsgType.OK)
            {
                this.Close();
            }
        }
 /// <summary>
 /// part out stock
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OKBtn_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(PartNRTB.Text) || string.IsNullOrWhiteSpace(QuantityTB.Text) ||
         string.IsNullOrWhiteSpace(WarehouseNRTB.Text) || string.IsNullOrWhiteSpace(PositionNRTB.Text) || string.IsNullOrWhiteSpace(FIFODP.Text))
     {
         MessageBox.Show("请将数据填写完整");
     }
     else
     {
         StorageManageServiceClient client = new StorageManageServiceClient();
         ToolingManWPF.StorageManageServiceReference.Message msg = client.PartOutStore(PartNRTB.Text, "", int.Parse(QuantityTB.Text), DateTime.Parse(FIFODP.Text), WarehouseNRTB.Text, PositionNRTB.Text);
         MessageBox.Show(msg.Content);
     }
 }
 /// <summary>
 /// part out stock
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OKBtn_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(PartNRTB.Text) || string.IsNullOrWhiteSpace(QuantityTB.Text)
         || string.IsNullOrWhiteSpace(WarehouseNRTB.Text) || string.IsNullOrWhiteSpace(PositionNRTB.Text) || string.IsNullOrWhiteSpace(FIFODP.Text))
     {
         MessageBox.Show("请将数据填写完整");
     }
     else
     {
         StorageManageServiceClient client = new StorageManageServiceClient();
         ToolingManWPF.StorageManageServiceReference.Message msg = client.PartOutStore(PartNRTB.Text, "", int.Parse(QuantityTB.Text), DateTime.Parse(FIFODP.Text), WarehouseNRTB.Text, PositionNRTB.Text);
         MessageBox.Show(msg.Content);
     }
 }
예제 #5
0
 private void OKBtn_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(PartNRTB.Text) || string.IsNullOrWhiteSpace(QuantityTB.Text) ||
         string.IsNullOrWhiteSpace(WarehouseNRTB.Text) || string.IsNullOrWhiteSpace(PositionNRTB.Text))
     {
         MessageBox.Show("请将数据填写完整");
     }
     else
     {
         StorageManageServiceClient client = new StorageManageServiceClient();
         Message msg = client.PartInStore(PartNRTB.Text, "", int.Parse(QuantityTB.Text),
                                          string.IsNullOrEmpty(FIFODP.Text) ? DateTime.Parse(DateTime.Now.ToShortDateString()) : DateTime.Parse(FIFODP.Text), WarehouseNRTB.Text, PositionNRTB.Text);
         MessageBox.Show(msg.Content);
     }
 }
 private void OKBtn_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(PartNRTB.Text) || string.IsNullOrWhiteSpace(QuantityTB.Text)
         || string.IsNullOrWhiteSpace(WarehouseNRTB.Text) || string.IsNullOrWhiteSpace(PositionNRTB.Text))
     {
         MessageBox.Show("请将数据填写完整");
     }
     else
     {
         StorageManageServiceClient client = new StorageManageServiceClient();
         Message msg= client.PartInStore(PartNRTB.Text, "", int.Parse(QuantityTB.Text),
             string.IsNullOrEmpty(FIFODP.Text) ? DateTime.Parse(DateTime.Now.ToShortDateString()) : DateTime.Parse(FIFODP.Text), WarehouseNRTB.Text, PositionNRTB.Text);
         MessageBox.Show(msg.Content);
     }
 }
예제 #7
0
        /// <summary>
        /// 按钮点击事件-申领模具
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void MoldApplyBtn_Click(object sender, RoutedEventArgs e)
        {
            if ((ToolingManWPF.ConditionServiceReference.MoldStateType)moldBaseInfo.State != ToolingManWPF.ConditionServiceReference.MoldStateType.Normal &&
                (MoldUseType)int.Parse(MoldUseWayCB.SelectedValue.ToString()) == MoldUseType.Produce)
            {
                MessageBox.Show("模具目前状态不可用作正产!");
                return;
            }
            if (!string.IsNullOrWhiteSpace(EnsureMoldNRTB.Text) && !string.IsNullOrWhiteSpace(ApplicantNRTB.Text) && !string.IsNullOrWhiteSpace(WorkstationNRTB.Text))
            {
                if (MoldNRTB.Text.Equals(EnsureMoldNRTB.Text))
                {
                    ConditionServiceClient conditionclient = new ConditionServiceClient();
                    BasicMessage           bmsg            = new BasicMessage();
                    if (!conditionclient.EmpExist(ApplicantNRTB.Text))
                    {
                        bmsg.Result = false;
                        bmsg.MsgContent.Add("申领员工");
                    }
                    if (!conditionclient.WorkstationExist(WorkstationNRTB.Text))
                    {
                        bmsg.Result = false;
                        bmsg.MsgContent.Add("工作台");
                    }
                    if (bmsg.Result == false)
                    {
                        MessageBox.Show(bmsg.MsgText + " 不存在,请重新输入");
                        return;
                    }

                    StorageManageServiceClient client = new StorageManageServiceClient();
                    Message          msg    = client.ApplyMold((MoldUseType)int.Parse(MoldUseWayCB.SelectedValue.ToString()), MoldNRTB.Text, ApplicantNRTB.Text, "", WorkstationNRTB.Text);
                    MessageBoxResult result = MessageBox.Show(msg.Content);
                    if (result == MessageBoxResult.OK)
                    {
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("确认模具号 与 模具号不一致");
                }
            }
            else
            {
                MessageBox.Show("请完整填写 申领员工号,压接机号,确认模具号");
            }
        }
 /// <summary>
 /// 按钮点击事件-模具添库
 /// </summary>
 /// <param name="sender">事件源</param>
 /// <param name="e">事件参数</param>
 private void OKBtn_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(MoldNRTB.Text) || string.IsNullOrWhiteSpace(WarehouseNRTB.Text) || string.IsNullOrWhiteSpace(PositionNRTB.Text))
     {
         MessageBox.Show("请将数据填写完整");
     }
     else
     {
         ConditionServiceClient conditionclient = new ConditionServiceClient();
         if (!conditionclient.MoldExist(MoldNRTB.Text))
         {
             MessageBox.Show("此磨具不存在");
             return;
         }
         StorageManageServiceClient client = new StorageManageServiceClient();
         Message msg = client.MoldInStore(MoldNRTB.Text, OperatorTB.Text, WarehouseNRTB.Text, PositionNRTB.Text);
         MessageBox.Show(msg.Content);
     }
 }
 /// <summary>
 /// 按钮点击事件-模具添库
 /// </summary>
 /// <param name="sender">事件源</param>
 /// <param name="e">事件参数</param>
 private void OKBtn_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(MoldNRTB.Text) || string.IsNullOrWhiteSpace(WarehouseNRTB.Text) || string.IsNullOrWhiteSpace(PositionNRTB.Text))
     {
         MessageBox.Show("请将数据填写完整");
     }
     else
     {
         ConditionServiceClient conditionclient = new ConditionServiceClient();
         if (!conditionclient.MoldExist(MoldNRTB.Text))
         {
             MessageBox.Show("此磨具不存在");
             return;
         }
         StorageManageServiceClient client = new StorageManageServiceClient();
         Message msg = client.MoldInStore(MoldNRTB.Text, OperatorTB.Text, WarehouseNRTB.Text, PositionNRTB.Text);
         MessageBox.Show(msg.Content);
     }
 }
예제 #10
0
        /// <summary>
        /// 按钮点击事件-模具入库
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void MoldInStoreBtn_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(MoldNRTB.Text) || string.IsNullOrWhiteSpace(ApplicantNRTB.Text))
            {
                MessageBox.Show("请将 模具号,退料员工号 填写完整");
            }
            else
            {
                BasicMessage           bmsg            = new BasicMessage();
                ConditionServiceClient conditionclient = new ConditionServiceClient();
                if (!conditionclient.MoldExist(MoldNRTB.Text))
                {
                    bmsg.Result = false;
                    bmsg.MsgContent.Add("模具");
                }
                if (ApplicantNRTB.Text.Length != 0 && !conditionclient.EmpExist(ApplicantNRTB.Text))
                {
                    bmsg.Result = false;
                    bmsg.MsgContent.Add("退料员工");
                }
                if (bmsg.Result == false)
                {
                    MessageBox.Show(bmsg.MsgText + " 不存在,请重新输入");
                    return;
                }

                StorageManageServiceClient client = new StorageManageServiceClient();
                // Message msg = client.MoldInStore(MoldNRTB.Text, OperatorTB.Text, WarehouseNRTB.Text, PositionNRTB.Text);
                Message          msg    = client.ReturnMoldInPosition(MoldNRTB.Text, ApplicantNRTB.Text, RemarkTB.Text);
                MessageBoxResult result = MessageBox.Show(msg.Content);
                if (result == MessageBoxResult.OK)
                {
                    this.Close();
                }

                if (msg.MsgType == MsgType.OK)
                {
                    MoldInStoreBtn.IsEnabled = false;
                }
            }
        }
예제 #11
0
        /// <summary>
        /// 按钮点击事件-模具归还
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void ReturnMoldBtn_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(MoldNRTB.Text) && !string.IsNullOrWhiteSpace(ApplicantNRTB.Text))
            {
                ConditionServiceClient conditionclient = new ConditionServiceClient();
                BasicMessage           bmsg            = new BasicMessage();

                if (!conditionclient.MoldExist(MoldNRTB.Text))
                {
                    bmsg.Result = false;
                    bmsg.MsgContent.Add("模具");
                }
                if (ApplicantNRTB.Text.Length != 0 && !conditionclient.EmpExist(ApplicantNRTB.Text))
                {
                    bmsg.Result = false;
                    bmsg.MsgContent.Add("退料员工");
                }
                if (bmsg.Result == false)
                {
                    MessageBox.Show(bmsg.MsgText + " 不存在,请重新输入");
                    return;
                }


                StorageManageServiceClient client = new StorageManageServiceClient();
                Message msg = client.ReturnMold(MoldNRTB.Text, ApplicantNRTB.Text, "", RemarkTB.Text, (MoldReturnStateType)int.Parse(MoldSateCB.SelectedValue.ToString()));
                MessageBox.Show(msg.Content);
                if (msg.MsgType == MsgType.OK)
                {
                    MoldPosiSP.Visibility = Visibility.Visible;
                    MoldPartInfoServiceClient moldpartClient = new MoldPartInfoServiceClient();
                    MoldPosiNRTB.Text        = moldpartClient.GetMoldPositionByNr(MoldNRTB.Text).PositionNR;
                    MoldInStoreBtn.IsEnabled = true;
                }
            }
            else
            {
                MessageBox.Show("请将 模具号,退料员工号 填写完整");
            }
        }
예제 #12
0
        /// <summary>
        /// 按钮点击事件-申领模具
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void MoldApplyBtn_Click(object sender, RoutedEventArgs e)
        {
            if ((ToolingManWPF.ConditionServiceReference.MoldStateType)moldBaseInfo.State != ToolingManWPF.ConditionServiceReference.MoldStateType.Normal
                && (MoldUseType)int.Parse(MoldUseWayCB.SelectedValue.ToString()) == MoldUseType.Produce)
            {
                MessageBox.Show("模具目前状态不可用作正产!");
                return;
            }
            if (!string.IsNullOrWhiteSpace(EnsureMoldNRTB.Text) && !string.IsNullOrWhiteSpace(ApplicantNRTB.Text) && !string.IsNullOrWhiteSpace(WorkstationNRTB.Text))
            {
                if (MoldNRTB.Text.Equals(EnsureMoldNRTB.Text))
                {
                    ConditionServiceClient conditionclient = new ConditionServiceClient();
                    BasicMessage bmsg = new BasicMessage();
                    if (!conditionclient.EmpExist(ApplicantNRTB.Text))
                    {
                        bmsg.Result = false;
                        bmsg.MsgContent.Add("申领员工");
                    }
                    if (!conditionclient.WorkstationExist(WorkstationNRTB.Text))
                    {
                        bmsg.Result = false;
                        bmsg.MsgContent.Add("工作台");
                    }
                    if (bmsg.Result == false)
                    {
                        MessageBox.Show(bmsg.MsgText + " 不存在,请重新输入");
                        return;
                    }

                    StorageManageServiceClient client = new StorageManageServiceClient();
                    Message msg = client.ApplyMold((MoldUseType)int.Parse(MoldUseWayCB.SelectedValue.ToString()), MoldNRTB.Text, ApplicantNRTB.Text, "", WorkstationNRTB.Text);
                    MessageBoxResult result = MessageBox.Show(msg.Content);
                    if (result == MessageBoxResult.OK)
                    {
                        this.Close();
                    }

                }
                else
                {
                    MessageBox.Show("确认模具号 与 模具号不一致");
                }
            }
            else
            {
                MessageBox.Show("请完整填写 申领员工号,压接机号,确认模具号");
            }
        }
예제 #13
0
        /// <summary>
        /// 按钮点击事件-上传文件
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void OKBtn_Click(object sender, RoutedEventArgs e)
        {
            List <FileUP> files           = null;
            long          fileTotalLength = 0;

            if (FileNameList.Items.Count > 0)
            {
                files = new List <FileUP>();
                UserListBoxItem userListBoxItem;

                imageFilter    = FileFilterUtil.GetImageFilters();
                documentFilter = FileFilterUtil.GetDocumentFilters();


                foreach (object item in FileNameList.Items)
                {
                    userListBoxItem = item as UserListBoxItem;
                    string path = userListBoxItem.Value;

                    if (File.Exists(path))
                    {
                        string fileType = path.Substring(path.LastIndexOf('.'), path.Length - path.LastIndexOf('.'));
                        string fileName = userListBoxItem.Display;

                        Stream stream = File.Open(path, FileMode.Open, FileAccess.Read);
                        byte[] data   = new byte[stream.Length];
                        stream.Read(data, 0, data.Length);
                        stream.Seek(0, SeekOrigin.Begin);

                        fileTotalLength += stream.Length;
                        ToolingManWPF.StorageManageServiceReference.AttachmentType attachType = ToolingManWPF.StorageManageServiceReference.AttachmentType.PICTURE;

                        if (imageFilter.Contains(fileType))
                        {
                            attachType = ToolingManWPF.StorageManageServiceReference.AttachmentType.PICTURE;
                        }
                        else if (documentFilter.Contains(fileType))
                        {
                            attachType = ToolingManWPF.StorageManageServiceReference.AttachmentType.DOCUMENT;
                        }
                        files.Add(new ToolingManWPF.StorageManageServiceReference.FileUP()
                        {
                            Name = fileName, FileType = fileType, Type = attachType, Data = data
                        });
                    }
                }
            }

            if (fileTotalLength < long.Parse((new ConfigUtil("MAXFILELENGTH")).Get("MAXLENGTH")))
            {
                StorageManageServiceClient client = new StorageManageServiceClient();
                Message msg = new Message();
                msg = client.FileUpLoad(files, moldNR);

                MessageBox.Show(msg.Content);
            }
            else
            {
                MessageBox.Show("一次上传文件大小不可大于50M", "", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
예제 #14
0
        /// <summary>
        /// 按钮点击事件-模具入库
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void OKBtn_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(MoldNRTB.Text) || string.IsNullOrWhiteSpace(OperatorTB.Text) )
            {
                MessageBox.Show("请将 模具号,操作员号 填写完整");
            }
            else
            {
                ConditionServiceClient conditionclient = new ConditionServiceClient();
                BasicMessage bmsg = new BasicMessage();

                if (!conditionclient.MoldExist(MoldNRTB.Text))
                {
                    bmsg.Result = false;
                    bmsg.MsgContent.Add("模具");
                }
                if (OperatorTB.Text.Length != 0 && !conditionclient.EmpExist(OperatorTB.Text))
                {
                    bmsg.Result = false;
                    bmsg.MsgContent.Add("操作员");
                }
                if (bmsg.Result == false)
                {
                    MessageBox.Show(bmsg.MsgText + " 不存在,请重新输入");
                    return;
                }
                StorageManageServiceClient client = new StorageManageServiceClient();
               // Message msg = client.MoldInStore(MoldNRTB.Text, OperatorTB.Text, WarehouseNRTB.Text, PositionNRTB.Text);
                Message msg = client.ReturnMoldInPosition(MoldNRTB.Text, OperatorTB.Text, RemarkTB.Text);
                MessageBoxResult result = MessageBox.Show(msg.Content);
                if (result == MessageBoxResult.OK)
                {
                    this.Close();
                }

            }
        }
예제 #15
0
        /// <summary>
        /// 按钮点击事件-上传报告
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void UpReportBtn_Click(object sender, RoutedEventArgs e)
        {
            if (MoldNRTB.Text.Length > 0 && OperatorNRTB.Text.Length > 0)
            {
                StorageManageServiceClient client = new StorageManageServiceClient();
                ConditionServiceClient conditionclient = new ConditionServiceClient();
                BasicMessage bmsg = new BasicMessage();
                if (!conditionclient.MoldExist(MoldNRTB.Text))
                {
                    bmsg.Result = false;
                    bmsg.MsgContent.Add("模具");
                }
                if (OperatorNRTB.Text.Length != 0 && !conditionclient.EmpExist(OperatorNRTB.Text))
                {
                    bmsg.Result = false;
                    bmsg.MsgContent.Add("试验员");
                }
                if (bmsg.Result == false)
                {
                    MessageBox.Show(bmsg.MsgText + " 不存在,请重新输入");
                    return;
                }
                // MoldPartInfoServiceClient bclient = new MoldPartInfoServiceClient();
                //MoldBaseInfo moldBaseInfo = bclient.GetMoldBaseInfoByNR(MoldNRTB.Text);
                //if (moldBaseInfo.State == ToolingManWPF.MoldPartInfoServiceReference.MoldStateType.NotReturned)
                //{
                //    MessageBox.Show("模具还未归还!");
                //    return;
                //}

                List<FileUP> files = null;
                long fileTotalLength = 0;
                if (FileNameList.Items.Count > 0)
                {
                    files = new List<FileUP>();
                    UserListBoxItem userListBoxItem;

                    imageFilter = FileFilterUtil.GetImageFilters();
                    documentFilter = FileFilterUtil.GetDocumentFilters();

                    foreach (object item in FileNameList.Items)
                    {
                        userListBoxItem = item as UserListBoxItem;
                        string path = userListBoxItem.Value;

                        if (File.Exists(path))
                        {
                            string fileType = path.Substring(path.LastIndexOf('.'), path.Length - path.LastIndexOf('.'));
                            string fileName = userListBoxItem.Display;

                            Stream stream = File.Open(path, FileMode.Open, FileAccess.Read);
                            byte[] data = new byte[stream.Length];
                            stream.Read(data, 0, data.Length);
                            stream.Seek(0, SeekOrigin.Begin);

                            fileTotalLength += stream.Length;

                            ToolingManWPF.StorageManageServiceReference.AttachmentType attachType = ToolingManWPF.StorageManageServiceReference.AttachmentType.PICTURE;

                            if (imageFilter.Contains(fileType))
                            {
                                attachType = ToolingManWPF.StorageManageServiceReference.AttachmentType.PICTURE;
                            }
                            else if (documentFilter.Contains(fileType))
                            {
                                attachType = ToolingManWPF.StorageManageServiceReference.AttachmentType.DOCUMENT;
                            }
                            files.Add(new FileUP() { Name = fileName, FileType = fileType, Type = attachType, Data = data });
                        }
                    }

                }

                if (fileTotalLength < long.Parse((new ConfigUtil("MAXFILELENGTH")).Get("MAXLENGTH")))
                {
                    Message msg = new Message();
                    switch ((ToolingManWPF.MoldPartInfoServiceReference.ReportType)int.Parse(MaintainTypeCB.SelectedValue.ToString()))
                    {
                        case ToolingManWPF.MoldPartInfoServiceReference.ReportType.MaintainReport:
                           // msg = client.MoldMaintain(MoldNRTB.Text, OperatorNRTB.Text, files, (bool)MoldStateCheckBox.IsChecked);
                            msg = client.MoldMaintain(MoldNRTB.Text, OperatorNRTB.Text, files, false);
                            break;
                        case ToolingManWPF.MoldPartInfoServiceReference.ReportType.TestReport:
                            int c = 0;
                            //int.TryParse(CurrentCutTimeTB.Text,out c);
                            msg = client.MoldTest(MoldNRTB.Text, OperatorNRTB.Text, files, c, false);
                            //msg = client.MoldTest(MoldNRTB.Text, OperatorNRTB.Text, files, c, (bool)MoldStateCheckBox.IsChecked);
                            break;
                    }

                    MessageBox.Show(msg.Content);
                }
                else
                    MessageBox.Show("一次上传文件大小不可大于50M", "", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
예제 #16
0
        /// <summary>
        /// 按钮点击事件-上传报告
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void UpReportBtn_Click(object sender, RoutedEventArgs e)
        {
            if (MoldNRTB.Text.Length > 0 && OperatorNRTB.Text.Length > 0)
            {
                StorageManageServiceClient client          = new StorageManageServiceClient();
                ConditionServiceClient     conditionclient = new ConditionServiceClient();
                BasicMessage bmsg = new BasicMessage();
                if (!conditionclient.MoldExist(MoldNRTB.Text))
                {
                    bmsg.Result = false;
                    bmsg.MsgContent.Add("模具");
                }
                if (OperatorNRTB.Text.Length != 0 && !conditionclient.EmpExist(OperatorNRTB.Text))
                {
                    bmsg.Result = false;
                    bmsg.MsgContent.Add("试验员");
                }
                if (bmsg.Result == false)
                {
                    MessageBox.Show(bmsg.MsgText + " 不存在,请重新输入");
                    return;
                }
                // MoldPartInfoServiceClient bclient = new MoldPartInfoServiceClient();
                //MoldBaseInfo moldBaseInfo = bclient.GetMoldBaseInfoByNR(MoldNRTB.Text);
                //if (moldBaseInfo.State == ToolingManWPF.MoldPartInfoServiceReference.MoldStateType.NotReturned)
                //{
                //    MessageBox.Show("模具还未归还!");
                //    return;
                //}

                List <FileUP> files           = null;
                long          fileTotalLength = 0;
                if (FileNameList.Items.Count > 0)
                {
                    files = new List <FileUP>();
                    UserListBoxItem userListBoxItem;

                    imageFilter    = FileFilterUtil.GetImageFilters();
                    documentFilter = FileFilterUtil.GetDocumentFilters();


                    foreach (object item in FileNameList.Items)
                    {
                        userListBoxItem = item as UserListBoxItem;
                        string path = userListBoxItem.Value;

                        if (File.Exists(path))
                        {
                            string fileType = path.Substring(path.LastIndexOf('.'), path.Length - path.LastIndexOf('.'));
                            string fileName = userListBoxItem.Display;

                            Stream stream = File.Open(path, FileMode.Open, FileAccess.Read);
                            byte[] data   = new byte[stream.Length];
                            stream.Read(data, 0, data.Length);
                            stream.Seek(0, SeekOrigin.Begin);

                            fileTotalLength += stream.Length;

                            ToolingManWPF.StorageManageServiceReference.AttachmentType attachType = ToolingManWPF.StorageManageServiceReference.AttachmentType.PICTURE;

                            if (imageFilter.Contains(fileType))
                            {
                                attachType = ToolingManWPF.StorageManageServiceReference.AttachmentType.PICTURE;
                            }
                            else if (documentFilter.Contains(fileType))
                            {
                                attachType = ToolingManWPF.StorageManageServiceReference.AttachmentType.DOCUMENT;
                            }
                            files.Add(new FileUP()
                            {
                                Name = fileName, FileType = fileType, Type = attachType, Data = data
                            });
                        }
                    }
                }

                if (fileTotalLength < long.Parse((new ConfigUtil("MAXFILELENGTH")).Get("MAXLENGTH")))
                {
                    Message msg = new Message();
                    switch ((ToolingManWPF.MoldPartInfoServiceReference.ReportType) int.Parse(MaintainTypeCB.SelectedValue.ToString()))
                    {
                    case ToolingManWPF.MoldPartInfoServiceReference.ReportType.MaintainReport:
                        // msg = client.MoldMaintain(MoldNRTB.Text, OperatorNRTB.Text, files, (bool)MoldStateCheckBox.IsChecked);
                        msg = client.MoldMaintain(MoldNRTB.Text, OperatorNRTB.Text, files, false);
                        break;

                    case ToolingManWPF.MoldPartInfoServiceReference.ReportType.TestReport:
                        int c = 0;
                        //int.TryParse(CurrentCutTimeTB.Text,out c);
                        msg = client.MoldTest(MoldNRTB.Text, OperatorNRTB.Text, files, c, false);
                        //msg = client.MoldTest(MoldNRTB.Text, OperatorNRTB.Text, files, c, (bool)MoldStateCheckBox.IsChecked);
                        break;
                    }

                    MessageBox.Show(msg.Content);
                }
                else
                {
                    MessageBox.Show("一次上传文件大小不可大于50M", "", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
        }
예제 #17
0
        /// <summary>
        /// 按钮点击事件-上传文件
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void OKBtn_Click(object sender, RoutedEventArgs e)
        {
            List< FileUP> files = null;
            long fileTotalLength = 0;
            if (FileNameList.Items.Count > 0)
            {
                files = new List<FileUP>();
                UserListBoxItem userListBoxItem;

                imageFilter = FileFilterUtil.GetImageFilters();
                documentFilter = FileFilterUtil.GetDocumentFilters();

                foreach (object item in FileNameList.Items)
                {
                    userListBoxItem = item as UserListBoxItem;
                    string path = userListBoxItem.Value;

                    if (File.Exists(path))
                    {
                        string fileType = path.Substring(path.LastIndexOf('.'), path.Length - path.LastIndexOf('.'));
                        string fileName = userListBoxItem.Display;

                        Stream stream = File.Open(path, FileMode.Open, FileAccess.Read);
                        byte[] data = new byte[stream.Length];
                        stream.Read(data, 0, data.Length);
                        stream.Seek(0, SeekOrigin.Begin);

                        fileTotalLength += stream.Length;
                         ToolingManWPF.StorageManageServiceReference.AttachmentType attachType =  ToolingManWPF.StorageManageServiceReference.AttachmentType.PICTURE;

                        if (imageFilter.Contains(fileType))
                        {
                            attachType =  ToolingManWPF.StorageManageServiceReference.AttachmentType.PICTURE;
                        }
                        else if (documentFilter.Contains(fileType))
                        {
                            attachType =  ToolingManWPF.StorageManageServiceReference.AttachmentType.DOCUMENT;
                        }
                        files.Add(new ToolingManWPF.StorageManageServiceReference.FileUP() { Name = fileName, FileType = fileType, Type = attachType, Data = data });
                    }
                }

            }

            if (fileTotalLength < long.Parse((new ConfigUtil("MAXFILELENGTH")).Get("MAXLENGTH")))
            {
                StorageManageServiceClient client = new StorageManageServiceClient();
                Message msg = new Message();
               msg= client.FileUpLoad(files,moldNR);

                MessageBox.Show(msg.Content);
            }
            else
                MessageBox.Show("一次上传文件大小不可大于50M", "", MessageBoxButton.OK, MessageBoxImage.Information);
        }
예제 #18
0
        /// <summary>
        /// 按钮点击事件-模具归还
        /// </summary>
        /// <param name="sender">事件源</param>
        /// <param name="e">事件参数</param>
        private void ReturnMoldBtn_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(MoldNRTB.Text) && !string.IsNullOrWhiteSpace(ApplicantNRTB.Text))
            {
                ConditionServiceClient conditionclient = new ConditionServiceClient();
                BasicMessage bmsg = new BasicMessage();

                if (!conditionclient.MoldExist(MoldNRTB.Text))
                {
                    bmsg.Result = false;
                    bmsg.MsgContent.Add("模具");
                }
                if (ApplicantNRTB.Text.Length != 0 && !conditionclient.EmpExist(ApplicantNRTB.Text))
                {
                    bmsg.Result = false;
                    bmsg.MsgContent.Add("退料员工");
                }
                if (bmsg.Result == false)
                {
                    MessageBox.Show(bmsg.MsgText + " 不存在,请重新输入");
                    return;
                }

                StorageManageServiceClient client = new StorageManageServiceClient();
                Message msg = client.ReturnMold(MoldNRTB.Text, ApplicantNRTB.Text, "", RemarkTB.Text, (MoldReturnStateType)int.Parse(MoldSateCB.SelectedValue.ToString()));
                MessageBox.Show(msg.Content);
                if (msg.MsgType == MsgType.OK)
                {
                    MoldPosiSP.Visibility = Visibility.Visible;
                    MoldPartInfoServiceClient moldpartClient = new MoldPartInfoServiceClient();
                    MoldPosiNRTB.Text = moldpartClient.GetMoldPositionByNr(MoldNRTB.Text).PositionNR;
                    MoldInStoreBtn.IsEnabled = true;
                }
            }
            else
            {
                MessageBox.Show("请将 模具号,退料员工号 填写完整");
            }
        }