示例#1
0
        public static void UpdateStatusReleased(T41Entity two, ProductionOrders prd)
        {
            principal.GravaAudit("Inicia OP Liberado");
            using (var rs = new MyRecordSet())
            {
                principal.GravaAudit("Pesquisa OP " + two.OWOR_DocNum);
                if (prd.GetByKey(two.OWOR_DocNum))
                {
                    principal.GravaAudit("Acho OP");
                    prd.ProductionOrderStatus = BoProductionOrderStatusEnum.boposReleased;
                }

                int ii = prd.Update();

                if (ii != 0)
                {
                    principal.GravaAudit("Erro " + MyLibs.v2.sbo.SAPConnection.DI.GetLastErrorDescription());
                }
                else
                {
                    principal.GravaAudit("Atualizado para liberado com sucesso");
                }
            }
            principal.GravaAudit("termino OP Liberado");
        }
        } // RecibirProductoTerminado

        private void CerrarOrdenFabricacion(int docEntry)
        {
            ProductionOrders order = (ProductionOrders)company.GetBusinessObject(BoObjectTypes.oProductionOrders);
            if (order.GetByKey(docEntry))
            {
                order.ProductionOrderStatus = BoProductionOrderStatusEnum.boposClosed;

                if (order.Update() != 0)
                {
                    raiseError();
                }
            }

        } // CerrarOrdenFabricacion
示例#3
0
        public static Result CancelDocument(int docEntry, int entryID, int exitID)
        {
            var              result           = new Result();
            Documents        oStockEntry      = null;
            Documents        oStockExit       = null;
            ProductionOrders oProductionOrder = null;

            try {
                Parallel.Invoke(
                    () => {
                    oProductionOrder = (ProductionOrders)DIApplication.Company.GetBusinessObject(BoObjectTypes.oProductionOrders);      //OWOR
                    oProductionOrder.GetByKey(docEntry);
                },
                    () => {
                    oStockEntry = (Documents)DIApplication.Company.GetBusinessObject(BoObjectTypes.oInventoryGenEntry);      //OIGN
                    oStockEntry.GetByKey(entryID);
                },
                    () => {
                    oStockExit = (Documents)DIApplication.Company.GetBusinessObject(BoObjectTypes.oInventoryGenExit);      //OIGE
                    oStockExit.GetByKey(exitID);
                });


                oProductionOrder.ProductionOrderStatus = BoProductionOrderStatusEnum.boposClosed;
                oProductionOrder.UserFields.Fields.Item("U_GLO_DocNum").Value    = oStockEntry.DocNum;
                oProductionOrder.UserFields.Fields.Item("U_GLO_DocNumSal").Value = oStockExit.DocNum;

                if (oProductionOrder.Update() != 0)
                {
                    LogService.WriteError("TransferDI (Draft) " + DIApplication.Company.GetLastErrorDescription());
                    result.Success = false;
                    result.Message = "Error: " + DIApplication.Company.GetLastErrorDescription();
                }
                else
                {
                    result.Success = true;
                    result.Message = String.Format("La Orden de Producción#{0} se cerro con éxito!", oProductionOrder.DocumentNumber);
                }
            }

            catch (Exception ex) {
                HandleException(ex, "StockEntryDI.CreateDocument", ref result);
            }
            finally {
                MemoryUtility.ReleaseComObject(oProductionOrder);
            }

            return(result);
        }
        private int CrearOrden(ElaboracionPartidaVO itemVO, String codigoAlmacen)
        {
            int docEntry = -1;
            ProductionOrders order = (ProductionOrders)company.GetBusinessObject(BoObjectTypes.oProductionOrders);

            order.Warehouse = codigoAlmacen;
            order.ItemNo = itemVO.itemCode;
            order.DueDate = DateTime.Today;
            order.PlannedQuantity = itemVO.cantidad;
            String referencia = "Generado desde el Portal";
            order.Remarks = referencia;
            order.JournalRemarks = referencia;

            if (order.Add() == 0)
            {
                string strDocEntry = company.GetNewObjectKey();
                docEntry = int.Parse(strDocEntry);

                order.GetByKey(docEntry);
                order.ProductionOrderStatus = BoProductionOrderStatusEnum.boposReleased;
                this.resultadoVO.DocNum = order.DocumentNumber;

                this._docEntryOf = strDocEntry;
                this._docNumOf = order.DocumentNumber.ToString();

                for (int i = 0; i < order.Lines.Count; i++)
                {
                    order.Lines.SetCurrentLine(i);
                    order.Lines.Warehouse = codigoAlmacen;
                }

                if (order.Update() != 0)
                {
                    raiseError();
                }
            }
            else
            {
                raiseError();
            }

            return docEntry;
        } // CrearOrden
