Ejemplo n.º 1
0
        /// <summary>
        /// 删除申请单
        /// </summary>
        /// <param name="billID">主键KEY</param>
        public override void DeleteBill(int billID)
        {
            DS_ApplyHead inHead = (DS_ApplyHead)NewObject <DS_ApplyHead>().getmodel(billID);

            if (inHead.AuditFlag == 1)
            {
                throw new Exception("当前单据已经审核,无法删除");
            }
            else
            {
                inHead.DelFlag = 1;
                inHead.save();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 保存药房入库单
        /// </summary>
        /// <typeparam name="THead">药房入库单表头模板</typeparam>
        /// <typeparam name="TDetail">药房入库单明细模板</typeparam>
        /// <param name="billHead">药房入库单表头</param>
        /// <param name="billDetails">药房入库单明细</param>
        public override void SaveBill <THead, TDetail>(THead billHead, List <TDetail> billDetails)
        {
            DS_ApplyHead          inHead   = billHead as DS_ApplyHead;
            List <DS_ApplyDetail> inDetals = billDetails as List <DS_ApplyDetail>;

            inHead.RegTime = System.DateTime.Now;
            string serialNO = NewObject <SerialNumberSource>().GetSerialNumber(SnType.药品, inHead.ApplyDeptID, DGConstant.OP_DS_APPLYPLAN);

            inHead.BillNO = Convert.ToInt64(serialNO);
            BindDb(inHead);
            inHead.save();
            if (inHead.ApplyHeadID > 0)
            {
                foreach (DS_ApplyDetail detail in inDetals)
                {
                    detail.ApplyHeadID = inHead.ApplyHeadID;
                    BindDb(detail);
                    detail.save();
                }
            }
        }
Ejemplo n.º 3
0
        public ServiceResponseData SaveBillFromApply()
        {
            string                   belongSys     = requestData.GetData <string>(0);
            string                   busiType      = requestData.GetData <string>(1);
            IDGBill                  iProcess      = NewObject <DGBillFactory>().GetBillProcess(busiType);
            DGBillResult             result        = new DGBillResult();
            DW_OutStoreHead          head          = requestData.GetData <DW_OutStoreHead>(2);
            List <DW_OutStoreDetail> details       = requestData.GetData <List <DW_OutStoreDetail> >(3);
            List <int>               deleteDetails = requestData.GetData <List <int> >(4);

            oleDb.BeginTransaction();
            try
            {
                foreach (int detailID in deleteDetails)
                {
                    NewObject <DW_OutStoreDetail>().delete(detailID);
                }

                iProcess.SaveBill(head, details);
                DS_ApplyHead applyHead = (DS_ApplyHead)NewObject <DS_ApplyHead>().getmodel(head.ApplyHeadId);
                applyHead.OutStoreHeadID = head.OutStoreHeadID;
                applyHead.AuditFlag      = 1;
                applyHead.AuditEmpID     = LoginUserInfo.EmpId;
                applyHead.AuditEmpName   = LoginUserInfo.EmpName;
                applyHead.AuditTime      = DateTime.Now;
                applyHead.save();

                foreach (var s in details)
                {
                    DS_ApplyDetail detailApply = NewObject <DS_ApplyDetail>().getlist <DS_ApplyDetail>("ApplyHeadId = " + applyHead.ApplyHeadID + " and DrugID=" + s.DrugID + " and BatchNO= '" + s.BatchNO + " '").FirstOrDefault();
                    if (detailApply != null)
                    {
                        detailApply.FactAmount = s.Amount;
                        detailApply.save();
                    }
                }

                Basic_SystemConfig config = NewObject <IDGDao>().GetDeptParameters(head.DeptID, "AutoAuditOutStore");
                if (config != null)
                {
                    //是否配置需要审核
                    if (config.Value == "1")
                    {
                        result = iProcess.AuditBill(head.OutStoreHeadID, LoginUserInfo.EmpId, LoginUserInfo.EmpName, LoginUserInfo.WorkId);
                    }
                }

                if (result.Result == 0)
                {
                    oleDb.CommitTransaction();
                }
                else
                {
                    oleDb.RollbackTransaction();
                }

                responseData.AddData(result);
            }
            catch (Exception error)
            {
                oleDb.RollbackTransaction();
                responseData.AddData(false);
                responseData.AddData(error.Message);
            }

            return(responseData);
        }