Exemplo n.º 1
0
 /// <summary>
 /// 更新药品批次信息
 /// </summary>
 /// <param name="batch">药品批次实体</param>
 /// <param name="newValidityTime">更新的到效日期</param>
 public void UpdateBatch(YP_Batch batch, DateTime newValidityTime)
 {
     try
     {
         BatchProcessor.UpdateBatch(batch, newValidityTime);
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 更新批次记录
 /// </summary>
 /// <param name="batch">药品批次实体</param>
 /// <param name="validityDate">到效日期更新值</param>
 static public void UpdateBatch(YP_Batch batch, DateTime validityDate)
 {
     try
     {
         if (batch != null)
         {
             batch.ValidityDate = validityDate;
             BindEntity <YP_Batch> .CreateInstanceDAL(oleDb, BLL.Tables.YK_BATCH).Update(batch);
         }
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 增加药品批次记录
        /// </summary>
        /// <param name="orderList">明细链表</param>
        /// <param name="inStoreTime">入库时间</param>
        static public void AddBatchNum(List <BillOrder> orderList, DateTime inStoreTime)
        {
            string   strWhere = "";
            YP_Batch newBatch = new YP_Batch();

            foreach (BillOrder billOrder in orderList)
            {
                YP_InOrder order = (YP_InOrder)billOrder;
                //查询入库明细中的药品是否已经有批次了
                strWhere = BLL.Tables.yk_batch.BATCHNUM + oleDb.EuqalTo() + "'" + order.BatchNum.ToString() + "'" +
                           oleDb.And() + BLL.Tables.yk_batch.MAKERDICID + oleDb.EuqalTo() + order.MakerDicID.ToString() +
                           oleDb.And() + BLL.Tables.yk_batch.DEPTID + oleDb.EuqalTo() + order.DeptID.ToString();
                YP_Batch oldBatch = BindEntity <YP_Batch> .CreateInstanceDAL(oleDb, BLL.Tables.YK_BATCH).GetModel(strWhere);

                //如果不是针对批次表中药品入库,则自动在批次表中增加一条批次记录
                if (oldBatch == null)
                {
                    if (order.InNum <= 0)
                    {
                        throw new Exception("新入库药品入库数量不能小于0");
                    }
                    newBatch.Batchnum     = order.BatchNum;
                    newBatch.Currentnum   = order.InNum;
                    newBatch.Del_flag     = 0;
                    newBatch.Deptid       = order.DeptID;
                    newBatch.Instoretime  = inStoreTime;
                    newBatch.Makerdicid   = order.MakerDicID;
                    newBatch.Unit         = order.LeastUnit;
                    newBatch.Unitnum      = order.UnitNum;
                    newBatch.ValidityDate = order.ValidityDate;
                    BindEntity <YP_Batch> .CreateInstanceDAL(oleDb, BLL.Tables.YK_BATCH).Add(newBatch);
                }
                //如果是批次表中的药品,增加批次表中药品数量
                else
                {
                    if (order.InNum > 0)
                    {
                        oldBatch.Currentnum = oldBatch.Currentnum + order.InNum;
                        oldBatch.Del_flag   = 0;
                    }
                    else
                    {
                        if (oldBatch.Currentnum + order.InNum < 0)
                        {
                            string drugName = "药品名称:" + DrugBaseDataBll.GetDurgName(order.MakerDicID);
                            string batchNum = " 批次号:" + order.BatchNum;
                            throw new Exception(drugName + batchNum + " 退库数量过多,无法退库");
                        }
                        else
                        {
                            oldBatch.Currentnum = oldBatch.Currentnum + order.InNum;
                            if (oldBatch.Currentnum == 0)
                            {
                                oldBatch.Del_flag = 1;
                            }
                        }
                    }
                    BindEntity <YP_Batch> .CreateInstanceDAL(oleDb, BLL.Tables.YK_BATCH).Update(oldBatch);
                }
            }
        }