private void CreateStockIn(DepartmentInventoryChecking checking)
 {
     IDictionary<Product, long> productList =
         (IDictionary<Product, long>) Flow.Session.Get(FlowConstants.TEMP_VALID_SELECTED_STOCK_IN_LIST);
     if (productList.Count == 0) return;
     int stockInType = 3; // 3: STOCK IN FOR COMPENSATE IN CHECKING
     Department mainStock = DepartmentLogic.FindById(0);
     CoralPOS.Models.StockIn stockIn = StockInHelper.Create(
                             mainStock,
                             productList,
                             "processChecking",
                             DateTime.Now,
                             "Stock in for unexist items in stock",
                             stockInType,
                             0);
     // populate the price for stock in
     PopulatePrice(stockIn);
     // save stock in
     StockInLogic.Add(stockIn);
     // create stock out from stock in
     if (checking.Department.DepartmentId > 0)
     {
         StockDefinitionStatus definitionStatus = StockDefinitionStatusLogic.FindById(DefinitionStatus.DESTROY_LOST_AND_DAMAGE);
         CoralPOS.Models.StockOut stockOut = StockOutHelper.From(stockIn, checking.Department, definitionStatus, 0, "Stock out from " + stockIn.Description);
         StockOutLogic.Add(stockOut);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Saves the evaluation result.
 /// </summary>
 /// <returns></returns>
 private object SaveEvaluationResult()
 {
     var saveResult = from dto in StockInventoryList.OfType<DepartmentStockTempValidDTO>()
                      from stv in dto.DepartmentStockTempValids
                      select stv;
     DepartmentInventoryChecking checking = new DepartmentInventoryChecking
                                                {
                                                    DepartmentInventoryId = DateTime.Now.Ticks,
                                                    CreateDate = DateTime.Now,
                                                    CreateId = "admin",
                                                    UpdateDate = DateTime.Now,
                                                    UpdateId = "admin",
                                                    DelFlg = 0,
                                                    ExclusiveKey = 0,
                                                    Description = Description,
                                                    Fixed = 0,
                                                    ExFld2 = 0,
                                                    ExFld3 = 0,
                                                    ExFld4 = "",
                                                    ExFld5 = "",
                                                    Department = SelectedDepartment
                                                };
     List<DepartmentStockTempValid> list = saveResult.ToList();
     foreach (DepartmentStockTempValid tempValid in saveResult)
     {
         tempValid.DepartmentInventoryChecking = checking;
     }
     DepartmentStockTempValidLogic.AddBatch(list);
     MessageBox.Show("Save successfully !");
     Reset();
     return 0;
 }
 public void SaveInventoryChecking(DepartmentInventoryChecking checking)
 {
     DepartmentInventoryChecking currChecking = DepartmentInventoryCheckingDao.FindById(checking.DepartmentInventoryId);
     if (checking.ExFld2 != currChecking.ExFld2)
     {
         currChecking.ExFld2 = checking.ExFld2;
         currChecking.UpdateDate = DateTime.Now;
         currChecking.UpdateId = "admin";
         currChecking.StockInList = checking.StockInList;
         currChecking.StockOutList = checking.StockOutList;
     }
     DepartmentInventoryCheckingDao.Update(currChecking);
 }
 public IList<DepartmentStockTempValid> LoadDepartmentStockTempValid(DepartmentInventoryChecking checking)
 {
     return (IList<DepartmentStockTempValid>) DepartmentStockTempValidDao.Execute((session) =>
                                                                                      {
                                                                                          var rs = session.Query<DepartmentStockTempValid>();
                                                                                          var list = from valid in rs.Fetch(x=>x.Product).ThenFetch(x=>x.ProductMaster)
                                                                                                     where valid.DepartmentInventoryChecking.DepartmentInventoryId == checking.DepartmentInventoryId && valid.Fixed ==0
                                                                                                     select valid    ;
                                                                                          return list.ToList();
                                                                                      });
 }
        private void CreateStockOut(DepartmentInventoryChecking checking)
        {
            IDictionary<Product, long> productExportList =
                (IDictionary<Product, long>)Flow.Session.Get(FlowConstants.TEMP_VALID_SELECTED_STOCK_OUT_LIST);
            if (productExportList.Count == 0) return;
            if (checking.Department.DepartmentId > 0) // department id > 0
            {
                // write instructions for department do stock out automatically

            }
            else
            {
                StockDefinitionStatus definitionStatus = StockDefinitionStatusLogic.FindById(DefinitionStatus.DESTROY_LOST_AND_DAMAGE);
                string description = "Stock out from extra products in stock";
                CoralPOS.Models.StockOut stockOut = StockOutHelper.Create(
                                                            checking.Department,
                                                            productExportList,
                                                            "processChecking",
                                                            DateTime.Now,
                                                            definitionStatus,
                                                            description,
                                                            0);

                StockOutLogic.Add(stockOut);
            }
        }
        private string CreateStockOut(DepartmentInventoryChecking checking, IList<DepartmentStockTempValid> exportList)
        {
            // write instructions for department do stock out
            IDictionary<Product, long> productExportList = new Dictionary<Product, long>();
            foreach (DepartmentStockTempValid tempValid in exportList)
            {
                productExportList.Add(tempValid.Product, tempValid.Quantity - tempValid.GoodQuantity);
            }

            Flow.Session.Put(FlowConstants.TEMP_VALID_SELECTED_STOCK_OUT_LIST, productExportList);
            StringBuilder builder = new StringBuilder();
            foreach (KeyValuePair<Product, long> pair in productExportList)
            {
                builder.Append("OUT=" + pair.Key.ProductId + "," + pair.Value.ToString());
                builder.Append("\r\n");
            }

            return builder.ToString();
        }
 /// <summary>
 /// Initializes this instance.
 /// </summary>
 protected override void OnInitialize()
 {
     StockInventoryList = new ArrayList();
     EvaluationList = new ArrayList();
     FromDate = ToDate = DateTime.Now;
     SelectedEvaluationKey = new DepartmentInventoryChecking();
     TempValidDTO = new DepartmentStockTempValidDTO();
 }