Esempio n. 1
0
 internal void save(XapDataList <CiOrderDO> dataSource, string[] id_ors)
 {
     try
     {
         List <string> id_deletes = new List <string>();
         for (int i = dataSource.Count - 1; i >= 0; i--)
         {
             CiOrderDO ciOrderDO = dataSource[i];
             if (ciOrderDO.Eu_uncpordoctorjudge == 0)
             {
                 ciOrderDO.Eu_uncporjudge = (int)HpIndicJudgeEnum.WAITINGJUDGE;
             }
             else if (ciOrderDO.Eu_uncpordoctorjudge == 1)
             {
                 ciOrderDO.Eu_uncporjudge = (int)HpIndicJudgeEnum.JUDGED;
             }
             else if (ciOrderDO.Eu_uncpordoctorjudge == 2)
             {
                 id_deletes.Add(ciOrderDO.Id_or);
                 dataSource.Remove(ciOrderDO);
             }
         }
         ICiOrdMaintainService mainService = XapServiceMgr.find <ICiOrdMaintainService>();
         mainService.saveCporCheckReport(dataSource, id_deletes.ToArray());
         //if (id_deletes.Count > 0)
         //{
         //    mainService.relDeleteOrder(id_deletes.ToArray());
         //}
         //if (dataSource.Count > 0)
         //{
         //    ICiorderMDOCrudService orderService = XapServiceMgr.find<ICiorderMDOCrudService>();
         //    orderService.save(dataSource);
         //}
     }
     catch (Exception ex) {
         ex.Publish();
     }
 }
Esempio n. 2
0
        public void setEmsOrDrugList(XapDataList <EmsOrDrug> list)
        {
            lock (this) {
                IMaterialStockService stoctService = XapServiceMgr.find <IMaterialStockService>();
                List <GetStockReqDTO> reqDtos      = new List <GetStockReqDTO>();
                if (emsOrDrugList == null)
                {
                    emsOrDrugList = new XapDataList <EmsOrDrug>();
                }
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].Fg_mm == true)
                    {
                        GetStockReqDTO reqDTO = new GetStockReqDTO();
                        reqDTO.Id_mm       = list[i].Id_mm;
                        reqDTO.Id_dep      = list[i].Id_dep_wh;
                        reqDTO.Req_unit_id = list[i].Id_unit_sale;
                        reqDtos.Add(reqDTO);
                    }
                }
                if (reqDtos.Count > 0)
                {
                    MaterialStockDTO[] stockdto = null;
                    try
                    {
                        stockdto = stoctService.getMaterialStocks(reqDtos.ToArray());
                    }
                    catch (Exception ex)
                    {
                        ex.Publish();
                        //this.ShowInfo(ex.Message);
                    }
                    if (stockdto == null)
                    {
                        return;
                    }
                    for (int i = list.Count - 1; i >= 0; i--)
                    {
                        MaterialStockDTO materialDo = stockdto.FirstOrDefault(p => p.Id_mm == list[i].Id_mm);
                        if (materialDo != null)
                        {
                            FDouble mmcount  = materialDo.Quan_stock;
                            int?    mmStatus = materialDo.Mmstatus;
                            //药房无此药的移除
                            if (mmStatus != null && mmStatus == (int)MaterialStatus.NORELATION)
                            {
                                list.RemoveAt(i);
                            }
                            else
                            {
                                list[i].Fact_count = mmcount;
                                list[i].Price      = materialDo.Price_act;
                                list[i].Mmstatus   = materialDo.Mmstatus;

                                EmsOrDrug ems = emsOrDrugList.FirstOrDefault(p => p.Id_mm == list[i].Id_mm);
                                if (ems != null)
                                {
                                    emsOrDrugList.Remove(ems);
                                }
                                emsOrDrugList.Add(list[i]);
                            }
                        }
                    }
                    List <EmsOrDrug> sortList = null;
                    try
                    {
                        sortList = emsOrDrugList.OrderByDescending(p => p.Fact_count).OrderBy(p => p.Mmstatus).ToList();
                    }
                    catch //(Exception e)
                    {
                        // e.Message;
                    }

                    if (emsOrDrugList == null)
                    {
                        emsOrDrugList = new XapDataList <EmsOrDrug>();
                    }
                    else
                    {
                        emsOrDrugList.Clear();
                    }
                    sortList.ForEach(p => emsOrDrugList.Add(p));
                }
            }
        }