写标签添加写批次效期
This commit is contained in:
		
							parent
							
								
									0c085b4bab
								
							
						
					
					
						commit
						d40b7b836a
					
				| 
						 | 
				
			
			@ -1029,6 +1029,7 @@ namespace DM_Weight.Port
 | 
			
		|||
 | 
			
		||||
        #region 2.4寸汉显屏
 | 
			
		||||
        // 基础数据写入方法
 | 
			
		||||
        //三色灯标签写标签type:1药品名称;2规格;5批次;6效期;8厂家
 | 
			
		||||
        public void WriteChannelInfo(int type, string content, int drawerNo, int colNo)
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -550,7 +550,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    {
 | 
			
		||||
                        // 更新屏显库存
 | 
			
		||||
                        //List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
 | 
			
		||||
                        List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType == 5)
 | 
			
		||||
                        List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType == 5&&it.CheckQuantity>0).OrderBy(it=>it.EffDate)
 | 
			
		||||
                        .GroupBy(it => new
 | 
			
		||||
                        {
 | 
			
		||||
                            it.DrawerNo,
 | 
			
		||||
| 
						 | 
				
			
			@ -566,9 +566,16 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        {
 | 
			
		||||
                            singleChannels.ForEach(it =>
 | 
			
		||||
                            {
 | 
			
		||||
                                //将库位多批次的总库存数更新标签
 | 
			
		||||
                                _portUtil.WriteChannelInfo(6, it.EffDate == null ? "" : it.EffDate, it.DrawerNo, it.ColNo);
 | 
			
		||||
                                Thread.Sleep(200);
 | 
			
		||||
                                _portUtil.WriteChannelInfo(5, it.ManuNo, it.DrawerNo, it.ColNo);
 | 
			
		||||
                                Thread.Sleep(200);
 | 
			
		||||
                                // 将库位多批次的总库存数更新标签
 | 
			
		||||
                                _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
 | 
			
		||||
                                Thread.Sleep(200);
 | 
			
		||||
                                _portUtil.ShowContent(it.DrawerNo, it.ColNo);
 | 
			
		||||
                                Thread.Sleep(200);
 | 
			
		||||
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -479,14 +479,38 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
 | 
			
		||||
                                //});
 | 
			
		||||
                                // 更新屏显库存
 | 
			
		||||
                                List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
 | 
			
		||||
                                if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
                                List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType == 5);
 | 
			
		||||
                                if (singleChannels!=null&&singleChannels.Count > 0)
 | 
			
		||||
                                {
 | 
			
		||||
                                    singleChannels.ForEach(it =>
 | 
			
		||||
                                    for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
 | 
			
		||||
                                        Thread.Sleep(200);
 | 
			
		||||
                                    });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                                        List<ChannelStock> csList = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                                                                                 .Where(cs => cs.MachineId == singleChannels[i].MachineId)
 | 
			
		||||
                                                                                 .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
 | 
			
		||||
                                                                                 .Where(cs => cs.ColNo == singleChannels[i].ColNo && cs.Quantity > 0).OrderBy(cs => cs.EffDate).ToList();
 | 
			
		||||
 | 
			
		||||
                                        if (csList != null && csList.Count > 0)
 | 
			
		||||
                                        {
 | 
			
		||||
                                            int totalQuantity = csList.Sum(c => c.Quantity);
 | 
			
		||||
 | 
			
		||||
                                            _portUtil.WriteChannelInfo(5, csList[0].EffDate == null ? "" : csList[0].EffDate, csList[0].DrawerNo, csList[0].ColNo);
 | 
			
		||||
                                            Thread.Sleep(200);
 | 
			
		||||
                                            _portUtil.WriteChannelInfo(6, csList[0].ManuNo == null ? "" : csList[0].ManuNo, csList[0].DrawerNo, csList[0].ColNo);
 | 
			
		||||
                                            Thread.Sleep(200);
 | 
			
		||||
                                            _portUtil.ShowContent(csList[0].DrawerNo, csList[0].ColNo);
 | 
			
		||||
                                            Thread.Sleep(200);
 | 
			
		||||
                                            //将库位多批次的总库存数更新标签
 | 
			
		||||
                                            _portUtil.WriteQuantity(csList[i].DrawerNo, csList[i].ColNo, totalQuantity);
 | 
			
		||||
                                            Thread.Sleep(200);
 | 
			
		||||
                                        }
 | 
			
		||||
                                    }
 | 
			
		||||
                                    //singleChannels.ForEach(it =>
 | 
			
		||||
                                    //{
 | 
			
		||||
                                    //    _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
 | 
			
		||||
                                    //    Thread.Sleep(200);
 | 
			
		||||
                                    //});
 | 
			
		||||
                                }
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -433,14 +433,32 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            {
 | 
			
		||||
                                if (singleChannels[i].BoardType == 5)
 | 
			
		||||
                                {
 | 
			
		||||
                                    int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                                                                        .Where(cs => cs.MachineId == singleChannels[i].MachineId)
 | 
			
		||||
                                                                        .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
 | 
			
		||||
                                                                        .Where(cs => cs.ColNo == singleChannels[i].ColNo)
 | 
			
		||||
                                                                        .Sum(it => it.Quantity);
 | 
			
		||||
                                    //将库位多批次的总库存数更新标签
 | 
			
		||||
                                    _portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
 | 
			
		||||
                                    Thread.Sleep(200);
 | 
			
		||||
                                    List<ChannelStock> csList = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                                                                             .Where(cs => cs.MachineId == singleChannels[i].MachineId)
 | 
			
		||||
                                                                             .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
 | 
			
		||||
                                                                             .Where(cs => cs.ColNo == singleChannels[i].ColNo && cs.Quantity > 0).OrderBy(cs => cs.EffDate).ToList();
 | 
			
		||||
 | 
			
		||||
                                    if (csList != null && csList.Count > 0)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        int totalQuantity = csList.Sum(c => c.Quantity);
 | 
			
		||||
                                        _portUtil.WriteChannelInfo(5, csList[0].EffDate == null ? "" : csList[0].EffDate, csList[0].DrawerNo, csList[0].ColNo);
 | 
			
		||||
                                        Thread.Sleep(200);
 | 
			
		||||
                                        _portUtil.WriteChannelInfo(6, csList[0].ManuNo == null ? "" : csList[0].ManuNo, csList[0].DrawerNo, csList[0].ColNo);
 | 
			
		||||
                                        Thread.Sleep(200);
 | 
			
		||||
                                        _portUtil.ShowContent(csList[0].DrawerNo, csList[0].ColNo);
 | 
			
		||||
                                        Thread.Sleep(200);
 | 
			
		||||
                                        //将库位多批次的总库存数更新标签
 | 
			
		||||
                                        _portUtil.WriteQuantity(csList[i].DrawerNo, csList[i].ColNo, totalQuantity);
 | 
			
		||||
                                        Thread.Sleep(200);
 | 
			
		||||
                                    }
 | 
			
		||||
                                    //int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                                    //                                    .Where(cs => cs.MachineId == singleChannels[i].MachineId)
 | 
			
		||||
                                    //                                    .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
 | 
			
		||||
                                    //                                    .Where(cs => cs.ColNo == singleChannels[i].ColNo)
 | 
			
		||||
                                    //                                    .Sum(it => it.Quantity);
 | 
			
		||||
                                    ////将库位多批次的总库存数更新标签
 | 
			
		||||
                                    //_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
 | 
			
		||||
                                    //Thread.Sleep(200);
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -454,14 +454,32 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                {
 | 
			
		||||
                                    if (singleChannels[i].BoardType == 5)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                                                                            .Where(cs => cs.MachineId == singleChannels[i].MachineId)
 | 
			
		||||
                                                                            .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
 | 
			
		||||
                                                                            .Where(cs => cs.ColNo == singleChannels[i].ColNo)
 | 
			
		||||
                                                                            .Sum(it => it.Quantity);
 | 
			
		||||
                                        //将库位多批次的总库存数更新标签
 | 
			
		||||
                                        _portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
 | 
			
		||||
                                        Thread.Sleep(200);
 | 
			
		||||
                                        List<ChannelStock> csList = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                                                                             .Where(cs => cs.MachineId == singleChannels[i].MachineId)
 | 
			
		||||
                                                                             .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
 | 
			
		||||
                                                                             .Where(cs => cs.ColNo == singleChannels[i].ColNo && cs.Quantity > 0).OrderBy(cs => cs.EffDate).ToList();
 | 
			
		||||
 | 
			
		||||
                                        if (csList != null && csList.Count > 0)
 | 
			
		||||
                                        {
 | 
			
		||||
                                            int totalQuantity = csList.Sum(c => c.Quantity);
 | 
			
		||||
                                            _portUtil.WriteChannelInfo(5, csList[0].EffDate == null ? "" : csList[0].EffDate, csList[0].DrawerNo, csList[0].ColNo);
 | 
			
		||||
                                            Thread.Sleep(200);
 | 
			
		||||
                                            _portUtil.WriteChannelInfo(6, csList[0].ManuNo == null ? "" : csList[0].ManuNo, csList[0].DrawerNo, csList[0].ColNo);
 | 
			
		||||
                                            Thread.Sleep(200);
 | 
			
		||||
                                            _portUtil.ShowContent(csList[0].DrawerNo, csList[0].ColNo);
 | 
			
		||||
                                            Thread.Sleep(200);
 | 
			
		||||
                                            //将库位多批次的总库存数更新标签
 | 
			
		||||
                                            _portUtil.WriteQuantity(csList[i].DrawerNo, csList[i].ColNo, totalQuantity);
 | 
			
		||||
                                            Thread.Sleep(200);
 | 
			
		||||
                                        }
 | 
			
		||||
                                        //int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                                        //                                    .Where(cs => cs.MachineId == singleChannels[i].MachineId)
 | 
			
		||||
                                        //                                    .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
 | 
			
		||||
                                        //                                    .Where(cs => cs.ColNo == singleChannels[i].ColNo)
 | 
			
		||||
                                        //                                    .Sum(it => it.Quantity);
 | 
			
		||||
                                        ////将库位多批次的总库存数更新标签
 | 
			
		||||
                                        //_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
 | 
			
		||||
                                        //Thread.Sleep(200);
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -376,14 +376,32 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            {
 | 
			
		||||
                                if (singleChannels[i].BoardType == 5)
 | 
			
		||||
                                {
 | 
			
		||||
                                    int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                                                                        .Where(cs => cs.MachineId == singleChannels[i].MachineId)
 | 
			
		||||
                                                                        .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
 | 
			
		||||
                                                                        .Where(cs => cs.ColNo == singleChannels[i].ColNo)
 | 
			
		||||
                                                                        .Sum(it => it.Quantity);
 | 
			
		||||
                                    //将库位多批次的总库存数更新标签
 | 
			
		||||
                                    _portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
 | 
			
		||||
                                    Thread.Sleep(200);
 | 
			
		||||
                                    List<ChannelStock> csList = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                                                                             .Where(cs => cs.MachineId == singleChannels[i].MachineId)
 | 
			
		||||
                                                                             .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
 | 
			
		||||
                                                                             .Where(cs => cs.ColNo == singleChannels[i].ColNo && cs.Quantity > 0).OrderBy(cs => cs.EffDate).ToList();
 | 
			
		||||
 | 
			
		||||
                                    if (csList != null && csList.Count > 0)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        int totalQuantity = csList.Sum(c => c.Quantity);
 | 
			
		||||
                                        _portUtil.WriteChannelInfo(5, csList[0].EffDate == null ? "" : csList[0].EffDate, csList[0].DrawerNo, csList[0].ColNo);
 | 
			
		||||
                                        Thread.Sleep(200);
 | 
			
		||||
                                        _portUtil.WriteChannelInfo(6, csList[0].ManuNo == null ? "" : csList[0].ManuNo, csList[0].DrawerNo, csList[0].ColNo);
 | 
			
		||||
                                        Thread.Sleep(200);
 | 
			
		||||
                                        _portUtil.ShowContent(csList[0].DrawerNo, csList[0].ColNo);
 | 
			
		||||
                                        Thread.Sleep(200);
 | 
			
		||||
                                        //将库位多批次的总库存数更新标签
 | 
			
		||||
                                        _portUtil.WriteQuantity(csList[i].DrawerNo, csList[i].ColNo, totalQuantity);
 | 
			
		||||
                                        Thread.Sleep(200);
 | 
			
		||||
                                    }
 | 
			
		||||
                                    //int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                                    //                                    .Where(cs => cs.MachineId == singleChannels[i].MachineId)
 | 
			
		||||
                                    //                                    .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
 | 
			
		||||
                                    //                                    .Where(cs => cs.ColNo == singleChannels[i].ColNo)
 | 
			
		||||
                                    //                                    .Sum(it => it.Quantity);
 | 
			
		||||
                                    ////将库位多批次的总库存数更新标签
 | 
			
		||||
                                    //_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
 | 
			
		||||
                                    //Thread.Sleep(200);
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue