出药时按先入先出规则
This commit is contained in:
		
							parent
							
								
									96b3918d4c
								
							
						
					
					
						commit
						a105928315
					
				| 
						 | 
					@ -91,6 +91,12 @@ namespace DM_Weight.Models
 | 
				
			||||||
        ///</summary>
 | 
					        ///</summary>
 | 
				
			||||||
        [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; }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -301,7 +301,8 @@ 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,
 | 
				
			||||||
 | 
					                                        FillTime=it.Quantity<=0?DateTime.Now:it.FillTime
 | 
				
			||||||
                                    }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.DrugId }).ExecuteCommand();
 | 
					                                    }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.DrugId }).ExecuteCommand();
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                                else
 | 
					                                else
 | 
				
			||||||
| 
						 | 
					@ -328,7 +329,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();
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                                // 获取更新完库存后的药品库存
 | 
					                                // 获取更新完库存后的药品库存
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -317,6 +317,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                                    ManuNo = it.ManuNo,
 | 
					                                    ManuNo = it.ManuNo,
 | 
				
			||||||
                                    EffDate = it.EffDate,
 | 
					                                    EffDate = it.EffDate,
 | 
				
			||||||
                                    Id = it.Id,
 | 
					                                    Id = it.Id,
 | 
				
			||||||
 | 
					                                    FillTime=it.Quantity<=0?DateTime.Now:it.FillTime
 | 
				
			||||||
                                }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
 | 
					                                }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).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?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();
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -198,7 +198,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                    .WhereIF(!string.IsNullOrEmpty(orderDetail.SetManuNo), cs => cs.ManuNo.Equals(orderDetail.SetManuNo))
 | 
					                    .WhereIF(!string.IsNullOrEmpty(orderDetail.SetManuNo), cs => cs.ManuNo.Equals(orderDetail.SetManuNo))
 | 
				
			||||||
                    .Where(cs => cs.DrugId == orderDetail.DrugId)
 | 
					                    .Where(cs => cs.DrugId == orderDetail.DrugId)
 | 
				
			||||||
                    .OrderBy(cs => cs.EffDate)
 | 
					                    .OrderBy(cs => cs.EffDate)
 | 
				
			||||||
                    .OrderBy(cs => cs.DrawerNo)
 | 
					                    //.OrderBy(cs => cs.DrawerNo)
 | 
				
			||||||
 | 
					                    .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;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -219,8 +219,9 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                    .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 8) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
					                    .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 8) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
				
			||||||
                    .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 8)
 | 
					                    .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 8)
 | 
				
			||||||
                    .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;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -284,6 +284,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                    SqlSugarHelper.Db.Updateable(new ChannelStock()
 | 
					                    SqlSugarHelper.Db.Updateable(new ChannelStock()
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        Quantity = ChannelStock.Quantity + ReturnQuantity,
 | 
					                        Quantity = ChannelStock.Quantity + ReturnQuantity,
 | 
				
			||||||
 | 
					                        FillTime= ChannelStock.Quantity<=0 ? DateTime.Now : ChannelStock.FillTime,
 | 
				
			||||||
                        Id = ChannelStock.Id,
 | 
					                        Id = ChannelStock.Id,
 | 
				
			||||||
                    }).UpdateColumns(it => new { it.Quantity }).ExecuteCommand();
 | 
					                    }).UpdateColumns(it => new { it.Quantity }).ExecuteCommand();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue