chr
6 天以前 43a0207d207390abdeeb3ab9155eebf03edd7b1a
PdmSwPlugin.PDM/PdmControl.xaml.cs
@@ -1038,14 +1038,8 @@
            ConcurrentDictionary<string, DrawInfo> result = new ConcurrentDictionary<string, DrawInfo>();
            PdmBom topBom = model.BomTree[0];
            CountdownEvent counter = new CountdownEvent(1);
            taskFactory.StartNew(() =>
            {
                GetAllByTask(new object[] {
                topBom, result, counter, ErrMsgs, 0 });
            });
            GetAllByTask(new object[] { topBom, result, counter, ErrMsgs, 0 });
            counter.Wait();
            // 不需要手动释放
            //counter.Dispose();
            return new Dictionary<string, DrawInfo>(result);
        }
@@ -1061,7 +1055,7 @@
            int level = (int)datas[4];
            try
            {
                counter.TryAddCount();
                counter.AddCount();
                string filepath = bom.partNo;
                lock (result)
                {
@@ -1616,32 +1610,39 @@
        /// <exception cref="Exception"></exception>
        private void UploadSingleDraw(DrawAuditOrder daOrder, PdmBom bom, bool justUpload)
        {
            string d3FilePath = bom.d3FilePath;
            string d2FilePath = d3FilePath.Replace(Path.GetExtension(d3FilePath), ".slddrw");
            if (string.IsNullOrEmpty(d3FilePath) || !File.Exists(d3FilePath))
            try
            {
                throw new Exception($"[{bom.partModel}]未找到3D图纸");
                string d3FilePath = bom.d3FilePath;
                string d2FilePath = d3FilePath.Replace(Path.GetExtension(d3FilePath), ".slddrw");
                if (string.IsNullOrEmpty(d3FilePath) || !File.Exists(d3FilePath))
                {
                    throw new Exception($"[{bom.partModel}]未找到3D图纸");
                }
                // !justUpload(需要审核)要判断2D图纸存不存在
                if (!justUpload && (string.IsNullOrEmpty(d2FilePath) || !File.Exists(d2FilePath)))
                {
                    throw new Exception($"[{bom.partModel}]未找到工程图纸");
                }
                MultipartFormDataContent httpContent = new MultipartFormDataContent();
                httpContent.Add(new StringContent(bom.partNo), "materialCode");
                httpContent.Add(new StringContent(bom.partNo), "materialModel");
                httpContent.Add(new StringContent(daOrder.id), "orderId");
                httpContent.Add(new StringContent(justUpload.ToString()), "justUpload");
                FileInfo fileInfo = new FileInfo(d3FilePath);
                httpContent.Add(new ByteArrayContent(FileUtil.toByteArray(d3FilePath)), "d3File", fileInfo.Name);
                //  !justUpload(需要审核)要上传2D图
                if (!justUpload)
                {
                    FileInfo file2Info = new FileInfo(d2FilePath);
                    httpContent.Add(new ByteArrayContent(FileUtil.toByteArray(d2FilePath)), "d2File", file2Info.Name);
                }
                Result<DrawAudit> res = Client.PostSyncAction<DrawAudit>("drawAudit/add", httpContent);
                DrawAudit da = res.HandleResult();
            }
            // !justUpload(需要审核)要判断2D图纸存不存在
            if (!justUpload && (string.IsNullOrEmpty(d2FilePath) || !File.Exists(d2FilePath)))
            catch (NullReferenceException nex)
            {
                throw new Exception($"[{bom.partModel}]未找到工程图纸");
                Logger.Error($"UploadSingleDraw NullReferenceException.", nex);
            }
            MultipartFormDataContent httpContent = new MultipartFormDataContent();
            httpContent.Add(new StringContent(bom.partNo), "materialCode");
            httpContent.Add(new StringContent(bom.partNo), "materialModel");
            httpContent.Add(new StringContent(daOrder.id), "orderId");
            httpContent.Add(new StringContent(justUpload.ToString()), "justUpload");
            FileInfo fileInfo = new FileInfo(d3FilePath);
            httpContent.Add(new ByteArrayContent(FileUtil.toByteArray(d3FilePath)), "d3File", fileInfo.Name);
            //  !justUpload(需要审核)要上传2D图
            if (!justUpload)
            {
                FileInfo file2Info = new FileInfo(d2FilePath);
                httpContent.Add(new ByteArrayContent(FileUtil.toByteArray(d2FilePath)), "d2File", file2Info.Name);
            }
            Result<DrawAudit> res = Client.PostSyncAction<DrawAudit>("drawAudit/add", httpContent);
            DrawAudit da = res.HandleResult();
        }
        private void Exclude_Click(object sender, RoutedEventArgs e)