添加药盒标签类型,添加打开药盒及无按钮标签
This commit is contained in:
		
							parent
							
								
									43d372ebe0
								
							
						
					
					
						commit
						f144b21a09
					
				| 
						 | 
				
			
			@ -54,7 +54,7 @@
 | 
			
		|||
		<!-- 抽屉串口的串口号 -->
 | 
			
		||||
		<add key="DrawerPortPath" value="COM1" />
 | 
			
		||||
		<!-- can总线串口的串口号 -->
 | 
			
		||||
		<add key="CanBusPortPath" value="COM3" />
 | 
			
		||||
		<add key="CanBusPortPath" value="COM17" />
 | 
			
		||||
		<!-- 条码枪串口的串口号 -->
 | 
			
		||||
		<add key="ScanCodePortPath" value="COM8" />
 | 
			
		||||
		
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,6 +55,19 @@ namespace DM_Weight.Converter
 | 
			
		|||
                    {
 | 
			
		||||
                        return "外置回收";
 | 
			
		||||
                    }
 | 
			
		||||
                case 35:
 | 
			
		||||
                    if (DrawerType == 1)
 | 
			
		||||
                    {
 | 
			
		||||
                        return "管控药盒带屏幕";
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (DrawerType == 2)
 | 
			
		||||
                    {
 | 
			
		||||
                        return "药盒带屏幕回收(内置)";
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        return "外置回收";
 | 
			
		||||
                    }
 | 
			
		||||
                case 4:
 | 
			
		||||
                    if (DrawerType == 1)
 | 
			
		||||
                    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -264,6 +264,12 @@ namespace DM_Weight.Port
 | 
			
		|||
                                // 药盒指示灯使能
 | 
			
		||||
                                await BoxLockLightOn();
 | 
			
		||||
                            }
 | 
			
		||||
                            // 药盒
 | 
			
		||||
                            if (BoardType == 35)
 | 
			
		||||
                            {
 | 
			
		||||
                                // 药盒带屏幕
 | 
			
		||||
                                await OpenBox();
 | 
			
		||||
                            }
 | 
			
		||||
                            if (BoardType == 6)
 | 
			
		||||
                            {
 | 
			
		||||
                                // 药盒指示灯使能
 | 
			
		||||
| 
						 | 
				
			
			@ -970,16 +976,23 @@ namespace DM_Weight.Port
 | 
			
		|||
        /// </summary>
 | 
			
		||||
        /// <param name="ColNo"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task OpenBox(int ColNo)
 | 
			
		||||
        public async Task OpenBox()
 | 
			
		||||
        {
 | 
			
		||||
            int[] iNum = new int[] { 3, 2, 1 };
 | 
			
		||||
            for (int i = 0; i < ColNos.Length; i++)
 | 
			
		||||
            {
 | 
			
		||||
                int ColNo = ColNos[i];
 | 
			
		||||
                int[] iNum = new int[] { 4, 2, 1 };
 | 
			
		||||
                var colNo2 = ColNo % 3 > 0 ? (ColNo % 3) - 1 : 2;
 | 
			
		||||
                var bColNo = iNum[colNo2];
 | 
			
		||||
                decimal decolNO = (decimal)ColNo;
 | 
			
		||||
                var channel = Convert.ToInt32((DrawerNo * 10 + Math.Ceiling(decolNO / 3)).ToString(), 16);
 | 
			
		||||
            byte[] buffer = new byte[] { 0xaa, (byte)channel, 5,(byte)bColNo, 0x00,0x00,0x00,0xee};
 | 
			
		||||
                byte[] buffer = new byte[] { 0xaa, (byte)channel, 5, (byte)bColNo, 0x00, 0x00, 0x00, 0xee };
 | 
			
		||||
                //byte[] buffer = new byte[] { 0xaa, 0x11, 0x05,0x01, 0x00,0x00,0x00,0xee};
 | 
			
		||||
                logger.Info($"{Convert.ToHexString(buffer)}");
 | 
			
		||||
                canBusSerial.Write(buffer, 0, 8);
 | 
			
		||||
            await Task.Delay(TimeSpan.FromMilliseconds(20));
 | 
			
		||||
                await Task.Delay(800);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 查询药盒状态
 | 
			
		||||
| 
						 | 
				
			
			@ -990,7 +1003,7 @@ namespace DM_Weight.Port
 | 
			
		|||
        {
 | 
			
		||||
            decimal deColNo = (decimal)ColNo;
 | 
			
		||||
            var channel = Convert.ToInt32((DrawerNo * 10 + Math.Ceiling(deColNo / 3)).ToString(), 16);
 | 
			
		||||
            byte[] buffer = new byte[] {0xaa,(byte)channel,2,0,0,0,0,0xee };
 | 
			
		||||
            byte[] buffer = new byte[] { 0xaa, (byte)channel, 2, 0, 0, 0, 0, 0xee };
 | 
			
		||||
            canBusSerial.Write(buffer, 0, 8);
 | 
			
		||||
            return await GetBufferByPort(canBusSerial, 8);
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -1084,7 +1097,7 @@ namespace DM_Weight.Port
 | 
			
		|||
            {
 | 
			
		||||
 | 
			
		||||
                canBusSerial.DiscardInBuffer();
 | 
			
		||||
                int channel = Convert.ToInt32((drawerNo * 10 + colNo).ToString(),16);
 | 
			
		||||
                int channel = Convert.ToInt32((drawerNo * 10 + colNo).ToString(), 16);
 | 
			
		||||
                byte[] buffer = new byte[] { 0xaa, (byte)channel, 6, 0, 0, 0, 0, 0xee };
 | 
			
		||||
                buffer[3] = (byte)(quantity >> 8);
 | 
			
		||||
                buffer[4] = (byte)(quantity & 0xff);
 | 
			
		||||
| 
						 | 
				
			
			@ -1133,55 +1146,67 @@ namespace DM_Weight.Port
 | 
			
		|||
 | 
			
		||||
        #region 标签显示屏
 | 
			
		||||
        //清屏
 | 
			
		||||
        public void ClearContentMethod(int drawerNo,int colNo)
 | 
			
		||||
        public void ClearContentMethod(int drawerNo, int colNo)
 | 
			
		||||
        {
 | 
			
		||||
            decimal deColNo = colNo;
 | 
			
		||||
            var channel = drawerNo * 10 + Math.Ceiling(deColNo / 3);
 | 
			
		||||
            int[] iNum =new int[] { 3, 2, 1 };
 | 
			
		||||
            var colNo2 = colNo%3>0?(colNo%3)-1:2;
 | 
			
		||||
            var bColNo = iNum[colNo2];
 | 
			
		||||
            byte[] buffer = new byte[] { 0xaa,(byte)channel,0x09,(byte)bColNo ,0xee};
 | 
			
		||||
            //var channel = drawerNo * 10 + Math.Ceiling(deColNo / 3);
 | 
			
		||||
            int[] iNum = new int[] { 3, 2, 1 };
 | 
			
		||||
            var colNo2 = colNo % 3 > 0 ? (colNo % 3) - 1 : 2;
 | 
			
		||||
            var bColNo = Convert.ToInt32((iNum[colNo2]+10).ToString(),16);
 | 
			
		||||
            //var index = Convert.ToInt32(((colNo % 3 == 0 ? 3 : colNo % 3)+10).ToString(),16);
 | 
			
		||||
            int channel = Convert.ToInt32((drawerNo * 10 + Math.Ceiling((decimal)colNo / 3)).ToString(), 16);
 | 
			
		||||
            byte[] buffer = new byte[] { 0xaa, (byte)channel, 0x09, (byte)bColNo, 0,0,0, 0xee };
 | 
			
		||||
            canBusSerial.Write(buffer, 0, 8);
 | 
			
		||||
            logger.Info($"清屏指令:{Convert.ToHexString(buffer)}");
 | 
			
		||||
        }
 | 
			
		||||
        //刷新内容
 | 
			
		||||
        public void ShowContentMethod(int drawerNo, int colNo)
 | 
			
		||||
        public async Task ShowContentMethod(int drawerNo, int colNo)
 | 
			
		||||
        {
 | 
			
		||||
            var channel = drawerNo * 10 + Math.Ceiling((decimal)colNo % 3);
 | 
			
		||||
            byte[] buffer = new byte[] { 0xaa, (byte)channel, 0x0c, 0x00, 0x00, 0x00, 0x00, 0xee};
 | 
			
		||||
            canBusSerial.Write(buffer,0,8);
 | 
			
		||||
            int channel = Convert.ToInt32((drawerNo * 10 + Math.Ceiling((decimal)colNo / 3)).ToString(), 16);
 | 
			
		||||
            byte[] buffer = new byte[] { 0xaa, (byte)channel, 0x0c, 0x00, 0x00, 0x00, 0x00, 0xee };
 | 
			
		||||
            logger.Info($"刷新内容指令:{Convert.ToHexString(buffer)}");
 | 
			
		||||
            canBusSerial.Write(buffer, 0, 8);
 | 
			
		||||
        }
 | 
			
		||||
        // 基础数据写入方法
 | 
			
		||||
        public async void WriteChannelInfoMethod(int type,string content,int drawerNo,int colNo)
 | 
			
		||||
        public async Task WriteChannelInfoMethod(int type, string content, int drawerNo, int colNo)
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                canBusSerial.DiscardInBuffer();
 | 
			
		||||
                Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
 | 
			
		||||
                byte[] contentBuf = Encoding.GetEncoding("gb2312").GetBytes(trim(content));
 | 
			
		||||
                if (content.Length > 10)
 | 
			
		||||
                {
 | 
			
		||||
                    content = content.Substring(0, 10);
 | 
			
		||||
                int channel = Convert.ToInt32((DrawerNo * 10 + Math.Ceiling((decimal)colNo / 3)).ToString(), 16);
 | 
			
		||||
                }
 | 
			
		||||
                int channel = Convert.ToInt32((drawerNo * 10 + Math.Ceiling((decimal)colNo / 3)).ToString(), 16);
 | 
			
		||||
                int[] iNum = new int[] { 3, 2, 1 };
 | 
			
		||||
                var colNo2 = colNo % 3 > 0 ? (colNo % 3) - 1 : 2;
 | 
			
		||||
                var bColNo = iNum[colNo2]; if (contentBuf.Length % 2 != 0)
 | 
			
		||||
                var bColNo = iNum[colNo2]+160;
 | 
			
		||||
                //var index = (colNo % 3 == 0 ? 3 : colNo % 3)+160;
 | 
			
		||||
                if (contentBuf.Length % 2 != 0)
 | 
			
		||||
                {
 | 
			
		||||
                    Array.Resize(ref contentBuf, contentBuf.Length + 1);
 | 
			
		||||
                }
 | 
			
		||||
                byte[] buffer = new byte[] { 0xaa, (byte)channel, (byte)colNo2, (byte)type, 0, 0, 0, 0xee };
 | 
			
		||||
                byte[] buffer = new byte[] { 0xaa, (byte)channel, (byte)bColNo, (byte)type, 0, 0, 0, 0xee };
 | 
			
		||||
                canBusSerial.Write(buffer, 0, 8);
 | 
			
		||||
                await Task.Delay(20);
 | 
			
		||||
                logger.Info($"开始写标签指令:{Convert.ToHexString(buffer)}");
 | 
			
		||||
                await Task.Delay(30);
 | 
			
		||||
                buffer[4] = 1;
 | 
			
		||||
                for (int i = 0; i < contentBuf.Length; i += 2)
 | 
			
		||||
                {
 | 
			
		||||
                    buffer[5] = contentBuf[i];
 | 
			
		||||
                    buffer[6] = contentBuf[i + 1];
 | 
			
		||||
                    canBusSerial.Write(buffer, 0, 8);
 | 
			
		||||
                    await Task.Delay(20);
 | 
			
		||||
                    logger.Info($"写标签指令:{Convert.ToHexString(buffer)}");
 | 
			
		||||
                    await Task.Delay(30);
 | 
			
		||||
                }
 | 
			
		||||
                buffer[4] = 2;
 | 
			
		||||
                buffer[5] = 0;
 | 
			
		||||
                buffer[6] = 0;
 | 
			
		||||
                canBusSerial.Write(buffer, 0, 8);
 | 
			
		||||
                await Task.Delay(20);
 | 
			
		||||
                logger.Info($"结束写标签指令:{Convert.ToHexString(buffer)}");
 | 
			
		||||
                await Task.Delay(30);
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
| 
						 | 
				
			
			@ -1578,7 +1603,7 @@ namespace DM_Weight.Port
 | 
			
		|||
        /// 冰箱温度设定最小
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task FridgeMinSetting(float min,int iIndex)
 | 
			
		||||
        public async Task FridgeMinSetting(float min, int iIndex)
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -1617,7 +1642,7 @@ namespace DM_Weight.Port
 | 
			
		|||
        /// 冰箱温度设定最大
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task FridgeMaxSetting(float max,int iIndex)
 | 
			
		||||
        public async Task FridgeMaxSetting(float max, int iIndex)
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -1662,9 +1687,9 @@ namespace DM_Weight.Port
 | 
			
		|||
            {
 | 
			
		||||
                fridgeSerial.DiscardInBuffer();
 | 
			
		||||
                byte bAddress;
 | 
			
		||||
                if (iIndex == 1 )
 | 
			
		||||
                if (iIndex == 1)
 | 
			
		||||
                {
 | 
			
		||||
                    bAddress=0x01;
 | 
			
		||||
                    bAddress = 0x01;
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			@ -1710,7 +1735,7 @@ namespace DM_Weight.Port
 | 
			
		|||
        /// 设置冰箱温度
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task<float> SetFridgeTemperature(float temperature,int iIndex)
 | 
			
		||||
        public async Task<float> SetFridgeTemperature(float temperature, int iIndex)
 | 
			
		||||
        {
 | 
			
		||||
            int tpt = (int)temperature * 10;
 | 
			
		||||
            byte Temperature = (byte)(tpt & 0xff);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -534,7 +534,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        private bool _isFinishClick = false;
 | 
			
		||||
        public DelegateCommand TakeFinish { get => new DelegateCommand(TakeFinishAction); }
 | 
			
		||||
 | 
			
		||||
        private void TakeFinishAction()
 | 
			
		||||
        private async void TakeFinishAction()
 | 
			
		||||
        {
 | 
			
		||||
            if (!_isFinishClick)
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -771,8 +771,41 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            //}
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    List<ChannelStock> singleChannelsBoxSmart = record.Where(it => it.BoardType == 35)
 | 
			
		||||
                                                                    .GroupBy(it => new { it.DrawerNo, 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();
 | 
			
		||||
 | 
			
		||||
                    if (singleChannelsBoxSmart != null && singleChannelsBoxSmart.Count > 0)
 | 
			
		||||
                    {
 | 
			
		||||
                        for (int i = 0; i < singleChannelsBoxSmart.Count; i++)
 | 
			
		||||
                        {
 | 
			
		||||
                            List<ChannelStock> channelStockEffDate = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                                                                .Where(cs => cs.MachineId == singleChannelsBoxSmart[i].MachineId)
 | 
			
		||||
                                                                .Where(cs => cs.DrawerNo == singleChannelsBoxSmart[i].DrawerNo)
 | 
			
		||||
                                                                .Where(cs => cs.ColNo == singleChannelsBoxSmart[i].ColNo)
 | 
			
		||||
                                                                .Where(cs => cs.Quantity > 0)
 | 
			
		||||
                                                                .OrderBy(cs => cs.EffDate).ToList();
 | 
			
		||||
                            int totalQuantity = channelStockEffDate.Sum(it => it.Quantity);
 | 
			
		||||
 | 
			
		||||
                            //将库位多批次的总库存数更新标签
 | 
			
		||||
 | 
			
		||||
                            await Task.Delay(200);
 | 
			
		||||
                            await _portUtil.WriteChannelInfoMethod(2, totalQuantity.ToString(), channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
 | 
			
		||||
                            await Task.Delay(200);
 | 
			
		||||
                            await _portUtil.WriteChannelInfoMethod(5, channelStockEffDate[0].EffDate, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
 | 
			
		||||
                            await Task.Delay(200);
 | 
			
		||||
                            await _portUtil.WriteChannelInfoMethod(6, channelStockEffDate[0].ManuNo, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
 | 
			
		||||
                            await Task.Delay(200);
 | 
			
		||||
                            await _portUtil.ShowContentMethod(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -248,6 +248,21 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    _portUtil.ShowContent(item.DrawerNo, item.ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                                //_screenUtil.SetStockInfo(item, 1);
 | 
			
		||||
                                if(item.BoardType == 35)
 | 
			
		||||
                                {
 | 
			
		||||
                                    _portUtil.WindowName = "BindingChannelDialog";
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(1,DrugInfo.DrugName, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(3, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(4, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(5, item.EffDate, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(6, item.ManuNo, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
| 
						 | 
				
			
			@ -306,6 +321,21 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    await Task.Delay(200);
 | 
			
		||||
                                    _portUtil.ShowContent(item.DrawerNo, item.ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                                if (item.BoardType == 35)
 | 
			
		||||
                                {
 | 
			
		||||
                                    _portUtil.WindowName = "BindingChannelDialog";
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(3, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(4, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(5, item.EffDate, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(6, item.ManuNo, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                                //_screenUtil.SetStockInfo(item, 1);
 | 
			
		||||
                            });
 | 
			
		||||
                            GetChannelsByDrawerNo();
 | 
			
		||||
| 
						 | 
				
			
			@ -347,6 +377,12 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            await Task.Delay(200);
 | 
			
		||||
                            _portUtil.ShowContent(item.DrawerNo, item.ColNo);
 | 
			
		||||
                        }
 | 
			
		||||
                        if(item.BoardType == 35)
 | 
			
		||||
                        {
 | 
			
		||||
                            _portUtil.ClearContentMethod(item.DrawerNo, item.ColNo);
 | 
			
		||||
                            await Task.Delay(300);
 | 
			
		||||
                            _portUtil.ShowContentMethod(item.DrawerNo,item.ColNo);
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        //_screenUtil.SetStockInfo(item, 1);
 | 
			
		||||
                    });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -290,6 +290,10 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    //await Task.Delay(200);
 | 
			
		||||
                                    _portUtil.ShowContent(item.DrawerNo, item.ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                                if(item.BoardType==35)
 | 
			
		||||
                                {
 | 
			
		||||
                                    _portUtil.ClearContentMethod(item.DrawerNo,item.ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                                //_screenUtil.SetStockInfo(item, 1);
 | 
			
		||||
 | 
			
		||||
                            }
 | 
			
		||||
| 
						 | 
				
			
			@ -365,6 +369,12 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                //Thread.Sleep(200);
 | 
			
		||||
                                _portUtil.ShowContent(item.DrawerNo, item.ColNo);
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
                            if (item.BoardType == 35)
 | 
			
		||||
                            {
 | 
			
		||||
                                _portUtil.WindowName = "BindingChannelDialog";
 | 
			
		||||
                                _portUtil.ClearContentMethod(item.DrawerNo,item.ColNo);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -141,7 +141,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        // 完成按钮
 | 
			
		||||
        public DelegateCommand TakeFinish
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            get => new DelegateCommand(async() =>
 | 
			
		||||
            {
 | 
			
		||||
                _isFinishClick = true;
 | 
			
		||||
                List<ChannelStock> record = ChannelStocks.FindAll(it => it.Quantity != it.CheckQuantity).ToList();
 | 
			
		||||
| 
						 | 
				
			
			@ -206,7 +206,23 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                        {
 | 
			
		||||
                            singleChannels.ForEach(it =>
 | 
			
		||||
                            {
 | 
			
		||||
                                _portUtil.WriteChannelInfoMethod(2, (it.Quantity - it.TakeQuantity).ToString(), it.DrawerNo, it.ColNo);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                        {
 | 
			
		||||
                            for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                            {
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity + singleChannels[i].AddQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        RequestData();
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -135,7 +135,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    _portUtil.WindowName = "DrawerAddDrugWindow";
 | 
			
		||||
                    _portUtil.Operate = true;
 | 
			
		||||
                    _portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
 | 
			
		||||
                    _portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
 | 
			
		||||
                    _portUtil.ColNos = singleChannels.Where(it=>it.AddQuantity>0).Select(it => it.ColNo).ToArray();
 | 
			
		||||
                    _portUtil.DrawerNo = DrawerNo;
 | 
			
		||||
                    _portUtil.Start();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -154,7 +154,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        // 完成按钮
 | 
			
		||||
        public DelegateCommand TakeFinish
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            get => new DelegateCommand(async() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (!_isFinishClick)
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			@ -296,6 +296,36 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        });
 | 
			
		||||
                        if (f.Data)
 | 
			
		||||
                        {
 | 
			
		||||
                            List<ChannelStock> singleChannels = 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();
 | 
			
		||||
                            singleChannels = singleChannels.Where(it => it.AddQuantity > 0).ToList();
 | 
			
		||||
                            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
                            {
 | 
			
		||||
                                //将库位多批次的总库存数更新标签
 | 
			
		||||
                                //_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) - singleChannels.Sum(it => it.TakeQuantity));
 | 
			
		||||
 | 
			
		||||
                                singleChannels.ForEach(it =>
 | 
			
		||||
                                {
 | 
			
		||||
                                    _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
 | 
			
		||||
                                });
 | 
			
		||||
                            }
 | 
			
		||||
                            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                            {
 | 
			
		||||
                                for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                                {
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity + singleChannels[i].AddQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            RequestData();
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -301,6 +301,36 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        });
 | 
			
		||||
                        if (f.Data)
 | 
			
		||||
                        {
 | 
			
		||||
                            List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType != 1)
 | 
			
		||||
                                                                       .GroupBy(it => it.ColNo)
 | 
			
		||||
                                                                       .Select(it =>
 | 
			
		||||
                                                                       {
 | 
			
		||||
                                                                           var ret = it.First();
 | 
			
		||||
                                                                           ret.Quantity = it.Sum(itx => itx.Quantity);
 | 
			
		||||
                                                                           ret.TakeQuantity = it.Sum(itx => itx.TakeQuantity);
 | 
			
		||||
                                                                           return ret;
 | 
			
		||||
                                                                       }).ToList();
 | 
			
		||||
                            singleChannels = singleChannels.Where(it => it.TakeQuantity > 0).ToList();
 | 
			
		||||
                            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
                            {
 | 
			
		||||
                                //将库位多批次的总库存数更新标签
 | 
			
		||||
                                //_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) - singleChannels.Sum(it => it.TakeQuantity));
 | 
			
		||||
 | 
			
		||||
                                singleChannels.ForEach(it =>
 | 
			
		||||
                                {
 | 
			
		||||
                                    _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
 | 
			
		||||
                                });
 | 
			
		||||
                            }
 | 
			
		||||
                            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                            {
 | 
			
		||||
                                singleChannels.ForEach(async it =>
 | 
			
		||||
                                {
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(2, (it.Quantity - it.TakeQuantity).ToString(), it.DrawerNo, it.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.ShowContentMethod(it.DrawerNo, it.ColNo);
 | 
			
		||||
                                });
 | 
			
		||||
                            }
 | 
			
		||||
                            RequestData();
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -378,6 +378,16 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                        {
 | 
			
		||||
                            for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                            {
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity + singleChannels[i].AddQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -288,7 +288,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        // 完成按钮
 | 
			
		||||
        public DelegateCommand TakeFinish
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            get => new DelegateCommand(async() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (!_isFinishClick)
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			@ -442,6 +442,16 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
 | 
			
		||||
                                });
 | 
			
		||||
                            }
 | 
			
		||||
                            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                            {
 | 
			
		||||
                                for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                                {
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity - singleChannels[i].TakeQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
                                Message = "调拨取药完成,库存已更新",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -283,7 +283,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        // 完成按钮
 | 
			
		||||
        public DelegateCommand TakeFinish
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            get => new DelegateCommand(async() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (!_isFinishClick)
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			@ -436,6 +436,16 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.TakeQuantity);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                        {
 | 
			
		||||
                            for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                            {
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity + singleChannels[i].TakeQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
                            Message = "处方退药完成,库存已更新",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -298,7 +298,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        // 完成按钮
 | 
			
		||||
        public DelegateCommand TakeFinish
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            get => new DelegateCommand(async() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (!_isFinishClick)
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			@ -460,6 +460,18 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
 | 
			
		||||
                                });
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
                            List<ChannelStock> singleChannelsBoxSmart = record.FindAll(it => it.BoardType == 35);
 | 
			
		||||
                            if ((singleChannelsBoxSmart.Count > 0 ? singleChannelsBoxSmart[0].BoardType : 1) == 35)
 | 
			
		||||
                            {
 | 
			
		||||
                                for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                                {
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity - singleChannels[i].TakeQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
                                Message = "抽屉取药完成,库存已更新",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -223,7 +223,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        // 完成按钮
 | 
			
		||||
        public DelegateCommand TakeFinish
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            get => new DelegateCommand(async() =>
 | 
			
		||||
            {
 | 
			
		||||
                IsFinishClick = true;
 | 
			
		||||
                string InvoiceId = "RETURN_" + CurrentTimeMillis();
 | 
			
		||||
| 
						 | 
				
			
			@ -364,6 +364,12 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    {
 | 
			
		||||
                        _portUtil.WriteQuantity(ChannelStock.DrawerNo, ChannelStock.ColNo, ChannelStock.Quantity + ReturnQuantity);
 | 
			
		||||
                    }
 | 
			
		||||
                    if(ChannelStock.BoardType==35)
 | 
			
		||||
                    {
 | 
			
		||||
                        await _portUtil.WriteChannelInfoMethod(2, (ChannelStock.Quantity + ChannelStock.ReturnQuantity).ToString(), ChannelStock.DrawerNo, ChannelStock.ColNo);
 | 
			
		||||
                        await Task.Delay(200);
 | 
			
		||||
                        await _portUtil.ShowContentMethod(ChannelStock.DrawerNo, ChannelStock.ColNo);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -370,7 +370,22 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                        {
 | 
			
		||||
                            for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                            {
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity + singleChannels[i].AddQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                            }
 | 
			
		||||
                            //singleChannels.ForEach(async it =>
 | 
			
		||||
                            //{
 | 
			
		||||
                            //    await _portUtil.WriteChannelInfoMethod(2, (it.Quantity + it.AddQuantity).ToString(), it.DrawerNo, it.ColNo);
 | 
			
		||||
                            //    await Task.Delay(200);
 | 
			
		||||
                            //    await _portUtil.ShowContentMethod(it.DrawerNo, it.ColNo);
 | 
			
		||||
                            //});
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -199,7 +199,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        // 完成按钮
 | 
			
		||||
        public DelegateCommand TakeFinish
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            get => new DelegateCommand(async() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (!_isFinishClick)
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			@ -344,6 +344,16 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                        {
 | 
			
		||||
                            for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                            {
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity - singleChannels[i].TakeQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue