Пример #1
0
        /// <summary>
        /// 通过条码查询相对应的产品信息
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string Create(HttpContext context)
        {
            try
            {
                string _EqID       = context.Request["EqID"].Trim();
                string _BARCODE    = context.Request["BARCODE"].Trim();
                string _LNO        = context.Request["LNO"].Trim();
                string _Storehouse = context.Request["Storehouse"].Trim();
                string _LOGINNAM   = context.Request["LOGINNAM"].Trim();
                string _ENAM       = context.Request["ENAM"].Trim();
                string _FAC        = context.Request["FAC"].Trim();
                //限制只能扫描镂空条码
                if (_BARCODE.Length != 11)
                {
                    return(JsonHelper <Messaging <string> > .EntityToJson(new Messaging <string>("444", "请扫描镂空硫化条码!")));
                }
                //软控货架验证

                /*string mess = new MESNACMESDal().GetShelfInfo(_BARCODE);
                 * if (!string.IsNullOrWhiteSpace(mess))
                 * {
                 *   return JsonHelper<Messaging<string>>.EntityToJson(new Messaging<string>("444", mess));
                 * }*/
                //验证软控报警胎
                string _alarm = new LogisticsLaunchVerificationDal().ALARM(_BARCODE);
                if (!string.IsNullOrWhiteSpace(_alarm))
                {
                    return(JsonHelper <Messaging <string> > .EntityToJson(new Messaging <string>("444", _alarm)));
                }
                //MES综合验证
                string strMes = dal.GetScanShelfChecking(_LNO, _BARCODE, _LOGINNAM, _FAC, _ENAM, _Storehouse);
                if (!string.IsNullOrEmpty(strMes))
                {
                    return(JsonHelper <Messaging <string> > .EntityToJson(new Messaging <string>("444", strMes)));
                }
                //如果多个货架为空优先使用最新的
                string newLNO = dal.GetNewestLnoNum(_EqID.Trim());
                if (!string.IsNullOrWhiteSpace(newLNO))
                {
                    _LNO = newLNO;
                }
                QMB0101 qmb0101 = new QMB0101Dal().GetByModel(_BARCODE);
                STC0009 stc0009 = dal.GetBySTC0009Model(qmb0101.ITNBR, _EqID, _level);
                //同一个规格默认装载一个货笼
                if (!string.IsNullOrWhiteSpace(stc0009.LNO))
                {
                    _LNO = stc0009.LNO;
                }
                else
                {
                    string derLno = dal.GetFirstCargoASC(_EqID);
                    if (!string.IsNullOrEmpty(derLno))
                    {
                        _LNO = derLno;
                    }
                }
                STC0009 stc9 = new STC0009
                {
                    BARCODE    = qmb0101.BARCODE,
                    DBRES      = qmb0101.DBRES,
                    Grade      = qmb0101.QCSTATE,
                    ITDSC      = qmb0101.ITDSC,
                    ITNBR      = qmb0101.ITNBR,
                    LEVEL      = _level,
                    LNO        = _LNO,
                    LOGINNAM   = _LOGINNAM,
                    Storehouse = _Storehouse,
                    TyreNo     = qmb0101.TYRENO,
                    EQUIPID    = _EqID
                };
                if (dal.Create(stc9))
                {
                    dal.DeleteCage(stc9.LNO, stc9.EQUIPID, _level);
                    return(JsonHelper <Messaging <STC0009> > .EntityToJson(new Messaging <STC0009>("0", xml.ReadLandXml("0"), dal.GetDataList(stc9.LNO, stc9.EQUIPID, _level))));
                }
                else
                {
                    return(JsonHelper <Messaging <string> > .EntityToJson(new Messaging <string>("2", "轮胎上架货笼失败!")));
                }
            }
            catch (Exception ex)
            {
                SystemErrorPlug.ErrorRecord(ex.ToString());
                return(JsonHelper <Messaging <string> > .EntityToJson(new Messaging <string>("500", ex.Message.ToString().Trim().Replace("\r\n", ""))));
            }
        }