Esempio n. 1
0
        public override void CheckSemantic(Scope scope, ErrorLog log)
        {
            if (Attributes != null)
            {
                foreach (var attr in Attributes)
                {
                    attr.CheckSemantic(scope, log);
                }
            }

            Scope functionScope = new Scope(scope)
            {
                CurrentFunction = this
            };

            if (Parameters != null)
            {
                for (int i = 0; i < Parameters.Length; i++)
                {
                    var p = Parameters[i];
                    p.Position = i;
                    p.Function = this;
                    p.CheckSemantic(functionScope, log);
                }
            }

            ReturnType = ReturnTypeInfo.GetTypeDeclaration(scope, log);
            Body.CheckSemantic(functionScope, log);
            IsChecked = true;
        }
Esempio n. 2
0
        public static bool SaveReturnType(ReturnTypeInfo param)
        {
            string sql = string.Format(@"IF EXISTS(SELECT 1 FROM dbo.ReturnType WHERE ZPRDNR = '{0}' AND ZCOLSN = '{1}')
BEGIN
	UPDATE dbo.ReturnType SET THTYPE = '{2}' WHERE ZPRDNR = '{0}' AND ZCOLSN = '{1}'
END
ELSE
BEGIN
	INSERT INTO dbo.ReturnType( ZPRDNR, ZCOLSN, THTYPE, Timestamps )
	VALUES  ( '{0}', '{1}', '{2}', GETDATE())
END", param.ZPRDNR, param.ZCOLSN, param.THTYPE);

            return(DBHelper.ExecuteNonQuery(sql) > 0);
        }
        internal bool TryConvert(ref object value)
        {
            if (value == null)
            {
                return(!ReturnTypeInfo.IsValueType || ReturnTypeInfo.IsGenericType && ReturnTypeInfo.GetGenericTypeDefinition() == typeof(Nullable <>));
            }

            Type valueType = value.GetType();
            Type type      = ReturnType;

            // Dont support arbitrary IConvertible by limiting which types can use this
            Type[]        convertableTo;
            TypeConverter typeConverterTo;

            if (SimpleConvertTypes.TryGetValue(valueType, out convertableTo) && Array.IndexOf(convertableTo, type) != -1)
            {
                value = Convert.ChangeType(value, type);
            }
            else if (WellKnownConvertTypes.TryGetValue(type, out typeConverterTo) && typeConverterTo.CanConvertFrom(valueType))
            {
                value = typeConverterTo.ConvertFromInvariantString(value.ToString());
            }
            else if (!ReturnTypeInfo.IsAssignableFrom(valueType.GetTypeInfo()))
            {
                // Is there an implicit cast operator ?
                MethodInfo cast = type.GetRuntimeMethod("op_Implicit", new[] { valueType });
                if (cast != null && cast.ReturnType != type)
                {
                    cast = null;
                }
                if (cast == null)
                {
                    cast = valueType.GetRuntimeMethod("op_Implicit", new[] { valueType });
                }
                if (cast != null && cast.ReturnType != type)
                {
                    cast = null;
                }
                if (cast == null)
                {
                    return(false);
                }

                value = cast.Invoke(null, new[] { value });
            }

            return(true);
        }
Esempio n. 4
0
        internal bool TryConvert(ref object value)
        {
            if (value == null)
            {
                return(!ReturnTypeInfo.IsValueType || ReturnTypeInfo.IsGenericType && ReturnTypeInfo.GetGenericTypeDefinition() == typeof(Nullable <>));
            }

            Type valueType = value.GetType();
            Type type      = ReturnType;

            // TODO This is temporary fix before deleting CreateByXaml flag in BindableProperty.
            if (valueType.IsGenericType && valueType.GetGenericTypeDefinition() == typeof(Tizen.NUI.BaseComponents.Selector <>) && valueType.GetGenericArguments()[0] == ReturnType)
            {
                return(true);
            }

            // Dont support arbitrary IConvertible by limiting which types can use this
            Type[]        convertableTo;
            TypeConverter typeConverterTo;

            if (SimpleConvertTypes.TryGetValue(valueType, out convertableTo) && Array.IndexOf(convertableTo, type) != -1)
            {
                value = Convert.ChangeType(value, type);
            }
            else if (WellKnownConvertTypes.TryGetValue(type, out typeConverterTo) && typeConverterTo.CanConvertFrom(valueType))
            {
                value = typeConverterTo.ConvertFromInvariantString(value.ToString());
            }
            else if (UserCustomConvertTypes.TryGetValue(type, out typeConverterTo) && typeConverterTo.CanConvertFrom(valueType))
            {
                //Modification for NUI XAML : user defined converter for DynamicResource can be added
                value = typeConverterTo.ConvertFromInvariantString(value.ToString());
            }
            else if (!ReturnTypeInfo.IsAssignableFrom(valueType.GetTypeInfo()))
            {
                var cast = type.GetImplicitConversionOperator(fromType: valueType, toType: type)
                           ?? valueType.GetImplicitConversionOperator(fromType: valueType, toType: type);

                if (cast == null)
                {
                    return(false);
                }

                value = cast.Invoke(null, new[] { value });
            }

            return(true);
        }
Esempio n. 5
0
        public static List <ReturnTypeInfo> GetAllReturnType()
        {
            string                sql    = @"SELECT * FROM dbo.ReturnType";
            DataTable             dt     = DBHelper.GetTable(sql, false);
            List <ReturnTypeInfo> result = new List <ReturnTypeInfo>();

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    ReturnTypeInfo item = ReturnTypeInfo.BuildReturnType(row);
                    result.Add(item);
                }
            }
            return(result);
        }
Esempio n. 6
0
        public static List <ReturnTypeInfo> getReturnType(string pin, string se)
        {
            try
            {
                string                sql    = string.Format(@"SELECT * FROM dbo.ReturnType where ZPRDNR='{0}' and ZCOLSN='{1}'", pin, se);
                DataTable             dt     = DBHelper.GetTable(sql, false);
                List <ReturnTypeInfo> result = new List <ReturnTypeInfo>();
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        ReturnTypeInfo item = ReturnTypeInfo.BuildReturnType(row);
                        result.Add(item);
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLine(ex.ToString());
            }

            return(null);
        }
Esempio n. 7
0
        internal bool TryConvert(ref object value)
        {
            if (value == null)
            {
                return(!ReturnTypeInfo.IsValueType || ReturnTypeInfo.IsGenericType && ReturnTypeInfo.GetGenericTypeDefinition() == typeof(Nullable <>));
            }

            Type valueType = value.GetType();
            Type type      = ReturnType;

            // Dont support arbitrary IConvertible by limiting which types can use this
            if (SimpleConvertTypes.TryGetValue(valueType, out Type[] convertibleTo) && Array.IndexOf(convertibleTo, type) != -1)
Esempio n. 8
0
        public override HLACommonView.Model.CheckResult CheckData()
        {
            HLACommonView.Model.CheckResult result = new HLACommonView.Model.CheckResult();
            if (btnStart.Enabled)
            {
                result.UpdateMessage("未开始检货");
                result.InventoryResult = false;
            }
            else
            {
                if (errorEpcNumber > 0)
                {
                    result.UpdateMessage(EPC_WEI_ZHU_CE);
                    result.InventoryResult = false;
                }
                if (mainEpcNumber != addEpcNumber && addEpcNumber > 0)
                {
                    result.UpdateMessage(TWO_NUMBER_ERROR);
                    result.InventoryResult = false;
                }
                if (boxNoList.Count > 0)
                {
                    boxNoList.Clear();
                    result.UpdateMessage(XIANG_MA_BU_YI_ZHI);
                    result.InventoryResult = false;
                }
                if (string.IsNullOrEmpty(lblHu.Text.Trim()))
                {
                    result.UpdateMessage(WEI_SAO_DAO_XIANG_MA);
                    result.InventoryResult = false;

                    string hu = LocalDataService.GetNewErrorHu(SysConfig.DeviceNO);
                    Invoke(new Action(() =>
                    {
                        lblHu.Text = hu;
                    }));
                }

                if (epcList.Count == 0)
                {
                    result.UpdateMessage(WEI_SAO_DAO_EPC);
                    result.InventoryResult = false;
                }
                else
                {
                    //判断是否重投
                    object lastResult = GetLastCheckResult(lblHu.Text);
                    if (lastResult != null && lastResult.ToString().ToUpper() == "S")
                    {
                        //上次检测结果为正常,

                        bool isAllSame    = true;
                        bool isAllNotSame = true;
                        List <PBBoxDetailInfo> lastCheckDetail = GetBoxDetailByHU(lblHu.Text);
                        if (lastCheckDetail != null && lastCheckDetail.Count > 0)
                        {
                            if (lastCheckDetail.Count != epcList.Count)
                            {
                                isAllSame = false;
                            }
                            foreach (PBBoxDetailInfo item in lastCheckDetail)
                            {
                                if (!epcList.Contains(item.EPC))
                                {
                                    isAllSame = false;
                                    break;
                                }
                                else
                                {
                                    isAllNotSame = false;
                                }
                            }
                        }
                        else
                        {
                            isAllSame    = false;
                            isAllNotSame = true;
                        }

                        if (isAllSame)
                        {
                            result.IsRecheck = true;
                            //result.InventoryResult = false;
                        }
                        else if (isAllNotSame)
                        {
                            //两批EPC对比,完全不一样,示为箱码重复使用
                            result.UpdateMessage(XIANG_MA_CHONG_FU_SHI_YONG);
                            result.InventoryResult = false;
                        }

                        if (lastCheckDetail.Count > 0 && !isAllSame && !isAllNotSame)
                        {
                            result.UpdateMessage(EPC_YI_SAO_MIAO);
                            result.InventoryResult = false;
                        }
                    }
                    else
                    {
                        if (ExistsSameEpc())
                        {
                            result.UpdateMessage(EPC_YI_SAO_MIAO);
                            result.InventoryResult = false;
                        }
                        //判断是否只有一个SKU
                        if (IsOneSku())
                        {
                            if (tagDetailList != null && tagDetailList.Count > 0)
                            {
                                TagDetailInfo  tag = tagDetailList.First();
                                ReturnTypeInfo rt  = null;

                                if (cboLh.Text.ToUpper() == "TH")
                                {
                                    if (tag.LIFNRS?.Count > 1)
                                    {
                                        result.UpdateMessage(Consts.Default.JIAO_JIE_HAO_BU_YI_ZHI);
                                        result.InventoryResult = false;
                                    }
                                    else
                                    {
                                        lifnr = tag.LIFNRS?.FirstOrDefault();
                                    }
                                }

                                if (returnTypeList != null)
                                {
                                    rt = returnTypeList.Find(i => i.ZPRDNR == tag.ZSATNR && i.ZCOLSN == tag.ZCOLSN_WFG);
                                }

                                MaterialInfo material = materialList.Find(i => i.MATNR == tag.MATNR);
                                int          pxqty    = 0;

                                if (material != null)
                                {
                                    if (material.PUT_STRA == "ADM1")
                                    {
                                        pxqty = material.PXQTY;
                                    }
                                    else
                                    {
                                        pxqty = material.PXQTY_FH;
                                    }
                                }

                                if (IsUseBoxStandard())
                                {
                                    //按箱规收货
                                    if (pxqty != mainEpcNumber)
                                    {
                                        result.UpdateMessage(BU_FU_HE_XIANG_GUI + string.Format("({0})", pxqty));
                                        result.InventoryResult = false;
                                    }
                                    else
                                    {
                                        IsFull = true;
                                    }
                                }
                                else
                                {
                                    if (pxqty < mainEpcNumber)
                                    {
                                        result.UpdateMessage(SHU_LIANG_DA_YU_XIANG_GUI);
                                        result.InventoryResult = false;
                                    }
                                }

                                if (rt == null || string.IsNullOrEmpty(rt.THTYPE) || (rt.THTYPE.ToUpper() != "TH02" && rt.THTYPE.ToUpper() != "TH03"))
                                {
                                    //退货类型为空值
                                    List <AuthInfo> auth = authList != null?authList.FindAll(i => i.AUTH_VALUE_DES == material.PUT_STRA) : null;

                                    if (material != null)
                                    {
                                        if (auth != null)
                                        {
                                            if (!auth.Exists(i => i.AUTH_VALUE == cboLh.Text))
                                            {
                                                string authPrint = "";
                                                auth.ForEach(i => {
                                                    authPrint += i.AUTH_VALUE + ",";
                                                });
                                                if (authPrint.EndsWith(","))
                                                {
                                                    authPrint = authPrint.Remove(authPrint.Length - 1, 1);
                                                }
                                                result.UpdateMessage(LOU_HAO_BU_FU + string.Format("({0})", authPrint));
                                                result.InventoryResult = false;
                                            }
                                        }
                                        else
                                        {
                                            result.UpdateMessage(LOU_HAO_BU_FU);
                                            result.InventoryResult = false;
                                        }
                                    }
                                }
                                else
                                {
                                    if (rt.THTYPE.ToUpper() == "TH02" || rt.THTYPE.ToUpper() == "TH03")
                                    {
                                        if (!lhList.Exists(i => i.Lh == cboLh.Text && i.ReturnType == rt.THTYPE))
                                        {
                                            List <LhInfo> l  = lhList.FindAll(i => i.ReturnType == rt.THTYPE);
                                            string        lh = "";
                                            if (l != null && l.Count > 0)
                                            {
                                                l.ForEach(i => {
                                                    lh += i.Lh + ",";
                                                });

                                                if (lh.EndsWith(","))
                                                {
                                                    lh = lh.Remove(lh.Length - 1, 1);
                                                }
                                            }
                                            result.UpdateMessage(LOU_HAO_BU_FU + string.Format("({0})", lh));
                                            result.InventoryResult = false;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            result.UpdateMessage(DUO_GE_SHANG_PIN);
                            result.InventoryResult = false;
                        }
                    }
                }
            }


            if (result.IsRecheck || result.InventoryResult)
            {
                result.UpdateMessage(result.IsRecheck ? CHONG_TOU : RIGHT);
                SetInventoryResult(1);
            }
            else
            {
                SetInventoryResult(3);
            }
            return(result);
        }