Exemple #1
0
        private bool createMoving(long shipmentId)
        {
            var document = new Moving();
            document.SetRef("PickingPlan", shipmentId);
            document.Date = DateTime.Now;

            var q = DB.NewQuery(@"select Nomenclature, sum(Quantity) [Quantity], min(LineNumber) LineNumber
            from SubShipmentPlanNomenclatureInfo
            where IdDoc = @IdDoc
            group by Nomenclature
            order by LineNumber");
            q.AddInputParameter("IdDoc", shipmentId);
            var docTable = document.NomenclatureInfo;
            q.Foreach(qResult =>
                {
                    var nomenclarute = Convert.ToInt64(qResult["Nomenclature"]);
                    var quantity = Convert.ToDecimal(qResult["Quantity"]);

                    var docRow = docTable.GetNewRow(document);
                    docRow[document.Nomenclature] = nomenclarute;
                    docRow[document.PlanValue] = quantity;
                    docRow[document.RowState] = RowsStates.PlannedPicking;
                    docRow.AddRowToTable(document);
                });

            var result = document.Write();

            return result == WritingResult.Success;
        }
Exemple #2
0
        public bool GetNewMovementId(out long documentId)
        {
            var doc = new Moving();
            doc.SetRef("Responsible", getUserId());
            doc.Date = SystemConfiguration.ServerDateTime;
            doc.SetRef("Responsible", getUserId());
            var writeResult = doc.Write();

            documentId = doc.Id;
            return writeResult == WritingResult.Success;
        }