出药时按先入先出规则
This commit is contained in:
		
							parent
							
								
									6a9d8e0aeb
								
							
						
					
					
						commit
						d009de4de7
					
				| 
						 | 
					@ -92,6 +92,12 @@ namespace DM_Weight.Models
 | 
				
			||||||
        [SugarColumn(ColumnName = "state")]
 | 
					        [SugarColumn(ColumnName = "state")]
 | 
				
			||||||
        public int? State { get; set; }
 | 
					        public int? State { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 入库时间:针对先入先出操作
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        [SugarColumn(ColumnName = "fill_time")]
 | 
				
			||||||
 | 
					        public DateTime? FillTime { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [SugarColumn(IsIgnore = true)]
 | 
					        [SugarColumn(IsIgnore = true)]
 | 
				
			||||||
        public bool IsSelected { get; set; }
 | 
					        public bool IsSelected { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -302,13 +302,14 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                                        DrawerNo = it.DrawerNo,
 | 
					                                        DrawerNo = it.DrawerNo,
 | 
				
			||||||
                                        ColNo = it.ColNo,
 | 
					                                        ColNo = it.ColNo,
 | 
				
			||||||
                                        DrawerType = it.DrawerType,
 | 
					                                        DrawerType = it.DrawerType,
 | 
				
			||||||
                                        BoardType = it.BoardType
 | 
					                                        BoardType = it.BoardType,
 | 
				
			||||||
                                    }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.DrugId }).ExecuteCommand();
 | 
					                                        FillTime=it.Quantity<=0||it.FillTime==null ? DateTime.Now : it.FillTime,
 | 
				
			||||||
 | 
					                                    }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.DrugId,it.FillTime }).ExecuteCommand();
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                                else
 | 
					                                else
 | 
				
			||||||
                                {
 | 
					                                {
 | 
				
			||||||
                                    //如果批号重复则不让添加
 | 
					                                    //如果批号重复则不让添加
 | 
				
			||||||
                                    List<ChannelStock> csCount = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo && cs.ManuNo == it.ManuNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList();
 | 
					                                    List<ChannelStock> csCount = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo&&cs.ColNo==it.ColNo && cs.ManuNo == it.ManuNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList();
 | 
				
			||||||
                                    if (csCount.Count > 0)
 | 
					                                    if (csCount.Count > 0)
 | 
				
			||||||
                                    {
 | 
					                                    {
 | 
				
			||||||
                                        //repeatList.Add(it.ManuNo);
 | 
					                                        //repeatList.Add(it.ManuNo);
 | 
				
			||||||
| 
						 | 
					@ -329,7 +330,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                                        DrawerType = it.DrawerType,
 | 
					                                        DrawerType = it.DrawerType,
 | 
				
			||||||
                                        BoardType = it.BoardType,
 | 
					                                        BoardType = it.BoardType,
 | 
				
			||||||
                                        Id = Guid.NewGuid().ToString(),
 | 
					                                        Id = Guid.NewGuid().ToString(),
 | 
				
			||||||
                                        MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
 | 
					                                        MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1",
 | 
				
			||||||
 | 
					                                        FillTime = DateTime.Now
 | 
				
			||||||
                                    }).ExecuteCommand();
 | 
					                                    }).ExecuteCommand();
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                                // 获取更新完库存后的药品库存
 | 
					                                // 获取更新完库存后的药品库存
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -420,7 +420,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                           .Where(cs => cs.DrugId.Equals(DrugInfo.DrugId.ToString()))
 | 
					                           .Where(cs => cs.DrugId.Equals(DrugInfo.DrugId.ToString()))
 | 
				
			||||||
                           .Where(cs => cs.DrawerType == 1)
 | 
					                           .Where(cs => cs.DrawerType == 1)
 | 
				
			||||||
                           .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
					                           .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
				
			||||||
                           .Where(cs => cs.DrawerNo == item.DrawerNo)
 | 
					                           .Where(cs => cs.DrawerNo == item.DrawerNo&&cs.ColNo==item.ColNo)
 | 
				
			||||||
                           .Count();
 | 
					                           .Count();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            if (count > 0)
 | 
					                            if (count > 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -317,7 +317,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                                    ManuNo = it.ManuNo,
 | 
					                                    ManuNo = it.ManuNo,
 | 
				
			||||||
                                    EffDate = it.EffDate,
 | 
					                                    EffDate = it.EffDate,
 | 
				
			||||||
                                    Id = it.Id,
 | 
					                                    Id = it.Id,
 | 
				
			||||||
                                }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
 | 
					                                    FillTime=it.Quantity<=0||it.FillTime==null ? DateTime.Now : it.FillTime
 | 
				
			||||||
 | 
					                                }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate,it.FillTime }).ExecuteCommand();
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                            else
 | 
					                            else
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
| 
						 | 
					@ -347,6 +348,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                                        ManuNo = recordList[0].ManuNo,
 | 
					                                        ManuNo = recordList[0].ManuNo,
 | 
				
			||||||
                                        EffDate = recordList[0].EffDate,
 | 
					                                        EffDate = recordList[0].EffDate,
 | 
				
			||||||
                                        Id = recordList[0].Id,
 | 
					                                        Id = recordList[0].Id,
 | 
				
			||||||
 | 
					                                        FillTime=recordList[0].Quantity <= 0 || recordList[0].FillTime == null ? DateTime.Now : recordList[0].FillTime
 | 
				
			||||||
                                    }).Where(item => item.Id == item.Id).ExecuteCommand();
 | 
					                                    }).Where(item => item.Id == item.Id).ExecuteCommand();
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                                else
 | 
					                                else
 | 
				
			||||||
| 
						 | 
					@ -364,7 +366,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                                        DrawerType = it.DrawerType,
 | 
					                                        DrawerType = it.DrawerType,
 | 
				
			||||||
                                        BoardType = it.BoardType,
 | 
					                                        BoardType = it.BoardType,
 | 
				
			||||||
                                        Id = Guid.NewGuid().ToString(),
 | 
					                                        Id = Guid.NewGuid().ToString(),
 | 
				
			||||||
                                        MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
 | 
					                                        MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1",
 | 
				
			||||||
 | 
					                                        FillTime = DateTime.Now
 | 
				
			||||||
                                    }).ExecuteCommand();
 | 
					                                    }).ExecuteCommand();
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -216,8 +216,9 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                     .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前2个抽屉,双人登录开后14个抽屉
 | 
					                     .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前2个抽屉,双人登录开后14个抽屉
 | 
				
			||||||
                    .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
 | 
					                    .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
 | 
				
			||||||
                    .OrderBy(cs => cs.EffDate)
 | 
					                    .OrderBy(cs => cs.EffDate)
 | 
				
			||||||
                    .OrderBy(cs => cs.DrawerNo)
 | 
					                    //.OrderBy(cs => cs.DrawerNo)
 | 
				
			||||||
                    .OrderBy(cs => cs.ManuNo)
 | 
					                    //.OrderBy(cs => cs.ManuNo)
 | 
				
			||||||
 | 
					                    .OrderBy(cs=>cs.FillTime)
 | 
				
			||||||
                    .ToList();
 | 
					                    .ToList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                int total = HasQChannels.Sum(it => it.Quantity);
 | 
					                int total = HasQChannels.Sum(it => it.Quantity);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -220,8 +220,9 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                    .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前2个抽屉,双人登录开后14个抽屉
 | 
					                    .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前2个抽屉,双人登录开后14个抽屉
 | 
				
			||||||
                    .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
 | 
					                    .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
 | 
				
			||||||
                    .OrderBy(cs => cs.EffDate)
 | 
					                    .OrderBy(cs => cs.EffDate)
 | 
				
			||||||
                    .OrderBy(cs => cs.DrawerNo)
 | 
					                    //.OrderBy(cs => cs.DrawerNo)
 | 
				
			||||||
                    .OrderBy(cs => cs.ManuNo)
 | 
					                    //.OrderBy(cs => cs.ManuNo)
 | 
				
			||||||
 | 
					                    .OrderBy(cs=>cs.FillTime)
 | 
				
			||||||
                    .ToList();
 | 
					                    .ToList();
 | 
				
			||||||
                int total = HasQChannels.Sum(it => it.Quantity);
 | 
					                int total = HasQChannels.Sum(it => it.Quantity);
 | 
				
			||||||
                int TakeQ = orderDetail.Quantity;
 | 
					                int TakeQ = orderDetail.Quantity;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue