Exemplo n.º 1
0
        //手机补充库存
        public ResultObj <int> PutStockWithMobile([FromBody] List <TunnelInfoModel> lstTunnelInfo)
        {
            if (lstTunnelInfo.Count < 1)
            {
                return(Content(0));
            }

            if (!MachineHelper.IsOnline(lstTunnelInfo[0].MachineId))
            {
                return(Content(0));
            }

            IFullfilBill ifullfilBill = new TunnelInfoService();
            int          result       = ifullfilBill.UpdateStockWithMobile(lstTunnelInfo);

            if (result == 1)
            {
                List <CommandModel> lstCommand = new List <CommandModel>();
                lstCommand.Add(new CommandModel()
                {
                    Content = lstTunnelInfo[0].MachineId,
                    Size    = 12
                });
                foreach (TunnelInfoModel tunnel in lstTunnelInfo)
                {
                    lstCommand.Add(new CommandModel()
                    {
                        Content = tunnel.TunnelId,
                        Size    = 5
                    });
                    lstCommand.Add(new CommandModel()
                    {
                        Content = (tunnel.CurrStock > 10?tunnel.CurrStock.ToString():"0" + tunnel.CurrStock.ToString()),
                        Size    = 2
                    });
                }

                SocketHelper.GenerateCommand(12, 13 + lstTunnelInfo.Count * 7, 83, lstCommand);
            }
            return(Content(result));
        }