5 using System.Collections.Generic;
37 #endregion Constructor 45 _ReadOnly = _ReadOnly || _oDocLin._Solo_Lectura;
63 string lcSql =
string.Empty;
66 lcSql =
"SELECT EMPRESA,space(2) as LETRA,NUMERO,FECHA,ARTICULO,LINIA,LOTE,UNIDADES, " +
67 " PERIODO,ALMACEN,CADUCIDAD,UBICA,FECHA2,PESO, " +
68 " TALLA,COLOR,ASI, " +
69 " UNIDADES AS UNIASIG, 0.00000000000 AS UNI2, PESO AS PESASIG, 0.00000000000 AS PES2, " +
70 " cast(1 as bit) as SEL, cast(0 as bit) as AJENO, cast(0 as bit) as REGULA, space(80) as ORIGEN, 0.00000000000 AS COSTE " +
71 "FROM " + DB.SQLDatabase(
"LOTES",
"LTDTRAN") +
" " +
72 " WHERE PERIODO = " + DB.SQLString(_cPeriodo) +
" " +
73 " AND EMPRESA = " + DB.SQLString(_oDocLin._Empresa) +
74 " AND NUMERO = " + DB.SQLString(_oDocLin._Numero) +
75 " AND LINIA = " + DB.SQLString(_oDocLin._LineaReal);
77 DB.SQLExec(lcSql, ref _oDataTable);
86 string lcSql =
string.Empty;
88 string lcOn = EW_GLOBAL._Consolida(
"a.EMPRESA",
true,
false);
91 lcSql =
"SELECT a.LOTE, a.CADUCIDAD, a.UNIDADES, a.PESO, a.UBICA, a.TALLA, a.COLOR, " +
92 " 0.00000000000 AS UNIASIG,0.00000000000 AS PESASIG, 0.00000000000 AS UNI2, 0.00000000000 AS PES2, space(20) as ASI, " +
93 " cast(0 as bit) as SEL, cast(0 as bit) as AJENO, cast(0 as bit) as REGULA, space(80) as ORIGEN, 0.00000000000 AS COSTE " +
94 "FROM " + DB.SQLDatabase(
"LOTES",
"STOCKLOTES") +
" a " +
95 " LEFT JOIN " + DB.SQLDatabase(
"LOTES",
"LTDTRAN") +
" b " +
97 " AND a.ALMACEN = b.ALMACEN " +
98 " AND a.ARTICULO = b.ARTICULO " +
99 " AND a.LOTE = b.LOTE " +
100 " AND a.UBICA = b.UBICA " +
101 " AND a.TALLA = b.TALLA " +
102 " AND a.COLOR = b.COLOR " +
103 " AND b.NUMERO = " + DB.SQLString(_oDocLin._Numero) +
104 " AND b.LINIA = " + DB.SQLString(_oDocLin._LineaReal) +
106 " AND a.TALLA = " + DB.SQLString(_oDocLin._Talla) +
107 " AND a.COLOR = " + DB.SQLString(_oDocLin._Color) +
108 " AND a.ARTICULO = " + DB.SQLString(_oDocLin._Articulo) +
109 " AND a.ALMACEN = " + DB.SQLString(_oDocLin._Almacen) +
110 " AND a.FECHA <= " + DB.SQLString(_oDocLin._Fecha) +
111 " AND b.LOTE = null " +
112 " AND b.UBICA = null ";
114 DB.SQLExec(lcSql, ref tdtStockLote);
123 return _oLotesConfig._SinMov_Ltdtran;
132 string lcSql =
" AND PERIODO = " + DB.SQLString(_cPeriodo) +
" " +
133 " AND EMPRESA = " + DB.SQLString(_oDocLin._Empresa) +
" " +
134 " AND NUMERO = " + DB.SQLString(_oDocLin._Numero) +
" " +
135 " AND LINIA = " + DB.SQLString(_oDocLin._LineaReal) +
" " +
136 " AND LOTE = " + DB.SQLString(toDetCodigo.
_Codigo) +
" " +
137 " AND UBICA = " + DB.SQLString(toDetCodigo.
_Ubicacion) +
" " +
138 " AND TALLA = " + DB.SQLString(toDetCodigo.
_Talla) +
" " +
139 " AND COLOR = " + DB.SQLString(toDetCodigo.
_Color) +
" ";
141 _dOldCreated = Convert.ToDateTime(DB.SQLValor(
"LTDTRAN",
"1=1 " + lcSql +
" AND '' ",
"",
"CREATED",
"LOTES"));
143 lcSql =
"DELETE FROM " + DB.SQLDatabase(
"LOTES",
"LTDTRAN") +
" WHERE 1=1 " + lcSql;
154 string lcSql =
string.Empty;
156 lcSql =
"INSERT INTO " + DB.SQLDatabase(
"LOTES",
"LTDTRAN") +
" " +
157 "(EMPRESA,NUMERO,FECHA,ARTICULO,LINIA,LOTE,UNIDADES,PERIODO,ALMACEN,CADUCIDAD,UBICA,FECHA2,PESO,TALLA,COLOR,ASI" +
158 (_dOldCreated == DateTime.MinValue ?
"" :
",CREATED") +
161 DB.SQLString(_oDocLin._Empresa) +
", " +
162 DB.SQLString(_oDocLin._Numero) +
", " +
163 DB.SQLString(_oDocLin._Fecha) +
", " +
164 DB.SQLString(_oDocLin._Articulo) +
", " +
165 DB.SQLString(_oDocLin._LineaReal) +
", " +
166 DB.SQLString(toDetCodigo.
_Codigo) +
", " +
167 DB.SQLString(toDetCodigo.
_Unidades) +
", " +
168 DB.SQLString(_cPeriodo) +
", " +
169 DB.SQLString(_oDocLin._Almacen) +
", " +
172 DB.SQLString(DateTime.Now) +
", " +
173 DB.SQLString(toDetCodigo.
_Peso) +
", " +
174 DB.SQLString(_oDocLin._Talla) +
", " +
175 DB.SQLString(_oDocLin._Color) +
", " +
176 DB.SQLString(toDetCodigo.
_Asi) +
" " +
177 (_dOldCreated == DateTime.MinValue ?
"" :
", " + DB.SQLString(_dOldCreated)) +
189 return _oDocLin._NombreArticulo;
199 if (_oLotesConfig._Coste_Lote)
201 DataTable dtLotesDeLaLinea =
new DataTable();
202 if (_Obtener_Detalle(toLinea, ref dtLotesDeLaLinea) && dtLotesDeLaLinea.Rows.Count > 0)
204 decimal costes = 0.0M;
205 var detalleLotes = dtLotesDeLaLinea.AsEnumerable().Where(loEle => !
string.IsNullOrWhiteSpace(loEle.Field<
string>(
"CODIGO"))).ToList();
207 if (detalleLotes.Any())
209 var totalUnidades = decimal.Zero;
211 foreach (var item
in detalleLotes)
213 var codigoLote = item.Field<
string>(
"CODIGO").TrimEnd();
214 var unidades = item.Field<decimal>(
"UNIDADES");
216 totalUnidades += unidades;
217 costes += (costeUnitario * unidades);
221 toLinea.
_Coste = costes / (totalUnidades != 0 ? totalUnidades : 1);
253 toDic.Add(
"_privateUnidades", tnValor);
266 toDic.Add(
"_privatePeso", tnValor);
289 #region IStockExtRegulari 304 lcSql =
"Delete From " + DB.SQLDatabase(
"LOTES",
"LTDTRAN") +
305 " Where empresa = " + DB.SQLString(toLinea.
_Empresa) +
306 " And numero = " + DB.SQLString(toLinea.
_Numero) +
307 " And linia = " + DB.SQLString(toLinea.
_LineaReal) +
308 " And periodo = " + DB.SQLString(_cPeriodo);
310 llOk = DB.SQLExec(lcSql);
350 bool llGestionEspecial =
false;
361 if (toValue == null) this._ReadOnly =
true;
364 if ((toValue is Boolean && (
bool)toValue ==
false) || this._ReadOnly)
365 _Iniciar_Asignacion_Lotes(toLinea,
false);
367 _Iniciar_Asignacion_Lotes(toLinea,
true);
369 tcMensajeError = _Error_Message;
370 llGestionEspecial =
true;
377 return llGestionEspecial;
387 string lcSql =
"Update " + DB.SQLDatabase(
"LOTES",
"LTDTRAN") +
388 " Set fecha = " + DB.SQLString(toLinea.
_Fecha) +
389 " Where empresa = " + DB.SQLString(toLinea.
_Empresa) +
390 " And numero = " + DB.SQLString(toLinea.
_Numero) +
391 " And linia = " + DB.SQLString(toLinea.
_Linea) +
392 " And periodo = " + DB.SQLString(_cPeriodo);
410 string lcSql = String.Empty;
412 lcSql =
"SELECT LOTE AS CODIGO, UNIDADES, PESO " +
413 "FROM " + DB.SQLDatabase(
"LOTES",
"LTDTRAN") +
" " +
414 "WHERE EMPRESA = " + DB.SQLString(toLinea.
_Empresa) +
415 " AND NUMERO = " + DB.SQLString(toLinea.
_Numero) +
416 " AND LINIA = " + DB.SQLString(toLinea.
_LineaReal) +
417 " AND PERIODO = " + DB.SQLString(_cPeriodo);
418 llOk = DB.SQLExec(lcSql, ref tdtResultados);
433 bool llCondicion =
false;
437 llCondicion = llCondicion || teCampo ==
eCampoDocumentLinea.Talla && !String.IsNullOrWhiteSpace(toLinea.
_Talla) && String.Compare(toLinea.
_Talla, (
string)toValue) != 0;
438 llCondicion = llCondicion || teCampo ==
eCampoDocumentLinea.Color && !String.IsNullOrWhiteSpace(toLinea.
_Color) && String.Compare(toLinea.
_Color, (
string)toValue) != 0;
445 string lcDef = Convert.ToString(EW_GLOBAL._GetVariable(
"wc_deflote"));
447 tcMensajeRespuesta =
"No se permite modificar el artículo, trabaja con " + lcDef +
". " + Environment.NewLine +
448 "Pruebe a borrar el artículo e introducir uno de nuevo.";
476 #endregion IStockExtRegulari
Clase para controlar toda la gestion de venta de un lote/ubicacion de artículo
Clase para la gestión de los lotes
string _Talla
Codigo de la talla
Interficie mínima de las líneas (Mantener lo mas reducida posible)
eCampoDocumentLinea
Definición del enumerado de los campos de una linea de documento
Nullable< DateTime > _Caducidad
Fecha de caducidad del lote (Accepta NULL)
Interficie para operaciones extendidas de fabricación
string _Color
Codigo de color
string _Codigo
Código de lote asociado
decimal _Peso
Peso asignado a la venta
string _Ubicacion
Código de la ubicación
Definición de la interfície necesaria para los objetos de documento utilizados en el formulario FormD...
string _Asi
Asi del registro
int _LineaReal
Devuelve el campo linia: para todos los documentos sera el mismo valor que la linea pero en el docume...
decimal _Unidades
Unidades asignadas a la venta