public ServerMessage DataMethod(RfidCollections data)
        {
            var message = new ServerMessage();
            var action  = string.Empty;

            message = bll.DataMethod(data, ref action);
            var    newRfidCollections = bll.whereRfidCollections(data.rfidKey);
            string actionName         = string.Empty;

            if (string.IsNullOrEmpty(newRfidCollections.specialAction))
            {
                actionName = newRfidCollections.Action.ToUpper();
            }
            else
            {
                actionName = newRfidCollections.specialAction.ToUpper();
            }
            if ((actionName.StartsWith("IN") || actionName.StartsWith("OUT")) && newRfidCollections.stockLocTo == 6 && message.Code == 0)
            {
                actionName = actionName.StartsWith("OUT") ? "出库" : "入库";
                chat.Clients.All.setInputBinStock(new { binCode = bll.whereBinCode(newRfidCollections.stockBinTo), action = actionName, time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
            }
            SendPull(message.Code, data.stockFromStr);
            return(message);
        }
        public ActionResult EditSaveCogMethod(RfidCollections data)
        {
            data.Code = bll.getCode(data.Code);
            ServerMessage msg = new DataInteraction().DataMethod(data);

            return(Json(new { success = true, message = JsonConvert.SerializeObject(msg) }, JsonRequestBehavior.AllowGet));
        }
Exemple #3
0
        public ServerMessage 取料()
        {
            RfidCollections jsonData = new RfidCollections()
            {
                rfidKey = "SH00-1102-B001-SHDPRack01--03",
                Code    = Code,
            };

            return(client.DataMethod(jsonData));
        }
Exemple #4
0
        public bool 空箱返回()
        {
            RfidCollections jsonData = new RfidCollections()
            {
                Action   = "5",
                Empty_pt = "KX001",
                Code     = Code,
            };

            client.DataMethod(jsonData);
            return(true);
        }
Exemple #5
0
        public ServerMessage 绑定()
        {
            RfidCollections jsonData = new RfidCollections()
            {
                Exidv   = "001",
                Matnr   = "001",
                rfidKey = "SH00-1102-B001-SHDPRack01--05",
                Code    = Code
            };

            return(client.DataMethod(jsonData));
        }
Exemple #6
0
        public ServerMessage 解绑()
        {
            //Assert.AreEqual(230, 230);

            RfidCollections jsonData = new RfidCollections()
            {
                Code    = "A001",
                rfidKey = "SH00-1102-B001---01"
            };

            ;
            return(client.DataMethod(jsonData));
        }
Exemple #7
0
        public ServerMessage DataMethod(RfidCollections rfidKey, ref string action)
        {
            var    megInfo    = new ServerMessage();
            string message    = string.Empty;
            var    acionGroup = string.Empty;
            var    dataObj    = new RfidCollections();

            try
            {
                //var data = JsonConvert.DeserializeObject<RfidCollections>(jsonData);
                AbsRfidCollections <RfidCollections> abs = new RunRfidCollections_DAL(rfidKey);
                dataObj = abs.GetData();
                //action = abs.GetAction().ToLower();
                acionGroup = this.SqlQueryOne <string>(" select actionGroup from rfidinfo where rfidKey=@rfidKey", new { rfidKey = rfidKey.rfidKey });//查询方法组

                if (string.IsNullOrEmpty(acionGroup))
                {
                    message = "0,successfully";
                }
                else
                {
                    if (abs.GetAction().Equals("131"))
                    {
                        message = "0,successfully";
                    }
                    else
                    {
                        message = RunActionGroup(abs, acionGroup, rfidKey.specialAction);
                    }
                }

                if (abs.GetERP() != null && message.StartsWith("0"))
                {
                    SapncoClient client = new SapncoClient();
                    client.RegisterRfcDestination();
                    var    sapCreateDate = DateTime.Now;
                    SAPLog sapLog        = new SAPLog()
                    {
                        Zsjno = sapCreateDate.ToString("yyyyMMddHHmmss") + abs.GetData().Exidv, Ztype = abs.GetData().ecp, Werks = abs.GetData().plantToStr, Zpltn = abs.GetData().assLine, Zpoint = abs.GetData().linePoint, Matnr = abs.GetData().Matnr, Exidv = abs.GetData().Exidv, ZlgortOri = abs.GetData().stockFromStr, ZlgortTar = abs.GetData().stockToStr, qty = rfidKey.qty.ToString(), Created = sapCreateDate.ToString("yyyy-MM-dd HH:mm:ss")
                    };
                    SAPLog ret = client.InvokeRFCFunctionRFID(sapLog);
                    sapLogger(ret);
                    if (sapLog.M_TYPE.Contains("E"))
                    {
                        //return new ServerMessage() { Code = 1, Msg = "SAP ERROR" };
                    }
                }
            }
            catch
            {
                megInfo.Code = 1;
                megInfo.Msg  = "Data Error";
            }
            var msg = string.IsNullOrEmpty(message) ? new string[2] {
                "1", "Data Handle Error"
            } : message.Split(',');
            //插入处理记录
            var svc = new ServerMessage()
            {
                Code = int.Parse(msg[0]), Msg = msg[1]
            };

            dataObj.CodeInt = svc.Code;
            dataObj.Msg     = svc.Msg;
            var acionArray = acionGroup.Split(',').ToList();

            if (!string.IsNullOrEmpty(rfidKey.specialAction))
            {
                if (!acionArray.Contains(rfidKey.specialAction.ToLower()))
                {
                    dataObj.Action = rfidKey.specialAction.ToUpper();
                }
            }
            this.SqlExecute <int>("insert into Operation(rfidKey,action,plantTo,stockTo,binTo,plantFrom,stockFrom,binFrom,matnr,exidv,recordTime,processingState,messageHints) values(@Code,@Action,@plantTo,@stockLocTo,@stockBinTo,@plantFrom,@stockLocFrom,@stockBinFrom,@Matnr,@Exidv,now(),@CodeInt,@Msg)", dataObj);
            return(svc);
        }
Exemple #8
0
 public ServerMessage DataMethod(RfidCollections data, ref string action)
 {
     return(dal.DataMethod(data, ref action));
 }