复制master分支代码
This commit is contained in:
		
							parent
							
								
									b11a8a479c
								
							
						
					
					
						commit
						d4c42203d2
					
				| 
						 | 
				
			
			@ -11,6 +11,7 @@ using Prism.Regions;
 | 
			
		|||
using Prism.Services.Dialogs;
 | 
			
		||||
using SqlSugar;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Collections.ObjectModel;
 | 
			
		||||
using System.Configuration;
 | 
			
		||||
| 
						 | 
				
			
			@ -18,6 +19,7 @@ using System.Linq;
 | 
			
		|||
using System.Text;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows.Documents;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -288,7 +290,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            List<ChannelStock> iChannelStock = new List<ChannelStock>();
 | 
			
		||||
            if (SelectedInvoice != null)
 | 
			
		||||
            {
 | 
			
		||||
                //先查询入库单中有几种药
 | 
			
		||||
                //先查询有几种药
 | 
			
		||||
                string strSql = @"SELECT sum(Quantity) AS SumQuantity, COUNT(ID) AS CountNum,INVOICE_NO AS InvoiceNo,drug_id AS DrugId,QUANTITY AS quantity,drug_manu_no AS drugManuNo FROM IN_OUT_INVOICE WHERE INVOICE_NO=@INVOICE_NO  GROUP BY INVOICE_NO,DRUG_ID";
 | 
			
		||||
 | 
			
		||||
                var invoices = SqlSugarHelper.Db.SqlQueryable<InOutInvoice>(strSql)
 | 
			
		||||
| 
						 | 
				
			
			@ -341,8 +343,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                continue;
 | 
			
		||||
                            }
 | 
			
		||||
                            //没有库存写入一条数据
 | 
			
		||||
                            ChannelStock stock = new ChannelStock();
 | 
			
		||||
                            //没有库存写入一条数据
 | 
			
		||||
                            stock.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
 | 
			
		||||
                            stock.DrawerNo = channelLst.DrawerNo;
 | 
			
		||||
                            stock.BoardType = channelLst.BoardType;
 | 
			
		||||
| 
						 | 
				
			
			@ -355,13 +357,16 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            stockList.Add(stock);
 | 
			
		||||
                        }
 | 
			
		||||
                        //stock.AddQuantity = invoicesManuNo[j].quantity;
 | 
			
		||||
                        stockList.GroupBy(it =>it.ManuNo)
 | 
			
		||||
                        //stockList.ForEach(s => s.AddQuantity = invoicesManuNo[j].quantity);
 | 
			
		||||
                        stockList.GroupBy(x => x.ManuNo)
 | 
			
		||||
                           .Select(it =>
 | 
			
		||||
                           {
 | 
			
		||||
                               var ret = it.First();
 | 
			
		||||
                               ret.AddQuantity = invoicesManuNo[j].quantity;
 | 
			
		||||
                               return ret;
 | 
			
		||||
                                 }).ToList();
 | 
			
		||||
                           })
 | 
			
		||||
                           .ToList();
 | 
			
		||||
 | 
			
		||||
                        if (channelLst.channelStocks == null)
 | 
			
		||||
                        {
 | 
			
		||||
                            channelLst.channelStocks = new List<ChannelStock>();
 | 
			
		||||
| 
						 | 
				
			
			@ -458,15 +463,21 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
 | 
			
		||||
            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
            {
 | 
			
		||||
                //List<ChannelStock> ChannelLst = channelStocks.Where(it => it.BoardType != 1)
 | 
			
		||||
                //                                                        .GroupBy(it => it.ColNo)
 | 
			
		||||
                //                                                        .Select(it =>
 | 
			
		||||
                //                                                        {
 | 
			
		||||
                //                                                            var ret = it.First();
 | 
			
		||||
                //                                                            ret.Quantity = it.Sum(itx => itx.Quantity);
 | 
			
		||||
                //                                                            ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
 | 
			
		||||
                //                                                            return ret;
 | 
			
		||||
                //                                                        }).ToList();
 | 
			
		||||
                List<ChannelStock> ChannelLst = new List<ChannelStock>();
 | 
			
		||||
                for (int i = 0; i < channelStocks.Count; i++)
 | 
			
		||||
                {
 | 
			
		||||
                    ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
 | 
			
		||||
                    singleChannels.Add(copy);
 | 
			
		||||
                }
 | 
			
		||||
                ChannelLst = ChannelLst.Where(it => it.BoardType != 1)
 | 
			
		||||
                                                                        .GroupBy(it => it.ColNo)
 | 
			
		||||
                                                                        .Select(it =>
 | 
			
		||||
                                                                        {
 | 
			
		||||
                                                                            var ret = it.First();
 | 
			
		||||
                                                                            ret.Quantity = it.Sum(itx => itx.Quantity);
 | 
			
		||||
                                                                            ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
 | 
			
		||||
                                                                            return ret;
 | 
			
		||||
                                                                        }).ToList();
 | 
			
		||||
                // 发送加药数量
 | 
			
		||||
                singleChannels.ForEach(it =>
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			@ -599,7 +610,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            {
 | 
			
		||||
                                //根据ChannelLsts中的库位,删除该库位库存为0的记录
 | 
			
		||||
                                SqlSugarHelper.Db.Deleteable<ChannelStock>()
 | 
			
		||||
                                .Where(cs => cs.Quantity <= 0 && cs.DrawerNo == ChannelLsts[i].channelStocks[0].DrawerNo && cs.ColNo == ChannelLsts[i].channelStocks[0].ColNo).ExecuteCommand();
 | 
			
		||||
                                .Where(cs => cs.Quantity <= 0 && cs.DrugId == ChannelLsts[i].DrugId && cs.MachineId == ChannelLsts[i].MachineId).ExecuteCommand();
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        return true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue