Пример #1
0
        /// <summary>
        /// 通过条码查询相对应的产品信息
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string Create(HttpContext context)
        {
            try
            {
                string  _barcode    = context.Request["BARCODE"] as string;
                string  _LNO        = context.Request["LNO"] as string;
                string  _Storehouse = context.Request["Storehouse"] as string;
                string  _LOGINNAM   = context.Request["LOGINNAM"] as string;
                string  _ENAM       = context.Request["ENAM"] as string;
                string  _BARCODE    = _barcode.Trim();
                string  LNO         = _LNO.Trim();
                string  Storehouse  = _Storehouse.Trim();
                string  LOGINNAM    = _LOGINNAM.Trim();
                string  ENAM        = _ENAM.Trim();
                WIP0010 model       = new WIP0010Dal().GetEntityById(_BARCODE);
                if (string.IsNullOrEmpty(model.BARCODE))
                {
                    //扫描异常轮胎报警
                    //dal.CallPolice(_BARCODE, ENAM, LOGINNAM, Storehouse);
                    return(JsonHelper <Messaging <string> > .EntityToJson(new Messaging <string>("2", "该条码信息的轮胎不在车间库存中!")));
                }
                if (dal.CheckSTC0017BarCode(model.BARCODE.Trim()) > 0)
                {
                    return(JsonHelper <Messaging <string> > .EntityToJson(new Messaging <string>("2", "该条码已经扫描上架!")));
                }

                if (dal.CheckUpCage17(LNO) > 0)
                {
                    return(JsonHelper <Messaging <string> > .EntityToJson(new Messaging <string>("2", "货笼已经使用!")));
                }
                if (model.LOCKYN == "Y")
                {
                    return(JsonHelper <Messaging <string> > .EntityToJson(new Messaging <string>("2", "该条码信息的轮胎在库存中已经锁定!")));
                }
                if (model.STA != "1")
                {
                    return(JsonHelper <Messaging <string> > .EntityToJson(new Messaging <string>("2", "该条码信息的轮胎在库存中处于、不良、保留或者报废状态!")));
                }

                QMB0101 qmb0101 = new QMB0101Dal().GetByModel(model.BARCODE);
                if (qmb0101.QCSTATE.Trim() == "1")
                {
                    return(JsonHelper <Messaging <string> > .EntityToJson(new Messaging <string>("2", "该条码信息的轮胎是合格品,无法上架操作!")));
                }
                int barCodeCount = dal.GetBarCodeCount(model.BARCODE);
                if (barCodeCount > 0)
                {
                    STC0009 stc09 = dal.GetBySTC0009(model.BARCODE, LOGINNAM, _level);
                    return(JsonHelper <Messaging <string> > .EntityToJson(new Messaging <string>("2", "该条码信息的轮胎已经在[" + stc09.LNO + "]货架上!")));
                }
                int count = dal.GetCount(LNO, model.ITNBR, "", _level);
                int num   = dal.GetCargoCageQuantity(model.ITNBR);
                if (0 != num)
                {
                    if (count > num)
                    {
                        return(JsonHelper <Messaging <string> > .EntityToJson(new Messaging <string>("2", "该货笼已经达到最大装胎数量,无法在装笼操作!")));
                    }
                }
                else
                {
                    num = 30;
                    if ("03" == model.FAC || "01" == model.FAC)
                    {
                        num = 9;
                    }
                    if (count > num)
                    {
                        return(JsonHelper <Messaging <string> > .EntityToJson(new Messaging <string>("2", "该货笼已经达到最大装胎数量,无法在装笼操作!")));
                    }
                }

                STC0009 stc9 = new STC0009
                {
                    BARCODE    = model.BARCODE,
                    DBRES      = qmb0101.DBRES,
                    Grade      = qmb0101.QCSTATE,
                    ITDSC      = model.ITDSC,
                    ITNBR      = model.ITNBR,
                    LEVEL      = _level,
                    LNO        = LNO,
                    LOGINNAM   = LOGINNAM,
                    Storehouse = Storehouse,
                    TyreNo     = qmb0101.TYRENO,
                    QRCode     = "",
                    RfidCode   = ""
                };
                if (dal.Create(stc9))
                {
                    dal.DeleteCage(stc9.LNO, stc9.LOGINNAM, _level);
                    return(JsonHelper <Messaging <STC0009> > .EntityToJson(new Messaging <STC0009>("0", xml.ReadLandXml("0"), dal.GetDataList(LNO, LOGINNAM, _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", ""))));
            }
        }