示例#5
0
        public static void UpdateLineOP(T41Entity two, ProductionOrders prd)
        {
            try
            {
                using (var rs = new MyRecordSet())
                {
                    try
                    {
                        principal.GravaAudit("Inicio remove linhas OP");
                        string sql1 = "delete from WOR1 where docentry = " + two.OWOR_DocNum + "and ItemType = 4 ";

                        rs.DoQuery(sql1);
                        principal.GravaAudit("Termino remove linhas OP ");
                    }
                    catch (Exception ex)
                    {
                        principal.GravaAudit("EX " + ex.Message.ToString());
                        principal.GravaAudit("Continua");
                    }

                    string sql = "Select distinct T1.DocEntry, T3.ItemCode, 'PP' As 'ProductionWarehouse', ConsumptionQuantity , T0.OItm_CodeBars, T0.OWor_DocNum from [Sage_Transaction41] T0 ";
                    sql += "left join OWOR T1 on T1.U_ORDER_JOMAR = T0.OWOR_Order_Jomar and T1.Type = 'S'";
                    sql += "left join OITM T3 on T3.CodeBars = T0.OITM_CodeBars ";
                    sql += "left join ITT1 T2 on T2.Code = T3.ItemCode and T2.Type = 4 ";
                    sql += "where T0.OWOR_Order_Jomar = '" + two.OWOR_U_ORDER_JOMAR + "' and readySAP <> 'Y' ";

                    principal.GravaAudit("Inicio add linhas OP");
                    principal.GravaAudit(sql);
                    rs.DoQuery(sql);

                    int a  = 0;
                    int ii = 0;
                    while (rs.HasNext())
                    {
                        if (prd.GetByKey(rs.GetFieldValue(0).ToInt()))
                        {
                            principal.GravaAudit("Item " + rs.GetFieldValue(1).ToString());
                            principal.GravaAudit("PlannedQuantity " + rs.GetFieldValue(3).ToDouble().ToString());
                            principal.GravaAudit("Warehouse " + rs.GetFieldValue(2).ToString());
                            principal.GravaAudit("U_Line_Jomar " + two.OWOR_U_ORDER_JOMAR);

                            prd.Lines.Add();
                            prd.Lines.ItemNo          = rs.GetFieldValue(1).ToString();
                            prd.Lines.ItemType        = ProductionItemType.pit_Item;
                            prd.Lines.PlannedQuantity = rs.GetFieldValue(3).ToDouble();
                            //prd.Lines.BaseQuantity = rs.GetFieldValue(0).ToInt();
                            prd.Lines.Warehouse = rs.GetFieldValue(2).ToString();
                            prd.Lines.UserFields.Fields.Item("U_Line_Jomar").Value = two.OWOR_U_ORDER_JOMAR;
                            ii = prd.Update();
                        }
                    }

                    principal.GravaAudit("Termino add linhas OP");


                    if (ii != 0)
                    {
                        principal.GravaAudit("Erro " + MyLibs.v2.sbo.SAPConnection.DI.GetLastErrorDescription());
                    }
                    else
                    {
                        two.ReadBySAP = 'Y';
                        UpdateStatus41(two);
                        principal.GravaAudit("Concluido com sucesso");
                    }
                }
            }
            catch (Exception ex)
            {
                principal.GravaAudit("Erro " + ex.Message.ToString());
            }
        }